Added code to allow deleting of biblioitems
This commit is contained in:
parent
5aa4116d16
commit
bb8b344e40
5 changed files with 89 additions and 28 deletions
|
@ -15,7 +15,7 @@ $VERSION = 0.01;
|
|||
&newordernum &modbiblio &modorder &getsingleorder &invoice &receiveorder
|
||||
&bookfundbreakdown &curconvert &updatesup &insertsup &newitems &modbibitem
|
||||
&getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems
|
||||
&findall &needsmod &delitem &delbibitem &delbiblio &delorder &branches
|
||||
&findall &needsmod &delitem &deletebiblioitem &delbiblio &delorder &branches
|
||||
&getallorders &getrecorders &updatecurrencies &getorder &getcurrency &updaterecorder
|
||||
&updatecost &checkitems &modnote &getitemtypes &getbiblio
|
||||
&getbiblioitem &getitemsbybiblioitem &isbnsearch &keywordsearch
|
||||
|
@ -1115,32 +1115,62 @@ sub delitem{
|
|||
$dbh->disconnect;
|
||||
}
|
||||
|
||||
sub delbibitem{
|
||||
my ($itemnum)=@_;
|
||||
my $dbh=C4Connect;
|
||||
my $query="select * from biblioitems where biblioitemnumber=$itemnum";
|
||||
my $sth=$dbh->prepare($query);
|
||||
$sth->execute;
|
||||
if (my @data=$sth->fetchrow_array){
|
||||
$sth->finish;
|
||||
$query="Insert into deletedbiblioitems values (";
|
||||
foreach my $temp (@data){
|
||||
$temp=~ s/\'/\\\'/g;
|
||||
$query=$query."'$temp',";
|
||||
}
|
||||
$query=~ s/\,$/\)/;
|
||||
# print $query;
|
||||
$sth=$dbh->prepare($query);
|
||||
|
||||
sub deletebiblioitem {
|
||||
my ($biblioitemnumber) = @_;
|
||||
my $dbh = C4Connect;
|
||||
my $query = "Select * from biblioitems
|
||||
where biblioitemnumber = $biblioitemnumber";
|
||||
my $sth = $dbh->prepare($query);
|
||||
my @results;
|
||||
|
||||
$sth->execute;
|
||||
|
||||
if (@results = $sth->fetchrow_array) {
|
||||
|
||||
$query = "Insert into deletedbiblioitems values (";
|
||||
foreach my $value (@results) {
|
||||
$value = $dbh->quote($value);
|
||||
$query .= "$value,";
|
||||
} # foreach
|
||||
|
||||
$query =~ s/\,$/\)/;
|
||||
$dbh->do($query);
|
||||
|
||||
$query = "Delete from biblioitems
|
||||
where biblioitemnumber = $biblioitemnumber";
|
||||
$dbh->do($query);
|
||||
} # if
|
||||
|
||||
$sth->finish;
|
||||
$query = "Delete from biblioitems where biblioitemnumber=$itemnum";
|
||||
$sth=$dbh->prepare($query);
|
||||
|
||||
# Now delete all the items attached to the biblioitem
|
||||
|
||||
$query = "Select * from items where biblioitemnumber = $biblioitemnumber";
|
||||
$sth = $dbh->prepare($query);
|
||||
|
||||
$sth->execute;
|
||||
|
||||
while (@results = $sth->fetchrow_array) {
|
||||
|
||||
$query = "Insert into deleteditems values (";
|
||||
foreach my $value (@results) {
|
||||
$value = $dbh->quote($value);
|
||||
$query .= "$value,";
|
||||
} # foreach
|
||||
|
||||
$query =~ s/\,$/\)/;
|
||||
$dbh->do($query);
|
||||
} # while
|
||||
|
||||
$sth->finish;
|
||||
}
|
||||
$sth->finish;
|
||||
$dbh->disconnect;
|
||||
}
|
||||
|
||||
$query = "Delete from items where biblioitemnumber = $biblioitemnumber";
|
||||
$dbh->do($query);
|
||||
|
||||
$dbh->disconnect;
|
||||
} # sub deletebiblioitem
|
||||
|
||||
|
||||
sub delbiblio{
|
||||
my ($biblio)=@_;
|
||||
|
|
|
@ -11,7 +11,8 @@ use strict;
|
|||
use C4::Output;
|
||||
|
||||
my $input = new CGI;
|
||||
my $error = $input->param('error');
|
||||
my $error = $input->param('error');
|
||||
my $success = $input->param('biblioitem');
|
||||
|
||||
print $input->header;
|
||||
print startpage();
|
||||
|
@ -33,7 +34,12 @@ EOF
|
|||
<font color="red" size="5">No items found</font>
|
||||
<p />
|
||||
EOF
|
||||
} # if
|
||||
} elsif ($success eq "added") {
|
||||
print << "EOF";
|
||||
<font color="red" size="5">Website Biblioitem Added</font>
|
||||
<p />
|
||||
EOF
|
||||
} # elsif
|
||||
|
||||
print << "EOF";
|
||||
<table bgcolor="#ffcc00" width="80%" cellpadding="5">
|
||||
|
|
|
@ -35,6 +35,10 @@ if (! $biblionumber) {
|
|||
} else {
|
||||
|
||||
$biblioitemnum = &newbiblioitem($biblioitem);
|
||||
|
||||
print $input->redirect("additem.pl?biblioitemnum=$biblioitemnum");
|
||||
|
||||
if ($input->param('itemtype') eq "WEB") {
|
||||
print $input->redirect("addbooks.pl?biblioitem=added");
|
||||
} else {
|
||||
print $input->redirect("additem.pl?biblioitemnum=$biblioitemnum");
|
||||
} # else
|
||||
} # else
|
||||
|
|
21
deletebiblioitem.pl
Executable file
21
deletebiblioitem.pl
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use C4::Acquisitions;
|
||||
use CGI;
|
||||
|
||||
my $input = new CGI;
|
||||
my $biblionumber = $input->param('biblionumber');
|
||||
my $biblioitemnumber = $input->param('biblioitemnumber');
|
||||
|
||||
if (! $biblionumber) {
|
||||
print $input->redirect("/catalogue/");
|
||||
|
||||
} elsif (! $biblioitemnumber) {
|
||||
print $input->param("detail.pl?type=intra&bib=$biblionumber");
|
||||
|
||||
} else {
|
||||
&deletebiblioitem($biblioitemnumber);
|
||||
|
||||
print $input->redirect("detail.pl?type=intra&bib=$biblionumber");
|
||||
} # else
|
|
@ -19,7 +19,7 @@ my $data=bibitemdata($bibitemnum);
|
|||
my $biblio=$input->param('biblio');
|
||||
my $submit=$input->param('submit.x');
|
||||
if ($submit eq ''){
|
||||
print $input->redirect("/cgi-bin/koha/delbibitem.pl?bibitemnum=$bibitemnum&biblio=$biblio");
|
||||
print $input->redirect("deletebiblioitem.pl?biblioitemnumber=$bibitemnum&biblionumber=$biblio");
|
||||
}
|
||||
print $input->header;
|
||||
#my ($count,$subject)=subject($data->{'biblionumber'});
|
||||
|
|
Loading…
Reference in a new issue