diff --git a/README.md b/README.md index 161fd0098252..e7d7027e12af 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Just make sure to add the `invoice-ninja` tag to your question. -#### Note: v5 is now in beta. To upgrade from v4 you need to [install v5](https://invoiceninja.github.io/selfhost.html) as a separate app and then use the migration tool in the latest version of v4 on Settings > Account Management. +#### Note: v5 is now in beta. To upgrade from v4 you need to [install v5](https://invoiceninja.github.io/docs/self-host/) as a separate app and then use the migration tool in the latest version of v4 on Settings > Account Management. All Pro and Enterprise features from the hosted app are included in the open-source code. We offer a $30 per year white-label license to remove the Invoice Ninja branding from client facing parts of the app. diff --git a/app/Console/Commands/ExportMigrations.php b/app/Console/Commands/ExportMigrations.php index bc9f4c223699..8e8f0866899b 100644 --- a/app/Console/Commands/ExportMigrations.php +++ b/app/Console/Commands/ExportMigrations.php @@ -62,6 +62,7 @@ class ExportMigrations extends Command $users = User::all(); foreach($users as $user) { + Auth::login($user); $this->export($user); } } @@ -78,18 +79,28 @@ class ExportMigrations extends Command $fileName = "{$accountKey}-{$date}-invoiceninja"; $data['data'] = [ + 'account' => $this->getAccount(), 'company' => $this->getCompany(), 'users' => $this->getUsers(), 'tax_rates' => $this->getTaxRates(), + 'payment_terms' => $this->getPaymentTerms(), 'clients' => $this->getClients(), - 'products' => $this->getProducts(), - 'invoices' => $this->getInvoices(), - 'quotes' => $this->getQuotes(), - 'payments' => array_merge($this->getPayments(), $this->getCredits()), - 'credits' => $this->getCreditsNotes(), - 'documents' => $this->getDocuments(), 'company_gateways' => $this->getCompanyGateways(), 'client_gateway_tokens' => $this->getClientGatewayTokens(), + 'vendors' => $this->getVendors(), + 'projects' => $this->getProjects(), + 'products' => $this->getProducts(), + 'credits' => $this->getCreditsNotes(), + 'invoices' => $this->getInvoices(), + 'recurring_invoices' => $this->getRecurringInvoices(), + 'quotes' => $this->getQuotes(), + 'payments' => array_merge($this->getPayments(), $this->getCredits()), + 'documents' => $this->getDocuments(), + 'expense_categories' => $this->getExpenseCategories(), + 'task_statuses' => $this->getTaskStatuses(), + 'expenses' => $this->getExpenses(), + 'tasks' => $this->getTasks(), + 'documents' => $this->getDocuments(), ]; $file = storage_path("migrations/{$fileName}.zip"); diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index 92a5deeb24ac..8ff34c808cf3 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -73,6 +73,8 @@ trait GenerateMigrationResources info("get company"); return [ + 'first_day_of_week' => $this->account->start_of_week, + 'first_month_of_year' => $this->account->financial_year_start, 'version' => NINJA_VERSION, 'referral_code' => $this->account->referral_code ?: '', 'account_id' => $this->account->id, @@ -713,7 +715,7 @@ info("get company"); default: - # code... + return 5; break; } } @@ -747,6 +749,34 @@ info("get company"); } + private function transformQuoteStatusId($quote) + { + if(!$quote->is_public) + return 1; + + if($quote->quote_invoice_id) + return 4; + + switch ($quote->invoice_status_id) { + case 1: + return 1; + break; + case 2: + return 2; + break; + case 3: + return 2; + break; + case 4: + return 3; + break; + + default: + return 2; + break; + } + } + /* define('INVOICE_STATUS_DRAFT', 1); define('INVOICE_STATUS_SENT', 2); @@ -916,7 +946,7 @@ info("get company"); 'client_id' => $quote->client_id, 'user_id' => $quote->user_id, 'company_id' => $quote->account_id, - 'status_id' => $quote->invoice_status_id, + 'status_id' => $this->transformQuoteStatusId($quote), 'design_id' => $this->getDesignId($quote->invoice_design_id), 'number' => $quote->invoice_number, 'discount' => $quote->discount, @@ -985,6 +1015,7 @@ info("get company"); $transformed = []; $payments = Payment::where('account_id', $this->account->id) + ->where('payment_status_id', '!=', PAYMENT_STATUS_VOIDED) ->withTrashed() ->get(); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 8daf60c1c23a..06053d54ef6d 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -4138,6 +4138,13 @@ $LANG = array( 'vendor_address1' => 'Vendor Street', 'vendor_address2' => 'Vendor Apt/Suite', + ////////////////////////////////////// + 'start_migration' => 'Start Migration', + 'recurring_cancellation_request' => 'Request for recurring invoice cancellation from :contact', + 'recurring_cancellation_request_body' => ':contact from Client :client requested to cancel Recurring Invoice :invoice', + + 'hello' => 'Hello', + 'group_documents' => 'Group documents', ); return $LANG;