@@ -133,7 +133,7 @@ |
||
133 | 133 | */ |
134 | 134 | public function show(bool $show_simple = false) |
135 | 135 | { |
136 | - if ( $show_simple |
|
136 | + if ($show_simple |
|
137 | 137 | || !midcom::get()->auth->can_user_do('midcom:ajax', class: static::class)) { |
138 | 138 | $this->show_simple(); |
139 | 139 | return; |
@@ -272,7 +272,7 @@ |
||
272 | 272 | |
273 | 273 | private function add_head_elements(bool $centralized = false) : bool |
274 | 274 | { |
275 | - if ( !midcom::get()->auth->user |
|
275 | + if (!midcom::get()->auth->user |
|
276 | 276 | || !midcom::get()->config->get('toolbars_enable_centralized') |
277 | 277 | || !midcom::get()->auth->can_user_do('midcom:centralized_toolbar', class: __CLASS__)) { |
278 | 278 | return false; |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | if ($parent = $object->get_parent()) { |
120 | 120 | // Attachments are a special case |
121 | 121 | if ($object instanceof midcom_db_attachment) { |
122 | - if ( !$parent->can_do('midgard:attachments') |
|
122 | + if (!$parent->can_do('midgard:attachments') |
|
123 | 123 | || !$parent->can_do('midgard:update')) { |
124 | 124 | debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.", |
125 | 125 | MIDCOM_LOG_ERROR); |
126 | 126 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
127 | 127 | return false; |
128 | 128 | } |
129 | - } elseif ( !$parent->can_do('midgard:create') |
|
129 | + } elseif (!$parent->can_do('midgard:create') |
|
130 | 130 | && !midcom::get()->auth->can_user_do('midgard:create', class: get_class($object))) { |
131 | 131 | debug_add("Failed to create object, create privilege on the parent " . get_class($parent) . " {$parent->guid} or the actual object class not granted for the current user.", |
132 | 132 | MIDCOM_LOG_ERROR); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | // Default the owner to first group of current user |
241 | - if ( empty($object->metadata->owner) |
|
241 | + if (empty($object->metadata->owner) |
|
242 | 242 | && $first_group = midcom::get()->auth->user->get_first_group_guid()) { |
243 | 243 | $object->metadata->set('owner', $first_group); |
244 | 244 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public static function get_by_guid(midcom_core_dbaobject $object, string $guid) : bool |
464 | 464 | { |
465 | - if ( !midcom::get()->auth->admin |
|
465 | + if (!midcom::get()->auth->admin |
|
466 | 466 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) { |
467 | 467 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR); |
468 | 468 | return false; |
@@ -423,7 +423,8 @@ |
||
423 | 423 | */ |
424 | 424 | try { |
425 | 425 | return $object->get_by_id($object->id); |
426 | - } catch (Exception) { |
|
426 | + } |
|
427 | + catch (Exception) { |
|
427 | 428 | return false; |
428 | 429 | } |
429 | 430 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
47 | - if ( midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class) |
|
47 | + if (midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class) |
|
48 | 48 | && $this->group->can_do('midgard:create')) { |
49 | 49 | $buttons[] = $workflow->get_button($this->router->generate('person_new_group', ['guid' => $this->group->guid]), [ |
50 | 50 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $siteconfig = org_openpsa_core_siteconfig::get_instance(); |
56 | 56 | $user_url = $siteconfig->get_node_full_url('org.openpsa.user'); |
57 | - if ( $user_url |
|
57 | + if ($user_url |
|
58 | 58 | && midcom::get()->auth->can_user_do('org.openpsa.user:access', class: org_openpsa_user_interface::class)) { |
59 | 59 | $buttons[] = [ |
60 | 60 | MIDCOM_TOOLBAR_URL => $user_url . "group/{$this->group->guid}/", |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->add_breadcrumb('', $person->get_label()); |
26 | 26 | |
27 | 27 | $auth = midcom::get()->auth; |
28 | - if ( $person->guid == midcom::get()->auth->user->guid |
|
28 | + if ($person->guid == midcom::get()->auth->user->guid |
|
29 | 29 | || $auth->can_user_do('org.openpsa.user:manage', class: org_openpsa_user_interface::class)) { |
30 | 30 | $buttons = []; |
31 | 31 | $workflow = $this->get_workflow('datamanager'); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $delete_workflow = $this->get_workflow('delete', ['object' => $person]); |
39 | 39 | $buttons[] = $delete_workflow->get_button($this->router->generate('user_delete', ['guid' => $person->guid])); |
40 | 40 | } |
41 | - if ( $data['account']->get_username() |
|
41 | + if ($data['account']->get_username() |
|
42 | 42 | && $person->can_do('midgard:privileges')) { |
43 | 43 | $buttons[] = $workflow->get_button($this->router->generate('user_privileges', ['guid' => $person->guid]), [ |
44 | 44 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("permissions"), |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if ($this->_config->get('sales_pdfbuilder_class')) { |
86 | - if ( $this->_salesproject->can_do('midgard:update') |
|
86 | + if ($this->_salesproject->can_do('midgard:update') |
|
87 | 87 | && $this->is_pdf_creatable()) { |
88 | 88 | $workflow = $this->get_workflow('datamanager'); |
89 | 89 | $buttons[] = $workflow->get_button($this->router->generate('create_offer', ['guid' => $this->_salesproject->guid]), [ |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | case 'ordered': |
205 | 205 | if ($deliverable->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
206 | 206 | $entries = $deliverable->get_at_entries(); |
207 | - if ( $entries |
|
207 | + if ($entries |
|
208 | 208 | && $entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
209 | 209 | && midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class)) { |
210 | 210 | return '<button class="run_cycle"><i class="fa fa-refresh"></i>' . $this->_l10n->get('generate now') . '</button>'; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'delivered': |
217 | - if ( $deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
217 | + if ($deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
218 | 218 | && midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class)) { |
219 | 219 | $client_class = $this->_config->get('calculator'); |
220 | 220 | $client = new $client_class(); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function configureOptions(OptionsResolver $resolver) : void |
24 | 24 | { |
25 | - $map_attr = function (Options $options, $value) { |
|
25 | + $map_attr = function(Options $options, $value) { |
|
26 | 26 | $value ??= []; |
27 | 27 | $value['rows'] = $options['widget_config']['height']; |
28 | 28 | $value['cols'] = $options['widget_config']['width']; |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - if ( empty($input) |
|
37 | - || ( $input instanceof DateTime |
|
36 | + if (empty($input) |
|
37 | + || ($input instanceof DateTime |
|
38 | 38 | && $input->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) { |
39 | 39 | return $result; |
40 | 40 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | throw new TransformationFailedException('Expected an array.'); |
60 | 60 | } |
61 | 61 | |
62 | - if ( empty($array['date']) |
|
63 | - || ( $array['date'] instanceof DateTime |
|
62 | + if (empty($array['date']) |
|
63 | + || ($array['date'] instanceof DateTime |
|
64 | 64 | && $array['date']->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) { |
65 | 65 | return null; |
66 | 66 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function setTargetUrl(string $url) : static |
29 | 29 | { |
30 | - if ( !str_starts_with($url, "/") |
|
30 | + if (!str_starts_with($url, "/") |
|
31 | 31 | && !preg_match('|^https?://|', $url)) { |
32 | 32 | $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) ?: '/'; |
33 | 33 | $url = $prefix . $url; |