From c92c46f6724a7f3e84482336a25f321abf07814f Mon Sep 17 00:00:00 2001
From: Dorian Merz <merz@ub.uni-leipzig.de>
Date: Thu, 16 Apr 2020 10:29:11 +0200
Subject: [PATCH] refs #17203 [fid_bbi] 773g as fallback for page numbers in
 getBookComponentPartContainerTitle

---
 .../src/fid_bbi/RecordDriver/SolrMarcFincTrait.php  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/module/fid_bbi/src/fid_bbi/RecordDriver/SolrMarcFincTrait.php b/module/fid_bbi/src/fid_bbi/RecordDriver/SolrMarcFincTrait.php
index 462b6b4abcc..c784470f69c 100644
--- a/module/fid_bbi/src/fid_bbi/RecordDriver/SolrMarcFincTrait.php
+++ b/module/fid_bbi/src/fid_bbi/RecordDriver/SolrMarcFincTrait.php
@@ -164,11 +164,18 @@ trait SolrMarcFincTrait
             $text = $t->getData();
             $d = $marc773->getSubfield('d');
             if (!empty($d)) $text .= ', '.$d->getData();
-            if ($marc936 = $this->getMarcRecord()->getField('936'))
+            if (
+                $marc936 = $this->getMarcRecord()->getField('936')
+                &&
+                $h = $marc936->getSubfield('h')
+            )
             {
-                if ($h = $marc936->getSubfield('h'))
+                $text .= ', S. '.$h->getData();
+            }
+            else {
+                foreach ($marc773->getSubfields('g') as $sub)
                 {
-                    $text .= ', S. '.$h->getData();
+                    $text .= ', '.$sub->getData();
                 }
             }
 
-- 
GitLab