Fixed Invoice Cancelled Order Issue At Customer End

This commit is contained in:
Devansh 2020-08-11 11:56:25 +05:30
parent 6822751788
commit 57ebfab80e
1 changed files with 6 additions and 1 deletions

View File

@ -257,6 +257,11 @@ class Order extends Model implements OrderContract
return false;
}
$pendingInvoice = $this->invoices->where('state', 'pending')->first();
if ($pendingInvoice) {
return true;
}
foreach ($this->items as $item) {
if ($item->canCancel() && $item->order->status !== self::STATUS_CLOSED) {
return true;
@ -278,7 +283,7 @@ class Order extends Model implements OrderContract
}
foreach ($this->invoices as $item) {
if ($item->state == self::STATUS_PENDING || $item->state == "overdue") {
if ($item->state == 'pending' || $item->state == 'overdue') {
return false;
}
}