mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for migration data checks
This commit is contained in:
parent
2f4b46e435
commit
c2b07c3ebc
@ -819,7 +819,7 @@ class Import implements ShouldQueue
|
|||||||
if (isset($modified['invoices'])) {
|
if (isset($modified['invoices'])) {
|
||||||
foreach ($modified['invoices'] as $key => $invoice) {
|
foreach ($modified['invoices'] as $key => $invoice) {
|
||||||
|
|
||||||
if($modified['amount'] >= 0)
|
if($this->tryTransformingId('invoices', $invoice['invoice_id']))
|
||||||
$modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']);
|
$modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']);
|
||||||
else{
|
else{
|
||||||
$modified['credits'][$key]['credit_id'] = $this->transformId('credits', $invoice['invoice_id']);
|
$modified['credits'][$key]['credit_id'] = $this->transformId('credits', $invoice['invoice_id']);
|
||||||
@ -1289,6 +1289,7 @@ class Import implements ShouldQueue
|
|||||||
public function transformId($resource, string $old): int
|
public function transformId($resource, string $old): int
|
||||||
{
|
{
|
||||||
if (! array_key_exists($resource, $this->ids)) {
|
if (! array_key_exists($resource, $this->ids)) {
|
||||||
|
info(print_r($resource,1));
|
||||||
throw new Exception("Resource {$resource} not available.");
|
throw new Exception("Resource {$resource} not available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1299,6 +1300,19 @@ class Import implements ShouldQueue
|
|||||||
return $this->ids[$resource]["{$resource}_{$old}"]['new'];
|
return $this->ids[$resource]["{$resource}_{$old}"]['new'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function tryTransformingId($resource, string $old): ?int
|
||||||
|
{
|
||||||
|
if (! array_key_exists($resource, $this->ids)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! array_key_exists("{$resource}_{$old}", $this->ids[$resource])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->ids[$resource]["{$resource}_{$old}"]['new'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process & handle user_id.
|
* Process & handle user_id.
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,7 @@ class StartMigration implements ShouldQueue
|
|||||||
|
|
||||||
// public $maxExceptions = 2;
|
// public $maxExceptions = 2;
|
||||||
|
|
||||||
public $backoff = 86430;
|
//public $backoff = 86430;
|
||||||
|
|
||||||
public function __construct($filepath, User $user, Company $company)
|
public function __construct($filepath, User $user, Company $company)
|
||||||
{
|
{
|
||||||
|
@ -38,14 +38,14 @@ return [
|
|||||||
'driver' => 'database',
|
'driver' => 'database',
|
||||||
'table' => 'jobs',
|
'table' => 'jobs',
|
||||||
'queue' => 'default',
|
'queue' => 'default',
|
||||||
'retry_after' => 900000,
|
'retry_after' => 90000000,
|
||||||
],
|
],
|
||||||
|
|
||||||
'beanstalkd' => [
|
'beanstalkd' => [
|
||||||
'driver' => 'beanstalkd',
|
'driver' => 'beanstalkd',
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
'queue' => 'default',
|
'queue' => 'default',
|
||||||
'retry_after' => 900000,
|
'retry_after' => 90000000,
|
||||||
'block_for' => 0,
|
'block_for' => 0,
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ return [
|
|||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
'queue' => env('REDIS_QUEUE', 'default'),
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
'retry_after' => 900000,
|
'retry_after' => 90000000,
|
||||||
'block_for' => null,
|
'block_for' => null,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user