From 6fcab82101680c5077c896be8049d5d5007f7ff4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 17 Jul 2022 20:33:34 +1000 Subject: [PATCH 1/2] Fixes for plan expiry --- app/Models/Account.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; } From e04deab52d4ca0d7ee29dd3f7a395d50b0aac636 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 18 Jul 2022 07:15:37 +1000 Subject: [PATCH 2/2] Fixes for purchase orders --- app/Services/PurchaseOrder/ApplyNumber.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;