@@ -44,7 +44,8 @@ |
||
| 44 | 44 | if (!$obj instanceof org_openpsa_contacts_person_dba) { |
| 45 | 45 | try { |
| 46 | 46 | $obj = new org_openpsa_contacts_person_dba($obj->id); |
| 47 | - } catch (midcom_error $e) { |
|
| 47 | + } |
|
| 48 | + catch (midcom_error $e) { |
|
| 48 | 49 | $e->log(); |
| 49 | 50 | continue; |
| 50 | 51 | } |
@@ -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 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->_load_schemadb(); |
| 55 | 55 | $this->_modify_schema(); |
| 56 | 56 | $controller = midcom_helper_datamanager2_controller::create('simple'); |
| 57 | - $controller->schemadb =& $this->_schemadb; |
|
| 57 | + $controller->schemadb = & $this->_schemadb; |
|
| 58 | 58 | $controller->set_storage($this->_deliverable, $this->_schema); |
| 59 | 59 | if (!$controller->initialize()) { |
| 60 | 60 | throw new midcom_error("Failed to initialize a DM2 controller instance for deliverable {$this->_deliverable->id}."); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | private function _modify_schema() |
| 69 | 69 | { |
| 70 | - $fields =& $this->_schemadb['subscription']->fields; |
|
| 70 | + $fields = & $this->_schemadb['subscription']->fields; |
|
| 71 | 71 | |
| 72 | 72 | $mc = new org_openpsa_relatedto_collector($this->_deliverable->guid, 'midcom_services_at_entry_dba'); |
| 73 | 73 | $mc->add_object_order('start', 'ASC'); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $at_entries = $mc->get_related_objects(); |
| 76 | 76 | |
| 77 | 77 | if (sizeof($at_entries) != 1) { |
| 78 | - if ( ( $this->_deliverable->continuous |
|
| 78 | + if (($this->_deliverable->continuous |
|
| 79 | 79 | || $this->_deliverable->end > time()) |
| 80 | 80 | && $this->_deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_STARTED) { |
| 81 | 81 | $fields['next_cycle']['hidden'] = false; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if (!empty($formdata['at_entry']->value)) { |
| 129 | 129 | $entry = new midcom_services_at_entry_dba((int) $formdata['at_entry']->value); |
| 130 | 130 | } |
| 131 | - if ( isset($formdata['next_cycle']) |
|
| 131 | + if (isset($formdata['next_cycle']) |
|
| 132 | 132 | && !$formdata['next_cycle']->is_empty()) { |
| 133 | 133 | $next_cycle = (int) $formdata['next_cycle']->value->format('U'); |
| 134 | 134 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | $this->_load_schema(); |
| 78 | 78 | |
| 79 | 79 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
| 80 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb_salesproject_deliverable']; |
|
| 80 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb_salesproject_deliverable']; |
|
| 81 | 81 | $this->_request_data['controller']->set_storage($this->_deliverable); |
| 82 | 82 | $this->_request_data['controller']->process_ajax(); |
| 83 | 83 | |
@@ -51,7 +51,8 @@ |
||
| 51 | 51 | } |
| 52 | 52 | try { |
| 53 | 53 | $this->_request_data['product'] = org_openpsa_products_product_dba::get_cached($this->_deliverable->product); |
| 54 | - } catch (midcom_error $e) { |
|
| 54 | + } |
|
| 55 | + catch (midcom_error $e) { |
|
| 55 | 56 | $this->_request_data['product'] = false; |
| 56 | 57 | } |
| 57 | 58 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $this->_load_schemadb(); |
| 57 | 57 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
| 58 | - $this->_controller->schemadb =& $this->_schemadb; |
|
| 58 | + $this->_controller->schemadb = & $this->_schemadb; |
|
| 59 | 59 | $this->_controller->set_storage($this->_salesproject, $this->_schema); |
| 60 | 60 | if (!$this->_controller->initialize()) { |
| 61 | 61 | throw new midcom_error("Failed to initialize a DM2 controller instance for salesproject {$this->_salesproject->id}."); |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | $this->_load_defaults($args); |
| 72 | 72 | |
| 73 | 73 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
| 74 | - $this->_controller->schemadb =& $this->_schemadb; |
|
| 74 | + $this->_controller->schemadb = & $this->_schemadb; |
|
| 75 | 75 | $this->_controller->schemaname = $this->_schema; |
| 76 | - $this->_controller->callback_object =& $this; |
|
| 76 | + $this->_controller->callback_object = & $this; |
|
| 77 | 77 | $this->_controller->defaults = $this->_defaults; |
| 78 | 78 | if (!$this->_controller->initialize()) { |
| 79 | 79 | throw new midcom_error("Failed to initialize a DM2 create controller."); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_salesproject')); |
| 86 | 86 | if ($this->_salesproject) { |
| 87 | - $fields =& $schemadb['default']->fields; |
|
| 87 | + $fields = & $schemadb['default']->fields; |
|
| 88 | 88 | $fields['customer']['type_config']['options'] = org_openpsa_helpers_list::task_groups($this->_salesproject); |
| 89 | 89 | } |
| 90 | 90 | $this->_schemadb = $schemadb; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->_defaults['owner'] = midcom_connection::get_user(); |
| 97 | 97 | |
| 98 | 98 | if (!empty($args[0])) { |
| 99 | - $fields =& $this->_schemadb['default']->fields; |
|
| 99 | + $fields = & $this->_schemadb['default']->fields; |
|
| 100 | 100 | try { |
| 101 | 101 | $customer = new org_openpsa_contacts_group_dba($args[0]); |
| 102 | 102 | $fields['customer']['type_config']['options'] = array(0 => '', $customer->id => $customer->official); |
@@ -102,7 +102,8 @@ |
||
| 102 | 102 | $fields['customer']['type_config']['options'] = array(0 => '', $customer->id => $customer->official); |
| 103 | 103 | |
| 104 | 104 | $this->_defaults['customer'] = $customer->id; |
| 105 | - } catch (midcom_error $e) { |
|
| 105 | + } |
|
| 106 | + catch (midcom_error $e) { |
|
| 106 | 107 | $customer = new org_openpsa_contacts_person_dba($args[0]); |
| 107 | 108 | $this->_defaults['customerContact'] = $customer->id; |
| 108 | 109 | $fields['customer']['type_config']['options'] = org_openpsa_helpers_list::task_groups(new org_openpsa_sales_salesproject_dba, 'id', array($customer->id => true)); |
@@ -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 | } |