From 7357e4026f60eec6a736a17f99166e541ebdcc75 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 29 Jul 2022 09:19:49 +1000 Subject: [PATCH 1/5] Fixes for BPP in subscriptions --- ...07_26_091216_add_sms_verification_to_hosted_account.php | 7 ++++++- .../components/livewire/billing-portal-purchase.blade.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php b/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php index 168f18da29d7..7ef526562963 100644 --- a/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php +++ b/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php @@ -19,7 +19,12 @@ class AddSmsVerificationToHostedAccount extends Migration $table->boolean('account_sms_verified')->default(0); }); - App\Models\Account::query()->update(['account_sms_verified' => true]); + App\Models\Account::query()->cursor()->each(function ($account){ + + $account->account_sms_verified = true; + $account->save(); + + }); } /** diff --git a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php index da5fcadbe9be..3c53f02aae60 100644 --- a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php @@ -20,7 +20,7 @@ @foreach($subscription->service()->products() as $product)
-

{{ $product->notes }}

+

{!! $product->notes !!}

Date: Fri, 29 Jul 2022 09:26:31 +1000 Subject: [PATCH 2/5] Add enabled_expense_tax_rates --- app/Models/Company.php | 1 + app/Transformers/CompanyTransformer.php | 1 + ...d_expense_tax_rates_to_companies_table.php | 38 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 database/migrations/2022_07_28_232340_enabled_expense_tax_rates_to_companies_table.php diff --git a/app/Models/Company.php b/app/Models/Company.php index 652678b2b6a6..8285b43b43ee 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -119,6 +119,7 @@ class Company extends BaseModel 'track_inventory', 'inventory_notification_threshold', 'stock_notification', + 'enabled_expense_tax_rates', ]; protected $hidden = [ diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index c5fff8469e5f..dd3c7cb38574 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -177,6 +177,7 @@ class CompanyTransformer extends EntityTransformer 'inventory_notification_threshold' => (int) $company->inventory_notification_threshold, 'track_inventory' => (bool) $company->track_inventory, 'enable_applying_payments' => (bool) $company->enable_applying_payments, + 'enabled_expense_tax_rates' =. (bool) $company->enabled_expense_tax_rates, ]; } diff --git a/database/migrations/2022_07_28_232340_enabled_expense_tax_rates_to_companies_table.php b/database/migrations/2022_07_28_232340_enabled_expense_tax_rates_to_companies_table.php new file mode 100644 index 000000000000..04a07d8f7d22 --- /dev/null +++ b/database/migrations/2022_07_28_232340_enabled_expense_tax_rates_to_companies_table.php @@ -0,0 +1,38 @@ +boolean('enabled_expense_tax_rates')->default(0); + }); + + Company::query()->where('enabled_item_tax_rates', true)->cursor()->each(function ($company){ + + $company->enabled_expense_tax_rates = true; + $company->save(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + + } +}; From 3a510ffd4a33b8195c4bfa8678e9c17c4c632163 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 29 Jul 2022 10:34:33 +1000 Subject: [PATCH 3/5] Fixes for subscriptions - allow currency id to be passed through --- app/Http/Livewire/BillingPortalPurchase.php | 11 +++++++++++ app/Transformers/CompanyTransformer.php | 2 +- .../livewire/billing-portal-purchase.blade.php | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 8053b6c67a50..ebe0ca6c2688 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -263,6 +263,17 @@ class BillingPortalPurchase extends Component } } + if(array_key_exists('currency_id', $this->request_data)) { + + $currency = Cache::get('currencies')->filter(function ($item){ + return $item->id == $this->request_data['currency_id']; + })->first(); + + if($currency) + $data['settings']->currency_id = $currency->id; + + } + if (array_key_exists('locale', $this->request_data)) { $request = $this->request_data; diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index dd3c7cb38574..f35a75f51031 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -177,7 +177,7 @@ class CompanyTransformer extends EntityTransformer 'inventory_notification_threshold' => (int) $company->inventory_notification_threshold, 'track_inventory' => (bool) $company->track_inventory, 'enable_applying_payments' => (bool) $company->enable_applying_payments, - 'enabled_expense_tax_rates' =. (bool) $company->enabled_expense_tax_rates, + 'enabled_expense_tax_rates' => (bool) $company->enabled_expense_tax_rates, ]; } diff --git a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php index 3c53f02aae60..51c34fd695e1 100644 --- a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php @@ -20,7 +20,7 @@ @foreach($subscription->service()->products() as $product)
-

{!! $product->notes !!}

+

{!! nl2br($product->notes) !!}

service()->recurring_products() as $product)
-
{!! $product->notes !!}
+
{!! nl2br($product->notes) !!}
{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} From 63a7fd35f39a46d4ad788c8a50bdbf2184551e50 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 29 Jul 2022 12:12:24 +1000 Subject: [PATCH 4/5] Use null safe operators --- app/Models/Company.php | 2 +- composer.json | 4 ++-- composer.lock | 40 ++++++++++++++++++++-------------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/Models/Company.php b/app/Models/Company.php index 8285b43b43ee..15c9b94336e7 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -519,7 +519,7 @@ class Company extends BaseModel public function owner() { - return $this->company_users()->withTrashed()->where('is_owner', true)->first()->user; + return $this->company_users()->withTrashed()->where('is_owner', true)->first()?->user; } public function resolveRouteBinding($value, $field = null) diff --git a/composer.json b/composer.json index 70f7bcefd856..d20a92d9ffec 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "ext-json": "*", "ext-libxml": "*", "afosto/yaac": "^1.4", - "asm/php-ansible": "^4", + "asm/php-ansible": "^4.0", "authorizenet/authorizenet": "^2.0", "awobaz/compoships": "^2.1", "bacon/bacon-qr-code": "^2.0", @@ -162,4 +162,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 0c7dab925c33..53fa097b1ebf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bbd6f8107bd70628ea7527c968ca3c8d", + "content-hash": "dd251d0b8181fc819aded8d8d5c6bb07", "packages": [ { "name": "afosto/yaac", @@ -378,16 +378,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.231.15", + "version": "3.231.16", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "ba379285d24b609a997bd8b40933d3e0a3826dfb" + "reference": "c50adea1de4ad3d6dda41310a8af5ce13ee876d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ba379285d24b609a997bd8b40933d3e0a3826dfb", - "reference": "ba379285d24b609a997bd8b40933d3e0a3826dfb", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c50adea1de4ad3d6dda41310a8af5ce13ee876d5", + "reference": "c50adea1de4ad3d6dda41310a8af5ce13ee876d5", "shasum": "" }, "require": { @@ -464,9 +464,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.231.15" + "source": "https://github.com/aws/aws-sdk-php/tree/3.231.16" }, - "time": "2022-07-27T18:59:36+00:00" + "time": "2022-07-28T18:17:24+00:00" }, { "name": "bacon/bacon-qr-code", @@ -7438,16 +7438,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.7", + "version": "v0.11.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "77fc7270031fbc28f9a7bea31385da5c4855cb7a" + "reference": "f455acf3645262ae389b10e9beba0c358aa6994e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/77fc7270031fbc28f9a7bea31385da5c4855cb7a", - "reference": "77fc7270031fbc28f9a7bea31385da5c4855cb7a", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/f455acf3645262ae389b10e9beba0c358aa6994e", + "reference": "f455acf3645262ae389b10e9beba0c358aa6994e", "shasum": "" }, "require": { @@ -7508,9 +7508,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.7" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.8" }, - "time": "2022-07-07T13:49:11+00:00" + "time": "2022-07-28T14:25:11+00:00" }, { "name": "ralouphie/getallheaders", @@ -16461,16 +16461,16 @@ }, { "name": "vimeo/psalm", - "version": "4.24.0", + "version": "v4.25.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "06dd975cb55d36af80f242561738f16c5f58264f" + "reference": "d7cd84c4ebca74ba3419b9601f81d177bcbe2aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/06dd975cb55d36af80f242561738f16c5f58264f", - "reference": "06dd975cb55d36af80f242561738f16c5f58264f", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d7cd84c4ebca74ba3419b9601f81d177bcbe2aac", + "reference": "d7cd84c4ebca74ba3419b9601f81d177bcbe2aac", "shasum": "" }, "require": { @@ -16562,9 +16562,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.24.0" + "source": "https://github.com/vimeo/psalm/tree/v4.25.0" }, - "time": "2022-06-26T11:47:54+00:00" + "time": "2022-07-25T17:04:37+00:00" }, { "name": "webmozart/path-util", @@ -16707,5 +16707,5 @@ "platform-dev": { "php": "^7.4|^8.0" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } From 1d571712b271aff6dc2e4c5dc95e95cf955c957d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 29 Jul 2022 12:23:13 +1000 Subject: [PATCH 5/5] v5.5.3 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 9af9a6a81c7e..d2ff458a0121 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.5.2 \ No newline at end of file +5.5.3 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index d0670923e0b2..220d495a678f 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.5.2', - 'app_tag' => '5.5.2', + 'app_version' => '5.5.3', + 'app_tag' => '5.5.3', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),