From f24359d1548942c25217659d4fbe61a56f4bea48 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Mon, 6 May 2013 10:06:35 -0400 Subject: [PATCH] Resolving VUFIND-806 (Only one call no. shown per holdings location). --- .../src/VuFind/RecordTab/HoldingsILS.php | 20 +++++++++++++++++++ .../templates/RecordTab/holdingsils.phtml | 8 ++++++-- .../templates/RecordTab/holdingsils.phtml | 8 ++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/module/VuFind/src/VuFind/RecordTab/HoldingsILS.php b/module/VuFind/src/VuFind/RecordTab/HoldingsILS.php index cc089fe8b6a..321ad317bd5 100644 --- a/module/VuFind/src/VuFind/RecordTab/HoldingsILS.php +++ b/module/VuFind/src/VuFind/RecordTab/HoldingsILS.php @@ -67,6 +67,26 @@ class HoldingsILS extends AbstractBase return 'Holdings'; } + /** + * Support method used by template -- extract all unique call numbers from + * an array of items. + * + * @param array $items Items to search through. + * + * @return array + */ + public function getUniqueCallNumbers($items) + { + $callNos = array(); + foreach ($items as $item) { + if (isset($item['callnumber']) && strlen($item['callnumber']) > 0) { + $callNos[] = $item['callnumber']; + } + } + sort($callNos); + return array_unique($callNos); + } + /** * Is this tab active? * diff --git a/themes/blueprint/templates/RecordTab/holdingsils.phtml b/themes/blueprint/templates/RecordTab/holdingsils.phtml index 79e862bd3f5..96f806653b4 100644 --- a/themes/blueprint/templates/RecordTab/holdingsils.phtml +++ b/themes/blueprint/templates/RecordTab/holdingsils.phtml @@ -48,10 +48,14 @@ <? foreach ($holdings as $location => $holding): ?> <h3><?=$this->transEsc($location)?></h3> <table cellpadding="2" cellspacing="0" border="0" class="citation" summary="<?=$this->transEsc('Holdings details from')?> <?=$this->transEsc($location)?>"> - <? if (isset($holding['items'][0]['callnumber'])): ?> + <? $callNos = $this->tab->getUniqueCallNumbers($holding['items']); if (!empty($callNos)): ?> <tr> <th><?=$this->transEsc("Call Number")?>: </th> - <td><?=$this->escapeHtml($holding['items'][0]['callnumber'])?></td> + <td> + <? foreach ($callNos as $callNo): ?> + <?=$this->escapeHtml($callNo)?><br /> + <? endforeach; ?> + </td> </tr> <? endif; ?> <? if (!empty($holding['summary'])): ?> diff --git a/themes/jquerymobile/templates/RecordTab/holdingsils.phtml b/themes/jquerymobile/templates/RecordTab/holdingsils.phtml index 66f3848768a..f1b6549a583 100644 --- a/themes/jquerymobile/templates/RecordTab/holdingsils.phtml +++ b/themes/jquerymobile/templates/RecordTab/holdingsils.phtml @@ -36,10 +36,14 @@ <? foreach ($holdings as $location => $holding): ?> <h4><?=$this->transEsc($location)?></h4> <table class="holdings" summary="<?=$this->transEsc('Holdings details from')?> <?=$this->transEsc($location)?>"> - <? if (isset($holding['items'][0]['callnumber'])): ?> + <? $callNos = $this->tab->getUniqueCallNumbers($holding['items']); if (!empty($callNos)): ?> <tr> <th><?=$this->transEsc("Call Number")?>: </th> - <td><?=$this->escapeHtml($holding['items'][0]['callnumber'])?></td> + <td> + <? foreach ($callNos as $callNo): ?> + <?=$this->escapeHtml($callNo)?><br /> + <? endforeach; ?> + </td> </tr> <? endif; ?> <? if (!empty($holding['summary'])): ?> -- GitLab