[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4 Biblio.pm,1.28,1.29
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/C4 Biblio.pm,1.28,1.29 |
Date: |
Thu, 12 Dec 2002 08:35:02 -0800 |
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv28988/C4
Modified Files:
Biblio.pm
Log Message:
adding authentification with Auth.pm and
MAJOR BUGFIX on marc biblio modification
Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** Biblio.pm 10 Dec 2002 13:30:03 -0000 1.28
--- Biblio.pm 12 Dec 2002 16:35:00 -0000 1.29
***************
*** 2,5 ****
--- 2,9 ----
# $Id$
# $Log$
+ # Revision 1.29 2002/12/12 16:35:00 tipaul
+ # adding authentification with Auth.pm and
+ # MAJOR BUGFIX on marc biblio modification
+ #
# Revision 1.28 2002/12/10 13:30:03 tipaul
# fugfixes from Dombes Abbey work
***************
*** 451,454 ****
--- 455,459 ----
# pass the MARC::Record to this function, and it will create the records in
the marc tables
my ($dbh,$record,$biblionumber) = @_;
+ warn "adding : ".$record->as_formatted();
# search for MARC biblionumber
$dbh->do("lock tables marc_biblio WRITE,marc_subfield_table WRITE,
marc_word WRITE, marc_blob_subfield WRITE, stopwords READ");
***************
*** 471,474 ****
--- 476,486 ----
$subfields[$subfieldcount][1]
);
+ warn "ADDING :$bibid,".
+ $field->tag().
+ $field->indicator(1).$field->indicator(2).",
+ $fieldcount,
+ $subfields[$subfieldcount][0],
+ $subfieldcount+1,
+ $subfields[$subfieldcount][1]";
}
}
***************
*** 479,513 ****
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)) {
! return;
! }
if (not($subfieldcode)) {
$subfieldcode=' ';
}
! if (length($subfieldvalue)>255) {
! # $dbh->do("lock tables marc_blob_subfield WRITE, marc_subfield_table
WRITE");
! my $sth=$dbh->prepare("insert into marc_blob_subfield (subfieldvalue)
values (?)");
! $sth->execute($subfieldvalue);
! $sth=$dbh->prepare("select max(blobidlink)from marc_blob_subfield");
! $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";
! }
}
&MARCaddword($dbh,$bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue);
--- 491,525 ----
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 (length($subfieldvalue) ==0) {
! return;
! }
if (not($subfieldcode)) {
$subfieldcode=' ';
}
! if (length($subfieldvalue)>255) {
! # $dbh->do("lock tables marc_blob_subfield WRITE,
marc_subfield_table WRITE");
! my $sth=$dbh->prepare("insert into marc_blob_subfield
(subfieldvalue) values (?)");
! $sth->execute($subfieldvalue);
! $sth=$dbh->prepare("select max(blobidlink)from
marc_blob_subfield");
! $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";
! }
}
&MARCaddword($dbh,$bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue);
***************
*** 521,530 ****
my $sth=$dbh->prepare("select
bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
from marc_subfield_table
! where bibid=? order by tagorder,subfieldorder
");
my $sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield
where blobidlink=?");
$sth->execute($bibid);
my $prevtagorder=1;
! my $prevtag;
my $previndicator;
my %subfieldlist={};
--- 533,542 ----
my $sth=$dbh->prepare("select
bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
from marc_subfield_table
! where bibid=? order by
tag,tagorder,subfieldcode
");
my $sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield
where blobidlink=?");
$sth->execute($bibid);
my $prevtagorder=1;
! my $prevtag=' ';
my $previndicator;
my %subfieldlist={};
***************
*** 542,545 ****
--- 554,558 ----
}
$previndicator.=" ";
+ # warn "NEW : subfieldcode : $prevtag";
my $field = MARC::Field->new( $prevtag,
substr($previndicator,0,1), substr($previndicator,1,1), %subfieldlist);
# warn $field->as_formatted();
***************
*** 551,555 ****
%subfieldlist->{$row->{'subfieldcode'}} =
$row->{'subfieldvalue'};
} else {
! %subfieldlist->{$row->{'subfieldcode'}} =
$row->{'subfieldvalue'};
$prevtag= $row->{tag};
$previndicator=$row->{tag_indicator};
--- 564,572 ----
%subfieldlist->{$row->{'subfieldcode'}} =
$row->{'subfieldvalue'};
} else {
! warn "subfieldcode : $row->{'subfieldcode'} / value :
$row->{'subfieldvalue'}, tag : $row->{tag}";
! if (%subfieldlist->{$row->{'subfieldcode'}}) {
! %subfieldlist->{$row->{'subfieldcode'}}.='|';
! }
! %subfieldlist->{$row->{'subfieldcode'}} .=
$row->{'subfieldvalue'};
$prevtag= $row->{tag};
$previndicator=$row->{tag_indicator};
***************
*** 572,576 ****
my $sth=$dbh->prepare("select
bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
from marc_subfield_table
! where bibid=? and tagorder=? order by
subfieldorder
");
$sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield where
blobidlink=?");
--- 589,593 ----
my $sth=$dbh->prepare("select
bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
from marc_subfield_table
! where bibid=? and tagorder=? order by
subfieldcode,subfieldorder
");
$sth2=$dbh->prepare("select subfieldvalue from marc_blob_subfield where
blobidlink=?");
***************
*** 611,614 ****
--- 628,634 ----
my ($dbh,$record,$bibid,$itemnumber,$delete)address@hidden;
my $oldrecord=&MARCgetbiblio($dbh,$bibid);
+ warn "OLD : ".$oldrecord->as_formatted();
+ warn "----------------------------------\nNEW : ".$record->as_formatted();
+ warn "\n";
# if nothing to change, don't waste time...
if ($oldrecord eq $record) {
***************
*** 650,654 ****
return;
}
! # warn "MARCmoditem : ".$record->as_formatted;
# otherwise, skip through each subfield...
my @fields = $record->fields();
--- 670,676 ----
return;
}
! warn "MARCmoditem : ".$record->as_formatted;
! warn "OLD : ".$oldrecord->as_formatted;
!
# otherwise, skip through each subfield...
my @fields = $record->fields();
***************
*** 662,685 ****
my $subfieldorder=0;
foreach my $subfield (@subfields) {
! $subfieldorder++;
! if ($oldfield eq 0 or (! $oldfield->subfield(@$subfield[0])) ) {
! # just adding datas...
# warn "addfield : / $subfieldorder / @$subfield[0] -
@$subfield[1]";
!
&MARCaddsubfield($dbh,$bibid,$field->tag(),$field->indicator(1).$field->indicator(2),
!
$tagorder,@$subfield[0],$subfieldorder,@$subfield[1]);
! } else {
! # warn "modfield : / $subfieldorder / @$subfield[0] -
@$subfield[1]";
! # modify he subfield if it's a different string
! if ($oldfield->subfield(@$subfield[0]) ne @$subfield[1]
) {
! my
$subfieldid=&MARCfindsubfieldid($dbh,$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder);
! # warn "HERE : $subfieldid,
$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder";
!
&MARCmodsubfield($dbh,$subfieldid,@$subfield[1]);
} else {
#FIXME ???
! warn "ICI";
}
}
- }
}
}
--- 684,710 ----
my $subfieldorder=0;
foreach my $subfield (@subfields) {
! $subfieldorder++;
! warn "compare :
$oldfield".$oldfield->subfield(@$subfield[0]);
! if ($oldfield eq 0 or
(length($oldfield->subfield(@$subfield[0])) ==0) ) {
! # just adding datas...
# warn "addfield : / $subfieldorder / @$subfield[0] -
@$subfield[1]";
! warn "NEW subfield :
$bibid,".$field->tag().",".$tagorder.","address@hidden",".$subfieldorder.","address@hidden")";
!
&MARCaddsubfield($dbh,$bibid,$field->tag(),$field->indicator(1).$field->indicator(2),
!
$tagorder,@$subfield[0],$subfieldorder,@$subfield[1]);
} else {
+ # warn "modfield : / $subfieldorder / @$subfield[0] -
@$subfield[1]";
+ # modify he subfield if it's a different string
+ if ($oldfield->subfield(@$subfield[0]) ne
@$subfield[1] ) {
+ my
$subfieldid=&MARCfindsubfieldid($dbh,$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder);
+ warn "changing : $subfieldid,
$bibid,".$field->tag(),",$tagorder,@$subfield[0],@$subfield[1],$subfieldorder";
+
&MARCmodsubfield($dbh,$subfieldid,@$subfield[1]);
+ } else {
#FIXME ???
! warn "nothing to change :
".$oldfield->subfield(@$subfield[0]);
! }
}
}
}
+ warn "-----------------------";
}
***************
*** 755,764 ****
sub MARCfindsubfieldid {
! my ($dbh,$bibid,$tag,$tagorder,$subfield,$subfieldorder) = @_;
! my $sth=$dbh->prepare("select subfieldid from marc_subfield_table
! where bibid=? and tag=? and tagorder=?
! and subfieldcode=? and subfieldorder=?");
! $sth->execute($bibid,$tag,$tagorder,$subfield,$subfieldorder);
! my ($res) = $sth->fetchrow;
return $res;
}
--- 780,796 ----
sub MARCfindsubfieldid {
! my ($dbh,$bibid,$tag,$tagorder,$subfield,$subfieldorder) = @_;
! my $sth=$dbh->prepare("select subfieldid from marc_subfield_table
! where bibid=? and tag=? and tagorder=?
! and subfieldcode=? and
subfieldorder=?");
! $sth->execute($bibid,$tag,$tagorder,$subfield,$subfieldorder);
! my ($res) = $sth->fetchrow;
! unless ($res) {
! $sth=$dbh->prepare("select subfieldid from marc_subfield_table
! where bibid=? and tag=? and tagorder=?
! and subfieldcode=?");
! $sth->execute($bibid,$tag,$tagorder,$subfield);
! ($res) = $sth->fetchrow;
! }
return $res;
}
***************
*** 881,885 ****
my $record = MARC::Record->new();
my %subfieldlist={};
! for (my $i=0; $i<= @$rtags; $i++) {
# rebuild MARC::Record
if (@$rtags[$i] ne $prevtag) {
--- 913,917 ----
my $record = MARC::Record->new();
my %subfieldlist={};
! for (my $i=0; $i< @$rtags; $i++) {
# rebuild MARC::Record
if (@$rtags[$i] ne $prevtag) {
***************
*** 893,899 ****
%subfieldlist={};
%subfieldlist->address@hidden = @$rvalues[$i];
} else {
! %subfieldlist->address@hidden = @$rvalues[$i];
$prevtag= @$rtags[$i];
}
}
--- 925,936 ----
%subfieldlist={};
%subfieldlist->address@hidden = @$rvalues[$i];
+ warn " ==>@$rsubfields[$i]} = @$rvalues[$i];";
} else {
! # if (%subfieldlist->address@hidden) {
! # %subfieldlist->address@hidden .= '|';
! # }
! %subfieldlist->address@hidden address@hidden;
$prevtag= @$rtags[$i];
+ warn " ==>@$rsubfields[$i]} ,= @$rvalues[$i];";
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4 Biblio.pm,1.28,1.29,
Paul POULAIN <=
- Prev by Date:
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.10,1.11 addbooks.pl,1.15,1.16 additem.pl,1.9,1.10 isbnsearch.pl,1.5,1.6
- Next by Date:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple additem.tmpl,1.2,1.3
- Previous by thread:
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.10,1.11 addbooks.pl,1.15,1.16 additem.pl,1.9,1.10 isbnsearch.pl,1.5,1.6
- Next by thread:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple additem.tmpl,1.2,1.3
- Index(es):