1 package C4::VirtualShelves;
3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
28 use constant SHELVES_MASTHEAD_MAX => 10; #number under Lists button in masthead
29 use constant SHELVES_COMBO_MAX => 10; #add to combo in search
30 use constant SHELVES_MGRPAGE_MAX => 20; #managing page
31 use constant SHELVES_POPUP_MAX => 40; #addbybiblio popup
33 use constant SHARE_INVITATION_EXPIRY_DAYS => 14; #two weeks to accept
35 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
38 # set the version for version checking
39 $VERSION = 3.07.00.049;
52 C4::VirtualShelves - Functions for manipulating Koha virtual shelves
56 use C4::VirtualShelves;
60 This module provides functions for manipulating virtual shelves,
61 including creating and deleting virtual shelves, and adding and removing
62 bibs to and from virtual shelves.
68 $howmany= ShelvesMax($context);
70 Tells how much shelves are shown in which context.
71 POPUP refers to addbybiblionumber popup, MGRPAGE is managing page (in opac or
72 staff), COMBO refers to the Add to-combo of search results. MASTHEAD is the
73 main Koha toolbar with Lists button.
79 return SHELVES_POPUP_MAX if $which eq 'POPUP';
80 return SHELVES_MGRPAGE_MAX if $which eq 'MGRPAGE';
81 return SHELVES_COMBO_MAX if $which eq 'COMBO';
82 return SHELVES_MASTHEAD_MAX if $which eq 'MASTHEAD';
83 return SHELVES_MASTHEAD_MAX;
87 my ($owner, $category) = @_;
89 # Find out how many shelves total meet the submitted criteria...
91 my $dbh = C4::Context->dbh;
92 my $query = "SELECT count(*) FROM virtualshelves vs ";
95 LEFT JOIN virtualshelfshares sh ON sh.shelfnumber=vs.shelfnumber
96 AND sh.borrowernumber=?
97 WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?) };
98 @params= ($owner, $owner, $owner);
101 $query.='WHERE category=2';
104 my $sth = $dbh->prepare($query);
105 $sth->execute(@params);
106 my ($total)= $sth->fetchrow;
116 Koha Development Team <http://koha-community.org/>
120 C4::Circulation::Circ2(3)