[Koha-patches] [PATCH 1/2] Bug 6679 : Fixing a style error to pass Perl::Critic, plus silencing a warn

Chris Cormack chrisc at catalyst.net.nz
Mon Aug 8 11:02:00 CEST 2011


---
 acqui/addorderiso2709.pl |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl
index c46263a..8a2a000 100755
--- a/acqui/addorderiso2709.pl
+++ b/acqui/addorderiso2709.pl
@@ -210,8 +210,20 @@ if ($op eq ""){
         }
         if ($price){
             $orderinfo{'listprice'} = $price;
-            eval "use C4::Acquisition qw/GetBasket/;";
-            eval "use C4::Bookseller qw/GetBookSellerFromId/;";
+            eval {
+		require C4::Acquisition;
+		import C4::Acquisition qw/GetBasket/;
+	    };
+	    if ($@){
+		croak $@;
+	    }
+            eval {
+		require C4::Bookseller;
+	        import C4::Bookseller qw/GetBookSellerFromId/;
+	    };
+	    if ($@){
+		croak $@;
+	    }
             my $basket     = GetBasket( $orderinfo{basketno} );
             my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
             my $gst        = $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
@@ -265,7 +277,7 @@ my $budget = GetBudget($budget_id);
 
 # build budget list
 my $budget_loop = [];
-my $budgets = GetBudgetHierarchy( q{}, $borrower->{branchcode}, $borrower->{borrowernumber} );
+$budgets = GetBudgetHierarchy( q{}, $borrower->{branchcode}, $borrower->{borrowernumber} );
 foreach my $r ( @{$budgets} ) {
     if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
         next;
-- 
1.7.4.1



More information about the Koha-patches mailing list