https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12802

Aleisha Amohia <alei...@catalyst.net.nz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #154076|0                           |1
        is obsolete|                            |

--- Comment #118 from Aleisha Amohia <alei...@catalyst.net.nz> ---
Created attachment 159780
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159780&action=edit
Bug 12802: Sent notices using several email addresses

Currently it is not possible to select several email addresses to notify
a patron. The only place where the mechanism exists is in the
overdue_notices.pl script.

This patch reuses the AutoEmailPrimaryAddress syspref and changes its
type to "multiple". Like that it is now possible to select several email
addresses. Note that there is no sense to select OFF and another value
for this pref. So if the 'OFF' (first valid) value exist, it takes the
priority.

It will add the ability to choose the email addresses to use to notify
patrons. The option is "email", "emailpro" and "B_email".
If "OFF" is selected, the first valid address will be returned (same
behavior as before this patch).

Note for the QA step:
I found a possible regression, but IMO it's not a big deal:
Before this patch if a letter did not contain a "to_address", the
C4::Letters::_send_message_by_email subroutine retrieve the email from
the given borrowernumber.
This is now done in the EnqueueMessage subroutine.
What it means: If a borrower didn't have an email address when the
notice was sent to the queue, the email address won't be check again
when the notice will really sent to the patron.
This change permits to sent a letter to the queue (EnqueueLetter)
without any information (from_address, to_address), only the
borrowernumber is mandatory to retrieve them.
The _send_message_by_email subroutine should not contain any useful
code, only sent the letter we ask it to sent.

What this patch does:
The Koha::Patron::notice_email_address subroutine has been renamed to
Koha::Patron::notice_email_addresses (plural). It only gets the patron
emails defined in the AutoEmailPrimaryAddress pref.

If no 'to_address' parameter is given to EnqueueMessage, the emails
will be retrieved at this moment.

In C4::Message: An old form was found. The AutoEmailPrimaryAddress was
not check. The smsalertnumber was sent for the to_address param, which
is wrong.

C4::Reserves: AddReserve and _koha_notify_reserve:
The from address is built in the QueueLetter. It is useless to do it
here.

overdue_notices.pl: The script could be cleaned a little bit if we
remove the --email parameter. Indeed it is redundant with this new
enhancement. I can propose another patch with a die statement and a
message: "you should use the pref AutoEmailPrimaryAddress" if the
--email is provided.

opac/opac-shareshelf.pl and opac/opac-memberentry.pl:
just remove the from and to address. They will be filled on sending to
the queue (because of the borrowernumber).

Test plan:
1. Apply this patch without updating the pref AutoEmailPrimaryAddress
   (or fill it with a single value if it is not done yet).
2. Try the different way to sent notices to a patron (check the
   following letter code: HOLD, CHECKIN, CHECKOUT, PREDUE, RENEW, DUE).
3. Verify the email is correctly sent to the message_queue.
4. Fill the pref with email and emailpro (for instance)
5. Verify that 2 notices are sent to the message_queue: 1 with the email
   and 1 with the emailpro.
6. You can also verify that only 1 notice is generated if the emailpro
   is empty.

Important note for testers: Pending messages must be removed each time
you change the value of AutoEmailPrimaryAddress. When there are already
existing pending messages for a borrower, Koha tries to update them
rather than enqueuing new ones, but it will not update the recipient's
email address, nor add/remove messages depending on the new value of
AutoEmailPrimaryAddress; not sure if this is a bug or not.

Signed-off-by: Mathieu Saby <mathsaby...@gmail.com>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to