Pruning documentation files

This commit is contained in:
hdl 2006-01-31 11:08:05 +00:00
parent 70d7337063
commit fa5aa442ee
7 changed files with 0 additions and 372 deletions

View File

@ -1,230 +0,0 @@
#!/usr/bin/perl
# small script that import an iso2709 file into koha 2.0
use strict;
use MARC::File::USMARC;
use MARC::Record;
use MARC::Batch;
use C4::Context;
use C4::Biblio;
use C4::Date;
use Time::HiRes qw(gettimeofday);
use Getopt::Long;
my ( $input_marc_file) = ('');
my ($version, $test_parameter,$char_encoding, $annexe);
GetOptions(
'file:s' => \$input_marc_file,
'h' => \$version,
't' => \$test_parameter,
'c:s' => \$char_encoding,
'a:s' => \$annexe,
);
if ($version || ($input_marc_file eq '')) {
print <<EOF
Script pour importer un fichier iso2709 dans Koha.
Paramètres :
\th : Cet écran d'aide
\tfile /chemin/vers/fichier/fichier.iso2709 : Le fichier à importer
\tt : test mode : Ne fait rien, sauf parser le fichier.
\tc : L'encodate des caractères. UNIMARC (valeur par défaut) ou MARC21
SAMPLE : ./import.pl -file /home/koha/bdp82-janvier.iso2709
EOF
;#'/
die;
}
my $dbh = C4::Context->dbh;
if ($test_parameter) {
print "TESTING MODE ONLY\n DOING NOTHING\n===============\n";
}
$|=1; # flushes output
$char_encoding = 'UNIMARC' unless ($char_encoding);
my $starttime = gettimeofday;
my $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
$batch->warnings_off();
$batch->strict_off();
my $i=0;
#1st of all, find item MARC tag.
my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber");
while ( my $record = $batch->next() ) {
$i++;
print ".";
my $timeneeded = gettimeofday - $starttime;
print "$i in $timeneeded s\n" unless ($i % 50);
#now, parse the record, extract the item fields, and store them in somewhere else.
## create an empty record object to populate
my $newRecord = MARC::Record->new();
# noter le champ 908 (public visé). => ca ne doit rien donner dans les fichiers BDP
# go through each field in the existing record
foreach my $oldField ( $record->fields() ) {
# just reproduce tags < 010 in our new record
if ( $oldField->tag() < 10 ) {
$newRecord->append_fields( $oldField );
next();
}
# store our new subfield data in this list
my @newSubfields = ();
# go through each subfield code/data pair
foreach my $pair ( $oldField->subfields() ) {
$pair->[1] =~ s/\<//g;
$pair->[1] =~ s/\>//g;
# supprimer les - dans l'ISBN
if ($oldField->tag() eq '010' && $pair->[0] eq 'a') {
$pair->[1] =~ s/-//g;
}
# supprimer les () dans le titre
if ($oldField->tag() eq '200' && $pair->[0] eq 'a') {
# warn "==>".$pair->[1];
$pair->[1] =~ s/\x88//g;
$pair->[1] =~ s/\x89//g;
}
if ($oldField->tag() eq '995' && $pair->[0] eq 'f') {
# warn "==>".$pair->[1];
$pair->[0] = 'j';
$pair->[1] = "a".$pair->[1]."b";
}
if ($oldField->tag() eq '995' && $pair->[0] eq 'c') {
# warn "==>".$pair->[1];
$pair->[1] = "BIB";
}
if ($oldField->tag() eq '995' && $pair->[0] eq 'a') {
# warn "==>".$pair->[1];
$pair->[1] = "Med";
$pair->[0] = 'b';
}
# on ignore le 995$o (notforloan dans Koha)
push( @newSubfields, $pair->[0], char_decode($pair->[1],$char_encoding)) unless ($oldField->tag() eq 995 and $pair->[0] eq 'o');
}
# Ajouter le nouveau champ dans le MARC::Record, en déplacant le 906 en 610 (indexation libre)
my $newField;
# if ($oldField->tag() eq 906) {
# $newField = MARC::Field->new(
# 610,
# $oldField->indicator(1),
# $oldField->indicator(2),
# @newSubfields
# );
# } else {
$newField = MARC::Field->new(
$oldField->tag(),
$oldField->indicator(1),
$oldField->indicator(2),
@newSubfields
);
# }
$newRecord->append_fields( $newField );
}
# ajouter itemtypes
# print $record->as_formatted unless $record->field("995");
my $cote =$record->field("995")->subfield("k");
my $itemtypefield;
if ($newRecord->field('200')) {
my $type;
$type = "SF" if $cote=~/^SF /;
$type = "RP" if $cote=~/^RP /;
$type = "BDA" if ($cote=~/^BD / && $cote!~/\([J|R|B]\)/);
$type = "BD" if ($cote=~/^BD / && $cote=~/\([J|R|B]\)\s*$/);
$type = "JR" if ($cote=~/^R? / && $cote=~/\([J|R|B]\)\s*$/);
$type = "R" if ($cote=~/^R / && $cote!~/\([J|R|B]\)/);
$type = "RP" if ($cote=~/^RP / && $cote!~/\([J|R|B]\)/);
$type = "RV" if ($cote=~/^RV / && $cote!~/\([J|R|B]\)/);
$type = "RH" if ($cote=~/^RH / && $cote!~/\([J|R|B]\)/);
$type = "JD" if ($cote=~/^[0-9.]* / && $cote=~/\([J|R|B]\)\s*$/);
$type = "RP" if ($cote=~/^RP / && $cote!~/\([J|R|B]\)/);
$type = "ED" if ($cote=~/^C / && $cote=~/\([J|R|B]\)\s*$/);
$type = "RV" if ($cote=~/^[0-9.]* / && $cote!~/\([J|R|B]\)/);
$type = "A" if ($cote=~/^A /);
$type = "N" if ($cote=~/^N /);
$type = "BDP" unless ($type);
$newRecord->field('200')->add_subfields('b' => $type,
);
}
if ($newRecord->field('317')) {
my $date;
$date = format_date('today');
$newRecord->field('317')->add_subfields('a' => $date,
);
} else {
my $date;
$date = format_date('today');
my $newField = MARC::Field->new('317','','','a'=>$date);
$newRecord->append_fields($newField)
}
if ($newRecord->field('010') && $newRecord->field('010')->subfield('d')){
my $tmpField = $newRecord->field('010')->clone;
$newRecord->delete_field($tmpField);
if ($newRecord->field('995')){
$newRecord->field('995')->add_subfields('u'=>$tmpField->subfield('d'));
}else{
my $Field= MARC::Field->new('995','','','u'=>$tmpField->subfield('d'));
$newRecord->insert_fields_ordered($Field);
}
}
my @fields = $newRecord->field($tagfield);
my @items;
my $nbitems=0;
foreach my $field (@fields) {
my $item = MARC::Record->new();
if ($field->subfield('b')){$field->update('b' => 'Med');} else {$field->add_subfields('b' => 'Med');}
if ($field->subfield('c')){$field->update('c' => 'BIB');} else {$field->add_subfields('c' => 'BIB');}
$field->add_subfields('s' => 'Médiathèque');
# if ($public_vise eq "A partir de 1 an") {
# $field->update('q' => '0-5');
# } elsif ($public_vise eq "A partir de 2 ans") {
# $field->update('q' => '0-5');
# } elsif ($public_vise eq "A partir de 3 ans") {
# $field->update('q' => '0-5');
# } elsif ($public_vise eq "A partir de 4 ans") {
# $field->update('q' => '0-5');
# } elsif ($public_vise eq "A partir de 6 ans") {
# $field->update('q' => '06-09');
# } elsif ($public_vise eq "A partir de 7 ans") {
# $field->update('q' => '06-09');
# } elsif ($public_vise eq "A partir de 8 ans") {
# $field->update('q' => '06-09');
# } elsif ($public_vise eq "A partir de 9 ans") {
# $field->update('q' => '06-09');
# } elsif ($public_vise eq "A partir de 10 ans") {
# $field->update('q' => '10-11');
# } elsif ($public_vise eq "A partir de 11 ans") {
# $field->update('q' => '10-11');
# } elsif ($public_vise eq "A partir de 12 ans") {
# $field->update('q' => '12-16');
# } elsif ($public_vise eq "A partir de 13 ans") {
# $field->update('q' => '12-16');
# } elsif ($public_vise eq "A partir de 14 ans") {
# $field->update('q' => '12-16');
# } else {
# $field->update('q' => '18');
# }
$item->append_fields($field);
push @items,$item;
$newRecord->delete_field($field);
$nbitems++;
}
# now, create biblio and items with NEWnewXX call.
unless ($test_parameter) {
warn "biblio : ".$newRecord->as_formatted;
my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$newRecord,'') if $nbitems>0;
for (my $i=0;$i<$nbitems;$i++) {
my $itemfield = $items[$i];
warn "Exemplaire $i : ".$itemfield->as_formatted;
NEWnewitem($dbh,$itemfield,$bibid,'');
}
}
}
# $dbh->do("unlock tables");
my $timeneeded = gettimeofday - $starttime;
print "$i MARC record done in $timeneeded seconds\n";

