Bug 31282

Summary: Broken characters in patron_emailer.pl verbose mode
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Command-line UtilitiesAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Kyle M Hall (khall) <kyle>
Severity: normal    
Priority: P5 - low CC: david, kyle, lucas, robin, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the patron_emailer.pl script (misc/cronjobs/patron_emailer.pl) so that non-ASCII characters in notices display correctly.
Version(s) released in:
22.11.00,22.05.06,21.11.12
Circulation function:
Attachments: Screenshot
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode

Description Tomás Cohen Arazi (tcohen) 2022-08-02 12:22:07 UTC
If you have non-ASCII characters in the printed notice, and run it with --verbose or without --commit, you will get broken characters.
Comment 1 Tomás Cohen Arazi (tcohen) 2022-08-02 12:23:46 UTC
Created attachment 138502 [details]
Screenshot
Comment 2 Tomás Cohen Arazi (tcohen) 2022-08-02 12:28:25 UTC
Created attachment 138504 [details] [review]
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode

To test:
1. Have a report containing:
   SELECT tomascohen@theke.io;
2. Have a members notice containing ¡ and other non-ASCII characters.
3. Run (changing the report number and notice code accordingly):
   $ kshell
  k$ perl misc/cronjobs/patron_emailer.pl --report 4 \
           --notice BIRTHDAY --from tomascohen@theke.io --module members
=> FAIL: non-ASCII characters are broken
4. Apply this patch
5. Repeat 3
=> SUCCESS: Things print correctly!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 David Nind 2022-08-18 23:02:19 UTC
Created attachment 139439 [details] [review]
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode

To test:
1. Have a report containing:
   SELECT tomascohen@theke.io;
2. Have a members notice containing ¡ and other non-ASCII characters.
3. Run (changing the report number and notice code accordingly):
   $ kshell
  k$ perl misc/cronjobs/patron_emailer.pl --report 4 \
           --notice BIRTHDAY --from tomascohen@theke.io --module members
=> FAIL: non-ASCII characters are broken
4. Apply this patch
5. Repeat 3
=> SUCCESS: Things print correctly!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2022-08-18 23:12:48 UTC
Testing notes (using koha-testing-docker):

- I couldn't get step 1 to work for me, so I ended up:
  . Creating a new report: SELECT borrowernumber, firstname, surname, address, email, address2, city, zipcode, dateofbirth FROM borrowers WHERE MONTH(dateofbirth) = 08
 . Edited details of patrons in the results so that they have an email address.
 . Created a notice with a code called BIRTHDAY and added some text to the Email notice with non-ASCII characters.
 ==> step 3 worked as expected
Comment 5 Kyle M Hall (khall) 2022-08-19 12:14:08 UTC
Created attachment 139486 [details] [review]
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode

To test:
1. Have a report containing:
   SELECT tomascohen@theke.io;
2. Have a members notice containing ¡ and other non-ASCII characters.
3. Run (changing the report number and notice code accordingly):
   $ kshell
  k$ perl misc/cronjobs/patron_emailer.pl --report 4 \
           --notice BIRTHDAY --from tomascohen@theke.io --module members
=> FAIL: non-ASCII characters are broken
4. Apply this patch
5. Repeat 3
=> SUCCESS: Things print correctly!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Tomás Cohen Arazi (tcohen) 2022-08-19 12:58:11 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 7 Lucas Gass (lukeg) 2022-10-14 19:18:49 UTC
Backported to 22.05.x for 22.05.06 release
Comment 8 Victor Grousset/tuxayo 2022-10-21 22:16:31 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.
Comment 9 Arthur Suzuki 2022-10-22 22:09:39 UTC
Thanks!

Pushed to 21.11 for 21.11.12