[open-ils-commits] r15300 - in branches/rel_1_6/Open-ILS: examples src/perlmods/OpenILS/Application/Circ xul/staff_client/server/circ xul/staff_client/server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 11 18:22:59 EST 2010
Author: phasefx
Date: 2010-01-11 18:22:52 -0500 (Mon, 11 Jan 2010)
New Revision: 15300
Modified:
branches/rel_1_6/Open-ILS/examples/fm_IDL.xml
branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
branches/rel_1_6/Open-ILS/xul/staff_client/server/circ/checkout.js
branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/items.js
Log:
Backport changesets 14820, 15063, 15064, 15066: duedate virtual field for non-cat circs that honors closed dates, etc.
Modified: branches/rel_1_6/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/rel_1_6/Open-ILS/examples/fm_IDL.xml 2010-01-11 19:17:05 UTC (rev 15299)
+++ branches/rel_1_6/Open-ILS/examples/fm_IDL.xml 2010-01-11 23:22:52 UTC (rev 15300)
@@ -3317,6 +3317,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: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm 2010-01-11 19:17:05 UTC (rev 15299)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm 2010-01-11 23:22:52 UTC (rev 15300)
@@ -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
@@ -34,6 +38,7 @@
$evt = $editor->event unless
$circ = $editor->create_action_non_cataloged_circulation( $circ )
+
} else {
$id = $U->simplereq(
'open-ils.storage',
@@ -42,6 +47,11 @@
$circ->id($id);
}
+ if($circ) {
+ my $e = ($editor) ? $editor : new_editor();
+ $circ = noncat_due_date($e, $circ);
+ }
+
return( $circ, $evt );
}
@@ -145,20 +155,44 @@
/
);
+
sub fetch_noncat {
my( $self, $conn, $auth, $circid ) = @_;
- my $e = OpenILS::Utils::Editor->new( authtoken => $auth );
+ my $e = new_editor( authtoken => $auth );
return $e->event unless $e->checkauth;
my $c = $e->retrieve_action_non_cataloged_circulation($circid)
or return $e->event;
if( $c->patron ne $e->requestor->id ) {
return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm
}
- return $c;
+ return noncat_due_date($e, $c);
}
+sub noncat_due_date {
+ my($e, $circ) = @_;
+ my $otype = $e->retrieve_config_non_cataloged_type($circ->item_type)
+ or return $e->die_event;
+ my $duedate = $_dt_parser->parse_datetime( clense_ISO8601($circ->circ_time) );
+ $duedate = $duedate
+ ->add( seconds => interval_to_seconds($otype->circ_duration) )
+ ->strftime('%FT%T%z');
+
+ my $offset = $U->storagereq(
+ 'open-ils.storage.actor.org_unit.closed_date.overlap',
+ $circ->circ_lib,
+ $duedate
+ );
+
+ $duedate = $offset->{end} if ($offset);
+ $circ->duedate($duedate);
+
+ return $circ;
+}
+
+
+
__PACKAGE__->register_method(
method => 'fetch_open_noncats',
authoritative => 1,
Modified: branches/rel_1_6/Open-ILS/xul/staff_client/server/circ/checkout.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/server/circ/checkout.js 2010-01-11 19:17:05 UTC (rev 15299)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/server/circ/checkout.js 2010-01-11 23:22:52 UTC (rev 15300)
@@ -378,16 +378,7 @@
checkout.payload.circ.circ_lib( checkout.payload.noncat_circ.circ_lib() );
checkout.payload.circ.circ_staff( checkout.payload.noncat_circ.staff() );
checkout.payload.circ.usr( checkout.payload.noncat_circ.patron() );
-
- JSAN.use('util.date');
- var c = checkout.payload.noncat_circ.circ_time();
- var d = c == "now" ? new Date() : util.date.db_date2Date( c );
- var t =obj.data.hash.cnct[ checkout.payload.noncat_circ.item_type() ];
- var cd = t.circ_duration() || "14 days";
- var i = util.date.interval_to_seconds( cd ) * 1000;
- d.setTime( Date.parse(d) + i );
- checkout.payload.circ.due_date( util.date.formatted_date(d,'%F') );
-
+ checkout.payload.circ.due_date( checkout.payload.noncat_circ.duedate() );
}
}
Modified: branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/items.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/items.js 2010-01-11 19:17:05 UTC (rev 15299)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/items.js 2010-01-11 23:22:52 UTC (rev 15300)
@@ -156,12 +156,9 @@
fake_circ.xact_start( nc_circ.circ_time() );
fake_circ.renewal_remaining(0);
fake_circ.stop_fines('Non-Cataloged');
+ fake_circ.due_date( nc_circ.duedate() );
- JSAN.use('util.date');
- var c = nc_circ.circ_time();
- var d = c == "now" ? new Date() : util.date.db_date2Date( c );
- var t = obj.data.hash.cnct[ nc_circ.item_type() ];
- if (!t) {
+ if (!obj.data.hash.cnct[ nc_circ.item_type() ]) {
var robj2 = obj.network.simple_request('FM_CNCT_RETRIEVE',[ nc_circ.circ_lib() ]);
if (typeof robj2.ilsevent != 'undefined') throw(robj);
obj.data.stash_retrieve();
@@ -172,12 +169,7 @@
}
}
obj.data.stash('hash','list');
- t = obj.data.hash.cnct[ nc_circ.item_type() ];
}
- var cd = t.circ_duration() || $("patronStrings").getString('staff.patron.items.show_noncats.14_days');
- var i = util.date.interval_to_seconds( cd ) * 1000;
- d.setTime( Date.parse(d) + i );
- fake_circ.due_date( util.date.formatted_date(d,'%F') );
var fake_record = new mvr();
fake_record.title( obj.data.hash.cnct[ nc_circ.item_type() ].name());
More information about the open-ils-commits
mailing list