[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 BookShelves.pm [rel_3_0]
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/C4 BookShelves.pm [rel_3_0] |
Date: |
Fri, 15 Dec 2006 17:37:52 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/12/15 17:37:52
Modified files:
C4 : BookShelves.pm
Log message:
removing a function used only once.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/BookShelves.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.15.8.8&r2=1.15.8.9
Patches:
Index: BookShelves.pm
===================================================================
RCS file: /sources/koha/koha/C4/BookShelves.pm,v
retrieving revision 1.15.8.8
retrieving revision 1.15.8.9
diff -u -b -r1.15.8.8 -r1.15.8.9
--- BookShelves.pm 14 Dec 2006 17:22:55 -0000 1.15.8.8
+++ BookShelves.pm 15 Dec 2006 17:37:52 -0000 1.15.8.9
@@ -3,7 +3,7 @@
package C4::BookShelves;
-# $Id: BookShelves.pm,v 1.15.8.8 2006/12/14 17:22:55 toins Exp $
+# $Id: BookShelves.pm,v 1.15.8.9 2006/12/15 17:37:52 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -29,7 +29,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.15.8.8 $' =~ /\d+/g; shift(@v) . "." .
join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.15.8.9 $' =~ /\d+/g; shift(@v) . "." .
join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -60,8 +60,6 @@
&ModShelf
&ShelfPossibleAction
&DelFromShelf &DelShelf
-
- &DisplayShelf
);
my $dbh = C4::Context->dbh;
@@ -171,13 +169,20 @@
sub GetShelfContents {
my ( $shelfnumber ) = @_;
my @itemlist;
- my $query = "SELECT itemnumber FROM shelfcontents WHERE shelfnumber=?
ORDER BY itemnumber";
+ my $query =
+ " SELECT itemnumber
+ FROM shelfcontents
+ WHERE shelfnumber=?
+ ORDER BY itemnumber
+ ";
my $sth = $dbh->prepare($query);
$sth->execute($shelfnumber);
- my $sth2 = $dbh->prepare("SELECT biblio.*,biblioitems.* FROM items
+ my $sth2 = $dbh->prepare("
+ SELECT biblio.*,biblioitems.* FROM items
LEFT JOIN biblio on
items.biblionumber=biblio.biblionumber
LEFT JOIN biblioitems on
items.biblionumber=biblioitems.biblionumber
- WHERE items.itemnumber=?");
+ WHERE items.itemnumber=?"
+ );
while ( my ($itemnumber) = $sth->fetchrow ) {
$sth2->execute($itemnumber);
my $item = $sth2->fetchrow_hashref;
@@ -346,7 +351,7 @@
=cut
sub ShelfPossibleAction {
- my ( $loggedinuser, $shelfnumber, $action ) = @_;
+ my ( $user, $shelfnumber, $action ) = @_;
my $query = qq(
SELECT owner,category
FROM bookshelf
@@ -355,8 +360,8 @@
my $sth = $dbh->prepare($query);
$sth->execute($shelfnumber);
my ( $owner, $category ) = $sth->fetchrow;
- return 1 if (($category >= 3 or $owner eq $loggedinuser) && $action eq
'manage' );
- return 1 if (($category >= 2 or $owner eq $loggedinuser) && $action eq
'view' );
+ return 1 if (($category >= 3 or $owner eq $user) && $action eq 'manage' );
+ return 1 if (($category >= 2 or $owner eq $user) && $action eq 'view' );
return 0;
}
@@ -373,7 +378,6 @@
#'
sub DelFromShelf {
my ( $itemnumber, $shelfnumber ) = @_;
- warn Data::Dumper::Dumper(@_);
my $query = qq(
DELETE FROM shelfcontents
WHERE shelfnumber=? AND itemnumber=?
@@ -392,48 +396,12 @@
#'
sub DelShelf {
- warn "Delshelf";
my ( $shelfnumber ) = @_;
my $sth = $dbh->prepare("DELETE FROM bookshelf WHERE shelfnumber=?");
$sth->execute($shelfnumber);
return 0;
}
-=head2 DisplayShelf
-
-DisplayShelf($shelfnumber,$shelflist,innerquery,$template,$loggedinuser);
-
-=cut
-
-sub DisplayShelf {
- my $innershelfnumber = shift;
- my $shelflist = shift;
- my $innerquery = shift;
- my $innertemplate = shift;
- my $user = shift;
-
- #check that the user can view the shelf
- return
- unless ( ShelfPossibleAction( $user, $innershelfnumber, 'view' ) );
- my ($itemlist) = GetShelfContents($innershelfnumber);
- my $item = '';
- my $color = '';
- my @itemsloop;
- foreach $item ( sort { $a->{'barcode'} cmp $b->{'barcode'} } @$itemlist ) {
- ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
- $item->{'toggle'} = $color;
- push( @itemsloop, $item );
- }
- $innertemplate->param(
- itemsloop => address@hidden,
- shelfname => $shelflist->{$innershelfnumber}->{'shelfname'},
- shelfnumber => $innershelfnumber,
- viewshelf => $innerquery->param('viewshelf'),
- manageshelf =>
- &ShelfPossibleAction( $user, $innershelfnumber, 'manage' ),
- );
-}
-
END { } # module clean-up code here (global destructor)
1;
@@ -454,6 +422,9 @@
#
# $Log: BookShelves.pm,v $
+# Revision 1.15.8.9 2006/12/15 17:37:52 toins
+# removing a function used only once.
+#
# Revision 1.15.8.8 2006/12/14 17:22:55 toins
# bookshelves work perfectly with mod_perl and are cleaned.
#