View File

@ -1,78 +0,0 @@
#!/usr/bin/perl
# small script that deletes biblios which barcodes are in the parameter file.
use strict;
use MARC::File::USMARC;
use MARC::Record;
use MARC::Batch;
use C4::Context;
use C4::Biblio;
use Time::HiRes qw(gettimeofday);
use Getopt::Long;
my ( $input_file) = ('');
my ($version, $test_parameter,$char_encoding, $annexe);
GetOptions(
'file:s' => \$input_file,
'h' => \$version,
't' => \$test_parameter,
);
if ($version || ($input_file eq '')) {
print <<EOF
Script pour supprimer des notices en série dans Koha
Paramètres :
\th : Cet écran d'aide
\tfile /chemin/vers/fichier/fichier.codebarres : Le fichier contenant les code-barres à supprimer. Chaque code-barre est sur une ligne différente.
\tt : test mode : Ne fait rien, sauf parser le fichier.
SAMPLE : ./nettoie_bdp.pl -file /home/koha/liste_barcodes.txt
EOF
;#'
die;
}
my $dbh = C4::Context->dbh;
if ($test_parameter) {
print "TESTING MODE ONLY\n DOING NOTHING\n===============\n";
}
$|=1; # flushes output
my $starttime = gettimeofday;
open FILE, $input_file || die "erreur : fichier introuvable";
my $i=0;
#1st of all, find barcode MARC tag.
my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.barcode");
my $sth = $dbh->prepare("select bibid from marc_subfield_table where tag=$tagfield and subfieldcode='$tagsubfield' and subfieldvalue=?");
while ( my $barcode = <FILE> ) {
$barcode=~tr#\n\r\l# #;
$barcode=~s/\s//g;
chomp $barcode;
$barcode="a".$barcode."b" if not ($barcode=~/a|b/);
$i++;
$sth->execute($barcode);
my ($bibid) = $sth->fetchrow;
if ($test_parameter) {
if ($bibid) {
print "suppression de $bibid (code barre $barcode)\n";
} else {
print "Problème avec le code barre $barcode : introuvable dans la base\n";
}
} else {
if ($bibid) {
&NEWdelbiblio($dbh,$bibid);
} else {
print "Problème avec le code barre $barcode : introuvable dans la base\n";
}
print ".";
my $timeneeded = gettimeofday - $starttime;
print "$i in $timeneeded s\n" unless ($i % 50);
}
# print "B : $barcode";
}
# $dbh->do("unlock tables");
my $timeneeded = gettimeofday - $starttime;
print "$i MARC record done in $timeneeded seconds\n";

