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 (-20 / +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 43-58 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
43
        type          => "opac",
39
        type          => "opac",
44
    }
40
    }
45
);
41
);
42
my $patron     = Koha::Patrons->find($borrowernumber);
43
my $user_email = $patron ? $patron->notice_email_address : undef;
46
44
47
my $op        = $query->param('op') || q{};
45
my $op        = $query->param('op') || q{};
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 ( $op eq "cud-send" && $email_add ) {
49
if ( $op eq "cud-send" && $email_add && $user_email ) {
52
53
    my $patron     = Koha::Patrons->find($borrowernumber);
54
    my $user_email = $patron->notice_email_address;
55
56
    my $comment = $query->param('comment');
50
    my $comment = $query->param('comment');
57
51
58
    my @bibs = split( /\//, $bib_list );
52
    my @bibs = split( /\//, $bib_list );
Lines 63-74 if ( $op eq "cud-send" && $email_add ) { Link Here
63
    }
57
    }
64
58
65
    if ( !defined $iso2709 ) {
59
    if ( !defined $iso2709 ) {
66
        carp "Error sending mail: empty basket";
60
        $template->param( error => 'NO_BODY' );
67
        $template->param( error => 1 );
68
    }
69
    elsif ( !defined $user_email or $user_email eq '' ) {
70
        carp "Error sending mail: sender's email address is invalid";
71
        $template->param( error => 1 );
72
    }
61
    }
73
    else {
62
    else {
74
        my %loops = ( biblio => \@bibs, );
63
        my %loops = ( biblio => \@bibs, );
Lines 111-118 if ( $op eq "cud-send" && $email_add ) { Link Here
111
    $template->param( email_add => $email_add );
100
    $template->param( email_add => $email_add );
112
    output_html_with_http_headers $query, $cookie, $template->output, undef,
101
    output_html_with_http_headers $query, $cookie, $template->output, undef,
113
      { force_no_caching => 1 };
102
      { force_no_caching => 1 };
114
}
103
115
else {
104
} elsif( !$user_email ) {
105
    $template->param( email_add => 1, error => 'NO_REPLY_ADDRESS' );
106
    output_html_with_http_headers $query, $cookie, $template->output;
107
108
} else {
116
    my $new_session_id = $query->cookie('CGISESSID');
109
    my $new_session_id = $query->cookie('CGISESSID');
117
    $template->param(
110
    $template->param(
118
        bib_list       => $bib_list,
111
        bib_list       => $bib_list,
119
- 

Return to bug 35969