Bugzilla – Attachment 24526 Details for
Bug 11056
dead code in basketgroup.pl : remove code depending on "validate" param
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11056 : Delete dead code in basketgroup.pl
Bug-11056--Delete-dead-code-in-basketgrouppl.patch (text/plain), 6.67 KB, created by
Kyle M Hall (khall)
on 2014-01-17 17:22:56 UTC
(
hide
)
Description:
Bug 11056 : Delete dead code in basketgroup.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-01-17 17:22:56 UTC
Size:
6.67 KB
patch
obsolete
>From fc9bbe932d228c03bc7c15df36f49f22399969ed Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathieu.saby@univ-rennes2.fr> >Date: Wed, 18 Dec 2013 18:04:25 +0100 >Subject: [PATCH] Bug 11056 : Delete dead code in basketgroup.pl > >In basketgroup.pl, some code is supposed to be executed if $op = "validate". >But this value is no more assigned to $op variable since 2009. > >This patch suppressed dead code, along with parseinputbaskets and parseinputbasketgroups subs, which are obsolete. >No functional changes expected > >Regression test : >Check basketgroup are shown as before the patch, and can be closed and reopen. >Check you can add or remove a basket from a basketgroup, and change informations about it (like delivery place) >Check you can create a basketgroup when you close a basket. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >The following commands return nothing: >- grep validate acqui/basketgroup.tt >- grep -R basketgroup.pl -C 2 | grep validate >- git grep parseinputbaskets >- git grep parseinputbasketgroups >- git grep basketgroup.pl | grep validate > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > acqui/basketgroup.pl | 105 -------------------------------------------------- > 1 files changed, 0 insertions(+), 105 deletions(-) > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 7067ba9..2051eaa 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -70,69 +70,6 @@ our ($template, $loggedinuser, $cookie) > debug => 1, > }); > >-sub parseinputbaskets { >- my $booksellerid = shift; >- my $baskets = &GetBasketsByBookseller($booksellerid); >- for(my $i=0; $i < scalar @$baskets; ++$i) { >- if( @$baskets[$i] && ! @$baskets[$i]->{'closedate'} ) { >- splice(@$baskets, $i, 1); >- --$i; >- } >- } >- foreach my $basket (@$baskets){ >-#perl DBI uses value "undef" for the mysql "NULL" value, so i need to check everywhere where $basket->{'basketgroupid'} is used for undef â¹ >- $basket->{'basketgroupid'} = $input->param($basket->{'basketno'}.'-group') || undef; >- } >- return $baskets; >-} >- >- >- >-sub parseinputbasketgroups { >- my $booksellerid = shift; >- my $baskets = shift; >- my $basketgroups = &GetBasketgroups($booksellerid); >- my $newbasketgroups; >- foreach my $basket (@$baskets){ >- my $basketgroup; >- my $i = 0; >- my $exists; >- if(! $basket->{'basketgroupid'} || $basket->{'basketgroupid'} == 0){ >- $exists = "true"; >- } else { >- foreach my $basketgroup (@$basketgroups){ >- if($basket->{'basketgroupid'} == $basketgroup->{'id'}){ >- $exists = "true"; >- push(@{$basketgroup->{'basketlist'}}, $basket->{'basketno'}); >- last; >- } >- } >- } >- if (! $exists){ >-#if the basketgroup doesn't exist yet >- $basketgroup = $newbasketgroups->{$basket->{'basketgroupid'}} || undef; >- $basketgroup->{'booksellerid'} = $booksellerid; >- } else { >- while($i < scalar @$basketgroups && @$basketgroups[$i]->{'id'} != $basket->{'basketgroupid'}){ >- ++$i; >- } >- $basketgroup = @$basketgroups[$i]; >- } >- $basketgroup->{'id'}=$basket->{'basketgroupid'}; >- $basketgroup->{'name'}=$input->param('basketgroup-'.$basketgroup->{'id'}.'-name') || ""; >- $basketgroup->{'closed'}= $input->param('basketgroup-'.$basketgroup->{'id'}.'-closed'); >- push(@{$basketgroup->{'basketlist'}}, $basket->{'basketno'}); >- if (! $exists){ >- $newbasketgroups->{$basket->{'basketgroupid'}} = $basketgroup; >- } else { >- if($basketgroup->{'id'}){ >- @$basketgroups[$i] = $basketgroup; >- } >- } >- } >- return($basketgroups, $newbasketgroups); >-} >- > sub BasketTotal { > my $basketno = shift; > my $bookseller = shift; >@@ -297,7 +234,6 @@ my $op = $input->param('op') || 'display'; > # possible values of $op : > # - add : adds a new basketgroup, or edit an open basketgroup, or display a closed basketgroup > # - mod_basket : modify an individual basket of the basketgroup >-# - validate : FIXME dead code > # - closeandprint : close and print an closed basketgroup in pdf. called by clicking on "Close and print" button in closed basketgroups list > # - print : print a closed basketgroup. called by clicking on "Print" button in closed basketgroups list > # - export : export in CSV a closed basketgroup. called by clicking on "Export" button in closed basketgroups list >@@ -387,47 +323,6 @@ if ( $op eq "add" ) { > ModBasket( { basketno => $basketno, > basketgroupid => $basketgroupid } ); > print $input->redirect("basket.pl?basketno=" . $basketno); >-} elsif ($op eq 'validate') { >-# >-# FIXME dead code >-# >- if(! $booksellerid){ >- $template->param( booksellererror => 1); >- } else { >- $template->param( booksellerid => $booksellerid ); >- } >- my $baskets = parseinputbaskets($booksellerid); >- my ($basketgroups, $newbasketgroups) = parseinputbasketgroups($booksellerid, $baskets); >- foreach my $nbgid (keys %$newbasketgroups){ >-#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 >- my $bgid = NewBasketgroup($newbasketgroups->{$nbgid}); >- ${$newbasketgroups->{$nbgid}}->{'id'} = $bgid; >- ${$newbasketgroups->{$nbgid}}->{'oldid'} = $nbgid; >- } >- foreach my $basket (@$baskets){ >-#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. >- if ( $basket->{'basketgroupid'} && $newbasketgroups->{$basket->{'basketgroupid'}} ){ >- $basket->{'basketgroupid'} = ${$newbasketgroups->{$basket->{'basketgroupid'}}}->{'id'}; >- } >- ModBasket($basket); >- } >- foreach my $basketgroup (@$basketgroups){ >- if(! $basketgroup->{'id'}){ >- foreach my $basket (@{$basketgroup->{'baskets'}}){ >- if($input->param('basket'.$basket->{'basketno'}.'changed')){ >- ModBasket($basket); >- } >- } >- } elsif ($input->param('basketgroup-'.$basketgroup->{'id'}.'-changed')){ >- ModBasketgroup($basketgroup); >- } >- } >- $basketgroups = &GetBasketgroups($booksellerid); >- my $bookseller = &GetBookSellerFromId($booksellerid); >- $baskets = &GetBasketsByBookseller($booksellerid); >- # keep ungroupedbaskets >- >- displaybasketgroups($basketgroups, $bookseller, $baskets); > } elsif ( $op eq 'closeandprint') { > # > # close an open basketgroup and generates a pdf >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11056
:
23642
|
23741
|
24521
| 24526