[open-ils-commits] r14574 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Oct 23 09:33:05 EDT 2009
Author: erickson
Date: 2009-10-23 09:33:03 -0400 (Fri, 23 Oct 2009)
New Revision: 14574
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
updated logic that handles how many canceled holds to return in patron holds list call
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2009-10-23 13:31:52 UTC (rev 14573)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2009-10-23 13:33:03 UTC (rev 14574)
@@ -342,19 +342,42 @@
{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);
}
if( ! $self->api_name =~ /id_list/ ) {
More information about the open-ils-commits
mailing list