From: miker Date: Sat, 7 Nov 2009 14:25:53 +0000 (+0000) Subject: add virtual duedate field to non-cat circs, and offset the calculated duedate just... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f06e1ed2259d2dd9531368f23999ddbc0d084ade;p=evergreen%2Fpines.git add virtual duedate field to non-cat circs, and offset the calculated duedate just like real circs git-svn-id: svn://svn.open-ils.org/ILS/trunk@14820 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 3862138f0c..35a1ed8a8d 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3476,6 +3476,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm index 4c1226b129..36b73dbf2a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm @@ -3,6 +3,9 @@ use base 'OpenILS::Application'; use strict; use warnings; use OpenSRF::EX qw(:try); use Data::Dumper; +use DateTime; +use DateTime::Format::ISO8601; +use OpenSRF::Utils qw/:datetime/; use OpenSRF::Utils::Logger qw(:logger); use OpenILS::Application::AppUtils; use OpenILS::Utils::Fieldmapper; @@ -11,6 +14,7 @@ use OpenILS::Utils::CStoreEditor qw/:funcs/; $Data::Dumper::Indent = 0; my $U = "OpenILS::Application::AppUtils"; +my $_dt_parser = DateTime::Format::ISO8601->new; # returns ( $newid, $evt ). If $evt, then there was an error @@ -145,6 +149,7 @@ __PACKAGE__->register_method( / ); + sub fetch_noncat { my( $self, $conn, $auth, $circid ) = @_; my $e = OpenILS::Utils::Editor->new( authtoken => $auth ); @@ -154,6 +159,24 @@ sub fetch_noncat { if( $c->patron ne $e->requestor->id ) { return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm } + + my $otype = $e->retrieve_config_non_cataloged_type($c->item_type) + or return $e->die_event; + + my $duedate = $_dt_parser->parse_datetime( clense_ISO8601($c->circ_time) ); + $duedate = $duedate + ->add( seconds => interval_to_seconds($otype->circ_duration) ) + ->strftime('%FT%T%z'); + + my $offset = $e->request( + 'open-ils.storage.actor.org_unit.closed_date.overlap', + $c->circ_lib, + $duedate + ); + + $duedate = $offset->{end} if ($offset); + $c->duedate($duedate); + return $c; }