From 53e40a4e6ac71185dd1151a73f8b92d3ca57d5fb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 23 Nov 2020 13:07:32 +1100 Subject: [PATCH 1/2] Fixes for purging existing company --- app/Services/Migration/CompleteService.php | 4 +++- app/Traits/GenerateMigrationResources.php | 2 +- resources/lang/en/texts.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Services/Migration/CompleteService.php b/app/Services/Migration/CompleteService.php index 317da466a2b6..3ebf40629066 100644 --- a/app/Services/Migration/CompleteService.php +++ b/app/Services/Migration/CompleteService.php @@ -43,8 +43,10 @@ class CompleteService $files = []; foreach ($this->data as $companyKey => $companyData) { + $data[] = [ - 'company_key' => $companyKey, + 'company_index' => $companyKey, + 'company_key' => $companyData['data']['company']['company_key'], 'force' => $companyData['force'], ]; diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index a4708a7588f8..c08ca2e6fe81 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -773,7 +773,7 @@ trait GenerateMigrationResources 'date' => Carbon::parse($item->created_at)->toDateString(), 'custom_value1' => $item->custom_value1, 'custom_value2' => $item->custom_value2, - 'type_id' => $item->invoice_item_type_id, + 'type_id' => (string)$item->invoice_item_type_id, ]; } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 3ddc2e308def..c93cd24e969a 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -3536,7 +3536,7 @@ $LANG = array( 'marked_credit_as_sent' => 'Successfully marked credit as sent', 'email_subject_payment_partial' => 'Email Partial Payment Subject', 'is_approved' => 'Is Approved', - 'migration_went_wrong' => 'Oops, something went wrong! Make sure you did proper setup with V2 of Invoice Ninja, before starting migration.', + 'migration_went_wrong' => 'Error: Make sure you did proper setup with V5 of Invoice Ninja, before starting migration.', 'cross_migration_message' => 'Cross account migration is not allowed. Make sure e-mail address is same on V4 and V5.', 'email_credit' => 'Email Credit', 'client_email_not_set' => 'Client does not have an email address set', From 9ccfc960558a2eb20a08fe6d04f56bcd0197aad9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 23 Nov 2020 22:04:58 +1100 Subject: [PATCH 2/2] Fixes for documentation --- .gitignore | 2 ++ app/Console/Commands/ExportMigrations.php | 2 +- app/Traits/GenerateMigrationResources.php | 10 +++++++++- docs/index.rst | 2 +- storage/import/.gitignore | 2 -- storage/migrations/.gitignore | 2 -- 6 files changed, 13 insertions(+), 7 deletions(-) mode change 100755 => 100644 storage/import/.gitignore diff --git a/.gitignore b/.gitignore index e0c8d883f5cd..d02d02ced32c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ /resources/assets/bower /storage/*.key /storage/documents +/storage/import +/storage/migrations /bootstrap/compiled.php /bootstrap/environment.php /vendor diff --git a/app/Console/Commands/ExportMigrations.php b/app/Console/Commands/ExportMigrations.php index c05c4fb02522..2ed9f42a9229 100644 --- a/app/Console/Commands/ExportMigrations.php +++ b/app/Console/Commands/ExportMigrations.php @@ -68,7 +68,7 @@ class ExportMigrations extends Command $fileName = "{$accountKey}-{$date}-invoiceninja"; - $data = [ + $data['data'] = [ 'company' => $this->getCompany(), 'users' => $this->getUsers(), 'tax_rates' => $this->getTaxRates(), diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index c08ca2e6fe81..63cd88fd6742 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -879,7 +879,7 @@ trait GenerateMigrationResources 'invitation_id' => $payment->invitation_id, 'company_gateway_id' => $payment->account_gateway_id, 'type_id' => $payment->payment_type_id, - 'status_id' => $payment->payment_status_id, + 'status_id' => $this->transformPaymentStatus($payment), 'amount' => $payment->amount ?: 0, 'applied' => $payment->amount ?: 0, 'refunded' => $payment->refunded ?: 0, @@ -899,6 +899,14 @@ trait GenerateMigrationResources return $transformed; } + private function transformPaymentStatus($payment) + { + if($payment->is_deleted && $payment->payment_status_id == 4) + return 2; + + return $payment->payment_status_id; + } + private function getCredits() { $credits = Credit::where('account_id', $this->account->id)->where('balance', '>', 0)->whereIsDeleted(false) diff --git a/docs/index.rst b/docs/index.rst index 0f4a6f6f1430..96a830cd4d68 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -Invoice Ninja User Guide +Invoice Ninja V4.x User Guide. For Version 5.x documentation, please go to invoiceninja.github.io ======================== Want to find out everything there is to know about how to use your Invoice Ninja account? Look no further than our User Guide, where you’ll learn all about creating and sending invoices, receiving payments, creating tasks, converting quotes to invoices, recurring invoices, entering credits and much, much more. diff --git a/storage/import/.gitignore b/storage/import/.gitignore old mode 100755 new mode 100644 index d6b7ef32c847..e69de29bb2d1 --- a/storage/import/.gitignore +++ b/storage/import/.gitignore @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/storage/migrations/.gitignore b/storage/migrations/.gitignore index c96a04f008ee..e69de29bb2d1 100644 --- a/storage/migrations/.gitignore +++ b/storage/migrations/.gitignore @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file