From 1457256b98afd94dc3e3166200120bfb29b562dc Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 2 Jul 2010 08:39:46 -0400 Subject: [PATCH] bug 4188: move PDF templates for printed purchase orders The PDF templates for purchase orders now live in the directory koha-tmpl/intranet-tmpl/prog/pdf to separate them from code. As no automatic translation system for PDF files is currently implemented, I'm keeping them out of the language subdirectories for now. At present, there are two choices of templates for printing purchase orders (AKA basket groups), controlled by setting the OrderPdfFormat syspref: pdfformat::layout2pages (two-page layout) pdfformat::layout3pages (three-page layout) To customize a template or to add a new one requires two steps: * modifying the PDF; note that OpenOffice source files are included as a way of generating the PDF * modifying the code in acqui/pdfformat/layout*.pm to position the order text onto the template Signed-off-by: Galen Charlton --- C4/Languages.pm | 2 +- acqui/pdfformat/layout2pages.pm | 7 ++----- acqui/pdfformat/layout3pages.pm | 7 ++----- .../intranet-tmpl/prog/pdf}/layout2pages.odt | Bin .../intranet-tmpl/prog/pdf}/layout2pages.pdf | Bin .../intranet-tmpl/prog/pdf}/layout3pages.odt | Bin .../intranet-tmpl/prog/pdf}/layout3pages.pdf | Bin 7 files changed, 5 insertions(+), 11 deletions(-) rename {acqui/pdfformat => koha-tmpl/intranet-tmpl/prog/pdf}/layout2pages.odt (100%) rename {acqui/pdfformat => koha-tmpl/intranet-tmpl/prog/pdf}/layout2pages.pdf (100%) rename {acqui/pdfformat => koha-tmpl/intranet-tmpl/prog/pdf}/layout3pages.odt (100%) rename {acqui/pdfformat => koha-tmpl/intranet-tmpl/prog/pdf}/layout3pages.pdf (100%) diff --git a/C4/Languages.pm b/C4/Languages.pm index f8f60f47b9..fd1659611a 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -267,7 +267,7 @@ sub _get_language_dirs { next if $lang_string =~/css$/; next if $lang_string =~/CVS$/; next if $lang_string =~/\.txt$/i; #Don't read the readme.txt ! - next if $lang_string =~/img|images|famfam|sound/; + next if $lang_string =~/img|images|famfam|sound|pdf/; push @lang_strings, $lang_string; } return (@lang_strings); diff --git a/acqui/pdfformat/layout2pages.pm b/acqui/pdfformat/layout2pages.pm index c7c19853df..768fdec74d 100755 --- a/acqui/pdfformat/layout2pages.pm +++ b/acqui/pdfformat/layout2pages.pm @@ -236,11 +236,8 @@ sub printfooters { sub printpdf { my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_; # open the default PDF that will be used for base (1st page already filled) - use FindBin qw( $Bin ); - open(my $fh, "$Bin/pdfformat/layout2pages.pdf") or die "$@"; - my @pdf = <$fh>; - close($fh); - my $pdf = PDF::API2->openScalar(join('', @pdf)); + my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout2pages.pdf'; + my $pdf = PDF::API2->open($pdf_template); $pdf->pageLabel( 0, { -style => 'roman', } ); # start with roman numbering diff --git a/acqui/pdfformat/layout3pages.pm b/acqui/pdfformat/layout3pages.pm index 2d82b8ad3b..f081b5605c 100755 --- a/acqui/pdfformat/layout3pages.pm +++ b/acqui/pdfformat/layout3pages.pm @@ -373,11 +373,8 @@ sub printfooters { sub printpdf { my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_; # open the default PDF that will be used for base (1st page already filled) - use FindBin qw( $Bin ); - open(my $fh, "$Bin/pdfformat/layout3pages.pdf") or die "$@"; - my @pdf = <$fh>; - close($fh); - my $pdf = PDF::API2->openScalar(join('', @pdf)); + my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout3pages.pdf'; + my $pdf = PDF::API2->open($pdf_template); $pdf->pageLabel( 0, { -style => 'roman', } ); # start with roman numbering diff --git a/acqui/pdfformat/layout2pages.odt b/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.odt similarity index 100% rename from acqui/pdfformat/layout2pages.odt rename to koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.odt diff --git a/acqui/pdfformat/layout2pages.pdf b/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.pdf similarity index 100% rename from acqui/pdfformat/layout2pages.pdf rename to koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.pdf diff --git a/acqui/pdfformat/layout3pages.odt b/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.odt similarity index 100% rename from acqui/pdfformat/layout3pages.odt rename to koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.odt diff --git a/acqui/pdfformat/layout3pages.pdf b/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.pdf similarity index 100% rename from acqui/pdfformat/layout3pages.pdf rename to koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.pdf -- 2.39.5