Browse Source

Bug 8267 - Overdue notices not working

The variable $i was being re-used and overwriting the necessary value that was being passed to a subroutine. Renaming $i to $j fixed it. I also added an extra safety check within parse_letter that would also have prevented this bug.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
3.10.x
Kyle Hall 11 years ago
committed by Paul Poulain
parent
commit
ac5e09a0f0
  1. 8
      misc/cronjobs/overdue_notices.pl

8
misc/cronjobs/overdue_notices.pl

@ -486,14 +486,14 @@ END_SQL
my $titles = "";
my @items = ();
my $i = 0;
my $j = 0;
my $exceededPrintNoticesMaxLines = 0;
while ( my $item_info = $sth2->fetchrow_hashref() ) {
if ( ( !$email || $nomail ) && $PrintNoticesMaxLines && $i >= $PrintNoticesMaxLines ) {
if ( ( !$email || $nomail ) && $PrintNoticesMaxLines && $j >= $PrintNoticesMaxLines ) {
$exceededPrintNoticesMaxLines = 1;
last;
}
$i++;
$j++;
my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
$titles .= join("\t", @item_info) . "\n";
$itemcount++;
@ -657,7 +657,7 @@ substituted keys and values.
sub parse_letter {
my $params = shift;
foreach my $required (qw( letter_code borrowernumber )) {
return unless exists $params->{$required};
return unless ( exists $params->{$required} && $params->{$required} );
}
my $substitute = $params->{'substitute'} || {};

Loading…
Cancel
Save