[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4 BookShelves.pm,1.2.2.2,1.2.2.3
From: |
Steve Tonnesen |
Subject: |
[Koha-cvs] CVS: koha/C4 BookShelves.pm,1.2.2.2,1.2.2.3 |
Date: |
Mon, 28 Oct 2002 09:45:17 -0800 |
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv28530/C4
Modified Files:
Tag: rel-1-2
BookShelves.pm
Log Message:
Merging from trunk to rel-1-2
Index: BookShelves.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/BookShelves.pm,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** BookShelves.pm 14 Aug 2002 18:30:50 -0000 1.2.2.2
--- BookShelves.pm 28 Oct 2002 17:45:15 -0000 1.2.2.3
***************
*** 6,9 ****
--- 6,10 ----
#requires DBI.pm to be installed
+ # $Id$
# Copyright 2000-2002 Katipo Communications
***************
*** 29,77 ****
use C4::Database;
use C4::Circulation::Circ2;
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
!
# set the version for version checking
$VERSION = 0.01;
!
@ISA = qw(Exporter);
@EXPORT = qw(&GetShelfList &GetShelfContents &AddToShelf &RemoveFromShelf
&AddShelf &RemoveShelf);
- %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
-
- # your exported package globals go here,
- # as well as any optionally exported functions
-
- @EXPORT_OK = qw($Var1 %Hashit);
-
-
- # non-exported package globals go here
- use vars qw(@more $stuff);
-
- # initalize package globals, first exported ones
-
- my $Var1 = '';
- my %Hashit = ();
-
- # then the others (which are still accessible as $Some::Module::stuff)
- my $stuff = '';
- my @more = ();
-
- # all file-scoped lexicals must be created before
- # the functions below that use them.
-
- # file-private lexicals go here
- my $priv_var = '';
- my %secret_hash = ();
-
- # here's a file-private function as a closure,
- # callable as &$priv_func; it cannot be prototyped.
- my $priv_func = sub {
- # stuff goes here.
- };
-
- # make all your functions, whether exported or not;
my $dbh=C4Connect();
sub GetShelfList {
my $sth=$dbh->prepare("select shelfnumber,shelfname from bookshelf");
$sth->execute;
--- 30,71 ----
use C4::Database;
use C4::Circulation::Circ2;
! use vars qw($VERSION @ISA @EXPORT);
!
# set the version for version checking
$VERSION = 0.01;
!
! =head1 NAME
!
! C4::BookShelves - Functions for manipulating Koha virtual bookshelves
!
! =head1 SYNOPSIS
!
! use C4::BookShelves;
!
! =head1 DESCRIPTION
!
! This module provides functions for manipulating virtual bookshelves,
! including creating and deleting bookshelves, and adding and removing
! items to and from bookshelves.
!
! =head1 FUNCTIONS
!
! =over 2
!
! =cut
!
@ISA = qw(Exporter);
@EXPORT = qw(&GetShelfList &GetShelfContents &AddToShelf &RemoveFromShelf
&AddShelf &RemoveShelf);
my $dbh=C4Connect();
sub GetShelfList {
+ # FIXME - These two database queries can be combined into one:
+ # SELECT bookshelf.shelfnumber, bookshelf.shelfname,
+ # count(shelfcontents.itemnumber)
+ # FROM bookshelf
+ # LEFT JOIN shelfcontents
+ # ON bookshelf.shelfnumber = shelfcontents.shelfnumber
+ # GROUP BY bookshelf.shelfnumber
my $sth=$dbh->prepare("select shelfnumber,shelfname from bookshelf");
$sth->execute;
***************
*** 79,82 ****
--- 73,77 ----
while (my ($shelfnumber, $shelfname) = $sth->fetchrow) {
my $sti=$dbh->prepare("select count(*) from shelfcontents where
shelfnumber=$shelfnumber");
+ # FIXME - Should there be an "order by" in here somewhere?
$sti->execute;
my ($count) = $sti->fetchrow;
***************
*** 87,91 ****
--- 82,99 ----
}
+ =item GetShelfContents
+ $itemlist = &GetShelfContents($env, $shelfnumber);
+
+ Looks up information about the contents of virtual bookshelf number
+ C<$shelfnumber>.
+
+ Returns a reference-to-array, whose elements are references-to-hash,
+ as returned by C<&getiteminformation>.
+
+ I don't know what C<$env> is.
+
+ =cut
+ #'
sub GetShelfContents {
my ($env, $shelfnumber) = @_;
***************
*** 98,103 ****
--- 106,124 ----
}
return (address@hidden);
+ # FIXME - Wouldn't it be more intuitive to return a list,
+ # rather than a reference-to-list?
}
+ =item AddToShelf
+
+ &AddToShelf($env, $itemnumber, $shelfnumber);
+
+ Adds item number C<$itemnumber> to virtual bookshelf number
+ C<$shelfnumber>, unless that item is already on that shelf.
+
+ C<$env> is ignored.
+
+ =cut
+ #'
sub AddToShelf {
my ($env, $itemnumber, $shelfnumber) = @_;
***************
*** 108,115 ****
--- 129,150 ----
} else {
$sth=$dbh->prepare("insert into shelfcontents (shelfnumber, itemnumber,
flags) values ($shelfnumber, $itemnumber, 0)");
+ # FIXME - The default for 'flags' is NULL.
+ # Why set it to 0?
$sth->execute;
}
}
+ =item RemoveFromShelf
+
+ &RemoveFromShelf($env, $itemnumber, $shelfnumber);
+
+ Removes item number C<$itemnumber> from virtual bookshelf number
+ C<$shelfnumber>. If the item wasn't on that bookshelf to begin with,
+ nothing happens.
+
+ C<$env> is ignored.
+
+ =cut
+ #'
sub RemoveFromShelf {
my ($env, $itemnumber, $shelfnumber) = @_;
***************
*** 118,121 ****
--- 153,172 ----
}
+ =item AddShelf
+
+ ($status, $msg) = &AddShelf($env, $shelfname);
+
+ Creates a new virtual bookshelf with name C<$shelfname>.
+
+ Returns a two-element array, where C<$status> is 0 if the operation
+ was successful, or non-zero otherwise. C<$msg> is "Done" in case of
+ success, or an error message giving the reason for failure.
+
+ C<$env> is ignored.
+
+ =cut
+ #'
+ # FIXME - Perhaps this could/should return the number of the new bookshelf
+ # as well?
sub AddShelf {
my ($env, $shelfname) = @_;
***************
*** 132,135 ****
--- 183,201 ----
}
+ =item RemoveShelf
+
+ ($status, $msg) = &RemoveShelf($env, $shelfnumber);
+
+ Deletes virtual bookshelf number C<$shelfnumber>. The bookshelf must
+ be empty.
+
+ Returns a two-element array, where C<$status> is 0 if the operation
+ was successful, or non-zero otherwise. C<$msg> is "Done" in case of
+ success, or an error message giving the reason for failure.
+
+ C<$env> is ignored.
+
+ =cut
+ #'
sub RemoveShelf {
my ($env, $shelfnumber) = @_;
***************
*** 146,155 ****
}
-
END { } # module clean-up code here (global destructor)
#
# $Log$
# Revision 1.2.2.2 2002/08/14 18:30:50 tonnesen
# Adding copyright statements to all .pl and .pm files in rel-1-2 branch
--- 212,224 ----
}
END { } # module clean-up code here (global destructor)
+ 1;
#
# $Log$
+ # Revision 1.2.2.3 2002/10/28 17:45:15 tonnesen
+ # Merging from trunk to rel-1-2
+ #
# Revision 1.2.2.2 2002/08/14 18:30:50 tonnesen
# Adding copyright statements to all .pl and .pm files in rel-1-2 branch
***************
*** 159,160 ****
--- 228,243 ----
#
#
+
+ __END__
+
+ =back
+
+ =head1 AUTHOR
+
+ Koha Developement team <address@hidden>
+
+ =head1 SEE ALSO
+
+ C4::Circulation::Circ2(3)
+
+ =cut
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4 BookShelves.pm,1.2.2.2,1.2.2.3,
Steve Tonnesen <=
- Prev by Date:
[Koha-cvs] CVS: koha/C4 Context.pm,NONE,1.9.2.1
- Next by Date:
[Koha-cvs] CVS: koha admin-home.pl,1.1.2.2,1.1.2.3 bookcount.pl,1.1.4.1,1.1.4.2 catalogue-home.pl,1.1.2.2,1.1.2.3 charges.pl,1.1.1.1.2.1,1.1.1.1.2.2 currency.pl,1.1.1.1.2.1,1.1.1.1.2.2 delbiblio.pl,1.2.2.3,1.2.2.4 deletemem.pl,1.2.2.1,1.2.2.2 delitem.pl,1.1.1.1.2.2,1.1.1.1.2.3 detail.pl,1.3.2.5,1.3.2.6 groups.pl,1.1.2.1,1.1.2.2 moredetail.pl,1.4.2.4,1.4.2.5 reports-home.pl,1.1.2.2,1.1.2.3 shelves.pl,1.2.2.2,1.2.2.3
- Previous by thread:
[Koha-cvs] CVS: koha/C4 Context.pm,NONE,1.9.2.1
- Next by thread:
[Koha-cvs] CVS: koha admin-home.pl,1.1.2.2,1.1.2.3 bookcount.pl,1.1.4.1,1.1.4.2 catalogue-home.pl,1.1.2.2,1.1.2.3 charges.pl,1.1.1.1.2.1,1.1.1.1.2.2 currency.pl,1.1.1.1.2.1,1.1.1.1.2.2 delbiblio.pl,1.2.2.3,1.2.2.4 deletemem.pl,1.2.2.1,1.2.2.2 delitem.pl,1.1.1.1.2.2,1.1.1.1.2.3 detail.pl,1.3.2.5,1.3.2.6 groups.pl,1.1.2.1,1.1.2.2 moredetail.pl,1.4.2.4,1.4.2.5 reports-home.pl,1.1.2.2,1.1.2.3 shelves.pl,1.2.2.2,1.2.2.3
- Index(es):