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