From 175576247cebceacdaeb38f6f347ea8ce8b9e18e Mon Sep 17 00:00:00 2001
From: Laura Hild <lshild@wm.edu>
Date: Tue, 4 Nov 2014 08:56:29 -0500
Subject: [PATCH] Symphony: properly report patronLogin failure

---
 .../VuFind/src/VuFind/ILS/Driver/Symphony.php | 34 ++++++++++++-------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php
index 89e15481f79..a8db0255e8b 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php
@@ -968,18 +968,28 @@ class Symphony extends AbstractBase implements ServiceLocatorAwareInterface
             'cat_password' => $password,
         );
 
-        $resp = $this->makeRequest(
-            'patron',
-            'lookupMyAccountInfo',
-            array(
-                'includePatronInfo' => 'true',
-                'includePatronAddressInfo' => 'true'
-            ),
-            array(
-                'login' => $username,
-                'password' => $password,
-            )
-        );
+        try {
+            $resp = $this->makeRequest(
+                'patron',
+                'lookupMyAccountInfo',
+                array(
+                    'includePatronInfo' => 'true',
+                    'includePatronAddressInfo' => 'true'
+                ),
+                array(
+                    'login' => $username,
+                    'password' => $password,
+                )
+            );
+        } catch (SoapFault $e) {
+            $unableToLogin = 'ns0:com.sirsidynix.symws.service.'
+                . 'exceptions.SecurityServiceException.unableToLogin';
+            if ($e->faultcode == $unableToLogin) {
+                return null;
+            } else {
+                throw $e;
+            }
+        }
 
         $patron['id']      = $resp->patronInfo->$usernameField;
         $patron['library'] = $resp->patronInfo->patronLibraryID;
-- 
GitLab