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 68-74
my $query = new CGI;
Link Here
|
68 |
my $basketno = $query->param('basketno'); |
69 |
my $basketno = $query->param('basketno'); |
69 |
my $booksellerid = $query->param('booksellerid'); |
70 |
my $booksellerid = $query->param('booksellerid'); |
70 |
|
71 |
|
71 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
72 |
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( |
72 |
{ |
73 |
{ |
73 |
template_name => "acqui/basket.tmpl", |
74 |
template_name => "acqui/basket.tmpl", |
74 |
query => $query, |
75 |
query => $query, |
Lines 80-92
my ( $template, $loggedinuser, $cookie ) = 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 181-186
if ( $op eq 'delete_confirm' ) {
Link Here
|
181 |
$basket->{closedate} = undef; |
194 |
$basket->{closedate} = undef; |
182 |
ModBasket($basket); |
195 |
ModBasket($basket); |
183 |
print $query->redirect('/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'}) |
196 |
print $query->redirect('/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'}) |
|
|
197 |
} elsif ( $op eq 'mod_users' ) { |
198 |
my $basketusers_ids = $query->param('basketusers_ids'); |
199 |
my @basketusers = split( /:/, $basketusers_ids ); |
200 |
ModBasketUsers($basketno, @basketusers); |
201 |
print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno"); |
202 |
exit; |
203 |
} elsif ( $op eq 'mod_branch' ) { |
204 |
my $branch = $query->param('branch'); |
205 |
$branch = undef if(defined $branch and $branch eq ''); |
206 |
ModBasket({ |
207 |
basketno => $basket->{basketno}, |
208 |
branch => $branch |
209 |
}); |
210 |
print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno"); |
211 |
exit; |
184 |
} else { |
212 |
} else { |
185 |
# get librarian branch... |
213 |
# get librarian branch... |
186 |
if ( C4::Context->preference("IndependantBranches") ) { |
214 |
if ( C4::Context->preference("IndependantBranches") ) { |
Lines 196-201
if ( $op eq 'delete_confirm' ) {
Link Here
|
196 |
} |
224 |
} |
197 |
} |
225 |
} |
198 |
} |
226 |
} |
|
|
227 |
# get branches |
228 |
my $branches = C4::Branch::GetBranches; |
229 |
my @branches_loop; |
230 |
foreach my $branch (sort keys %$branches) { |
231 |
push @branches_loop, { |
232 |
branchcode => $branch, |
233 |
branchname => $branches->{$branch}->{branchname}, |
234 |
selected => (defined $basket->{branch} and $branch eq $basket->{branch}) ? 1 : 0 |
235 |
}; |
236 |
} |
237 |
|
199 |
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups |
238 |
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups |
200 |
my $basketgroups; |
239 |
my $basketgroups; |
201 |
my $member = GetMember(borrowernumber => $loggedinuser); |
240 |
my $member = GetMember(borrowernumber => $loggedinuser); |
Lines 231-236
if ( $op eq 'delete_confirm' ) {
Link Here
|
231 |
"loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s", |
270 |
"loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s", |
232 |
$basket->{creationdate}, $basket->{authorisedby}; |
271 |
$basket->{creationdate}, $basket->{authorisedby}; |
233 |
|
272 |
|
|
|
273 |
my @basketusers_ids = GetBasketUsers($basketno); |
274 |
my @basketusers; |
275 |
foreach my $basketuser_id (@basketusers_ids) { |
276 |
my $basketuser = GetMember(borrowernumber => $basketuser_id); |
277 |
push @basketusers, $basketuser if $basketuser; |
278 |
} |
279 |
|
234 |
#to get active currency |
280 |
#to get active currency |
235 |
my $cur = GetCurrency(); |
281 |
my $cur = GetCurrency(); |
236 |
|
282 |
|
Lines 324-330
if ( $op eq 'delete_confirm' ) {
Link Here
|
324 |
push @books_loop, \%line; |
370 |
push @books_loop, \%line; |
325 |
} |
371 |
} |
326 |
|
372 |
|
327 |
my $total_est_gste; |
373 |
my $total_est_gste; |
328 |
my $total_est_gsti; |
374 |
my $total_est_gsti; |
329 |
my $gist_est; |
375 |
my $gist_est; |
330 |
if ($gist){ # if we have GST |
376 |
if ($gist){ # if we have GST |
Lines 343-351
my $total_est_gste;
Link Here
|
343 |
} |
389 |
} |
344 |
$gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
390 |
$gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
345 |
} else { |
391 |
} else { |
346 |
$total_rrp_gsti = $total_rrp; |
392 |
$total_rrp_gsti = $total_rrp; |
347 |
$total_est_gsti = $total_rrp_est; |
393 |
$total_est_gsti = $total_rrp_est; |
348 |
} |
394 |
} |
349 |
|
395 |
|
350 |
my $contract = &GetContract($basket->{contractnumber}); |
396 |
my $contract = &GetContract($basket->{contractnumber}); |
351 |
my @orders = GetOrders($basketno); |
397 |
my @orders = GetOrders($basketno); |
Lines 373-381
my $total_est_gste;
Link Here
|
373 |
basketbooksellernote => $basket->{booksellernote}, |
419 |
basketbooksellernote => $basket->{booksellernote}, |
374 |
basketcontractno => $basket->{contractnumber}, |
420 |
basketcontractno => $basket->{contractnumber}, |
375 |
basketcontractname => $contract->{contractname}, |
421 |
basketcontractname => $contract->{contractname}, |
|
|
422 |
branches_loop => \@branches_loop, |
376 |
creationdate => $basket->{creationdate}, |
423 |
creationdate => $basket->{creationdate}, |
377 |
authorisedby => $basket->{authorisedby}, |
424 |
authorisedby => $basket->{authorisedby}, |
378 |
authorisedbyname => $basket->{authorisedbyname}, |
425 |
authorisedbyname => $basket->{authorisedbyname}, |
|
|
426 |
basketusers_ids => join(':', @basketusers_ids), |
427 |
basketusers => \@basketusers, |
379 |
closedate => $basket->{closedate}, |
428 |
closedate => $basket->{closedate}, |
380 |
estimateddeliverydate=> $estimateddeliverydate, |
429 |
estimateddeliverydate=> $estimateddeliverydate, |
381 |
active => $bookseller->{'active'}, |
430 |
active => $bookseller->{'active'}, |