From 8dd23b5419681a30bc56c3350e73cd2048060ba0 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Wed, 24 Oct 2018 17:20:41 +0300 Subject: [PATCH 1/2] grammar --- resources/lang/en-GB/invoices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/en-GB/invoices.php b/resources/lang/en-GB/invoices.php index 512220c9b..53b99b561 100644 --- a/resources/lang/en-GB/invoices.php +++ b/resources/lang/en-GB/invoices.php @@ -31,7 +31,7 @@ return [ 'mark_sent' => 'Mark Sent', 'download_pdf' => 'Download PDF', 'send_mail' => 'Send Email', - 'all_invoices' => 'Login to for all invoices', + 'all_invoices' => 'Login to view all invoices', 'status' => [ 'draft' => 'Draft', From 42f6b004851c30c547105d03ea7dad7f5f25179c Mon Sep 17 00:00:00 2001 From: denisdulici Date: Wed, 24 Oct 2018 17:32:00 +0300 Subject: [PATCH 2/2] fixed #566 --- app/Http/Controllers/Banking/Transactions.php | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Banking/Transactions.php b/app/Http/Controllers/Banking/Transactions.php index d2ef17e91..dc6645709 100644 --- a/app/Http/Controllers/Banking/Transactions.php +++ b/app/Http/Controllers/Banking/Transactions.php @@ -39,12 +39,12 @@ class Transactions extends Controller if ($type != 'income') { $this->addTransactions(Payment::collect(['paid_at'=> 'desc']), trans_choice('general.expenses', 1)); - $this->addTransactions(BillPayment::collect(['paid_at'=> 'desc']), trans_choice('general.expenses', 1), trans_choice('general.bills', 1)); + $this->addTransactions(BillPayment::collect(['paid_at'=> 'desc']), trans_choice('general.expenses', 1)); } if ($type != 'expense') { $this->addTransactions(Revenue::collect(['paid_at'=> 'desc']), trans_choice('general.incomes', 1)); - $this->addTransactions(InvoicePayment::collect(['paid_at'=> 'desc']), trans_choice('general.incomes', 1), trans_choice('general.invoices', 1)); + $this->addTransactions(InvoicePayment::collect(['paid_at'=> 'desc']), trans_choice('general.incomes', 1)); } $transactions = $this->getTransactions($request); @@ -57,27 +57,29 @@ class Transactions extends Controller * * @param $items * @param $type - * @param $category */ - protected function addTransactions($items, $type, $category = null) + protected function addTransactions($items, $type) { foreach ($items as $item) { - $data = [ + if (!empty($item->category)) { + $category_name = $item->category->name; + } else { + if ($type == trans_choice('general.incomes', 1)) { + $category_name = $item->invoice->category->name; + } else { + $category_name = $item->bill->category->name; + } + } + + $this->transactions[] = (object) [ 'paid_at' => $item->paid_at, 'account_name' => $item->account->name, 'type' => $type, 'description' => $item->description, 'amount' => $item->amount, 'currency_code' => $item->currency_code, + 'category_name' => $category_name, ]; - - if (!is_null($category)) { - $data['category_name'] = $category; - } else { - $data['category_name'] = $item->category->name; - } - - $this->transactions[] = (object) $data; } }