Bugzilla – Attachment 134927 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.93 KB, created by
Kyle M Hall
on 2022-05-12 13:46:03 UTC
(
hide
)
Description:
Bug 29100: Remove unnecessary loops
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2022-05-12 13:46:03 UTC
Size:
3.93 KB
patch
obsolete
>From 1b8cbf158489532d37c6a63a4ba14c1747aa0f23 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 > >Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov> >--- > 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 54a9804b39..4c3a60738d 100755 >--- a/misc/cronjobs/advance_notices.pl >+++ b/misc/cronjobs/advance_notices.pl >@@ -291,12 +291,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'}} ) { >@@ -306,8 +302,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, > } ) >@@ -343,12 +339,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'}} ) { >@@ -358,8 +350,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