mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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'])) {
|
||||
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']);
|
||||
else{
|
||||
$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
|
||||
{
|
||||
if (! array_key_exists($resource, $this->ids)) {
|
||||
info(print_r($resource,1));
|
||||
throw new Exception("Resource {$resource} not available.");
|
||||
}
|
||||
|
||||
@ -1299,6 +1300,19 @@ class Import implements ShouldQueue
|
||||
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.
|
||||
*
|
||||
|
@ -57,7 +57,7 @@ class StartMigration implements ShouldQueue
|
||||
|
||||
// public $maxExceptions = 2;
|
||||
|
||||
public $backoff = 86430;
|
||||
//public $backoff = 86430;
|
||||
|
||||
public function __construct($filepath, User $user, Company $company)
|
||||
{
|
||||
|
@ -38,14 +38,14 @@ return [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 900000,
|
||||
'retry_after' => 90000000,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 900000,
|
||||
'retry_after' => 90000000,
|
||||
'block_for' => 0,
|
||||
],
|
||||
|
||||
@ -63,7 +63,7 @@ return [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 900000,
|
||||
'retry_after' => 90000000,
|
||||
'block_for' => null,
|
||||
],
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user