@@ -68,7 +68,7 @@ |
||
| 68 | 68 | $status_changer_label = $this->l10n->get('system'); |
| 69 | 69 | $target_person_label = $this->l10n->get('system'); |
| 70 | 70 | |
| 71 | - if ( $status_change->metadata->creator |
|
| 71 | + if ($status_change->metadata->creator |
|
| 72 | 72 | && $status_change->metadata->creator != $fallback_creator->guid) { |
| 73 | 73 | $status_changer = org_openpsa_widgets_contact::get($status_change->metadata->creator); |
| 74 | 74 | $status_changer_label = $status_changer->show_inline(); |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | // Set the "now working on" status |
| 153 | 153 | $workingon = new org_openpsa_mypage_workingon(); |
| 154 | 154 | if (!$workingon->set($_POST['task'])) { |
| 155 | - midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.mypage'), 'Failed to set "working on" parameter to "' . $_POST['task'] . '", reason ' . midcom_connection::get_error_string(), 'error'); |
|
| 155 | + midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.mypage'), 'Failed to set "working on" parameter to "' . $_POST['task'] . '", reason ' . midcom_connection::get_error_string(), 'error'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | return new midcom_response_relocate($relocate . "workingon/"); |
@@ -92,7 +92,8 @@ |
||
| 92 | 92 | $customer = new org_openpsa_contacts_group_dba($customer_id); |
| 93 | 93 | $customer_label = $customer->official; |
| 94 | 94 | $customer = $customer_id; |
| 95 | - } catch (midcom_error $e) { |
|
| 95 | + } |
|
| 96 | + catch (midcom_error $e) { |
|
| 96 | 97 | } |
| 97 | 98 | } |
| 98 | 99 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $this->calculate_price(false); |
| 56 | 56 | |
| 57 | - if ( $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 57 | + if ($this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 58 | 58 | && $this->continuous == true) { |
| 59 | 59 | $this->end = 0; |
| 60 | 60 | } elseif ($this->end < $this->start) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $calculator->run($this); |
| 141 | 141 | $cost = $calculator->get_cost(); |
| 142 | 142 | $price = $calculator->get_price(); |
| 143 | - if ( $price != $this->price |
|
| 143 | + if ($price != $this->price |
|
| 144 | 144 | || $cost != $this->cost) { |
| 145 | 145 | $this->price = $price; |
| 146 | 146 | $this->cost = $cost; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $units = $agreement_hours['invoiceable']; |
| 188 | 188 | $uninvoiceableUnits = $agreement_hours['reported'] - ($agreement_hours['invoiceable'] + $agreement_hours['invoiced']); |
| 189 | 189 | |
| 190 | - if ( $units != $this->units |
|
| 190 | + if ($units != $this->units |
|
| 191 | 191 | || $uninvoiceableUnits != $this->uninvoiceableUnits) { |
| 192 | 192 | debug_add("agreement values have changed, setting units to " . $units . ", uninvoiceable: " . $uninvoiceableUnits); |
| 193 | 193 | $this->units = $units; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | public function invoice() |
| 244 | 244 | { |
| 245 | - if ( $this->state >= self::STATE_INVOICED |
|
| 245 | + if ($this->state >= self::STATE_INVOICED |
|
| 246 | 246 | || $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
| 247 | 247 | return false; |
| 248 | 248 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | private function _find_suspects_event(midcom_core_dbaobject $object, $defaults, array &$links_array) |
| 55 | 55 | { |
| 56 | - if ( !is_array($object->participants) |
|
| 56 | + if (!is_array($object->participants) |
|
| 57 | 57 | || count($object->participants) < 2) { |
| 58 | 58 | //We have invalid list or less than two participants, abort |
| 59 | 59 | return; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function new_subscription_cycle(array $args, midcom_baseclasses_components_cron_handler $handler) |
| 146 | 146 | { |
| 147 | - if ( !isset($args['deliverable']) |
|
| 147 | + if (!isset($args['deliverable']) |
|
| 148 | 148 | || !isset($args['cycle'])) { |
| 149 | 149 | $handler->print_error('deliverable GUID or cycle number not set, aborting'); |
| 150 | 150 | return false; |
@@ -134,7 +134,8 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | try { |
| 136 | 136 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args['deliverable']); |
| 137 | - } catch (midcom_error $e) { |
|
| 137 | + } |
|
| 138 | + catch (midcom_error $e) { |
|
| 138 | 139 | $handler->print_error("Deliverable {$args['deliverable']} not found: " . midcom_connection::get_error_string()); |
| 139 | 140 | return false; |
| 140 | 141 | } |
@@ -158,7 +159,8 @@ discard block |
||
| 158 | 159 | } |
| 159 | 160 | try { |
| 160 | 161 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args['deliverable']); |
| 161 | - } catch (midcom_error $e) { |
|
| 162 | + } |
|
| 163 | + catch (midcom_error $e) { |
|
| 162 | 164 | $handler->print_error('no deliverable with passed GUID: ' . $args['deliverable'] . ', aborting'); |
| 163 | 165 | return false; |
| 164 | 166 | } |
@@ -166,7 +168,8 @@ discard block |
||
| 166 | 168 | //get the owner of the salesproject the deliverable belongs to |
| 167 | 169 | try { |
| 168 | 170 | $project = new org_openpsa_sales_salesproject_dba($deliverable->salesproject); |
| 169 | - } catch (midcom_error $e) { |
|
| 171 | + } |
|
| 172 | + catch (midcom_error $e) { |
|
| 170 | 173 | $handler->print_error('Failed to load salesproject: ' . $e->getMessage()); |
| 171 | 174 | return false; |
| 172 | 175 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | $profit = $value - $cost; |
| 93 | - if ( $this->value != $value |
|
| 93 | + if ($this->value != $value |
|
| 94 | 94 | || $this->profit != $profit) { |
| 95 | 95 | $this->value = $value; |
| 96 | 96 | $this->profit = $value - $cost; |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | public function _on_updating() |
| 222 | 222 | { |
| 223 | - if ( $this->state != self::STATE_ACTIVE |
|
| 223 | + if ($this->state != self::STATE_ACTIVE |
|
| 224 | 224 | && !$this->end) { |
| 225 | 225 | //Not active anymore and end not set, set it to now |
| 226 | 226 | $this->end = time(); |
| 227 | 227 | } |
| 228 | - if ( $this->end |
|
| 228 | + if ($this->end |
|
| 229 | 229 | && $this->state == self::STATE_ACTIVE) { |
| 230 | 230 | //Returned to active state, clear the end marker. |
| 231 | 231 | $this->end = 0; |
@@ -120,14 +120,16 @@ |
||
| 120 | 120 | if (!empty($this->customer)) { |
| 121 | 121 | try { |
| 122 | 122 | return org_openpsa_contacts_group_dba::get_cached($this->customer); |
| 123 | - } catch (midcom_error $e) { |
|
| 123 | + } |
|
| 124 | + catch (midcom_error $e) { |
|
| 124 | 125 | $e->log(); |
| 125 | 126 | } |
| 126 | 127 | } |
| 127 | 128 | if (!empty($this->customerContact)) { |
| 128 | 129 | try { |
| 129 | 130 | return org_openpsa_contacts_person_dba::get_cached($this->customerContact); |
| 130 | - } catch (midcom_error $e) { |
|
| 131 | + } |
|
| 132 | + catch (midcom_error $e) { |
|
| 131 | 133 | $e->log(); |
| 132 | 134 | } |
| 133 | 135 | } |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | try { |
| 24 | 24 | $person = new midcom_db_person($this->uid); |
| 25 | 25 | $grp = new midcom_db_group($this->gid); |
| 26 | - } catch (midcom_error $e) { |
|
| 26 | + } |
|
| 27 | + catch (midcom_error $e) { |
|
| 27 | 28 | $e->log(); |
| 28 | 29 | return 'Invalid membership record'; |
| 29 | 30 | } |
@@ -40,7 +41,8 @@ discard block |
||
| 40 | 41 | } |
| 41 | 42 | try { |
| 42 | 43 | $person = new midcom_db_person($this->uid); |
| 43 | - } catch (midcom_error $e) { |
|
| 44 | + } |
|
| 45 | + catch (midcom_error $e) { |
|
| 44 | 46 | return; |
| 45 | 47 | } |
| 46 | 48 | midcom::get()->cache->invalidate($person->guid); |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | { |
| 79 | 79 | parent::__set($property, $value); |
| 80 | 80 | |
| 81 | - if ( $property == 'firstname' |
|
| 81 | + if ($property == 'firstname' |
|
| 82 | 82 | || $property == 'lastname' |
| 83 | 83 | || $property == 'homepage' |
| 84 | 84 | || $property == 'email') { |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | { |
| 38 | 38 | return preg_replace_callback( |
| 39 | 39 | "%(<\s*)+(/\s*)+{$element}%i", |
| 40 | - function ($matches) { |
|
| 40 | + function($matches) { |
|
| 41 | 41 | return htmlentities($matches[0]); |
| 42 | 42 | }, |
| 43 | 43 | $input |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if ($uplink == $root_id) { |
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | - if ( $uplink == false |
|
| 225 | + if ($uplink == false |
|
| 226 | 226 | || $uplink == -1) { |
| 227 | 227 | return false; |
| 228 | 228 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $entry = "<span class=\"{$current_class}\">{$entry}</span>"; |
| 447 | 447 | } |
| 448 | 448 | } else { |
| 449 | - if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 449 | + if (!empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 450 | 450 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) { |
| 451 | 451 | continue; |
| 452 | 452 | } |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $id = "custom-{$key}"; |
| 570 | 570 | |
| 571 | 571 | $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}"; |
| 572 | - if ( substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 572 | + if (substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 573 | 573 | || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) { |
| 574 | 574 | $url = $entry[MIDCOM_NAV_URL]; |
| 575 | 575 | } |
@@ -296,7 +296,8 @@ |
||
| 296 | 296 | // the tree. This is, for example, used by the on-delete cache invalidation. |
| 297 | 297 | try { |
| 298 | 298 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
| 299 | - } catch (midcom_error $e) { |
|
| 299 | + } |
|
| 300 | + catch (midcom_error $e) { |
|
| 300 | 301 | debug_add("Could not load GUID {$guid}, trying to continue anyway. Last error was: " . $e->getMessage(), MIDCOM_LOG_WARN); |
| 301 | 302 | } |
| 302 | 303 | if (!empty($object)) { |