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

(-)a/acqui/basket.pl (-21 / +14 lines)
Lines 108-124 unless (CanUserManageBasket($loggedinuser, $basket, $userflags)) { Link Here
108
# FIXME : the query->param('booksellerid') below is probably useless. The bookseller is always known from the basket
108
# FIXME : the query->param('booksellerid') below is probably useless. The bookseller is always known from the basket
109
# if no booksellerid in parameter, get it from basket
109
# if no booksellerid in parameter, get it from basket
110
# warn "=>".$basket->{booksellerid};
110
# warn "=>".$basket->{booksellerid};
111
my $op = $query->param('op');
111
my $op = $query->param('op') // 'list';
112
if (!defined $op) {
113
    $op = q{};
114
}
115
112
116
my $confirm_pref= C4::Context->preference("BasketConfirmations") || '1';
113
my $confirm_pref= C4::Context->preference("BasketConfirmations") || '1';
117
$template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2';
114
$template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2';
118
115
119
$template->param( email_ok => 1 ) if defined $query->param('email_ok');
116
my @messages;
120
$template->param( email_error => $query->param('email_error') ) if defined $query->param('email_error');
121
122
117
123
if ( $op eq 'delete_confirm' ) {
118
if ( $op eq 'delete_confirm' ) {
124
    my $basketno = $query->param('basketno');
119
    my $basketno = $query->param('basketno');
Lines 170-191 if ( $op eq 'delete_confirm' ) { Link Here
170
    print GetBasketAsCSV($query->param('basketno'), $query);
165
    print GetBasketAsCSV($query->param('basketno'), $query);
171
    exit;
166
    exit;
172
} elsif ($op eq 'email') {
167
} elsif ($op eq 'email') {
173
    my $redirect_url = '/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'};
168
    my $err = eval {
174
    my $err;
169
        SendAlerts( 'orderacquisition', $query->param('basketno'), 'ACQORDER' );
175
176
    eval {
177
        $err = SendAlerts( 'orderacquisition', $query->param('basketno'), 'ACQORDER' );
178
    };
170
    };
179
    if ( $@ ) {
171
    if ( $@ ) {
180
    $redirect_url .= '&email_error='.$@;
172
        push @messages, { type => 'error', code => $@ };
181
    } elsif ( ref $err and exists $err->{error} ) {
173
    } elsif ( ref $err and exists $err->{error} ) {
182
        $redirect_url .= '&email_error=' . $err->{error};
174
        push @messages, { type => 'error', code => $err->{error} };
183
    } else {
175
    } else {
184
        $redirect_url .= '&email_ok=1';
176
        push @messages, { type => 'message', code => 'email_sent' };
185
    }
177
    }
186
178
187
    print $query->redirect($redirect_url)
179
    $op = 'list';
188
189
} elsif ($op eq 'close') {
180
} elsif ($op eq 'close') {
190
    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
181
    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
191
    if ($confirm) {
182
    if ($confirm) {
Lines 242-248 elsif ( $op eq 'ediorder' ) { Link Here
242
    });
233
    });
243
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
234
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
244
    exit;
235
    exit;
245
} else {
236
}
237
238
if ( $op eq 'list' ) {
246
    my @branches_loop;
239
    my @branches_loop;
247
    # get librarian branch...
240
    # get librarian branch...
248
    if ( C4::Context->preference("IndependentBranches") ) {
241
    if ( C4::Context->preference("IndependentBranches") ) {
Lines 427-432 elsif ( $op eq 'ediorder' ) { Link Here
427
    );
420
    );
428
}
421
}
429
422
423
$template->param( messages => \@messages );
424
output_html_with_http_headers $query, $cookie, $template->output;
425
430
sub get_order_infos {
426
sub get_order_infos {
431
    my $order = shift;
427
    my $order = shift;
432
    my $bookseller = shift;
428
    my $bookseller = shift;
Lines 502-510 sub get_order_infos { Link Here
502
    return \%line;
498
    return \%line;
503
}
499
}
504
500
505
output_html_with_http_headers $query, $cookie, $template->output;
506
507
508
sub edi_close_and_order {
501
sub edi_close_and_order {
509
    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
502
    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
510
    if ($confirm) {
503
    if ($confirm) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-15 / +14 lines)
Lines 295-316 Link Here
295
            [% END %]
295
            [% END %]
296
        [% ELSE %]
296
        [% ELSE %]
297
297
298
        [% IF email_error %]
298
        [% FOR m IN messages %]
299
            <div class="dialog alert">
299
            <div class="dialog [% m.type %]">
300
            [% IF ( email_error == "no_email" ) %]
300
                [% SWITCH m.code %]
301
                This vendor has no contact selected for sending orders to or is missing an e-mail address.
301
                [% CASE 'no_email' %]
302
            [% ELSIF ( email_error == "no_basketno" ) %]
302
                    This vendor has no contact selected for sending orders to or is missing an e-mail address.
303
                No basket given.
303
                [% CASE 'no_basketno' %]
304
            [% ELSIF ( email_error == "no_letter" ) %]
304
                    No basket given.
305
                There is no notice template with code ACQORDER defined.
305
                [% CASE 'no_letter' %]
306
            [% ELSE %]
306
                    There is no notice template with code ACQORDER defined.
307
                ERROR! - [% email_error %]
307
                [% CASE 'email_sent' %]
308
            [% END %]
308
                    Order e-mail was sent to the vendor.
309
                [% CASE %]
310
                    ERROR! - [% m.code %]
311
                [% END %]
309
            </div>
312
            </div>
310
        [% END %]
313
        [% END %]
311
        [% IF ( email_ok ) %]
312
            <div class="dialog message">Order e-mail was sent to the vendor.</div>
313
        [% END %]
314
        <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
314
        <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
315
        [% IF ( basketno ) %]
315
        [% IF ( basketno ) %]
316
            <div id="acqui_basket_summary" class="yui-g">
316
            <div id="acqui_basket_summary" class="yui-g">
317
- 

Return to bug 5260