Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 188 lines (159 sloc) 5.96 kb
a0b06fb @ctfliblime Prepare for perlbrew usage by changing all script magic to "#!/usr/bi…
ctfliblime authored
1 #!/usr/bin/env perl
a367ee8 Add a call to C4::Members & GPL added.
toins authored
2
3 # Copyright 2000-2002 Katipo Communications
4 #
5 # This file is part of Koha.
6 #
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
10 # version.
11 #
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.
15 #
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
19
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
20 use strict;
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
21 use warnings;
4bf76c2 bug 2615: remove unneeded 'require Exporter'
Galen Charlton authored
22
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
23 use CGI;
24 use Mail::Sendmail;
25
fc1342f rel_3_0 moved to HEAD
tipaul authored
26 use C4::Auth; # checkauth, getborrowernumber.
3607caa @ctfliblime Add Koha.pm and include it universally
ctfliblime authored
27 use Koha;
ad5c826 Sync to same file in 1.2 branch
acli authored
28 use C4::Context;
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
29 use C4::Koha;
c596d55 HUGE COMMIT : code cleaning circulation.
tipaul authored
30 use C4::Circulation;
100e6a9 functions that were in C4::Interface::CGI::Output are now in C4::Output.
hdl authored
31 use C4::Output;
71edba6 cleanup for opac/ Dates - missing format_date, etc.
Joshua Ferraro authored
32 use C4::Dates qw/format_date/;
a367ee8 Add a call to C4::Members & GPL added.
toins authored
33 use C4::Members;
8138b6d patron attributes - OPAC display
Galen Charlton authored
34 use C4::Members::Attributes;
76fb49b Send borrower mods to branchemail instead of syspref.
Ryan Higgins authored
35 use C4::Branch;
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
36
37 my $query = new CGI;
38
fc1342f rel_3_0 moved to HEAD
tipaul authored
39 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
40 {
41 template_name => "opac-userupdate.tmpl",
42 query => $query,
43 type => "opac",
44 authnotrequired => 0,
45 flagsrequired => { borrow => 1 },
46 debug => 1,
47 }
48 );
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
49
50 # get borrower information ....
c80b328 clean up old-style calls to GetMemberDetails
Galen Charlton authored
51 my ( $borr ) = GetMemberDetails( $borrowernumber );
76fb49b Send borrower mods to branchemail instead of syspref.
Ryan Higgins authored
52 my $lib = GetBranchDetail($borr->{'branchcode'});
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
53
54 # handle the new information....
55 # collect the form values and send an email.
fc1342f rel_3_0 moved to HEAD
tipaul authored
56 my @fields = (
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
57 'surname','firstname','othernames','streetaddress','city','zipcode','country','phone','mobile','fax','phonepro', 'emailaddress','emailpro','B_streetnumber','B_streetaddress','B_city','B_zipcode','B_country','B_phone','B_email','dateofbirth','sex'
fc1342f rel_3_0 moved to HEAD
tipaul authored
58 );
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
59 my $update;
76fb49b Send borrower mods to branchemail instead of syspref.
Ryan Higgins authored
60 my $updateemailaddress = $lib->{'branchemail'};
61 $updateemailaddress = C4::Context->preference('KohaAdminEmailAddress') unless( $updateemailaddress =~ /\w+@\w+/);
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
62 if ( !$updateemailaddress || $updateemailaddress eq '' ) {
fc1342f rel_3_0 moved to HEAD
tipaul authored
63 warn
64 "KohaAdminEmailAddress system preference not set. Couldn't send patron update information for $borr->{'firstname'} $borr->{'surname'} (#$borrowernumber)\n";
65 my ($template) = get_template_and_user(
66 {
67 template_name => "kohaerror.tmpl",
68 query => $query,
69 type => "opac",
70 authnotrequired => 1,
71 flagsrequired => { borrow => 1 },
72 debug => 1,
73 }
74 );
75
76 $template->param(
04d2b67 @oleonard Moving the text of an error message from the script to the template w…
oleonard authored
77 noadminemail => 1,
fc1342f rel_3_0 moved to HEAD
tipaul authored
78 );
ad5c826 Sync to same file in 1.2 branch
acli authored
79
ddc6ead Updated opac-userupdate.pl to work with 1.3
acli authored
80 output_html_with_http_headers $query, $cookie, $template->output;
ad5c826 Sync to same file in 1.2 branch
acli authored
81 exit;
82 }
83
5aeb6f7 @oleonard Correction to enable sending of update emails.
oleonard authored
84 if ( $query->param('modify') ) {
fc1342f rel_3_0 moved to HEAD
tipaul authored
85
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
86 # get all the fields:
87 my $message = <<"EOF";
ddc6ead Updated opac-userupdate.pl to work with 1.3
acli authored
88 Borrower $borr->{'cardnumber'}
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
89
ddc6ead Updated opac-userupdate.pl to work with 1.3
acli authored
90 has requested to change her/his personal details.
91 Please check these new details and make the changes:
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
92 EOF
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
93
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
94 my $streetnumber = $borr->{'streetnumber'} || '';
95 my $address = $borr->{'address'} || '';
96 my $address2 = $borr->{'address2'} || '';
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
97 my $B_streetnumber = $borr->{'B_streetnumber'} || '';
98 my $B_address = $borr->{'B_address'} || '';
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
99 my $B_address2 = $borr->{'B_address2'} || '';
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
100
fc1342f rel_3_0 moved to HEAD
tipaul authored
101 foreach my $field (@fields) {
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
102 my $newfield = $query->param($field) || '';
103 my $borrowerfield = '';
104 if($borr->{$field}) {
105 $borrowerfield = $borr->{$field};
106 }
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
107
108 # reconstruct the address
109 if($field eq "streetaddress") {
110 $borrowerfield = "$streetnumber $address, $address2";
111 }
112
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
113 # reconstruct the alternate address
114 if($field eq "B_streetaddress") {
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
115 $borrowerfield = "$B_streetnumber $B_address, $B_address2";
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
116 }
448ad31 @nengard Bugs: 1172 3579 3596 fixes to patron detail in opac
nengard authored
117
90d1248 @gcollum Bug 2505: Enabled warnings in opac-userupdate.pl
gcollum authored
118 if($field eq "dateofbirth") {
119 $borrowerfield = format_date( $borr->{'dateofbirth'} ) || '';
120 }
121
122 if($borrowerfield eq $newfield) {
123 $message .= "$field : $borrowerfield --> $newfield\n";
124 } else {
125 $message .= uc($field) . " : $borrowerfield --> $newfield\n";
126 }
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
127 }
128 $message .= "\n\nThanks,\nKoha\n\n";
fc1342f rel_3_0 moved to HEAD
tipaul authored
129 my %mail = (
130 To => $updateemailaddress,
131 From => $updateemailaddress,
132 Subject => "User Request for update of Record.",
dfcdc73 @PaulPoulain bugfix : ship utf-8 encoding in mail header
PaulPoulain authored
133 Message => $message,
134 'Content-Type' => 'text/plain; charset="utf8"',
fc1342f rel_3_0 moved to HEAD
tipaul authored
135 );
136
137 if ( sendmail %mail ) {
138
139 # do something if it works....
140 warn "Mail sent ok\n";
4c832dc @oleonard Adding redirect parameter to opac-userupdate.pl so that message can b…
oleonard authored
141 print $query->redirect('/cgi-bin/koha/opac-user.pl?patronupdate=sent');
fc1342f rel_3_0 moved to HEAD
tipaul authored
142 exit;
143 }
144 else {
145
146 # do something if it doesnt work....
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
147 warn "Error sending mail: $Mail::Sendmail::error \n";
148 }
5aa0fca Removed trailing whitespace.
arensb authored
149 }
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
150
fc1342f rel_3_0 moved to HEAD
tipaul authored
151 $borr->{'dateenrolled'} = format_date( $borr->{'dateenrolled'} );
8e8f1a0 @oleonard Show card number (non-editable) on opac-userupdate.pl. Also correctly…
oleonard authored
152 $borr->{'dateexpiry'} = format_date( $borr->{'dateexpiry'} );
fc1342f rel_3_0 moved to HEAD
tipaul authored
153 $borr->{'dateofbirth'} = format_date( $borr->{'dateofbirth'} );
154 $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} );
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
155
8138b6d patron attributes - OPAC display
Galen Charlton authored
156 if (C4::Context->preference('ExtendedPatronAttributes')) {
157 my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber, 'opac');
158 if (scalar(@$attributes) > 0) {
159 $borr->{ExtendedPatronAttributes} = 1;
160 $borr->{patron_attributes} = $attributes;
161 }
162 }
163
65b0ca3 Messaging Preferences for OPAC
John Beppu authored
164 my $checkin_prefs = C4::Members::Messaging::GetMessagingPreferences({
165 borrowernumber => $borrowernumber,
166 message_name => 'Item Checkout'
167 });
168 for (@{ $checkin_prefs->{transports} }) {
169 $borr->{"items_returned_$_"} = 1;
170 }
171 my $checkout_prefs = C4::Members::Messaging::GetMessagingPreferences({
172 borrowernumber => $borrowernumber,
173 message_name => 'Item Check-in'
174 });
175 for (@{ $checkout_prefs->{transports} }) {
176 $borr->{"items_borrowed_$_"} = 1;
177 }
178
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
179 my @bordat;
180 $bordat[0] = $borr;
181
fc1342f rel_3_0 moved to HEAD
tipaul authored
182 $template->param(
0f1825d @oleonard Changes to allow highlighting of current tab on user pages.
oleonard authored
183 BORROWER_INFO => \@bordat,
184 userupdateview => 1,
7ed4e50 Added Paul's LibraryName variable to template
oleonard authored
185 );
6007e1e added these files from the rel-1-2 branch. This is the beging of the …
finlayt authored
186
52a5fd4 Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
acli authored
187 output_html_with_http_headers $query, $cookie, $template->output;
Something went wrong with that request. Please try again.