From e85ca5a738e4debc4be1cba235668e17508d1e87 Mon Sep 17 00:00:00 2001 From: Julia Bauder <julia.bauder@gmail.com> Date: Mon, 13 Jan 2014 15:13:48 -0600 Subject: [PATCH] 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. --- .../VuFind/src/VuFind/ILS/Driver/Sierra.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php index 6eba97bd130..1eb75a5b623 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php @@ -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"; } -- GitLab