mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-16 11:54:35 -04:00
Don’t apply annual discount if during the year
This commit is contained in:
parent
396db1dec4
commit
721c4cd349
@ -56,13 +56,17 @@ class Company extends Eloquent
|
|||||||
// handle promos and discounts
|
// handle promos and discounts
|
||||||
public function hasActiveDiscount(Carbon $date = null)
|
public function hasActiveDiscount(Carbon $date = null)
|
||||||
{
|
{
|
||||||
if ( ! $this->discount) {
|
if ( ! $this->discount || ! $this->discount_expires) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$date = $date ?: Carbon::today();
|
$date = $date ?: Carbon::today();
|
||||||
|
|
||||||
return $this->discount_expires && $this->discount_expires->gt($date);
|
if ($this->plan_term == PLAN_TERM_MONTHLY) {
|
||||||
|
return $this->discount_expires->gt($date);
|
||||||
|
} else {
|
||||||
|
return $this->discount_expires->subMonths(11)->gt($date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function discountedPrice($price)
|
public function discountedPrice($price)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user