Fix strict recurring date for 2 years, error 500 when displaying services without an invoice
This commit is contained in:
@@ -307,6 +307,7 @@ class Service extends Model
|
||||
* Product of the service
|
||||
*
|
||||
* @return BelongsTo
|
||||
* @deprecated use type->product
|
||||
*/
|
||||
public function product()
|
||||
{
|
||||
@@ -519,8 +520,17 @@ class Service extends Model
|
||||
break;
|
||||
|
||||
// Two Yearly
|
||||
// NOTE: price_recurr_strict ignored
|
||||
case 5: $date = $this->getInvoiceNextAttribute()->addYear(2)->subDay(); break;
|
||||
case 5:
|
||||
if (!$this->product->price_recurr_strict)
|
||||
$date = $this->getInvoiceNextAttribute()->addYear(2)->subDay();
|
||||
else {
|
||||
$date = $this->getInvoiceNextAttribute()->addYear(2)->subDay()->endOfYear();
|
||||
|
||||
if ($date->clone()->addDay()->year % 2) {
|
||||
$date = $date->subYear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Three Yearly
|
||||
// NOTE: price_recurr_strict ignored
|
||||
@@ -1301,4 +1311,4 @@ class Service extends Model
|
||||
{
|
||||
return in_array($this->order_status,$this->inactive_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user