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