From 1ef9c7037beab58eab3ec0a6e0cea995f99fb0bc Mon Sep 17 00:00:00 2001 From: Reatile Tshikalange Date: Wed, 1 Apr 2020 02:19:26 +0200 Subject: [PATCH] fix: adding discount_amounth_total for empty items on invoice creation This fixes an error where if you delete the first [default and oly] row when creating a new invoice and save a Flash message of "Undefined offset 2" is returned. --- app/Jobs/Sale/CreateInvoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/Sale/CreateInvoice.php b/app/Jobs/Sale/CreateInvoice.php index 7ade6315f..b551d4051 100644 --- a/app/Jobs/Sale/CreateInvoice.php +++ b/app/Jobs/Sale/CreateInvoice.php @@ -175,7 +175,7 @@ class CreateInvoice extends Job $taxes = []; if (empty($this->request['items'])) { - return [$sub_total, $taxes]; + return [$sub_total, $discount_amount_total, $taxes]; } foreach ((array) $this->request['items'] as $item) {