From 5dff7c3d0fd4f942f0fe83f0dade73d6f6ec9dc8 Mon Sep 17 00:00:00 2001
From: Gregor Gawol <gawol@ub.uni-leipzig.de>
Date: Wed, 21 Sep 2016 09:46:10 +0200
Subject: [PATCH] refs #8639: * used publishDateSort * used in result list and
 detail view

---
 .../SolrDefault/result-list.phtml             |  6 +--
 .../RecordDriver/SolrMarc/core.phtml          | 37 +++++++++++--------
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml
index bd00873d58d..c08e97059b1 100644
--- a/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml
+++ b/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml
@@ -33,7 +33,7 @@
           <? endforeach; ?>
         <? endif; ?>
 
-        <? $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublicationDates(); ?>
+        <? $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublishDateSort(); ?>
         <? if (!empty($journalTitle)): ?>
           <?=!empty($summAuthor) ? '<br />' : ''?>
           <?=$this->transEsc('Published in')?>
@@ -41,10 +41,10 @@
           <? $containerID = $this->driver->getContainerRecordID(); ?>
           <? /* TODO: handle highlighting more elegantly here: */?>
           <a href="<?=($containerID ? $this->recordLink()->getUrl("$containerSource|$containerID") : $this->record($this->driver)->getLink('journaltitle', str_replace(array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'), '', $journalTitle)))?>"><?=$this->highlight($journalTitle) ?></a>
-          <?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?>
+          <?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate) . ')' : ''?>
         <? elseif (!empty($summDate)): ?>
           <?=!empty($summAuthor) ? '<br />' : ''?>
-          <?=$this->transEsc('Published') . ' ' . $this->escapeHtml($summDate[0])?>
+          <?=$this->transEsc('Published') . ' ' . $this->escapeHtml($summDate)?>
         <? endif; ?>
         <? $summInCollection = $this->driver->getContainingCollections(); if (!empty($summInCollection)): ?>
           <? foreach ($summInCollection as $collId => $collText): ?>
diff --git a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
index 687c5131607..9606eecdfdf 100644
--- a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
@@ -143,26 +143,31 @@ if($loggedin = $this->auth()->isLoggedIn()) {
         </tr>
       <? endif; ?>
 
-      <? $publications = $this->driver->getPublicationDetails(); if (!empty($publications)): ?>
-      <tr>
-        <th><?=$this->transEsc('Published')?>: </th>
-        <td>
-          <? foreach ($publications as $field): ?>
-            <span property="publisher" typeof="Organization">
+      <?
+      $publications = $this->driver->getPublicationDetails();
+      $pubDateSort = $this->driver->getPublishDateSort();
+      if (!empty($publications)): ?>
+        <tr>
+          <th><?=$this->transEsc('Published')?>: </th>
+          <td>
+            <? foreach ($publications as $field): ?>
+              <span property="publisher" typeof="Organization">
             <? $pubPlace = $field->getPlace(); if (!empty($pubPlace)): ?>
               <span property="location"><?=$this->escapeHtml($pubPlace)?></span>
             <? endif; ?>
-            <? $pubName = $field->getName(); if (!empty($pubName)): ?>
-              <span property="name"><?=$this->escapeHtml($pubName)?></span>
-            <? endif; ?>
+                <? $pubName = $field->getName(); if (!empty($pubName)): ?>
+                  <span property="name"><?=$this->escapeHtml($pubName)?></span>
+                <? endif; ?>
             </span>
-            <? $pubDate = $field->getDate(); if (!empty($pubDate)): ?>
-              <span property="publicationDate"><?=$this->escapeHtml($pubDate)?></span>
-            <? endif; ?>
-            <br/>
-          <? endforeach; ?>
-        </td>
-      </tr>
+              <? $pubDate = $field->getDate(); if (!empty($pubDateSort)): ?>
+                <span property="publicationDate"><?=$this->escapeHtml($pubDateSort)?></span>
+              <? elseif (!empty($pubDate)): ?>
+                <span property="publicationDate"><?=$this->escapeHtml($pubDate)?></span>
+              <? endif; ?>
+              <br/>
+            <? endforeach; ?>
+          </td>
+        </tr>
       <? endif; ?>
 
       <? $edition = $this->driver->getEdition(); if (!empty($edition)): ?>
-- 
GitLab