1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Minor fixes for check data

This commit is contained in:
David Bomba 2021-11-07 17:41:02 +11:00
parent 3b4afd4537
commit 573ddd83eb

View File

@ -1024,7 +1024,7 @@ class CompanyImport implements ShouldQueue
foreach((object)$this->getObject("users") as $user)
{
if(User::where('email', $user->email)->where('account_id', '!=', $this->account->id)->exists())
if(User::withTrashed()->where('email', $user->email)->where('account_id', '!=', $this->account->id)->exists())
throw new ImportCompanyFailed("{$user->email} is already in the system attached to a different account");
$user_array = (array)$user;
@ -1037,7 +1037,7 @@ class CompanyImport implements ShouldQueue
$new_user = User::withTrashed()->firstOrNew(
['email' => $user->email],
$user_array,
)->restore();
);
$new_user->account_id = $this->account->id;
$new_user->save(['timestamps' => false]);
@ -1067,7 +1067,7 @@ class CompanyImport implements ShouldQueue
$new_cu = CompanyUser::withTrashed()->firstOrNew(
['user_id' => $user_id, 'company_id' => $this->company->id],
$cu_array,
)->restore();
);
$new_cu->account_id = $this->account->id;
$new_cu->save(['timestamps' => false]);
@ -1078,8 +1078,6 @@ class CompanyImport implements ShouldQueue
}
private function transformDocumentId($id, $type)
{
switch ($type) {