From 681c38e65988fd7e54706ca66ef34e81c67edb2b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 4 Sep 2023 10:34:14 +1000 Subject: [PATCH] Fixes for db::raw --- app/Services/Chart/ChartQueries.php | 2 +- app/Services/Chart/ChartQueriesLegacy.php | 2 +- app/Services/Chart/ChartServiceLegacy.php | 1 + app/Transformers/PurchaseOrderHistoryTransformer.php | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Services/Chart/ChartQueries.php b/app/Services/Chart/ChartQueries.php index 90ffd79a43..da83406a46 100644 --- a/app/Services/Chart/ChartQueries.php +++ b/app/Services/Chart/ChartQueries.php @@ -168,7 +168,7 @@ trait ChartQueries { $user_filter = $this->is_admin ? '' : 'AND payments.user_id = '.$this->user->id; - return DB::select((" + return DB::select(" SELECT sum(payments.amount - payments.refunded) as paid_to_date, payments.currency_id AS currency_id diff --git a/app/Services/Chart/ChartQueriesLegacy.php b/app/Services/Chart/ChartQueriesLegacy.php index 9bf418a63a..1091defff5 100644 --- a/app/Services/Chart/ChartQueriesLegacy.php +++ b/app/Services/Chart/ChartQueriesLegacy.php @@ -139,7 +139,7 @@ trait ChartQueriesLegacy AND invoices.is_deleted = 0 AND (invoices.date BETWEEN :start_date AND :end_date) GROUP BY currency_id - "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]); + ", ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]); } public function getInvoiceChartQuery($start_date, $end_date, $currency_id) diff --git a/app/Services/Chart/ChartServiceLegacy.php b/app/Services/Chart/ChartServiceLegacy.php index 84e53cec93..372d89ddb9 100644 --- a/app/Services/Chart/ChartServiceLegacy.php +++ b/app/Services/Chart/ChartServiceLegacy.php @@ -15,6 +15,7 @@ use App\Models\Client; use App\Models\Company; use App\Models\Expense; use Illuminate\Support\Facades\Cache; +use App\Services\Chart\ChartQueriesLegacy; class ChartServiceLegacy { diff --git a/app/Transformers/PurchaseOrderHistoryTransformer.php b/app/Transformers/PurchaseOrderHistoryTransformer.php index 5f2af4d659..8422ce16d8 100644 --- a/app/Transformers/PurchaseOrderHistoryTransformer.php +++ b/app/Transformers/PurchaseOrderHistoryTransformer.php @@ -19,11 +19,11 @@ class PurchaseOrderHistoryTransformer extends EntityTransformer { use MakesHash; - protected $defaultIncludes = [ + protected array $defaultIncludes = [ // 'activity', ]; - protected $availableIncludes = [ + protected array $availableIncludes = [ 'activity', ];