|
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) { |