@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // TODO: Warehouse management: create new order |
| 98 | - if ( $this->_deliverable->end < $next_cycle_start |
|
| 98 | + if ($this->_deliverable->end < $next_cycle_start |
|
| 99 | 99 | && $this->_deliverable->end != 0) { |
| 100 | 100 | debug_add('Do not register next cycle, the contract ends before'); |
| 101 | 101 | return $this->_deliverable->end_subscription(); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | //If previous cycle was run at the end of the month, the new one should be at the end of the month as well |
| 326 | 326 | $date = new DateTime(gmdate('Y-m-d', $time), new DateTimeZone('GMT')); |
| 327 | - if ( $date->format('t') == $date->format('j') |
|
| 327 | + if ($date->format('t') == $date->format('j') |
|
| 328 | 328 | && $new_date->format('t') != $new_date->format('j')) { |
| 329 | 329 | $new_date->setDate((int) $new_date->format('Y'), (int) $new_date->format('m'), (int) $new_date->format('t')); |
| 330 | 330 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $this->calculate_price(false); |
| 73 | 73 | |
| 74 | - if ( $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 74 | + if ($this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 75 | 75 | && $this->continuous) { |
| 76 | 76 | $this->end = 0; |
| 77 | 77 | } elseif ($this->end < $this->start) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $calculator->run($this); |
| 139 | 139 | $cost = $calculator->get_cost(); |
| 140 | 140 | $price = $calculator->get_price(); |
| 141 | - if ( $price != $this->price |
|
| 141 | + if ($price != $this->price |
|
| 142 | 142 | || $cost != $this->cost) { |
| 143 | 143 | $this->price = $price; |
| 144 | 144 | $this->cost = $cost; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $units = $hours['invoiceable']; |
| 179 | 179 | $uninvoiceableUnits = $hours['reported'] - ($hours['invoiceable'] + $hours['invoiced']); |
| 180 | 180 | |
| 181 | - if ( $units != $this->units |
|
| 181 | + if ($units != $this->units |
|
| 182 | 182 | || $uninvoiceableUnits != $this->uninvoiceableUnits) { |
| 183 | 183 | debug_add("agreement values have changed, setting units to " . $units . ", uninvoiceable: " . $uninvoiceableUnits); |
| 184 | 184 | $this->units = $units; |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | break; |
| 230 | 230 | case 'q': |
| 231 | 231 | // Quarterly recurring subscription |
| 232 | - $identifier = ceil(((int)$date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
| 232 | + $identifier = ceil(((int) $date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
| 233 | 233 | break; |
| 234 | 234 | case 'hy': |
| 235 | 235 | // Half-yearly recurring subscription |
| 236 | - $identifier = ceil(((int)$date->format('n')) / 6) . '/' . $date->format('Y'); |
|
| 236 | + $identifier = ceil(((int) $date->format('n')) / 6) . '/' . $date->format('Y'); |
|
| 237 | 237 | break; |
| 238 | 238 | case 'y': |
| 239 | 239 | // Yearly recurring subscription |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | public function invoice() : bool |
| 263 | 263 | { |
| 264 | - if ( $this->state >= self::STATE_INVOICED |
|
| 264 | + if ($this->state >= self::STATE_INVOICED |
|
| 265 | 265 | || $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
| 266 | 266 | return false; |
| 267 | 267 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | midcom::get()->uimessages->add(midcom::get()->i18n->get_string('org.openpsa.sales', 'org.openpsa.sales'), sprintf(midcom::get()->i18n->get_string('marked deliverable "%s" delivered', 'org.openpsa.sales'), $this->title)); |
| 365 | 365 | |
| 366 | 366 | // Check if we need to create task or ship goods |
| 367 | - if ( $update_deliveries |
|
| 367 | + if ($update_deliveries |
|
| 368 | 368 | && $product->orgOpenpsaObtype === org_openpsa_products_product_dba::TYPE_SERVICE) { |
| 369 | 369 | // Change status of tasks connected to the deliverable |
| 370 | 370 | $qb = org_openpsa_projects_task_dba::new_query_builder(); |