diff --git a/C4/Maintainance.pm b/C4/Maintainance.pm index c6fd03fb10..de1d23e178 100644 --- a/C4/Maintainance.pm +++ b/C4/Maintainance.pm @@ -13,7 +13,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 0.01; @ISA = qw(Exporter); -@EXPORT = qw(&listsubjects &updatesub); +@EXPORT = qw(&listsubjects &updatesub &shiftgroup &deletedbib &undeletebib); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], # your exported package globals go here, @@ -80,5 +80,64 @@ sub updatesub{ $sth->finish; $dbh->disconnect; } + +sub shiftgroup{ + my ($bib,$bi)=@_; + my $dbh=C4Connect; + my $query="update biblioitems set biblionumber=$bib where biblioitemnumber=$bi"; + my $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $query="update items set biblionumber=$bib where biblioitemnumber=$bi"; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $dbh->disconnect; +} + +sub deletedbib{ + my ($title)=@_; + my $dbh=C4Connect; + my $query="Select * from deletedbiblio where title like '$title%' order by title"; + my $sth=$dbh->prepare($query); + $sth->execute; + my @results; + my $i=0; + while (my $data=$sth->fetchrow_hashref){ + $results[$i]=$data; + $i++; + } + $sth->finish; + $dbh->disconnect; + return($i,\@results); +} + +sub undeletebib{ + my ($bib)=@_; + my $dbh=C4Connect; + my $query="select * from deletedbiblio where biblionumber=$bib"; + my $sth=$dbh->prepare($query); + $sth->execute; + if (my @data=$sth->fetchrow_array){ + $sth->finish; + $query="Insert into biblio values ("; + foreach my $temp (@data){ + $temp=~ s/\'/\\\'/g; + $query=$query."'$temp',"; + } + $query=~ s/\,$/\)/; + # print $query; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + } + $query="Delete from deletedbiblio where biblionumber=$bib"; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $dbh->disconnect; +} + + END { } # module clean-up code here (global destructor) diff --git a/catmaintain.pl b/catmaintain.pl index 5d2275ec0b..a0201b29cd 100755 --- a/catmaintain.pl +++ b/catmaintain.pl @@ -43,12 +43,41 @@ if ($type eq 'allsub'){ print "Successfully modified $oldsub is now $sub"; print "
Back to catalogue maintenance
";
print "Close this window";
+} elsif ($type eq 'undel'){
+ my $title=$input->param('title');
+ my ($count,$results)=deletedbib($title);
+ print "
| Title | Author | Undelete |
| $results->[$i]->{'title'} | $results->[$i]->{'author'} | [$i]->{'biblionumber'}>Undelete | \n"; + } + print "
Back to Catalogue Maintenance";
} else {
+ print "Subject Maintenance
";
print "
"; + print "Group Maintenance"; + print "
"; + print ""; + print "Undelete Biblio"; + print "
"; } print endmenu('catalog'); print endpage();