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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt (-1 / +7 lines)
Lines 22-28 Link Here
22
22
23
                            [% IF ( error ) %]
23
                            [% IF ( error ) %]
24
                                <div class="alert alert-warning">
24
                                <div class="alert alert-warning">
25
                                    <p>There was an error sending the cart.</p>
25
                                    [% IF error == 'NO_BODY' %]
26
                                        <p>There was an error sending the cart: No valid biblio records found.</p>
27
                                    [% ELSIF error == 'NO_REPLY_ADDRESS' %]
28
                                        <p>Since we do not have your email address, we cannot send a mail. We need your email address as reply-to address.</p>
29
                                    [% ELSE %]
30
                                        <p>There was an error sending the cart.</p>
31
                                    [% END %]
26
                                </div>
32
                                </div>
27
                            [% END %]
33
                            [% END %]
28
34
(-)a/opac/opac-sendbasket.pl (-19 / +12 lines)
Lines 21-33 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use Encode;
23
use Encode;
24
use Carp qw( carp );
25
use Try::Tiny qw( catch try );
26
24
27
use C4::Biblio qw(
25
use C4::Auth   qw( get_template_and_user );
28
  GetMarcSubjects
26
use C4::Biblio qw(GetMarcSubjects);
29
);
30
use C4::Auth qw( get_template_and_user );
31
use C4::Output qw( output_html_with_http_headers );
27
use C4::Output qw( output_html_with_http_headers );
32
use C4::Templates;
28
use C4::Templates;
33
use Koha::Biblios;
29
use Koha::Biblios;
Lines 44-54 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
44
        type          => "opac",
40
        type          => "opac",
45
    }
41
    }
46
);
42
);
43
my $patron     = Koha::Patrons->find($borrowernumber);
44
my $user_email = $patron ? $patron->notice_email_address : undef;
47
45
48
my $bib_list  = $query->param('bib_list') || '';
46
my $bib_list  = $query->param('bib_list') || '';
49
my $email_add = $query->param('email_add');
47
my $email_add = $query->param('email_add');
50
48
51
if ( $email_add ) {
49
if ( $email_add && $user_email ) {
52
    die "Wrong CSRF token"
50
    die "Wrong CSRF token"
53
      unless Koha::Token->new->check_csrf(
51
      unless Koha::Token->new->check_csrf(
54
        {
52
        {
Lines 57-65 if ( $email_add ) { Link Here
57
        }
55
        }
58
      );
56
      );
59
57
60
    my $patron     = Koha::Patrons->find($borrowernumber);
61
    my $user_email = $patron->notice_email_address;
62
63
    my $comment = $query->param('comment');
58
    my $comment = $query->param('comment');
64
59
65
    my @bibs = split( /\//, $bib_list );
60
    my @bibs = split( /\//, $bib_list );
Lines 70-81 if ( $email_add ) { Link Here
70
    }
65
    }
71
66
72
    if ( !defined $iso2709 ) {
67
    if ( !defined $iso2709 ) {
73
        carp "Error sending mail: empty basket";
68
        $template->param( error => 'NO_BODY' );
74
        $template->param( error => 1 );
75
    }
76
    elsif ( !defined $user_email or $user_email eq '' ) {
77
        carp "Error sending mail: sender's email address is invalid";
78
        $template->param( error => 1 );
79
    }
69
    }
80
    else {
70
    else {
81
        my %loops = ( biblio => \@bibs, );
71
        my %loops = ( biblio => \@bibs, );
Lines 118-125 if ( $email_add ) { Link Here
118
    $template->param( email_add => $email_add );
108
    $template->param( email_add => $email_add );
119
    output_html_with_http_headers $query, $cookie, $template->output, undef,
109
    output_html_with_http_headers $query, $cookie, $template->output, undef,
120
      { force_no_caching => 1 };
110
      { force_no_caching => 1 };
121
}
111
122
else {
112
} elsif( !$user_email ) {
113
    $template->param( email_add => 1, error => 'NO_REPLY_ADDRESS' );
114
    output_html_with_http_headers $query, $cookie, $template->output;
115
116
} else {
123
    my $new_session_id = $query->cookie('CGISESSID');
117
    my $new_session_id = $query->cookie('CGISESSID');
124
    $template->param(
118
    $template->param(
125
        bib_list       => $bib_list,
119
        bib_list       => $bib_list,
126
- 

Return to bug 35969