Merge pull request #7645 from turbo124/v5-develop

Fixes for purchase orders when applying number
This commit is contained in:
David Bomba 2022-07-18 07:16:36 +10:00 committed by GitHub
commit 7ceb280bdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;