@@ -123,7 +123,8 @@ |
||
123 | 123 | $row = []; |
124 | 124 | try { |
125 | 125 | $row['person'] = org_openpsa_contacts_person_dba::get_cached($hour->person); |
126 | - } catch (midcom_error $e) { |
|
126 | + } |
|
127 | + catch (midcom_error $e) { |
|
127 | 128 | $e->log(); |
128 | 129 | continue; |
129 | 130 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $qb_hr = org_openpsa_expenses_hour_report_dba::new_query_builder(); |
44 | 44 | $qb_hr->add_constraint('date', '<=', (int) $this->_request_data['query_data']['end']); |
45 | 45 | $qb_hr->add_constraint('date', '>=', (int) $this->_request_data['query_data']['start']); |
46 | - if ( array_key_exists('invoiceable_filter', $this->_request_data['query_data']) |
|
46 | + if (array_key_exists('invoiceable_filter', $this->_request_data['query_data']) |
|
47 | 47 | && $this->_request_data['query_data']['invoiceable_filter'] != -1) { |
48 | 48 | $qb_hr->add_constraint('invoiceable', '=', (bool) $this->_request_data['query_data']['invoiceable_filter']); |
49 | 49 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $tasks = $this->_expand_task($this->_request_data['query_data']['task']); |
60 | 60 | $qb_hr->add_constraint('task', 'IN', $tasks); |
61 | 61 | } |
62 | - if ( array_key_exists('hour_type_filter', $this->_request_data['query_data']) |
|
62 | + if (array_key_exists('hour_type_filter', $this->_request_data['query_data']) |
|
63 | 63 | && $this->_request_data['query_data']['hour_type_filter'] != 'builtin:all') { |
64 | 64 | $qb_hr->add_constraint('reportType', '=', $this->_request_data['query_data']['hour_type_filter']); |
65 | 65 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | private function add_to_group($new_row, $matching, $sort, $title) |
152 | 152 | { |
153 | - $rows =& $this->_request_data['report']['rows']; |
|
153 | + $rows = & $this->_request_data['report']['rows']; |
|
154 | 154 | if (array_key_exists($matching, $rows)) { |
155 | 155 | $rows[$matching]['rows'][] = $new_row; |
156 | 156 | $rows[$matching]['total_hours'] += $new_row['hour']->hours; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | $recipient = $_ENV["RECIPIENT"]; |
47 | 47 | $token_length = strlen($recipient) - strlen($prefix) - strlen($suffix); |
48 | -if ( $token_length <= 0 |
|
48 | +if ($token_length <= 0 |
|
49 | 49 | || substr($recipient, 0, strlen($prefix)) != $prefix |
50 | 50 | || substr($recipient, strlen($prefix) + $token_length) != $suffix) { |
51 | 51 | error_log("Recipient address does not match address template: $recipient"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | fclose($fh); |
62 | 62 | exit(0); |
63 | 63 | } |
64 | -} elseif ( substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
64 | +} elseif (substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
65 | 65 | || substr($BOUNCE_LOGGER, 0, strlen("https://")) == "https://") { |
66 | 66 | $client = new org_openpsa_httplib(); |
67 | 67 | $client->post($BOUNCE_LOGGER, ["token" => $token]); |
@@ -222,7 +222,8 @@ discard block |
||
222 | 222 | $this->_backend->send($person, $member, $token, $subject, $content, $from); |
223 | 223 | self::$_messages_sent++; |
224 | 224 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT; |
225 | - } catch (midcom_error $e) { |
|
225 | + } |
|
226 | + catch (midcom_error $e) { |
|
226 | 227 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::FAILURE; |
227 | 228 | if (!$this->test_mode) { |
228 | 229 | $params[] = [ |
@@ -279,7 +280,8 @@ discard block |
||
279 | 280 | { |
280 | 281 | try { |
281 | 282 | $person = org_openpsa_contacts_person_dba::get_cached($member->person); |
282 | - } catch (midcom_error $e) { |
|
283 | + } |
|
284 | + catch (midcom_error $e) { |
|
283 | 285 | debug_add("Person #{$member->person} deleted or missing, removing member (member #{$member->id})"); |
284 | 286 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
285 | 287 | $member->delete(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | parent::__construct(); |
81 | 81 | $this->_message = $message; |
82 | 82 | |
83 | - if ( $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
83 | + if ($this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
84 | 84 | && $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_HTML) { |
85 | 85 | throw new midcom_error('unsupported message type'); |
86 | 86 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $token .= midcom_helper_misc::random_string($this->token_size - 1, 'abcdefghijklmnopqrstuvwxyz0123456789'); |
248 | 248 | |
249 | 249 | //If token is not free or (very, very unlikely) matches our dummy token, recurse. |
250 | - if ( $token === 'dummy' |
|
250 | + if ($token === 'dummy' |
|
251 | 251 | || !org_openpsa_directmarketing_campaign_messagereceipt_dba::token_is_free($token)) { |
252 | 252 | return $this->_create_token(); |
253 | 253 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | $type = $this->_backend->get_type(); |
274 | - if ( $person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
274 | + if ($person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
275 | 275 | || $person->get_parameter('org.openpsa.directmarketing', "send_{$type}_denied")) { |
276 | 276 | debug_add("Sending {$type} messages to person {$person->rname} is denied, unsubscribing member (member #{$member->id})"); |
277 | 277 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return; |
75 | 75 | } |
76 | 76 | $parent = $this->get_parent(); |
77 | - if ( $parent |
|
77 | + if ($parent |
|
78 | 78 | && $parent->component == 'org.openpsa.documents') { |
79 | 79 | midcom::get()->auth->request_sudo('org.openpsa.documents'); |
80 | 80 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * if nothing matched so far and the subtype is alphanumeric, uppercase it on the theory |
171 | 171 | * that it's probably a file extension |
172 | 172 | */ |
173 | - if ( $st_orig == $subtype |
|
173 | + if ($st_orig == $subtype |
|
174 | 174 | && preg_match('/^[a-z0-9]+$/', $subtype)) { |
175 | 175 | $subtype = strtoupper($subtype); |
176 | 176 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $properties = $this->get_properties(); |
186 | 186 | // Copy current properties |
187 | 187 | foreach ($properties as $key) { |
188 | - if ( $key != 'guid' |
|
188 | + if ($key != 'guid' |
|
189 | 189 | && $key != 'id' |
190 | 190 | && $key != 'metadata') { |
191 | 191 | $backup->$key = $this->{$key}; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype); |
218 | 218 | |
219 | 219 | $original_handle = $original_attachment->open('r'); |
220 | - if ( !$backup_attachment |
|
220 | + if (!$backup_attachment |
|
221 | 221 | || !$original_handle) { |
222 | 222 | // Failed to copy the attachment, abort |
223 | 223 | return $backup->delete(); |
@@ -93,8 +93,8 @@ |
||
93 | 93 | |
94 | 94 | private function prepare_url($url) |
95 | 95 | { |
96 | - if ( substr($url, 0, 1) != '/' |
|
97 | - && ! preg_match('|^https?://|', $url)) { |
|
96 | + if (substr($url, 0, 1) != '/' |
|
97 | + && !preg_match('|^https?://|', $url)) { |
|
98 | 98 | $url = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . $url; |
99 | 99 | } |
100 | 100 | return '"' . $url . '"'; |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | private function load_controller(org_openpsa_invoices_billing_data_dba $bd) |
31 | 31 | { |
32 | 32 | $schemadb = schemadb::from_path($this->_config->get('schemadb_billing_data')); |
33 | - $vat =& $schemadb->get('default')->get_field('vat'); |
|
34 | - $due =& $schemadb->get('default')->get_field('due'); |
|
33 | + $vat = & $schemadb->get('default')->get_field('vat'); |
|
34 | + $due = & $schemadb->get('default')->get_field('due'); |
|
35 | 35 | // Fill VAT select |
36 | 36 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
37 | 37 | if (!empty($vat_array)) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $data['controller'] = $this->load_controller($bd); |
75 | 75 | |
76 | 76 | $workflow = $this->get_workflow('datamanager', ['controller' => $data['controller']]); |
77 | - if ( $mode == 'edit' |
|
77 | + if ($mode == 'edit' |
|
78 | 78 | && $bd->can_do('midgard:delete')) { |
79 | 79 | $delete = $this->get_workflow('delete', [ |
80 | 80 | 'object' => $bd, |
@@ -82,7 +82,7 @@ |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // OPML subscription list import support |
85 | - if ( array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
85 | + if (array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
86 | 86 | && is_uploaded_file($_FILES['net_nemein_rss_manage_opml']['tmp_name'])) { |
87 | 87 | $opml_file = $_FILES['net_nemein_rss_manage_opml']['tmp_name']; |
88 | 88 |
@@ -210,8 +210,7 @@ |
||
210 | 210 | { |
211 | 211 | $ret = []; |
212 | 212 | |
213 | - foreach ($this->storage as $field => $value) |
|
214 | - { |
|
213 | + foreach ($this->storage as $field => $value) { |
|
215 | 214 | $ret[$field] = $value->get_value(); |
216 | 215 | $config = $this->schema->get_field($field); |
217 | 216 | if (!empty($config['type_config']['allow_multiple'])) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function set_storage(midcom_core_dbaobject $storage = null, $schemaname = null) |
138 | 138 | { |
139 | - if ( $schemaname === null |
|
139 | + if ($schemaname === null |
|
140 | 140 | && !empty($storage->id)) { |
141 | 141 | $schemaname = $storage->get_parameter('midcom.helper.datamanager2', 'schema_name'); |
142 | 142 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $name = 'midcom_helper_datamanager2'; |
259 | 259 | } |
260 | 260 | |
261 | - if ( $this->form === null |
|
261 | + if ($this->form === null |
|
262 | 262 | || $this->form->getName() != $name) { |
263 | 263 | $config = [ |
264 | 264 | 'schema' => $this->get_schema() |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | { |
334 | 334 | $ret = true; |
335 | 335 | foreach ($this->storage as $field) { |
336 | - if ( $field instanceof recreateable |
|
336 | + if ($field instanceof recreateable |
|
337 | 337 | && !$field->recreate()) { |
338 | 338 | $ret = false; |
339 | 339 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | // workaround for weird mgd API behavior where setting empty (i.e. deleting) a |
27 | 27 | // nonexistent parameter returns false |
28 | - if ( ($this->value === false || $this->value === null || $this->value === "") |
|
28 | + if (($this->value === false || $this->value === null || $this->value === "") |
|
29 | 29 | && $this->load() === null) { |
30 | 30 | return true; |
31 | 31 | } |