From affc283a055f06d559de82e7c1cbc507e9fb9c93 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 16 Oct 2014 16:47:06 +0200 Subject: [PATCH] Bug 13096: Send an ACCTDETAILS notice when staff edits patron Content-Type: text/plain; charset=utf-8 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. --- .../prog/en/modules/members/memberentrygen.tt | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 56cc570..58140ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1,4 +1,5 @@ [% IF ( opduplicate ) %][% SET focusAction = "clearDupe" %][% END %] +[% USE Koha %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › @@ -103,6 +104,12 @@ $(mytables).find(" li[data-category_code='']").show(); } + function checkAcctMail() { + if ( $("#mailacctdetails").length ) { // does it exist? + $("#mailacctdetails").prop('checked', true); + } + } + var MSG_SEPARATOR = _("Separator must be / in field %s"); var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); @@ -1076,7 +1083,7 @@ [% IF ( opduplicate ) %] <input type="text" id="userid" name="userid" size="20" value="" /> [% ELSE %] - <input type="text" id="userid" name="userid" size="20" value="[% userid %]" /> + <input type="text" id="userid" name="userid" size="20" value="[% userid %]" onchange="checkAcctMail();" /> [% END %] [% END %] @@ -1113,7 +1120,7 @@ [% IF ( opduplicate ) %] <input type="password" id="password" name="password" size="20" /> [% ELSE %] - <input type="password" id="password" name="password" size="20" value="****" /> + <input type="password" id="password" name="password" size="20" value="****" onchange="checkAcctMail();" /> [% END %] [% END %] [% ELSE %] @@ -1169,6 +1176,15 @@ [% END %] [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %] </li> + [% IF Koha.Preference('AutoEmailOpacUser') %] + [% IF opadd || opduplicate # will already trigger automatic mail %] + [% ELSE %] + <li> + <label for="mailacctdetails"> </label> + <input type="checkbox" id="mailacctdetails" name="mailacctdetails"> Mail account details to patron when saving this record</input> + </li> + [% END %] + [% END %] </ol> </fieldset> [% END # hide fieldset %][% END %] -- 1.7.7.6