diff --git a/app/Models/Account.php b/app/Models/Account.php index ebbbb18934c5..2ea57856c5c0 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -498,8 +498,15 @@ class Account extends BaseModel $plan_expires = Carbon::parse($this->plan_expires); - if(!$this->payment_id && $plan_expires->gt(now())) - return $plan_expires->diffInDays(); + if(!$this->payment_id && $plan_expires->gt(now())){ + + $diff = $plan_expires->diffInDays(); + + if($diff > 14); + return 0; + + return $diff; + } return 0; } diff --git a/app/Services/PurchaseOrder/ApplyNumber.php b/app/Services/PurchaseOrder/ApplyNumber.php index 68398c9ebd1b..197a555c8dce 100644 --- a/app/Services/PurchaseOrder/ApplyNumber.php +++ b/app/Services/PurchaseOrder/ApplyNumber.php @@ -46,7 +46,7 @@ class ApplyNumber extends AbstractService $this->trySaving(); break; case 'when_sent': - if ($this->invoice->status_id == PurchaseOrder::STATUS_SENT) { + if ($this->purchase_order->status_id == PurchaseOrder::STATUS_SENT) { $this->trySaving(); } break;