From 408503ef8a6a9012ac6ca86dab1cc09ba1318739 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 1 Aug 2021 11:11:57 +1000 Subject: [PATCH] Fixes for import --- app/Jobs/Util/Import.php | 70 ++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 8a13ebe425..e256105de3 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -214,41 +214,6 @@ class Import implements ShouldQueue $this->{$method}($data[$import]); } - // if(Ninja::isHosted() && array_key_exists('ninja_tokens', $data)) - $this->processNinjaTokens($data['ninja_tokens']); - - // $this->fixData(); - - $this->setInitialCompanyLedgerBalances(); - - // $this->fixClientBalances(); - $check_data = CheckCompanyData::dispatchNow($this->company, md5(time())); - - try{ - Mail::to($this->user->email, $this->user->name()) - ->send(new MigrationCompleted($this->company, implode("
",$check_data))); - } - catch(\Exception $e) { - - nlog($e->getMessage()); - } - - /*After a migration first some basic jobs to ensure the system is up to date*/ - VersionCheck::dispatch(); - - $account = $this->company->account; - $account->default_company_id = $this->company->id; - $account->save(); - - //company size check - if ($this->company->invoices()->count() > 1000 || $this->company->products()->count() > 1000 || $this->company->clients()->count() > 1000) { - $this->company->is_large = true; - $this->company->save(); - } - - // CreateCompanyPaymentTerms::dispatchNow($sp035a66, $spaa9f78); - // CreateCompanyTaskStatuses::dispatchNow($this->company, $this->user); - $task_statuses = [ ['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 1], ['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 2], @@ -259,6 +224,41 @@ class Import implements ShouldQueue TaskStatus::insert($task_statuses); + $account = $this->company->account; + $account->default_company_id = $this->company->id; + $account->save(); + + //company size check + if ($this->company->invoices()->count() > 1000 || $this->company->products()->count() > 1000 || $this->company->clients()->count() > 1000) { + $this->company->is_large = true; + $this->company->save(); + } + + $this->setInitialCompanyLedgerBalances(); + + // $this->fixClientBalances(); + $check_data = CheckCompanyData::dispatchNow($this->company, md5(time())); + + // if(Ninja::isHosted() && array_key_exists('ninja_tokens', $data)) + $this->processNinjaTokens($data['ninja_tokens']); + + // $this->fixData(); + try{ + Mail::to($this->user->email, $this->user->name()) + ->send(new MigrationCompleted($this->company, implode("
",$check_data))); + } + catch(\Exception $e) { + nlog($e->getMessage()); + } + + /*After a migration first some basic jobs to ensure the system is up to date*/ + VersionCheck::dispatch(); + + + + // CreateCompanyPaymentTerms::dispatchNow($sp035a66, $spaa9f78); + // CreateCompanyTaskStatuses::dispatchNow($this->company, $this->user); + info('CompletedπŸš€πŸš€πŸš€πŸš€πŸš€ at '.now()); unlink($this->file_path);