Bugzilla – Attachment 114069 Details for
Bug 21886
Add option to send notices from owning library instead of issuing library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21886: (QA follow-up) Fix QA script errors
Bug-21886-QA-follow-up-Fix-QA-script-errors.patch (text/plain), 7.21 KB, created by
Nick Clemens (kidclamp)
on 2020-12-01 13:24:43 UTC
(
hide
)
Description:
Bug 21886: (QA follow-up) Fix QA script errors
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-12-01 13:24:43 UTC
Size:
7.21 KB
patch
obsolete
>From 05ebf74ad2bec629f8d273621cfa236f505e4662 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 16 Oct 2020 14:22:58 +0100 >Subject: [PATCH] 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> >--- > C4/Circulation.pm | 4 ++-- > misc/cronjobs/advance_notices.pl | 39 +++++++++++++++++++++------------------ > misc/cronjobs/overdue_notices.pl | 22 +++++++++++----------- > 3 files changed, 34 insertions(+), 31 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b3ec1d48ff..a0ed814606 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -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 >diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl >index 39e9171c59..f514c6f916 100755 >--- a/misc/cronjobs/advance_notices.pl >+++ b/misc/cronjobs/advance_notices.pl >@@ -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'; >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 918bc30799..e9e9ac3d34 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -339,8 +339,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'; >@@ -364,8 +364,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 { > >@@ -527,7 +527,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"; >@@ -541,11 +541,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} ) { >@@ -555,7 +555,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"; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21886
:
82668
|
86513
|
111581
|
111582
|
111679
|
111711
|
111828
|
111872
|
111873
|
112990
|
114068
| 114069 |
114070
|
114071