1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Fix promotion

This commit is contained in:
Hillel Coren 2017-12-06 10:13:21 +02:00
parent 84c42624f2
commit bfab8728af

View File

@ -145,7 +145,7 @@ class Company extends Eloquent
foreach ($discounts as $weeks => $promo) { foreach ($discounts as $weeks => $promo) {
list($discount, $validFor) = $promo; list($discount, $validFor) = $promo;
$difference = $this->created_at->diffInWeeks(); $difference = $this->created_at->diffInWeeks();
if ($difference >= $weeks) { if ($difference >= $weeks && $discount > $this->discount) {
$this->discount = $discount; $this->discount = $discount;
$this->promo_expires = date_create()->modify($validFor . ' days')->format('Y-m-d'); $this->promo_expires = date_create()->modify($validFor . ' days')->format('Y-m-d');
$this->save(); $this->save();