From 8dd61dd5b2851d5c24f2b70865737c6a09b78f5e Mon Sep 17 00:00:00 2001
From: Dorian Merz <merz@ub.uni-leipzig.de>
Date: Thu, 8 Oct 2020 08:59:07 +0200
Subject: [PATCH] refs #18048 [finc] align return type of SolrAI's getCleanISSN
 with parent method

---
 module/finc/src/finc/RecordDriver/SolrAI.php | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/module/finc/src/finc/RecordDriver/SolrAI.php b/module/finc/src/finc/RecordDriver/SolrAI.php
index 4af5fa770e8..ddc8790d151 100644
--- a/module/finc/src/finc/RecordDriver/SolrAI.php
+++ b/module/finc/src/finc/RecordDriver/SolrAI.php
@@ -267,13 +267,23 @@ class SolrAI extends SolrDefault implements
     }
 
     /**
-     * Get an array of all ISSNs associated with the record (may be empty).
+     * Get just the base portion of the first listed ISSN (or false if no ISSNs).
+     * The major part of this is a copy of the parent method. It only uses rft.issn
+     * instead of getISSNs
      *
-     * @return array of issns
+     * @return mixed
      */
     public function getCleanISSN()
     {
-        return $this->getAIRecord('rft.issn');
+        $issns = $this->getAIRecord('rft.issn');
+        if (empty($issns)) {
+            return false;
+        }
+        $issn = $issns[0];
+        if ($pos = strpos($issn, ' ')) {
+            $issn = substr($issn, 0, $pos);
+        }
+        return $issn;
     }
 
     /**
-- 
GitLab