bug 4188: move PDF templates for printed purchase orders
authorGalen Charlton <gmcharlt@gmail.com>
Fri, 2 Jul 2010 12:39:46 +0000 (08:39 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Fri, 2 Jul 2010 12:49:44 +0000 (08:49 -0400)
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 <gmcharlt@gmail.com>
C4/Languages.pm
acqui/pdfformat/layout2pages.odt [deleted file]
acqui/pdfformat/layout2pages.pdf [deleted file]
acqui/pdfformat/layout2pages.pm
acqui/pdfformat/layout3pages.odt [deleted file]
acqui/pdfformat/layout3pages.pdf [deleted file]
acqui/pdfformat/layout3pages.pm
koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.odt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.pdf [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.odt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.pdf [new file with mode: 0644]

index f8f60f4..fd16596 100644 (file)
@@ -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.odt b/acqui/pdfformat/layout2pages.odt
deleted file mode 100644 (file)
index e072883..0000000
Binary files a/acqui/pdfformat/layout2pages.odt and /dev/null differ
diff --git a/acqui/pdfformat/layout2pages.pdf b/acqui/pdfformat/layout2pages.pdf
deleted file mode 100644 (file)
index 59d0de8..0000000
Binary files a/acqui/pdfformat/layout2pages.pdf and /dev/null differ
index c7c1985..768fdec 100755 (executable)
@@ -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.odt b/acqui/pdfformat/layout3pages.odt
deleted file mode 100644 (file)
index 8e91458..0000000
Binary files a/acqui/pdfformat/layout3pages.odt and /dev/null differ
diff --git a/acqui/pdfformat/layout3pages.pdf b/acqui/pdfformat/layout3pages.pdf
deleted file mode 100644 (file)
index 1560e78..0000000
Binary files a/acqui/pdfformat/layout3pages.pdf and /dev/null differ
index 2d82b8a..f081b56 100755 (executable)
@@ -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/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.odt b/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.odt
new file mode 100644 (file)
index 0000000..e072883
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.odt differ
diff --git a/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.pdf b/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.pdf
new file mode 100644 (file)
index 0000000..59d0de8
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/pdf/layout2pages.pdf differ
diff --git a/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.odt b/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.odt
new file mode 100644 (file)
index 0000000..8e91458
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.odt differ
diff --git a/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.pdf b/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.pdf
new file mode 100644 (file)
index 0000000..1560e78
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/pdf/layout3pages.pdf differ