From: miker Date: Tue, 21 Aug 2007 00:24:16 +0000 (+0000) Subject: add optional hold age requirement to nearest_hold method X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=29a222bff7c0f60164d817d87150749949b3e141;p=Evergreen.git add optional hold age requirement to nearest_hold method git-svn-id: svn://svn.open-ils.org/ILS/trunk@7707 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index fb2afebd10..2de972d9e1 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -183,14 +183,20 @@ sub nearest_hold { my $pl = shift; my $cp = shift; my $limit = int(shift()) || 10; + my $age = shift() || '0 seconds'; - my $ids = action::hold_request->db_Main->selectcol_arrayref(<<" SQL", {}, $cp, $pl); + my $age_where = ''; + if ($age) { + $age_where = " + + my $ids = action::hold_request->db_Main->selectcol_arrayref(<<" SQL", {}, $cp, $pl, $age); SELECT h.id FROM action.hold_request h JOIN action.hold_copy_map hm ON (hm.hold = h.id) JOIN actor.org_unit_proximity p ON (p.from_org = h.pickup_lib) WHERE hm.target_copy = ? AND p.to_org = ? + AND AGE(h.request_time) > ? AND h.capture_time IS NULL AND h.cancel_time IS NULL ORDER BY