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

One bug fix and one enhancement

Fixed a bug related to new items: daysOld was always defaulting to 30
days because mathematical comparisons with it were always failing;
needed to cast daysOld as an integer before doing mathematical
comparisons with it. Enhancement: changed item status queries to pull
the human-readable location rather than the cryptic location code from
the database.
parent c7ea1727
No related merge requests found
......@@ -359,17 +359,22 @@ class Sierra extends AbstractBase
// Use the database ids to get the item-level information (status,
// location, and potentially call number) associated with that bib record
$query1 = "SELECT item_view.item_status_code, "
. "item_view.location_code, "
. "location_name.name, "
. "varfield_view.field_content, "
. "varfield_view.varfield_type_code, "
. "checkout.due_gmt "
. "FROM sierra_view.item_view "
. "LEFT JOIN sierra_view.varfield_view "
. "ON (item_view.id = varfield_view.record_id) "
. "LEFT JOIN sierra_view.location "
. "ON (item_view.location_code = location.code) "
. "LEFT JOIN sierra_view.location_name "
. "ON (location.id = location_name.location_id) "
. "LEFT JOIN sierra_view.checkout "
. "ON (item_view.id = checkout.item_record_id) "
. "WHERE item_view.id = $1"
. "AND varfield_view.record_type_code = 'i';";
. "WHERE item_view.id = $1 "
. "AND varfield_view.record_type_code = 'i' "
. "AND location_name.iii_language_id = '1';";
pg_prepare($this->db, "prep_query", $query1);
foreach ($itemIds as $item) {
$callnumber = null;
......@@ -431,20 +436,25 @@ class Sierra extends AbstractBase
$itemIds = $this->getIds($id);
// Use the database ids to get the item-level information (status,
// location, and potentially call number) associated with that bib record
$query1 = "SELECT
$query1 = "SELECT
item_view.item_status_code,
item_view.location_code,
location_name.name,
checkout.due_gmt,
varfield_view.field_content,
varfield_view.varfield_type_code
FROM
sierra_view.item_view
sierra_view.item_view
LEFT JOIN sierra_view.location
ON (item_view.location_code = location.code)
LEFT JOIN sierra_view.location_name
ON (location.id = location_name.location_id)
LEFT JOIN sierra_view.checkout
ON (item_view.id = checkout.item_record_id)
LEFT JOIN sierra_view.varfield_view
ON (item_view.id = varfield_view.record_id)
WHERE item_view.id = $1
AND varfield_view.record_type_code = 'i';";
AND varfield_view.record_type_code = 'i'
AND location_name.iii_language_id = '1';";
pg_prepare($this->db, "prep_query", $query1);
foreach ($itemIds as $item) {
$callnumber = null;
......@@ -515,6 +525,7 @@ class Sierra extends AbstractBase
try {
$newItems = array();
$offset = $limit * ($page - 1);
$daysOld = (int) $daysOld;
if (is_int($daysOld) == false || $daysOld > 30) {
$daysOld = "30";
}
......
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