View File

@ -1,23 +0,0 @@
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@dummy-opac
DocumentRoot /koha-2.2.5/opac-html
ScriptAlias /cgi-bin/koha/ /koha-2.2.5/opac-cgi/
ServerName opac
ErrorLog logs/opac-error_log
CustomLog logs/opac-access_log common
SetEnv PERL5LIB "c:/koha-2.2.5/modules"
</VirtualHost>
<VirtualHost *>
ServerAdmin webmaster@dummy-opac
DocumentRoot /koha-2.2.5/intranet-html
ScriptAlias /cgi-bin/koha/ /koha-2.2.5/intranet-cgi/
ServerName intranet
ErrorLog logs/intranet-error_log
CustomLog logs/intranet-access_log common
SetEnv PERL5LIB "c:/koha-2.2.5/modules"
</VirtualHost>

View File

@ -1,9 +0,0 @@
database=koha
hostname=localhost
user=kohaadmin
pass=K0h@dm1n
intranetdir=c:/koha-2.2.5/intranet-cgi
opacdir=c:/koha-2.2.5/opac-cgi
kohaversion=2.2.2
opachtdocs=c:/koha-2.2.5/opac-html/opac-tmpl
intrahtdocs=c:/koha-2.2.5/intranet-html/intranet-tmpl

View File

@ -1,16 +0,0 @@
#!/bin/sh
#
# This script opens a gnome-terminal in the directory you select.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Copyright (C) Keith Conger <acid@twcny.rr.com>
#
# Install in your ~/Nautilus/scripts directory.
# You need to be running Nautilus 1.0.3+ to use scripts.
export KOHA_CONF="/etc/koha/koha.conf"
export PERL5LIB='/usr/local/koha/intranet/modules'
/home/responsables/valerie/.bdp/import.pl -file "$1"

View File

@ -1,16 +0,0 @@
#!/bin/sh
#
# This script opens a gnome-terminal in the directory you select.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Copyright (C) Keith Conger <acid@twcny.rr.com>
#
# Install in your ~/Nautilus/scripts directory.
# You need to be running Nautilus 1.0.3+ to use scripts.
export KOHA_CONF="/etc/koha/koha.conf"
export PERL5LIB='/usr/local/koha/intranet/modules'
/home/responsables/valerie/.bdp/nettoie_bdp.pl -file "$1"