koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Biblio.pm [rel_2_2]


From: paul poulain
Subject: [Koha-cvs] koha/C4 Biblio.pm [rel_2_2]
Date: Wed, 14 Dec 2005 13:08:47 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     paul poulain <address@hidden>   05/12/14 13:08:47

Modified files:
        C4             : Biblio.pm 

Log message:
        * fix for items.notes that is not correctly handled in the non-MARC 
part of the DB
        * for an unknown reason, mysql fetchrow_hashref returns author BEFORE 
the title, even if you want it after that makes a problem for UNIMARC where we 
have 200 $atitle $fauthor => the record appears $f $a.
        * handling better biblio/biblioitems creation from an acquisition : the 
biblio is deleted & recreated to avoid strange things like a repeated 200 field 
in UNIMARC.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Biblio.pm.diff?only_with_tag=rel_2_2&tr1=1.115.2.25&tr2=1.115.2.26&r1=text&r2=text

Patches:
Index: koha/C4/Biblio.pm
diff -u koha/C4/Biblio.pm:1.115.2.25 koha/C4/Biblio.pm:1.115.2.26
--- koha/C4/Biblio.pm:1.115.2.25        Fri Oct 28 13:46:50 2005
+++ koha/C4/Biblio.pm   Wed Dec 14 13:08:47 2005
@@ -883,7 +883,7 @@
     if ( $biblionumber > 0 ) {
         my $sth2 =
           $dbh->prepare(
-"select 
biblionumber,author,title,unititle,notes,abstract,serial,seriestitle,copyrightdate,timestamp
+"select 
biblionumber,title,unititle,notes,abstract,serial,seriestitle,copyrightdate,timestamp
                from biblio where biblionumber=?"
         );
         $sth2->execute($biblionumber);
@@ -895,6 +895,19 @@
                     $row->{$code}, '');
             }
         }
+        #for an unknown reason, mysql fetchrow_hashref returns author BEFORE 
the title, even if you want it after
+        # that makes a problem for UNIMARC where we have 200 $atitle $fauthor 
=> the record appears $f $a.
+        # this dirty hack fixes the problem
+        $sth2 = $dbh->prepare("select author from biblio where 
biblionumber=?");
+        $sth2->execute($biblionumber);
+        $row = $sth2->fetchrow_hashref;
+        $code;
+        foreach $code ( keys %$row ) {
+            if ( $row->{$code} ) {
+                &MARCkoha2marcOnefield( $sth, $record, "biblio." . $code,
+                    $row->{$code}, '');
+            }
+        }
     }
 
     #--- if biblioitem, then retrieve old-style koha data
@@ -1874,7 +1887,7 @@
     $item->{'itemnum'} = $item->{'itemnumber'} unless $item->{'itemnum'};
     my $query = "update items set  
barcode=?,itemnotes=?,itemcallnumber=?,notforloan=?,location=?,multivolumepart=?,multivolume=?,stack=?,wthdrawn=?";
     my @bind = (
-        $item->{'barcode'},                    $item->{'notes'},
+        $item->{'barcode'},                    $item->{'itemnotes'},
         $item->{'itemcallnumber'},     $item->{'notforloan'},
         $item->{'location'},           $item->{multivolumepart},
                $item->{multivolume},           $item->{stack},
@@ -1886,7 +1899,7 @@
                                                        
location=?,multivolumepart=?,multivolume=?,stack=?,wthdrawn=?";
         @bind = (
             $item->{'bibitemnum'},     $item->{'barcode'},
-            $item->{'notes'},          $item->{'homebranch'},
+            $item->{'itemnotes'},          $item->{'homebranch'},
             $item->{'lost'},           $item->{'wthdrawn'},
             $item->{'itemcallnumber'}, $item->{'notforloan'},
             $item->{'location'},               $item->{multivolumepart},
@@ -2166,11 +2179,14 @@
     my $bibitemnum = &OLDnewbiblioitem( $dbh, $biblioitem );
 
     my $MARCbiblio =
-      MARCkoha2marcBiblio( $dbh, 0, $bibitemnum )
-      ; # the 0 means "do NOT retrieve biblio, only biblioitem, in the MARC 
record
+      MARCkoha2marcBiblio( $dbh, $biblioitem->{biblionumber}, $bibitemnum );
+      # the 0 means "do NOT retrieve biblio, only biblioitem, in the MARC 
record
     my $bibid =
       &MARCfind_MARCbibid_from_oldbiblionumber( $dbh,
         $biblioitem->{biblionumber} );
+    # delete biblio, as we will reintroduce it the line after
+    # the biblio is complete from MARCkoha2marcBiblio (3 lines before)
+    &MARCdelbiblio($dbh,$bibid,1);
     &MARCaddbiblio( $dbh, $MARCbiblio, $biblioitem->{biblionumber}, '',$bibid 
);
     return ($bibitemnum);
 }
@@ -2753,8 +2769,13 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.115.2.25 2005/10/28 13:46:50 doxulting Exp $
+# $Id: Biblio.pm,v 1.115.2.26 2005/12/14 13:08:47 tipaul Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.115.2.26  2005/12/14 13:08:47  tipaul
+# * fix for items.notes that is not correctly handled in the non-MARC part of 
the DB
+# * for an unknown reason, mysql fetchrow_hashref returns author BEFORE the 
title, even if you want it after that makes a problem for UNIMARC where we have 
200 $atitle $fauthor => the record appears $f $a.
+# * handling better biblio/biblioitems creation from an acquisition : the 
biblio is deleted & recreated to avoid strange things like a repeated 200 field 
in UNIMARC.
+#
 # Revision 1.115.2.25  2005/10/28 13:46:50  doxulting
 # There was a bug : Even if you erased the marc field linked to 
additionalauthors.authors the additionalauthors stayed in database. Now : 
delete before recreating
 #




reply via email to

[Prev in Thread] Current Thread [Next in Thread]