Created attachment 32475 [details] [review] Bug 13096: Send an ACCTDETAILS notice when staff edits patron If AutoEmailOpacUser is enabled, Koha will send an email with account details to the patron at creation time. This report makes it possible to also end this mail when updating patron details, perhaps finishing the registration process at a later stage. This patch makes the needed template change. It adds a checkbox when a patron is modified (not created/duplicated). It adds javascript to check this checkbox on a username or password change. The staff user can uncheck it again if needed. Test plan: Disable AutoEmailOpacUser. Test adding, duplicating and modifying a patron. You should not see the checkbox. Enable AutoEmailOpacUser. Test adding or duplicating. You should not see the checkbox. Test modifying a patron. If you edit username or password, the checkbox should automatically be checked. You can uncheck it again.
Created attachment 32476 [details] [review] Bug 13096: Send an ACCTDETAILS notice: Rewording pref and code changes This patch adds a line to the AutoEmailOpacUser pref description. It also makes some code changes to memberentry.pl. The code for selecting an email address and sending the alert is moved to a subroutine. An additional call is made for the op=save situation; if in that case param mailacctdetails is true, a mail will be sent too. Note that the script refers to op=duplicate several times. Inspecting the template shows that the duplicate operation also goes via op=insert however. Test plan: [1] Check the pref rewording in Systempreferences. [2] Disable AutoEmailOpacUser. Add, duplicate, modify patron. No mails? [3] Enable AutoEmailOpacUser. Add, duplicate patron. Check mail. [4] Modify patron. Check the email checkbox. Did you receive it? [5] Modify patron. Uncheck the email checkbox. No mail?
I will also add a change to this specific notice on a follow-up report (see bug 13102). This can be tested already.
Just a thing that I will still do: Put the same logic in member-password.pl Could do that on another report?
For native speakers: Is the text " Mail account details to patron when saving this record" clear enough? It should make clear that this is a one-off mail and not a permanent patron attribute or so.
Still making some adjustments. Obsoleting patches for now.
Created attachment 33028 [details] [review] Bug 13096: Adding code from memberentry to Members.pm module This patch adds routine SendAutoEmail to Members.pm (and adds some tests). The code is taken from memberentry.pl. Follow-up patches modify the code in memberentry and add new calls to this routine too. Test plan: Run the revised unit test Members.t.
Created attachment 33158 [details] [review] Bug 13096: Template changes for memberentry in staff. If AutoEmailOpacUser is enabled, Koha will send an email with account details to the patron at creation time. This report makes it possible to also send this mail when updating patron details, perhaps finishing the registration process at a later stage. This patch makes the needed template changes. It adds a checkbox when a patron is modified (not created/duplicated). It adds javascript to check this checkbox on a username or password change. The staff user can uncheck it again if needed. Test plan: Disable AutoEmailOpacUser. Test adding, duplicating and modifying a patron. You should not see the checkbox. Enable AutoEmailOpacUser. Test adding or duplicating. You should not see the checkbox. Test modifying a patron. If you edit username or password, the checkbox should automatically be checked. You can uncheck it again.
Created attachment 33159 [details] [review] Bug 13096: Send account notice at patron modification time Instead of sending an account notice only at creation time, this patch makes it possible to generate the same notice when changing account details of the patron. In memberentry.pl, the code for selecting an email address and sending the alert is replaced by calling SendAutoEmail in Members.pm. An additional call is made for the op=save situation; if in that case param mailacctdetails is true (checkbox), a mail will be sent. Note that the script refers to op=duplicate several times. Inspecting the template shows that the duplicate operation also goes via op=insert however. If the password is '!' (disabled), the form now shows the password as blank. If no password is entered, AddMember will insert the ! again. This makes staff more aware of a missing password than showing *****. Test plan: [1] Disable AutoEmailOpacUser. Add, duplicate, modify patron. No mails? [2] Enable AutoEmailOpacUser. Add, duplicate patron. Check mail. [3] Modify patron. Check the email checkbox. Did you receive it? [4] Modify patron. Uncheck the email checkbox. No mail? [5] Create a new patron without userid and password. No mail. [6] Edit this patron: a userid has been generated, but the password should be blank. Enter a password. Check mail.
Created attachment 33160 [details] [review] Bug 13096: Send account notice when user completes self-registration If you have enabled AutoEmailOPACUser, a notice is sent to a patron at creation time. This patch will make Koha send a notice when someone self-registers and submits or follows the verification link. The usercode and password are prefilled on the form, but many patrons will find it helpful to have them in a mail. Instead of creating a new pref for this specific case, I have chosen to extend pref AutoEmailOpacUser. These situations are very similar. The pref text is adjusted in a follow-up. Note: If the user does not enter an email address, he will not receive any notice. (No verification link either.) Test plan: [1] Enable the prefs AutoEmailOPACUser and PatronSelfRegistration. [2] Enable PatronSelfRegistrationVerifyByEmail. [3] Self-register an account. Verify the account with the link in the mail. Check that you receive another mail with account details now. [4] Disable PatronSelfRegistrationVerifyByEmail. [5] Self-register again. Check if you receive a mail when submitting.
Created attachment 33161 [details] [review] Bug 13096: Send account notice when changing password with member-password Send an alert with account details if AutoEmailOpacUser is enabled and the checkbox was not unchecked. Added license statement and modern perl line to the code. Fixed some other minor issues too: When changing password, the ajax call used userid instead of borrowernumber. Current master does not allow you to change userid only. Test on newpassword in the template was dead. Removed dead destination parameter. Test plan: Disable AutoEmailOpacUser. Goto a patron. Click the Change Password button. No checkbox, no mail. Enable AutoEmailOpacUser. Click Change Password again. Do you receive a mail when saving? Uncheck the checkbox: no mail? Test changing the userid only. Test saving without any changes.
Created attachment 33162 [details] [review] Bug 13096: Adjusting description of pref AutoEmailOPACUser. Test plan: Check the pref rewording in Systempreferences.
Will still make some small adjustments before setting to Needs Signoff
There will be not much support for extending the AutoEmailOpacUser functionality. See report 8753. I will not put more effort into this line of development.
Created attachment 40073 [details] [review] Bug 13096 - Cucumber tests. See Cucumber/testsStructuring.tutorial for more info
Sorry commit to wrong bug.