From 2e53520f95f1c2bcdb82effa4d7d8df72eb0a9b4 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 17 Dec 2015 11:05:11 +0200
Subject: [PATCH] Switched Primo record retrieval to an unquoted contains
 search to work around a Primo issue where colons in the ID cause retrieval to
 fail otherwise.

---
 .../src/VuFindSearch/Backend/Primo/Connector.php         | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Primo/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/Primo/Connector.php
index ed2069ff94e..a22a36b677c 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Primo/Connector.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Primo/Connector.php
@@ -605,8 +605,13 @@ class Connector implements \Zend\Log\LoggerAwareInterface
         // Query String Parameters
         if (isset($recordId)) {
             $qs   = [];
-            $qs[] = 'query=rid,exact,"' . urlencode(addcslashes($recordId, '"'))
-                . '"';
+            // There is currently (at 2015-12-17) a problem with Primo fetching
+            // records that have colons in the id (e.g.
+            // doaj_xmloai:doaj.org/article:94935655971c4917aab4fcaeafeb67b9).
+            // According to Ex Libris support we must use contains search without
+            // quotes for the time being.
+            $qs[] = 'query=rid,contains,'
+                . urlencode(addcslashes($recordId, '":-()'));
             $qs[] = "institution=$inst_code";
             $qs[] = 'onCampus=' . ($onCampus ? 'true' : 'false');
             $qs[] = "indx=1";
-- 
GitLab