1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Adjustments for import

This commit is contained in:
= 2021-07-31 20:43:56 +10:00
parent 9acc02a7df
commit d2e56b9803

View File

@ -192,19 +192,17 @@ class Import implements ShouldQueue
nlog("Starting Migration");
nlog($this->user->email);
info("Starting Migration");
info($this->user->email);
nlog("Company ID = ");
nlog($this->company->id);
auth()->login($this->user, false);
auth()->user()->setCompany($this->company);
// $jsonStream = \JsonMachine\JsonMachine::fromFile($this->file_path, "/data");
$array = json_decode(file_get_contents($this->file_path), 1);
$data = $array['data'];
foreach ($this->available_imports as $import) {
if (! array_key_exists($import, $data)) {
//throw new ResourceNotAvailableForMigration("Resource {$key} is not available for migration.");
info("Resource {$import} is not available for migration.");
continue;
}
@ -249,7 +247,17 @@ class Import implements ShouldQueue
}
// CreateCompanyPaymentTerms::dispatchNow($sp035a66, $spaa9f78);
CreateCompanyTaskStatuses::dispatchNow($this->company, $this->user);
// 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],
['name' => ctrans('texts.in_progress'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 3],
['name' => ctrans('texts.done'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 4],
];
TaskStatus::insert($task_statuses);
info('Completed🚀🚀🚀🚀🚀 at '.now());