Bug 5399: remove useless eval 'use C4::Foo'
authorGalen Charlton <gmcharlt@gmail.com>
Mon, 17 Jan 2011 09:45:41 +0000 (09:45 +0000)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 17 Jan 2011 09:52:53 +0000 (22:52 +1300)
Also add a couple FIXMEs

Marcel: Signed and updated for current master

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
acqui/addorderiso2709.pl
acqui/basketgroup.pl

index 781df61..29f8143 100755 (executable)
@@ -37,7 +37,7 @@ use C4::Biblio;
 use C4::Items;
 use C4::Koha qw/GetItemTypes/;
 use C4::Budgets qw/GetBudgets/;
-use C4::Acquisition qw/NewOrderItem/;
+use C4::Acquisition qw/NewOrderItem GetBasket/;
 use C4::Bookseller qw/GetBookSellerFromId/;
 
 my $input = new CGI;
@@ -145,8 +145,6 @@ if ($op eq ""){
               if ($orderinfo{'listprice'} =~ /^([\d\.,]*)/) {
                   $orderinfo{'listprice'} = $1;
                   $orderinfo{'listprice'} =~ s/,/\./;
-                  eval "use C4::Acquisition qw/GetBasket/;";
-                  eval "use C4::Bookseller qw/GetBookSellerFromId/;";
                   my $basket = GetBasket($orderinfo{basketno});
                   my $bookseller = GetBookSellerFromId($basket->{booksellerid});
                   # '//' is like '||' but tests for defined, rather than true
@@ -163,8 +161,6 @@ if ($op eq ""){
               if ($orderinfo{'listprice'} =~ /^([\d\.,]*)/) {
                   $orderinfo{'listprice'} = $1;
                   $orderinfo{'listprice'} =~ s/,/\./;
-                  eval "use C4::Acquisition qw/GetBasket/;";
-                  eval "use C4::Bookseller qw/GetBookSellerFromId/;";
                   my $basket = GetBasket($orderinfo{basketno});
                   my $bookseller = GetBookSellerFromId($basket->{booksellerid});
                   my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
index aba32d4..0d5bcd5 100755 (executable)
@@ -183,8 +183,9 @@ sub printbasketgrouppdf{
     my ($basketgroupid) = @_;
     
     my $pdfformat = C4::Context->preference("OrderPdfFormat");
-    eval "use $pdfformat" ;
-    eval "use C4::Branch";
+    eval "use $pdfformat";
+    # FIXME consider what would happen if $pdfformat does not
+    # contain the name of a valid Perl module.
     
     my $basketgroup = GetBasketgroup($basketgroupid);
     my $bookseller = GetBookSellerFromId($basketgroup->{'booksellerid'});
@@ -244,7 +245,7 @@ sub printbasketgrouppdf{
     );
     my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed";
     print $pdf;
-    exit;
+    exit; # FIXME bad form to exit out of a subroutine like this
 }
 
 my $op = $input->param('op');