Bug 21886: (QA follow-up) Fix QA script errors

This patch fixes a perlcritic issue and also replaces tabs with four
spaces where appropriate.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2020-10-16 14:22:58 +01:00 committed by Jonathan Druart
parent 9d765eb5c9
commit 04548e4c80
3 changed files with 34 additions and 31 deletions

View File

@ -2701,7 +2701,7 @@ sub GetUpcomingDueIssues {
my $dbh = C4::Context->dbh;
my $statement;
if($params->{'owning_library'}) {
$statement = <<"END_SQL";
$statement = <<"END_SQL";
SELECT *
FROM (
SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due, branches.branchemail
@ -2713,7 +2713,7 @@ FROM (
WHERE days_until_due >= 0 AND days_until_due <= ?
END_SQL
} else {
$statement = <<"END_SQL";
$statement = <<"END_SQL";
SELECT *
FROM (
SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due, branches.branchemail

View File

@ -125,7 +125,7 @@ Enabling this flag ensures that the issuing library is the sender of
the digested message. It has no effect unless the borrower has
chosen 'Digests only' on the advance messages.
=item B<-library>
=item B<--library>
select notices for one specific library. Use the value in the
branches.branchcode table. This option can be repeated in order
@ -240,7 +240,10 @@ unless ($confirm) {
}
cronlogaction();
my %branches = map { $_ => 1 } @branchcodes if @branchcodes;
my %branches = {};
if (@branchcodes) {
%branches = map { $_ => 1 } @branchcodes;
}
# The fields that will be substituted into <<items.content>>
my @item_content_fields = split(/,/,$itemscontent);
@ -294,14 +297,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
$due_digest->{ $upcoming->{borrowernumber} }->{count}++;
}
} else {
my $branchcode;
if($owning_library) {
$branchcode = $upcoming->{'homebranch'};
} else {
$branchcode = $upcoming->{'branchcode'};
}
# Skip this DUE if we specify list of libraries and this one is not part of it
next if (@branchcodes && !$branches{$branchcode});
my $branchcode;
if($owning_library) {
$branchcode = $upcoming->{'homebranch'};
} else {
$branchcode = $upcoming->{'branchcode'};
}
# Skip this DUE if we specify list of libraries and this one is not part of it
next if (@branchcodes && !$branches{$branchcode});
my $item = Koha::Items->find( $upcoming->{itemnumber} );
my $letter_type = 'DUE';
@ -341,14 +344,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
$upcoming_digest->{ $upcoming->{borrowernumber} }->{count}++;
}
} else {
my $branchcode;
if($owning_library) {
$branchcode = $upcoming->{'homebranch'};
} else {
$branchcode = $upcoming->{'branchcode'};
}
# Skip this PREDUE if we specify list of libraries and this one is not part of it
next if (@branchcodes && !$branches{$branchcode});
my $branchcode;
if($owning_library) {
$branchcode = $upcoming->{'homebranch'};
} else {
$branchcode = $upcoming->{'branchcode'};
}
# Skip this PREDUE if we specify list of libraries and this one is not part of it
next if (@branchcodes && !$branches{$branchcode});
my $item = Koha::Items->find( $upcoming->{itemnumber} );
my $letter_type = 'PREDUE';

View File

@ -341,8 +341,8 @@ if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
warn qq(using "$csvfilename" as filename, that seems odd);
}
my @overduebranches = C4::Overdues::GetBranchcodesWithOverdueRules(); # Branches with overdue rules
my @branches; # Branches passed as parameter with overdue rules
my @overduebranches = C4::Overdues::GetBranchcodesWithOverdueRules(); # Branches with overdue rules
my @branches; # Branches passed as parameter with overdue rules
my $branchcount = scalar(@overduebranches);
my $overduebranch_word = scalar @overduebranches > 1 ? 'branches' : 'branch';
@ -366,8 +366,8 @@ if (@branchcodes) {
if (@branches) {
my $branch_word = scalar @branches > 1 ? 'branches' : 'branch';
$verbose and warn "$branch_word @branches have overdue rules\n";
my $branch_word = scalar @branches > 1 ? 'branches' : 'branch';
$verbose and warn "$branch_word @branches have overdue rules\n";
} else {
@ -529,7 +529,7 @@ END_SQL
# $letter->{'content'} is the text of the mail that is sent.
# this text contains fields that are replaced by their value. Those fields must be written between brackets
# The following fields are available :
# itemcount is interpreted here as the number of items in the overdue range defined by the current notice or all overdues < max if(-list-all).
# itemcount is interpreted here as the number of items in the overdue range defined by the current notice or all overdues < max if(-list-all).
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country>
my $borrower_sql = <<"END_SQL";
@ -543,11 +543,11 @@ AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0
END_SQL
my @borrower_parameters;
if ($branchcode) {
if($owning_library) {
$borrower_sql .= ' AND items.homebranch=? ';
} else {
$borrower_sql .= ' AND issues.branchcode=? ';
}
if($owning_library) {
$borrower_sql .= ' AND items.homebranch=? ';
} else {
$borrower_sql .= ' AND issues.branchcode=? ';
}
push @borrower_parameters, $branchcode;
}
if ( $overdue_rules->{categorycode} ) {
@ -557,7 +557,7 @@ END_SQL
$borrower_sql .= ' AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber';
# $sth gets borrower info iff at least one overdue item has triggered the overdue action.
my $sth = $dbh->prepare($borrower_sql);
my $sth = $dbh->prepare($borrower_sql);
$sth->execute(@borrower_parameters);
$verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows";