|
Lines 53-58
use CGI;
Link Here
|
| 53 |
use C4::Bookseller qw/GetBookSellerFromId/; |
53 |
use C4::Bookseller qw/GetBookSellerFromId/; |
| 54 |
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket/; |
54 |
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket/; |
| 55 |
use C4::Bookseller qw/GetBookSellerFromId/; |
55 |
use C4::Bookseller qw/GetBookSellerFromId/; |
|
|
56 |
use C4::Branch qw/GetBranches/; |
| 57 |
use C4::Members qw/GetMember/; |
| 56 |
|
58 |
|
| 57 |
my $input=new CGI; |
59 |
my $input=new CGI; |
| 58 |
|
60 |
|
|
Lines 268-281
if ( $op eq "add" ) {
Link Here
|
| 268 |
} |
270 |
} |
| 269 |
} else { |
271 |
} else { |
| 270 |
my $basketgroupid = $input->param('basketgroupid'); |
272 |
my $basketgroupid = $input->param('basketgroupid'); |
| 271 |
if($basketgroupid){ |
273 |
my $branchcode; |
|
|
274 |
if ( $basketgroupid ) { |
| 275 |
# Get the selected baskets in the basketgroup to display them |
| 272 |
my $selecteds = GetBasketsByBasketgroup($basketgroupid); |
276 |
my $selecteds = GetBasketsByBasketgroup($basketgroupid); |
| 273 |
foreach (@{$selecteds}){ |
277 |
foreach (@{$selecteds}){ |
| 274 |
$_->{total} = BasketTotal($_->{basketno}, $_); |
278 |
$_->{total} = BasketTotal($_->{basketno}, $_); |
| 275 |
} |
279 |
} |
| 276 |
$template->param(basketgroupid => $basketgroupid, |
280 |
$template->param(basketgroupid => $basketgroupid, |
| 277 |
selectedbaskets => $selecteds); |
281 |
selectedbaskets => $selecteds); |
|
|
282 |
|
| 283 |
# Get general informations about the basket group to prefill the form |
| 284 |
my $basketgroup = GetBasketgroup($basketgroupid); |
| 285 |
$template->param( |
| 286 |
name => $basketgroup->{name}, |
| 287 |
deliverycomment => $basketgroup->{deliverycomment}, |
| 288 |
); |
| 289 |
$branchcode = $basketgroup->{deliveryplace}; |
| 290 |
} |
| 291 |
|
| 292 |
# Build the combobox to select the delivery place |
| 293 |
my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) ); |
| 294 |
my $branch = $branchcode || $borrower->{'branchcode'}; |
| 295 |
my $branches = GetBranches; |
| 296 |
my @branchloop; |
| 297 |
foreach my $thisbranch (sort keys %$branches) { |
| 298 |
my $selected = 1 if $thisbranch eq $branch; |
| 299 |
my %row = ( |
| 300 |
value => $thisbranch, |
| 301 |
selected => $selected, |
| 302 |
branchname => $branches->{$thisbranch}->{branchname}, |
| 303 |
); |
| 304 |
push @branchloop, \%row; |
| 278 |
} |
305 |
} |
|
|
306 |
$template->param( branchloop => \@branchloop ); |
| 307 |
|
| 279 |
$template->param( booksellerid => $booksellerid ); |
308 |
$template->param( booksellerid => $booksellerid ); |
| 280 |
} |
309 |
} |
| 281 |
$template->param(grouping => 1); |
310 |
$template->param(grouping => 1); |
|
Lines 362-375
if ( $op eq "add" ) {
Link Here
|
| 362 |
my $basketgroupid = $input->param('basketgroupid'); |
391 |
my $basketgroupid = $input->param('basketgroupid'); |
| 363 |
my $basketgroupname = $input->param('basketgroupname'); |
392 |
my $basketgroupname = $input->param('basketgroupname'); |
| 364 |
my $booksellerid = $input->param('booksellerid'); |
393 |
my $booksellerid = $input->param('booksellerid'); |
|
|
394 |
my $deliveryplace = $input->param('deliveryplace'); |
| 395 |
my $deliverycomment = $input->param('deliverycomment'); |
| 365 |
my $close = $input->param('close') ? 1 : 0; |
396 |
my $close = $input->param('close') ? 1 : 0; |
| 366 |
# If we got a basketgroupname, we create a basketgroup |
397 |
# If we got a basketgroupname, we create a basketgroup |
| 367 |
if ($basketgroupid) { |
398 |
if ($basketgroupid) { |
| 368 |
$basketgroup = { |
399 |
$basketgroup = { |
| 369 |
name => $basketgroupname, |
400 |
name => $basketgroupname, |
| 370 |
id => $basketgroupid, |
401 |
id => $basketgroupid, |
| 371 |
basketlist => \@baskets, |
402 |
basketlist => \@baskets, |
| 372 |
closed => $close, |
403 |
deliveryplace => $deliveryplace, |
|
|
404 |
deliverycomment => $deliverycomment, |
| 405 |
closed => $close, |
| 373 |
}; |
406 |
}; |
| 374 |
ModBasketgroup($basketgroup); |
407 |
ModBasketgroup($basketgroup); |
| 375 |
if($close){ |
408 |
if($close){ |
|
Lines 377-386
if ( $op eq "add" ) {
Link Here
|
| 377 |
} |
410 |
} |
| 378 |
}else{ |
411 |
}else{ |
| 379 |
$basketgroup = { |
412 |
$basketgroup = { |
| 380 |
name => $basketgroupname, |
413 |
name => $basketgroupname, |
| 381 |
booksellerid => $booksellerid, |
414 |
booksellerid => $booksellerid, |
| 382 |
basketlist => \@baskets, |
415 |
basketlist => \@baskets, |
| 383 |
closed => $close, |
416 |
deliveryplace => $deliveryplace, |
|
|
417 |
deliverycomment => $deliverycomment, |
| 418 |
closed => $close, |
| 384 |
}; |
419 |
}; |
| 385 |
$basketgroupid = NewBasketgroup($basketgroup); |
420 |
$basketgroupid = NewBasketgroup($basketgroup); |
| 386 |
} |
421 |
} |