From f9347fc652df0fee4d7a90149ba9853d683ceb86 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 16 May 2021 19:44:44 +1000 Subject: [PATCH] fixes for factories --- app/Factory/CreditFactory.php | 8 ++++---- app/Factory/InvoiceFactory.php | 8 ++++---- app/Factory/RecurringInvoiceFactory.php | 8 ++++---- app/Factory/RecurringQuoteFactory.php | 8 ++++---- app/Http/Middleware/SetDomainNameDb.php | 8 ++++++-- app/Http/Middleware/SetInviteDb.php | 4 ++-- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/app/Factory/CreditFactory.php b/app/Factory/CreditFactory.php index 4a34ece9820e..154352c46389 100644 --- a/app/Factory/CreditFactory.php +++ b/app/Factory/CreditFactory.php @@ -37,10 +37,10 @@ class CreditFactory $credit->tax_rate1 = 0; $credit->tax_name2 = ''; $credit->tax_rate2 = 0; - $credit->custom_value1 = 0; - $credit->custom_value2 = 0; - $credit->custom_value3 = 0; - $credit->custom_value4 = 0; + $credit->custom_value1 = ''; + $credit->custom_value2 = ''; + $credit->custom_value3 = ''; + $credit->custom_value4 = ''; $credit->amount = 0; $credit->balance = 0; $credit->partial = 0; diff --git a/app/Factory/InvoiceFactory.php b/app/Factory/InvoiceFactory.php index c69ae41e794d..fec4e05e3a62 100644 --- a/app/Factory/InvoiceFactory.php +++ b/app/Factory/InvoiceFactory.php @@ -38,10 +38,10 @@ class InvoiceFactory $invoice->tax_rate2 = 0; $invoice->tax_name3 = ''; $invoice->tax_rate3 = 0; - $invoice->custom_value1 = 0; - $invoice->custom_value2 = 0; - $invoice->custom_value3 = 0; - $invoice->custom_value4 = 0; + $invoice->custom_value1 = ''; + $invoice->custom_value2 = ''; + $invoice->custom_value3 = ''; + $invoice->custom_value4 = ''; $invoice->amount = 0; $invoice->balance = 0; $invoice->paid_to_date = 0; diff --git a/app/Factory/RecurringInvoiceFactory.php b/app/Factory/RecurringInvoiceFactory.php index 159fdce4da2a..8603c30812f9 100644 --- a/app/Factory/RecurringInvoiceFactory.php +++ b/app/Factory/RecurringInvoiceFactory.php @@ -36,10 +36,10 @@ class RecurringInvoiceFactory $invoice->tax_rate1 = 0; $invoice->tax_name2 = ''; $invoice->tax_rate2 = 0; - $invoice->custom_value1 = 0; - $invoice->custom_value2 = 0; - $invoice->custom_value3 = 0; - $invoice->custom_value4 = 0; + $invoice->custom_value1 = ''; + $invoice->custom_value2 = ''; + $invoice->custom_value3 = ''; + $invoice->custom_value4 = ''; $invoice->amount = 0; $invoice->balance = 0; $invoice->partial = 0; diff --git a/app/Factory/RecurringQuoteFactory.php b/app/Factory/RecurringQuoteFactory.php index 18a9991eb800..28aba86ea583 100644 --- a/app/Factory/RecurringQuoteFactory.php +++ b/app/Factory/RecurringQuoteFactory.php @@ -35,10 +35,10 @@ class RecurringQuoteFactory $quote->tax_rate1 = 0; $quote->tax_name2 = ''; $quote->tax_rate2 = 0; - $quote->custom_value1 = 0; - $quote->custom_value2 = 0; - $quote->custom_value3 = 0; - $quote->custom_value4 = 0; + $quote->custom_value1 = ''; + $quote->custom_value2 = ''; + $quote->custom_value3 = ''; + $quote->custom_value4 = ''; $quote->amount = 0; $quote->balance = 0; $quote->partial = 0; diff --git a/app/Http/Middleware/SetDomainNameDb.php b/app/Http/Middleware/SetDomainNameDb.php index 260de03f8a7d..8bfde19417ce 100644 --- a/app/Http/Middleware/SetDomainNameDb.php +++ b/app/Http/Middleware/SetDomainNameDb.php @@ -52,7 +52,9 @@ class SetDomainNameDb if ($request->json) { return response()->json($error, 403); } else { - abort(400, 'Domain not found'); + MultiDB::setDb('db-ninja-01'); + nlog("I could not set the DB - defaulting to DB1"); + //abort(400, 'Domain not found'); } } @@ -68,7 +70,9 @@ class SetDomainNameDb if ($request->json) { return response()->json($error, 403); } else { - abort(400, 'Domain not found'); + MultiDB::setDb('db-ninja-01'); + nlog("I could not set the DB - defaulting to DB1"); + //abort(400, 'Domain not found'); } } diff --git a/app/Http/Middleware/SetInviteDb.php b/app/Http/Middleware/SetInviteDb.php index fd66829c62d1..b9067b4cf3df 100644 --- a/app/Http/Middleware/SetInviteDb.php +++ b/app/Http/Middleware/SetInviteDb.php @@ -28,7 +28,7 @@ class SetInviteDb public function handle($request, Closure $next) { $error = [ - 'message' => 'Invalid URL', + 'message' => 'I could not find the database for this object.', 'errors' => new stdClass, ]; /* @@ -46,7 +46,7 @@ class SetInviteDb if (request()->json) { return response()->json($error, 403); } else { - abort(404); + abort(404,'I could not find the database for this object.'); } }