From: miker Date: Wed, 3 Mar 2010 19:36:11 +0000 (+0000) Subject: keep the original due_date time component of day-granular circs on due_date edit X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ca79398d899eef935e06eb183d702dacb0cd1980;p=evergreen%2Ftadl.git keep the original due_date time component of day-granular circs on due_date edit git-svn-id: svn://svn.open-ils.org/ILS/trunk@15680 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index 7d719846ea..a06404db7f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -490,6 +490,13 @@ sub set_circ_due_date { return $e->die_event unless $e->allowed('CIRC_OVERRIDE_DUE_DATE', $circ->circ_lib); $date = cleanse_ISO8601($date); + + if (!(interval_to_seconds($circ->duration) % 86400)) { # duration is divisible by days + my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($circ->due_date)); + my $new_date = DateTime::Format::ISO8601->new->parse_datetime($date); + $date = $new_date->ymd . 'T' . $original_date->strftime('%T%z'); + } + $circ->due_date($date); $e->update_action_circulation($circ) or return $e->die_event; $e->commit;