From 597db6c78fbe570b2254e093467746e9ce114013 Mon Sep 17 00:00:00 2001 From: KeckR <35768517+KeckR@users.noreply.github.com> Date: Mon, 14 May 2018 21:54:49 +0200 Subject: [PATCH] Add enumchron support to ILS driver getHolding method (#1115) - Resolves VUFIND-1269 --- module/VuFind/src/VuFind/ILS/Driver/Demo.php | 5 +++++ module/VuFind/src/VuFind/ILS/Driver/Koha.php | 6 ++++-- module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php | 2 ++ module/VuFind/src/VuFind/ILS/Driver/Voyager.php | 8 +++----- .../templates/RecordTab/holdingsils/extended.phtml | 5 +++++ .../templates/RecordTab/holdingsils/standard.phtml | 6 +++++- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/Demo.php b/module/VuFind/src/VuFind/ILS/Driver/Demo.php index ded059e02b7..855f43c36b4 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Demo.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Demo.php @@ -625,6 +625,7 @@ class Demo extends AbstractBase // Get basic status info: $status = $this->getSimulatedStatus($id, $patron); + $issue = 1; // Add notes and summary: foreach (array_keys($status) as $i) { $itemNum = $i + 1; @@ -640,6 +641,10 @@ class Demo extends AbstractBase for ($j = 1; $j <= $summCount; $j++) { $status[$i]['summary'][] = "Item $itemNum summary $j"; } + $volume = intdiv($issue, 4) + 1; + $seriesIssue = $issue % 4; + $issue = $issue + 1; + $status[$i]['enumchron'] = "volume $volume, issue $seriesIssue"; } // Send back final value: diff --git a/module/VuFind/src/VuFind/ILS/Driver/Koha.php b/module/VuFind/src/VuFind/ILS/Driver/Koha.php index 2401a2a07cb..2517480f84c 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Koha.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Koha.php @@ -176,7 +176,8 @@ class Koha extends AbstractBase $sql = "select itemnumber as ITEMNO, location as LOCATION, " . "holdingbranch as HLDBRNCH, reserves as RESERVES, itemcallnumber as " . "CALLNO, barcode as BARCODE, copynumber as COPYNO, " . - "notforloan as NOTFORLOAN from items where biblionumber = :id" . + "enumchron AS ENUMCHRON, notforloan as NOTFORLOAN" . + " from items where biblionumber = :id" . " order by itemnumber"; try { $itemSqlStmt = $this->db->prepare($sql); @@ -246,7 +247,8 @@ class Koha extends AbstractBase 'barcode' => (null == $rowItem['BARCODE']) ? 'Unknown' : $rowItem['BARCODE'], 'number' => (null == $rowItem['COPYNO']) - ? 'Unknown' : $rowItem['COPYNO'] + ? 'Unknown' : $rowItem['COPYNO'], + 'enumchron' => $rowItem['ENUMCHRON'] ?? null, ]; } return $holding; diff --git a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php index 2552784b208..766fdc70817 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php @@ -807,6 +807,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements i.holdingbranch as HLDBRNCH, i.homebranch as HOMEBRANCH, i.reserves as RESERVES, i.itemcallnumber as CALLNO, i.barcode as BARCODE, i.copynumber as COPYNO, i.notforloan as NOTFORLOAN, + i.enumchron AS ENUMCHRON, i.itemnotes as PUBLICNOTES, b.frameworkcode as DOCTYPE, t.frombranch as TRANSFERFROM, t.tobranch as TRANSFERTO, i.itemlost as ITEMLOST, i.itemlost_on AS LOSTON @@ -980,6 +981,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements ? 'Unknown' : $rowItem['BARCODE'], 'number' => (null == $rowItem['COPYNO']) ? '' : $rowItem['COPYNO'], + 'enumchron' => $rowItem['ENUMCHRON'] ?? null, 'requests_placed' => $reservesCount ? $reservesCount : 0, 'frameworkcode' => $rowItem['DOCTYPE'], ]; diff --git a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php index 34a48256a1e..8c86e40f4ef 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php @@ -764,12 +764,8 @@ EOT; $data = []; foreach ($sqlRows as $row) { - // Determine Copy Number (always use sequence number; append volume - // when available) + // Determine Copy Number $number = $row['ITEM_SEQUENCE_NUMBER']; - if (isset($row['ITEM_ENUM'])) { - $number .= ' (' . utf8_encode($row['ITEM_ENUM']) . ')'; - } // Concat wrapped rows (MARC data more than 300 bytes gets split // into multiple rows) @@ -1085,6 +1081,8 @@ EOT; } $holding[$i] += [ 'availability' => $availability['available'], + 'enumchron' => isset($row['ITEM_ENUM']) + ? utf8_encode($row['ITEM_ENUM']) : null, 'duedate' => $dueDate, 'number' => $number, 'requests_placed' => $requests_placed, diff --git a/themes/bootstrap3/templates/RecordTab/holdingsils/extended.phtml b/themes/bootstrap3/templates/RecordTab/holdingsils/extended.phtml index 3e959325702..7b77448011a 100644 --- a/themes/bootstrap3/templates/RecordTab/holdingsils/extended.phtml +++ b/themes/bootstrap3/templates/RecordTab/holdingsils/extended.phtml @@ -10,6 +10,11 @@ <span class="holding-field copy-number"> <?=$this->transEsc("Copy")?> <?=$this->escapeHtml($holding['number'])?> </span> + <span class="holding-field enumchron"> + <?php if ($holding['enumchron'] ?? false): ?> + (<?=$this->escapeHtml($holding['enumchron'])?>) + <?php endif; ?> + </span> <span class="holding-field barcode"> <?=$this->escapeHtml($holding['barcode'])?> </span> diff --git a/themes/bootstrap3/templates/RecordTab/holdingsils/standard.phtml b/themes/bootstrap3/templates/RecordTab/holdingsils/standard.phtml index 61a010d2808..9cfa21c2bab 100644 --- a/themes/bootstrap3/templates/RecordTab/holdingsils/standard.phtml +++ b/themes/bootstrap3/templates/RecordTab/holdingsils/standard.phtml @@ -5,7 +5,11 @@ $checkILLRequest = $holding['checkILLRequest'] ?? false; ?> <tr vocab="http://schema.org/" typeof="Offer"> - <th><?=$this->transEsc("Copy")?> <?=$this->escapeHtml($holding['number'])?></th> + <th class="copy-number"><?=$this->transEsc("Copy")?> <?=$this->escapeHtml($holding['number'])?> + <?php if ($holding['enumchron'] ?? false): ?> + <span class="enumchron">(<?=$this->escapeHtml($holding['enumchron'])?>)</span> + <?php endif; ?> + </th> <td> <?php if ($holding['reserve'] == "Y"): ?> <link property="availability" href="http://schema.org/InStoreOnly" /> -- GitLab