@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | // generate next action buttons |
59 | - if ( $invoice->can_do('midgard:update') |
|
59 | + if ($invoice->can_do('midgard:update') |
|
60 | 60 | && count($next_marker) > 0) |
61 | 61 | { |
62 | 62 | foreach ($next_marker as $mark) |
@@ -73,10 +73,8 @@ discard block |
||
73 | 73 | { |
74 | 74 | if ($mode !== 'dashboard') |
75 | 75 | { |
76 | - $this->_view_toolbar->add_item |
|
77 | - ( |
|
78 | - array |
|
79 | - ( |
|
76 | + $this->_view_toolbar->add_item( |
|
77 | + array( |
|
80 | 78 | MIDCOM_TOOLBAR_URL => '', |
81 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('dashboard'), |
82 | 80 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png', |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) |
87 | 85 | { |
88 | 86 | $workflow = $this->get_workflow('datamanager2'); |
89 | - $this->_view_toolbar->add_item($workflow->get_button('invoice/new/', array |
|
90 | - ( |
|
87 | + $this->_view_toolbar->add_item($workflow->get_button('invoice/new/', array( |
|
91 | 88 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create invoice'), |
92 | 89 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', |
93 | 90 | ))); |
@@ -106,10 +103,8 @@ discard block |
||
106 | 103 | |
107 | 104 | if (sizeof($results) == 1) |
108 | 105 | { |
109 | - $toolbar->add_item |
|
110 | - ( |
|
111 | - array |
|
112 | - ( |
|
106 | + $toolbar->add_item( |
|
107 | + array( |
|
113 | 108 | MIDCOM_TOOLBAR_URL => $urlprefix . key($results) . '/', |
114 | 109 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'), |
115 | 110 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/back.png', |
@@ -129,10 +124,8 @@ discard block |
||
129 | 124 | |
130 | 125 | if (sizeof($results) == 1) |
131 | 126 | { |
132 | - $toolbar->add_item |
|
133 | - ( |
|
134 | - array |
|
135 | - ( |
|
127 | + $toolbar->add_item( |
|
128 | + array( |
|
136 | 129 | MIDCOM_TOOLBAR_URL => $urlprefix . key($results) . '/', |
137 | 130 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'), |
138 | 131 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/next.png', |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | if (array_key_exists($this->_schema, $schemadb)) |
69 | 69 | { |
70 | 70 | $schema_name = $this->_schema; |
71 | - } |
|
72 | - else |
|
71 | + } else |
|
73 | 72 | { |
74 | 73 | $schema_name = key($schemadb); |
75 | 74 | } |
@@ -110,8 +109,7 @@ discard block |
||
110 | 109 | { |
111 | 110 | $this->_rows[] = array($row); |
112 | 111 | } |
113 | - } |
|
114 | - else |
|
112 | + } else |
|
115 | 113 | { |
116 | 114 | $this->_rows = $rows; |
117 | 115 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | $cancelation_invoice = new org_openpsa_invoices_invoice_dba($this->invoice->cancelationInvoice); |
116 | 116 | $cancelation_invoice_link = $prefix . 'invoice/' . $cancelation_invoice->guid . '/'; |
117 | 117 | $cancelation_invoice_link = "<a href=\"" . $cancelation_invoice_link . "\">" . $this->l10n->get('invoice') . " " . $cancelation_invoice->get_label() . "</a>"; |
118 | - $entries[] = array |
|
119 | - ( |
|
118 | + $entries[] = array( |
|
120 | 119 | 'timestamp' => $cancelation_invoice->metadata->created, |
121 | 120 | 'message' => sprintf($this->l10n->get('invoice got canceled by %s'), $cancelation_invoice_link), |
122 | 121 | 'order' => 4 |
@@ -124,20 +123,18 @@ discard block |
||
124 | 123 | } |
125 | 124 | else if ($this->invoice->paid) |
126 | 125 | { |
127 | - $entries[] = array |
|
128 | - ( |
|
126 | + $entries[] = array( |
|
129 | 127 | 'timestamp' => $this->invoice->paid, |
130 | 128 | 'message' => sprintf($this->l10n->get('marked invoice %s paid'), ''), |
131 | 129 | 'order' => 3 |
132 | 130 | ); |
133 | 131 | } |
134 | - if ( $this->invoice->due |
|
135 | - && ( ( $this->invoice->due < time() |
|
132 | + if ($this->invoice->due |
|
133 | + && (($this->invoice->due < time() |
|
136 | 134 | && $this->invoice->paid == 0) |
137 | 135 | || $this->invoice->due < $this->invoice->paid)) |
138 | 136 | { |
139 | - $entries[] = array |
|
140 | - ( |
|
137 | + $entries[] = array( |
|
141 | 138 | 'timestamp' => $this->invoice->due, |
142 | 139 | 'message' => $this->l10n->get('overdue'), |
143 | 140 | 'order' => 2 |
@@ -148,8 +145,7 @@ discard block |
||
148 | 145 | { |
149 | 146 | if ($mail_time = $this->invoice->get_parameter('org.openpsa.invoices', 'sent_by_mail')) |
150 | 147 | { |
151 | - $entries[] = array |
|
152 | - ( |
|
148 | + $entries[] = array( |
|
153 | 149 | 'timestamp' => $mail_time, |
154 | 150 | 'message' => sprintf($this->l10n->get('marked invoice %s sent per mail'), ''), |
155 | 151 | 'order' => 1 |
@@ -157,16 +153,14 @@ discard block |
||
157 | 153 | } |
158 | 154 | else |
159 | 155 | { |
160 | - $entries[] = array |
|
161 | - ( |
|
156 | + $entries[] = array( |
|
162 | 157 | 'timestamp' => $this->invoice->sent, |
163 | 158 | 'message' => sprintf($this->l10n->get('marked invoice %s sent'), ''), |
164 | 159 | 'order' => 1 |
165 | 160 | ); |
166 | 161 | } |
167 | 162 | } |
168 | - $entries[] = array |
|
169 | - ( |
|
163 | + $entries[] = array( |
|
170 | 164 | 'timestamp' => $this->invoice->metadata->created, |
171 | 165 | 'message' => sprintf($this->l10n->get('invoice %s created'), ''), |
172 | 166 | 'order' => 0 |
@@ -183,8 +177,7 @@ discard block |
||
183 | 177 | |
184 | 178 | foreach ($rows as $row) |
185 | 179 | { |
186 | - $entries[] = array |
|
187 | - ( |
|
180 | + $entries[] = array( |
|
188 | 181 | 'timestamp' => strtotime((string) $row['created']), |
189 | 182 | 'message' => $row['title'] |
190 | 183 | ); |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | 'message' => sprintf($this->l10n->get('invoice got canceled by %s'), $cancelation_invoice_link), |
122 | 122 | 'order' => 4 |
123 | 123 | ); |
124 | - } |
|
125 | - else if ($this->invoice->paid) |
|
124 | + } else if ($this->invoice->paid) |
|
126 | 125 | { |
127 | 126 | $entries[] = array |
128 | 127 | ( |
@@ -154,8 +153,7 @@ discard block |
||
154 | 153 | 'message' => sprintf($this->l10n->get('marked invoice %s sent per mail'), ''), |
155 | 154 | 'order' => 1 |
156 | 155 | ); |
157 | - } |
|
158 | - else |
|
156 | + } else |
|
159 | 157 | { |
160 | 158 | $entries[] = array |
161 | 159 | ( |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | // TODO: Warehouse management: create new order |
95 | - if ( $this->_deliverable->end < $next_cycle_start |
|
95 | + if ($this->_deliverable->end < $next_cycle_start |
|
96 | 96 | && $this->_deliverable->end != 0) |
97 | 97 | { |
98 | 98 | debug_add('Do not register next cycle, the contract ends before'); |
@@ -112,8 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | private function _create_at_entry($cycle_number, $start) |
114 | 114 | { |
115 | - $args = array |
|
116 | - ( |
|
115 | + $args = array( |
|
117 | 116 | 'deliverable' => $this->_deliverable->guid, |
118 | 117 | 'cycle' => $cycle_number, |
119 | 118 | ); |
@@ -344,7 +343,7 @@ discard block |
||
344 | 343 | { |
345 | 344 | //If previous cycle was run at the end of the month, the new one should be at the end of the month as well |
346 | 345 | $date = new DateTime(gmdate('Y-m-d', $time), new DateTimeZone('GMT')); |
347 | - if ( $date->format('t') == $date->format('j') |
|
346 | + if ($date->format('t') == $date->format('j') |
|
348 | 347 | && $new_date->format('t') != $new_date->format('j')) |
349 | 348 | { |
350 | 349 | $new_date->setDate((int) $new_date->format('Y'), (int) $new_date->format('m'), (int) $new_date->format('t')); |
@@ -415,11 +414,11 @@ discard block |
||
415 | 414 | break; |
416 | 415 | case 'q': |
417 | 416 | // Quarterly recurring subscription |
418 | - $identifier = ceil(((int)$date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
417 | + $identifier = ceil(((int) $date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
419 | 418 | break; |
420 | 419 | case 'hy': |
421 | 420 | // Half-yearly recurring subscription |
422 | - $identifier = ceil(((int)$date->format('n')) / 6) . '/' . $date->format('Y'); |
|
421 | + $identifier = ceil(((int) $date->format('n')) / 6) . '/' . $date->format('Y'); |
|
423 | 422 | break; |
424 | 423 | case 'y': |
425 | 424 | // Yearly recurring subscription |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | if (org_openpsa_projects_workflow::complete($task, sprintf($this->_i18n->get_string('completed by subscription %s', 'org.openpsa.sales'), $cycle_number))) |
79 | 79 | { |
80 | 80 | $tasks_completed[] = $task; |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | $tasks_not_completed[] = $task; |
85 | 84 | } |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | try |
142 | 141 | { |
143 | 142 | $owner = midcom_db_person::get_cached($salesproject->owner); |
144 | - } |
|
145 | - catch (midcom_error $e) |
|
143 | + } catch (midcom_error $e) |
|
146 | 144 | { |
147 | 145 | $e->log(); |
148 | 146 | return; |
@@ -152,8 +150,7 @@ discard block |
||
152 | 150 | if (is_null($next_run)) |
153 | 151 | { |
154 | 152 | $next_run_label = $l10n->get('no more cycles'); |
155 | - } |
|
156 | - else |
|
153 | + } else |
|
157 | 154 | { |
158 | 155 | $next_run_label = $l10n->get_formatter()->date($next_run); |
159 | 156 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($task->agreement); |
57 | 57 | $item->deliverable = $deliverable->id; |
58 | - } |
|
59 | - catch (midcom_error $e) |
|
58 | + } catch (midcom_error $e) |
|
60 | 59 | { |
61 | 60 | $e->log(); |
62 | 61 | } |
@@ -155,8 +154,7 @@ discard block |
||
155 | 154 | $customer = org_openpsa_contacts_group_dba::get_cached($customer_id); |
156 | 155 | $data['customer_label'] = $customer->official; |
157 | 156 | $data['disabled'] = ''; |
158 | - } |
|
159 | - catch (midcom_error $e) |
|
157 | + } catch (midcom_error $e) |
|
160 | 158 | { |
161 | 159 | $data['customer_label'] = $this->_l10n->get('no customer'); |
162 | 160 | $data['disabled'] = ' disabled="disabled"'; |
@@ -180,21 +178,18 @@ discard block |
||
180 | 178 | if ($deliverable->invoiceByActualUnits) |
181 | 179 | { |
182 | 180 | $data['invoiceable_units'] = $task->invoiceableHours; |
183 | - } |
|
184 | - else |
|
181 | + } else |
|
185 | 182 | { |
186 | 183 | $data['invoiceable_units'] = $task->plannedHours; |
187 | 184 | } |
188 | - } |
|
189 | - catch (midcom_error $e) |
|
185 | + } catch (midcom_error $e) |
|
190 | 186 | { |
191 | 187 | $e->log(); |
192 | 188 | if ($this->_config->get('default_hourly_price')) |
193 | 189 | { |
194 | 190 | $data['default_price'] = $this->_config->get('default_hourly_price'); |
195 | 191 | $data['invoiceable_units'] = $task->invoiceableHours; |
196 | - } |
|
197 | - else |
|
192 | + } else |
|
198 | 193 | { |
199 | 194 | $data['default_price'] = ''; |
200 | 195 | } |
@@ -50,8 +50,7 @@ |
||
50 | 50 | |
51 | 51 | public function get_row(midcom_core_dbaobject $at_entry) |
52 | 52 | { |
53 | - $invoice = array |
|
54 | - ( |
|
53 | + $invoice = array( |
|
55 | 54 | 'time' => strftime('%Y-%m-%d %H:%M:%S', $at_entry->start), |
56 | 55 | 'month' => strftime('%B %Y', $at_entry->start), |
57 | 56 | 'index_month' => strftime('%Y-%m', $at_entry->start), |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
62 | 62 | $salesproject = org_openpsa_sales_salesproject_dba::get_cached($deliverable->salesproject); |
63 | - } |
|
64 | - catch (midcom_error $e) |
|
63 | + } catch (midcom_error $e) |
|
65 | 64 | { |
66 | 65 | $e->log(); |
67 | 66 | return $invoice; |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | { |
72 | 71 | $type = $this->_i18n->get_l10n('org.openpsa.expenses')->get('invoiceable reports'); |
73 | 72 | $invoice_sum = $deliverable->units * $deliverable->pricePerUnit; |
74 | - } |
|
75 | - else |
|
73 | + } else |
|
76 | 74 | { |
77 | 75 | $invoice_sum = $deliverable->price; |
78 | 76 | $type = $this->_i18n->get_l10n('org.openpsa.reports')->get('fixed price'); |
@@ -106,8 +104,7 @@ discard block |
||
106 | 104 | $object = $classname::get_cached($id); |
107 | 105 | $invoice[$fieldname] = $object->render_link(); |
108 | 106 | $invoice['index_' . $fieldname] = $object->get_label(); |
109 | - } |
|
110 | - catch (midcom_error $e) |
|
107 | + } catch (midcom_error $e) |
|
111 | 108 | { |
112 | 109 | $e->log(); |
113 | 110 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function _load_schemadb() |
19 | 19 | { |
20 | 20 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb')); |
21 | - if ( $this->_mode == 'create' |
|
21 | + if ($this->_mode == 'create' |
|
22 | 22 | && count($this->_master->_handler['args']) == 1) |
23 | 23 | { |
24 | 24 | // We're creating invoice for chosen customer |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | private function _modify_schema() |
41 | 41 | { |
42 | - $fields =& $this->_schemadb['default']->fields; |
|
42 | + $fields = & $this->_schemadb['default']->fields; |
|
43 | 43 | // Fill VAT select |
44 | 44 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
45 | 45 | if (!empty($vat_array)) |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function _populate_schema_customers_for_contact($contact_id) |
102 | 102 | { |
103 | - $fields =& $this->_schemadb['default']->fields; |
|
103 | + $fields = & $this->_schemadb['default']->fields; |
|
104 | 104 | $organizations = array(0 => ''); |
105 | 105 | $member_mc = org_openpsa_contacts_member_dba::new_collector('uid', $contact_id); |
106 | 106 | $member_mc->add_constraint('gid.orgOpenpsaObtype', '>', org_openpsa_contacts_group_dba::MYCONTACTS); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | private function _populate_schema_contacts_for_customer($customer) |
125 | 125 | { |
126 | - $fields =& $this->_schemadb['default']->fields; |
|
126 | + $fields = & $this->_schemadb['default']->fields; |
|
127 | 127 | // We know the customer company, present contact as a select widget |
128 | 128 | $persons_array = array(); |
129 | 129 | $member_mc = midcom_db_member::new_collector('gid', $customer->id); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $person = org_openpsa_contacts_person_dba::get_cached($member); |
136 | 136 | $persons_array[$person->id] = $person->rname; |
137 | 137 | } |
138 | - catch (midcom_error $e){} |
|
138 | + catch (midcom_error $e) {} |
|
139 | 139 | } |
140 | 140 | asort($persons_array); |
141 | 141 | $fields['customerContact']['widget'] = 'select'; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | { |
157 | 157 | $this->_object = new org_openpsa_invoices_invoice_dba(); |
158 | 158 | |
159 | - if (! $this->_object->create()) |
|
159 | + if (!$this->_object->create()) |
|
160 | 160 | { |
161 | 161 | debug_print_r('We operated on this object:', $this->_object); |
162 | 162 | throw new midcom_error("Failed to create a new invoice. Error: " . midcom_connection::get_error_string()); |
@@ -233,8 +233,7 @@ discard block |
||
233 | 233 | if ($this->_object->can_do('midgard:update')) |
234 | 234 | { |
235 | 235 | $workflow = $this->get_workflow('datamanager2'); |
236 | - $buttons[] = $workflow->get_button("invoice/edit/{$this->_object->guid}/", array |
|
237 | - ( |
|
236 | + $buttons[] = $workflow->get_button("invoice/edit/{$this->_object->guid}/", array( |
|
238 | 237 | MIDCOM_TOOLBAR_ACCESSKEY => 'e', |
239 | 238 | )); |
240 | 239 | } |
@@ -245,8 +244,7 @@ discard block |
||
245 | 244 | $buttons[] = $workflow->get_button("invoice/delete/{$this->_object->guid}/"); |
246 | 245 | } |
247 | 246 | |
248 | - $buttons[] = array |
|
249 | - ( |
|
247 | + $buttons[] = array( |
|
250 | 248 | MIDCOM_TOOLBAR_URL => "invoice/items/{$this->_object->guid}/", |
251 | 249 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit invoice items'), |
252 | 250 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', |
@@ -255,14 +253,12 @@ discard block |
||
255 | 253 | |
256 | 254 | if (!$this->_object->sent) |
257 | 255 | { |
258 | - $buttons[] = array |
|
259 | - ( |
|
256 | + $buttons[] = array( |
|
260 | 257 | MIDCOM_TOOLBAR_URL => "invoice/process/", |
261 | 258 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark sent'), |
262 | 259 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail-reply.png', |
263 | 260 | MIDCOM_TOOLBAR_POST => true, |
264 | - MIDCOM_TOOLBAR_POST_HIDDENARGS => array |
|
265 | - ( |
|
261 | + MIDCOM_TOOLBAR_POST_HIDDENARGS => array( |
|
266 | 262 | 'action' => 'mark_sent', |
267 | 263 | 'id' => $this->_object->id, |
268 | 264 | 'relocate' => true |
@@ -272,14 +268,12 @@ discard block |
||
272 | 268 | } |
273 | 269 | else if (!$this->_object->paid) |
274 | 270 | { |
275 | - $buttons[] = array |
|
276 | - ( |
|
271 | + $buttons[] = array( |
|
277 | 272 | MIDCOM_TOOLBAR_URL => "invoice/process/", |
278 | 273 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark paid'), |
279 | 274 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/ok.png', |
280 | 275 | MIDCOM_TOOLBAR_POST => true, |
281 | - MIDCOM_TOOLBAR_POST_HIDDENARGS => array |
|
282 | - ( |
|
276 | + MIDCOM_TOOLBAR_POST_HIDDENARGS => array( |
|
283 | 277 | 'action' => 'mark_paid', |
284 | 278 | 'id' => $this->_object->id, |
285 | 279 | 'relocate' => true |
@@ -288,11 +282,10 @@ discard block |
||
288 | 282 | ); |
289 | 283 | } |
290 | 284 | |
291 | - if ( !$this->_object->paid |
|
285 | + if (!$this->_object->paid |
|
292 | 286 | && $this->_config->get('invoice_pdfbuilder_class')) |
293 | 287 | { |
294 | - $buttons[] = array |
|
295 | - ( |
|
288 | + $buttons[] = array( |
|
296 | 289 | MIDCOM_TOOLBAR_URL => "invoice/pdf/{$this->_object->guid}/", |
297 | 290 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create pdf'), |
298 | 291 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', |
@@ -301,14 +294,12 @@ discard block |
||
301 | 294 | $billing_data = $this->_object->get_billing_data(); |
302 | 295 | if (intval($billing_data->sendingoption) == 2) |
303 | 296 | { |
304 | - $buttons[] = array |
|
305 | - ( |
|
297 | + $buttons[] = array( |
|
306 | 298 | MIDCOM_TOOLBAR_URL => "invoice/process/", |
307 | 299 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark sent_per_mail'), |
308 | 300 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail-reply.png', |
309 | 301 | MIDCOM_TOOLBAR_POST => true, |
310 | - MIDCOM_TOOLBAR_POST_HIDDENARGS => array |
|
311 | - ( |
|
302 | + MIDCOM_TOOLBAR_POST_HIDDENARGS => array( |
|
312 | 303 | 'action' => 'send_by_mail', |
313 | 304 | 'id' => $this->_object->id, |
314 | 305 | 'relocate' => true |
@@ -320,14 +311,12 @@ discard block |
||
320 | 311 | |
321 | 312 | if ($this->_object->is_cancelable()) |
322 | 313 | { |
323 | - $buttons[] = array |
|
324 | - ( |
|
314 | + $buttons[] = array( |
|
325 | 315 | MIDCOM_TOOLBAR_URL => "invoice/process/", |
326 | 316 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create cancelation'), |
327 | 317 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/cancel.png', |
328 | 318 | MIDCOM_TOOLBAR_POST => true, |
329 | - MIDCOM_TOOLBAR_POST_HIDDENARGS => array |
|
330 | - ( |
|
319 | + MIDCOM_TOOLBAR_POST_HIDDENARGS => array( |
|
331 | 320 | 'action' => 'create_cancelation', |
332 | 321 | 'id' => $this->_object->id, |
333 | 322 | 'relocate' => true |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | try |
26 | 26 | { |
27 | 27 | $this->_request_data['customer'] = new org_openpsa_contacts_group_dba($this->_master->_handler['args'][0]); |
28 | - } |
|
29 | - catch (midcom_error $e) |
|
28 | + } catch (midcom_error $e) |
|
30 | 29 | { |
31 | 30 | $this->_request_data['customer'] = new org_openpsa_contacts_person_dba($this->_master->_handler['args'][0]); |
32 | 31 | } |
@@ -63,32 +62,27 @@ discard block |
||
63 | 62 | if (!empty($this->_object->customerContact)) |
64 | 63 | { |
65 | 64 | $this->_populate_schema_customers_for_contact($this->_object->customerContact); |
66 | - } |
|
67 | - else if (array_key_exists('customer', $this->_request_data)) |
|
65 | + } else if (array_key_exists('customer', $this->_request_data)) |
|
68 | 66 | { |
69 | 67 | if (is_a($this->_request_data['customer'], 'org_openpsa_contacts_group_dba')) |
70 | 68 | { |
71 | 69 | $this->_populate_schema_contacts_for_customer($this->_request_data['customer']); |
72 | - } |
|
73 | - else |
|
70 | + } else |
|
74 | 71 | { |
75 | 72 | $this->_populate_schema_customers_for_contact($this->_request_data['customer']->id); |
76 | 73 | } |
77 | - } |
|
78 | - else if (!empty($this->_object->customer)) |
|
74 | + } else if (!empty($this->_object->customer)) |
|
79 | 75 | { |
80 | 76 | try |
81 | 77 | { |
82 | 78 | $this->_request_data['customer'] = org_openpsa_contacts_group_dba::get_cached($this->_object->customer); |
83 | 79 | $this->_populate_schema_contacts_for_customer($this->_request_data['customer']); |
84 | - } |
|
85 | - catch (midcom_error $e) |
|
80 | + } catch (midcom_error $e) |
|
86 | 81 | { |
87 | 82 | $fields['customer']['hidden'] = true; |
88 | 83 | $e->log(); |
89 | 84 | } |
90 | - } |
|
91 | - else |
|
85 | + } else |
|
92 | 86 | { |
93 | 87 | // We don't know company, present customer contact as chooser and hide customer field |
94 | 88 | $fields['customer']['hidden'] = true; |
@@ -134,8 +128,7 @@ discard block |
||
134 | 128 | { |
135 | 129 | $person = org_openpsa_contacts_person_dba::get_cached($member); |
136 | 130 | $persons_array[$person->id] = $person->rname; |
137 | - } |
|
138 | - catch (midcom_error $e){} |
|
131 | + } catch (midcom_error $e){} |
|
139 | 132 | } |
140 | 133 | asort($persons_array); |
141 | 134 | $fields['customerContact']['widget'] = 'select'; |
@@ -184,8 +177,7 @@ discard block |
||
184 | 177 | |
185 | 178 | // we got a customer, set description default |
186 | 179 | $this->_defaults['description'] = $dummy->get_default('remarks'); |
187 | - } |
|
188 | - else |
|
180 | + } else |
|
189 | 181 | { |
190 | 182 | $due_date = ($this->_config->get('default_due_days') * 3600 * 24) + time(); |
191 | 183 | $this->_defaults['due'] = $due_date; |
@@ -269,8 +261,7 @@ discard block |
||
269 | 261 | ), |
270 | 262 | MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'), |
271 | 263 | ); |
272 | - } |
|
273 | - else if (!$this->_object->paid) |
|
264 | + } else if (!$this->_object->paid) |
|
274 | 265 | { |
275 | 266 | $buttons[] = array |
276 | 267 | ( |
@@ -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)) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $billing_data = new org_openpsa_invoices_billing_data_dba(); |
55 | 55 | $billing_data->linkGuid = $this->_linked_object->guid; |
56 | - if (! $billing_data->create()) |
|
56 | + if (!$billing_data->create()) |
|
57 | 57 | { |
58 | 58 | debug_print_r('We operated on this object:', $billing_data); |
59 | 59 | throw new midcom_error("Failed to create a new billing_data. Error: " . midcom_connection::get_error_string()); |
@@ -82,11 +82,10 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $workflow = $this->get_workflow('datamanager2', array('controller' => $data['controller'])); |
85 | - if ( $mode == 'edit' |
|
85 | + if ($mode == 'edit' |
|
86 | 86 | && $billing_data[0]->can_do('midgard:delete')) |
87 | 87 | { |
88 | - $delete = $this->get_workflow('delete', array |
|
89 | - ( |
|
88 | + $delete = $this->get_workflow('delete', array( |
|
90 | 89 | 'object' => $billing_data[0], |
91 | 90 | 'label' => $this->_l10n->get('billing data') |
92 | 91 | )); |
@@ -109,8 +108,7 @@ discard block |
||
109 | 108 | $billing_data->require_do('midgard:delete'); |
110 | 109 | $this->_linked_object = midcom::get()->dbfactory->get_object_by_guid($billing_data->linkGuid); |
111 | 110 | |
112 | - $workflow = $this->get_workflow('delete', array |
|
113 | - ( |
|
111 | + $workflow = $this->get_workflow('delete', array( |
|
114 | 112 | 'object' => $billing_data, |
115 | 113 | 'success_url' => $this->get_relocate_url() |
116 | 114 | )); |
@@ -81,8 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | throw new midcom_error(midcom_connection::get_error_string()); |
83 | 83 | } |
84 | - } |
|
85 | - else |
|
84 | + } else |
|
86 | 85 | { |
87 | 86 | $nodes = $object_qb->execute(); |
88 | 87 | $node = $nodes[0]; |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | if (!empty($this->_request_data['deliverable'])) |
136 | 136 | { |
137 | - $constraints = array |
|
138 | - ( |
|
137 | + $constraints = array( |
|
139 | 138 | 'invoice' => $invoice->id, |
140 | 139 | 'deliverable' => $this->_request_data['deliverable']->id |
141 | 140 | ); |
@@ -194,12 +193,11 @@ discard block |
||
194 | 193 | { |
195 | 194 | $this->_master->prepare_toolbar('dashboard'); |
196 | 195 | |
197 | - if ( $this->_topic->can_do('midgard:update') |
|
196 | + if ($this->_topic->can_do('midgard:update') |
|
198 | 197 | && $this->_topic->can_do('midcom:component_config')) |
199 | 198 | { |
200 | 199 | $workflow = $this->get_workflow('datamanager2'); |
201 | - $this->_node_toolbar->add_item($workflow->get_button('config/', array |
|
202 | - ( |
|
200 | + $this->_node_toolbar->add_item($workflow->get_button('config/', array( |
|
203 | 201 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
204 | 202 | MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'), |
205 | 203 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png', |
@@ -328,16 +326,14 @@ discard block |
||
328 | 326 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) |
329 | 327 | { |
330 | 328 | $workflow = $this->get_workflow('datamanager2'); |
331 | - $buttons[] = $workflow->get_button("invoice/new/{$this->_customer->guid}/", array |
|
332 | - ( |
|
329 | + $buttons[] = $workflow->get_button("invoice/new/{$this->_customer->guid}/", array( |
|
333 | 330 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create invoice'), |
334 | 331 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', |
335 | 332 | )); |
336 | 333 | |
337 | 334 | if ($this->_customer->can_do('midgard:create')) |
338 | 335 | { |
339 | - $buttons[] = $workflow->get_button("billingdata/" . $this->_customer->guid . "/", array |
|
340 | - ( |
|
336 | + $buttons[] = $workflow->get_button("billingdata/" . $this->_customer->guid . "/", array( |
|
341 | 337 | MIDCOM_TOOLBAR_LABEL => $this->_i18n->get_string('edit billingdata', 'org.openpsa.contacts'), |
342 | 338 | MIDCOM_TOOLBAR_OPTIONS => array('data-refresh-opener' => 'false'), |
343 | 339 | )); |
@@ -346,8 +342,7 @@ discard block |
||
346 | 342 | |
347 | 343 | if ($this->_request_data['contacts_url']) |
348 | 344 | { |
349 | - $buttons[] = array |
|
350 | - ( |
|
345 | + $buttons[] = array( |
|
351 | 346 | MIDCOM_TOOLBAR_URL => $this->_request_data['contacts_url'] . (is_a($this->_customer, 'org_openpsa_contacts_group_dba') ? 'group' : 'person') . "/{$this->_customer->guid}/", |
352 | 347 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to customer'), |
353 | 348 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png', |
@@ -399,10 +394,8 @@ discard block |
||
399 | 394 | |
400 | 395 | if ($sales_url) |
401 | 396 | { |
402 | - $this->_view_toolbar->add_item |
|
403 | - ( |
|
404 | - array |
|
405 | - ( |
|
397 | + $this->_view_toolbar->add_item( |
|
398 | + array( |
|
406 | 399 | MIDCOM_TOOLBAR_URL => $sales_url . "deliverable/{$this->_deliverable->guid}/", |
407 | 400 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to deliverable'), |
408 | 401 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png', |
@@ -109,8 +109,7 @@ discard block |
||
109 | 109 | $customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer); |
110 | 110 | $entry['customer'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$customer->guid}/\">" . $customer->get_label() . "</a>"; |
111 | 111 | $entry['index_customer'] = $customer->get_label(); |
112 | - } |
|
113 | - catch (midcom_error $e) |
|
112 | + } catch (midcom_error $e) |
|
114 | 113 | { |
115 | 114 | $entry['customer'] = ''; |
116 | 115 | $entry['index_customer'] = ''; |
@@ -124,8 +123,7 @@ discard block |
||
124 | 123 | $contact = org_openpsa_contacts_person_dba::get_cached($invoice->customerContact); |
125 | 124 | $entry['contact'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$contact->guid}/\">" . $contact->get_label() . "</a>"; |
126 | 125 | $entry['index_contact'] = $contact->get_label(); |
127 | - } |
|
128 | - catch (midcom_error $e) |
|
126 | + } catch (midcom_error $e) |
|
129 | 127 | { |
130 | 128 | $entry['contact'] = ''; |
131 | 129 | $entry['index_contact'] = ''; |
@@ -254,14 +252,12 @@ discard block |
||
254 | 252 | { |
255 | 253 | $mc = org_openpsa_invoices_invoice_item_dba::new_collector('deliverable', $this->_deliverable->id); |
256 | 254 | $qb->add_constraint('id', 'IN', $mc->get_values('invoice')); |
257 | - } |
|
258 | - else if ($this->_customer) |
|
255 | + } else if ($this->_customer) |
|
259 | 256 | { |
260 | 257 | if (is_a($this->_customer, 'org_openpsa_contacts_group_dba')) |
261 | 258 | { |
262 | 259 | $qb->add_constraint('customer', '=', $this->_customer->id); |
263 | - } |
|
264 | - else |
|
260 | + } else |
|
265 | 261 | { |
266 | 262 | $qb->add_constraint('customerContact', '=', $this->_customer->id); |
267 | 263 | } |
@@ -318,8 +314,7 @@ discard block |
||
318 | 314 | try |
319 | 315 | { |
320 | 316 | $this->_customer = new org_openpsa_contacts_group_dba($args[0]); |
321 | - } |
|
322 | - catch (midcom_error $e) |
|
317 | + } catch (midcom_error $e) |
|
323 | 318 | { |
324 | 319 | $this->_customer = new org_openpsa_contacts_person_dba($args[0]); |
325 | 320 | } |
@@ -438,7 +438,7 @@ |
||
438 | 438 | || !isset($_POST['price']) |
439 | 439 | || !isset($_POST['quantity'])) |
440 | 440 | { |
441 | - throw new midcom_error('Incomplete POST data'); |
|
441 | + throw new midcom_error('Incomplete POST data'); |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | midcom::get()->auth->require_valid_user(); |
31 | 31 | |
32 | - if ( empty($_POST['id']) |
|
32 | + if (empty($_POST['id']) |
|
33 | 33 | || empty($_POST['action'])) |
34 | 34 | { |
35 | 35 | throw new midcom_error('Incomplete POST data'); |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | midcom::get()->skip_page_style = true; |
42 | 42 | |
43 | - $data['message'] = array |
|
44 | - ( |
|
43 | + $data['message'] = array( |
|
45 | 44 | 'title' => $this->_l10n->get($this->_component), |
46 | 45 | 'type' => 'error' |
47 | 46 | ); |
@@ -199,8 +198,7 @@ discard block |
||
199 | 198 | $mail = new org_openpsa_mail(); |
200 | 199 | |
201 | 200 | // define replacements for subject / body |
202 | - $mail->parameters = array |
|
203 | - ( |
|
201 | + $mail->parameters = array( |
|
204 | 202 | "INVOICE_LABEL" => $invoice_label, |
205 | 203 | "INVOICE_DATE" => $invoice_date, |
206 | 204 | "FIRSTNAME" => $contactDetails["firstname"], |
@@ -327,7 +325,7 @@ discard block |
||
327 | 325 | $invoice_sum = 0; |
328 | 326 | foreach ($this->_request_data['invoice_items'] as $item) |
329 | 327 | { |
330 | - $entry = array(); |
|
328 | + $entry = array(); |
|
331 | 329 | $entry['id'] = $item->id; |
332 | 330 | try |
333 | 331 | { |
@@ -419,8 +417,7 @@ discard block |
||
419 | 417 | default: |
420 | 418 | throw new midcom_error('Invalid operation "' . $_POST['oper'] . '"'); |
421 | 419 | } |
422 | - $data['saved_values'] = array |
|
423 | - ( |
|
420 | + $data['saved_values'] = array( |
|
424 | 421 | 'id' => $item->id, |
425 | 422 | 'quantity' => $item->units, |
426 | 423 | 'price' => $item->pricePerUnit, |
@@ -432,7 +429,7 @@ discard block |
||
432 | 429 | |
433 | 430 | private function _verify_post_data() |
434 | 431 | { |
435 | - if ( empty($_POST['oper']) |
|
432 | + if (empty($_POST['oper']) |
|
436 | 433 | || !isset($_POST['id']) |
437 | 434 | || !isset($_POST['description']) |
438 | 435 | || !isset($_POST['price']) |
@@ -490,10 +487,8 @@ discard block |
||
490 | 487 | $this->add_breadcrumb("invoice/" . $this->_object->guid . "/", $this->_l10n->get('edit invoice items') . ': ' . $title); |
491 | 488 | |
492 | 489 | midcom::get()->head->set_pagetitle($this->_l10n->get('edit invoice items') . ': ' . $title); |
493 | - $this->_view_toolbar->add_item |
|
494 | - ( |
|
495 | - array |
|
496 | - ( |
|
490 | + $this->_view_toolbar->add_item( |
|
491 | + array( |
|
497 | 492 | MIDCOM_TOOLBAR_URL => "invoice/recalculation/{$this->_object->guid}/", |
498 | 493 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('recalculate_by_reports'), |
499 | 494 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', |
@@ -333,8 +333,7 @@ discard block |
||
333 | 333 | { |
334 | 334 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($item->deliverable); |
335 | 335 | $entry['deliverable'] = $deliverable->title; |
336 | - } |
|
337 | - catch (midcom_error $e) |
|
336 | + } catch (midcom_error $e) |
|
338 | 337 | { |
339 | 338 | $entry['deliverable'] = ''; |
340 | 339 | } |
@@ -342,8 +341,7 @@ discard block |
||
342 | 341 | { |
343 | 342 | $task = org_openpsa_projects_task_dba::get_cached($item->task); |
344 | 343 | $entry['task'] = $task->title; |
345 | - } |
|
346 | - catch (midcom_error $e) |
|
344 | + } catch (midcom_error $e) |
|
347 | 345 | { |
348 | 346 | $entry['task'] = ''; |
349 | 347 | } |
@@ -395,8 +393,7 @@ discard block |
||
395 | 393 | $item = new org_openpsa_invoices_invoice_item_dba(); |
396 | 394 | $item->invoice = $invoice->id; |
397 | 395 | $item->create(); |
398 | - } |
|
399 | - else |
|
396 | + } else |
|
400 | 397 | { |
401 | 398 | $item = new org_openpsa_invoices_invoice_item_dba((int) $_POST['id']); |
402 | 399 | } |