3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
25 use C4
::Auth
; # checkauth, getborrowernumber.
30 use C4
::Dates qw
/format_date/;
35 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
37 template_name
=> "opac-userupdate.tmpl",
41 flagsrequired
=> { borrow
=> 1 },
46 # get borrower information ....
47 my ( $borr, $flags ) = GetMemberDetails
( $borrowernumber );
49 # handle the new information....
50 # collect the form values and send an email.
52 'surname', 'firstname', 'phone',
53 'fax', 'address','address2','city','zipcode','phone','mobile','fax','phonepro', 'emailaddress','B_streetaddress','B_city','B_zipcode','dateofbirth','sex'
56 my $updateemailaddress = C4
::Context
->preference('KohaAdminEmailAddress');
57 if ( $updateemailaddress eq '' ) {
59 "KohaAdminEmailAddress system preference not set. Couldn't send patron update information for $borr->{'firstname'} $borr->{'surname'} (#$borrowernumber)\n";
60 my ($template) = get_template_and_user
(
62 template_name
=> "kohaerror.tmpl",
66 flagsrequired
=> { borrow
=> 1 },
72 errormessage
=> 'KohaAdminEmailAddress system preference
73 is not set. Please visit the library to update your user record'
76 output_html_with_http_headers
$query, $cookie, $template->output;
80 if ( $query->{'modify'} ) {
83 my $message = <<"EOF";
84 Borrower $borr->{'cardnumber'}
86 has requested to change her/his personal details.
87 Please check these new details and make the changes:
89 foreach my $field (@fields) {
90 my $newfield = $query->param($field);
91 $message .= "$field : $borr->{$field} --> $newfield\n";
93 $message .= "\n\nThanks,\nKoha\n\n";
95 To
=> $updateemailaddress,
96 From
=> $updateemailaddress,
97 Subject
=> "User Request for update of Record.",
101 if ( sendmail
%mail ) {
103 # do something if it works....
104 warn "Mail sent ok\n";
105 print $query->redirect('/cgi-bin/koha/opac-user.pl?patronupdate=sent');
110 # do something if it doesnt work....
111 warn "Error sending mail: $Mail::Sendmail::error \n";
115 $borr->{'dateenrolled'} = format_date
( $borr->{'dateenrolled'} );
116 $borr->{'expiry'} = format_date
( $borr->{'expiry'} );
117 $borr->{'dateofbirth'} = format_date
( $borr->{'dateofbirth'} );
118 $borr->{'ethnicity'} = fixEthnicity
( $borr->{'ethnicity'} );
124 BORROWER_INFO
=> \
@bordat
127 output_html_with_http_headers
$query, $cookie, $template->output;