Bug 12923

Summary: Improve error logging for advance_notices.pl; Show borrowernumber when no letter of type is found and force utf8 output.
Product: Koha Reporter: Olli-Antti Kivilahti <olli-antti.kivilahti>
Component: NoticesAssignee: Olli-Antti Kivilahti <olli-antti.kivilahti>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, kyle
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12922
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12924
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 12923 - Improve error logging for advance_notices.pl; Show borrowernumber when no letter of type is found and force utf8 output.
Bug 12923 - Improve error logging for advance_notices.pl; Show borrowernumber when no letter of type is found and force utf8 output.
Bug 12923 Improve error logging for advance_notices.pl
Bug 12923 Improve error logging for advance_notices.pl

Description Olli-Antti Kivilahti 2014-09-15 15:17:48 UTC
when running advance_notices.pl with -n flag, diacritics run awol in the console output!

Also when debugging which borrower requests undefined letter templates, it is very handy to log the borrowernumber so we catch and fix bad borrower message transport settings.

This patch fixes those issues.
Comment 1 Olli-Antti Kivilahti 2014-09-15 15:18:55 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2014-11-25 16:03:41 UTC
Olli, Is this ready to be tested?
Please provide a test plan.
Comment 3 Olli-Antti Kivilahti 2014-12-15 16:16:41 UTC Comment hidden (obsolete)
Comment 4 Olli-Antti Kivilahti 2014-12-15 16:17:39 UTC
Having this in production for 3+ months already.
Let me know of any bugs ;)
Comment 5 Frédéric Demians 2015-11-10 11:39:05 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2015-12-02 12:07:50 UTC
Everything works fine but I am wondering if it couldn't be useful to display the branchcode too.
A letter is not generated because it's missing for a given branchcode (here the one from the issue), not for a given patron.
Comment 7 Jonathan Druart 2015-12-02 12:08:23 UTC
Created attachment 45321 [details] [review]
Bug 12923 Improve error logging for advance_notices.pl

Show borrowernumber when no letter of type is found and force utf8
output when running advance_notices.pl with -n flag, diacritics run awol
in the console output!

Also when debugging which borrower requests undefined letter templates,
it is very handy to log the borrowernumber so we catch and fix bad
borrower message transport settings.

TEST PREPARATION:

0. Edit the ODUEDGST letter, find an undefined letter for any trasport
   type.

::TESTS ARE (ALMOST) THE SAME AS IN bugg 12922::
TEST PLAN:

1. Find a borrower and from the messaging preferences set the "Advance
   notice" transport type to the undefined digest. Set the "Days in
   Advance" to 1.
2. Check-out something for that borrower and set the due date for
   tomorrow.
3. Run "misc/cronjobs/advance_notices.pl -c -n -v" from the terminal.
4. BEFORE THIS PATCH: You get an error "no letter of type 'PREDUEDGST'
   found. Please see sample_notices.sql at ./advance_notices.pl line
   366."
4. AFTER THIS PATCH: You get an error "no letter of type 'PREDUEDGST'
   found for borrowernumber 1104659. Please see sample_notices.sql at
   ./advance_notices.pl line 368."
   Makes life more worth living for!
   Also diacritics printed on screen are displayed properly.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  I confirm the diacritics issue and solution. borrowernumber is
  displayed with warning when the 'no letter...' message is displayed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Kyle M Hall (khall) 2015-12-31 16:12:30 UTC
Pushed to master, thanks Olli!
Comment 9 Olli-Antti Kivilahti 2016-02-08 14:13:35 UTC
Happy new year to you too!