|
@@ -56,7 +56,7 @@ discard block |
|
|
block discarded – undo |
|
56
|
56
|
|
|
57
|
57
|
private function _get_invoices_for_subscription(org_openpsa_sales_salesproject_deliverable_dba $deliverable, midcom_services_at_entry_dba $at_entry) : array |
|
58
|
58
|
{ |
|
59
|
|
- if ( $deliverable->invoiceByActualUnits |
|
|
59
|
+ if ($deliverable->invoiceByActualUnits |
|
60
|
60
|
&& $at_entry->arguments['cycle'] > 1) { |
|
61
|
61
|
$months = midcom_baseclasses_components_configuration::get('org.openpsa.sales', 'config')->get('subscription_profit_months'); |
|
62
|
62
|
$cutoff = (new DateTime)->modify('-' . $months . ' months'); |
|
@@ -81,8 +81,8 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
$time = $at_entry->start; |
|
82
|
82
|
$scheduler = new org_openpsa_invoices_scheduler($deliverable); |
|
83
|
83
|
|
|
84
|
|
- while ( $time < $this->_request_data['end'] |
|
85
|
|
- && ( $time < $deliverable->end |
|
|
84
|
+ while ($time < $this->_request_data['end'] |
|
|
85
|
+ && ($time < $deliverable->end |
|
86
|
86
|
|| $deliverable->continuous)) { |
|
87
|
87
|
$invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base); |
|
88
|
88
|
|
|
@@ -124,8 +124,8 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
foreach ($qb->execute() as $at_entry) { |
|
125
|
125
|
try { |
|
126
|
126
|
$deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
|
127
|
|
- if ( $deliverable->continuous |
|
128
|
|
- || ( $deliverable->start < $this->_request_data['end'] |
|
|
127
|
+ if ($deliverable->continuous |
|
|
128
|
+ || ($deliverable->start < $this->_request_data['end'] |
|
129
|
129
|
&& $deliverable->end > $this->_request_data['start'])) { |
|
130
|
130
|
$invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
|
131
|
131
|
} |