From: Liz Rea Date: Wed, 14 Sep 2011 19:56:03 +0000 (-0500) Subject: Bug 6870 [enh] - allow opac-userupdate.pl to use the patron's email as 'from' address X-Git-Url: http://git.rot13.org/?p=koha.git;a=commitdiff_plain;h=0920d96767f1e366670e87b5d4275c5473595d52 Bug 6870 [enh] - allow opac-userupdate.pl to use the patron's email as 'from' address Patch makes it so that Koha sends patron update emails from the first valid patron email address, instead of from the KohaAdmin or branch email address. This patch should make it so that libraries can directly reply to patrons regarding patron updates. To test: Create a patron with no email address, do a patron update and observe the to: and from: - they should both be the KohaAdminEmail address. Add an email address to that same patron, and send a patron update. Observe the to: and from: - the from: should be the first valid email address of the patron, to should be the KohaAdminEmail address. Signed-off-by: Owen Leonard Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl index aa5858a9f7..f8273ce9c8 100755 --- a/opac/opac-userupdate.pl +++ b/opac/opac-userupdate.pl @@ -48,6 +48,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( # get borrower information .... my ( $borr ) = GetMemberDetails( $borrowernumber ); +my ( $patronemail ) = GetFirstValidEmailAddress($borrowernumber); my $lib = GetBranchDetail($borr->{'branchcode'}); # handle the new information.... @@ -80,6 +81,10 @@ if ( !$updateemailaddress || $updateemailaddress eq '' ) { exit; } +if ( !$patronemail || $patronemail eq '' ) { + $patronemail = $updateemailaddress; +}; + if ( $query->param('modify') ) { # get all the fields: @@ -117,7 +122,7 @@ EOF $message .= "\n\nThanks,\nKoha\n\n"; my %mail = ( To => $updateemailaddress, - From => $updateemailaddress, + From => $patronemail, Subject => "User Request for update of Record.", Message => $message, 'Content-Type' => 'text/plain; charset="utf8"',