From dc3cf85e2c274dd36eb25ec34788ec60f66c53ff Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 22 Jul 2021 20:15:41 +1000 Subject: [PATCH 1/6] Fixes for Notifications --- app/Http/Controllers/SetupController.php | 2 -- app/Listeners/Invoice/InvoiceEmailedNotification.php | 1 - 2 files changed, 3 deletions(-) diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 80b5a4dd0fba..2d39f48908cc 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -69,8 +69,6 @@ class SetupController extends Controller } if ($check['system_health'] === false) { - nlog($check); - return response('Oops, something went wrong. Check your logs.'); /* We should never reach this block, but just in case. */ } diff --git a/app/Listeners/Invoice/InvoiceEmailedNotification.php b/app/Listeners/Invoice/InvoiceEmailedNotification.php index 09d56d53491a..f6a083b3ea37 100644 --- a/app/Listeners/Invoice/InvoiceEmailedNotification.php +++ b/app/Listeners/Invoice/InvoiceEmailedNotification.php @@ -66,7 +66,6 @@ class InvoiceEmailedNotification implements ShouldQueue if (($key = array_search('mail', $methods))) { unset($methods[$key]); - $nmo->to_user = $user; NinjaMailerJob::dispatch($nmo); From da7e368d6354e672faa5d435aceb1a59bc5ca749 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Jul 2021 08:04:01 +1000 Subject: [PATCH 2/6] Fixes for notifications --- app/Jobs/Mail/NinjaMailerJob.php | 2 -- app/Listeners/Invoice/InvoiceEmailedNotification.php | 2 +- app/Listeners/Invoice/InvoiceFailedEmailNotification.php | 2 +- app/Listeners/Quote/QuoteCreatedNotification.php | 2 +- tests/Feature/CompanyTest.php | 1 - 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 044b2cfd7e33..e77379786cfd 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -193,8 +193,6 @@ class NinjaMailerJob implements ShouldQueue return $this->setMailDriver(); } - - /* * Now that our token is refreshed and valid we can boot the * mail driver at runtime and also set the token which will persist diff --git a/app/Listeners/Invoice/InvoiceEmailedNotification.php b/app/Listeners/Invoice/InvoiceEmailedNotification.php index f6a083b3ea37..59ac94e2c3ef 100644 --- a/app/Listeners/Invoice/InvoiceEmailedNotification.php +++ b/app/Listeners/Invoice/InvoiceEmailedNotification.php @@ -63,7 +63,7 @@ class InvoiceEmailedNotification implements ShouldQueue $methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']); /* If one of the methods is email then we fire the EntitySentMailer */ - if (($key = array_search('mail', $methods))) { + if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); $nmo->to_user = $user; diff --git a/app/Listeners/Invoice/InvoiceFailedEmailNotification.php b/app/Listeners/Invoice/InvoiceFailedEmailNotification.php index 3f6551de4159..ac89010cadeb 100644 --- a/app/Listeners/Invoice/InvoiceFailedEmailNotification.php +++ b/app/Listeners/Invoice/InvoiceFailedEmailNotification.php @@ -58,7 +58,7 @@ class InvoiceFailedEmailNotification $methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']); - if (($key = array_search('mail', $methods))) { + if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); $nmo->to_user = $user; diff --git a/app/Listeners/Quote/QuoteCreatedNotification.php b/app/Listeners/Quote/QuoteCreatedNotification.php index c258b0d33c51..699b6eba88c2 100644 --- a/app/Listeners/Quote/QuoteCreatedNotification.php +++ b/app/Listeners/Quote/QuoteCreatedNotification.php @@ -60,7 +60,7 @@ class QuoteCreatedNotification implements ShouldQueue $methods = $this->findUserNotificationTypes($quote->invitations()->first(), $company_user, 'quote', ['all_notifications', 'quote_created', 'quote_created_all']); /* If one of the methods is email then we fire the EntitySentMailer */ - if (($key = array_search('mail', $methods))) { + if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php index 8ec6928f283c..538ef194ffce 100644 --- a/tests/Feature/CompanyTest.php +++ b/tests/Feature/CompanyTest.php @@ -100,7 +100,6 @@ class CompanyTest extends TestCase $settings->invoice_design_id = '2'; $settings->quote_design_id = '1'; -nlog($settings); $company->settings = $settings; $response = $this->withHeaders([ From 62359e4097009288a62ca33d40c72720c88866f8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Jul 2021 09:51:55 +1000 Subject: [PATCH 3/6] minor fixes for wepay --- app/Http/ValidationRules/Payment/ValidRefundableRequest.php | 2 +- app/PaymentDrivers/WePay/ACH.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index b29c6ab06a18..8dc5567beb65 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -80,7 +80,7 @@ class ValidRefundableRequest implements Rule $invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->withTrashed()->first(); if ($payment->invoices()->exists()) { - $paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first(); + $paymentable_invoice = $payment->invoices->where('invoice_id', $invoice->id)->first(); if (! $paymentable_invoice) { $this->error_msg = ctrans('texts.invoice_not_related_to_payment', ['invoice' => $invoice->hashed_id]); diff --git a/app/PaymentDrivers/WePay/ACH.php b/app/PaymentDrivers/WePay/ACH.php index 1060ee5c04ad..31fb62d46bc7 100644 --- a/app/PaymentDrivers/WePay/ACH.php +++ b/app/PaymentDrivers/WePay/ACH.php @@ -194,7 +194,7 @@ class ACH $token = ClientGatewayToken::find($this->decodePrimaryKey($request->input('source'))); $token_meta = $token->meta; - if($token_meta->state != "authorized") + if(!property_exists($token_meta, 'state') || $token_meta->state != "authorized") return redirect()->route('client.payment_methods.verification', ['payment_method' => $token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]); $app_fee = (config('ninja.wepay.fee_ach_multiplier') * $this->wepay_payment_driver->payment_hash->data->amount_with_fee) + config('ninja.wepay.fee_fixed'); From 8ac7ec8ef498ee831214a5f21ec1f9f208ac0cb5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Jul 2021 10:16:59 +1000 Subject: [PATCH 4/6] Fixes for validation rule --- app/Http/ValidationRules/Payment/ValidRefundableRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index 8dc5567beb65..b29c6ab06a18 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -80,7 +80,7 @@ class ValidRefundableRequest implements Rule $invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->withTrashed()->first(); if ($payment->invoices()->exists()) { - $paymentable_invoice = $payment->invoices->where('invoice_id', $invoice->id)->first(); + $paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first(); if (! $paymentable_invoice) { $this->error_msg = ctrans('texts.invoice_not_related_to_payment', ['invoice' => $invoice->hashed_id]); From d5d6c47d75c80e8c2bffacccc09471c6c800bb8f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Jul 2021 10:31:30 +1000 Subject: [PATCH 5/6] Minor fixes for reminder job --- app/Jobs/Util/ReminderJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/Util/ReminderJob.php b/app/Jobs/Util/ReminderJob.php index b530105643e2..cfd9504b1806 100644 --- a/app/Jobs/Util/ReminderJob.php +++ b/app/Jobs/Util/ReminderJob.php @@ -175,7 +175,7 @@ class ReminderJob implements ShouldQueue $invoice = $invoice->calc()->getInvoice(); $invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save(); - $invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$this->invoice->number}"); + $invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}"); return $invoice; } From 8375607f53d5247d7f6eb7cb59a13f0c6c3671ca Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 23 Jul 2021 13:10:47 +1000 Subject: [PATCH 6/6] Fixes for language translations --- resources/lang/en/texts.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index fc01b693ddaf..46e95f9742bf 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1749,6 +1749,7 @@ $LANG = array( 'lang_Danish' => 'Danish', 'lang_Dutch' => 'Dutch', 'lang_English' => 'English', + 'lang_English - United States' => 'English', 'lang_French' => 'French', 'lang_French - Canada' => 'French - Canada', 'lang_German' => 'German',