@@ -102,7 +102,7 @@ |
||
102 | 102 | if (is_string($value)) { |
103 | 103 | $this->_headers[$header] = trim($value); |
104 | 104 | } |
105 | - if ( strtolower($header) == 'from' |
|
105 | + if (strtolower($header) == 'from' |
|
106 | 106 | || strtolower($header) == 'reply-to' |
107 | 107 | || strtolower($header) == 'to') { |
108 | 108 | $this->_headers[$header] = $this->_encode_address_field($value); |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | try { |
43 | 43 | $folder = midcom_db_topic::get_cached($this->topic); |
44 | - } catch (midcom_error $e) { |
|
44 | + } |
|
45 | + catch (midcom_error $e) { |
|
45 | 46 | $e->log(); |
46 | 47 | } |
47 | 48 | $folder->delete_attachment(self::FOLDER_THUMBNAIL); |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | { |
52 | 53 | try { |
53 | 54 | return new midcom_db_attachment($this->$type); |
54 | - } catch (midcom_error $e) { |
|
55 | + } |
|
56 | + catch (midcom_error $e) { |
|
55 | 57 | $e->log(); |
56 | 58 | return false; |
57 | 59 | } |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $rows = $mc->get_rows(['id', 'name', 'guid'], 'id'); |
151 | 151 | |
152 | 152 | foreach ($images as $image) { |
153 | - if ( !isset($rows[$image->attachment]) |
|
153 | + if (!isset($rows[$image->attachment]) |
|
154 | 154 | || !isset($rows[$image->image]) |
155 | 155 | || !isset($rows[$image->thumbnail])) { |
156 | 156 | continue; |
@@ -77,9 +77,9 @@ |
||
77 | 77 | $filter_id = $this->_identifier . '_' . $filtername; |
78 | 78 | $user = midcom::get()->auth->user->get_storage(); |
79 | 79 | |
80 | - if ( isset($_POST['unset_filter']) |
|
80 | + if (isset($_POST['unset_filter']) |
|
81 | 81 | && $_POST['unset_filter'] == $filter_id) { |
82 | - if ( $user->get_parameter("org_openpsa_core_filter", $filter_id) |
|
82 | + if ($user->get_parameter("org_openpsa_core_filter", $filter_id) |
|
83 | 83 | && !$user->delete_parameter("org_openpsa_core_filter", $filter_id)) { |
84 | 84 | $message_content = sprintf( |
85 | 85 | $l10n->get('the handed filter for %s could not be set as parameter'), |
@@ -55,7 +55,8 @@ |
||
55 | 55 | $guid = $parts[1]; |
56 | 56 | try { |
57 | 57 | $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
58 | - } catch (midcom_error $e) { |
|
58 | + } |
|
59 | + catch (midcom_error $e) { |
|
59 | 60 | $e->log(); |
60 | 61 | } |
61 | 62 | } |
@@ -40,31 +40,31 @@ |
||
40 | 40 | return $output; |
41 | 41 | } |
42 | 42 | |
43 | - /** |
|
44 | - * @param midcom_core_dbaobject $object The object we're working on |
|
45 | - * @param string $field The schema field name |
|
46 | - * @return midcom_db_attachment[] List of attachments, indexed by identifier |
|
47 | - */ |
|
48 | - public static function get_dm2_attachments($object, $field) : array |
|
49 | - { |
|
50 | - $attachments = []; |
|
51 | - $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); |
|
52 | - if (empty($identifiers)) { |
|
53 | - return $attachments; |
|
54 | - } |
|
55 | - foreach ($identifiers as $identifier) { |
|
56 | - $parts = explode(':', $identifier); |
|
57 | - if (count($parts) != 2) { |
|
58 | - continue; |
|
59 | - } |
|
60 | - $guid = $parts[1]; |
|
61 | - try { |
|
62 | - $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
|
63 | - } catch (midcom_error $e) { |
|
64 | - $e->log(); |
|
65 | - } |
|
66 | - } |
|
43 | + /** |
|
44 | + * @param midcom_core_dbaobject $object The object we're working on |
|
45 | + * @param string $field The schema field name |
|
46 | + * @return midcom_db_attachment[] List of attachments, indexed by identifier |
|
47 | + */ |
|
48 | + public static function get_dm2_attachments($object, $field) : array |
|
49 | + { |
|
50 | + $attachments = []; |
|
51 | + $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); |
|
52 | + if (empty($identifiers)) { |
|
53 | + return $attachments; |
|
54 | + } |
|
55 | + foreach ($identifiers as $identifier) { |
|
56 | + $parts = explode(':', $identifier); |
|
57 | + if (count($parts) != 2) { |
|
58 | + continue; |
|
59 | + } |
|
60 | + $guid = $parts[1]; |
|
61 | + try { |
|
62 | + $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
|
63 | + } catch (midcom_error $e) { |
|
64 | + $e->log(); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - return $attachments; |
|
69 | - } |
|
68 | + return $attachments; |
|
69 | + } |
|
70 | 70 | } |
@@ -35,7 +35,8 @@ |
||
35 | 35 | try { |
36 | 36 | midcom::get()->dbfactory->get_object_by_guid($param->name); |
37 | 37 | $tried[$param->name] = true; |
38 | - } catch (midcom_error $e) { |
|
38 | + } |
|
39 | + catch (midcom_error $e) { |
|
39 | 40 | $tried[$param->name] = false; |
40 | 41 | } |
41 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function merge($obj1, $obj2, $merge_mode) |
47 | 47 | { |
48 | - if ( $merge_mode !== 'all' |
|
48 | + if ($merge_mode !== 'all' |
|
49 | 49 | && $merge_mode !== 'future') { |
50 | 50 | debug_add("invalid mode {$merge_mode}", MIDCOM_LOG_ERROR); |
51 | 51 | throw new midcom_error('invalid merge mode'); |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | if (!empty($conf['duplicate_check'])) { |
88 | 88 | $dup = $this->check_duplicate($results, $result, $conf['duplicate_check']); |
89 | 89 | |
90 | - if ( is_object($dup) |
|
90 | + if (is_object($dup) |
|
91 | 91 | || $dup === false) { |
92 | - if ( !is_object($dup) |
|
92 | + if (!is_object($dup) |
|
93 | 93 | || !array_key_exists($dup->id, $todelete)) { |
94 | 94 | $todelete[$result->id] = $result; |
95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
101 | - if ( $needs_update |
|
101 | + if ($needs_update |
|
102 | 102 | && !$result->update()) { |
103 | 103 | throw new midcom_error("Failed to update {$classname} #{$result->id}, errstr: " . midcom_connection::get_error_string()); |
104 | 104 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | foreach ($results as $result) { |
150 | - if ( $result->$field === $object->$field |
|
150 | + if ($result->$field === $object->$field |
|
151 | 151 | && $result->id !== $object->id) { |
152 | 152 | return $result; |
153 | 153 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $changed = false; |
166 | 166 | foreach ($person2 as $property => $value) { |
167 | 167 | // Copy only simple properties not marked to be skipped missing from person1 |
168 | - if ( empty($person2->$property) |
|
168 | + if (empty($person2->$property) |
|
169 | 169 | || !empty($person1->$property) |
170 | 170 | || isset($skip_properties[$property]) |
171 | 171 | || !is_scalar($value)) { |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | midcom::get()->auth->request_sudo($this->_component); |
26 | 26 | try { |
27 | 27 | $person = new midcom_db_person($args['guid']); |
28 | - } catch (midcom_error $e) { |
|
28 | + } |
|
29 | + catch (midcom_error $e) { |
|
29 | 30 | $handler->print_error('Person with guid #' . $args['guid'] . ' does not exist'); |
30 | 31 | midcom::get()->auth->drop_sudo(); |
31 | 32 | return false; |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | $accounthelper = new org_openpsa_user_accounthelper($person); |
34 | 35 | try { |
35 | 36 | $accounthelper->reopen_account(); |
36 | - } catch (midcom_error $e) { |
|
37 | + } |
|
38 | + catch (midcom_error $e) { |
|
37 | 39 | $handler->print_error($e->getMessage()); |
38 | 40 | midcom::get()->auth->drop_sudo(); |
39 | 41 | return false; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function _on_created() |
64 | 64 | { |
65 | 65 | //Remove the resource if necessary |
66 | - if ( $this->type == self::DECLINED |
|
66 | + if ($this->type == self::DECLINED |
|
67 | 67 | && $this->targetPerson) { |
68 | 68 | $qb = org_openpsa_projects_task_resource_dba::new_query_builder(); |
69 | 69 | $qb->add_constraint('task', '=', $this->task); |
@@ -95,7 +95,8 @@ |
||
95 | 95 | org_openpsa_projects_workflow::accept($task, 0, $this->comment); |
96 | 96 | return; |
97 | 97 | } |
98 | - } catch (midcom_error $e) { |
|
98 | + } |
|
99 | + catch (midcom_error $e) { |
|
99 | 100 | $e->log(); |
100 | 101 | } |
101 | 102 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $status_changer_label = $this->l10n->get('system'); |
69 | 69 | $target_person_label = $this->l10n->get('system'); |
70 | 70 | |
71 | - if ( $status_change->metadata->creator |
|
71 | + if ($status_change->metadata->creator |
|
72 | 72 | && $status_change->metadata->creator != $fallback_creator->guid) { |
73 | 73 | $status_changer = org_openpsa_widgets_contact::get($status_change->metadata->creator); |
74 | 74 | $status_changer_label = $status_changer->show_inline(); |