Bugzilla – Attachment 82545 Details for
Bug 21853
Internal software error when exporting basket group as PDF with Perl > 5.24.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21853: Fix PDF export of basketgroups
Bug-21853-Fix-PDF-export-of-basketgroups.patch (text/plain), 6.31 KB, created by
Marcel de Rooy
on 2018-11-20 14:07:29 UTC
(
hide
)
Description:
Bug 21853: Fix PDF export of basketgroups
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-11-20 14:07:29 UTC
Size:
6.31 KB
patch
obsolete
>From 241de71814e3fad0182a9f657a3643b75abcfc08 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Sat, 17 Nov 2018 11:58:02 +0100 >Subject: [PATCH] Bug 21853: Fix PDF export of basketgroups >Content-Type: text/plain; charset=utf-8 > >In recent versions of Perl, '.' is not included by default in @INC. This >breaks PDF export of basketgroups. > >This patch moves acqui/pdfformat/*.pm files in Koha namespace so that >they can be 'require'd without manipulating @INC > >Test plan: >1. Turn off Plack/Starman and test PDF export for every value of > OrderPdfFormat system preference >2. Turn on Plack/Starman and test PDF export for every value of > OrderPdfFormat system preference >3. Test on a dev install and a standard/package install > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > {acqui => Koha}/pdfformat/layout2pages.pm | 3 +-- > {acqui => Koha}/pdfformat/layout2pagesde.pm | 3 +-- > {acqui => Koha}/pdfformat/layout3pages.pm | 3 +-- > {acqui => Koha}/pdfformat/layout3pagesfr.pm | 2 +- > acqui/basketgroup.pl | 31 ++++++++++++++--------------- > 5 files changed, 19 insertions(+), 23 deletions(-) > rename {acqui => Koha}/pdfformat/layout2pages.pm (99%) > rename {acqui => Koha}/pdfformat/layout2pagesde.pm (99%) > rename {acqui => Koha}/pdfformat/layout3pages.pm (99%) > rename {acqui => Koha}/pdfformat/layout3pagesfr.pm (99%) > >diff --git a/acqui/pdfformat/layout2pages.pm b/Koha/pdfformat/layout2pages.pm >similarity index 99% >rename from acqui/pdfformat/layout2pages.pm >rename to Koha/pdfformat/layout2pages.pm >index 0d2a6e7..90537c3 100644 >--- a/acqui/pdfformat/layout2pages.pm >+++ b/Koha/pdfformat/layout2pages.pm >@@ -1,4 +1,4 @@ >-#!/usr/bin/perl >+package Koha::pdfformat::layout2pages; > > #example script to print a basketgroup > #written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com >@@ -21,7 +21,6 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > #you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub. >-package pdfformat::layout2pages; > use vars qw(@ISA @EXPORT); > use MIME::Base64; > use Modern::Perl; >diff --git a/acqui/pdfformat/layout2pagesde.pm b/Koha/pdfformat/layout2pagesde.pm >similarity index 99% >rename from acqui/pdfformat/layout2pagesde.pm >rename to Koha/pdfformat/layout2pagesde.pm >index 63269df..aeee17b 100644 >--- a/acqui/pdfformat/layout2pagesde.pm >+++ b/Koha/pdfformat/layout2pagesde.pm >@@ -1,4 +1,4 @@ >-#!/usr/bin/perl >+package Koha::pdfformat::layout2pagesde; > > #example script to print a basketgroup > #written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com >@@ -21,7 +21,6 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > #you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub. >-package pdfformat::layout2pagesde; > use vars qw(@ISA @EXPORT); > use MIME::Base64; > use Modern::Perl; >diff --git a/acqui/pdfformat/layout3pages.pm b/Koha/pdfformat/layout3pages.pm >similarity index 99% >rename from acqui/pdfformat/layout3pages.pm >rename to Koha/pdfformat/layout3pages.pm >index 8f80fe2..d02160e 100644 >--- a/acqui/pdfformat/layout3pages.pm >+++ b/Koha/pdfformat/layout3pages.pm >@@ -1,4 +1,4 @@ >-#!/usr/bin/perl >+package Koha::pdfformat::layout3pages; > > #example script to print a basketgroup > #written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com >@@ -21,7 +21,6 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > #you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub. >-package pdfformat::layout3pages; > use vars qw(@ISA @EXPORT); > use MIME::Base64; > use List::MoreUtils qw/uniq/; >diff --git a/acqui/pdfformat/layout3pagesfr.pm b/Koha/pdfformat/layout3pagesfr.pm >similarity index 99% >rename from acqui/pdfformat/layout3pagesfr.pm >rename to Koha/pdfformat/layout3pagesfr.pm >index 5568e01..b4bdf78 100644 >--- a/acqui/pdfformat/layout3pagesfr.pm >+++ b/Koha/pdfformat/layout3pagesfr.pm >@@ -1,4 +1,4 @@ >-#!/usr/bin/perl >+package Koha::pdfformat::layout3pagesfr; > > #example script to print a basketgroup > #written 07/11/08 by john.soros@biblibre.com and paul.poulain@biblibre.com >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 05c505a..e1cba84 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -49,6 +49,7 @@ use Carp; > use C4::Auth; > use C4::Output; > use CGI qw ( -utf8 ); >+use File::Spec; > > use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/; > use Koha::EDI qw/create_edi_order get_edifact_ean/; >@@ -123,29 +124,27 @@ sub displaybasketgroups { > > sub printbasketgrouppdf{ > my ($basketgroupid) = @_; >- >+ > my $pdfformat = C4::Context->preference("OrderPdfFormat"); >- if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages' || $pdfformat eq 'pdfformat::layout3pagesfr' >- || $pdfformat eq 'pdfformat::layout2pagesde'){ >- eval { >- eval "require $pdfformat"; >- import $pdfformat; >- }; >- if ($@){ >- } >+ my @valid_pdfformats = qw(pdfformat::layout3pages pdfformat::layout2pages pdfformat::layout3pagesfr pdfformat::layout2pagesde); >+ if (grep {$_ eq $pdfformat} @valid_pdfformats) { >+ $pdfformat = "Koha::$pdfformat"; >+ my $pdfformat_filepath = File::Spec->catfile(split /::/, $pdfformat) . '.pm'; >+ require $pdfformat_filepath; >+ import $pdfformat; > } > else { >- print $input->header; >- print $input->start_html; # FIXME Should do a nicer page >- print "<h1>Invalid PDF Format set</h1>"; >- print "Please go to the systempreferences and set a valid pdfformat"; >- exit; >+ print $input->header; >+ print $input->start_html; # FIXME Should do a nicer page >+ print "<h1>Invalid PDF Format set</h1>"; >+ print "Please go to the systempreferences and set a valid pdfformat"; >+ exit; > } >- >+ > my $basketgroup = GetBasketgroup($basketgroupid); > my $bookseller = Koha::Acquisition::Booksellers->find( $basketgroup->{booksellerid} ); > my $baskets = GetBasketsByBasketgroup($basketgroupid); >- >+ > my %orders; > for my $basket (@$baskets) { > my @ba_orders; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21853
:
82422
|
82425
|
82498
|
82499
| 82545 |
82546