diff --git a/components/UserObserver.php b/components/UserObserver.php index 6ffdf34..4ee91f0 100644 --- a/components/UserObserver.php +++ b/components/UserObserver.php @@ -90,7 +90,7 @@ public function updateUser($params) if ($user->contact_id !== $contact->id) { $user->contact_id = $contact->id; - if (!$user->save()) { + if (!$user->save(false)) { \Yii::log("Unable to save user contact: ".print_r($user->getErrors(),true), \CLogger::LEVEL_ERROR); throw new Exception("Unable to save user contact: ".print_r($user->getErrors(),true)); } @@ -98,7 +98,7 @@ public function updateUser($params) return $user; } else { \Yii::log("User " . $username . " not found in the CSD database.", \CLogger::LEVEL_ERROR); - throw new Exception("Unable to save user contact: ".$username); + return; } } catch (Exception $e) { \Yii::log("Unable to update user. Error: ". $e->getMessage(), \CLogger::LEVEL_ERROR); @@ -172,10 +172,10 @@ private function saveUser(User $user, UserAuthentication $user_authentication, a } $user->is_consultant = $remote_user['is_consultant']; $user->is_surgeon = $remote_user['is_surgeon']; - $user_authentication->active = !$remote_user['active']; + $user_authentication->active = $remote_user['active']; $user->global_firm_rights = 1; - if (!$user->save()) { + if (!$user->save(false)) { \Yii::log('Unable to save user: '.print_r($user->getErrors(),true), \CLogger::LEVEL_ERROR); throw new Exception('Unable to save user: '.print_r($user->getErrors(),true)); } @@ -206,7 +206,7 @@ private function saveContact(User $user, Contact $contact): Contact $contact->last_name = $user->last_name; $contact->qualifications = $user->qualifications; - if (!$contact->save()) { + if (!$contact->save(false)) { \Yii::log('Unable to save contact: '.print_r($contact->getErrors(),true), \CLogger::LEVEL_ERROR); throw new Exception('Unable to save contact: '.print_r($contact->getErrors(),true)); }