Bug 12752

Summary: OVERDUE notice mis-labeled as "Hold Available for Pickup"
Product: Koha Reporter: Barton Chittenden <barton>
Component: NoticesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: brendan, chris, gwilliams, jonathan.druart, julian.maurice, kyle, m.de.rooy, tmisilo
Version: unspecified   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13215
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11867
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 11867, 16217    
Bug Blocks:    
Attachments: Bug 12752: FIX letter names in 3.15.00.041
Bug 12752: FIX letter names in 3.15.00.041
Bug 12752: FIX letter names in 3.15.00.041
Bug 12752: FIX letter names in 3.15.00.041

Description Barton Chittenden 2014-08-12 18:41:53 UTC
The letter with code OVERDUE for 'all branches' and message transport type 'phone' has the name "Hold Available for Pickup".

There are no other notices with code 'OVERDUE', however there is a letter marked 'ODUE'.

This notice can be seen at the bywater demo site (username bywater/password bywater):

http://intranet.bywatersolutions.com/cgi-bin/koha/tools/letter.pl

and here:

http://intranet.bywatersolutions.com/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=&module=circulation&code=OVERDUE


select * from letter where code='OVERDUE'\G
*************************** 1. row ***************************
                module: circulation
                  code: OVERDUE
            branchcode: 
                  name: Hold Available for Pickup
               is_html: 0
                 title: Overdue Notice (phone notice)
               content: Your item is overdue
message_transport_type: phone

Thsi notice should be deleted; if a default overdue phone notice is needed, it should be added under the code 'ODUE'.
Comment 1 Katrin Fischer 2015-04-13 20:35:31 UTC
It's a problem with the database update not setting a variable correctly I think, we ran into this too, but lost sight of it
Comment 2 Nicole C. Engard 2015-05-13 23:12:19 UTC
Actually ODUE is Overdue - this notice is new and not needed. I've been deleting it from most installs.

Nicole
Comment 3 Barton Chittenden 2015-09-29 16:31:14 UTC
This became an issue at one of our partner consortia; this database row needs to be deleted before it causes more problems:

The library had several additional OVERDUE notices:

select module, code, branchcode, name, is_html, title, message_transport_type from letter where code='OVERDUE';
+-------------+---------+------------+----------------------------------+---------+--------------------------------+------------------------+
| module      | code    | branchcode | name                             | is_html | title                          | message_transport_type |
+-------------+---------+------------+----------------------------------+---------+--------------------------------+------------------------+
| circulation | OVERDUE |            | Item Past Due Alert (2nd Notice) |       0 | Library Item(s) Past Due Alert | email                  |
| circulation | OVERDUE |            | Printable Hold notice            |       0 | Overdue Notice (phone notice)  | phone                  |
| circulation | OVERDUE | XYZZY      | Item Past Due Alert (2nd Notice) |       0 | Library Item(s) Past Due Alert | email                  |
| circulation | OVERDUE | ABCDEF     | Item Past Due Alert              |       0 | Library Item(s) Past Due Alert | email                  |
| circulation | OVERDUE | FOOOBARB   | Item Past Due Alert (2nd Notice) |       0 | Library Item(s) Past Due Alert | email                  |
+-------------+---------+------------+----------------------------------+---------+--------------------------------+------------------------+

This caused confusion, because

a) The OVERDUE/"All libraries" notice with name "Printable Hold notice" did *not* show as a distinct letter on tools/letter.pl
b) tools/overduerules.pl shows available letters by 'letter.name', but only the letter code is stored in the overduerules table.

This also points the the necessity of adding a primary key to the letters table, as noted in bug 13215.
Comment 4 HB-NEKLS 2015-10-20 20:39:04 UTC
Bug 15007 will add a primary key id to the letter table.
Comment 5 Jonathan Druart 2015-11-10 12:35:45 UTC
This has certainly been caused by 3.15.00.041 (bug 11867).
The structure of the letter table is not ideal, it should be split into 2 tables to normalised it.
I don't know how we could fix this issue as a script cannot know what is the correct name of the letter.
Comment 6 Katrin Fischer 2015-11-22 21:37:10 UTC
I think the problem might be here:
http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=installer/data/mysql/updatedatabase.pl;h=6ba8e4d88b90acf6512458ae2448fddc81b15308;hb=5574a2fc4952322219892bcff3ea2525fec41949#l8361

$name is explicitly set for the HOLD messages, but never updates for the other messages later on:
8363     my $name = $dbh->selectcol_arrayref(q|
8364         SELECT name FROM letter WHERE code="HOLD"
8365     |);
8366     $name = $name->[0];

So $name is also used for PREDUE and OVERDUE

Maybe we could fix that database update - and then also do a database update looking at the code/module and change accordingly.
Comment 7 Barton Chittenden 2016-04-05 20:59:05 UTC
In 3.22, this seems to have shifted from OVERDUE to PREDUE

select * from letter where code = 'PREDUE'\G
*************************** 1. row ***************************
                module: circulation
                  code: PREDUE
            branchcode: 
                  name: Hold Available for Pickup
               is_html: 0
                 title: Advance Notice of Item Due (phone notice)
               content: Your item is due soon
message_transport_type: phone
1 row in set (0.00 sec)
Comment 8 Jonathan Druart 2016-04-06 15:04:21 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2016-04-06 15:05:06 UTC
(In reply to Katrin Fischer from comment #6)
> So $name is also used for PREDUE and OVERDUE
> 
> Maybe we could fix that database update - and then also do a database update
> looking at the code/module and change accordingly.

Yes indeed! Sorry to have been so slow to provide a fix for that.
Comment 10 Jonathan Druart 2016-04-06 16:06:02 UTC
See also bug 16217 for a global fix.
Comment 11 Chris Cormack 2016-04-19 00:30:19 UTC Comment hidden (obsolete)
Comment 12 Kyle M Hall (khall) 2016-04-21 14:30:34 UTC Comment hidden (obsolete)
Comment 13 Marcel de Rooy 2016-04-28 07:58:04 UTC
QA: Looking at this one now.
Comment 14 Marcel de Rooy 2016-04-28 08:13:04 UTC
Created attachment 50879 [details] [review]
Bug 12752: FIX letter names in 3.15.00.041

3.15.00.041 was wrong, the name of the letter should not always been the
name of the first HOLD notice.
PREDUE_PHONE should be updated with the first name of the PREDUE notice,
same for OVERDUE_PHONE and OVERDUE

Signed-off-by: Chris Cormack <chrisc@catalyst.net.z>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 15 Brendan Gallagher 2016-04-28 23:28:58 UTC
Pushed to Master - Should be in the May 2016 Release.  Thanks!
Comment 16 Julian Maurice 2016-05-09 08:23:42 UTC
Patch pushed to 3.22.x, will be in 3.22.7
Comment 17 Chris Cormack 2016-06-19 20:47:36 UTC
Pushed to 3.20.x will be in 3.20.11