Skip to content
Snippets Groups Projects
Commit 176fcbd8 authored by Julia Bauder's avatar Julia Bauder Committed by Demian Katz
Browse files

Replicating III's 'just cataloged' functionality

parent f08e2799
No related merge requests found
...@@ -6,4 +6,7 @@ dna_user = username ...@@ -6,4 +6,7 @@ dna_user = username
dna_password = password 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 ; 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 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
...@@ -42,6 +42,7 @@ ill_request_error_technical = "Your request failed due to a system error. Please ...@@ -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_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>." 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" Item removed from favorites = "Item removed from favourites"
just_cataloged = "Just Catalogued"
Library Catalog Password = "Library Catalogue Password" Library Catalog Password = "Library Catalogue Password"
Library Catalog Profile = "Library Catalogue Profile" Library Catalog Profile = "Library Catalogue Profile"
Library Catalog Record = "Library Catalogue Record" Library Catalog Record = "Library Catalogue Record"
......
...@@ -500,6 +500,7 @@ Journal Articles = "Journal Articles" ...@@ -500,6 +500,7 @@ Journal Articles = "Journal Articles"
Journal Title = "Journal Title" Journal Title = "Journal Title"
Journals = "Journals" Journals = "Journals"
Jump to = "Jump to" Jump to = "Jump to"
just_cataloged = "Just Cataloged"
Keyword = "Keyword" Keyword = "Keyword"
Keyword Filter = "Keyword Filter" Keyword Filter = "Keyword Filter"
Kit = "Kit" Kit = "Kit"
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
*/ */
namespace VuFind\ILS\Driver; 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 * Sierra (III) ILS Driver for Vufind2
...@@ -39,8 +40,10 @@ use VuFind\Exception\ILS as ILSException; ...@@ -39,8 +40,10 @@ use VuFind\Exception\ILS as ILSException;
* @license http://opensource.org/licenses/GPL-3.0 GNU General Public License * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License
* @link http://vufind.org/wiki/building_an_ils_driver Wiki * @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 * Database connection
* *
...@@ -114,6 +117,39 @@ class Sierra extends AbstractBase ...@@ -114,6 +117,39 @@ class Sierra extends AbstractBase
return $itemRecords; 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 * Some call number processing used for both getStatus and getHoldings
* *
...@@ -163,7 +199,6 @@ class Sierra extends AbstractBase ...@@ -163,7 +199,6 @@ class Sierra extends AbstractBase
. " dbname=" . $this->config['Catalog']['dna_db'] . " dbname=" . $this->config['Catalog']['dna_db']
. " user=" . $this->config['Catalog']['dna_user'] . " user=" . $this->config['Catalog']['dna_user']
. " password=" . $this->config['Catalog']['dna_password']; . " password=" . $this->config['Catalog']['dna_password'];
$this->db = pg_connect($conn_string); $this->db = pg_connect($conn_string);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ILSException($e->getMessage()); throw new ILSException($e->getMessage());
...@@ -360,7 +395,8 @@ class Sierra extends AbstractBase ...@@ -360,7 +395,8 @@ class Sierra extends AbstractBase
. "location_name.name, " . "location_name.name, "
. "varfield_view.field_content, " . "varfield_view.field_content, "
. "varfield_view.varfield_type_code, " . "varfield_view.varfield_type_code, "
. "checkout.due_gmt " . "checkout.due_gmt, "
. "item_view.record_creation_date_gmt "
. "FROM sierra_view.item_view " . "FROM sierra_view.item_view "
. "LEFT JOIN sierra_view.varfield_view " . "LEFT JOIN sierra_view.varfield_view "
. "ON (item_view.id = varfield_view.record_id) " . "ON (item_view.id = varfield_view.record_id) "
...@@ -394,11 +430,11 @@ class Sierra extends AbstractBase ...@@ -394,11 +430,11 @@ class Sierra extends AbstractBase
} else { } else {
$availability = false; $availability = false;
} }
$location = $this->getLocationText($resultArray[1], $resultArray[5]);
$itemInfo = [ $itemInfo = [
"id" => $id, "id" => $id,
"status" => $resultArray[0], "status" => $resultArray[0],
"location" => $resultArray[1], "location" => $location,
"reserve" => "N", "reserve" => "N",
"callnumber" => $finalcallnumber, "callnumber" => $finalcallnumber,
"availability" => $availability "availability" => $availability
...@@ -439,9 +475,10 @@ class Sierra extends AbstractBase ...@@ -439,9 +475,10 @@ class Sierra extends AbstractBase
location_name.name, location_name.name,
checkout.due_gmt, checkout.due_gmt,
varfield_view.field_content, varfield_view.field_content,
varfield_view.varfield_type_code varfield_view.varfield_type_code,
FROM item_view.record_creation_date_gmt
sierra_view.item_view FROM
sierra_view.item_view
LEFT JOIN sierra_view.location LEFT JOIN sierra_view.location
ON (item_view.location_code = location.code) ON (item_view.location_code = location.code)
LEFT JOIN sierra_view.location_name LEFT JOIN sierra_view.location_name
...@@ -478,12 +515,12 @@ class Sierra extends AbstractBase ...@@ -478,12 +515,12 @@ class Sierra extends AbstractBase
} else { } else {
$availability = false; $availability = false;
} }
$location = $this->getLocationText($resultArray[1], $resultArray[5]);
$itemInfo = [ $itemInfo = [
"id" => $id, "id" => $id,
"availability" => $availability, "availability" => $availability,
"status" => $resultArray[0], "status" => $resultArray[0],
"location" => $resultArray[1], "location" => $location,
"reserve" => "N", "reserve" => "N",
"callnumber" => $finalcallnumber, "callnumber" => $finalcallnumber,
"duedate" => $resultArray[2], "duedate" => $resultArray[2],
...@@ -673,4 +710,4 @@ class Sierra extends AbstractBase ...@@ -673,4 +710,4 @@ class Sierra extends AbstractBase
throw new ILSException($e->getMessage()); throw new ILSException($e->getMessage());
} }
} }
} }
\ No newline at end of file
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