Bug 11856: Add publication year and edition to English acq PDF templates
authorKatrin Fischer <katrin.fischer@bsz-bw.de>
Thu, 27 Feb 2014 10:12:11 +0000 (11:12 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 28 Apr 2014 17:19:31 +0000 (17:19 +0000)
To test:
- Switch OrderPdfFormat to pdfformat::layout3pages
- Create one or more  baskets with a few orders, make sure you
  are adding some records that contain a publication year and/or
  edition statement
- Close the basket
- Create a basket group
- Print the PDF and check that edition and publication year
  show up and bibliographic information is printed correctly
- Switch OrderPdfFormat to pdfformat::layout2pages
- Repeat PDF print

This patch also changes the formatting a bit and differentiates between
UNIMARC and MARC21. For MARC21 no additional punctuation is needed as
those are cataloged with the information. Only spaces are added for MARC21,
while UNIMARC is kept they way it was before.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
acqui/basketgroup.pl
acqui/pdfformat/layout2pages.pm
acqui/pdfformat/layout3pages.pm

index b2d8b94..8d84270 100755 (executable)
@@ -200,12 +200,15 @@ sub printbasketgrouppdf{
 
             # Editor Number
             my $en;
+            my $edition;
             my $marcrecord=eval{MARC::Record::new_from_xml( $ord->{marcxml},'UTF-8' )};
             if ($marcrecord){
                 if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) {
                     $en = $marcrecord->subfield( '345', "b" );
+                    $edition = $marcrecord->subfield( '205', 'a' );
                 } elsif ( C4::Context->preference("marcflavour") eq 'MARC21' ) {
                     $en = $marcrecord->subfield( '037', "a" );
+                    $edition = $marcrecord->subfield( '250', 'a' );
                 }
             }
 
@@ -213,8 +216,9 @@ sub printbasketgrouppdf{
                 isbn => ($ord->{isbn} ? $ord->{isbn} : undef),
                 itemtype => ( $ord->{itemtype} and $bib->{itemtype} ? $itemtypes->{$bib->{itemtype}}->{description} : undef ),
                 en => ( $en ? $en : undef ),
+                edition => ( $edition ? $edition : undef ),
             };
-            for my $key ( qw/ gstrate author title itemtype publishercode discount quantity rrpgsti rrpgste gstgsti gstgste ecostgsti ecostgste gstvalue totalgste totalgsti / ) {
+            for my $key ( qw/ gstrate author title itemtype publishercode copyrightdate publicationyear discount quantity rrpgsti rrpgste gstgsti gstgste ecostgsti ecostgste gstvalue totalgste totalgsti / ) {
                 $ba_order->{$key} = $ord->{$key};
             }
 
index 335dc0a..df84c7d 100644 (file)
@@ -88,12 +88,32 @@ sub printorders {
     }
     push(@$abaskets, $arrbasket);
 
+    my $titleinfo;
     for my $basket (@$baskets){
         for my $line (@{$orders->{$basket->{basketno}}}) {
             $arrbasket = undef;
+            $titleinfo = "";
+            if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) {
+                $titleinfo =  $line->{title} . " / " . $line->{author} .
+                    ( $line->{isbn} ? " ISBN: " . $line->{isbn} : '' ) .
+                    ( $line->{en} ? " EN: " . $line->{en} : '' ) .
+                    ( $line->{itemtype} ? ", " . $line->{itemtype} : '' ) .
+                    ( $line->{edition} ? ", " . $line->{edition} : '' ) .
+                    ( $line->{publishercode} ? ' published by '. $line->{publishercode} : '') .
+                    ( $line->{publicationyear} ? ', '. $line->{publicationyear} : '');
+            }
+            else { # MARC21, NORMARC
+                $titleinfo =  $line->{title} . " " . $line->{author} .
+                    ( $line->{isbn} ? " ISBN: " . $line->{isbn} : '' ) .
+                    ( $line->{en} ? " EN: " . $line->{en} : '' ) .
+                    ( $line->{itemtype} ? " " . $line->{itemtype} : '' ) .
+                    ( $line->{edition} ? ", " . $line->{edition} : '' ) .
+                    ( $line->{publishercode} ? ' published by '. $line->{publishercode} : '') .
+                    ( $line->{copyrightdate} ? ' '. $line->{copyrightdate} : '');
+            }
             push( @$arrbasket,
                 $basket->{basketno},
-                $line->{title} . " / " . $line->{author} . ( $line->{isbn} ? " ISBN : " . $line->{isbn} : '' ) . ( $line->{en} ? " EN : " . $line->{en} : '' ) . ", " . $line->{itemtype} . ( $line->{publishercode} ? ' published by '. $line->{publishercode} : ""),
+                $titleinfo,
                 $line->{quantity},
                 $num->format_price($line->{rrpgsti}),
                 $num->format_price($line->{discount}).'%',
index b9d10aa..d09be33 100644 (file)
@@ -108,10 +108,31 @@ sub printorders {
             push(@$arrbasket, $bkey);
         }
         push(@$abaskets, $arrbasket);
+
+        my $titleinfo;
         foreach my $line (@{$orders->{$basket->{basketno}}}) {
             $arrbasket = undef;
+            $titleinfo = "";
+            if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) {
+                $titleinfo =  $line->{title} . " / " . $line->{author} .
+                    ( $line->{isbn} ? " ISBN: " . $line->{isbn} : '' ) .
+                    ( $line->{en} ? " EN: " . $line->{en} : '' ) .
+                    ( $line->{itemtype} ? ", " . $line->{itemtype} : '' ) .
+                    ( $line->{edition} ? ", " . $line->{edition} : '' ) .
+                    ( $line->{publishercode} ? ' published by '. $line->{publishercode} : '') .
+                    ( $line->{publicationyear} ? ', '. $line->{publicationyear} : '');
+            }
+            else { # MARC21, NORMARC
+                $titleinfo =  $line->{title} . " " . $line->{author} .
+                    ( $line->{isbn} ? " ISBN: " . $line->{isbn} : '' ) .
+                    ( $line->{en} ? " EN: " . $line->{en} : '' ) .
+                    ( $line->{itemtype} ? " " . $line->{itemtype} : '' ) .
+                    ( $line->{edition} ? ", " . $line->{edition} : '' ) .
+                    ( $line->{publishercode} ? ' published by '. $line->{publishercode} : '') .
+                    ( $line->{copyrightdate} ? ' '. $line->{copyrightdate} : '');
+            }
             push( @$arrbasket,
-                $line->{title} . " / " . $line->{author} . ( $line->{isbn} ? " ISBN : " . $line->{isbn} : '' ) . ( $line->{en} ? " EN : " . $line->{en} : '' ) . ", " . $line->{itemtype} . ( $line->{publishercode} ? ' published by '. $line->{publishercode} : ""),
+                $titleinfo,
                 $line->{quantity},
                 $num->format_price($line->{rrpgste}),
                 $num->format_price($line->{rrpgsti}),