[Koha-cvs] CVS: koha/C4 Biblio.pm,1.25,1.26
Paul POULAIN
tipaul at users.sourceforge.net
Tue Nov 12 16:58:45 CET 2002
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv9086/C4
Modified Files:
Biblio.pm
Log Message:
road to 1.3.2 :
* many bugfixes
* adding value_builder : you can map a subfield in the marc_subfield_structure to a sub stored in "value_builder" directory. In this directory you can create screen used to build values with any method. In this commit is a 1st draft of the builder for 100$a unimarc french subfield, which is composed of 35 digits, with 12 differents values (only the 4th first are provided for instance)
Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** Biblio.pm 25 Oct 2002 10:58:26 -0000 1.25
--- Biblio.pm 12 Nov 2002 15:58:43 -0000 1.26
***************
*** 2,5 ****
--- 2,10 ----
# $Id$
# $Log$
+ # Revision 1.26 2002/11/12 15:58:43 tipaul
+ # road to 1.3.2 :
+ # * many bugfixes
+ # * adding value_builder : you can map a subfield in the marc_subfield_structure to a sub stored in "value_builder" directory. In this directory you can create screen used to build values with any method. In this commit is a 1st draft of the builder for 100$a unimarc french subfield, which is composed of 35 digits, with 12 differents values (only the 4th first are provided for instance)
+ #
# Revision 1.25 2002/10/25 10:58:26 tipaul
# Road to 1.3.2
***************
*** 356,362 ****
if ($forlibrarian eq 1) {
! $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as lib,tab, mandatory, repeatable,authorised_value from marc_subfield_structure");
} else {
! $sth=$dbh->prepare("select tagfield,tagsubfield,libopac as lib,tab, mandatory, repeatable,authorised_value from marc_subfield_structure");
}
$sth->execute;
--- 361,367 ----
if ($forlibrarian eq 1) {
! $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder from marc_subfield_structure");
} else {
! $sth=$dbh->prepare("select tagfield,tagsubfield,libopac as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder from marc_subfield_structure");
}
$sth->execute;
***************
*** 364,368 ****
my $subfield;
my $authorised_value;
! while ( ($tag, $subfield, $lib, $tab, $mandatory, $repeatable,$authorised_value) = $sth->fetchrow) {
$res->{$tag}->{$subfield}->{lib}=$lib;
$res->{$tag}->{$subfield}->{tab}=$tab;
--- 369,375 ----
my $subfield;
my $authorised_value;
! my $thesaurus_category;
! my $value_builder;
! while ( ($tag, $subfield, $lib, $tab, $mandatory, $repeatable,$authorised_value,$thesaurus_category,$value_builder) = $sth->fetchrow) {
$res->{$tag}->{$subfield}->{lib}=$lib;
$res->{$tag}->{$subfield}->{tab}=$tab;
***************
*** 370,373 ****
--- 377,382 ----
$res->{$tag}->{$subfield}->{repeatable}=$repeatable;
$res->{$tag}->{$subfield}->{authorised_value}=$authorised_value;
+ $res->{$tag}->{$subfield}->{thesaurus_category}=$thesaurus_category;
+ $res->{$tag}->{$subfield}->{value_builder}=$value_builder;
}
return $res;
***************
*** 462,466 ****
sub MARCaddsubfield {
# Add a new subfield to a tag into the DB.
! my ($dbh,$bibid,$tagid,$indicator,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue) = @_;
# if not value, end of job, we do nothing
if (not($subfieldvalue)) {
--- 471,475 ----
sub MARCaddsubfield {
# Add a new subfield to a tag into the DB.
! my ($dbh,$bibid,$tagid,$tag_indicator,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue) = @_;
# if not value, end of job, we do nothing
if (not($subfieldvalue)) {
***************
*** 477,495 ****
$sth->execute;
my ($res)=$sth->fetchrow;
! $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?)");
if ($tagid<100) {
! $sth->execute($bibid,'0'.$tagid,$tagorder,$subfieldcode,$subfieldorder,$res);
} else {
! $sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$res);
}
if ($sth->errstr) {
! print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue)\n";
}
# $dbh->do("unlock tables");
} else {
! my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,subfieldvalue) values (?,?,?,?,?,?)");
! $sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue);
if ($sth->errstr) {
! print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue)\n";
}
}
--- 486,504 ----
$sth->execute;
my ($res)=$sth->fetchrow;
! $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?,?)");
if ($tagid<100) {
! $sth->execute($bibid,'0'.$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$res);
} else {
! $sth->execute($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$res);
}
if ($sth->errstr) {
! print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue)\n";
}
# $dbh->do("unlock tables");
} else {
! my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values (?,?,?,?,?,?,?)");
! $sth->execute($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue);
if ($sth->errstr) {
! print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue)\n";
}
}
***************
*** 510,513 ****
--- 519,523 ----
my $prevtagorder=1;
my $prevtag;
+ my $previndicator;
my %subfieldlist={};
while (my $row=$sth->fetchrow_hashref) {
***************
*** 518,526 ****
$row->{'subfieldvalue'}=$row2->{'subfieldvalue'};
}
if ($row->{tagorder} ne $prevtagorder) {
! my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist);
$record->add_fields($field);
$prevtagorder=$row->{tagorder};
$prevtag = $row->{tag};
%subfieldlist={};
%subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'};
--- 528,543 ----
$row->{'subfieldvalue'}=$row2->{'subfieldvalue'};
}
+ # warn "$row->{bibid} = $row->{tag} - $row->{subfieldcode}";
if ($row->{tagorder} ne $prevtagorder) {
! if (length($prevtag) <3) {
! $prevtag = "0".$prevtag;
! }
! $previndicator.=" ";
! my $field = MARC::Field->new( $prevtag, substr($previndicator,0,1), substr($previndicator,1,1), %subfieldlist);
! # warn $field->as_formatted();
$record->add_fields($field);
$prevtagorder=$row->{tagorder};
$prevtag = $row->{tag};
+ $previndicator=$row->{tag};
%subfieldlist={};
%subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'};
***************
*** 528,531 ****
--- 545,549 ----
%subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'};
$prevtag= $row->{tag};
+ $previndicator=$row->{indicator};
}
}
***************
*** 842,846 ****
sub MARChtml2marc {
! my ($dbh,$rtags,$rsubfields,$rvalues) = @_;
my $prevtag = @$rtags[0];
my $record = MARC::Record->new();
--- 860,864 ----
sub MARChtml2marc {
! my ($dbh,$rtags,$rsubfields,$rvalues,%indicators) = @_;
my $prevtag = @$rtags[0];
my $record = MARC::Record->new();
***************
*** 849,853 ****
# rebuild MARC::Record
if (@$rtags[$i] ne $prevtag) {
! my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist);
$record->add_fields($field);
$prevtag = @$rtags[$i];
--- 867,875 ----
# rebuild MARC::Record
if (@$rtags[$i] ne $prevtag) {
! if ($prevtag<10) {
! $prevtag='0'.10;
! }
! $indicators{$prevtag}.=' ';
! my $field = MARC::Field->new( $prevtag, substr($indicators{$prevtag},0,1),substr($indicators{$prevtag},1,1), %subfieldlist);
$record->add_fields($field);
$prevtag = @$rtags[$i];
***************
*** 992,997 ****
(my $tagfield2, my $tagsubfield2) = $sth->fetchrow;
if ($tagsubfield1 != $tagsubfield2) {
! print STDERR "Error in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same field number";
! print "Error in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same field number";
die;
}
--- 1014,1019 ----
(my $tagfield2, my $tagsubfield2) = $sth->fetchrow;
if ($tagsubfield1 != $tagsubfield2) {
! print STDERR "Error in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same subfield number";
! print "Content-Type: text/html\n\nError in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same subfield number";
die;
}
***************
*** 1009,1012 ****
--- 1031,1035 ----
sub NEWnewitem {
my ($dbh, $record,$bibid) = @_;
+ warn "add item : ".$record->as_formatted();
# add item in old-DB
my $item = &MARCmarc2koha($dbh,$record);
***************
*** 1409,1413 ****
# $barcode = uc($barcode);
$barcode = $dbh->quote($barcode);
! $sth->prepare("Insert into items set
itemnumber = ?, biblionumber = ?,
biblioitemnumber = ?, barcode = ?,
--- 1432,1436 ----
# $barcode = uc($barcode);
$barcode = $dbh->quote($barcode);
! $sth=$dbh->prepare("Insert into items set
itemnumber = ?, biblionumber = ?,
biblioitemnumber = ?, barcode = ?,
***************
*** 1423,1427 ****
$item->{'homebranch'},$item->{'homebranch'},
$item->{'price'},$item->{'replacementprice'},
! NOW(),$item->{'itemnotes'},$item->{'loan'});
$sth->execute;
--- 1446,1450 ----
$item->{'homebranch'},$item->{'homebranch'},
$item->{'price'},$item->{'replacementprice'},
! $item->{'itemnotes'},$item->{'loan'});
$sth->execute;
More information about the Koha-cvs
mailing list