@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $invoice_sum = 0; |
35 | 35 | foreach ($this->_object->get_invoice_items() as $item) { |
36 | - $entry = array(); |
|
36 | + $entry = array(); |
|
37 | 37 | $entry['id'] = $item->id; |
38 | 38 | try { |
39 | 39 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($item->deliverable); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | private function _verify_post_data() |
150 | 150 | { |
151 | - if ( empty($_POST['oper']) |
|
151 | + if (empty($_POST['oper']) |
|
152 | 152 | || !isset($_POST['id']) |
153 | 153 | || !isset($_POST['description']) |
154 | 154 | || !isset($_POST['price']) |
@@ -38,13 +38,15 @@ |
||
38 | 38 | try { |
39 | 39 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($item->deliverable); |
40 | 40 | $entry['deliverable'] = $deliverable->title; |
41 | - } catch (midcom_error $e) { |
|
41 | + } |
|
42 | + catch (midcom_error $e) { |
|
42 | 43 | $entry['deliverable'] = ''; |
43 | 44 | } |
44 | 45 | try { |
45 | 46 | $task = org_openpsa_projects_task_dba::get_cached($item->task); |
46 | 47 | $entry['task'] = $task->title; |
47 | - } catch (midcom_error $e) { |
|
48 | + } |
|
49 | + catch (midcom_error $e) { |
|
48 | 50 | $entry['task'] = ''; |
49 | 51 | } |
50 | 52 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_billing_data')); |
27 | 27 | |
28 | - $fields =& $schemadb[$this->get_schema_name()]->fields; |
|
28 | + $fields = & $schemadb[$this->get_schema_name()]->fields; |
|
29 | 29 | // Fill VAT select |
30 | 30 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
31 | 31 | if (!empty($vat_array)) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | $workflow = $this->get_workflow('datamanager2', array('controller' => $data['controller'])); |
79 | - if ( $mode == 'edit' |
|
79 | + if ($mode == 'edit' |
|
80 | 80 | && $billing_data[0]->can_do('midgard:delete')) { |
81 | 81 | $delete = $this->get_workflow('delete', array( |
82 | 82 | 'object' => $billing_data[0], |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function _on_creating() |
20 | 20 | { |
21 | - if ( $this->invoice |
|
21 | + if ($this->invoice |
|
22 | 22 | && $this->position == 0) { |
23 | 23 | $invoice = org_openpsa_invoices_invoice_dba::get_cached($this->invoice); |
24 | 24 | $this->position = count($invoice->get_invoice_items()) + 1; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } catch (midcom_error $e) { |
70 | 70 | } |
71 | 71 | } |
72 | - if ( $url == '' |
|
72 | + if ($url == '' |
|
73 | 73 | && $sales_url) { |
74 | 74 | try { |
75 | 75 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $invoice = new org_openpsa_invoices_invoice_dba($this->invoice); |
92 | 92 | $old_sum = $invoice->sum; |
93 | 93 | self::update_invoice($invoice); |
94 | - if ( $old_sum != $invoice->sum |
|
94 | + if ($old_sum != $invoice->sum |
|
95 | 95 | && !empty($this->deliverable)) { |
96 | 96 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable); |
97 | 97 | self::update_deliverable($deliverable); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | if ($invoiced != $deliverable->invoiced) { |
133 | 133 | $deliverable->invoiced = $invoiced; |
134 | - if ( $deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
134 | + if ($deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
135 | 135 | && $deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED) { |
136 | 136 | $deliverable->state = org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED; |
137 | 137 | } |
@@ -66,7 +66,8 @@ discard block |
||
66 | 66 | try { |
67 | 67 | $task = org_openpsa_projects_task_dba::get_cached($this->task); |
68 | 68 | $url = $projects_url . 'task/' . $task->guid . '/'; |
69 | - } catch (midcom_error $e) { |
|
69 | + } |
|
70 | + catch (midcom_error $e) { |
|
70 | 71 | } |
71 | 72 | } |
72 | 73 | if ( $url == '' |
@@ -74,7 +75,8 @@ discard block |
||
74 | 75 | try { |
75 | 76 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable); |
76 | 77 | $url = $sales_url . 'deliverable/' . $deliverable->guid . '/'; |
77 | - } catch (midcom_error $e) { |
|
78 | + } |
|
79 | + catch (midcom_error $e) { |
|
78 | 80 | } |
79 | 81 | } |
80 | 82 | if ($url != '') { |
@@ -96,7 +98,8 @@ discard block |
||
96 | 98 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable); |
97 | 99 | self::update_deliverable($deliverable); |
98 | 100 | } |
99 | - } catch (midcom_error $e) { |
|
101 | + } |
|
102 | + catch (midcom_error $e) { |
|
100 | 103 | $e->log(); |
101 | 104 | } |
102 | 105 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $entries = array_merge($this->get_status_entries(), $this->get_journal_entries()); |
87 | 87 | |
88 | - usort($entries, function ($a, $b) { |
|
88 | + usort($entries, function($a, $b) { |
|
89 | 89 | if ($a['timestamp'] == $b['timestamp']) { |
90 | 90 | if ($a['order'] == $b['order']) { |
91 | 91 | return 0; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | 'order' => 3 |
123 | 123 | ); |
124 | 124 | } |
125 | - if ( $this->invoice->due |
|
126 | - && ( ( $this->invoice->due < time() |
|
125 | + if ($this->invoice->due |
|
126 | + && (($this->invoice->due < time() |
|
127 | 127 | && $this->invoice->paid == 0) |
128 | 128 | || $this->invoice->due < $this->invoice->paid)) { |
129 | 129 | $entries[] = array( |
@@ -174,7 +174,8 @@ |
||
174 | 174 | try { |
175 | 175 | midcom_db_topic::get_cached($node_guid); |
176 | 176 | $this->_available_generators[$component] = $loc; |
177 | - } catch (midcom_error $e) { |
|
177 | + } |
|
178 | + catch (midcom_error $e) { |
|
178 | 179 | debug_add("topic for component '{$component}' not found or accessible"); |
179 | 180 | } |
180 | 181 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | private function _get_invoices_for_subscription($deliverable, $at_entry) |
51 | 51 | { |
52 | - if ( $deliverable->invoiceByActualUnits |
|
52 | + if ($deliverable->invoiceByActualUnits |
|
53 | 53 | && $at_entry->arguments['cycle'] > 1) { |
54 | 54 | $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1); |
55 | 55 | if ($invoice_sum == 0) { |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $time = $at_entry->start; |
66 | 66 | $scheduler = new org_openpsa_invoices_scheduler($deliverable); |
67 | 67 | |
68 | - while ( $time < $this->_request_data['end'] |
|
69 | - && ( $time < $deliverable->end |
|
68 | + while ($time < $this->_request_data['end'] |
|
69 | + && ($time < $deliverable->end |
|
70 | 70 | || $deliverable->continuous)) { |
71 | 71 | $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base); |
72 | 72 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | foreach ($at_entries as $at_entry) { |
110 | 110 | try { |
111 | 111 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
112 | - if ( $deliverable->continuous |
|
113 | - || ( $deliverable->start < $this->_request_data['end'] |
|
112 | + if ($deliverable->continuous |
|
113 | + || ($deliverable->start < $this->_request_data['end'] |
|
114 | 114 | && $deliverable->end > $this->_request_data['start'])) { |
115 | 115 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
116 | 116 | } |
@@ -114,7 +114,8 @@ |
||
114 | 114 | && $deliverable->end > $this->_request_data['start'])) { |
115 | 115 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
116 | 116 | } |
117 | - } catch (midcom_error $e) { |
|
117 | + } |
|
118 | + catch (midcom_error $e) { |
|
118 | 119 | } |
119 | 120 | } |
120 | 121 | $invoices = array_merge($invoices, $this->_get_deliverable_invoices()); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $this->_group = new org_openpsa_products_product_group_dba($args[0]); |
33 | 33 | |
34 | 34 | $data['controller'] = midcom_helper_datamanager2_controller::create('simple'); |
35 | - $data['controller']->schemadb =& $this->_request_data['schemadb_group']; |
|
35 | + $data['controller']->schemadb = & $this->_request_data['schemadb_group']; |
|
36 | 36 | $data['controller']->set_storage($this->_group); |
37 | 37 | if (!$data['controller']->initialize()) { |
38 | 38 | throw new midcom_error("Failed to initialize a DM2 controller instance for product {$this->_group->id}."); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function load_schemadb() |
44 | 44 | { |
45 | - $this->_schemadb =& $this->_request_data['schemadb_product']; |
|
45 | + $this->_schemadb = & $this->_request_data['schemadb_product']; |
|
46 | 46 | |
47 | 47 | return $this->_schemadb; |
48 | 48 | } |
@@ -132,7 +132,8 @@ |
||
132 | 132 | } elseif ((int) $args[0] > 0) { |
133 | 133 | try { |
134 | 134 | $this->parent = new org_openpsa_products_product_group_dba((int) $args[0]); |
135 | - } catch (midcom_error $e) { |
|
135 | + } |
|
136 | + catch (midcom_error $e) { |
|
136 | 137 | $e->log(); |
137 | 138 | } |
138 | 139 | } |
@@ -43,6 +43,6 @@ |
||
43 | 43 | */ |
44 | 44 | public function _load_schemadb() |
45 | 45 | { |
46 | - $this->_schemadb =& $this->_request_data['schemadb_product']; |
|
46 | + $this->_schemadb = & $this->_request_data['schemadb_product']; |
|
47 | 47 | } |
48 | 48 | } |