From 386221cba898dbacaaf03510ab8572c6a7aadc58 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 19 Aug 2021 00:45:16 +1000 Subject: [PATCH 1/4] Minor fixes for namespaces --- app/PaymentDrivers/Sample/CreditCard.php | 2 +- app/PaymentDrivers/Sample/PaymentDriver.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/PaymentDrivers/Sample/CreditCard.php b/app/PaymentDrivers/Sample/CreditCard.php index 44c404ae2611..976ae402f2e8 100644 --- a/app/PaymentDrivers/Sample/CreditCard.php +++ b/app/PaymentDrivers/Sample/CreditCard.php @@ -10,7 +10,7 @@ * @license https://www.elastic.co/licensing/elastic-license */ -namespace App\PaymentDrivers\Eway; +namespace App\PaymentDrivers\Sample; use App\Exceptions\PaymentFailed; use App\Jobs\Mail\PaymentFailureMailer; diff --git a/app/PaymentDrivers/Sample/PaymentDriver.php b/app/PaymentDrivers/Sample/PaymentDriver.php index 401ceec3aed9..71cbb77e540d 100644 --- a/app/PaymentDrivers/Sample/PaymentDriver.php +++ b/app/PaymentDrivers/Sample/PaymentDriver.php @@ -9,7 +9,7 @@ * @license https://www.elastic.co/licensing/elastic-license */ -namespace App\PaymentDrivers; +namespace App\PaymentDrivers\Sample; use App\Http\Requests\Payments\PaymentWebhookRequest; use App\Models\ClientGatewayToken; From 9fcaaf63022413b7dd5737d4cadddb898a366847 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 19 Aug 2021 07:41:34 +1000 Subject: [PATCH 2/4] Autobill tweaks --- app/Http/Controllers/SubdomainController.php | 1 + .../RecurringInvoice/StoreRecurringInvoiceRequest.php | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/SubdomainController.php b/app/Http/Controllers/SubdomainController.php index 7751eda00d85..20334c32c111 100644 --- a/app/Http/Controllers/SubdomainController.php +++ b/app/Http/Controllers/SubdomainController.php @@ -28,6 +28,7 @@ class SubdomainController extends BaseController 'custom_domain', 'preview', 'invoiceninja', + 'cname', ]; public function __construct() diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index bbd097d2aaae..d2f4e09d2893 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -107,6 +107,7 @@ class StoreRecurringInvoiceRequest extends Request } else { if ($client = Client::find($input['client_id'])) { $input['auto_bill'] = $client->getSetting('auto_bill'); + $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); } } @@ -115,14 +116,12 @@ class StoreRecurringInvoiceRequest extends Request private function setAutoBillFlag($auto_bill) { - if ($auto_bill == 'always') { + if ($auto_bill == 'always' || $auto_bill == 'optout') { return true; } - - //if ($auto_bill == 'off' || $auto_bill == 'optin') { return false; - //} + } public function messages() From 3f7018c4074d73202ca8ce43a1acc6a7cbbbc054 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 19 Aug 2021 08:02:28 +1000 Subject: [PATCH 3/4] Translations in reminders --- app/Jobs/Util/ReminderJob.php | 5 +++ ...comma_as_decimal_place_companies_table.php | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 database/migrations/2021_08_18_220124_use_comma_as_decimal_place_companies_table.php diff --git a/app/Jobs/Util/ReminderJob.php b/app/Jobs/Util/ReminderJob.php index 62835f456196..e4240b49ac82 100644 --- a/app/Jobs/Util/ReminderJob.php +++ b/app/Jobs/Util/ReminderJob.php @@ -25,6 +25,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\App; class ReminderJob implements ShouldQueue { @@ -148,6 +149,10 @@ class ReminderJob implements ShouldQueue */ private function setLateFee($invoice, $amount, $percent) :Invoice { + App::forgetInstance('translator'); + $t = app('translator'); + $t->replace(Ninja::transformTranslations($invoice->client->getMergedSettings())); + $temp_invoice_balance = $invoice->balance; if ($amount <= 0 && $percent <= 0) { diff --git a/database/migrations/2021_08_18_220124_use_comma_as_decimal_place_companies_table.php b/database/migrations/2021_08_18_220124_use_comma_as_decimal_place_companies_table.php new file mode 100644 index 000000000000..d5330bea293b --- /dev/null +++ b/database/migrations/2021_08_18_220124_use_comma_as_decimal_place_companies_table.php @@ -0,0 +1,32 @@ +boolean('use_comma_as_decimal_place')->default(0); + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} From ec66efeb6fb1f52c78205a16676eb81952600186 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 19 Aug 2021 08:12:39 +1000 Subject: [PATCH 4/4] comma as decimal support --- app/Models/Company.php | 1 + app/Transformers/CompanyTransformer.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Models/Company.php b/app/Models/Company.php index adabc0782260..2d6e9badd87a 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -94,6 +94,7 @@ class Company extends BaseModel 'invoice_task_datelog', 'default_password_timeout', 'show_task_end_date', + 'use_comma_as_decimal_place', ]; protected $hidden = [ diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index 79bb8ceda245..daf1f802941d 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -160,6 +160,7 @@ class CompanyTransformer extends EntityTransformer 'invoice_task_datelog' => (bool) $company->invoice_task_datelog, 'show_task_end_date' => (bool) $company->show_task_end_date, 'markdown_enabled' => (bool) $company->markdown_enabled, + 'use_comma_as_decimal_place' => (bool) $company->use_comma_as_decimal_place, ]; }