[open-ils-commits] r14820 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application/Circ (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Nov 7 09:25:54 EST 2009
Author: miker
Date: 2009-11-07 09:25:53 -0500 (Sat, 07 Nov 2009)
New Revision: 14820
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
Log:
add virtual duedate field to non-cat circs, and offset the calculated duedate just like real circs
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2009-11-06 23:28:34 UTC (rev 14819)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2009-11-07 14:25:53 UTC (rev 14820)
@@ -3476,6 +3476,7 @@
<field reporter:label="Non-cat Item Type" name="item_type" reporter:datatype="link"/>
<field reporter:label="Patron" name="patron" reporter:datatype="link"/>
<field reporter:label="Circulating Staff" name="staff" reporter:datatype="link"/>
+ <field reporter:label="Virtual Due Date/Time" name="duedate" reporter:datatype="timestamp" oils_persist:virtual="true"/>
</fields>
<links>
<link field="item_type" reltype="has_a" key="id" map="" class="cnct"/>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm 2009-11-06 23:28:34 UTC (rev 14819)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm 2009-11-07 14:25:53 UTC (rev 14820)
@@ -3,6 +3,9 @@
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 @@
$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 @@
/
);
+
sub fetch_noncat {
my( $self, $conn, $auth, $circid ) = @_;
my $e = OpenILS::Utils::Editor->new( authtoken => $auth );
@@ -154,6 +159,24 @@
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;
}
More information about the open-ils-commits
mailing list