From ad5c82626db319c301bdc03a1a9c5e302b4a204a Mon Sep 17 00:00:00 2001 From: acli Date: Tue, 4 Feb 2003 06:01:52 +0000 Subject: [PATCH] Sync to same file in 1.2 branch --- opac/opac-userupdate.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl index a85e31209a..5ef29c43ac 100755 --- a/opac/opac-userupdate.pl +++ b/opac/opac-userupdate.pl @@ -5,6 +5,7 @@ use CGI; use Mail::Sendmail; use C4::Auth; # checkauth, getborrowernumber. +use C4::Context; use C4::Koha; use C4::Circulation::Circ2; use HTML::Template; @@ -29,7 +30,18 @@ my ($borr, $flags) = getpatroninformation(undef, $borrowernumber); # collect the form values and send an email. my @fields = ('title', 'surname', 'firstname', 'phone', 'faxnumber', 'streetaddress', 'emailaddress', 'city'); my $update; -my $updateemailaddress = "finlay\@katipo.co.nz"; #Will have to change this! !!!!!!!!!!!!!!!!!!! +my $updateemailaddress= C4::Context->preference('KohaAdminEmailAddress'); +if ($updateemailaddress eq '') { + warn "KohaAdminEmailAddress system preference not set. Couldn't send patron update information for $borr->{'firstname'} $borr->{'surname'} (#$borrowernumber)\n"; + my $template = gettemplate("kohaerror.tmpl", "opac"); + + $template->param(errormessage => 'KohaAdminEmailAddress system preference + is not set. Please visit the library to update your user record'); + + print $query->header(), $template->output; + exit; +} + if ($query->{'title'}) { # get all the fields: my $message = <<"EOF"; @@ -50,6 +62,7 @@ EOF # do something if it works.... warn "Mail sent ok\n"; print $query->redirect('/cgi-bin/koha/opac-user.pl'); + exit; } else { # do something if it doesnt work.... warn "Error sending mail: $Mail::Sendmail::error \n"; -- 2.39.5