@@ -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)) { |
@@ -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(); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | public function _handler_create(Request $request, array &$data, ?string $guid = null) |
61 | 61 | { |
62 | - midcom::get()->auth->require_user_do('org.openpsa.user:manage', class: org_openpsa_user_interface::class); |
|
62 | + midcom::get()->auth->require_user_do('org.openpsa.user:manage', class : org_openpsa_user_interface::class); |
|
63 | 63 | |
64 | 64 | if ($guid !== null) { |
65 | 65 | // Get the organization |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function _handler_create(Request $request, ?string $guid = null) |
23 | 23 | { |
24 | - midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class); |
|
24 | + midcom::get()->auth->require_user_do('midgard:create', class : org_openpsa_contacts_person_dba::class); |
|
25 | 25 | |
26 | 26 | $defaults = []; |
27 | 27 | if (!empty($guid)) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function _handler_new(Request $request, ?string $guid = null) |
39 | 39 | { |
40 | - midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_sales_salesproject_dba::class); |
|
40 | + midcom::get()->auth->require_user_do('midgard:create', class : org_openpsa_sales_salesproject_dba::class); |
|
41 | 41 | |
42 | 42 | $this->_salesproject = new org_openpsa_sales_salesproject_dba; |
43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $schemadb = schemadb::from_path($this->_config->get('schemadb_salesproject')); |
49 | 49 | |
50 | 50 | if ($guid) { |
51 | - $field =& $schemadb->get('default')->get_field('customer'); |
|
51 | + $field = & $schemadb->get('default')->get_field('customer'); |
|
52 | 52 | try { |
53 | 53 | $customer = new org_openpsa_contacts_group_dba($guid); |
54 | 54 | $field['type_config']['options'] = [0 => '', $customer->id => $customer->official]; |
@@ -54,7 +54,8 @@ discard block |
||
54 | 54 | $field['type_config']['options'] = [0 => '', $customer->id => $customer->official]; |
55 | 55 | |
56 | 56 | $defaults['customer'] = $customer->id; |
57 | - } catch (midcom_error) { |
|
57 | + } |
|
58 | + catch (midcom_error) { |
|
58 | 59 | $customer = new org_openpsa_contacts_person_dba($guid); |
59 | 60 | $defaults['customerContact'] = $customer->id; |
60 | 61 | $field['type_config']['options'] = $this->list_groups([$customer->id => true]); |
@@ -126,7 +127,8 @@ discard block |
||
126 | 127 | try { |
127 | 128 | $company = new org_openpsa_contacts_group_dba($company_id); |
128 | 129 | $ret[$company->id] = $company->get_label(); |
129 | - } catch (midcom_error $e) { |
|
130 | + } |
|
131 | + catch (midcom_error $e) { |
|
130 | 132 | $e->log(); |
131 | 133 | } |
132 | 134 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | if ($contacts = $importer->parse($input)) { |
140 | 140 | $this->_request_data['import_status'] = $importer->import_subscribers($contacts, $this->_request_data['campaign']); |
141 | - if ( $this->_request_data['import_status']['subscribed_new'] > 0 |
|
141 | + if ($this->_request_data['import_status']['subscribed_new'] > 0 |
|
142 | 142 | || $this->_request_data['import_status']['already_subscribed'] > 0) { |
143 | 143 | $this->_import_success = true; |
144 | 144 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $read_rows = 0; |
196 | 196 | $handle = fopen($data['tmp_file'], 'r'); |
197 | 197 | $total_columns = 0; |
198 | - while ( $read_rows < 2 |
|
198 | + while ($read_rows < 2 |
|
199 | 199 | && $csv_line = fgetcsv($handle, 1000, $data['separator'])) { |
200 | 200 | if ($total_columns == 0) { |
201 | 201 | $total_columns = count($csv_line); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | $result = $this->validate_units($fields); |
19 | 19 | |
20 | - if ( empty($fields['end']) |
|
20 | + if (empty($fields['end']) |
|
21 | 21 | && empty($fields['continuous'])) { |
22 | 22 | if ($result === true) { |
23 | 23 | $result = []; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function validate_units(array $fields) |
31 | 31 | { |
32 | - if ( empty($fields['invoiceByActualUnits']) |
|
32 | + if (empty($fields['invoiceByActualUnits']) |
|
33 | 33 | && empty($fields['plannedUnits'])) { |
34 | 34 | return [ |
35 | 35 | 'plannedUnits' => midcom::get()->i18n->get_string('select either planned units or invoice by actual units', 'org.openpsa.sales') |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $schema->get_field('next_cycle')['hidden'] = false; |
38 | 38 | $schema->get_field('next_cycle')['default'] = $entry->start; |
39 | 39 | $schema->get_field('at_entry')['default'] = $entry->id; |
40 | - } elseif ( ($this->_deliverable->continuous || $this->_deliverable->end > time()) |
|
40 | + } elseif (($this->_deliverable->continuous || $this->_deliverable->end > time()) |
|
41 | 41 | && $this->_deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_STARTED) { |
42 | 42 | $schema->get_field('next_cycle')['hidden'] = false; |
43 | 43 | } |