7 use C4::Output; # gettemplate
8 use C4::Auth; # checkauth, getborrowernumber.
10 use C4::Circulation::Circ2;
15 my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
17 # get borrower information ....
18 my $borrowernumber = getborrowernumber($loggedinuser);
19 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
22 # handle the new information....
23 # collect the form values and send an email.
24 my @fields = ('title', 'surname', 'firstname', 'phone', 'faxnumber', 'streetaddress', 'emailaddress', 'city');
26 my $updateemailaddress = "finlay\@katipo.co.nz"; #Will have to change this! !!!!!!!!!!!!!!!!!!!
27 if ($query->{'title'}) {
29 my $message = <<"EOF";
30 Borrower $borr->{'cardnumber'} http://intradev.katipo.co.nz/cgi-bin/koha/moremember.pl?bornum=$borrowernumber
32 has requested to change their personal details. Please check these new details and make the changes:
34 foreach my $field (@fields){
35 my $newfield = $query->param($field);
36 $message .= "$field : $borr->{$field} --> $newfield\n";
38 $message .= "\n\nThanks,\nKoha\n\n";
39 my %mail = ( To => $updateemailaddress ,
40 From => $updateemailaddress ,
41 Subject => "User Request for update of Record.",
42 Message => $message );
44 # do something if it works....
45 warn "Mail sent ok\n";
46 print $query->redirect('/cgi-bin/koha/opac-user.pl');
48 # do something if it doesnt work....
49 warn "Error sending mail: $Mail::Sendmail::error \n";
53 my $template = gettemplate("opac-userupdate.tmpl", "opac");
56 $borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
57 $borr->{'expiry'} = slashifyDate($borr->{'expiry'});
58 $borr->{'dateofbirth'} = slashifyDate($borr->{'dateofbirth'});
59 $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'});
65 $template->param(BORROWER_INFO => \@bordat);
68 $template->param(loggedinuser => $loggedinuser);
70 print "Content-Type: text/html\n\n", $template->output;