mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Minor fixes for check data
This commit is contained in:
parent
3b4afd4537
commit
573ddd83eb
@ -1024,7 +1024,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
foreach((object)$this->getObject("users") as $user)
|
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");
|
throw new ImportCompanyFailed("{$user->email} is already in the system attached to a different account");
|
||||||
|
|
||||||
$user_array = (array)$user;
|
$user_array = (array)$user;
|
||||||
@ -1037,7 +1037,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
$new_user = User::withTrashed()->firstOrNew(
|
$new_user = User::withTrashed()->firstOrNew(
|
||||||
['email' => $user->email],
|
['email' => $user->email],
|
||||||
$user_array,
|
$user_array,
|
||||||
)->restore();
|
);
|
||||||
|
|
||||||
$new_user->account_id = $this->account->id;
|
$new_user->account_id = $this->account->id;
|
||||||
$new_user->save(['timestamps' => false]);
|
$new_user->save(['timestamps' => false]);
|
||||||
@ -1067,7 +1067,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
$new_cu = CompanyUser::withTrashed()->firstOrNew(
|
$new_cu = CompanyUser::withTrashed()->firstOrNew(
|
||||||
['user_id' => $user_id, 'company_id' => $this->company->id],
|
['user_id' => $user_id, 'company_id' => $this->company->id],
|
||||||
$cu_array,
|
$cu_array,
|
||||||
)->restore();
|
);
|
||||||
|
|
||||||
$new_cu->account_id = $this->account->id;
|
$new_cu->account_id = $this->account->id;
|
||||||
$new_cu->save(['timestamps' => false]);
|
$new_cu->save(['timestamps' => false]);
|
||||||
@ -1078,8 +1078,6 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function transformDocumentId($id, $type)
|
private function transformDocumentId($id, $type)
|
||||||
{
|
{
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user