From c3946f44b09eedd0690766f6515eaeb17093b8b5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 1 Jun 2021 08:09:38 +1000 Subject: [PATCH 1/2] Fixes for custom payment method name --- app/Http/Controllers/ImportJsonController.php | 2 +- app/Http/ViewComposers/PortalComposer.php | 1 + app/Jobs/Company/CompanyImport.php | 18 +++++++++++++++++- app/Services/Client/PaymentMethod.php | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ImportJsonController.php b/app/Http/Controllers/ImportJsonController.php index a26280ca7e..80bc843421 100644 --- a/app/Http/Controllers/ImportJsonController.php +++ b/app/Http/Controllers/ImportJsonController.php @@ -84,7 +84,7 @@ class ImportJsonController extends BaseController $file_location = public_path("storage/backups/$filename/backup.json"); if (! file_exists($file_location)) - throw new NonExistingMigrationFile('Backup file does not exist, or it is corrupted.'); + throw new NonExistingMigrationFile('Backup file does not exist, or is corrupted.'); $data = json_decode(file_get_contents($file_location)); diff --git a/app/Http/ViewComposers/PortalComposer.php b/app/Http/ViewComposers/PortalComposer.php index 6bb63f052d..ea201d6d3f 100644 --- a/app/Http/ViewComposers/PortalComposer.php +++ b/app/Http/ViewComposers/PortalComposer.php @@ -13,6 +13,7 @@ namespace App\Http\ViewComposers; use App\Utils\Ninja; use App\Utils\TranslationHelper; +use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Lang; use Illuminate\View\View; diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index 766d7b0de2..c798224443 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -147,11 +147,24 @@ class CompanyImport implements ShouldQueue $this->backup_file = Cache::get($this->hash); - if ( empty( $this->import_object ) ) + if ( empty( $this->backup_file ) ) throw new \Exception('No import data found, has the cache expired?'); $this->backup_file = base64_decode($this->backup_file); + + if(array_key_exists('import_settings', $request) && $request['import_settings'] == 'true') { + $this->preFlightChecks()->importSettings(); + } + + if(array_key_exists('import_data', $request) && $request['import_data'] == 'true') { + + $this->preFlightChecks() + ->purgeCompanyData() + ->importData(); + + } + } @@ -191,6 +204,7 @@ class CompanyImport implements ShouldQueue $this->company->tasks()->forceDelete(); $this->company->vendors()->forceDelete(); $this->company->expenses()->forceDelete(); + $this->company->subscriptions()->forceDelete(); $this->company->save(); @@ -226,6 +240,8 @@ class CompanyImport implements ShouldQueue } + return $this; + } private function import_payment_terms() diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index 571c3dd61b..0936cabdbd 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -188,7 +188,7 @@ class PaymentMethod $fee_label = $gateway->calcGatewayFeeLabel($this->amount, $this->client, $gateway_type_id); - if(!$gateway_type_id){ + if(!$gateway_type_id || (GatewayType::CUSTOM == $gateway_type_id)){ $this->payment_urls[] = [ 'label' => $gateway->getConfigField('name') . $fee_label, From b1609f3971578b3ea0b9984cddf27c228253e0d9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 1 Jun 2021 08:10:01 +1000 Subject: [PATCH 2/2] 5.1.69 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index b7f91e238d..4a79f40759 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.1.68 \ No newline at end of file +5.1.69 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 1f12d05720..777c913d67 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.1.68', - 'app_tag' => '5.1.68-release', + 'app_version' => '5.1.69', + 'app_tag' => '5.1.69-release', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),