Fixes for importing backups

This commit is contained in:
David Bomba 2025-08-02 10:36:17 +10:00
parent 340212d8e3
commit c131c1d63d
1 changed files with 5 additions and 5 deletions

View File

@ -1427,13 +1427,13 @@ class CompanyImport implements ShouldQueue
//foreach ($this->backup_file->users as $user)
foreach ((object)$this->getObject("users") as $user) {
if($user = MultiDB::hasUser(['email' => $user->email])) { //ensures that we do no inject existing users into the new account.
if($user->account_id != $this->account->id) {
throw new ImportCompanyFailed("{$user->email} is already in the system attached to a different account");
if($userX = MultiDB::hasUser(['email' => $user->email])) { //ensures that we do no inject existing users into the new account.
if($userX->account_id != $this->account->id) {
throw new ImportCompanyFailed("{$userX->email} is already in the system attached to a different account");
}
}
MultiDB::setDb($this->company->db);