From 4852a134dab9277aca4890bfa3c11e40d569550c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 29 May 2024 23:19:03 +1000 Subject: [PATCH] Adjustments for tests --- app/Export/CSV/ClientExport.php | 2 +- app/Export/CSV/InvoiceExport.php | 3 ++- app/Export/CSV/InvoiceItemExport.php | 2 +- app/Export/CSV/ProductExport.php | 2 +- app/Export/CSV/PurchaseOrderExport.php | 2 +- app/Export/CSV/PurchaseOrderItemExport.php | 2 +- app/Export/CSV/QuoteExport.php | 2 +- app/Export/CSV/QuoteItemExport.php | 2 +- app/Export/CSV/RecurringInvoiceExport.php | 2 +- app/Export/CSV/TaskExport.php | 2 +- app/Export/CSV/VendorExport.php | 2 +- .../Requests/Report/GenericReportRequest.php | 16 ++++++++-------- 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/Export/CSV/ClientExport.php b/app/Export/CSV/ClientExport.php index fd5b35e97670..de3ee42c0650 100644 --- a/app/Export/CSV/ClientExport.php +++ b/app/Export/CSV/ClientExport.php @@ -127,7 +127,7 @@ class ClientExport extends BaseExport ->withTrashed() ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) + if(!$this->input['include_deleted'] ?? false) $query->where('is_deleted', 0); $query = $this->addDateRange($query); diff --git a/app/Export/CSV/InvoiceExport.php b/app/Export/CSV/InvoiceExport.php index 534a9a96978b..b0435e3859fd 100644 --- a/app/Export/CSV/InvoiceExport.php +++ b/app/Export/CSV/InvoiceExport.php @@ -62,7 +62,8 @@ class InvoiceExport extends BaseExport }) ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/InvoiceItemExport.php b/app/Export/CSV/InvoiceItemExport.php index 1a621fec7de3..20308854f2ac 100644 --- a/app/Export/CSV/InvoiceItemExport.php +++ b/app/Export/CSV/InvoiceItemExport.php @@ -75,7 +75,7 @@ class InvoiceItemExport extends BaseExport }) ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/ProductExport.php b/app/Export/CSV/ProductExport.php index 81fb42dcfbce..cd874d16eb92 100644 --- a/app/Export/CSV/ProductExport.php +++ b/app/Export/CSV/ProductExport.php @@ -76,7 +76,7 @@ class ProductExport extends BaseExport ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/PurchaseOrderExport.php b/app/Export/CSV/PurchaseOrderExport.php index 6dc38d175f6f..cbe54e51b2c9 100644 --- a/app/Export/CSV/PurchaseOrderExport.php +++ b/app/Export/CSV/PurchaseOrderExport.php @@ -63,7 +63,7 @@ class PurchaseOrderExport extends BaseExport }) ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/PurchaseOrderItemExport.php b/app/Export/CSV/PurchaseOrderItemExport.php index 4ef9d4ce541a..96c4c03aff28 100644 --- a/app/Export/CSV/PurchaseOrderItemExport.php +++ b/app/Export/CSV/PurchaseOrderItemExport.php @@ -67,7 +67,7 @@ class PurchaseOrderItemExport extends BaseExport }) ->with('vendor')->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/QuoteExport.php b/app/Export/CSV/QuoteExport.php index 3110bcb87274..13c53cb0dc3a 100644 --- a/app/Export/CSV/QuoteExport.php +++ b/app/Export/CSV/QuoteExport.php @@ -69,7 +69,7 @@ class QuoteExport extends BaseExport }) ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/QuoteItemExport.php b/app/Export/CSV/QuoteItemExport.php index af9e53cc1304..d3f8be4b91f8 100644 --- a/app/Export/CSV/QuoteItemExport.php +++ b/app/Export/CSV/QuoteItemExport.php @@ -70,7 +70,7 @@ class QuoteItemExport extends BaseExport }) ->with('client')->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/RecurringInvoiceExport.php b/app/Export/CSV/RecurringInvoiceExport.php index 74adf2424641..9c88f33f7ab9 100644 --- a/app/Export/CSV/RecurringInvoiceExport.php +++ b/app/Export/CSV/RecurringInvoiceExport.php @@ -61,7 +61,7 @@ class RecurringInvoiceExport extends BaseExport }) ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/TaskExport.php b/app/Export/CSV/TaskExport.php index f562f742fa2e..5b1985ce4782 100644 --- a/app/Export/CSV/TaskExport.php +++ b/app/Export/CSV/TaskExport.php @@ -70,7 +70,7 @@ class TaskExport extends BaseExport ->withTrashed() ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Export/CSV/VendorExport.php b/app/Export/CSV/VendorExport.php index 2bff1c34f7f2..187487a14765 100644 --- a/app/Export/CSV/VendorExport.php +++ b/app/Export/CSV/VendorExport.php @@ -64,7 +64,7 @@ class VendorExport extends BaseExport ->withTrashed() ->where('company_id', $this->company->id); - if(!$this->input['include_deleted']) { + if(!$this->input['include_deleted'] ?? false){ $query->where('is_deleted', 0); } diff --git a/app/Http/Requests/Report/GenericReportRequest.php b/app/Http/Requests/Report/GenericReportRequest.php index 7a59becd7e84..1ebd60dc4321 100644 --- a/app/Http/Requests/Report/GenericReportRequest.php +++ b/app/Http/Requests/Report/GenericReportRequest.php @@ -68,14 +68,14 @@ class GenericReportRequest extends Request $input['user_id'] = auth()->user()->id; - // if(!$this->checkAuthority()){ - // $input['date_range'] = ''; - // $input['start_date'] = ''; - // $input['end_date'] = ''; - // $input['send_email'] = true; - // $input['report_keys'] = []; - // $input['document_email_attachment'] = false; - // } + if(!$this->checkAuthority()){ + $input['date_range'] = ''; + $input['start_date'] = ''; + $input['end_date'] = ''; + $input['send_email'] = true; + $input['report_keys'] = []; + $input['document_email_attachment'] = false; + } $this->replace($input); }