@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | $state = $data['deliverable']->get_state(); |
4 | 4 | $formatter = $data['l10n']->get_formatter(); |
5 | 5 | $per_unit = $data['l10n']->get('per unit'); |
6 | -if ( $data['product'] |
|
6 | +if ($data['product'] |
|
7 | 7 | && $unit_option = org_openpsa_sales_viewer::get_unit_option($data['product']->unit)) { |
8 | 8 | $per_unit = sprintf($data['l10n']->get('per %s'), $unit_option); |
9 | 9 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | </div> |
110 | 110 | <?php |
111 | 111 | $tabs = []; |
112 | - if ( $data['invoices_url'] |
|
112 | + if ($data['invoices_url'] |
|
113 | 113 | && $data['deliverable']->invoiced > 0) { |
114 | 114 | $tabs[] = [ |
115 | 115 | 'url' => $data['invoices_url'] . "list/deliverable/{$data['deliverable']->guid}/", |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ]; |
118 | 118 | } |
119 | 119 | |
120 | - if ( $data['projects_url'] |
|
120 | + if ($data['projects_url'] |
|
121 | 121 | && $data['deliverable']->state >= org_openpsa_sales_salesproject_deliverable_dba::STATE_ORDERED |
122 | 122 | && $data['product'] |
123 | 123 | && $data['product']->orgOpenpsaObtype == org_openpsa_products_product_dba::TYPE_SERVICE) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | echo " </tbody>\n"; |
174 | 174 | echo "</table>\n"; |
175 | - if ( $at_entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
|
175 | + if ($at_entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
|
176 | 176 | && midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class)) { |
177 | 177 | $label = $data['l10n']->get('generate now'); |
178 | 178 | $process_link = $data['router']->generate('deliverable_run_cycle', ['guid' => $data['deliverable']->guid]); |
@@ -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; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | private array $_search = []; |
77 | 77 | |
78 | - public function __construct(array|client $source, string $datatype = 'json') |
|
78 | + public function __construct(array | client $source, string $datatype = 'json') |
|
79 | 79 | { |
80 | 80 | $this->_datatype = $datatype; |
81 | 81 | if ($source instanceof client) { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | private function _convert_to_localdata() : string |
204 | 204 | { |
205 | - return "var " . $this->_grid->get_identifier() . '_entries = ' . json_encode($this->get_rows()) . ";\n"; |
|
205 | + return "var " . $this->_grid->get_identifier() . '_entries = ' . json_encode($this->get_rows()) . ";\n"; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | private function _render_json() |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $this->_sort_field = $query['sidx']; |
234 | 234 | $this->_sort_direction = strtoupper($query['sord'] ?? 'ASC'); |
235 | 235 | } |
236 | - if ( !empty($query['_search']) |
|
236 | + if (!empty($query['_search']) |
|
237 | 237 | && $query['_search'] === 'true') { |
238 | 238 | foreach ($query as $field => $value) { |
239 | 239 | if (in_array($field, ['_search', 'nd', 'page', 'rows', 'sidx', 'sord'])) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | $this->_total_rows = $query->count(); |
258 | 258 | |
259 | - if ( $this->_datatype == 'json' |
|
259 | + if ($this->_datatype == 'json' |
|
260 | 260 | && !empty($this->_results_per_page)) { |
261 | 261 | $query->set_limit($this->_results_per_page); |
262 | 262 | if (!empty($this->_offset)) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function set_storage(?midcom_core_dbaobject $storage = null, ?string $schemaname = null) : self |
59 | 59 | { |
60 | - if ( $schemaname === null |
|
60 | + if ($schemaname === null |
|
61 | 61 | && !empty($storage->id)) { |
62 | 62 | $schemaname = $storage->get_parameter('midcom.helper.datamanager2', 'schema_name'); |
63 | 63 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $this->form = null; |
147 | 147 | } |
148 | 148 | |
149 | - if ( $this->form === null |
|
149 | + if ($this->form === null |
|
150 | 150 | || ($name && $this->form->getName() != $name)) { |
151 | 151 | $this->build_form($this->get_builder($name)); |
152 | 152 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | { |
240 | 240 | $ret = true; |
241 | 241 | foreach ($this->storage as $field) { |
242 | - if ( $field instanceof recreateable |
|
242 | + if ($field instanceof recreateable |
|
243 | 243 | && !$field->recreate()) { |
244 | 244 | $ret = false; |
245 | 245 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | return true; |
204 | 204 | } |
205 | 205 | if ($user === null) { |
206 | - $user =& $this->user; |
|
206 | + $user = & $this->user; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($user == 'EVERYONE') { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * |
275 | 275 | * It always returns true for administrative users. |
276 | 276 | */ |
277 | - public function is_group_member(midcom_core_group|string $group, ?midcom_core_user $user = null) : bool |
|
277 | + public function is_group_member(midcom_core_group | string $group, ?midcom_core_user $user = null) : bool |
|
278 | 278 | { |
279 | 279 | if ($this->is_admin($user)) { |
280 | 280 | // Administrators always have access. |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | * (group:...), any valid identifier for the midcom_core_group |
520 | 520 | * constructor or a valid object of that type. |
521 | 521 | */ |
522 | - public function get_group(string|int|midcom_db_group|midgard_group $id) : ?midcom_core_group |
|
522 | + public function get_group(string | int | midcom_db_group | midgard_group $id) : ?midcom_core_group |
|
523 | 523 | { |
524 | 524 | $param = $id; |
525 | 525 |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return "{$cacheroot}/{$subdir}/{$this->guid}/{$this->name}"; |
156 | 156 | } |
157 | 157 | |
158 | - public static function get_url(midgard_attachment|midcom_db_attachment|string $attachment, ?string $name = null) : string |
|
158 | + public static function get_url(midgard_attachment | midcom_db_attachment | string $attachment, ?string $name = null) : string |
|
159 | 159 | { |
160 | 160 | if (is_string($attachment)) { |
161 | 161 | $guid = $attachment; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | public function update_cache() |
302 | 302 | { |
303 | 303 | // Check if the attachment can be read anonymously |
304 | - if ( midcom::get()->config->get('attachment_cache_enabled') |
|
304 | + if (midcom::get()->config->get('attachment_cache_enabled') |
|
305 | 305 | && !$this->can_do('midgard:read', 'EVERYONE')) { |
306 | 306 | // Not public file, ensure it is removed |
307 | 307 | $this->remove_from_cache(); |