From 39ed67c3575c1f4a70d7aec8caf9b77e3d2a3798 Mon Sep 17 00:00:00 2001
From: Frank Morgner <morgnerf@ub.uni-leipzig.de>
Date: Tue, 28 Aug 2018 09:41:02 +0200
Subject: [PATCH] refs #13787 * adds new FincIls method refreshLogin() to force
 balanceFinesOfUser() to get new scopes via paia login

---
 module/finc/src/finc/ILS/Driver/FincILS.php   | 20 +++++++++++++++++++
 .../src/finc/ILS/Driver/LiberoDingTrait.php   |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/module/finc/src/finc/ILS/Driver/FincILS.php b/module/finc/src/finc/ILS/Driver/FincILS.php
index 2cf2f55aa63..4e83aee5feb 100644
--- a/module/finc/src/finc/ILS/Driver/FincILS.php
+++ b/module/finc/src/finc/ILS/Driver/FincILS.php
@@ -966,6 +966,26 @@ class FincILS extends PAIA implements LoggerAwareInterface
         }
     }
 
+    /**
+     * Refresh Login
+     *
+     * Refresh by removing time to expire and constraint authenticating via
+     * paiaLogin by patronLogin.
+     *
+     * @param string $username The patron's username
+     * @param string $password The patron's login password
+     *
+     * @return mixed Associative array of patron info on successful login,
+     * null on unsuccessful login.
+     * @access public
+     */
+    public function refreshLogin($username, $password)
+    {
+        $session = $this->getSession();
+        $session->expires = 0;
+        return $this->patronLogin($username, $password);
+    }
+
     /**
      * PAIA helper function to map session data to return value of patronLogin()
      *
diff --git a/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php b/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php
index e3264e0d4f9..82e1e38a8fd 100644
--- a/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php
+++ b/module/finc/src/finc/ILS/Driver/LiberoDingTrait.php
@@ -185,6 +185,8 @@ trait LiberoDingTrait
             );
             return false;
         }
+        // reload PAIA session by paia login again
+        $this->refreshLogin($patron['cat_username'], $patron['cat_password']);
 
         return $this->_getLiberoDingResultBool($result);
     }
-- 
GitLab