Bug 19496

Summary: Patron notes about item does not get emailed as indicated
Product: Koha Reporter: Kelly McElligott <kelly>
Component: OPACAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: major    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, josef.moravec, jzairo, kelly, lisettepalouse+koha, marjorie.barry-vila, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22823
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 14224    
Bug Blocks: 22821    
Attachments: Bug 19496: Fixing to_address for patron notes
Bug 19496: Fixing to_address for patron notes
Bug 19496: Fixing to_address for patron notes
Bug 19496: ReplytoDefault is a pref, not a C4::Context method
Bug 19496: [17.05.x] Fixing to_address for patron notes
Bug 19496: [17.05.x] ReplytoDefault is a pref, not a C4::Context method

Description Kelly McElligott 2017-10-19 20:28:54 UTC
According to Bug 14224, with the system preference 'allowcheckoutnotes' enabled, the process should go like this: 

1.The patron leaves a note on an item in the OPAC
2.A notice is generated and will be emailed to branch email.
3. Upon checkin of the item the note is displayed on the staff client.

However, currently with this system preference enabled,
1. The patron leaves a note on the item in the OPAC
2. The patron's email receives the notice. 
3. Upon check in of the item, the note is displayed on the staff client.


  
There are two other bugs are shown as block to the original bug 14224 - these bugs are 17698 and 18915.
Comment 1 Jonathan Druart 2017-11-02 11:30:34 UTC
Aleisha, can you take care of this one please?
Comment 2 Aleisha Amohia 2017-11-27 22:10:41 UTC
Created attachment 69404 [details] [review]
Bug 19496: Fixing to_address for patron notes

This patch ensures the patron note to_address is the branch email or the
Koha Admin email, and the from_address is the patron's email.

To test:
1) Ensure syspref 'allowcheckoutnotes' is turned on
2) Go to OPAC, leave a note on a checkout
3) Confirm that the note is received (in mysql message_queue) but the
to_address is the patron's email - this is wrong
4) Apply patch and refresh OPAC
5) Leave a note on a checkout
6) Confirm that the note is received in message queue
7) Confirm that the to_address is one of:
- branch email
- branch reply to
- syspref ReplytoDefault
- syspref KohaAdminEmailAddress
8) Confirm that the from_address is one of:
- patron email
- patron emailpro
- patron B_email

Sponsored-by: Catalyst IT
Comment 3 David Bourgault 2017-12-01 20:13:18 UTC
Created attachment 69455 [details] [review]
Bug 19496: Fixing to_address for patron notes

This patch ensures the patron note to_address is the branch email or the
Koha Admin email, and the from_address is the patron's email.

To test:
1) Ensure syspref 'allowcheckoutnotes' is turned on
2) Go to OPAC, leave a note on a checkout
3) Confirm that the note is received (in mysql message_queue) but the
to_address is the patron's email - this is wrong
4) Apply patch and refresh OPAC
5) Leave a note on a checkout
6) Confirm that the note is received in message queue
7) Confirm that the to_address is one of:
- branch email
- branch reply to
- syspref ReplytoDefault
- syspref KohaAdminEmailAddress
8) Confirm that the from_address is one of:
- patron email
- patron emailpro
- patron B_email

Sponsored-by: Catalyst IT

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Comment 4 Josef Moravec 2017-12-07 13:13:19 UTC
Created attachment 69606 [details] [review]
Bug 19496: Fixing to_address for patron notes

This patch ensures the patron note to_address is the branch email or the
Koha Admin email, and the from_address is the patron's email.

To test:
1) Ensure syspref 'allowcheckoutnotes' is turned on
2) Go to OPAC, leave a note on a checkout
3) Confirm that the note is received (in mysql message_queue) but the
to_address is the patron's email - this is wrong
4) Apply patch and refresh OPAC
5) Leave a note on a checkout
6) Confirm that the note is received in message queue
7) Confirm that the to_address is one of:
- branch email
- branch reply to
- syspref ReplytoDefault
- syspref KohaAdminEmailAddress
8) Confirm that the from_address is one of:
- patron email
- patron emailpro
- patron B_email

Sponsored-by: Catalyst IT

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 5 Jonathan Druart 2017-12-07 13:53:37 UTC
Created attachment 69611 [details] [review]
Bug 19496: ReplytoDefault is a pref, not a C4::Context method
Comment 6 Jonathan Druart 2017-12-07 13:55:40 UTC
I expect that librarians will get spammed. But as soon as it fixed a major bug I am going to push this patch.
We should generate a digest for these PATRON_NOTE notice.

See also bug 19772 I found when testing this patch.
Comment 7 Jonathan Druart 2017-12-07 14:25:37 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 8 Nick Clemens 2017-12-14 18:19:24 UTC
Pushed to stable for 17.11.01, awesome work all!
Comment 9 Fridolin Somers 2017-12-21 09:50:46 UTC
Patch does not apply to 17.05.x because it is still $member hash instead of $patron object.
Rebase looks tricky, please provide rebased patches.
Comment 10 Jonathan Druart 2017-12-21 13:11:48 UTC
Created attachment 70012 [details] [review]
Bug 19496: [17.05.x] Fixing to_address for patron notes

This patch ensures the patron note to_address is the branch email or the
Koha Admin email, and the from_address is the patron's email.

To test:
1) Ensure syspref 'allowcheckoutnotes' is turned on
2) Go to OPAC, leave a note on a checkout
3) Confirm that the note is received (in mysql message_queue) but the
to_address is the patron's email - this is wrong
4) Apply patch and refresh OPAC
5) Leave a note on a checkout
6) Confirm that the note is received in message queue
7) Confirm that the to_address is one of:
- branch email
- branch reply to
- syspref ReplytoDefault
- syspref KohaAdminEmailAddress
8) Confirm that the from_address is one of:
- patron email
- patron emailpro
- patron B_email

Sponsored-by: Catalyst IT
Comment 11 Jonathan Druart 2017-12-21 13:11:56 UTC
Created attachment 70013 [details] [review]
Bug 19496: [17.05.x] ReplytoDefault is a pref, not a C4::Context method
Comment 12 Jonathan Druart 2017-12-21 13:12:43 UTC
(In reply to Fridolin SOMERS from comment #9)
> Patch does not apply to 17.05.x because it is still $member hash instead of
> $patron object.
> Rebase looks tricky, please provide rebased patches.

Done, please test!
Comment 13 Fridolin Somers 2018-01-09 12:26:38 UTC
(In reply to Jonathan Druart from comment #12)
> (In reply to Fridolin SOMERS from comment #9)
> > Patch does not apply to 17.05.x because it is still $member hash instead of
> > $patron object.
> > Rebase looks tricky, please provide rebased patches.
> 
> Done, please test!

Works perfect thanks a lot
Comment 14 Fridolin Somers 2018-01-09 12:27:05 UTC
Pushed to 17.05.x for 17.05.08
Comment 15 Martin Renvoize 2019-05-01 15:32:29 UTC
This looks incorrect to me with regards to how email preference fallbacks should work.

I'm going to open another bug to clarify - bug 22821