From 1ebaea42d15cdfc8637be93c7e9889c2ce6d7009 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Dec 2022 13:46:48 +1100 Subject: [PATCH 01/17] Fixes for translations --- lang/en/texts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en/texts.php b/lang/en/texts.php index 9fc9764b2a61..82480c63daf9 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -4778,7 +4778,7 @@ $LANG = array( 'invoice_task_project' => 'Invoice Task Project', 'invoice_task_project_help' => 'Add the project to the invoice line items', 'bulk_action' => 'Bulk Action', - 'phone_validation_error' => 'This mobile/cell phone number is not valid, please enter in E.164 format', + 'phone_validation_error' => 'This mobile (cell) phone number is not valid, please enter in E.164 format', 'transaction' => 'Transaction', 'disable_2fa' => 'Disable 2FA', 'change_number' => 'Change Number', From 70db8052c0f94f3ed6330b48d45947f0f666fe62 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Dec 2022 14:19:43 +1100 Subject: [PATCH 02/17] add checks prior to attempting to add in payment types --- app/Models/PaymentType.php | 1 + app/Utils/Traits/Pdf/PDF.php | 2 ++ .../2022_05_12_56879_add_stripe_klarna.php | 34 ++++++++++++++----- .../2022_07_12_45766_add_matomo.php | 1 + lang/en/texts.php | 2 +- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/Models/PaymentType.php b/app/Models/PaymentType.php index 21b165014c65..5459a83774a8 100644 --- a/app/Models/PaymentType.php +++ b/app/Models/PaymentType.php @@ -56,6 +56,7 @@ class PaymentType extends StaticModel const INSTANT_BANK_PAY = 45; const FPX = 46; const KLARNA = 47; + const Interac_E_Transfer = 48; public static function parseCardType($cardName) { diff --git a/app/Utils/Traits/Pdf/PDF.php b/app/Utils/Traits/Pdf/PDF.php index 21f41daf8273..f81407b9f9c0 100644 --- a/app/Utils/Traits/Pdf/PDF.php +++ b/app/Utils/Traits/Pdf/PDF.php @@ -21,9 +21,11 @@ class PDF extends FPDI { $this->SetXY(0, -5); $this->SetFont('Arial', 'I', 9); + $this->SetTextColor(135, 135, 135); $trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']); + $trans = iconv('UTF-8', 'ISO-8859-7', $trans); $this->Cell(0, 5, $trans, 0, 0, $this->text_alignment); } diff --git a/database/migrations/2022_05_12_56879_add_stripe_klarna.php b/database/migrations/2022_05_12_56879_add_stripe_klarna.php index 969553634d52..e85e0e733879 100644 --- a/database/migrations/2022_05_12_56879_add_stripe_klarna.php +++ b/database/migrations/2022_05_12_56879_add_stripe_klarna.php @@ -14,21 +14,37 @@ return new class extends Migration { */ public function up() { - Schema::table('payment_types', function (Blueprint $table) { - $type = new PaymentType(); + $pt = PaymentType::find(47); + if(!$pt) + { + $type = new PaymentType(); $type->id = 47; $type->name = 'Klarna'; $type->gateway_type_id = GatewayType::KLARNA; - $type->save(); - }); - $type = new GatewayType(); + } - $type->id = 23; - $type->alias = 'klarna'; - $type->name = 'Klarna'; - $type->save(); + $pt = PaymentType::find(48); + + if(!$pt) + { + $type = new PaymentType(); + $type->id = 48; + $type->name = 'Interac E-Transfer'; + $type->save(); + } + + $gt = GatewayType::find(23); + + if(!$gt) + { + $type = new GatewayType(); + $type->id = 23; + $type->alias = 'klarna'; + $type->name = 'Klarna'; + $type->save(); + } } }; diff --git a/database/migrations/2022_07_12_45766_add_matomo.php b/database/migrations/2022_07_12_45766_add_matomo.php index 5df323980c73..6eb354c2784a 100644 --- a/database/migrations/2022_07_12_45766_add_matomo.php +++ b/database/migrations/2022_07_12_45766_add_matomo.php @@ -17,5 +17,6 @@ return new class extends Migration $table->string('matomo_url',191)->nullable(); $table->bigInteger('matomo_id')->nullable(); }); + } }; \ No newline at end of file diff --git a/lang/en/texts.php b/lang/en/texts.php index 82480c63daf9..e15dd9f6cf23 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -4891,7 +4891,7 @@ $LANG = array( 'restored_transaction_rule' => 'Successfully restored transaction rule', 'search_transaction_rule' => 'Search Transaction Rule', 'search_transaction_rules' => 'Search Transaction Rules', - + 'payment_type_Interac E-Transfer' => 'Interac E-Transfer', ); return $LANG; From ecb4ee7b8f2d4da4a7386320b87afae5f061d507 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Dec 2022 14:35:10 +1100 Subject: [PATCH 03/17] Add transaction filters for payments and expenses --- app/Filters/ExpenseFilters.php | 14 ++++++++++++++ app/Filters/PaymentFilters.php | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/Filters/ExpenseFilters.php b/app/Filters/ExpenseFilters.php index d7e10ac0f4f1..657680140a69 100644 --- a/app/Filters/ExpenseFilters.php +++ b/app/Filters/ExpenseFilters.php @@ -92,6 +92,20 @@ class ExpenseFilters extends QueryFilters return $this->builder; } + /** + * Returns a list of expenses that can be matched to bank transactions + */ + public function match_transactions($value = '') + { + + if($value == 'true') + { + return $this->builder->where('is_deleted',0)->whereNull('transaction_id'); + } + + return $this->builder; + } + /** * Filters the list based on the status diff --git a/app/Filters/PaymentFilters.php b/app/Filters/PaymentFilters.php index 823cb9fcf741..e09c49e35557 100644 --- a/app/Filters/PaymentFilters.php +++ b/app/Filters/PaymentFilters.php @@ -81,6 +81,20 @@ class PaymentFilters extends QueryFilters }); } + /** + * Returns a list of payments that can be matched to bank transactions + */ + public function match_transactions($value = '') + { + + if($value == 'true') + { + return $this->builder->where('is_deleted',0)->whereNull('transaction_id'); + } + + return $this->builder; + } + /** * Sorts the list based on $sort. * From 3cc7d344ca6de75f44ec1bc699a997591431281f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Dec 2022 14:49:37 +1100 Subject: [PATCH 04/17] Update lang files --- lang/en/texts.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lang/en/texts.php b/lang/en/texts.php index e15dd9f6cf23..297089b539a7 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -4892,6 +4892,9 @@ $LANG = array( 'search_transaction_rule' => 'Search Transaction Rule', 'search_transaction_rules' => 'Search Transaction Rules', 'payment_type_Interac E-Transfer' => 'Interac E-Transfer', + 'delete_bank_account' => 'Delete Bank Account', + 'archive_transaction' => 'Archive Transaction', + 'delete_transaction' => 'Delete Transaction', ); return $LANG; From a3b1ea41e33b002c7776ea2a4ec2d69e55e2eaaf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Dec 2022 17:37:43 +1100 Subject: [PATCH 05/17] Minor clean up of layout files --- resources/views/portal/ninja2020/layout/app.blade.php | 2 -- resources/views/portal/ninja2020/layout/clean.blade.php | 3 --- 2 files changed, 5 deletions(-) diff --git a/resources/views/portal/ninja2020/layout/app.blade.php b/resources/views/portal/ninja2020/layout/app.blade.php index 23e6f36be1b0..ae2a0c6b0a46 100644 --- a/resources/views/portal/ninja2020/layout/app.blade.php +++ b/resources/views/portal/ninja2020/layout/app.blade.php @@ -66,8 +66,6 @@ - {{-- --}} - {{-- --}}