From 8720f1dec21d42c75a7dff06c6faf7973c9e6e04 Mon Sep 17 00:00:00 2001 From: Alex Arnaud <alex.arnaud@biblibre.com> Date: Thu, 28 Mar 2024 10:01:51 +0000 Subject: [PATCH] hotline#199203 : fix error when saving Patron information to SIGB --- VERSIONS_HOTLINE/199203 | 1 + library/Class/WebService/SIGB/Emprunteur.php | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 VERSIONS_HOTLINE/199203 diff --git a/VERSIONS_HOTLINE/199203 b/VERSIONS_HOTLINE/199203 new file mode 100644 index 00000000000..19949085d11 --- /dev/null +++ b/VERSIONS_HOTLINE/199203 @@ -0,0 +1 @@ + - correctif #199203 : Correction d'une erreur à la validation de modifications d'usager \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Emprunteur.php b/library/Class/WebService/SIGB/Emprunteur.php index 4f11aa30a56..9f4f5c65759 100644 --- a/library/Class/WebService/SIGB/Emprunteur.php +++ b/library/Class/WebService/SIGB/Emprunteur.php @@ -734,7 +734,7 @@ class Class_WebService_SIGB_Emprunteur { public function ensureAndSave(Class_Users $user) : bool { $this->ensureService($user); if ($user->isAbonne() && $this->_service) - return $this->save(); + return $this->save($user); return $this->isNullInstance(); } @@ -806,13 +806,13 @@ class Class_WebService_SIGB_Emprunteur { } - public function save() : bool { + public function save(?Class_Users $user = null) : bool { if ( ! isset($this->_service)) return false; $this->_service->saveEmprunteur($this); - if ( ! $this->_service->hasErrors()) { - Class_WebService_SIGB_EmprunteurCache::newInstance()->save($user, $this); + if ( ! $this->_service->hasErrors() && $user) { + $this->_saveCache($user); return true; } @@ -821,6 +821,13 @@ class Class_WebService_SIGB_Emprunteur { } + protected function _saveCache(?Class_Users $user = null): void + { + if ($user) + Class_WebService_SIGB_EmprunteurCache::newInstance()->save($user, $this); + } + + public function resetPassword() { if (!isset($this->_service)) return false; -- GitLab