[Koha-patches] [PATCH] GetMarcFromKohaField needs 2 args, or there's no point.

Joe Atzberger joe.atzberger at liblime.com
Wed Feb 4 22:55:49 CET 2009


GetMarcFromKohaField returns (0,0) without the $frameworkcode argument.
Note the argument can be "", but it must not be undefined.
---
 C4/Biblio.pm |    4 ++--
 C4/Search.pm |   16 +++++++---------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 54d3cab..44d9fdb 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -2217,7 +2217,7 @@ sub _DelBiblioNoZebra {
     if ($server eq 'biblioserver') {
         %index=GetNoZebraIndexes;
         # get title of the record (to store the 10 first letters with the index)
-        my ($titletag,$titlesubfield) = GetMarcFromKohaField('biblio.title');
+        my ($titletag,$titlesubfield) = GetMarcFromKohaField('biblio.title', ''); # FIXME: should be GetFrameworkCode($biblionumber) ??
         $title = lc($record->subfield($titletag,$titlesubfield));
     } else {
         # for authorities, the "title" is the $a mainentry
@@ -2311,7 +2311,7 @@ sub _AddBiblioNoZebra {
     if ($server eq 'biblioserver') {
         %index=GetNoZebraIndexes;
         # get title of the record (to store the 10 first letters with the index)
-        my ($titletag,$titlesubfield) = GetMarcFromKohaField('biblio.title');
+        my ($titletag,$titlesubfield) = GetMarcFromKohaField('biblio.title', ''); # FIXME: should be GetFrameworkCode($biblionumber) ??
         $title = lc($record->subfield($titletag,$titlesubfield));
     } else {
         # warn "server : $server";
diff --git a/C4/Search.pm b/C4/Search.pm
index 129a222..9abe5f1 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1933,15 +1933,13 @@ sub NZorder {
             my ( $biblionumber, $title ) = split /,/, $_;
             my $record = GetMarcBiblio($biblionumber);
             my $callnumber;
-            my ( $callnumber_tag, $callnumber_subfield ) =
-              GetMarcFromKohaField( $dbh, 'items.itemcallnumber' );
-            ( $callnumber_tag, $callnumber_subfield ) =
-              GetMarcFromKohaField('biblioitems.callnumber')
-              unless $callnumber_tag;
+            my $frameworkcode = GetFrameworkCode($biblionumber);
+            my ( $callnumber_tag, $callnumber_subfield ) = GetMarcFromKohaField(  'items.itemcallnumber', $frameworkcode);
+               ( $callnumber_tag, $callnumber_subfield ) = GetMarcFromKohaField('biblioitems.callnumber', $frameworkcode)
+                unless $callnumber_tag;
             if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
                 $callnumber = $record->subfield( '200', 'f' );
-            }
-            else {
+            } else {
                 $callnumber = $record->subfield( '100', 'a' );
             }
 
@@ -2155,8 +2153,8 @@ sub ModBiblios {
         $tag = $tag . $subfield;
         undef $subfield;
     }
-    my ( $bntag,   $bnsubf )   = GetMarcFromKohaField('biblio.biblionumber');
-    my ( $itemtag, $itemsubf ) = GetMarcFromKohaField('items.itemnumber');
+    my ( $bntag,   $bnsubf )   = GetMarcFromKohaField('biblio.biblionumber', '');
+    my ( $itemtag, $itemsubf ) = GetMarcFromKohaField('items.itemnumber', '');
     if ($tag eq $itemtag) {
         # do not allow the embedded item tag to be 
         # edited from here
-- 
1.5.5.GIT




More information about the Koha-patches mailing list