Merge branch 'master' of github.com:invoiceninja/invoiceninja

This commit is contained in:
Hillel Coren 2021-02-16 18:34:12 +02:00
commit 3b67e2a8c8
4 changed files with 58 additions and 9 deletions

View File

@ -13,7 +13,7 @@
Just make sure to add the `invoice-ninja` tag to your question. 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. 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.

View File

@ -62,6 +62,7 @@ class ExportMigrations extends Command
$users = User::all(); $users = User::all();
foreach($users as $user) { foreach($users as $user) {
Auth::login($user);
$this->export($user); $this->export($user);
} }
} }
@ -78,18 +79,28 @@ class ExportMigrations extends Command
$fileName = "{$accountKey}-{$date}-invoiceninja"; $fileName = "{$accountKey}-{$date}-invoiceninja";
$data['data'] = [ $data['data'] = [
'account' => $this->getAccount(),
'company' => $this->getCompany(), 'company' => $this->getCompany(),
'users' => $this->getUsers(), 'users' => $this->getUsers(),
'tax_rates' => $this->getTaxRates(), 'tax_rates' => $this->getTaxRates(),
'payment_terms' => $this->getPaymentTerms(),
'clients' => $this->getClients(), '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(), 'company_gateways' => $this->getCompanyGateways(),
'client_gateway_tokens' => $this->getClientGatewayTokens(), '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"); $file = storage_path("migrations/{$fileName}.zip");

View File

@ -73,6 +73,8 @@ trait GenerateMigrationResources
info("get company"); info("get company");
return [ return [
'first_day_of_week' => $this->account->start_of_week,
'first_month_of_year' => $this->account->financial_year_start,
'version' => NINJA_VERSION, 'version' => NINJA_VERSION,
'referral_code' => $this->account->referral_code ?: '', 'referral_code' => $this->account->referral_code ?: '',
'account_id' => $this->account->id, 'account_id' => $this->account->id,
@ -713,7 +715,7 @@ info("get company");
default: default:
# code... return 5;
break; 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_DRAFT', 1);
define('INVOICE_STATUS_SENT', 2); define('INVOICE_STATUS_SENT', 2);
@ -916,7 +946,7 @@ info("get company");
'client_id' => $quote->client_id, 'client_id' => $quote->client_id,
'user_id' => $quote->user_id, 'user_id' => $quote->user_id,
'company_id' => $quote->account_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), 'design_id' => $this->getDesignId($quote->invoice_design_id),
'number' => $quote->invoice_number, 'number' => $quote->invoice_number,
'discount' => $quote->discount, 'discount' => $quote->discount,
@ -985,6 +1015,7 @@ info("get company");
$transformed = []; $transformed = [];
$payments = Payment::where('account_id', $this->account->id) $payments = Payment::where('account_id', $this->account->id)
->where('payment_status_id', '!=', PAYMENT_STATUS_VOIDED)
->withTrashed() ->withTrashed()
->get(); ->get();

View File

@ -4138,6 +4138,13 @@ $LANG = array(
'vendor_address1' => 'Vendor Street', 'vendor_address1' => 'Vendor Street',
'vendor_address2' => 'Vendor Apt/Suite', '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; return $LANG;