[open-ils-commits] r14209 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Sep 29 14:56:43 EDT 2009
Author: erickson
Date: 2009-09-29 14:56:38 -0400 (Tue, 29 Sep 2009)
New Revision: 14209
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
added API call for back-dating a circulation after it's already been checked in
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2009-09-29 16:44:54 UTC (rev 14208)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2009-09-29 18:56:38 UTC (rev 14209)
@@ -361,9 +361,55 @@
}
+__PACKAGE__->register_method(
+ method => "post_checkin_backdate_circ",
+ api_name => "open-ils.circ.post_checkin_backdate",
+ signature => {
+ desc => q/Back-date an already checked in circulation/,
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'Circ ID', type => 'number'},
+ {desc => 'ISO8601 backdate', type => 'string'},
+ ],
+ return => {desc => q/1 on success, failure event on error/}
+ }
+);
+sub post_checkin_backdate_circ {
+ my( $self, $conn, $auth, $circ_id, $backdate ) = @_;
+ my $e = new_editor(authtoken=>$auth, xact=>1);
+ return $e->die_event unless $e->checkauth;
+ my $circ = $e->retrieve_action_circulation($circ_id)
+ or return $e->die_event;
+
+ # anyone with checkin perms can backdate (more restrictive?)
+ return $e->die_event unless $e->allowed('COPY_CHECKIN', $circ->circ_lib);
+
+ # don't allow back-dating an open circulation
+ return OpenILS::Event->new('BAD_PARAMS') unless
+ $backdate and $circ->checkin_time;
+
+ # update the checkin and stop_fines times to reflect the new backdate
+ $circ->stop_fines_time(clense_ISO8601($backdate));
+ $circ->checkin_time(clense_ISO8601($backdate));
+ $e->update_action_circulation($circ) or return $e->die_event;
+
+ # now void the overdues "erased" by the back-dating
+ my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($e, $circ, $backdate);
+ return $evt if $evt;
+
+ # If the circ was closed before and the balance owned !=0, re-open the transaction
+ $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($e, $circ->id);
+ return $evt if $evt;
+
+ $e->commit;
+ return 1;
+}
+
+
+
__PACKAGE__->register_method (
method => 'set_circ_due_date',
api_name => 'open-ils.circ.circulation.due_date.update',
More information about the open-ils-commits
mailing list