|
Lines 28-33
use C4::Output;
Link Here
|
| 28 |
use CGI; |
28 |
use CGI; |
| 29 |
use C4::Acquisition; |
29 |
use C4::Acquisition; |
| 30 |
use C4::Budgets; |
30 |
use C4::Budgets; |
|
|
31 |
use C4::Branch; |
| 31 |
use C4::Bookseller qw( GetBookSellerFromId); |
32 |
use C4::Bookseller qw( GetBookSellerFromId); |
| 32 |
use C4::Debug; |
33 |
use C4::Debug; |
| 33 |
use C4::Biblio; |
34 |
use C4::Biblio; |
|
Lines 80-92
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
Link Here
|
| 80 |
); |
81 |
); |
| 81 |
|
82 |
|
| 82 |
my $basket = GetBasket($basketno); |
83 |
my $basket = GetBasket($basketno); |
|
|
84 |
$booksellerid = $basket->{booksellerid} unless $booksellerid; |
| 85 |
my ($bookseller) = GetBookSellerFromId($booksellerid); |
| 86 |
|
| 87 |
unless (CanUserManageBasket($loggedinuser, $basket, $userflags)) { |
| 88 |
$template->param( |
| 89 |
cannot_manage_basket => 1, |
| 90 |
basketno => $basketno, |
| 91 |
basketname => $basket->{basketname}, |
| 92 |
booksellerid => $booksellerid, |
| 93 |
name => $bookseller->{name} |
| 94 |
); |
| 95 |
output_html_with_http_headers $query, $cookie, $template->output; |
| 96 |
exit; |
| 97 |
} |
| 83 |
|
98 |
|
| 84 |
# FIXME : what about the "discount" percentage? |
99 |
# FIXME : what about the "discount" percentage? |
| 85 |
# FIXME : the query->param('booksellerid') below is probably useless. The bookseller is always known from the basket |
100 |
# FIXME : the query->param('booksellerid') below is probably useless. The bookseller is always known from the basket |
| 86 |
# if no booksellerid in parameter, get it from basket |
101 |
# if no booksellerid in parameter, get it from basket |
| 87 |
# warn "=>".$basket->{booksellerid}; |
102 |
# warn "=>".$basket->{booksellerid}; |
| 88 |
$booksellerid = $basket->{booksellerid} unless $booksellerid; |
|
|
| 89 |
my ($bookseller) = GetBookSellerFromId($booksellerid); |
| 90 |
my $op = $query->param('op'); |
103 |
my $op = $query->param('op'); |
| 91 |
if (!defined $op) { |
104 |
if (!defined $op) { |
| 92 |
$op = q{}; |
105 |
$op = q{}; |
|
Lines 188-193
if ( $op eq 'delete_confirm' ) {
Link Here
|
| 188 |
$basket->{closedate} = undef; |
201 |
$basket->{closedate} = undef; |
| 189 |
ModBasket($basket); |
202 |
ModBasket($basket); |
| 190 |
print $query->redirect('/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'}) |
203 |
print $query->redirect('/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'}) |
|
|
204 |
} elsif ( $op eq 'mod_users' ) { |
| 205 |
my $basketusers_ids = $query->param('basketusers_ids'); |
| 206 |
my @basketusers = split( /:/, $basketusers_ids ); |
| 207 |
ModBasketUsers($basketno, @basketusers); |
| 208 |
print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno"); |
| 209 |
exit; |
| 210 |
} elsif ( $op eq 'mod_branch' ) { |
| 211 |
my $branch = $query->param('branch'); |
| 212 |
$branch = undef if(defined $branch and $branch eq ''); |
| 213 |
ModBasket({ |
| 214 |
basketno => $basket->{basketno}, |
| 215 |
branch => $branch |
| 216 |
}); |
| 217 |
print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno"); |
| 218 |
exit; |
| 191 |
} else { |
219 |
} else { |
| 192 |
# get librarian branch... |
220 |
# get librarian branch... |
| 193 |
if ( C4::Context->preference("IndependantBranches") ) { |
221 |
if ( C4::Context->preference("IndependantBranches") ) { |
|
Lines 203-208
if ( $op eq 'delete_confirm' ) {
Link Here
|
| 203 |
} |
231 |
} |
| 204 |
} |
232 |
} |
| 205 |
} |
233 |
} |
|
|
234 |
# get branches |
| 235 |
my $branches = C4::Branch::GetBranches; |
| 236 |
my @branches_loop; |
| 237 |
foreach my $branch (sort keys %$branches) { |
| 238 |
push @branches_loop, { |
| 239 |
branchcode => $branch, |
| 240 |
branchname => $branches->{$branch}->{branchname}, |
| 241 |
selected => (defined $basket->{branch} and $branch eq $basket->{branch}) ? 1 : 0 |
| 242 |
}; |
| 243 |
} |
| 244 |
|
| 206 |
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups |
245 |
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups |
| 207 |
my $basketgroups; |
246 |
my $basketgroups; |
| 208 |
my $member = GetMember(borrowernumber => $loggedinuser); |
247 |
my $member = GetMember(borrowernumber => $loggedinuser); |
|
Lines 238-243
if ( $op eq 'delete_confirm' ) {
Link Here
|
| 238 |
"loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s", |
277 |
"loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s", |
| 239 |
$basket->{creationdate}, $basket->{authorisedby}; |
278 |
$basket->{creationdate}, $basket->{authorisedby}; |
| 240 |
|
279 |
|
|
|
280 |
my @basketusers_ids = GetBasketUsers($basketno); |
| 281 |
my @basketusers; |
| 282 |
foreach my $basketuser_id (@basketusers_ids) { |
| 283 |
my $basketuser = GetMember(borrowernumber => $basketuser_id); |
| 284 |
push @basketusers, $basketuser if $basketuser; |
| 285 |
} |
| 286 |
|
| 241 |
#to get active currency |
287 |
#to get active currency |
| 242 |
my $cur = GetCurrency(); |
288 |
my $cur = GetCurrency(); |
| 243 |
|
289 |
|
|
Lines 331-337
if ( $op eq 'delete_confirm' ) {
Link Here
|
| 331 |
push @books_loop, \%line; |
377 |
push @books_loop, \%line; |
| 332 |
} |
378 |
} |
| 333 |
|
379 |
|
| 334 |
my $total_est_gste; |
380 |
my $total_est_gste; |
| 335 |
my $total_est_gsti; |
381 |
my $total_est_gsti; |
| 336 |
my $gist_est; |
382 |
my $gist_est; |
| 337 |
if ($gist){ # if we have GST |
383 |
if ($gist){ # if we have GST |
|
Lines 350-358
my $total_est_gste;
Link Here
|
| 350 |
} |
396 |
} |
| 351 |
$gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
397 |
$gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
| 352 |
} else { |
398 |
} else { |
| 353 |
$total_rrp_gsti = $total_rrp; |
399 |
$total_rrp_gsti = $total_rrp; |
| 354 |
$total_est_gsti = $total_rrp_est; |
400 |
$total_est_gsti = $total_rrp_est; |
| 355 |
} |
401 |
} |
| 356 |
|
402 |
|
| 357 |
my $contract = &GetContract($basket->{contractnumber}); |
403 |
my $contract = &GetContract($basket->{contractnumber}); |
| 358 |
my @orders = GetOrders($basketno); |
404 |
my @orders = GetOrders($basketno); |
|
Lines 382-390
my $total_est_gste;
Link Here
|
| 382 |
basketbooksellernote => $basket->{booksellernote}, |
428 |
basketbooksellernote => $basket->{booksellernote}, |
| 383 |
basketcontractno => $basket->{contractnumber}, |
429 |
basketcontractno => $basket->{contractnumber}, |
| 384 |
basketcontractname => $contract->{contractname}, |
430 |
basketcontractname => $contract->{contractname}, |
|
|
431 |
branches_loop => \@branches_loop, |
| 385 |
creationdate => $basket->{creationdate}, |
432 |
creationdate => $basket->{creationdate}, |
| 386 |
authorisedby => $basket->{authorisedby}, |
433 |
authorisedby => $basket->{authorisedby}, |
| 387 |
authorisedbyname => $basket->{authorisedbyname}, |
434 |
authorisedbyname => $basket->{authorisedbyname}, |
|
|
435 |
basketusers_ids => join(':', @basketusers_ids), |
| 436 |
basketusers => \@basketusers, |
| 388 |
closedate => $basket->{closedate}, |
437 |
closedate => $basket->{closedate}, |
| 389 |
estimateddeliverydate=> $estimateddeliverydate, |
438 |
estimateddeliverydate=> $estimateddeliverydate, |
| 390 |
active => $bookseller->{'active'}, |
439 |
active => $bookseller->{'active'}, |