Bugzilla – Attachment 33159 Details for
Bug 13096
Send account notice with login details in more situations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13096: Send account notice at patron modification time
Bug-13096-Send-account-notice-at-patron-modificati.patch (text/plain), 6.25 KB, created by
Marcel de Rooy
on 2014-11-03 14:29:35 UTC
(
hide
)
Description:
Bug 13096: Send account notice at patron modification time
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-11-03 14:29:35 UTC
Size:
6.25 KB
patch
obsolete
>From a680a417baf5ba74f7a22fabd02f29b039466e85 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 17 Oct 2014 12:00:25 +0200 >Subject: [PATCH] Bug 13096: Send account notice at patron modification time >Content-Type: text/plain; charset=utf-8 > >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. >--- > members/memberentry.pl | 51 ++++++++++++++++-------------------------------- > 1 files changed, 17 insertions(+), 34 deletions(-) > >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 3c7f648..6cfd7ea 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -76,6 +76,8 @@ my $cardnumber = $input->param('cardnumber'); > my $check_member = $input->param('check_member'); > my $nodouble = $input->param('nodouble'); > my $duplicate = $input->param('duplicate'); >+my $mailacctdetails= $input->param('mailacctdetails') // 0; >+ > $nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're > # modifying an existing patron, it ipso facto > # isn't a duplicate. Marking FIXME because this >@@ -376,39 +378,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ > $borrowernumber = &AddMember(%newdata); > $newdata{'borrowernumber'} = $borrowernumber; > >- # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. >- if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'} && $newdata{'password'}) { >- #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead >- my $emailaddr; >- if (C4::Context->preference("AutoEmailPrimaryAddress") ne 'OFF' && >- $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} =~ /\w\@\w/ ) { >- $emailaddr = $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} >- } >- elsif ($newdata{email} =~ /\w\@\w/) { >- $emailaddr = $newdata{email} >- } >- elsif ($newdata{emailpro} =~ /\w\@\w/) { >- $emailaddr = $newdata{emailpro} >- } >- elsif ($newdata{B_email} =~ /\w\@\w/) { >- $emailaddr = $newdata{B_email} >- } >- # if we manage to find a valid email address, send notice >- if ($emailaddr) { >- $newdata{emailaddr} = $emailaddr; >- my $err; >- eval { >- $err = SendAlerts ( 'members', \%newdata, "ACCTDETAILS" ); >- }; >- if ( $@ ) { >- $template->param(error_alert => $@); >- } elsif ( ref($err) eq "HASH" && defined $err->{error} and $err->{error} eq "no_email" ) { >- $template->{VARS}->{'error_alert'} = "no_email"; >- } else { >- $template->{VARS}->{'info_alert'} = 1; >- } >- } >- } >+ C4::Members::SendAutoEmail( \%newdata, $template ); # send alert? > > if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { > C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); >@@ -425,6 +395,9 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ > # updating any columns in the borrowers table, > # which can happen if we're only editing the > # patron attributes or messaging preferences sections >+ >+ C4::Members::SendAutoEmail( \%newdata, $template ) if $mailacctdetails; >+ # send alert if asked for > if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { > C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); > } >@@ -649,12 +622,22 @@ if (C4::Context->preference('uppercasesurnames')) { > $data{'surname'} &&= uc( $data{'surname'} ); > $data{'contactname'} &&= uc( $data{'contactname'} ); > } >- > foreach (qw(dateenrolled dateexpiry dateofbirth)) { > $data{$_} = format_date($data{$_}); # back to syspref for display > $template->param( $_ => $data{$_}); > } > >+if( $data{password} eq '!' ) { >+ # This marks a disabled userid; note however that this is normally >+ # the result of saving a new patron without a password. >+ # If we do not clear it, the form gives the impression that a password >+ # has been entered, although it is only an exclamation mark. >+ # Clearing it may be more clear for staff :) >+ # AddMember will insert the ! again if no password is entered. >+ $data{password}=''; >+ $data{password2}=''; >+} >+ > if (C4::Context->preference('ExtendedPatronAttributes')) { > $template->param(ExtendedPatronAttributes => 1); > patron_attributes_form($template, $borrowernumber); >-- >1.7.7.6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13096
:
32475
|
32476
|
33028
|
33158
|
33159
|
33160
|
33161
|
33162
|
40073