koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Maintainance.pm,1.6,1.7


From: Andrew Arensburger
Subject: [Koha-cvs] CVS: koha/C4 Maintainance.pm,1.6,1.7
Date: Mon, 23 Sep 2002 06:54:36 -0700

Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv12206

Modified Files:
        Maintainance.pm 
Log Message:
Added POD.
Removed unnecessary trailing whitespace.


Index: Maintainance.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Maintainance.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Maintainance.pm     14 Aug 2002 18:12:51 -0000      1.6
--- Maintainance.pm     23 Sep 2002 13:54:34 -0000      1.7
***************
*** 31,42 ****
  $VERSION = 0.01;
  
  @ISA = qw(Exporter);
  @EXPORT = qw(&listsubjects &updatesub &shiftgroup &deletedbib &undeletebib
  &updatetype);
!  
  sub listsubjects {
    my ($sub,$num,$offset)address@hidden;
    my $dbh=C4Connect;
    my $query="Select * from bibliosubject where subject like '$sub%' group by 
subject";
    if ($num != 0){
      $query.=" limit $offset,$num";
--- 31,86 ----
  $VERSION = 0.01;
  
+ =head1 NAME
+ 
+ C4::Maintenance - Koha catalog maintenance functions
+ 
+ =head1 SYNOPSIS
+ 
+   use C4::Maintenance;
+ 
+ =head1 DESCRIPTION
+ 
+ The functions in this module perform various catalog-maintenance
+ functions, including deleting and undeleting books, fixing
+ miscategorized items, etc.
+ 
+ =head1 FUNCTIONS
+ 
+ =over 2
+ 
+ =cut
+ 
  @ISA = qw(Exporter);
  @EXPORT = qw(&listsubjects &updatesub &shiftgroup &deletedbib &undeletebib
  &updatetype);
! 
! =item listsubjects
! 
!   ($count, $results) = &listsubjects($subject, $n, $offset);
! 
! Finds the subjects that begin with C<$subject> in the bibliosubject
! table of the Koha database.
! 
! C<&listsubjects> returns a two-element array. C<$results> is a
! reference-to-array, in which each element is a reference-to-hash
! giving information about the given subject. C<$count> is the number of
! elements in C<@{$results}>.
! 
! Probably the only interesting field in C<$results->[$i]> is
! C<subject>, the subject in question.
! 
! C<&listsubject> returns up to C<$n> items, starting at C<$offset>. If
! C<$n> is 0, it will return all matching subjects.
! 
! =cut
! #'
! # FIXME - This API is bogus. The way it's currently used, it should
! # just return a list of strings.
  sub listsubjects {
    my ($sub,$num,$offset)address@hidden;
    my $dbh=C4Connect;
    my $query="Select * from bibliosubject where subject like '$sub%' group by 
subject";
+   # FIXME - Make $num and $offset optional.
+   # If $num was given, make sure $offset was, too.
    if ($num != 0){
      $query.=" limit $offset,$num";
***************
*** 56,59 ****
--- 100,112 ----
  }
  
+ =item updatesub
+ 
+   &updatesub($newsubject, $oldsubject);
+ 
+ Renames a subject from C<$oldsubject> to C<$newsubject> in the
+ bibliosubject table of the Koha database.
+ 
+ =cut
+ #'
  sub updatesub{
    my ($sub,$oldsub)address@hidden;
***************
*** 68,71 ****
--- 121,134 ----
  }
  
+ =item shiftgroup
+ 
+   &shiftgroup($biblionumber, $biblioitemnumber);
+ 
+ Changes the biblionumber associated with a given biblioitem.
+ C<$biblioitemnumber> is the number of the biblioitem to change.
+ C<$biblionumber> is the biblionumber to associate it with.
+ 
+ =cut
+ #'
  sub shiftgroup{
    my ($bib,$bi)address@hidden;
***************
*** 82,85 ****
--- 145,161 ----
  }
  
+ =item deletedbib
+ 
+   ($count, $results) = &deletedbib($title);
+ 
+ Looks up deleted books whose title begins with C<$title>.
+ 
+ C<&deletedbib> returns a two-element list. C<$results> is a
+ reference-to-array; each element is a reference-to-hash whose keys are
+ the fields of the deletedbiblio table in the Koha database. C<$count>
+ is the number of elements in C<$results>.
+ 
+ =cut
+ #'
  sub deletedbib{
    my ($title)address@hidden;
***************
*** 99,120 ****
  }
  
  sub undeletebib{
    my ($bib)address@hidden;
    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";
--- 175,208 ----
  }
  
+ =item undeletebib
+ 
+   &undeletebib($biblionumber);
+ 
+ Undeletes a book. C<&undeletebib> looks up the book with the given
+ biblionumber in the deletedbiblio table of the Koha database, and
+ moves its entry to the biblio table.
+ 
+ =cut
+ #'
  sub undeletebib{
    my ($bib)address@hidden;
    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;
!     # FIXME - Doesn't this keep the same biblionumber? Isn't this
!     # forbidden by the definition of 'biblio'? Or doesn't it matter?
!     $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";
***************
*** 125,131 ****
--- 213,229 ----
  }
  
+ =item updatetype
+ 
+   &updatetype($biblioitemnumber, $itemtype);
+ 
+ Changes the type of the item with the given biblioitemnumber to be
+ C<$itemtype>.
+ 
+ =cut
+ #'
  sub updatetype{
    my ($bi,$type)address@hidden;
    my $dbh=C4Connect;
+   # FIXME - Use $dbh->do(...);
    my $sth=$dbh->prepare("Update biblioitems set itemtype='$type' where 
biblioitemnumber=$bi");
    $sth->execute;
***************
*** 133,136 ****
    $dbh->disconnect;
  }
  END { }       # module clean-up code here (global destructor)
!     
--- 231,249 ----
    $dbh->disconnect;
  }
+ 
  END { }       # module clean-up code here (global destructor)
! 
! 1;
! __END__
! 
! =back
! 
! =head1 AUTHOR
! 
! Koha Developement team <address@hidden>
! 
! =head1 SEE ALSO
! 
! L<perl>.
! 
! =cut




reply via email to

[Prev in Thread] Current Thread [Next in Thread]