@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | $notification_entry->create(); |
58 | 58 | //relatedto from notifcation to deliverable |
59 | 59 | org_openpsa_relatedto_plugin::create($notification_entry, 'midcom.services.at', $deliverable, 'org.openpsa.sales', false, array('toExtra' => 'notify_at_entry')); |
60 | - } |
|
61 | - else |
|
60 | + } else |
|
62 | 61 | { |
63 | 62 | //get guid of at_entry |
64 | 63 | foreach ($entry_keys as $key => $entry) |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | try |
68 | 67 | { |
69 | 68 | $notification_entry = new midcom_services_at_entry_dba($entry); |
70 | - } |
|
71 | - catch (midcom_error $e) |
|
69 | + } catch (midcom_error $e) |
|
72 | 70 | { |
73 | 71 | //relatedto links to a non-existing at_entry - so create a new one an link to it |
74 | 72 | $notification_entry = new midcom_services_at_entry_dba(); |
@@ -84,8 +82,7 @@ discard block |
||
84 | 82 | $notification_entry->component = 'org.openpsa.sales'; |
85 | 83 | $notification_entry->arguments = array('deliverable' => $deliverable->guid); |
86 | 84 | $notification_entry->update(); |
87 | - } |
|
88 | - else |
|
85 | + } else |
|
89 | 86 | { |
90 | 87 | //void date - so delete existing at_entrys for this notify_date |
91 | 88 | foreach ($entry_keys as $key => $empty) |
@@ -95,8 +92,7 @@ discard block |
||
95 | 92 | $notification_entry = new midcom_services_at_entry_dba($mc_entry->get_subkey($key, 'fromGuid')); |
96 | 93 | //check if related at_entry exists & delete it |
97 | 94 | $notification_entry->delete(); |
98 | - } |
|
99 | - catch (midcom_error $e) |
|
95 | + } catch (midcom_error $e) |
|
100 | 96 | { |
101 | 97 | $e->log(); |
102 | 98 | } |
@@ -121,14 +117,12 @@ discard block |
||
121 | 117 | if ($object->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) |
122 | 118 | { |
123 | 119 | $prefix = $handler->_l10n->get('subscription'); |
124 | - } |
|
125 | - else |
|
120 | + } else |
|
126 | 121 | { |
127 | 122 | $prefix = $handler->_l10n->get('single delivery'); |
128 | 123 | } |
129 | 124 | $tmp["deliverable/{$object->guid}/"] = $prefix . ': ' . $object->title; |
130 | - } |
|
131 | - else |
|
125 | + } else |
|
132 | 126 | { |
133 | 127 | $tmp["salesproject/{$object->guid}/"] = $object->title; |
134 | 128 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | if ($this->_salesproject->can_do('midgard:update')) |
67 | 67 | { |
68 | 68 | $workflow = $this->get_workflow('datamanager2'); |
69 | - $buttons[] = $workflow->get_button("salesproject/edit/{$this->_salesproject->guid}/", array |
|
70 | - ( |
|
69 | + $buttons[] = $workflow->get_button("salesproject/edit/{$this->_salesproject->guid}/", array( |
|
71 | 70 | MIDCOM_TOOLBAR_ACCESSKEY => 'e', |
72 | 71 | )); |
73 | 72 | } |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | if (!empty($this->_request_data['projects_url'])) |
82 | 81 | { |
83 | 82 | $prefix = midcom_connection::get_url('self') . $this->_request_data['projects_url']; |
84 | - $buttons[] = array |
|
85 | - ( |
|
83 | + $buttons[] = array( |
|
86 | 84 | MIDCOM_TOOLBAR_URL => $prefix . "project/{$this->_salesproject->guid}/", |
87 | 85 | MIDCOM_TOOLBAR_LABEL => $this->_i18n->get_string('org.openpsa.projects', 'org.openpsa.projects'), |
88 | 86 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png', |
@@ -105,7 +103,7 @@ discard block |
||
105 | 103 | $this->_request_data['schemadb_salesproject_deliverable'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_deliverable')); |
106 | 104 | |
107 | 105 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
108 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb_salesproject']; |
|
106 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb_salesproject']; |
|
109 | 107 | $this->_request_data['controller']->set_storage($this->_salesproject); |
110 | 108 | $this->_request_data['controller']->process_ajax(); |
111 | 109 | } |
@@ -164,7 +162,7 @@ discard block |
||
164 | 162 | foreach ($deliverables as $deliverable) |
165 | 163 | { |
166 | 164 | $this->_controllers[$deliverable->id] = midcom_helper_datamanager2_controller::create('ajax'); |
167 | - $this->_controllers[$deliverable->id]->schemadb =& $this->_request_data['schemadb_salesproject_deliverable']; |
|
165 | + $this->_controllers[$deliverable->id]->schemadb = & $this->_request_data['schemadb_salesproject_deliverable']; |
|
168 | 166 | $this->_controllers[$deliverable->id]->set_storage($deliverable); |
169 | 167 | $this->_controllers[$deliverable->id]->process_ajax(); |
170 | 168 | $this->_request_data['deliverables_objects'][$deliverable->guid] = $deliverable; |
@@ -234,7 +232,7 @@ discard block |
||
234 | 232 | if (isset($entries[0])) |
235 | 233 | { |
236 | 234 | $toolbar['label'] = sprintf($this->_l10n->get('next invoice will be generated on %s'), $formatter->date($entries[0]->start)); |
237 | - if ( $entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
|
235 | + if ($entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
|
238 | 236 | && midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) |
239 | 237 | { |
240 | 238 | $toolbar['buttons']['run_cycle'] = $this->_l10n->get('generate now'); |
@@ -254,7 +252,7 @@ discard block |
||
254 | 252 | $toolbar['label'] = $this->_l10n->get('invoiced') . ': ' . $formatter->number($deliverable->invoiced); |
255 | 253 | } |
256 | 254 | } |
257 | - else if ( $deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
255 | + else if ($deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
258 | 256 | && midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) |
259 | 257 | { |
260 | 258 | //not invoiced yet |
@@ -192,16 +192,14 @@ discard block |
||
192 | 192 | try |
193 | 193 | { |
194 | 194 | $data['product'] = org_openpsa_products_product_dba::get_cached($deliverable->product); |
195 | - } |
|
196 | - catch (midcom_error $e) |
|
195 | + } catch (midcom_error $e) |
|
197 | 196 | { |
198 | 197 | $data['product'] = false; |
199 | 198 | } |
200 | 199 | if ($deliverable->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) |
201 | 200 | { |
202 | 201 | midcom_show_style('show-salesproject-deliverables-subscription'); |
203 | - } |
|
204 | - else |
|
202 | + } else |
|
205 | 203 | { |
206 | 204 | midcom_show_style('show-salesproject-deliverables-item'); |
207 | 205 | } |
@@ -219,13 +217,11 @@ discard block |
||
219 | 217 | //new, proposed |
220 | 218 | $toolbar['buttons']['order'] = $this->_l10n->get('mark ordered'); |
221 | 219 | $toolbar['buttons']['decline'] = $this->_l10n->get('mark declined'); |
222 | - } |
|
223 | - else if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_DECLINED) |
|
220 | + } else if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_DECLINED) |
|
224 | 221 | { |
225 | 222 | //declined, nothing to do... |
226 | 223 | return $toolbar; |
227 | - } |
|
228 | - else if ($deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_DELIVERED) |
|
224 | + } else if ($deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_DELIVERED) |
|
229 | 225 | { |
230 | 226 | //started, ordered |
231 | 227 | if ($deliverable->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) |
@@ -240,21 +236,18 @@ discard block |
||
240 | 236 | $toolbar['buttons']['run_cycle'] = $this->_l10n->get('generate now'); |
241 | 237 | } |
242 | 238 | } |
243 | - } |
|
244 | - else if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_ORDERED) |
|
239 | + } else if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_ORDERED) |
|
245 | 240 | { |
246 | 241 | $toolbar['buttons']['deliver'] = $this->_l10n->get('mark delivered'); |
247 | 242 | } |
248 | - } |
|
249 | - else if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED) |
|
243 | + } else if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED) |
|
250 | 244 | { |
251 | 245 | //delivered, invoiced |
252 | 246 | if ($deliverable->invoiced > 0) |
253 | 247 | { |
254 | 248 | $toolbar['label'] = $this->_l10n->get('invoiced') . ': ' . $formatter->number($deliverable->invoiced); |
255 | 249 | } |
256 | - } |
|
257 | - else if ( $deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
250 | + } else if ( $deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
258 | 251 | && midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) |
259 | 252 | { |
260 | 253 | //not invoiced yet |
@@ -55,9 +55,9 @@ 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 | - if (! $this->_controller->initialize()) |
|
60 | + if (!$this->_controller->initialize()) |
|
61 | 61 | { |
62 | 62 | throw new midcom_error("Failed to initialize a DM2 controller instance for salesproject {$this->_salesproject->id}."); |
63 | 63 | } |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $this->_load_defaults($args); |
73 | 73 | |
74 | 74 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
75 | - $this->_controller->schemadb =& $this->_schemadb; |
|
75 | + $this->_controller->schemadb = & $this->_schemadb; |
|
76 | 76 | $this->_controller->schemaname = $this->_schema; |
77 | - $this->_controller->callback_object =& $this; |
|
77 | + $this->_controller->callback_object = & $this; |
|
78 | 78 | $this->_controller->defaults = $this->_defaults; |
79 | - if (! $this->_controller->initialize()) |
|
79 | + if (!$this->_controller->initialize()) |
|
80 | 80 | { |
81 | 81 | throw new midcom_error("Failed to initialize a DM2 create controller."); |
82 | 82 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_salesproject')); |
88 | 88 | if ($this->_salesproject) |
89 | 89 | { |
90 | - $fields =& $schemadb['default']->fields; |
|
90 | + $fields = & $schemadb['default']->fields; |
|
91 | 91 | $fields['customer']['type_config']['options'] = org_openpsa_helpers_list::task_groups($this->_salesproject); |
92 | 92 | } |
93 | 93 | $this->_schemadb = $schemadb; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | if (!empty($args[0])) |
102 | 102 | { |
103 | - $fields =& $this->_schemadb['default']->fields; |
|
103 | + $fields = & $this->_schemadb['default']->fields; |
|
104 | 104 | try |
105 | 105 | { |
106 | 106 | $customer = new org_openpsa_contacts_group_dba($args[0]); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $this->_salesproject = new org_openpsa_sales_salesproject_dba(); |
127 | 127 | |
128 | - if (! $this->_salesproject->create()) |
|
128 | + if (!$this->_salesproject->create()) |
|
129 | 129 | { |
130 | 130 | debug_print_r('We operated on this object:', $this->_salesproject); |
131 | 131 | throw new midcom_error("Failed to create a new invoice. Error: " . midcom_connection::get_error_string()); |
@@ -165,8 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | midcom::get()->head->set_pagetitle($this->_l10n->get('create salesproject')); |
167 | 167 | |
168 | - $workflow = $this->get_workflow('datamanager2', array |
|
169 | - ( |
|
168 | + $workflow = $this->get_workflow('datamanager2', array( |
|
170 | 169 | 'controller' => $this->_controller, |
171 | 170 | 'save_callback' => array($this, 'save_callback') |
172 | 171 | )); |
@@ -186,8 +185,7 @@ discard block |
||
186 | 185 | public function _handler_delete($handler_id, array $args, array &$data) |
187 | 186 | { |
188 | 187 | $this->_salesproject = new org_openpsa_sales_salesproject_dba($args[0]); |
189 | - $workflow = $this->get_workflow('delete', array |
|
190 | - ( |
|
188 | + $workflow = $this->get_workflow('delete', array( |
|
191 | 189 | 'object' => $this->_salesproject, |
192 | 190 | 'recursive' => true |
193 | 191 | )); |
@@ -37,8 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | $article = new midcom_db_article($related); |
39 | 39 | echo "<li><a href=\"" . midcom::get()->permalinks->create_permalink($article->guid) . "\">{$article->title}</a></li>\n"; |
40 | - } |
|
41 | - catch (midcom_error $e) |
|
40 | + } catch (midcom_error $e) |
|
42 | 41 | { |
43 | 42 | $e->log(); |
44 | 43 | } |
@@ -94,10 +94,8 @@ discard block |
||
94 | 94 | if ($this->_request_data['contacts_url']) |
95 | 95 | { |
96 | 96 | $url_prefix = $this->_request_data['contacts_url'] . (is_a($this->_request_data['customer'], 'org_openpsa_contacts_group_dba') ? 'group' : 'person') . "/"; |
97 | - $this->_view_toolbar->add_item |
|
98 | - ( |
|
99 | - array |
|
100 | - ( |
|
97 | + $this->_view_toolbar->add_item( |
|
98 | + array( |
|
101 | 99 | MIDCOM_TOOLBAR_URL => $url_prefix . $this->_request_data['customer']->guid . '/', |
102 | 100 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to customer'), |
103 | 101 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png', |
@@ -108,8 +106,7 @@ discard block |
||
108 | 106 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_sales_salesproject_dba')) |
109 | 107 | { |
110 | 108 | $workflow = $this->get_workflow('datamanager2'); |
111 | - $this->_view_toolbar->add_item($workflow->get_button($create_url, array |
|
112 | - ( |
|
109 | + $this->_view_toolbar->add_item($workflow->get_button($create_url, array( |
|
113 | 110 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create salesproject'), |
114 | 111 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people.png', |
115 | 112 | ))); |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | $data['mode'] = 'customer'; |
41 | 41 | $data['list_title'] = sprintf($this->_l10n->get('salesprojects with %s'), $data['customer']->get_label()); |
42 | 42 | $this->add_breadcrumb("", $data['list_title']); |
43 | - } |
|
44 | - else |
|
43 | + } else |
|
45 | 44 | { |
46 | 45 | $data['mode'] = $this->get_list_mode($args); |
47 | 46 | $qb = $this->_add_state_constraint($data['mode'], $qb); |
@@ -134,8 +133,7 @@ discard block |
||
134 | 133 | { |
135 | 134 | $this->_request_data['customer'] = new org_openpsa_contacts_group_dba($guid); |
136 | 135 | $qb->add_constraint('customer', '=', $this->_request_data['customer']->id); |
137 | - } |
|
138 | - catch (midcom_error $e) |
|
136 | + } catch (midcom_error $e) |
|
139 | 137 | { |
140 | 138 | $this->_request_data['customer'] = new org_openpsa_contacts_person_dba($guid); |
141 | 139 | $qb->add_constraint('customerContact', '=', $this->_request_data['customer']->id); |
@@ -39,8 +39,7 @@ discard block |
||
39 | 39 | if ($this->_deliverable->can_do('midgard:update')) |
40 | 40 | { |
41 | 41 | $workflow = $this->get_workflow('datamanager2'); |
42 | - $this->_view_toolbar->add_item($workflow->get_button("deliverable/edit/{$this->_deliverable->guid}/", array |
|
43 | - ( |
|
42 | + $this->_view_toolbar->add_item($workflow->get_button("deliverable/edit/{$this->_deliverable->guid}/", array( |
|
44 | 43 | MIDCOM_TOOLBAR_ACCESSKEY => 'e', |
45 | 44 | ))); |
46 | 45 | } |
@@ -83,7 +82,7 @@ discard block |
||
83 | 82 | $this->_load_schema(); |
84 | 83 | |
85 | 84 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
86 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb_salesproject_deliverable']; |
|
85 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb_salesproject_deliverable']; |
|
87 | 86 | $this->_request_data['controller']->set_storage($this->_deliverable); |
88 | 87 | $this->_request_data['controller']->process_ajax(); |
89 | 88 |
@@ -74,8 +74,7 @@ discard block |
||
74 | 74 | try |
75 | 75 | { |
76 | 76 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
77 | - } |
|
78 | - catch (midcom_error $e) |
|
77 | + } catch (midcom_error $e) |
|
79 | 78 | { |
80 | 79 | debug_add("Failed to resolve the GUID {$guid}, this is most probably an access denied error.", MIDCOM_LOG_ERROR); |
81 | 80 | debug_add('Last MidCOM error string: ' . $e->getMessage()); |
@@ -171,8 +170,7 @@ discard block |
||
171 | 170 | if ($interface instanceof midcom_services_permalinks_resolver) |
172 | 171 | { |
173 | 172 | $result = $interface->resolve_object_link($topic, $object); |
174 | - } |
|
175 | - else |
|
173 | + } else |
|
176 | 174 | { |
177 | 175 | $result = $interface->_on_resolve_permalink($topic, $interface->get_config_for_topic($topic), $object->guid); |
178 | 176 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * DM2 creation callback, binds to the current content topic. |
67 | 67 | */ |
68 | - public function & dm2_create_callback (&$controller) |
|
68 | + public function & dm2_create_callback(&$controller) |
|
69 | 69 | { |
70 | 70 | $this->_deliverable = new org_openpsa_sales_salesproject_deliverable_dba(); |
71 | 71 | $this->_deliverable->salesproject = $this->_salesproject->id; |
72 | 72 | $this->_deliverable->state = org_openpsa_sales_salesproject_deliverable_dba::STATE_NEW; |
73 | 73 | $this->_deliverable->orgOpenpsaObtype = $this->_product->delivery; |
74 | 74 | |
75 | - if (! $this->_deliverable->create()) |
|
75 | + if (!$this->_deliverable->create()) |
|
76 | 76 | { |
77 | 77 | debug_print_r('We operated on this object:', $this->_deliverable); |
78 | 78 | throw new midcom_error('Failed to create a new deliverable. Last Midgard error was: ' . midcom_connection::get_error_string()); |
@@ -83,8 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function get_schema_defaults() |
85 | 85 | { |
86 | - $defaults = array |
|
87 | - ( |
|
86 | + $defaults = array( |
|
88 | 87 | 'product' => $this->_product->id, |
89 | 88 | 'units' => 1, |
90 | 89 | |
@@ -158,8 +157,7 @@ discard block |
||
158 | 157 | |
159 | 158 | midcom::get()->head->set_pagetitle($this->_l10n->get('add offer')); |
160 | 159 | midcom::get()->head->add_jsfile(MIDCOM_STATIC_URL . '/' . $this->_component . '/sales.js'); |
161 | - $workflow = $this->get_workflow('datamanager2', array |
|
162 | - ( |
|
160 | + $workflow = $this->get_workflow('datamanager2', array( |
|
163 | 161 | 'controller' => $data['controller'], |
164 | 162 | 'save_callback' => array($this, 'save_callback') |
165 | 163 | )); |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $local_filename = midcom_db_attachment::safe_filename($uploaded_file['name']); |
48 | 48 | $local_file = $this->_get_file($local_filename, true); |
49 | - } |
|
50 | - else |
|
49 | + } else |
|
51 | 50 | { |
52 | 51 | $local_file = $this->_file; |
53 | 52 | } |
@@ -89,8 +88,7 @@ discard block |
||
89 | 88 | // We're creating a new file |
90 | 89 | $local_filename = midcom_db_attachment::safe_filename($_POST['midgard_admin_asgard_filename']); |
91 | 90 | $local_file = $this->_get_file($local_filename, true); |
92 | - } |
|
93 | - else |
|
91 | + } else |
|
94 | 92 | { |
95 | 93 | $local_file = $this->_file; |
96 | 94 | } |
@@ -72,10 +72,8 @@ |
||
72 | 72 | $siteconfig = org_openpsa_core_siteconfig::get_instance(); |
73 | 73 | $products_url = $siteconfig->get_node_full_url('org.openpsa.products'); |
74 | 74 | $product_guid = $siteconfig->get_node_guid('org.openpsa.products'); |
75 | - $this->_view_toolbar->add_item |
|
76 | - ( |
|
77 | - array |
|
78 | - ( |
|
75 | + $this->_view_toolbar->add_item( |
|
76 | + array( |
|
79 | 77 | MIDCOM_TOOLBAR_URL => $products_url . 'product/' . $this->_product->get_path(new midcom_db_topic($product_guid)), |
80 | 78 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to product'), |
81 | 79 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png', |
@@ -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]; |
@@ -44,8 +44,7 @@ |
||
44 | 44 | $this->_deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args[0]); |
45 | 45 | $this->_salesproject = new org_openpsa_sales_salesproject_dba($this->_deliverable->salesproject); |
46 | 46 | |
47 | - $supported_operations = array |
|
48 | - ( |
|
47 | + $supported_operations = array( |
|
49 | 48 | 'decline', 'order', 'deliver', 'invoice', 'run_cycle' |
50 | 49 | ); |
51 | 50 |
@@ -54,9 +54,9 @@ 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 | - if (! $controller->initialize()) |
|
59 | + if (!$controller->initialize()) |
|
60 | 60 | { |
61 | 61 | throw new midcom_error("Failed to initialize a DM2 controller instance for deliverable {$this->_deliverable->id}."); |
62 | 62 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | private function _modify_schema() |
70 | 70 | { |
71 | - $fields =& $this->_schemadb['subscription']->fields; |
|
71 | + $fields = & $this->_schemadb['subscription']->fields; |
|
72 | 72 | |
73 | 73 | $mc = new org_openpsa_relatedto_collector($this->_deliverable->guid, 'midcom_services_at_entry_dba'); |
74 | 74 | $mc->add_object_order('start', 'ASC'); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | if (sizeof($at_entries) != 1) |
79 | 79 | { |
80 | - if ( ( $this->_deliverable->continuous |
|
80 | + if (($this->_deliverable->continuous |
|
81 | 81 | || $this->_deliverable->end > time()) |
82 | 82 | && $this->_deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_STARTED) |
83 | 83 | { |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | midcom::get()->head->add_jsfile(MIDCOM_STATIC_URL . '/' . $this->_component . '/sales.js'); |
111 | 111 | midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get('deliverable'))); |
112 | 112 | |
113 | - $workflow = $this->get_workflow('datamanager2', array |
|
114 | - ( |
|
113 | + $workflow = $this->get_workflow('datamanager2', array( |
|
115 | 114 | 'controller' => $data['controller'], |
116 | 115 | 'save_callback' => array($this, 'save_callback') |
117 | 116 | )); |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | { |
134 | 133 | $entry = new midcom_services_at_entry_dba((int) $formdata['at_entry']->value); |
135 | 134 | } |
136 | - if ( isset($formdata['next_cycle']) |
|
135 | + if (isset($formdata['next_cycle']) |
|
137 | 136 | && !$formdata['next_cycle']->is_empty()) |
138 | 137 | { |
139 | 138 | $next_cycle = (int) $formdata['next_cycle']->value->format('U'); |
@@ -160,8 +159,7 @@ discard block |
||
160 | 159 | else if ($next_cycle > 0) |
161 | 160 | { |
162 | 161 | //TODO: This code is copied from scheduler, and should be merged into a separate method at some point |
163 | - $args = array |
|
164 | - ( |
|
162 | + $args = array( |
|
165 | 163 | 'deliverable' => $this->_deliverable->guid, |
166 | 164 | 'cycle' => 2, //TODO: We might want to calculate the correct cycle number from start and unit at some point |
167 | 165 | ); |
@@ -188,8 +186,7 @@ discard block |
||
188 | 186 | { |
189 | 187 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args[0]); |
190 | 188 | $salesproject = $deliverable->get_parent(); |
191 | - $workflow = $this->get_workflow('delete', array |
|
192 | - ( |
|
189 | + $workflow = $this->get_workflow('delete', array( |
|
193 | 190 | 'object' => $deliverable, |
194 | 191 | 'success_url' => "salesproject/{$salesproject->guid}/" |
195 | 192 | )); |
@@ -145,8 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | $entry->delete(); |
147 | 147 | $this->_deliverable->end_subscription(); |
148 | - } |
|
149 | - else if ($next_cycle != $entry->start) |
|
148 | + } else if ($next_cycle != $entry->start) |
|
150 | 149 | { |
151 | 150 | //@todo If next_cycle is changed to be in the past, should we check if this would lead |
152 | 151 | //to multiple runs immediately? i.e. if you set a monthly subscriptions next cycle to |
@@ -156,8 +155,7 @@ discard block |
||
156 | 155 | $entry->start = $next_cycle; |
157 | 156 | $entry->update(); |
158 | 157 | } |
159 | - } |
|
160 | - else if ($next_cycle > 0) |
|
158 | + } else if ($next_cycle > 0) |
|
161 | 159 | { |
162 | 160 | //TODO: This code is copied from scheduler, and should be merged into a separate method at some point |
163 | 161 | $args = array |