From c9bdee2be8963472f3a733ed6b88bfc0b05e2fa1 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 3 Dec 2009 14:49:42 +0000 Subject: [PATCH] calculate/flesh non-cat circ due date during circ creation git-svn-id: svn://svn.open-ils.org/ILS/trunk@15064 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/NonCat.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm index 36b73dbf2a..01fef22bb6 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm @@ -38,6 +38,7 @@ sub create_non_cat_circ { $evt = $editor->event unless $circ = $editor->create_action_non_cataloged_circulation( $circ ) + } else { $id = $U->simplereq( 'open-ils.storage', @@ -46,6 +47,11 @@ sub create_non_cat_circ { $circ->id($id); } + if($circ) { + my $e = ($editor) ? $editor : new_editor(); + $circ = noncat_due_date($e, $circ); + } + return( $circ, $evt ); } @@ -159,25 +165,30 @@ sub fetch_noncat { if( $c->patron ne $e->requestor->id ) { return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm } + return noncat_due_date($e, $c); +} + +sub noncat_due_date { + my($e, $circ) = @_; - my $otype = $e->retrieve_config_non_cataloged_type($c->item_type) + my $otype = $e->retrieve_config_non_cataloged_type($circ->item_type) or return $e->die_event; - my $duedate = $_dt_parser->parse_datetime( clense_ISO8601($c->circ_time) ); + 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 = $e->request( 'open-ils.storage.actor.org_unit.closed_date.overlap', - $c->circ_lib, + $circ->circ_lib, $duedate ); $duedate = $offset->{end} if ($offset); - $c->duedate($duedate); + $circ->duedate($duedate); - return $c; + return $circ; } -- 2.11.0