CVS: koha/C4 Maintainance.pm,1.1.1.1,1.2
Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv9482/C4 Modified Files: Maintainance.pm Log Message: Got undeleting biblios going (catalogue maintenance should probably be in a password protected super librarian area or the like) Index: Maintainance.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Maintainance.pm,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Maintainance.pm 2000/12/19 23:45:54 1.1.1.1 --- Maintainance.pm 2001/03/13 22:04:04 1.2 *************** *** 14,18 **** @ISA = qw(Exporter); ! @EXPORT = qw(&listsubjects &updatesub); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], --- 14,18 ---- @ISA = qw(Exporter); ! @EXPORT = qw(&listsubjects &updatesub &shiftgroup &deletedbib &undeletebib); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], *************** *** 81,84 **** --- 81,143 ---- $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)
participants (1)
-
Chris Cornack