diff --git a/config/vufind/Sierra.ini b/config/vufind/Sierra.ini index 2bb97f4d475b9fc935e8b55ebb2b7ef9e83830bb..2ba1dba57703b4cf525c5876e0fff61c36407670 100644 --- a/config/vufind/Sierra.ini +++ b/config/vufind/Sierra.ini @@ -6,4 +6,7 @@ dna_user = username dna_password = password ; Should items for the "New Items" search be identified based on cataloging date instead of record creation date (the default)? Enter Y to have new items identified based on cataloging date, and anything else (like N) to have items identified based on record creation date new_by_cat_date = Y - +; How long, in hours, should newly cataloged items have a status of "Just cataloged"? Enter 0 if you do not wish to use the "Just cataloged" status. +just_cataloged_time = 72 +; Should "Just cataloged" be appended to the location (Y), or should it replace the location (N)? +just_cataloged_append = Y \ No newline at end of file diff --git a/languages/en-gb.ini b/languages/en-gb.ini index e70518868cb35484c6c6c9484508cd8a54c0ebe6..83295ac9c8c0852e057ef8c0f4a59f46e3caa156 100644 --- a/languages/en-gb.ini +++ b/languages/en-gb.ini @@ -42,6 +42,7 @@ ill_request_error_technical = "Your request failed due to a system error. Please ill_request_place_fail_missing = "Your request failed. Some data was missing. Please contact the issue desk for further assistance" ill_request_profile_html = "For storage retrieval request information, please establish your <a href="%%url%%">Library Catalogue Profile</a>." Item removed from favorites = "Item removed from favourites" +just_cataloged = "Just Catalogued" Library Catalog Password = "Library Catalogue Password" Library Catalog Profile = "Library Catalogue Profile" Library Catalog Record = "Library Catalogue Record" diff --git a/languages/en.ini b/languages/en.ini index 165735889eebfec0f251e57caf9191761c53ed18..96558d729abc31df239a5d351d029ebe67989c55 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -500,6 +500,7 @@ Journal Articles = "Journal Articles" Journal Title = "Journal Title" Journals = "Journals" Jump to = "Jump to" +just_cataloged = "Just Cataloged" Keyword = "Keyword" Keyword Filter = "Keyword Filter" Kit = "Kit" diff --git a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php index 093c4fdab741d4109af6ee11094d9ef96099aba0..56f982f229020efffe0e7ed10c00ce36909ef369 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php @@ -28,7 +28,8 @@ */ namespace VuFind\ILS\Driver; -use VuFind\Exception\ILS as ILSException; +use VuFind\Exception\ILS as ILSException, + VuFind\I18n\Translator\TranslatorAwareInterface; /** * Sierra (III) ILS Driver for Vufind2 @@ -39,8 +40,10 @@ use VuFind\Exception\ILS as ILSException; * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License * @link http://vufind.org/wiki/building_an_ils_driver Wiki */ -class Sierra extends AbstractBase +class Sierra extends AbstractBase implements TranslatorAwareInterface { + use \VuFind\I18n\Translator\TranslatorAwareTrait; + /** * Database connection * @@ -114,6 +117,39 @@ class Sierra extends AbstractBase return $itemRecords; } + /** + * Modify location string to add status information, if necessary + * + * @param string $location Original location string + * @param string $cattime Date and time item record was created + * + * @return string + */ + protected function getLocationText($location, $cattime) + { + // No "just cataloged" setting? Default to unmodified location. + if (!isset($this->config['Catalog']['just_cataloged_time'])) { + return $location; + } + + // Convert hours to seconds: + $seconds = 60*60*$this->config['Catalog']['just_cataloged_time']; + + // Was this a recently cataloged item? If so, return a special string + // based on the append setting.... + if (time() - $seconds < strtotime($cattime)) { + if (isset($this->config['Catalog']['just_cataloged_append']) + && $this->config['Catalog']['just_cataloged_append'] == 'Y' + ) { + return $location . ' ' . $this->translate('just_cataloged'); + } + return $this->translate('just_cataloged'); + } + + // Default case: return the location unmodified: + return $location; + } + /** * Some call number processing used for both getStatus and getHoldings * @@ -163,7 +199,6 @@ class Sierra extends AbstractBase . " dbname=" . $this->config['Catalog']['dna_db'] . " user=" . $this->config['Catalog']['dna_user'] . " password=" . $this->config['Catalog']['dna_password']; - $this->db = pg_connect($conn_string); } catch (\Exception $e) { throw new ILSException($e->getMessage()); @@ -360,7 +395,8 @@ class Sierra extends AbstractBase . "location_name.name, " . "varfield_view.field_content, " . "varfield_view.varfield_type_code, " - . "checkout.due_gmt " + . "checkout.due_gmt, " + . "item_view.record_creation_date_gmt " . "FROM sierra_view.item_view " . "LEFT JOIN sierra_view.varfield_view " . "ON (item_view.id = varfield_view.record_id) " @@ -394,11 +430,11 @@ class Sierra extends AbstractBase } else { $availability = false; } - + $location = $this->getLocationText($resultArray[1], $resultArray[5]); $itemInfo = [ "id" => $id, "status" => $resultArray[0], - "location" => $resultArray[1], + "location" => $location, "reserve" => "N", "callnumber" => $finalcallnumber, "availability" => $availability @@ -439,9 +475,10 @@ class Sierra extends AbstractBase location_name.name, checkout.due_gmt, varfield_view.field_content, - varfield_view.varfield_type_code - FROM - sierra_view.item_view + varfield_view.varfield_type_code, + item_view.record_creation_date_gmt + FROM + sierra_view.item_view LEFT JOIN sierra_view.location ON (item_view.location_code = location.code) LEFT JOIN sierra_view.location_name @@ -478,12 +515,12 @@ class Sierra extends AbstractBase } else { $availability = false; } - + $location = $this->getLocationText($resultArray[1], $resultArray[5]); $itemInfo = [ "id" => $id, "availability" => $availability, "status" => $resultArray[0], - "location" => $resultArray[1], + "location" => $location, "reserve" => "N", "callnumber" => $finalcallnumber, "duedate" => $resultArray[2], @@ -673,4 +710,4 @@ class Sierra extends AbstractBase throw new ILSException($e->getMessage()); } } -} \ No newline at end of file +}