Bugzilla – Attachment 45524 Details for
Bug 15240
Performance issue running overdue_notices.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15240: Do not process issues with a date due later than today
Bug-15240-Do-not-process-issues-with-a-date-due-la.patch (text/plain), 3.15 KB, created by
Jonathan Druart
on 2015-12-09 11:47:30 UTC
(
hide
)
Description:
Bug 15240: Do not process issues with a date due later than today
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-12-09 11:47:30 UTC
Size:
3.15 KB
patch
obsolete
>From 61050f665f0670ef94cbe43c5e208498f43c8a3a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 9 Dec 2015 11:10:33 +0000 >Subject: [PATCH] Bug 15240: Do not process issues with a date due later than > today > >There is no need to do this job in Perl, MySQL could do it instead. >The idea is to only retrieve the issues info which could be overdued. >--- > misc/cronjobs/overdue_notices.pl | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 98b0a25..7315de0 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -454,6 +454,7 @@ SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS > AND b.branchcode = items.homebranch > AND biblio.biblionumber = biblioitems.biblionumber > AND issues.borrowernumber = ? >+ AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0 > END_SQL > > my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? "; >@@ -499,15 +500,14 @@ END_SQL > # 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'; >-SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, >-TO_DAYS(?)-TO_DAYS(date_due) as difference, date_due >+ my $borrower_sql = <<"END_SQL"; >+SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due > FROM issues,borrowers,categories > WHERE issues.borrowernumber=borrowers.borrowernumber > AND borrowers.categorycode=categories.categorycode >+AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0 > END_SQL > my @borrower_parameters; >- push @borrower_parameters, $date_to_run->datetime(); > if ($branchcode) { > $borrower_sql .= ' AND issues.branchcode=? '; > push @borrower_parameters, $branchcode; >@@ -526,8 +526,6 @@ END_SQL > my $borrowernumber; > while ( my $data = $sth->fetchrow_hashref ) { > >- next unless ( DateTime->compare( $date_to_run, dt_from_string($data->{date_due})) ) == 1; >- > # check the borrower has at least one item that matches > my $days_between; > if ( C4::Context->preference('OverdueNoticeCalendar') ) >@@ -616,8 +614,6 @@ END_SQL > my $j = 0; > my $exceededPrintNoticesMaxLines = 0; > while ( my $item_info = $sth2->fetchrow_hashref() ) { >- next unless ( DateTime->compare( $date_to_run, dt_from_string($item_info->{date_due})) ) == 1; >- > if ( C4::Context->preference('OverdueNoticeCalendar') ) { > my $calendar = > Koha::Calendar->new( branchcode => $branchcode ); >-- >2.1.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 15240
:
45524
|
45554
|
46406
|
47335
|
47353
|
47354