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

(-)a/acqui/basketgroup.pl (-43 lines)
Lines 297-303 my $op = $input->param('op') || 'display'; Link Here
297
# possible values of $op :
297
# possible values of $op :
298
# - add : adds a new basketgroup, or edit an open basketgroup, or display a closed basketgroup
298
# - add : adds a new basketgroup, or edit an open basketgroup, or display a closed basketgroup
299
# - mod_basket : modify an individual basket of the basketgroup
299
# - mod_basket : modify an individual basket of the basketgroup
300
# - validate :  FIXME dead code
301
# - closeandprint : close and print an closed basketgroup in pdf. called by clicking on "Close and print" button in closed basketgroups list
300
# - closeandprint : close and print an closed basketgroup in pdf. called by clicking on "Close and print" button in closed basketgroups list
302
# - print : print a closed basketgroup. called by clicking on "Print" button in closed basketgroups list
301
# - print : print a closed basketgroup. called by clicking on "Print" button in closed basketgroups list
303
# - export : export in CSV a closed basketgroup. called by clicking on "Export" button in closed basketgroups list
302
# - export : export in CSV a closed basketgroup. called by clicking on "Export" button in closed basketgroups list
Lines 387-433 if ( $op eq "add" ) { Link Here
387
  ModBasket( { basketno => $basketno,
386
  ModBasket( { basketno => $basketno,
388
                         basketgroupid => $basketgroupid } );
387
                         basketgroupid => $basketgroupid } );
389
  print $input->redirect("basket.pl?basketno=" . $basketno);
388
  print $input->redirect("basket.pl?basketno=" . $basketno);
390
} elsif ($op eq 'validate') {
391
#
392
#  FIXME dead code
393
#
394
    if(! $booksellerid){
395
        $template->param( booksellererror => 1);
396
    } else {
397
        $template->param( booksellerid => $booksellerid );
398
    }
399
    my $baskets = parseinputbaskets($booksellerid);
400
    my ($basketgroups, $newbasketgroups) = parseinputbasketgroups($booksellerid, $baskets);
401
    foreach my $nbgid (keys %$newbasketgroups){
402
#javascript just picks an ID that's higher than anything else, the ID might not be correct..change it and change all the basket's basketgroupid as well
403
        my $bgid = NewBasketgroup($newbasketgroups->{$nbgid});
404
        ${$newbasketgroups->{$nbgid}}->{'id'} = $bgid;
405
        ${$newbasketgroups->{$nbgid}}->{'oldid'} = $nbgid;
406
    }
407
    foreach my $basket (@$baskets){
408
#if the basket was added to a new basketgroup, first change the groupid to the groupid of the basket in mysql, because it contains the id from javascript otherwise.
409
        if ( $basket->{'basketgroupid'} && $newbasketgroups->{$basket->{'basketgroupid'}} ){
410
            $basket->{'basketgroupid'} = ${$newbasketgroups->{$basket->{'basketgroupid'}}}->{'id'};
411
        }
412
        ModBasket($basket);
413
    }
414
    foreach my $basketgroup (@$basketgroups){
415
        if(! $basketgroup->{'id'}){
416
            foreach my $basket (@{$basketgroup->{'baskets'}}){
417
                if($input->param('basket'.$basket->{'basketno'}.'changed')){
418
                    ModBasket($basket);
419
                }
420
            }
421
        } elsif ($input->param('basketgroup-'.$basketgroup->{'id'}.'-changed')){
422
            ModBasketgroup($basketgroup);
423
        }
424
    }
425
    $basketgroups = &GetBasketgroups($booksellerid);
426
    my $bookseller = &GetBookSellerFromId($booksellerid);
427
    $baskets = &GetBasketsByBookseller($booksellerid);
428
    # keep ungroupedbaskets
429
430
    displaybasketgroups($basketgroups, $bookseller, $baskets);
431
} elsif ( $op eq 'closeandprint') {
389
} elsif ( $op eq 'closeandprint') {
432
#
390
#
433
# close an open basketgroup and generates a pdf
391
# close an open basketgroup and generates a pdf
434
- 

Return to bug 11056