@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | private function _update_cache() |
| 145 | 145 | { |
| 146 | 146 | $this->_merged = $this->_global; |
| 147 | - if ( !empty($this->_local) |
|
| 147 | + if (!empty($this->_local) |
|
| 148 | 148 | && is_array($this->_local)) { |
| 149 | 149 | $this->_merged = array_merge($this->_merged, $this->_local); |
| 150 | 150 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function store(array $params, $reset = true) |
| 187 | 187 | { |
| 188 | - if ( !$this->_object_stored |
|
| 188 | + if (!$this->_object_stored |
|
| 189 | 189 | && $this->_object) { |
| 190 | 190 | $this->_store_from_object(); |
| 191 | 191 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function get_all() |
| 271 | 271 | { |
| 272 | - if ( !$this->_object_stored |
|
| 272 | + if (!$this->_object_stored |
|
| 273 | 273 | && $this->_object) { |
| 274 | 274 | $this->_store_from_object(); |
| 275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public function exists($key) |
| 287 | 287 | { |
| 288 | - if ( !$this->_object_stored |
|
| 288 | + if (!$this->_object_stored |
|
| 289 | 289 | && $this->_object) { |
| 290 | 290 | $this->_store_from_object(); |
| 291 | 291 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | private function _get_invoices_for_subscription($deliverable, $at_entry) |
| 50 | 50 | { |
| 51 | - if ( $deliverable->invoiceByActualUnits |
|
| 51 | + if ($deliverable->invoiceByActualUnits |
|
| 52 | 52 | && $at_entry->arguments['cycle'] > 1) { |
| 53 | 53 | $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1); |
| 54 | 54 | if ($invoice_sum == 0) { |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $time = $at_entry->start; |
| 65 | 65 | $scheduler = new org_openpsa_invoices_scheduler($deliverable); |
| 66 | 66 | |
| 67 | - while ( $time < $this->_request_data['end'] |
|
| 68 | - && ( $time < $deliverable->end |
|
| 67 | + while ($time < $this->_request_data['end'] |
|
| 68 | + && ($time < $deliverable->end |
|
| 69 | 69 | || $deliverable->continuous)) { |
| 70 | 70 | $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base); |
| 71 | 71 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | foreach ($qb->execute() as $at_entry) { |
| 108 | 108 | try { |
| 109 | 109 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
| 110 | - if ( $deliverable->continuous |
|
| 111 | - || ( $deliverable->start < $this->_request_data['end'] |
|
| 110 | + if ($deliverable->continuous |
|
| 111 | + || ($deliverable->start < $this->_request_data['end'] |
|
| 112 | 112 | && $deliverable->end > $this->_request_data['start'])) { |
| 113 | 113 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
| 114 | 114 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function set_privilege($privilege, $assignee = null, $value = MIDCOM_PRIVILEGE_ALLOW, $classname = '') |
| 60 | 60 | { |
| 61 | - if ( !$this->can_do('midgard:update') |
|
| 61 | + if (!$this->can_do('midgard:update') |
|
| 62 | 62 | || !$this->can_do('midgard:privileges')) { |
| 63 | 63 | debug_add("Failed to set a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
| 64 | 64 | MIDCOM_LOG_ERROR); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function unset_privilege($privilege, $assignee = null, $classname = '') |
| 93 | 93 | { |
| 94 | - if ( !$this->can_do('midgard:update') |
|
| 94 | + if (!$this->can_do('midgard:update') |
|
| 95 | 95 | || !$this->can_do('midgard:privileges')) { |
| 96 | 96 | debug_add("Failed to unset a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
| 97 | 97 | MIDCOM_LOG_ERROR); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | debug_add('Cannot set parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | - if ( empty($domain) |
|
| 208 | + if (empty($domain) |
|
| 209 | 209 | || empty($name) |
| 210 | 210 | || !is_string($domain) |
| 211 | 211 | || !is_string($name)) { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if ( !$this->can_do('midgard:update') |
|
| 218 | + if (!$this->can_do('midgard:update') |
|
| 219 | 219 | || !$this->can_do('midgard:parameters')) { |
| 220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
| 221 | 221 | MIDCOM_LOG_ERROR); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | debug_add('Cannot delete parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
| 259 | 259 | return false; |
| 260 | 260 | } |
| 261 | - if ( empty($domain) |
|
| 261 | + if (empty($domain) |
|
| 262 | 262 | || empty($name) |
| 263 | 263 | || !is_string($domain) |
| 264 | 264 | || !is_string($name)) { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | return false; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if ( !$this->can_do('midgard:update') |
|
| 271 | + if (!$this->can_do('midgard:update') |
|
| 272 | 272 | || !$this->can_do('midgard:parameters')) { |
| 273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
| 274 | 274 | MIDCOM_LOG_ERROR); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | return false; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if ( !$this->can_do('midgard:update') |
|
| 66 | + if (!$this->can_do('midgard:update') |
|
| 67 | 67 | || !$this->can_do('midgard:attachments')) { |
| 68 | 68 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
| 69 | 69 | MIDCOM_LOG_ERROR); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if ( !$this->can_do('midgard:update') |
|
| 91 | + if (!$this->can_do('midgard:update') |
|
| 92 | 92 | || !$this->can_do('midgard:attachments')) { |
| 93 | 93 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
| 94 | 94 | MIDCOM_LOG_ERROR); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $attachment->parentguid = $this->guid; |
| 103 | 103 | |
| 104 | 104 | if (!$attachment->create()) { |
| 105 | - debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
| 105 | + debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
| 106 | 106 | MIDCOM_LOG_INFO); |
| 107 | 107 | return false; |
| 108 | 108 | } |
@@ -194,7 +194,7 @@ |
||
| 194 | 194 | return false; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if ( !empty($this->_old_username) |
|
| 197 | + if (!empty($this->_old_username) |
|
| 198 | 198 | && $this->_old_username !== $new_username) { |
| 199 | 199 | if (!$history = @unserialize($this->_person->get_parameter('midcom', 'username_history'))) { |
| 200 | 200 | $history = []; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( midcom::get()->config->get('auth_check_client_ip') |
|
| 87 | + if (midcom::get()->config->get('auth_check_client_ip') |
|
| 88 | 88 | && $data['clientip'] != $request->getClientIp()) { |
| 89 | 89 | debug_add("The session had mismatching client IP.", MIDCOM_LOG_INFO); |
| 90 | 90 | debug_add("Expected {$data['clientip']}, got {$request->getClientIp()}."); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | return false; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( !$this->check_timestamp($data['timestamp'], $user) |
|
| 101 | + if (!$this->check_timestamp($data['timestamp'], $user) |
|
| 102 | 102 | || !$this->authenticate($user->username, '', true)) { |
| 103 | 103 | $this->logout($user); |
| 104 | 104 | return false; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $user = midcom_connection::login($username, $password, $trusted); |
| 146 | 146 | |
| 147 | 147 | if (!$user) { |
| 148 | - debug_add("Failed to authenticate the given user: ". midcom_connection::get_error_string(), |
|
| 148 | + debug_add("Failed to authenticate the given user: " . midcom_connection::get_error_string(), |
|
| 149 | 149 | MIDCOM_LOG_INFO); |
| 150 | 150 | return false; |
| 151 | 151 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | { |
| 91 | 91 | if ($this->invoiceable) { |
| 92 | 92 | $task = new org_openpsa_projects_task_dba($this->task); |
| 93 | - $time_slot = (float)$task->get_parameter('org.openpsa.projects.projectbroker', 'minimum_slot'); |
|
| 93 | + $time_slot = (float) $task->get_parameter('org.openpsa.projects.projectbroker', 'minimum_slot'); |
|
| 94 | 94 | if (empty($time_slot)) { |
| 95 | 95 | $time_slot = (float) midcom_baseclasses_components_configuration::get('org.openpsa.projects', 'config')->get('default_minimum_time_slot'); |
| 96 | 96 | if (empty($time_slot)) { |
@@ -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; |