X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=acqui%2Fbasketgroup.pl;h=5dbae17963df499c610b36b08bf49dc940ccfbb6;hb=481f620455d40f93a3cb37136ef2c3964497751e;hp=084660393307e696b44af4f29c6c5fa2fcf13b47;hpb=552cde08db9e237de631af7e3acc774154b265a2;p=koha_gimpoz diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 0846603933..5dbae17963 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -45,6 +45,7 @@ The bookseller who we want to display the baskets (and basketgroups) of. use strict; use warnings; +use Carp; use C4::Input; use C4::Auth; @@ -184,9 +185,21 @@ sub printbasketgrouppdf{ my ($basketgroupid) = @_; my $pdfformat = C4::Context->preference("OrderPdfFormat"); - eval "use $pdfformat"; - # FIXME consider what would happen if $pdfformat does not - # contain the name of a valid Perl module. + if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages'){ + eval { + require $pdfformat; + import $pdfformat; + }; + if ($@){ + } + } + else { + print $input->header; + print $input->start_html; # FIXME Should do a nicer page + print "

Invalid PDF Format set

"; + print "Please go to the systempreferences and set a valid pdfformat"; + exit; + } my $basketgroup = GetBasketgroup($basketgroupid); my $bookseller = GetBookSellerFromId($basketgroup->{'booksellerid'}); @@ -202,8 +215,20 @@ sub printbasketgrouppdf{ #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate my @ba_order; if ( $ord->{biblionumber} && $ord->{quantity}> 0 ) { - eval "use C4::Biblio"; - eval "use C4::Koha"; + eval { + require C4::Biblio; + import C4::Biblio; + }; + if ($@){ + croak $@; + } + eval { + require C4::Koha; + import C4::Koha; + }; + if ($@){ + croak $@; + } my $bib = GetBiblioData($ord->{biblionumber}); my $itemtypes = GetItemTypes(); if($ord->{isbn}){ @@ -246,6 +271,7 @@ sub printbasketgrouppdf{ ); my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed"; print $pdf; + } my $op = $input->param('op');