From a2d85805a73fd0a99cd22d6554c255f107186689 Mon Sep 17 00:00:00 2001 From: Dorian Merz <merz@ub.uni-leipzig.de> Date: Wed, 21 Feb 2018 15:15:21 +0100 Subject: [PATCH] refs #12463: * adds changeUserPin function to LiberoDingTrait * changes relevant for finc-master --- .../src/finc/ILS/Driver/LiberoDingTrait.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php b/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php index 57bf6219fce..0e333790b30 100644 --- a/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php +++ b/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php @@ -386,6 +386,43 @@ trait LiberoDingTrait } + /** + * This method sends a PIN changing request to the LiberoDing. + * + * @param array $patron Patron array returned by patronLogin method. + * + * @return array An associative array + */ + public function changeUserPin($newPin,$patron) + { + $params = $this->_getLiberoDingRequestParams(); + $params['memberCode'] = $patron['cat_username']; + $params['password'] = $patron['cat_password']; + $params['newPin'] = $newPin; + + try { + $result = $this->httpService->get( + $this->getWebScraperUrl() .'changeUserPin.jsp', + $params, + null, + $this->_getLiberoDingRequestHeaders() + ); + } catch (\Exception $e) { + throw new ILSException($e->getMessage()); + } + + if (!$result->isSuccess()) { + // log error for debugging + $this->debug( + 'HTTP status ' . $result->getStatusCode() . + ' received' + ); + return false; + } + + return $this->_getLiberoDingResult($result, 'changeUserPinOk'); + } + /** * Get a mapping table to exchange general terms * of Libero and VuFind. -- GitLab