koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Breeding.pm cataloguing/addbiblio.pl up... [rel_3_0]


From: Bruno Toumi
Subject: [Koha-cvs] koha C4/Breeding.pm cataloguing/addbiblio.pl up... [rel_3_0]
Date: Wed, 31 Jan 2007 16:22:54 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Bruno Toumi <btoumi>    07/01/31 16:22:54

Modified files:
        C4             : Breeding.pm 
        cataloguing    : addbiblio.pl 
        updater        : updatedatabase 

Log message:
        -add possibility to use isbn with length of 13 characters
        for  Import datas in the reservoir.
        -modify isbn field in marc_breeding table (varchar 13)
        -add isbn filter (no - )when u read a notice from reservoir
        -add filter to have right field 100

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Breeding.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.9.2.1&r2=1.9.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/addbiblio.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.14.2.24&r2=1.14.2.25
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=rel_3_0&r1=1.157.2.55&r2=1.157.2.56

Patches:
Index: C4/Breeding.pm
===================================================================
RCS file: /sources/koha/koha/C4/Breeding.pm,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -b -r1.9.2.1 -r1.9.2.2
--- C4/Breeding.pm      9 Jan 2007 08:35:04 -0000       1.9.2.1
+++ C4/Breeding.pm      31 Jan 2007 16:22:53 -0000      1.9.2.2
@@ -84,10 +84,15 @@
             my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,'');
             $oldbiblio->{title} = char_decode($oldbiblio->{title},$encoding);
             $oldbiblio->{author} = char_decode($oldbiblio->{author},$encoding);
+            
+          my $isbnlength=10;
+          if($oldbiblio->{isbn}){
+          $isbnlength = length($oldbiblio->{isbn});
+          }
             # if isbn found and biblio does not exist, add it. If isbn found 
and biblio exists, overwrite or ignore depending on user choice
             # drop every "special" char : spaces, - ...
             $oldbiblio->{isbn} =~ s/ |-|\.//g,
-            $oldbiblio->{isbn} = substr($oldbiblio->{isbn},0,10);
+            $oldbiblio->{isbn} = substr($oldbiblio->{isbn},0,$isbnlength);
             $oldbiblio->{issn} =~ s/ |-|\.//g,
             $oldbiblio->{issn} = substr($oldbiblio->{issn},0,10);
             # search if biblio exists
@@ -119,9 +124,9 @@
                     my $recoded;
                     $recoded = $marcrecord->as_usmarc();
                     if ($breedingid && $overwrite_biblio eq 1) {
-                        $replacesql 
->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,10),$oldbiblio->{title},$oldbiblio->{author},$recoded,$encoding,$z3950random,$breedingid);
+                        $replacesql 
->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,$isbnlength),$oldbiblio->{title},$oldbiblio->{author},$recoded,$encoding,$z3950random,$breedingid);
                     } else {
-                        $insertsql 
->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,10),$oldbiblio->{title},$oldbiblio->{author},$recoded,$encoding,$z3950random);
+                        $insertsql 
->execute($filename,substr($oldbiblio->{isbn}.$oldbiblio->{issn},0,$isbnlength),$oldbiblio->{title},$oldbiblio->{author},$recoded,$encoding,$z3950random);
                     $breedingid=$dbh->{'mysql_insertid'};
                     }
                     $imported++;

Index: cataloguing/addbiblio.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/addbiblio.pl,v
retrieving revision 1.14.2.24
retrieving revision 1.14.2.25
diff -u -b -r1.14.2.24 -r1.14.2.25
--- cataloguing/addbiblio.pl    29 Jan 2007 17:00:48 -0000      1.14.2.24
+++ cataloguing/addbiblio.pl    31 Jan 2007 16:22:53 -0000      1.14.2.25
@@ -1,6 +1,6 @@
 #!/usr/bin/perl 
 
-# $Id: addbiblio.pl,v 1.14.2.24 2007/01/29 17:00:48 tipaul Exp $
+# $Id: addbiblio.pl,v 1.14.2.25 2007/01/31 16:22:53 btoumi Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -99,6 +99,28 @@
 #         $marc =~ s/frey0103/frey50  /;
         my $record = MARC::Record->new_from_usmarc($marc);
 #         warn "REC : $marc = ".$record->as_formatted;
+       if ($record->subfield('010','a')){
+       my $f010a=$record->subfield('010','a');
+       my $f010 = $record->field('010');
+       $record->delete_field($f010);
+       my $newisbn = $f010a;
+       $newisbn =~ s/-//g;
+       $f010->update('a' => $newisbn);
+       $record->insert_fields_ordered($f010);
+       }
+       
+    if ($record->subfield(100,'a')){
+       my $f100a=$record->subfield(100,'a');
+       my $f100 = $record->field(100);
+       my $f100temp = $f100->as_string;
+       $record->delete_field($f100);
+       if (length($f100temp)>28){
+       substr($f100temp,26,2,"50");
+       $f100->update('a' => $f100temp);
+       my $f100 = MARC::Field->new('100','','','a' => $f100temp);
+       $record->insert_fields_ordered($f100);
+       }
+    }
         if (ref($record) eq undef) {
             return -1;
         } else {

Index: updater/updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.157.2.55
retrieving revision 1.157.2.56
diff -u -b -r1.157.2.55 -r1.157.2.56
--- updater/updatedatabase      30 Jan 2007 10:50:19 -0000      1.157.2.55
+++ updater/updatedatabase      31 Jan 2007 16:22:54 -0000      1.157.2.56
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.157.2.55 2007/01/30 10:50:19 tipaul Exp $
+# $Id: updatedatabase,v 1.157.2.56 2007/01/31 16:22:54 btoumi Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -229,6 +229,7 @@
     aqbudget => { 'branchcode' => 'varchar(4) NULL'},
     auth_header => { 'marc' => 'BLOB NOT NULL', 'linkid' => 'BIGINT(20) NULL'},
     auth_subfield_structure =>{ 'hidden' => 'TINYINT(3) NOT NULL default 0', 
'kohafield' => 'VARCHAR(45) NOT NULL', 'linkid' =>  'TINYINT(1) NOT NULL 
default 0', 'isurl' => 'TINYINT(1)', 'frameworkcode'=>'VARCHAR(8) NOT  NULL'},
+    marc_breeding => { 'isbn' => 'varchar(13) NOT NULL'},
     serial =>{ 'publisheddate' => 'date', 'claimdate' => 'date', 
'itemnumber'=>'text NULL','routingnotes'=>'text NULL',},
     statistics => { 'associatedborrower' => 'integer'},
     z3950servers =>{  "name" =>"text",  "description" => "text NOT NULL",
@@ -1961,6 +1962,13 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.157.2.56  2007/01/31 16:22:54  btoumi
+# -add possibility to use isbn with length of 13 characters
+# for  Import datas in the reservoir.
+# -modify isbn field in marc_breeding table (varchar 13)
+# -add isbn filter (no - )when u read a notice from reservoir
+# -add filter to have right field 100
+#
 # Revision 1.157.2.55  2007/01/30 10:50:19  tipaul
 # adding 2 usefull indexes to biblioitems table
 #




reply via email to

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