Bugzilla – Attachment 125218 Details for
Bug 29100
Add checkouts data loop to predue/due notices script (advance_notices.pl)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29100: Remove unnecessary loops
Bug-29100-Remove-unnecessary-loops.patch (text/plain), 3.87 KB, created by
Kyle M Hall (khall)
on 2021-09-23 17:42:23 UTC
(
hide
)
Description:
Bug 29100: Remove unnecessary loops
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-09-23 17:42:23 UTC
Size:
3.87 KB
patch
obsolete
>From 095e773a64eb4db401386f37544e478cee67bab0 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Thu, 23 Sep 2021 13:40:48 -0400 >Subject: [PATCH] Bug 29100: Remove unnecessary loops > >Remove loops that only operate one one result only >--- > misc/cronjobs/advance_notices.pl | 24 ++++++++---------------- > 1 file changed, 8 insertions(+), 16 deletions(-) > >diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl >index 1f88367b12d..2584e5a65c1 100755 >--- a/misc/cronjobs/advance_notices.pl >+++ b/misc/cronjobs/advance_notices.pl >@@ -301,12 +301,8 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { > my $item = Koha::Items->find( $upcoming->{itemnumber} ); > my $letter_type = 'DUE'; > $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0'); >- my $titles = ""; >- my @issues; >- while ( my $item_info = $sth->fetchrow_hashref()) { >- push( @issues, $item_info ); >- $titles .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } ); >- } >+ my $item_info = $sth->fetchrow_hashref(); >+ my $title .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } ); > > ## Get branch info for borrowers home library. > foreach my $transport ( keys %{$borrower_preferences->{'transports'}} ) { >@@ -316,8 +312,8 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { > biblionumber => $item->biblionumber, > itemnumber => $upcoming->{'itemnumber'}, > substitute => { >- 'items.content' => $titles, >- issue => $issues[0], >+ 'items.content' => $title, >+ issue => $item_info, > }, > message_transport_type => $transport, > } ) >@@ -353,12 +349,8 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { > my $item = Koha::Items->find( $upcoming->{itemnumber} ); > my $letter_type = 'PREDUE'; > $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'}); >- my $titles = ""; >- my @issues; >- while ( my $item_info = $sth->fetchrow_hashref()) { >- push( @issues, $item_info ); >- $titles .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } ); >- } >+ my $item_info = $sth->fetchrow_hashref(); >+ my $title .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } ); > > ## Get branch info for borrowers home library. > foreach my $transport ( keys %{$borrower_preferences->{'transports'}} ) { >@@ -368,8 +360,8 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { > biblionumber => $item->biblionumber, > itemnumber => $upcoming->{'itemnumber'}, > substitute => { >- 'items.content' => $titles, >- issue => $issues[0], >+ 'items.content' => $title, >+ issue => $item_info, > }, > message_transport_type => $transport, > } ) >-- >2.30.2
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 29100
:
125217
|
125218
|
125219
|
134489
|
134490
|
134926
|
134927
|
137996
|
143898
|
143910
|
143911
|
143912
|
145235