From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Fri, 23 Oct 2009 13:33:03 +0000 (+0000) Subject: updated logic that handles how many canceled holds to return in patron holds list... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2c26f3f653488922543f17cc144a62659f80985b;p=evergreen%2Fmasslnc.git updated logic that handles how many canceled holds to return in patron holds list call git-svn-id: svn://svn.open-ils.org/ILS/trunk@14574 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 2f149ef9f1..44ae52f2a5 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -342,17 +342,40 @@ sub retrieve_holds { {order_by => {ahr => "request_time"}} ]); - if($$options{canceled}) { - my $count = $$options{cancel_count} || - $U->ou_ancestor_setting_value($e->requestor->ws_ou, - 'circ.canceled_hold_display_count', $e) || 5; + my $cancel_age; + my $cancel_count = + $U->ou_ancestor_setting_value( + $e->requestor->ws_ou, 'circ.holds.canceled.display_count', $e); + + unless($cancel_count) { + $cancel_age = $U->ou_ancestor_setting_value( + $e->requestor->ws_ou, 'circ.holds.canceled.display_age', $e); + } + + if($cancel_count) { + # find at most cancel_count canceled holds my $canceled = $e->search_action_hold_request([ { usr => $user_id , fulfillment_time => undef, cancel_time => {'!=' => undef}, }, - {order_by => {ahr => "cancel_time desc"}, limit => $count} + {order_by => {ahr => "cancel_time desc"}, limit => $cancel_count} + ]); + push(@$holds, @$canceled); + + } elsif($cancel_age) { + + # find all of the canceled holds that were canceled within the configured time frame + my $date = DateTime->now->add(seconds => OpenSRF::Utils::interval_to_seconds($cancel_age)); + $date = $U->epoch2ISO8601($date->epoch); + + my $canceled = $e->search_action_hold_request([ + { usr => $user_id , + fulfillment_time => undef, + cancel_time => {'>=' => $date}, + }, + {order_by => {ahr => "cancel_time desc"}} ]); push(@$holds, @$canceled); }