From 4a1c335a4d229e66244dc0ce8a564dbe80be1049 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 23 Feb 2015 21:03:41 +0000 Subject: [PATCH] LP#1423813: adjust some queries to account for deleted copy locations This patch adjusts some queries so that if a copy location is deleted, any undeleted items that are attached to it are considered deleted for the purpose of generating OPAC item lists and seeing if items are potentially available to fill hold request. It should be noted that if a copy location is marked as logically deleted, there shouldn't be any undeleted copies associated with it. However, as this condition is not presently enforced by a database contraint, adding additional checks on acpl.deleted provides some additional defense. Signed-off-by: Galen Charlton Signed-off-by: Ben Shum --- .../perlmods/lib/OpenILS/Application/AppUtils.pm | 5 ++++- .../perlmods/lib/OpenILS/Application/Circ/Holds.pm | 24 ++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm index 09c30ee570..b560bc9966 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -2021,7 +2021,10 @@ sub basic_opac_copy_query { filter => {checkin_time => undef} }, acpl => { - ($staff ? () : (filter => { opac_visible => 't' })) + filter => { + deleted => 'f', + ($staff ? () : ( opac_visible => 't' )), + }, }, ccs => { ($staff ? () : (filter => { opac_visible => 't' })) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index a5f9e7eb99..5061f245ff 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -2577,7 +2577,11 @@ sub _check_title_hold_is_possible { fkey => 'call_number', filter => { record => $titleid } }, - acpl => { field => 'id', filter => { holdable => 't'}, fkey => 'location' }, + acpl => { + field => 'id', + filter => { holdable => 't', deleted => 'f' }, + fkey => 'location' + }, ccs => { field => 'id', filter => { holdable => 't'}, fkey => 'status' }, acpm => { field => 'target_copy', type => 'left' } # ignore part-linked copies } @@ -2698,7 +2702,11 @@ sub _check_issuance_hold_is_possible { fkey => 'id', filter => { issuance => $issuanceid } }, - acpl => { field => 'id', filter => { holdable => 't'}, fkey => 'location' }, + acpl => { + field => 'id', + filter => { holdable => 't', deleted => 'f' }, + fkey => 'location' + }, ccs => { field => 'id', filter => { holdable => 't'}, fkey => 'status' } } }, @@ -2835,7 +2843,11 @@ sub _check_monopart_hold_is_possible { fkey => 'id', filter => { part => $partid } }, - acpl => { field => 'id', filter => { holdable => 't'}, fkey => 'location' }, + acpl => { + field => 'id', + filter => { holdable => 't', deleted => 'f' }, + fkey => 'location' + }, ccs => { field => 'id', filter => { holdable => 't'}, fkey => 'status' } } }, @@ -3806,7 +3818,11 @@ sub hold_has_copy_at { select => {acp => ['id'], acpl => ['name']}, from => { acp => { - acpl => {field => 'id', filter => { holdable => 't'}, fkey => 'location'}, + acpl => { + field => 'id', + filter => { holdable => 't', deleted => 'f' }, + fkey => 'location' + }, ccs => {field => 'id', filter => { holdable => 't'}, fkey => 'status' } } }, -- 2.11.0