From 6a8ab104800af1563106ca68a32b7897aa04db8f Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Wed, 2 Feb 2022 23:59:55 +0100
Subject: [PATCH] refs #21213 [finc] fix open url concat adding ampersand

---
 module/finc/src/finc/Resolver/Driver/Ezb.php | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/module/finc/src/finc/Resolver/Driver/Ezb.php b/module/finc/src/finc/Resolver/Driver/Ezb.php
index f5bd012fa0a..f4d8ae4a279 100644
--- a/module/finc/src/finc/Resolver/Driver/Ezb.php
+++ b/module/finc/src/finc/Resolver/Driver/Ezb.php
@@ -80,7 +80,7 @@ class Ezb extends Base implements TranslatorAwareInterface
     /**
      * Constructor
      *
-     * @param string            $config    ezb configuration
+     * @param string            $config     ezb configuration
      * @param \Zend\Http\Client $httpClient HTTP client
      */
     public function __construct($config, \Zend\Http\Client $httpClient)
@@ -192,11 +192,11 @@ class Ezb extends Base implements TranslatorAwareInterface
 
         // limit results to ezb only (set to true)
         if (isset($this->config->ezb_only) && $this->config->ezb_only) {
-            $pid .= 'ezb=1';
+            $pid .= '&ezb=1';
         }
         // limit results to zdb only (set to true)
         if (isset($this->config->zdb_only) && $this->config->zdb_only) {
-            $pid .= 'zdb=1';
+            $pid .= '&zdb=1';
         }
 
         $openURL .= '&pid=' . urlencode($pid);
@@ -226,7 +226,7 @@ class Ezb extends Base implements TranslatorAwareInterface
         // user
         return false;
     }
-    
+
     /**
      * Extract electronic results from the EZB response and inject them into the
      * $records array.
@@ -277,7 +277,8 @@ class Ezb extends Base implements TranslatorAwareInterface
 
             // get title from XPath Element defined in $xpathTitleSelector
             $titleXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" .
-                "Result[@state={$state}][" . ($i + 1) . "]/" . static::$xpathTitleSelector;
+                "Result[@state={$state}][" . ($i + 1) . "]/" .
+                static::$xpathTitleSelector;
             $title = $xpath->query($titleXP, $result)->item(0);
             if (isset($title)) {
                 $record['title'] = strip_tags($title->nodeValue);
@@ -310,7 +311,8 @@ class Ezb extends Base implements TranslatorAwareInterface
                 "Result[@state={$state}][" . ($i + 1) . "]/JournalURL";
             $journalUrl = $xpath->query($journalUrlXP, $result)->item(0);
 
-            // return direct access URL if available otherwise journal URL as fallback
+            // return direct access URL if available
+            // otherwise journal URL as fallback
             if (isset($accessUrl->nodeValue)) {
                 $record['href'] = $accessUrl->nodeValue;
             } elseif (isset($journalUrl)) {
-- 
GitLab