@@ -63,7 +63,8 @@ |
||
63 | 63 | if ($group > 0) { |
64 | 64 | try { |
65 | 65 | $this->parent = new org_openpsa_products_product_group_dba($group); |
66 | - } catch (midcom_error $e) { |
|
66 | + } |
|
67 | + catch (midcom_error $e) { |
|
67 | 68 | $e->log(); |
68 | 69 | } |
69 | 70 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ]); |
39 | 39 | } |
40 | 40 | |
41 | - if ( $this->_article->topic === $this->_topic->id |
|
41 | + if ($this->_article->topic === $this->_topic->id |
|
42 | 42 | && $this->_article->can_do('midgard:delete')) { |
43 | 43 | $delete = $this->get_workflow('delete', ['object' => $this->_article]); |
44 | 44 | $buttons[] = $delete->get_button($this->router->generate('delete', ['guid' => $this->_article->guid])); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($this->_config->get('comments_enable')) { |
74 | 74 | if ($node = net_nehmer_comments_interface::get_node($this->_topic, $this->_config->get('comments_topic'))) { |
75 | 75 | $data['comments_url'] = $node[MIDCOM_NAV_RELATIVEURL] . "comment/{$this->_article->guid}/"; |
76 | - if ( $this->_topic->can_do('midgard:update') |
|
76 | + if ($this->_topic->can_do('midgard:update') |
|
77 | 77 | && $this->_topic->can_do('net.nehmer.comments:moderation')) { |
78 | 78 | net_nehmer_comments_viewer::add_head_elements(); |
79 | 79 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | private function apply_constraints(midcom_core_query $query, array $constraints) |
77 | 77 | { |
78 | 78 | foreach ($constraints as $key => $data) { |
79 | - if ( !array_key_exists('value', $data) |
|
79 | + if (!array_key_exists('value', $data) |
|
80 | 80 | || empty($data['field']) |
81 | 81 | || empty($data['op'])) { |
82 | 82 | debug_add("Constraint #{$key} is not correctly defined, skipping", MIDCOM_LOG_WARN); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $query = $this->request["term"]; |
139 | 139 | $wildcard_query = $query; |
140 | - if ( isset($this->request['auto_wildcards']) |
|
140 | + if (isset($this->request['auto_wildcards']) |
|
141 | 141 | && !str_contains($query, '%')) { |
142 | 142 | switch ($this->request['auto_wildcards']) { |
143 | 143 | case 'start': |
@@ -245,9 +245,7 @@ discard block |
||
245 | 245 | return $label; |
246 | 246 | } |
247 | 247 | } |
248 | - return midcom_helper_reflector::get($object)->get_object_label($object) ?: |
|
249 | - self::build_label($object, array_column($result_headers, 'name')) ?: |
|
250 | - $object::class . ' #' . $object->id; |
|
248 | + return midcom_helper_reflector::get($object)->get_object_label($object) ?: self::build_label($object, array_column($result_headers, 'name')) ?: $object::class . ' #' . $object->id; |
|
251 | 249 | } |
252 | 250 | |
253 | 251 | private static function build_label($object, array $fields) : string |
@@ -282,7 +280,7 @@ discard block |
||
282 | 280 | } |
283 | 281 | return self::sanitize_label($value); |
284 | 282 | } |
285 | - if ( $field == 'username' |
|
283 | + if ($field == 'username' |
|
286 | 284 | && $object instanceof midcom_db_person) { |
287 | 285 | $account = new midcom_core_account($object); |
288 | 286 | return self::sanitize_label($account->get_username()); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function get_object_name(?string $name_property = null) : ?string |
33 | 33 | { |
34 | 34 | $name_property ??= midcom_helper_reflector::get_name_property($this->_object); |
35 | - if ( empty($name_property) |
|
35 | + if (empty($name_property) |
|
36 | 36 | || !midcom_helper_reflector::get($this->_object)->property_exists($name_property)) { |
37 | 37 | // Could not resolve valid property |
38 | 38 | return null; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $qb->add_constraint($child_name_property, '=', $name); |
126 | 126 | if ($qb->count()) { |
127 | - debug_add("Name clash in sibling class {$schema_type} for " . $this->_object::class . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" ); |
|
127 | + debug_add("Name clash in sibling class {$schema_type} for " . $this->_object::class . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')"); |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } while (!$this->name_is_unique()); |
200 | 200 | |
201 | 201 | // Get a copy of the current, usable name |
202 | - $ret = (string)$this->_object->{$name_prop}; |
|
202 | + $ret = (string) $this->_object->{$name_prop}; |
|
203 | 203 | // Restore the original name |
204 | 204 | $this->_object->{$name_prop} = $original_name; |
205 | 205 | return $ret; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->object = $this->load_object($guid); |
48 | 48 | |
49 | - if ( !midcom::get()->config->get('midcom_services_rcs_enable') |
|
49 | + if (!midcom::get()->config->get('midcom_services_rcs_enable') |
|
50 | 50 | || !$this->object->_use_rcs) { |
51 | 51 | throw new midcom_error_notfound("Revision control not supported for " . $this->object::class . "."); |
52 | 52 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | throw new midcom_error_notfound("Revision {$args[1]} does not exist."); |
258 | 258 | } |
259 | 259 | |
260 | - $data['preview'] = array_filter($this->backend->get_revision($revision), function ($value, $key) { |
|
260 | + $data['preview'] = array_filter($this->backend->get_revision($revision), function($value, $key) { |
|
261 | 261 | return !is_array($value) |
262 | 262 | && !in_array($value, ['', '0000-00-00']) |
263 | 263 | && midcom_services_rcs::is_field_showable($key); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $this->object->require_do('midgard:update'); |
286 | 286 | // TODO: set another privilege for restoring? |
287 | 287 | |
288 | - if ( $this->backend->get_history()->version_exists($args[1]) |
|
288 | + if ($this->backend->get_history()->version_exists($args[1]) |
|
289 | 289 | && $this->backend->restore_to_revision($args[1])) { |
290 | 290 | midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.rcs'), sprintf($this->_l10n->get('restore to version %s successful'), $args[1])); |
291 | 291 | return new midcom_response_relocate($this->get_object_url()); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - if ( empty($link->toComponent) |
|
55 | + if (empty($link->toComponent) |
|
56 | 56 | && !empty($link->fromComponent)) { |
57 | 57 | debug_add("Setting property 'toComponent' to '{$component}'"); |
58 | 58 | $link->toComponent = $component; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $link->fromComponent = $component; |
62 | 62 | } |
63 | 63 | |
64 | - if ( empty($link->toGuid) |
|
64 | + if (empty($link->toGuid) |
|
65 | 65 | && !empty($link->fromGuid)) { |
66 | 66 | $link->toClass = $obj::class; |
67 | 67 | $link->toGuid = $obj->guid; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | // Get the calendar root event |
26 | 26 | if (class_exists('org_openpsa_calendar_interface')) { |
27 | - $field =& $schemadb->get('default')->get_field('calendar'); |
|
27 | + $field = & $schemadb->get('default')->get_field('calendar'); |
|
28 | 28 | $field['type_config']['privilege_object'] = org_openpsa_calendar_interface::find_root_event(); |
29 | 29 | $field['type_config']['assignee'] = 'user:' . $person->guid; |
30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | // Get the calendar root event |
26 | 26 | if (class_exists('org_openpsa_calendar_interface')) { |
27 | - $field =& $schemadb->get('default')->get_field('calendar'); |
|
27 | + $field = & $schemadb->get('default')->get_field('calendar'); |
|
28 | 28 | $field['type_config']['privilege_object'] = org_openpsa_calendar_interface::find_root_event(); |
29 | 29 | $field['type_config']['assignee'] = 'group:' . $group->guid; |
30 | 30 | } |
@@ -52,7 +52,8 @@ |
||
52 | 52 | try { |
53 | 53 | \midgard_object_class::get_object_by_guid($param->parentguid); |
54 | 54 | $seen[$param->parentguid] = true; |
55 | - } catch (\Throwable) { |
|
55 | + } |
|
56 | + catch (\Throwable) { |
|
56 | 57 | $seen[$param->parentguid] = false; |
57 | 58 | } |
58 | 59 | } |