From 64b5b3a504fd99a3da5a58d541498b403ecbb64a Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 28 Nov 2017 01:11:06 +0000 Subject: [PATCH] Bug 19532: Cronjob to check for overdue recalls This patch adds a check to the overdue_notices cronjob, so if any of the overdue issues are also recalls, the status will be set to O (overdue) Signed-off-by: Nick Clemens --- misc/cronjobs/overdue_notices.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 8c42335..e870409 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -44,6 +44,7 @@ use Koha::Calendar; use Koha::Libraries; use Koha::Acquisition::Currencies; use Koha::Patrons; +use Koha::Recalls; =head1 NAME @@ -404,6 +405,7 @@ if ( defined $csvfilename ) { } else { open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; } + if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo branchname letternumber)) ) { print $csv_fh $csv->string, "\n"; } else { @@ -472,6 +474,7 @@ SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, branchname AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0 END_SQL + my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? "; $query .= " AND categorycode IN (".join( ',' , ('?') x @myborcat ).") " if (@myborcat); $query .= " AND categorycode NOT IN (".join( ',' , ('?') x @myborcatout ).") " if (@myborcatout); @@ -624,7 +627,7 @@ END_SQL my $itemcount = 0; my $titles = ""; my @items = (); - + my $j = 0; my $exceededPrintNoticesMaxLines = 0; while ( my $item_info = $sth2->fetchrow_hashref() ) { @@ -671,6 +674,13 @@ END_SQL } $sth2->finish; + foreach my $item (@items) { + my $recall = Koha::Recalls->find({ itemnumber => $item->{itemnumber} }); + if (defined $recall){ + $recall->update({ status => 'O' }); + } + } + my @message_transport_types = @{ GetOverdueMessageTransportTypes( $branchcode, $overdue_rules->{categorycode}, $i) }; @message_transport_types = @{ GetOverdueMessageTransportTypes( q{}, $overdue_rules->{categorycode}, $i) } unless @message_transport_types; -- 2.1.4