koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/misc rebuildthesaurus.pl,NONE,1.1.2.1 release_notes


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/misc rebuildthesaurus.pl,NONE,1.1.2.1 release_notes_200RC2.txt,1.1.2.2,1.1.2.3
Date: Tue, 20 Jan 2004 04:59:30 -0800

Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv24984/misc

Modified Files:
      Tag: rel_2_0
        release_notes_200RC2.txt 
Added Files:
      Tag: rel_2_0
        rebuildthesaurus.pl 
Log Message:
2.0.0RC2 build last commits...

--- NEW FILE ---
#!/usr/bin/perl
# script that rebuild thesaurus from biblio table.

use strict;

# Koha modules used
use MARC::File::USMARC;
use MARC::Record;
use MARC::Batch;
use C4::Context;
use C4::Biblio;
use C4::Authorities;
use Time::HiRes qw(gettimeofday);

use Getopt::Long;
my ( $input_marc_file, $number) = ('',0);
my ($version, $verbose, $test_parameter, $field,$delete,$category,$subfields);
GetOptions(
    'h' => \$version,
    'd' => \$delete,
    't' => \$test_parameter,
    'f:s' => \$field,
    's:s' => \$subfields,
    'v' => \$verbose,
    'c:s' => \$category,
);

if ($version || ($category eq '')) {
        print <<EOF
small script to recreate a authority table into Koha.
parameters :
\th : this version/help screen
\tc : thesaurus category
\tv : verbose mode.
\tt : test mode : parses the file, saying what he would do, but doing nothing.
\tf : the field
\ts : the subfields
\d : delete every entry of the selected category before doing work.

SAMPLE : ./bulkmarcimport.pl -c NP -f 700 -s "\$a, \$b (\$c ; \$d)" => will 
build authority file NP with value constructed with 700 field \$a, \$b, \$c & 
\$d subfields
In UNIMARC this rebuild author authority file.
EOF
;#
die;
}

my $dbh = C4::Context->dbh;
my @subfields = $subfields =~ /(\S)/g;
if ($delete) {
        print "deleting thesaurus\n";
        my $sth = $dbh->prepare("delete from bibliothesaurus where category=?");
        $sth->execute($category);
}
if ($test_parameter) {
        print "TESTING MODE ONLY\n    DOING NOTHING\n===============\n";
}

my $starttime = gettimeofday;
my $sth = $dbh->prepare("select bibid from marc_biblio");
$sth->execute;
my $i;
while (my ($bibid) = $sth->fetchrow) {
        my $record = MARCgetbiblio($dbh,$bibid);
#       warn $record->as_formatted;
        foreach my $fieldwanted ($record->field($field)) {
                my $resultstring = $subfields;
                foreach my $pair ( $fieldwanted->subfields() ) {
                        $resultstring =~ s/\$$pair->[0]/$pair->[1]/g;
                }
                # deals empty subfields
                foreach my $empty (@subfields) {
                        $resultstring =~ s/\$$empty//g;
                }
                warn "result : $resultstring" if $verbose;
                &newauthority($dbh,$category,$resultstring);
                $i++;
        }

}
my $timeneeded = gettimeofday - $starttime;
print "$i entries done in $timeneeded seconds\n";

Index: release_notes_200RC2.txt
===================================================================
RCS file: /cvsroot/koha/koha/misc/Attic/release_notes_200RC2.txt,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** release_notes_200RC2.txt    20 Jan 2004 09:47:11 -0000      1.1.2.2
--- release_notes_200RC2.txt    20 Jan 2004 12:59:28 -0000      1.1.2.3
***************
*** 3,7 ****
  This version of Koha is the second in the 2.0 "stable" series.
  It does not mean that it has no bugs, but least five libraries are using it 
and don't encounter impossible problems.
! If you want to adopt Koha, please do, but you're warned that this release 
candidate version may still have some bugs and missing features. If you test it 
and let us know about any we haven't seen yet, it will help us to fix them.
  
  
--- 3,11 ----
  This version of Koha is the second in the 2.0 "stable" series.
  It does not mean that it has no bugs, but least five libraries are using it 
and don't encounter impossible problems.
! If you want to adopt Koha, please do, but you're warned that this release 
candidate version may still have some bugs and missing features.
! If you test it and let us know about any we haven't seen yet, it will help us 
to fix them.
! 
! The 2.0.x series version is "feature freezed". Only bugs or minor changes 
will be made in this branch.
! The koha team is already working on the 2.2.x version. In CVS (HEAD branch), 
developpers can already get 1st draft of a working z3950 server.
  
  
***************
*** 76,79 ****
--- 80,84 ----
  * publisher added in acquisition process (the one with basket & supplier) 
Basket now ordered by publisher.
  * notforloan field management added in itemtype administration screen
+ * new migration script : misc/rebuildthesaurus.pl => this script can rebuild 
thesaurus/authority file after importing records with misc/bulkmarcimport.pl
  
  DB change :




reply via email to

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