7 use C4::Auth; # checkauth, getborrowernumber.
9 use C4::Circulation::Circ2;
15 my ($template, $borrowernumber, $cookie)
16 = get_template_and_user({template_name => "opac-userupdate.tmpl",
20 flagsrequired => {borrow => 1},
24 # get borrower information ....
25 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
28 # handle the new information....
29 # collect the form values and send an email.
30 my @fields = ('title', 'surname', 'firstname', 'phone', 'faxnumber', 'streetaddress', 'emailaddress', 'city');
32 my $updateemailaddress = "finlay\@katipo.co.nz"; #Will have to change this! !!!!!!!!!!!!!!!!!!!
33 if ($query->{'title'}) {
35 my $message = <<"EOF";
36 Borrower $borr->{'cardnumber'} http://intradev.katipo.co.nz/cgi-bin/koha/moremember.pl?bornum=$borrowernumber
38 has requested to change their personal details. Please check these new details and make the changes:
40 foreach my $field (@fields){
41 my $newfield = $query->param($field);
42 $message .= "$field : $borr->{$field} --> $newfield\n";
44 $message .= "\n\nThanks,\nKoha\n\n";
45 my %mail = ( To => $updateemailaddress ,
46 From => $updateemailaddress ,
47 Subject => "User Request for update of Record.",
48 Message => $message );
50 # do something if it works....
51 warn "Mail sent ok\n";
52 print $query->redirect('/cgi-bin/koha/opac-user.pl');
54 # do something if it doesnt work....
55 warn "Error sending mail: $Mail::Sendmail::error \n";
60 $borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
61 $borr->{'expiry'} = slashifyDate($borr->{'expiry'});
62 $borr->{'dateofbirth'} = slashifyDate($borr->{'dateofbirth'});
63 $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'});
69 $template->param(BORROWER_INFO => \@bordat);
71 print $query->header(-cookie => $cookie), $template->output;