@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | if ($result === true) { |
21 | 21 | $result = array(); |
22 | 22 | } |
23 | - if ( ( empty($fields['end_date']) |
|
23 | + if ((empty($fields['end_date']) |
|
24 | 24 | || $fields['end_date'] == '0000-00-00') |
25 | 25 | && empty($fields['continuous'])) { |
26 | 26 | $result['end'] = midcom::get()->i18n->get_string('select either end date or continuous', 'org.openpsa.sales'); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function validate_units(array $fields) |
35 | 35 | { |
36 | 36 | $result = array(); |
37 | - if ( empty($fields['invoiceByActualUnits']) |
|
37 | + if (empty($fields['invoiceByActualUnits']) |
|
38 | 38 | && empty($fields['plannedUnits'])) { |
39 | 39 | $result['plannedUnits'] = midcom::get()->i18n->get_string('select either planned units or invoice by actual units', 'org.openpsa.sales'); |
40 | 40 | return $result; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $this->_group = new midcom_db_group(); |
43 | 43 | if (!$this->_group->create()) { |
44 | 44 | debug_print_r('We operated on this object:', $this->_group); |
45 | - throw new midcom_error('Failed to create a new group. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
45 | + throw new midcom_error('Failed to create a new group. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return $this->_group; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (file_exists(MIDCOM_STATIC_ROOT . $jqgrid_path . 'i18n/grid.locale-' . $language . '.js')) { |
105 | 105 | $lang = $language; |
106 | 106 | } |
107 | - $head->add_jsfile(MIDCOM_STATIC_URL . $jqgrid_path . 'i18n/grid.locale-'. $lang . '.js'); |
|
107 | + $head->add_jsfile(MIDCOM_STATIC_URL . $jqgrid_path . 'i18n/grid.locale-' . $lang . '.js'); |
|
108 | 108 | $head->add_jsfile(MIDCOM_STATIC_URL . $jqgrid_path . 'jquery.jqgrid.min.js'); |
109 | 109 | |
110 | 110 | org_openpsa_widgets_ui::add_head_elements(); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function set_option($key, $value, $autoquote_string = true) |
160 | 160 | { |
161 | 161 | $this->_raw_options[$key] = $value; |
162 | - if ( $autoquote_string |
|
162 | + if ($autoquote_string |
|
163 | 163 | && is_string($value)) { |
164 | 164 | $value = '"' . str_replace('"', '\\"', $value) . '"'; |
165 | 165 | } elseif ($value === true) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function set_select_column($name, $label, $options, array $selectdata) |
193 | 193 | { |
194 | 194 | $selectstring = implode(';', array_map( |
195 | - function ($key, $value) { |
|
195 | + function($key, $value) { |
|
196 | 196 | return $key . ':' . $value; |
197 | 197 | }, |
198 | 198 | array_keys($selectdata), |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function remove_column($name) |
245 | 245 | { |
246 | - if ( empty($name) |
|
246 | + if (empty($name) |
|
247 | 247 | || !array_key_exists($name, $this->_columns)) { |
248 | 248 | throw new midcom_error('Invalid column name ' . $name); |
249 | 249 | } |
@@ -275,11 +275,11 @@ |
||
275 | 275 | $deliverable = null; |
276 | 276 | foreach (array_keys($mc_task_key) as $key) { |
277 | 277 | try { |
278 | - $deliverable = new org_openpsa_sales_salesproject_deliverable_dba((int)$mc_task_agreement->get_subkey($key, 'agreement')); |
|
278 | + $deliverable = new org_openpsa_sales_salesproject_deliverable_dba((int) $mc_task_agreement->get_subkey($key, 'agreement')); |
|
279 | 279 | $invoice_item->pricePerUnit = $deliverable->pricePerUnit; |
280 | 280 | $invoice_item->deliverable = $deliverable->id; |
281 | 281 | //calculate price |
282 | - if ( $deliverable->invoiceByActualUnits |
|
282 | + if ($deliverable->invoiceByActualUnits |
|
283 | 283 | || $deliverable->plannedUnits == 0) { |
284 | 284 | $invoice_item->units = $hours; |
285 | 285 | } else { |
@@ -65,7 +65,8 @@ discard block |
||
65 | 65 | { |
66 | 66 | try { |
67 | 67 | $invoice_sender = new midcom_db_person($invoicer); |
68 | - } catch (midcom_error $e) { |
|
68 | + } |
|
69 | + catch (midcom_error $e) { |
|
69 | 70 | return; |
70 | 71 | } |
71 | 72 | |
@@ -154,7 +155,8 @@ discard block |
||
154 | 155 | try { |
155 | 156 | $task = new org_openpsa_projects_task_dba($id); |
156 | 157 | $task->update_cache(); |
157 | - } catch (midcom_error $e) { |
|
158 | + } |
|
159 | + catch (midcom_error $e) { |
|
158 | 160 | } |
159 | 161 | } |
160 | 162 | |
@@ -285,7 +287,8 @@ discard block |
||
285 | 287 | } else { |
286 | 288 | $invoice_item->units = $deliverable->plannedUnits; |
287 | 289 | } |
288 | - } catch (midcom_error $e) { |
|
290 | + } |
|
291 | + catch (midcom_error $e) { |
|
289 | 292 | $e->log(); |
290 | 293 | $invoice_item->units = $hours; |
291 | 294 | } |
@@ -353,14 +356,16 @@ discard block |
||
353 | 356 | if (!empty($this->customer)) { |
354 | 357 | try { |
355 | 358 | return org_openpsa_contacts_group_dba::get_cached($this->customer); |
356 | - } catch (midcom_error $e) { |
|
359 | + } |
|
360 | + catch (midcom_error $e) { |
|
357 | 361 | $e->log(); |
358 | 362 | } |
359 | 363 | } |
360 | 364 | if (!empty($this->customerContact)) { |
361 | 365 | try { |
362 | 366 | return org_openpsa_contacts_person_dba::get_cached($this->customerContact); |
363 | - } catch (midcom_error $e) { |
|
367 | + } |
|
368 | + catch (midcom_error $e) { |
|
364 | 369 | $e->log(); |
365 | 370 | } |
366 | 371 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) |
42 | 42 | { |
43 | 43 | if ( !($bd = self::get_billing_data('org_openpsa_contacts_group_dba', $object->customer)) |
44 | - // check if the customerContact is set and has invoice_data |
|
44 | + // check if the customerContact is set and has invoice_data |
|
45 | 45 | && !($bd = self::get_billing_data('org_openpsa_contacts_person_dba', $object->customerContact))) { |
46 | 46 | $bd = new org_openpsa_invoices_billing_data_dba(); |
47 | 47 | $due = midcom_baseclasses_components_configuration::get('org.openpsa.invoices', 'config')->get('default_due_days'); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) |
42 | 42 | { |
43 | - if ( !($bd = self::get_billing_data('org_openpsa_contacts_group_dba', $object->customer)) |
|
43 | + if (!($bd = self::get_billing_data('org_openpsa_contacts_group_dba', $object->customer)) |
|
44 | 44 | // check if the customerContact is set and has invoice_data |
45 | 45 | && !($bd = self::get_billing_data('org_openpsa_contacts_person_dba', $object->customerContact))) { |
46 | 46 | $bd = new org_openpsa_invoices_billing_data_dba(); |
@@ -77,7 +77,8 @@ discard block |
||
77 | 77 | // if the property useContactAddress is set |
78 | 78 | $billing_data[0]->set_address(); |
79 | 79 | return $billing_data[0]; |
80 | - } catch (midcom_error $e) { |
|
80 | + } |
|
81 | + catch (midcom_error $e) { |
|
81 | 82 | $e->log(); |
82 | 83 | return false; |
83 | 84 | } |
@@ -122,10 +123,12 @@ discard block |
||
122 | 123 | { |
123 | 124 | try { |
124 | 125 | return new org_openpsa_contacts_person_dba($this->linkGuid); |
125 | - } catch (midcom_error $e) { |
|
126 | + } |
|
127 | + catch (midcom_error $e) { |
|
126 | 128 | try { |
127 | 129 | return new org_openpsa_contacts_group_dba($this->linkGuid); |
128 | - } catch (midcom_error $e) { |
|
130 | + } |
|
131 | + catch (midcom_error $e) { |
|
129 | 132 | debug_add("Failed to load contact with GUID: " . $this->linkGuid . " - last error:" . $e->getMessage(), MIDCOM_LOG_ERROR); |
130 | 133 | return false; |
131 | 134 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | - if ( $this->_config->get('sales_pdfbuilder_class') |
|
86 | + if ($this->_config->get('sales_pdfbuilder_class') |
|
87 | 87 | && $this->_salesproject->can_do('midgard:update') |
88 | 88 | && $this->is_pdf_creatable()) { |
89 | 89 | $workflow = $this->get_workflow('datamanager2'); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $this->_request_data['schemadb_salesproject_deliverable'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_deliverable')); |
124 | 124 | |
125 | 125 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
126 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb_salesproject']; |
|
126 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb_salesproject']; |
|
127 | 127 | $this->_request_data['controller']->set_storage($this->_salesproject); |
128 | 128 | $this->_request_data['controller']->process_ajax(); |
129 | 129 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $this->_request_data['deliverables_objects'] = array(); |
180 | 180 | foreach ($deliverables as $deliverable) { |
181 | 181 | $this->_controllers[$deliverable->id] = midcom_helper_datamanager2_controller::create('ajax'); |
182 | - $this->_controllers[$deliverable->id]->schemadb =& $this->_request_data['schemadb_salesproject_deliverable']; |
|
182 | + $this->_controllers[$deliverable->id]->schemadb = & $this->_request_data['schemadb_salesproject_deliverable']; |
|
183 | 183 | $this->_controllers[$deliverable->id]->set_storage($deliverable); |
184 | 184 | $this->_controllers[$deliverable->id]->process_ajax(); |
185 | 185 | $this->_request_data['deliverables_objects'][$deliverable->guid] = $deliverable; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | if ($deliverable->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
229 | 229 | if ($entries = $deliverable->get_at_entries()) { |
230 | 230 | $toolbar['label'] = sprintf($this->_l10n->get('next invoice will be generated on %s'), $formatter->date($entries[0]->start)); |
231 | - if ( $entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
|
231 | + if ($entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
|
232 | 232 | && midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) { |
233 | 233 | $toolbar['buttons']['run_cycle'] = $this->_l10n->get('generate now'); |
234 | 234 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | if ($deliverable->invoiced > 0) { |
242 | 242 | $toolbar['label'] = $this->_l10n->get('invoiced') . ': ' . $formatter->number($deliverable->invoiced); |
243 | 243 | } |
244 | - } elseif ( $deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
244 | + } elseif ($deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
245 | 245 | && midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) { |
246 | 246 | //not invoiced yet |
247 | 247 | $client_class = $this->_config->get('calculator'); |
@@ -48,7 +48,8 @@ |
||
48 | 48 | try { |
49 | 49 | $pdf_helper->render_and_attach(); |
50 | 50 | return $this->reply(true, $this->_l10n->get('pdf created')); |
51 | - } catch (midcom_error $e) { |
|
51 | + } |
|
52 | + catch (midcom_error $e) { |
|
52 | 53 | return $this->reply(false, $this->_l10n->get('pdf creation failed') . ': ' . $e->getMessage()); |
53 | 54 | } |
54 | 55 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | org_openpsa_widgets_contact::add_head_elements(); |
30 | 30 | |
31 | 31 | $head = midcom::get()->head; |
32 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/draggable.min.js'); |
|
33 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/droppable.min.js'); |
|
34 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/selectable.min.js'); |
|
35 | - $head->add_jsfile(MIDCOM_JQUERY_UI_URL. '/widgets/tabs.min.js'); |
|
32 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/draggable.min.js'); |
|
33 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/droppable.min.js'); |
|
34 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/selectable.min.js'); |
|
35 | + $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/widgets/tabs.min.js'); |
|
36 | 36 | $head->add_jsfile(MIDCOM_STATIC_URL . $prefix . 'js/elfinder.min.js'); |
37 | 37 | |
38 | 38 | $lang = midcom::get()->i18n->get_current_language(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function _load_schemadb() |
31 | 31 | { |
32 | 32 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb')); |
33 | - if ( $this->_mode == 'create' |
|
33 | + if ($this->_mode == 'create' |
|
34 | 34 | && count($this->_master->_handler['args']) == 1) { |
35 | 35 | // We're creating invoice for chosen customer |
36 | 36 | try { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | private function _modify_schema() |
49 | 49 | { |
50 | - $fields =& $this->_schemadb['default']->fields; |
|
50 | + $fields = & $this->_schemadb['default']->fields; |
|
51 | 51 | // Fill VAT select |
52 | 52 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
53 | 53 | if (!empty($vat_array)) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private function _populate_schema_customers_for_contact($contact_id) |
92 | 92 | { |
93 | - $fields =& $this->_schemadb['default']->fields; |
|
93 | + $fields = & $this->_schemadb['default']->fields; |
|
94 | 94 | $organizations = array(0 => ''); |
95 | 95 | |
96 | 96 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | private function _populate_schema_contacts_for_customer($customer) |
114 | 114 | { |
115 | - $fields =& $this->_schemadb['default']->fields; |
|
115 | + $fields = & $this->_schemadb['default']->fields; |
|
116 | 116 | // We know the customer company, present contact as a select widget |
117 | 117 | $persons_array = array(); |
118 | 118 | $qb = org_openpsa_contacts_person_dba::new_query_builder(); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | // sending per email enabled in billing data? |
238 | 238 | $billing_data = org_openpsa_invoices_billing_data_dba::get_by_object($this->_object); |
239 | - if ( !$this->_object->sent |
|
239 | + if (!$this->_object->sent |
|
240 | 240 | && intval($billing_data->sendingoption) == 2) { |
241 | 241 | $buttons[] = $this->build_button('send_by_mail', 'stock-icons/16x16/stock_mail-reply.png'); |
242 | 242 | } |
@@ -35,7 +35,8 @@ discard block |
||
35 | 35 | // We're creating invoice for chosen customer |
36 | 36 | try { |
37 | 37 | $this->customer = new org_openpsa_contacts_group_dba($this->_master->_handler['args'][0]); |
38 | - } catch (midcom_error $e) { |
|
38 | + } |
|
39 | + catch (midcom_error $e) { |
|
39 | 40 | $this->contact = new org_openpsa_contacts_person_dba($this->_master->_handler['args'][0]); |
40 | 41 | } |
41 | 42 | } |
@@ -75,7 +76,8 @@ discard block |
||
75 | 76 | try { |
76 | 77 | $this->customer = org_openpsa_contacts_group_dba::get_cached($this->_object->customer); |
77 | 78 | $this->_populate_schema_contacts_for_customer($this->customer); |
78 | - } catch (midcom_error $e) { |
|
79 | + } |
|
80 | + catch (midcom_error $e) { |
|
79 | 81 | $fields['customer']['hidden'] = true; |
80 | 82 | $e->log(); |
81 | 83 | } |