|
Lines 39-45
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
Link Here
|
| 39 |
template_name => "opac-sendbasketform.tmpl", |
39 |
template_name => "opac-sendbasketform.tmpl", |
| 40 |
query => $query, |
40 |
query => $query, |
| 41 |
type => "opac", |
41 |
type => "opac", |
| 42 |
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), |
42 |
authnotrequired => 0, |
| 43 |
flagsrequired => { borrow => 1 }, |
43 |
flagsrequired => { borrow => 1 }, |
| 44 |
} |
44 |
} |
| 45 |
); |
45 |
); |
|
Lines 51-61
my $email_sender = $query->param('email_sender');
Link Here
|
| 51 |
my $dbh = C4::Context->dbh; |
51 |
my $dbh = C4::Context->dbh; |
| 52 |
|
52 |
|
| 53 |
if ( $email_add ) { |
53 |
if ( $email_add ) { |
| 54 |
my $email_from = C4::Context->preference('KohaAdminEmailAddress'); |
54 |
my $user = GetMember(borrowernumber => $borrowernumber); |
|
|
55 |
my $user_email = GetFirstValidEmailAddress($borrowernumber) |
| 56 |
|| C4::Context->preference('KohaAdminEmailAddress'); |
| 57 |
|
| 58 |
my $email_from = "$user->{firstname} $user->{surname} <$user_email>"; |
| 55 |
my $comment = $query->param('comment'); |
59 |
my $comment = $query->param('comment'); |
| 56 |
my %mail = ( |
60 |
my %mail = ( |
| 57 |
To => $email_add, |
61 |
To => $email_add, |
| 58 |
From => $email_from |
62 |
From => $email_from, |
|
|
63 |
'X-Orig-IP' => $ENV{'REMOTE_ADDR'}, |
| 64 |
'X-Abuse-Report' => C4::Context->preference('KohaAdminEmailAddress'), |
| 59 |
); |
65 |
); |
| 60 |
|
66 |
|
| 61 |
my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( |
67 |
my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( |
|
Lines 63-69
if ( $email_add ) {
Link Here
|
| 63 |
template_name => "opac-sendbasket.tmpl", |
69 |
template_name => "opac-sendbasket.tmpl", |
| 64 |
query => $query, |
70 |
query => $query, |
| 65 |
type => "opac", |
71 |
type => "opac", |
| 66 |
authnotrequired => 1, |
72 |
authnotrequired => 0, |
| 67 |
flagsrequired => { borrow => 1 }, |
73 |
flagsrequired => { borrow => 1 }, |
| 68 |
} |
74 |
} |
| 69 |
); |
75 |
); |
|
Lines 103-110
if ( $email_add ) {
Link Here
|
| 103 |
|
109 |
|
| 104 |
my $resultsarray = \@results; |
110 |
my $resultsarray = \@results; |
| 105 |
|
111 |
|
| 106 |
my $user = GetMember(borrowernumber => $borrowernumber); |
|
|
| 107 |
|
| 108 |
$template2->param( |
112 |
$template2->param( |
| 109 |
BIBLIO_RESULTS => $resultsarray, |
113 |
BIBLIO_RESULTS => $resultsarray, |
| 110 |
email_sender => $email_sender, |
114 |
email_sender => $email_sender, |
|
Lines 164-177
$isofile
Link Here
|
| 164 |
$boundary-- |
168 |
$boundary-- |
| 165 |
END_OF_BODY |
169 |
END_OF_BODY |
| 166 |
|
170 |
|
| 167 |
# Sending mail |
171 |
# Sending mail (if not empty basket) |
| 168 |
if ( sendmail %mail ) { |
172 |
if ( defined($iso2709) && sendmail %mail ) { |
| 169 |
# do something if it works.... |
173 |
# do something if it works.... |
| 170 |
$template->param( SENT => "1" ); |
174 |
$template->param( SENT => "1" ); |
| 171 |
} |
175 |
} |
| 172 |
else { |
176 |
else { |
| 173 |
# do something if it doesnt work.... |
177 |
# do something if it doesnt work.... |
| 174 |
carp "Error sending mail: $Mail::Sendmail::error \n"; |
178 |
carp "Error sending mail: empty basket" if !defined($iso2709); |
|
|
179 |
carp "Error sending mail: $Mail::Sendmail::error" if $Mail::Sendmail::error; |
| 175 |
$template->param( error => 1 ); |
180 |
$template->param( error => 1 ); |
| 176 |
} |
181 |
} |
| 177 |
$template->param( email_add => $email_add ); |
182 |
$template->param( email_add => $email_add ); |
| 178 |
- |
|
|