View | Details | Raw Unified | Return to bug 21853
Collapse All | Expand All

(-)a/acqui/pdfformat/layout2pages.pm (-2 / +1 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl
1
package Koha::pdfformat::layout2pages;
2
2
3
#example script to print a basketgroup
3
#example script to print a basketgroup
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
Lines 21-27 Link Here
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
22
23
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
23
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
24
package pdfformat::layout2pages;
25
use vars qw(@ISA @EXPORT);
24
use vars qw(@ISA @EXPORT);
26
use MIME::Base64;
25
use MIME::Base64;
27
use Modern::Perl;
26
use Modern::Perl;
(-)a/acqui/pdfformat/layout2pagesde.pm (-2 / +1 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl
1
package Koha::pdfformat::layout2pagesde;
2
2
3
#example script to print a basketgroup
3
#example script to print a basketgroup
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
Lines 21-27 Link Here
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
22
23
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
23
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
24
package pdfformat::layout2pagesde;
25
use vars qw(@ISA @EXPORT);
24
use vars qw(@ISA @EXPORT);
26
use MIME::Base64;
25
use MIME::Base64;
27
use Modern::Perl;
26
use Modern::Perl;
(-)a/acqui/pdfformat/layout3pages.pm (-2 / +1 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl
1
package Koha::pdfformat::layout3pages;
2
2
3
#example script to print a basketgroup
3
#example script to print a basketgroup
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
Lines 21-27 Link Here
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
22
23
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
23
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
24
package pdfformat::layout3pages;
25
use vars qw(@ISA @EXPORT);
24
use vars qw(@ISA @EXPORT);
26
use MIME::Base64;
25
use MIME::Base64;
27
use List::MoreUtils qw/uniq/;
26
use List::MoreUtils qw/uniq/;
(-)a/acqui/pdfformat/layout3pagesfr.pm (-1 / +1 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl
1
package Koha::pdfformat::layout3pagesfr;
2
2
3
#example script to print a basketgroup
3
#example script to print a basketgroup
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
4
#written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com
(-)a/acqui/basketgroup.pl (-17 / +15 lines)
Lines 49-54 use Carp; Link Here
49
use C4::Auth;
49
use C4::Auth;
50
use C4::Output;
50
use C4::Output;
51
use CGI qw ( -utf8 );
51
use CGI qw ( -utf8 );
52
use File::Spec;
52
53
53
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
54
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
54
use Koha::EDI qw/create_edi_order get_edifact_ean/;
55
use Koha::EDI qw/create_edi_order get_edifact_ean/;
Lines 123-151 sub displaybasketgroups { Link Here
123
124
124
sub printbasketgrouppdf{
125
sub printbasketgrouppdf{
125
    my ($basketgroupid) = @_;
126
    my ($basketgroupid) = @_;
126
    
127
127
    my $pdfformat = C4::Context->preference("OrderPdfFormat");
128
    my $pdfformat = C4::Context->preference("OrderPdfFormat");
128
    if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages' || $pdfformat eq 'pdfformat::layout3pagesfr'
129
    my @valid_pdfformats = qw(pdfformat::layout3pages pdfformat::layout2pages pdfformat::layout3pagesfr pdfformat::layout2pagesde);
129
        || $pdfformat eq 'pdfformat::layout2pagesde'){
130
    if (grep {$_ eq $pdfformat} @valid_pdfformats) {
130
	eval {
131
        $pdfformat = "Koha::$pdfformat";
131
        eval "require $pdfformat";
132
        my $pdfformat_filepath = File::Spec->catfile(split /::/, $pdfformat) . '.pm';
132
	    import $pdfformat;
133
        require $pdfformat_filepath;
133
	};
134
        import $pdfformat;
134
	if ($@){
135
	}
136
    }
135
    }
137
    else {
136
    else {
138
	print $input->header;  
137
        print $input->header;
139
	print $input->start_html;  # FIXME Should do a nicer page
138
        print $input->start_html;  # FIXME Should do a nicer page
140
	print "<h1>Invalid PDF Format set</h1>";
139
        print "<h1>Invalid PDF Format set</h1>";
141
	print "Please go to the systempreferences and set a valid pdfformat";
140
        print "Please go to the systempreferences and set a valid pdfformat";
142
	exit;
141
        exit;
143
    }
142
    }
144
    
143
145
    my $basketgroup = GetBasketgroup($basketgroupid);
144
    my $basketgroup = GetBasketgroup($basketgroupid);
146
    my $bookseller = Koha::Acquisition::Booksellers->find( $basketgroup->{booksellerid} );
145
    my $bookseller = Koha::Acquisition::Booksellers->find( $basketgroup->{booksellerid} );
147
    my $baskets = GetBasketsByBasketgroup($basketgroupid);
146
    my $baskets = GetBasketsByBasketgroup($basketgroupid);
148
    
147
149
    my %orders;
148
    my %orders;
150
    for my $basket (@$baskets) {
149
    for my $basket (@$baskets) {
151
        my @ba_orders;
150
        my @ba_orders;
152
- 

Return to bug 21853