long is the road to 1.4.0
* MARCadditem and MARCmoditem now wroks * various bugfixes in MARC management !!! 1.3.0 should be released very soon now. Be careful !!!
This commit is contained in:
parent
500b95460e
commit
973334c26a
1 changed files with 40 additions and 22 deletions
62
C4/Biblio.pm
62
C4/Biblio.pm
|
@ -1,6 +1,12 @@
|
||||||
package C4::Biblio;
|
package C4::Biblio;
|
||||||
# $Id$
|
# $Id$
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.9 2002/09/20 12:57:46 tipaul
|
||||||
|
# long is the road to 1.4.0
|
||||||
|
# * MARCadditem and MARCmoditem now wroks
|
||||||
|
# * various bugfixes in MARC management
|
||||||
|
# !!! 1.3.0 should be released very soon now. Be careful !!!
|
||||||
|
#
|
||||||
# Revision 1.8 2002/09/10 13:53:52 tipaul
|
# Revision 1.8 2002/09/10 13:53:52 tipaul
|
||||||
# MARC API continued...
|
# MARC API continued...
|
||||||
# * some bugfixes
|
# * some bugfixes
|
||||||
|
@ -431,6 +437,7 @@ sub MARCgetbiblio {
|
||||||
sub MARCgetitem {
|
sub MARCgetitem {
|
||||||
# Returns MARC::Record of the biblio passed in parameter.
|
# Returns MARC::Record of the biblio passed in parameter.
|
||||||
my ($dbh,$bibid,$itemnumber)=@_;
|
my ($dbh,$bibid,$itemnumber)=@_;
|
||||||
|
warn "MARCgetitem : $bibid, $itemnumber\n";
|
||||||
my $record = MARC::Record->new();
|
my $record = MARC::Record->new();
|
||||||
# search MARC tagorder
|
# search MARC tagorder
|
||||||
my $sth2 = $dbh->prepare("select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?");
|
my $sth2 = $dbh->prepare("select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?");
|
||||||
|
@ -528,12 +535,15 @@ sub MARCmoditem {
|
||||||
$subfieldorder++;
|
$subfieldorder++;
|
||||||
if ($oldfield eq 0 or (! $oldfield->subfield(@$subfield[0])) ) {
|
if ($oldfield eq 0 or (! $oldfield->subfield(@$subfield[0])) ) {
|
||||||
# just adding datas...
|
# just adding datas...
|
||||||
|
warn "ADD = $bibid,".$field->tag().",".$field->indicator(1).".".$field->indicator(2).", $tagorder,".@$subfield[0].",$subfieldorder,@$subfield[1])\n";
|
||||||
&MARCaddsubfield($dbh,$bibid,$field->tag(),$field->indicator(1).$field->indicator(2),
|
&MARCaddsubfield($dbh,$bibid,$field->tag(),$field->indicator(1).$field->indicator(2),
|
||||||
$tagorder,@$subfield[0],$subfieldorder,@$subfield[1]);
|
$tagorder,@$subfield[0],$subfieldorder,@$subfield[1]);
|
||||||
} else {
|
} else {
|
||||||
# modify he subfield if it's a different string
|
# modify he subfield if it's a different string
|
||||||
|
warn "MODIFY = $bibid,".$field->tag().",".$field->indicator(1).".".$field->indicator(2).", $tagorder,".@$subfield[0].",$subfieldorder,@$subfield[1])\n";
|
||||||
if ($oldfield->subfield(@$subfield[0]) ne @$subfield[1] ) {
|
if ($oldfield->subfield(@$subfield[0]) ne @$subfield[1] ) {
|
||||||
my $subfieldid=&MARCfindsubfieldid($dbh,$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder);
|
my $subfieldid=&MARCfindsubfieldid($dbh,$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder);
|
||||||
|
warn "MODIFY2 = $bibid, $subfieldid, ".@$subfield[1]."\n";
|
||||||
&MARCmodsubfield($dbh,$subfieldid,@$subfield[1]);
|
&MARCmodsubfield($dbh,$subfieldid,@$subfield[1]);
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
@ -986,9 +996,8 @@ sub ALLnewitem {
|
||||||
=head2 ($itemnumber,$errors)= OLDnewitems($dbh,$item,$barcode);
|
=head2 ($itemnumber,$errors)= OLDnewitems($dbh,$item,$barcode);
|
||||||
create a item. $item is a hash and $barcode the barcode.
|
create a item. $item is a hash and $barcode the barcode.
|
||||||
|
|
||||||
=head2 OLDmoditem($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement);
|
=head2 OLDmoditem($dbh,$item);
|
||||||
modify item
|
modify item
|
||||||
NOTE : not standard API-style. Should be rewriten to be OLDmoditem($dbh,$item) where $item is a hash
|
|
||||||
|
|
||||||
=head2 OLDdelitem($dbh,$itemnum);
|
=head2 OLDdelitem($dbh,$itemnum);
|
||||||
delete item
|
delete item
|
||||||
|
@ -1376,25 +1385,26 @@ sub OLDnewitems {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub OLDmoditem {
|
sub OLDmoditem {
|
||||||
my ($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
|
my ($dbh,$item) = @_;
|
||||||
|
# my ($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
|
||||||
# my $dbh=C4Connect;
|
# my $dbh=C4Connect;
|
||||||
my $query="update items set biblioitemnumber=$bibitemnum,
|
my $query="update items set biblioitemnumber=$item->{'bibitemnum'},
|
||||||
barcode='$barcode',itemnotes='$notes'
|
barcode='$item->{'barcode'}',itemnotes='$item->{'notes'}'
|
||||||
where itemnumber=$itemnum";
|
where itemnumber=$item->{'itemnum'}";
|
||||||
if ($barcode eq ''){
|
if ($item->{'barcode'} eq ''){
|
||||||
$query="update items set biblioitemnumber=$bibitemnum,notforloan=$loan where itemnumber=$itemnum";
|
$query="update items set biblioitemnumber=$item->{'bibitemnum'},notforloan=$item->{'loan'} where itemnumber=$item->{'itemnum'}";
|
||||||
}
|
}
|
||||||
if ($lost ne ''){
|
if ($item->{'lost'} ne ''){
|
||||||
$query="update items set biblioitemnumber=$bibitemnum,
|
$query="update items set biblioitemnumber=$item->{'bibitemnum'},
|
||||||
barcode='$barcode',
|
barcode='$item->{'barcode'}',
|
||||||
itemnotes='$notes',
|
itemnotes='$item->{'notes'}',
|
||||||
homebranch='$homebranch',
|
homebranch='$item->{'homebranch'}',
|
||||||
itemlost='$lost',
|
itemlost='$item->{'lost'}',
|
||||||
wthdrawn='$wthdrawn'
|
wthdrawn='$item->{'wthdrawn'}'
|
||||||
where itemnumber=$itemnum";
|
where itemnumber=$item->{'itemnum'}";
|
||||||
}
|
}
|
||||||
if ($replacement ne ''){
|
if ($item->{'replacement'} ne ''){
|
||||||
$query=~ s/ where/,replacementprice='$replacement' where/;
|
$query=~ s/ where/,replacementprice='$item->{'replacement'}' where/;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sth=$dbh->prepare($query);
|
my $sth=$dbh->prepare($query);
|
||||||
|
@ -1650,10 +1660,18 @@ sub newitems {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub moditem {
|
sub moditem {
|
||||||
my ($loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
|
my ($item) = @_;
|
||||||
my $dbh=C4Connect;
|
# my ($loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
|
||||||
&OLDmoditem($dbh,$loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement);
|
my $dbh=C4Connect;
|
||||||
$dbh->disconnect;
|
&OLDmoditem($dbh,$item);
|
||||||
|
warn "biblionumber : $item->{'biblionumber'} / $item->{'itemnum'}\n";
|
||||||
|
my $MARCitem = &MARCkoha2marcItem($dbh,$item->{'biblionumber'},$item->{'itemnum'});
|
||||||
|
warn "before MARCmoditem : $item->{biblionumber}, $item->{'itemnum'}\n";
|
||||||
|
warn $MARCitem->as_formatted();
|
||||||
|
# print STDERR "MARCitem ".$MARCitem->as_formatted()."\n";
|
||||||
|
my $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$item->{biblionumber});
|
||||||
|
&MARCmoditem($dbh,$MARCitem,$bibid,$item->{itemnum},0);
|
||||||
|
$dbh->disconnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub checkitems{
|
sub checkitems{
|
||||||
|
|
Loading…
Reference in a new issue