Bugzilla – Attachment 25551 Details for
Bug 11820
dead code in basketgroup.pl : "add" operation is never invoked without a booksellerid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11820: remove dead code in basket group management
Bug-11820-remove-dead-code-in-basket-group-managem.patch (text/plain), 5.95 KB, created by
Galen Charlton
on 2014-02-21 20:11:40 UTC
(
hide
)
Description:
Bug 11820: remove dead code in basket group management
Filename:
MIME Type:
Creator:
Galen Charlton
Created:
2014-02-21 20:11:40 UTC
Size:
5.95 KB
patch
obsolete
>From 77bc330998b5a0c5531bbd7c9ec23f818593328c Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Fri, 21 Feb 2014 20:07:01 +0000 >Subject: [PATCH] Bug 11820: remove dead code in basket group management > >There was some code in acqui/basketgroup.pl that was apparently >intended to let one create a basket group for no (or an unknown) >vendor. However, this code was never reached, as there is nothing >in the templates that invokes basketgroup.pl with 'add' as the >operation that doesn't also pass the vendor ID along. > >This patch removes that dead code. > >To test: > >[1] Create a new basket group for a vendor and verify that it is > created correctly. >[2] Edit an existing basket group, including moving baskets in and > and out of, and verify that it works. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >--- > acqui/basketgroup.pl | 90 ++++++++++++++++++++------------------------------ > 1 file changed, 35 insertions(+), 55 deletions(-) > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index c050967..6b2529d 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -251,64 +251,44 @@ if ( $op eq "add" ) { > # the template will know if basketgroup must be displayed or edited, depending on the value of closed key > # > my $bookseller = &GetBookSellerFromId($booksellerid); >- if(! $booksellerid){ >-# Unknown bookseller >-# FIXME : ungroupedlist does not seem to be used in this file nor in template >- $template->param( ungroupedlist => 1); >- my @booksellers = GetBookSeller(''); >- for (my $i=0; $i < scalar @booksellers; $i++) { >- my $baskets = &GetBasketsByBookseller($booksellers[$i]->{id}); >- for (my $j=0; $j < scalar @$baskets; $j++) { >- if(! @$baskets[$i]->{closedate} || @$baskets[$i]->{basketgroupid}) { >- splice(@$baskets, $j, 1); >- $j--; >- } >- } >- if (scalar @$baskets == 0){ >- splice(@booksellers, $i, 1); >- $i--; >- } >+ my $basketgroupid = $input->param('basketgroupid'); >+ my $billingplace; >+ my $deliveryplace; >+ my $freedeliveryplace; >+ if ( $basketgroupid ) { >+ # Get the selected baskets in the basketgroup to display them >+ my $selecteds = GetBasketsByBasketgroup($basketgroupid); >+ foreach my $basket(@{$selecteds}){ >+ $basket->{total} = BasketTotal($basket->{basketno}, $bookseller); > } >+ $template->param(basketgroupid => $basketgroupid, >+ selectedbaskets => $selecteds); >+ >+ # Get general informations about the basket group to prefill the form >+ my $basketgroup = GetBasketgroup($basketgroupid); >+ $template->param( >+ name => $basketgroup->{name}, >+ deliverycomment => $basketgroup->{deliverycomment}, >+ freedeliveryplace => $basketgroup->{freedeliveryplace}, >+ ); >+ $billingplace = $basketgroup->{billingplace}; >+ $deliveryplace = $basketgroup->{deliveryplace}; >+ $freedeliveryplace = $basketgroup->{freedeliveryplace}; >+ $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0); > } else { >-# Known bookseller >- my $basketgroupid = $input->param('basketgroupid'); >- my $billingplace; >- my $deliveryplace; >- my $freedeliveryplace; >- if ( $basketgroupid ) { >- # Get the selected baskets in the basketgroup to display them >- my $selecteds = GetBasketsByBasketgroup($basketgroupid); >- foreach my $basket(@{$selecteds}){ >- $basket->{total} = BasketTotal($basket->{basketno}, $bookseller); >- } >- $template->param(basketgroupid => $basketgroupid, >- selectedbaskets => $selecteds); >- >- # Get general informations about the basket group to prefill the form >- my $basketgroup = GetBasketgroup($basketgroupid); >- $template->param( >- name => $basketgroup->{name}, >- deliverycomment => $basketgroup->{deliverycomment}, >- freedeliveryplace => $basketgroup->{freedeliveryplace}, >- ); >- $billingplace = $basketgroup->{billingplace}; >- $deliveryplace = $basketgroup->{deliveryplace}; >- $freedeliveryplace = $basketgroup->{freedeliveryplace}; >- $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0); >- } else { >- $template->param( closedbg => 0); >- } >- # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data >- my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) ); >- $billingplace = $billingplace || $borrower->{'branchcode'}; >- $deliveryplace = $deliveryplace || $borrower->{'branchcode'}; >- >- my $branches = C4::Branch::GetBranchesLoop( $billingplace ); >- $template->param( billingplaceloop => $branches ); >- $branches = C4::Branch::GetBranchesLoop( $deliveryplace ); >- $template->param( deliveryplaceloop => $branches ); >- $template->param( booksellerid => $booksellerid ); >+ $template->param( closedbg => 0); > } >+ # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data >+ my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) ); >+ $billingplace = $billingplace || $borrower->{'branchcode'}; >+ $deliveryplace = $deliveryplace || $borrower->{'branchcode'}; >+ >+ my $branches = C4::Branch::GetBranchesLoop( $billingplace ); >+ $template->param( billingplaceloop => $branches ); >+ $branches = C4::Branch::GetBranchesLoop( $deliveryplace ); >+ $template->param( deliveryplaceloop => $branches ); >+ $template->param( booksellerid => $booksellerid ); >+ > # the template will display a unique basketgroup > $template->param(grouping => 1); > my $basketgroups = &GetBasketgroups($booksellerid); >-- >1.7.10.4
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 11820
:
25551
|
25572
|
26159