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

Merge pull request #5923 from turbo124/v5-develop

5.1.71
This commit is contained in:
David Bomba 2021-06-05 12:43:12 +10:00 committed by GitHub
commit 1b76dc4d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 34 deletions

View File

@ -1 +1 @@
5.1.70
5.1.71

View File

@ -20,6 +20,7 @@ use App\Libraries\MultiDB;
use App\Mail\DownloadBackup;
use App\Mail\DownloadInvoices;
use App\Models\Activity;
use App\Models\Backup;
use App\Models\Client;
use App\Models\ClientContact;
use App\Models\ClientGatewayToken;
@ -646,24 +647,8 @@ class CompanyImport implements ShouldQueue
$this->backup_file->activities = $activities;
$this->genericImport(Activity::class,
$this->genericNewClassImport(Activity::class,
[
'user_id',
'company_id',
'client_id',
'client_contact_id',
'project_id',
'vendor_id',
'payment_id',
'invoice_id',
'credit_id',
'invitation_id',
'task_id',
'expense_id',
'token_id',
'quote_id',
'subscription_id',
'recurring_invoice_id',
'hashed_id',
'company_id',
],
@ -683,8 +668,7 @@ class CompanyImport implements ShouldQueue
['recurring_invoices' => 'recurring_invoice_id'],
['invitations' => 'invitation_id'],
],
'activities',
'created_at');
'activities');
return $this;
@ -694,7 +678,7 @@ class CompanyImport implements ShouldQueue
{
$this->genericImportWithoutCompany(Backup::class,
['activity_id','hashed_id'],
['hashed_id','id'],
[
['activities' => 'activity_id'],
],
@ -713,7 +697,7 @@ class CompanyImport implements ShouldQueue
[
['users' => 'user_id'],
['clients' => 'client_id'],
['activities' => 'activity_id'],
// ['activities' => 'activity_id'],
],
'company_ledger',
'created_at');
@ -955,7 +939,7 @@ class CompanyImport implements ShouldQueue
$activity_invitation_key = false;
if($class instanceof Activity){
if($class == 'App\Models\Activity'){
if(isset($obj->invitation_id)){
@ -965,6 +949,7 @@ class CompanyImport implements ShouldQueue
$activity_invitation_key = 'quote_invitations';
elseif($isset($obj->credit_id))
$activity_invitation_key = 'credit_invitations';
}
}
@ -974,14 +959,15 @@ class CompanyImport implements ShouldQueue
{
foreach($transform as $key => $value)
{
if($class instanceof Activity && $activity_invitation_key)
if($class == 'App\Models\Activity' && $activity_invitation_key && $key == 'invitations'){
$key = $activity_invitation_key;
}
$obj_array["{$value}"] = $this->transformId($key, $obj->{$value});
}
}
if($class instanceof CompanyGateway) {
if($class == 'App\Models\CompanyGateway') {
$obj_array['config'] = encrypt($obj_array['config']);
}
@ -1115,14 +1101,13 @@ class CompanyImport implements ShouldQueue
return null;
if (! array_key_exists($resource, $this->ids)) {
nlog($this->ids);
nlog($this->backup_file->payments);
// nlog($this->ids);
throw new \Exception("Resource {$resource} not available.");
}
if (! array_key_exists("{$old}", $this->ids[$resource])) {
nlog($this->ids);
nlog($this->backup_file->payments);
// nlog($this->ids[$resource]);
nlog("searching for {$old} in {$resource}");
throw new \Exception("Missing {$resource} key: {$old}");
}

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.1.70',
'app_tag' => '5.1.70-release',
'app_version' => '5.1.71',
'app_tag' => '5.1.71-release',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -769,7 +769,7 @@ class ImportCompanyTest extends TestCase
$this->backup_json_object->activities = $activities;
$this->genericImport(Activity::class,
$this->genericNewClassImport(Activity::class,
[
'user_id',
'company_id',
@ -806,8 +806,7 @@ class ImportCompanyTest extends TestCase
['recurring_invoices' => 'recurring_invoice_id'],
['invitations' => 'invitation_id'],
],
'activities',
'created_at');
'activities');
$this->assertEquals(25, Activity::count());