Bug 8607

Summary: overdue_notices is broken
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: NoticesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P5 - low CC: chris, claire.hernandez, fridolin.somers, katrin.fischer, koha.sekjal, matted-34813, paul.poulain
Version: 3.10   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 8378    
Attachments: Bug 8607: FIX overdues_notices script: $date is not replaced
SIGNED-OFF-Bug-8607-FIX-overdues_notices-script-date.patch

Description Jonathan Druart 2012-08-09 13:40:22 UTC
Bug 7447 introduces a critical bug in overdue_notices.pl
The script is unusable.
The variable $date is not replaced with its content.
Comment 1 Jonathan Druart 2012-08-09 13:41:34 UTC Comment hidden (obsolete)
Comment 2 wajasu 2012-08-12 02:22:43 UTC
Created attachment 11561 [details] [review]
SIGNED-OFF-Bug-8607-FIX-overdues_notices-script-date.patch


AS STAFF:
I set More -> Tools -> Patrons and Circulation -> Overdue notice/status triggers
   Select a library: Midway
   First
   Student  1  Overdue Notice

which adds a row to the overduerules  table (with branchcode 'MPL' categorycode='ST' delay1 letter1='ODUE'

I cataloged a biblio with a barcode (so we can check it out)
I set up a borrower Joe Cool who belongs to Midway Branch Library

AS BORROWER:
I signed in as my borrwer Joe
I checked out the cataloged book.
My summary for Joe shows a book checked out.

AS DBA:
To force the book overdue I used mysql to edit the issue.
mysql -uroot -p koha
> select * from issues;      TO FIND THE CHECKED OUT BOOK
> update issues set date_due='2012-08-01 23:59:00' where borrowernumber=51 and itemnumber=1;    CHOOSE ACCORDINGLY (It was due 2012-09-01)

Now I looked at My Summary for Joe, and his checked out book is OVERDUE and with a red background.

Since the overdue_notice.pl script joins across categories, borrowers, issues and it must be an exact match if -t trigger method,
I used without -t so the range for the overdue is between 1 and 90 days from the date_due

I ran my test accordingly:

Before patch: ---------------------------BROKEN
root@biblio:/home/koha/kohaclone/misc/cronjobs# ./overdue_notices.pl -n
DBD::mysql::st execute failed: Unknown column '$date' in 'where clause' at ./overdue_notices.pl line 467.
DBD::mysql::st fetchrow failed: fetch() without execute() at ./overdue_notices.pl line 470.

git am -i -u -3 <pathToPatch>

After patch: ----------------------------FIXED
root@biblio:/home/koha/kohaclone/misc/cronjobs# ./overdue_notices.pl -n
Use of uninitialized value in pattern match (m//) at ./overdue_notices.pl line 672.
Use of uninitialized value in pattern match (m//) at ./overdue_notices.pl line 683.
Dear Joe Cool,

According to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.

Midway
372 Forest Street

Phone:
Fax:
Email:

If you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.

The following item(s) is/are currently overdue:

"Paul and his theology " by , 227/.06, Barcode: 111 Fine: GBP

Thank-you for your prompt attention to this matter.

Midway Staff

-----------------------------------------

I did not persue other "rules" defaults, since this is a complex rule engine to test and is out of scope for this fix.
Note: The uninitialized warnings.
Note: Fine: GBP  (when its 0 or not defined)

wajasu
Comment 3 Katrin Fischer 2012-08-12 07:07:31 UTC
Hi wajasu, thx for testing this. I know the fine used to say 0.00 in earlier versions, maybe we need another little fix for this.
Comment 4 wajasu 2012-08-15 18:49:49 UTC
I investigated the reason for the Fine: USD instead of Fine $0.00

I fixed that in Bug 8378, as I found that existed.

Please refer to that patches comments for details.

When this patch gets applied, one should then apply the Bug 8378 patch
as the setup is similiar and it will save time.

Instead of a followup patch here, I am just refering to Bug 8378
as the followup.

wajasu
Comment 5 Ian Walls 2012-08-17 15:04:03 UTC
Replaces single quotes with double quotes so interpolation will work.  Marking Passed QA.
Comment 6 Chris Cormack 2012-08-24 02:12:22 UTC
Note for myself, this patch is not needed for 3.8.x, as 7447 is not on there
Comment 7 Paul Poulain 2012-08-28 15:49:38 UTC
Patch pushed today
Comment 8 Chris Cormack 2013-04-20 22:09:21 UTC
Released in 3.10.0