[open-ils-commits] r12097 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 6 12:53:00 EST 2009
Author: erickson
Date: 2009-02-06 12:52:57 -0500 (Fri, 06 Feb 2009)
New Revision: 12097
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
new method for un-canceling holds. request_time and expire_time are reset if appropriate org-unit-setting is enabled
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2009-02-06 16:15:14 UTC (rev 12096)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2009-02-06 17:52:57 UTC (rev 12097)
@@ -454,7 +454,47 @@
}
}
+
__PACKAGE__->register_method(
+ method => "uncancel_hold",
+ api_name => "open-ils.circ.hold.uncancel"
+);
+
+sub uncancel_hold {
+ my($self, $client, $auth, $hold_id) = @_;
+ my $e = new_editor(authtoken=>$auth, xact=>1);
+ return $e->event unless $e->checkauth;
+
+ my $hold = $e->retrieve_action_hold_request($hold_id)
+ or return $e->die_event;
+ return $e->die_event unless $e->allowed('CANCEL_HOLDS', $hold->request_lib);
+
+ return 0 if $hold->fulfillment_time;
+ return 1 unless $hold->cancel_time;
+
+ # if configured to reset the request time, also reset the expire time
+ if($U->ou_ancestor_setting_value(
+ $hold->request_lib, 'circ.hold_reset_request_time_on_uncancel', $e)) {
+
+ $hold->request_time('now');
+ my $interval = $U->ou_ancestor_setting_value($hold->request_lib, OILS_SETTING_HOLD_EXPIRE);
+ if($interval) {
+ my $date = DateTime->now->add(seconds => OpenSRF::Utils::interval_to_seconds($interval));
+ $hold->expire_time($U->epoch2ISO8601($date->epoch));
+ }
+ }
+
+ $hold->clear_cancel_time;
+ $e->update_action_hold_request($hold) or return $e->die_event;
+ $e->commit;
+
+ $U->storagereq('open-ils.storage.action.hold_request.copy_targeter', undef, $hold_id);
+
+ return 1;
+}
+
+
+__PACKAGE__->register_method(
method => "cancel_hold",
api_name => "open-ils.circ.hold.cancel",
notes => <<" NOTE");
More information about the open-ils-commits
mailing list