From d385b34802a21dfff96eba1f93ae9f75ba96fd83 Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 9 Jul 2009 20:41:44 +0000 Subject: [PATCH] Expand the conditions where we set the due_time to 23:59:59. Starting to wonder whether I should just change the edit due date function to set 23:59 instead... git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/trunk@575 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- tools/end_of_the_day.pl | 76 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/tools/end_of_the_day.pl b/tools/end_of_the_day.pl index d3d84ca5d6..fafe56da9a 100644 --- a/tools/end_of_the_day.pl +++ b/tools/end_of_the_day.pl @@ -7,6 +7,13 @@ # with an overdue charge at 48 hours + 5 minutes rather than at the end of the # day that 48 hours falls on. +# We also found that editing the due date for a given item sets the corresponding +# due time to 00:00 - which isn't great, as that means that it is due the minute +# the day starts. So, for now, we'll set all daily / weekly loans or those loans +# that are due exactly at midnight to being due at 23:59:59 - the very last second +# of the day on which it is due. This probably meets our patrons' expectations a bit +# better. + use DBI; use Getopt::Long; use OpenSRF::EX qw/:try/; @@ -43,34 +50,55 @@ $dbh->disconnect; sub end_of_day { my $set_due_time = shift; - my $select_stmt = <selectrow_array($select_stmt); - print localtime() . " - found " . scalar(@results) . " circulation transactions to update:\n"; - foreach (@results) { - print "\t$_\n"; - } - if ($set_due_time) { - my $stmt = $dbh->prepare($update_stmt); - my $updates = $stmt->execute(); - print "Updated $updates circulation transactions.\n"; - } + AND ( + ( + due_date::TIME != '23:59:59' + AND duration_rule LIKE ('%days%') + OR duration_rule LIKE ('%weeks%') + OR duration_rule = '48_hours_2_renew' + ) OR ( + due_date::TIME = '00:00:00' + ) + ) AND circ_lib IN ( + SELECT id + FROM actor.org_unit + WHERE parent_ou = 105 + ) +UPDATE + + + my $results = $dbh->selectcol_arrayref($select_stmt); + print localtime() . " - found " . scalar(@$results) . " circulation transactions to update:\n"; + foreach (@$results) { + print "\t$_\n"; + } + if ($set_due_time) { + my $stmt = $dbh->prepare($update_stmt); + my $updates = $stmt->execute(); + print "Updated $updates circulation transactions.\n"; + } } - -- 2.11.0