bugfixes for biblio deletion
This commit is contained in:
parent
a1d31b88e7
commit
87819d35b1
2 changed files with 68 additions and 58 deletions
120
C4/Biblio.pm
120
C4/Biblio.pm
|
@ -1498,25 +1498,26 @@ $item->{'itemnum'}=$item->{'itemnumber'} unless $item->{'itemnum'};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub OLDdelitem{
|
sub OLDdelitem{
|
||||||
my ($dbh,$itemnum)=@_;
|
my ($dbh,$itemnum)=@_;
|
||||||
# my $dbh=C4Connect;
|
# my $dbh=C4Connect;
|
||||||
my $sth=$dbh->prepare("select * from items where itemnumber=?");
|
my $sth=$dbh->prepare("select * from items where itemnumber=?");
|
||||||
$sth->execute($itemnum);
|
$sth->execute($itemnum);
|
||||||
my $data=$sth->fetchrow_hashref;
|
my $data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
my $query="Insert into deleteditems set ";
|
my $query="Insert into deleteditems set ";
|
||||||
my @bind = ();
|
my @bind = ();
|
||||||
foreach my $temp (keys %$data){
|
foreach my $temp (keys %$data){
|
||||||
$query .= "$temp = ?,"
|
$query .= "$temp = ?,";
|
||||||
push(@bind,$data->{$temp});
|
push(@bind,$data->{$temp});
|
||||||
}
|
}
|
||||||
|
$query =~ s/\,$//;
|
||||||
# print $query;
|
# print $query;
|
||||||
$sth=$dbh->prepare($query);
|
$sth=$dbh->prepare($query);
|
||||||
$sth->execute(@bind);
|
$sth->execute(@bind);
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$sth=$dbh->prepare("Delete from items where itemnumber=?");
|
$sth=$dbh->prepare("Delete from items where itemnumber=?");
|
||||||
$sth->execute($itemnum);
|
$sth->execute($itemnum);
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
# $dbh->disconnect;
|
# $dbh->disconnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,48 +1545,51 @@ where biblioitemnumber = ?");
|
||||||
} # if
|
} # if
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
# Now delete all the items attached to the biblioitem
|
# Now delete all the items attached to the biblioitem
|
||||||
$sth = $dbh->prepare("Select * from items where biblioitemnumber = ?");
|
$sth = $dbh->prepare("Select * from items where biblioitemnumber = ?");
|
||||||
$sth->execute($biblioitemnumber);
|
$sth->execute($biblioitemnumber);
|
||||||
my @results;
|
my @results;
|
||||||
while (@results = $sth->fetchrow_array) {
|
while (my $data = $sth->fetchrow_hashref) {
|
||||||
my $query = "Insert into deleteditems values (";
|
my $query="Insert into deleteditems set ";
|
||||||
foreach my $value (@results) {
|
my @bind = ();
|
||||||
$query .= "?,";
|
foreach my $temp (keys %$data){
|
||||||
} # foreach
|
$query .= "$temp = ?,";
|
||||||
$query =~ s/\,$/\)/;
|
push(@bind,$data->{$temp});
|
||||||
my $sth2= $dbh->prepare($query);
|
}
|
||||||
$sth2->execute(@results);
|
$query =~ s/\,$//;
|
||||||
$sth2->finish()
|
warn "Q 1560 : $query";
|
||||||
} # while
|
my $sth2=$dbh->prepare($query);
|
||||||
$sth->finish;
|
$sth2->execute(@bind);
|
||||||
$sth = $dbh->prepare("Delete from items where biblioitemnumber = ?");
|
} # while
|
||||||
$sth->execute($biblioitemnumber);
|
$sth->finish;
|
||||||
$sth->finish();
|
$sth = $dbh->prepare("Delete from items where biblioitemnumber = ?");
|
||||||
|
$sth->execute($biblioitemnumber);
|
||||||
|
$sth->finish();
|
||||||
# $dbh->disconnect;
|
# $dbh->disconnect;
|
||||||
} # sub deletebiblioitem
|
} # sub deletebiblioitem
|
||||||
|
|
||||||
sub OLDdelbiblio{
|
sub OLDdelbiblio{
|
||||||
my ($dbh,$biblio)=@_;
|
my ($dbh,$biblio)=@_;
|
||||||
my $sth=$dbh->prepare("select * from biblio where biblionumber=?");
|
my $sth=$dbh->prepare("select * from biblio where biblionumber=?");
|
||||||
$sth->execute($biblio);
|
$sth->execute($biblio);
|
||||||
if (my @data=$sth->fetchrow_array){
|
if (my $data=$sth->fetchrow_hashref){
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
# FIXME => replace insert values by insert (field) values ($value)
|
my $query="Insert into deletedbiblio set ";
|
||||||
$query="Insert into deletedbiblio values (";
|
my @bind =();
|
||||||
foreach my $temp (@data){
|
foreach my $temp (keys %$data){
|
||||||
$temp=~ s/\'/\\\'/g;
|
$query .= "$temp = ?,";
|
||||||
$query .= "?,";
|
push(@bind,$data->{$temp});
|
||||||
}
|
}
|
||||||
#replacing the last , by ",?)"
|
#replacing the last , by ",?)"
|
||||||
$query=~ s/\,$/\,\?\)/;
|
$query=~ s/\,$//;
|
||||||
$sth=$dbh->prepare($query);
|
warn "Q olddelbiblio : $query";
|
||||||
$sth->execute(@data);
|
$sth=$dbh->prepare($query);
|
||||||
$sth->finish;
|
$sth->execute(@bind);
|
||||||
$sth=$dbh->prepare("Delete from biblio where biblionumber=?");
|
$sth->finish;
|
||||||
$sth->execute($biblio);
|
$sth=$dbh->prepare("Delete from biblio where biblionumber=?");
|
||||||
$sth->finish;
|
$sth->execute($biblio);
|
||||||
}
|
$sth->finish;
|
||||||
$sth->finish;
|
}
|
||||||
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -2188,6 +2192,9 @@ Paul POULAIN paul.poulain@free.fr
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.77 2003/12/03 17:47:14 tipaul
|
||||||
|
# bugfixes for biblio deletion
|
||||||
|
#
|
||||||
# Revision 1.76 2003/12/03 01:43:41 slef
|
# Revision 1.76 2003/12/03 01:43:41 slef
|
||||||
# conflict markers?
|
# conflict markers?
|
||||||
#
|
#
|
||||||
|
@ -2521,7 +2528,6 @@ Paul POULAIN paul.poulain@free.fr
|
||||||
# In Biblio.pm, there are some subs that permits to build a old-style record from a MARC::Record, and the opposite. There is also a sub finding a MARC-bibid from a old-biblionumber and the opposite too.
|
# In Biblio.pm, there are some subs that permits to build a old-style record from a MARC::Record, and the opposite. There is also a sub finding a MARC-bibid from a old-biblionumber and the opposite too.
|
||||||
# Note we have decided with steve that a old-biblio <=> a MARC-Biblio.
|
# Note we have decided with steve that a old-biblio <=> a MARC-Biblio.
|
||||||
#
|
#
|
||||||
<<<<<<< Biblio.pm
|
|
||||||
|
|
||||||
sub itemcount{
|
sub itemcount{
|
||||||
my ($biblio)=@_;
|
my ($biblio)=@_;
|
||||||
|
|
|
@ -213,7 +213,7 @@ my %requiretables = (
|
||||||
my %requirefields = (
|
my %requirefields = (
|
||||||
biblio => { 'abstract' => 'text' },
|
biblio => { 'abstract' => 'text' },
|
||||||
deletedbiblio => { 'abstract' => 'text', 'marc' => 'blob' },
|
deletedbiblio => { 'abstract' => 'text', 'marc' => 'blob' },
|
||||||
deleteditems => { 'marc' => 'blob' },
|
deleteditems => { 'marc' => 'blob', 'paidfor' => 'text' },
|
||||||
biblioitems => {
|
biblioitems => {
|
||||||
'lccn' => 'char(25)',
|
'lccn' => 'char(25)',
|
||||||
'url' => 'varchar(255)',
|
'url' => 'varchar(255)',
|
||||||
|
@ -240,6 +240,7 @@ my %requirefields = (
|
||||||
},
|
},
|
||||||
aqorders => { 'budgetdate' => 'date' },
|
aqorders => { 'budgetdate' => 'date' },
|
||||||
aqbudget => {'aqbudgetid' => 'tinyint(4) auto_increment primary key'},
|
aqbudget => {'aqbudgetid' => 'tinyint(4) auto_increment primary key'},
|
||||||
|
items => {'paidfor' => 'text'},
|
||||||
|
|
||||||
#added so that reference items are not available for reserves...
|
#added so that reference items are not available for reserves...
|
||||||
itemtypes => { 'notforloan' => 'smallint(6)' },
|
itemtypes => { 'notforloan' => 'smallint(6)' },
|
||||||
|
@ -970,6 +971,9 @@ $sth->finish;
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.68 2003/12/03 17:47:14 tipaul
|
||||||
|
# bugfixes for biblio deletion
|
||||||
|
#
|
||||||
# Revision 1.67 2003/11/28 10:08:33 tipaul
|
# Revision 1.67 2003/11/28 10:08:33 tipaul
|
||||||
# * removing too verbose messages.
|
# * removing too verbose messages.
|
||||||
# * creating a fulltext index on bibliothesaurus
|
# * creating a fulltext index on bibliothesaurus
|
||||||
|
|
Loading…
Reference in a new issue