From 59a6e2a2776ecec99cf43e1f334a3d4e786537e5 Mon Sep 17 00:00:00 2001
From: Dorian Merz <merz@ub.uni-leipzig.de>
Date: Thu, 5 Dec 2019 09:57:21 +0100
Subject: [PATCH] refs #16525 [fid] fixes hierarchy display * adapts GetIt box
 logic for hierarchy parents * use cascading translation for multi-valume
 notices

---
 module/fid/src/View/Helper/Root/GetIt.php | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/module/fid/src/View/Helper/Root/GetIt.php b/module/fid/src/View/Helper/Root/GetIt.php
index 5c7e2f870ab..cf714571d10 100644
--- a/module/fid/src/View/Helper/Root/GetIt.php
+++ b/module/fid/src/View/Helper/Root/GetIt.php
@@ -65,6 +65,7 @@ class GetIt extends AbstractHelper
     protected $format;
     protected $facetAvail;
     protected $multipart;
+    protected $isCollection;
     protected $institution;
     protected $megacollection;
     protected $collection;
@@ -91,7 +92,8 @@ class GetIt extends AbstractHelper
         $this->sid = $this->driver->tryMethod('getSourceID');
         $this->format = $this->driver->tryMethod('getFormats');
         $this->facetAvail = $this->driver->tryMethod('getFacetAvail');
-        $this->multipart = $this->driver->tryMethod('getMultiPart');
+        //$this->multipart = $this->driver->tryMethod('isMultiPartSet');
+        $this->isCollection = $this->driver->tryMethod('hasChildren');
         $this->institution = $this->driver->tryMethod('getInstitutions');
         $this->megacollection = $this->driver->tryMethod('getMegaCollection');
         $this->collection = $this->driver->tryMethod('getCollection');
@@ -255,8 +257,8 @@ class GetIt extends AbstractHelper
                         return $this->translate('getit_text_13');
                     }
                 }
-                if (preg_grep($this->_getNonSourceIds('source_idsV8_4'), [$this->multipart])) {
-                    return $this->translate('getit_text_11');
+                if ($this->isCollection) {
+                    return $this->translate('getit_text_11',['%%hierarchy_tree%%' => $this->translate('hierarchy_tree')]);
                 }
                 if (preg_grep($this->_getNonSourceIds('source_idsV8_7'), $this->megacollection)
                 ) {
@@ -296,8 +298,8 @@ class GetIt extends AbstractHelper
                         return $this->translate('getit_text_15');
                     }
                 }
-            } elseif (preg_grep($this->_getNonSourceIds('source_idsV8_4'), [$this->multipart])) {
-                return $this->translate('getit_text_11');
+            } elseif ($this->isCollection) {
+                return $this->translate('getit_text_11',['%%hierarchy_tree%%' => $this->translate('hierarchy_tree')]);
             } elseif (in_array('Local', $this->facetAvail)
                 && preg_grep($this->_getNonSourceIds('source_idsV8_2'), $this->format)
             ) {
@@ -352,7 +354,7 @@ class GetIt extends AbstractHelper
         if (in_array($this->sid, $this->_getSourceIds('source_idsV9'))
             && preg_grep($this->_getNonSourceIds('source_idsV8_1'), $this->format)
             && !in_array($this->_getNonSourceIds('source_idsV8_9'), $this->institution)
-            && !preg_grep($this->_getNonSourceIds('source_idsV8_4'), [$this->multipart])
+            && !$this->isCollection
             && !preg_grep($this->_getNonSourceIds('source_idsV8_8'), $this->collection)
         ) {
             return true;
@@ -368,7 +370,7 @@ class GetIt extends AbstractHelper
         if (!in_array('Free', $this->facetAvail)
             && in_array($this->sid, $this->_getSourceIds('source_idsV9'))
             && preg_grep($this->_getNonSourceIds('source_idsV8_1'), $this->format)
-            && !preg_grep($this->_getNonSourceIds('source_idsV8_4'), [$this->multipart])
+            && !$this->isCollection
             && !preg_grep($this->_getNonSourceIds('source_idsV8_8'), $this->collection)
         ) {
             return true;
-- 
GitLab