From 37b114b94e4cff95f1f8f90b2d3aa5d9ed81c69c Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 30 Sep 2015 09:52:02 -0400
Subject: [PATCH] Support for setting the ILS language in Virtua.

---
 config/vufind/Virtua.ini                       |  2 ++
 module/VuFind/src/VuFind/ILS/Driver/Virtua.php | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/config/vufind/Virtua.ini b/config/vufind/Virtua.ini
index ff131fc5eb1..6af4bdca538 100644
--- a/config/vufind/Virtua.ini
+++ b/config/vufind/Virtua.ini
@@ -18,3 +18,5 @@ service     = VTLS01
 ; Login details
 user        = username
 password    = password
+; System language (en -> English, pt -> Portuguese, fr -> French; default = en) 
+language    = en
\ No newline at end of file
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php
index 483be7d90e2..eb62efdb596 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php
@@ -1690,7 +1690,7 @@ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterfa
             "elementcount" => "1",
             "function" => "PATRONATTEMPT",
             "host" => $this->config['Catalog']['host_string'],
-            "lng" => "en",
+            "lng" => $this->getConfiguredLanguage(),
             "login" => "1",
             "pos" => "1",
             "rootsearch" => "KEYWORD",
@@ -1768,7 +1768,7 @@ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterfa
         $post_data .= "&search="       . "PATRON";
         $post_data .= "&sessionid="    . "$session_id";
         $post_data .= "&skin="         . "homepage";
-        $post_data .= "&lng="          . "en";
+        $post_data .= "&lng="          . $this->getConfiguredLanguage();
         $post_data .= "&inst="         . "consortium";
         $post_data .= "&conf="         . urlencode(".&#047;chameleon.conf");
         $post_data .= "&u1="           . "12";
@@ -1852,6 +1852,17 @@ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterfa
         return "http://{$host}/{$path}/chameleon";
     }
 
+    /**
+     * Support method -- determine the language from the configuration.
+     *
+     * @return string
+     */
+    protected function getConfiguredLanguage()
+    {
+        return isset($this->config['Catalog']['language'])
+            ? $this->config['Catalog']['language'] : 'en';
+    }
+
     /**
      * Support method -- perform an HTTP request.  This will be a GET request unless
      * either $postParams or $rawPost is set to a non-null value.
-- 
GitLab