BUGFIX & improvement : new biblioitems fields saving and GetMarcAuthors improvement
authorPaul POULAIN <paul@koha-fr.org>
Wed, 12 Sep 2007 13:59:53 +0000 (15:59 +0200)
committerChris Cormack <crc@liblime.com>
Thu, 13 Sep 2007 01:54:13 +0000 (20:54 -0500)
hdl defined 5 new fields in biblioitems, to handle collections.
The _koha_modify_biblioitem didn't deal with those fields. it's fixed now.

GetMarcAuthor in UNIMARC have a $4 field that is related to the responsability the author has
it is connected to an authorised value.
The improvement expand the numeric value to the expanded one.

Signed-off-by: Chris Cormack <crc@liblime.com>
C4/Biblio.pm

index 00688fd..d0cdcb6 100644 (file)
@@ -1820,6 +1820,8 @@ The authors are stored in differents places depending on MARC flavour
 sub GetMarcAuthors {
     my ( $record, $marcflavour ) = @_;
     my ( $mintag, $maxtag );
+    # tagslib useful for UNIMARC author reponsabilities
+    my $tagslib = &GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be bugguy on some setups, will be usually correct.
     if ( $marcflavour eq "MARC21" ) {
         $mintag = "100";
         $maxtag = "111"; 
@@ -1842,7 +1844,6 @@ sub GetMarcAuthors {
                 $marcflavour ne 'MARC21'
                 and (
                     ($authors_subfield->[0] eq '3') or
-                    ($authors_subfield->[0] eq '4') or
                     ($authors_subfield->[0] eq '5')
                 )
             )
@@ -1854,7 +1855,17 @@ sub GetMarcAuthors {
             }
             $count_auth++;
             my $subfieldcode = $authors_subfield->[0];
-            my $value        = $authors_subfield->[1];
+            my $value;
+            # deal with UNIMARC author responsability
+            if (
+                $marcflavour ne 'MARC21'
+                and ($authors_subfield->[0] eq '4')
+            )
+            {
+                $value = "(".GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib ).")";
+            } else {
+                $value        = $authors_subfield->[1];
+            }
             $hash{tag}       = $field->tag;
             $hash{value}    .= $value . " " if ($subfieldcode != 9) ;
             $hash{link}     .= $value if ($subfieldcode eq 9);
@@ -3332,6 +3343,11 @@ sub _koha_modify_biblioitem {
     $biblioitem->{'bnotes'}       = $dbh->quote( $biblioitem->{'bnotes'} );
     $biblioitem->{'size'}         = $dbh->quote( $biblioitem->{'size'} );
     $biblioitem->{'place'}        = $dbh->quote( $biblioitem->{'place'} );
+    $biblioitem->{'collectiontitle'}        = $dbh->quote( $biblioitem->{'collectiontitle'} );
+    $biblioitem->{'collectionissn'}         = $dbh->quote( $biblioitem->{'collectionissn'} );
+    $biblioitem->{'collectionvolume'}       = $dbh->quote( $biblioitem->{'collectionvolume'} );
+    $biblioitem->{'editionstatement'}       = $dbh->quote( $biblioitem->{'editionstatement'} );
+    $biblioitem->{'editionresponsability'}  = $dbh->quote( $biblioitem->{'editionresponsability'} );
     $biblioitem->{'ccode'}        = $dbh->quote( $biblioitem->{'ccode'} );
     $biblioitem->{'biblionumber'} =
       $dbh->quote( $biblioitem->{'biblionumber'} );
@@ -3352,6 +3368,11 @@ sub _koha_modify_biblioitem {
         notes           = $biblioitem->{'bnotes'},
         size            = $biblioitem->{'size'},
         place           = $biblioitem->{'place'},
+        collectiontitle = $biblioitem->{'collectiontitle'},
+        collectionissn  = $biblioitem->{'collectionissn'},
+        collectionvolume= $biblioitem->{'collectionvolume'},
+        editionstatement= $biblioitem->{'editionstatement'},
+        editionresponsability= $biblioitem->{'editionresponsability'},
         ccode           = $biblioitem->{'ccode'}
         where biblionumber = $biblioitem->{'biblionumber'}";