View | Details | Raw Unified | Return to bug 3280
Collapse All | Expand All

(-)a/opac/opac-sendbasket.pl (-9 / +15 lines)
Lines 54-64 my $email_sender = $query->param('email_sender'); Link Here
54
my $dbh          = C4::Context->dbh;
54
my $dbh          = C4::Context->dbh;
55
55
56
if ( $email_add ) {
56
if ( $email_add ) {
57
    my $user = GetMember(borrowernumber => $borrowernumber);
58
    my $user_email = GetFirstValidEmailAddress($borrowernumber)
59
    || C4::Context->preference('KohaAdminEmailAddress');
60
57
    my $email_from = C4::Context->preference('KohaAdminEmailAddress');
61
    my $email_from = C4::Context->preference('KohaAdminEmailAddress');
62
    my $email_replyto = "$user->{firstname} $user->{surname} <$user_email>";
58
    my $comment    = $query->param('comment');
63
    my $comment    = $query->param('comment');
59
    my %mail = (
64
    my %mail = (
60
        To   => $email_add,
65
        To   => $email_add,
61
        From => $email_from
66
        From => $email_from,
67
    'Reply-To' => $email_replyto,
68
    'X-Orig-IP' => $ENV{'REMOTE_ADDR'},
69
    'X-Abuse-Report' => C4::Context->preference('KohaAdminEmailAddress'),
62
    );
70
    );
63
71
64
    my ( $template2, $borrowernumber, $cookie ) = get_template_and_user(
72
    my ( $template2, $borrowernumber, $cookie ) = get_template_and_user(
Lines 66-72 if ( $email_add ) { Link Here
66
            template_name   => "opac-sendbasket.tmpl",
74
            template_name   => "opac-sendbasket.tmpl",
67
            query           => $query,
75
            query           => $query,
68
            type            => "opac",
76
            type            => "opac",
69
            authnotrequired => 1,
77
            authnotrequired => 0,
70
            flagsrequired   => { borrow => 1 },
78
            flagsrequired   => { borrow => 1 },
71
        }
79
        }
72
    );
80
    );
Lines 106-113 if ( $email_add ) { Link Here
106
114
107
    my $resultsarray = \@results;
115
    my $resultsarray = \@results;
108
    
116
    
109
    my $user = GetMember(borrowernumber => $borrowernumber); 
110
    
111
    $template2->param(
117
    $template2->param(
112
        BIBLIO_RESULTS => $resultsarray,
118
        BIBLIO_RESULTS => $resultsarray,
113
        email_sender   => $email_sender,
119
        email_sender   => $email_sender,
Lines 162-175 $isofile Link Here
162
$boundary--
168
$boundary--
163
END_OF_BODY
169
END_OF_BODY
164
170
165
    # Sending mail
171
    # Sending mail (if not empty basket)
166
    if ( sendmail %mail ) {
172
    if ( defined($iso2709) && sendmail %mail ) {
167
        # do something if it works....
173
    # do something if it works....
168
        $template->param( SENT      => "1" );
174
        $template->param( SENT      => "1" );
169
    }
175
    }
170
    else {
176
    else {
171
        # do something if it doesnt work....
177
        # do something if it doesnt work....
172
        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;
173
        $template->param( error => 1 );
180
        $template->param( error => 1 );
174
    }
181
    }
175
    $template->param( email_add => $email_add );
182
    $template->param( email_add => $email_add );
176
- 

Return to bug 3280