[Koha-patches] [PATCH] [SIGNED-OFF] Bug 5399: remove useless eval 'use C4::Foo'
Marcel de Rooy
M.de.Rooy at rijksmuseum.nl
Mon Jan 17 10:15:05 CET 2011
From: Galen Charlton <gmcharlt at gmail.com>
Also add a couple FIXMEs
Marcel: Signed and updated for current master
Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
---
acqui/addorderiso2709.pl | 6 +-----
acqui/basketgroup.pl | 7 ++++---
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl
index 781df61..29f8143 100755
--- a/acqui/addorderiso2709.pl
+++ b/acqui/addorderiso2709.pl
@@ -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;
diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl
index aba32d4..8d2eef4 100755
--- a/acqui/basketgroup.pl
+++ b/acqui/basketgroup.pl
@@ -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');
--
1.6.0.6
More information about the Koha-patches
mailing list