From f3dab5b324065045af8249893f0e9f3458c60a56 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 11 Jun 2012 14:13:24 +0200 Subject: [PATCH 1/1] Bug 5356: Followup sort and branchname - Sort is now the same as C4::Branch::GetBranchesLoop - branchcodes are replaced with branchnames --- C4/Acquisition.pm | 9 +++++++-- acqui/basket.pl | 6 ++++-- acqui/basketgroup.pl | 29 +++++------------------------ acqui/basketheader.pl | 48 ++++-------------------------------------------- 4 files changed, 20 insertions(+), 72 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 890ff64..1d891ee 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -257,8 +257,8 @@ sub GetBasketAsCSV { notes => $order->{'notes'}, quantity => $order->{'quantity'}, rrp => $order->{'rrp'}, - deliveryplace => $basket->{'deliveryplace'}, - billingplace => $basket->{'billingplace'} + deliveryplace => C4::Branch::GetBranchName( $basket->{'deliveryplace'} ), + billingplace => C4::Branch::GetBranchName( $basket->{'billingplace'} ), }; foreach(qw( contractname author title publishercode collectiontitle notes @@ -307,6 +307,7 @@ sub GetBasketGroupAsCSV { my @orders = GetOrders( $$basket{basketno} ); my $contract = GetContract( $$basket{contractnumber} ); my $bookseller = GetBookSellerFromId( $$basket{booksellerid} ); + my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); foreach my $order (@orders) { my $bd = GetBiblioData( $order->{'biblionumber'} ); @@ -331,6 +332,10 @@ sub GetBasketGroupAsCSV { booksellerpostal => $bookseller->{postal}, contractnumber => $contract->{contractnumber}, contractname => $contract->{contractname}, + basketgroupdeliveryplace => C4::Branch::GetBranchName( $basketgroup->{deliveryplace} ) || C4::Branch::GetBranchName( $basketgroup->{freedeliveryplace} ), + basketgroupbillingplace => C4::Branch::GetBranchName( $basketgroup->{billingplace} ), + basketdeliveryplace => C4::Branch::GetBranchName( $basket->{deliveryplace} ), + basketbillingplace => C4::Branch::GetBranchName( $basket->{billingplace} ), }; foreach(qw( basketname author title publishercode collectiontitle notes diff --git a/acqui/basket.pl b/acqui/basket.pl index ebe965e..0c54d1d 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -363,6 +363,8 @@ my $total_est_gste; for my $key (keys %$basketgroup ){ $basketgroup->{"basketgroup$key"} = delete $basketgroup->{$key}; } + $basketgroup->{basketgroupdeliveryplace} = C4::Branch::GetBranchName( $basketgroup->{basketgroupdeliveryplace} ); + $basketgroup->{basketgroupbillingplace} = C4::Branch::GetBranchName( $basketgroup->{basketgroupbillingplace} ); $template->param(%$basketgroup); } my $borrower= GetMember('borrowernumber' => $loggedinuser); @@ -393,8 +395,8 @@ my $total_est_gste; authorisedbyname => $basket->{authorisedbyname}, closedate => $basket->{closedate}, estimateddeliverydate=> $estimateddeliverydate, - deliveryplace => $basket->{deliveryplace} || $basket->{freedeliveryplace}, - billingplace => $basket->{billingplace}, + deliveryplace => C4::Branch::GetBranchName( $basket->{deliveryplace} ) || C4::Branch::GetBranchName( $basket->{freedeliveryplace} ), + billingplace => C4::Branch::GetBranchName( $basket->{billingplace} ), active => $bookseller->{'active'}, booksellerid => $bookseller->{'id'}, name => $bookseller->{'name'}, diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index f873580..76a9c8d 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -328,30 +328,11 @@ if ( $op eq "add" ) { my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) ); $billingplace = $billingplace || $borrower->{'branchcode'}; $deliveryplace = $deliveryplace || $borrower->{'branchcode'}; - - my $branches = GetBranches; - - # Build the combobox to select the billing place - my @billingplaceloop; - for (sort keys %$branches) { - push @billingplaceloop, { - value => $_, - selected => $_ eq $billingplace, - branchname => $branches->{$_}->{branchname}, - }; - } - $template->param( billingplaceloop => \@billingplaceloop ); - - # Build the combobox to select the delivery place - my @deliveryplaceloop; - for (sort keys %$branches) { - push @deliveryplaceloop, { - value => $_, - selected => $_ eq $deliveryplace, - branchname => $branches->{$_}->{branchname}, - }; - } - $template->param( deliveryplaceloop => \@deliveryplaceloop ); + + my $branches = C4::Branch::GetBranchesLoop( $billingplace ); + $template->param( billingplaceloop => $branches ); + $branches = C4::Branch::GetBranchesLoop( $deliveryplace ); + $template->param( deliveryplaceloop => $branches ); $template->param( booksellerid => $booksellerid ); } diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index 3997811..142dcbe 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -121,50 +121,10 @@ if ( $op eq 'add_form' ) { # Build the combobox to select the billing place my @billingplaceloop; - # In case there's no branch selected - if ($billingplace eq "NO_LIBRARY_SET") { - my %row = ( - value => "", - selected => 1, - branchname => "--", - ); - push @billingplaceloop, \%row; - } - - for ( sort keys %$branches ) { - my $selected = 1 if $_ eq $billingplace; - my %row = ( - value => $_, - selected => $selected, - branchname => $branches->{$_}->{branchname}, - ); - push @billingplaceloop, \%row; - } - $template->param( billingplaceloop => \@billingplaceloop ); - - # Build the combobox to select the delivery place - my @deliveryplaceloop; - - # In case there's no branch selected - if ($deliveryplace eq "NO_LIBRARY_SET") { - my %row = ( - value => "", - selected => 1, - branchname => "--", - ); - push @deliveryplaceloop, \%row; - } - - for ( sort keys %$branches ) { - my $selected = 1 if $_ eq $deliveryplace; - my %row = ( - value => $_, - selected => $selected, - branchname => $branches->{$_}->{branchname}, - ); - push @deliveryplaceloop, \%row; - } - $template->param( deliveryplaceloop => \@deliveryplaceloop ); + my $branches = C4::Branch::GetBranchesLoop( $billingplace ); + $template->param( billingplaceloop => $branches ); + $branches = C4::Branch::GetBranchesLoop( $deliveryplace ); + $template->param( deliveryplaceloop => $branches ); #End Edit } elsif ( $op eq 'add_validate' ) { -- 1.7.7.3