1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4581 from turbo124/v5-develop

fixes for migration
This commit is contained in:
David Bomba 2020-12-28 17:05:39 +11:00 committed by GitHub
commit eb5639b358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View File

@ -110,6 +110,8 @@ class Import implements ShouldQueue
'payment_terms',
'tax_rates',
'clients',
'company_gateways',
'client_gateway_tokens',
'vendors',
'projects',
'products',
@ -118,8 +120,6 @@ class Import implements ShouldQueue
'recurring_invoices',
'quotes',
'payments',
'company_gateways',
'client_gateway_tokens',
'expense_categories',
'task_statuses',
'expenses',
@ -811,6 +811,11 @@ class Import implements ShouldQueue
//$modified['invoice_id'] = $this->transformId('invoices', $resource['invoice_id']);
$modified['company_id'] = $this->company->id;
// nlog($resource);
// nlog($resource['company_gateway_id']);
// nlog(strlen($resource['company_gateway_id']));
//unset($modified['invoices']);
unset($modified['invoice_id']);
@ -830,6 +835,12 @@ class Import implements ShouldQueue
PaymentFactory::create($this->company->id, $modified['user_id'])
);
if($resource['company_gateway_id'] != 'NULL' && $resource['company_gateway_id'] != NULL){
$payment->company_gateway_id = $this->transformId('company_gateways', $resource['company_gateway_id']);
$payment->save();
}
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
$this->ids['payments'] = [
@ -1026,13 +1037,11 @@ class Import implements ShouldQueue
$company_gateway = CompanyGateway::create($modified);
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
$key = "company_gateways_{$resource['id']}";
$this->ids['company_gateways'] = [
"company_gateways_{$old_user_key}" => [
$this->ids['company_gateways'][$key] = [
'old' => $resource['id'],
'new' => $company_gateway->id,
],
];
}

View File

@ -94,6 +94,7 @@ use App\Listeners\Activity\ExpenseArchivedActivity;
use App\Listeners\Activity\ExpenseDeletedActivity;
use App\Listeners\Activity\ExpenseRestoredActivity;
use App\Listeners\Activity\ExpenseUpdatedActivity;
use App\Listeners\Activity\PaymentArchivedActivity;
use App\Listeners\Activity\PaymentCreatedActivity;
use App\Listeners\Activity\PaymentDeletedActivity;
use App\Listeners\Activity\PaymentRefundedActivity;
@ -122,8 +123,8 @@ use App\Listeners\Invoice\InvoiceArchivedActivity;
use App\Listeners\Invoice\InvoiceCancelledActivity;
use App\Listeners\Invoice\InvoiceDeletedActivity;
use App\Listeners\Invoice\InvoiceEmailActivity;
use App\Listeners\Invoice\InvoiceEmailedNotification;
use App\Listeners\Invoice\InvoiceEmailFailedActivity;
use App\Listeners\Invoice\InvoiceEmailedNotification;
use App\Listeners\Invoice\InvoicePaidActivity;
use App\Listeners\Invoice\InvoiceReminderEmailActivity;
use App\Listeners\Invoice\InvoiceRestoredActivity;
@ -131,8 +132,8 @@ use App\Listeners\Invoice\InvoiceReversedActivity;
use App\Listeners\Invoice\InvoiceViewedActivity;
use App\Listeners\Invoice\UpdateInvoiceActivity;
use App\Listeners\Misc\InvitationViewedListener;
use App\Listeners\Payment\PaymentEmailedActivity;
use App\Listeners\Payment\PaymentEmailFailureActivity;
use App\Listeners\Payment\PaymentEmailedActivity;
use App\Listeners\Payment\PaymentNotification;
use App\Listeners\Payment\PaymentRestoredActivity;
use App\Listeners\Quote\QuoteApprovedActivity;