Skip to content
Snippets Groups Projects
Commit f24359d1 authored by Demian Katz's avatar Demian Katz
Browse files

Resolving VUFIND-806 (Only one call no. shown per holdings location).

parent ae218a7b
No related merge requests found
......@@ -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?
*
......
......@@ -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'])): ?>
......
......@@ -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'])): ?>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment