Bugzilla – Attachment 109029 Details for
Bug 25958
Allow LongOverdue cron to exclude specified lost values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop
Bug-25958-QA-follow-up-Implement-filter-in-databas.patch (text/plain), 2.42 KB, created by
Kyle M Hall (khall)
on 2020-08-24 17:14:50 UTC
(
hide
)
Description:
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-08-24 17:14:50 UTC
Size:
2.42 KB
patch
obsolete
>From f676d1eb0ae6c35aeac44a32f53f6173300d1d77 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 24 Aug 2020 13:13:17 -0400 >Subject: [PATCH] Bug 25958: (QA follow-up) Implement filter in database query > instead of in loop > >--- > misc/cronjobs/longoverdue.pl | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > >diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl >index d1bb9cb98f..1f4a380bab 100755 >--- a/misc/cronjobs/longoverdue.pl >+++ b/misc/cronjobs/longoverdue.pl >@@ -36,7 +36,6 @@ BEGIN { > > use Getopt::Long; > use Pod::Usage; >-use List::Util qw/ any /; > > use C4::Circulation qw/LostItem MarkIssueReturned/; > use C4::Context; >@@ -298,6 +297,15 @@ sub bounds { > > # FIXME - This sql should be inside the API. > sub longoverdue_sth { >+ my ( $params ) = @_; >+ my $skip_lost_values = $params->{skip_lost_values}; >+ >+ my $skip_lost_values_sql = q{}; >+ if ( @$skip_lost_values ) { >+ my $values = join( ',', map { qq{'$_'} } @$skip_lost_values ); >+ $skip_lost_values_sql = "AND itemlost NOT IN ( $values )" >+ } >+ > my $query = " > SELECT items.itemnumber, borrowernumber, date_due, itemlost > FROM issues, items >@@ -305,6 +313,7 @@ sub longoverdue_sth { > AND DATE_SUB(CURDATE(), INTERVAL ? DAY) > date_due > AND DATE_SUB(CURDATE(), INTERVAL ? DAY) <= date_due > AND itemlost <> ? >+ $skip_lost_values_sql > ORDER BY date_due > "; > return C4::Context->dbh->prepare($query); >@@ -376,7 +385,7 @@ my $i = 0; > # FIXME - The item is only marked returned if you supply --charge . > # We need a better way to handle this. > # >-my $sth_items = longoverdue_sth(); >+my $sth_items = longoverdue_sth({ skip_lost_values => \@skip_lost_values }); > > foreach my $startrange (sort keys %$lost) { > if( my $lostvalue = $lost->{$startrange} ) { >@@ -389,10 +398,6 @@ foreach my $startrange (sort keys %$lost) { > $sth_items->execute($startrange, $endrange, $lostvalue); > $count=0; > ITEM: while (my $row=$sth_items->fetchrow_hashref) { >- if ( @skip_lost_values ) { >- next ITEM if any { $_ eq $row->{itemlost} } @skip_lost_values; >- } >- > if( $filter_borrower_categories ) { > my $category = uc Koha::Patrons->find( $row->{borrowernumber} )->categorycode(); > next ITEM unless ( $category_to_process{ $category } ); >-- >2.24.1 (Apple Git-126)
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 25958
:
107461
|
107538
|
108592
|
108933
|
108934
|
109028
| 109029 |
110635