4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
38 my ($parameters) = @_;
40 my $branch = @
$parameters[0];
41 my $dbh = C4
::Context
->dbh;
44 if (C4
::Context
->preference('item-level_itypes')) {
45 $sth = $dbh->prepare("
46 SELECT itemtype, description, items.itype as itemtype, COUNT(*) AS total
48 WHERE items.itype=itemtypes.itemtype
49 AND items.holdingbranch=?
51 ORDER BY itemtypes.description");
55 $sth = $dbh->prepare("
56 SELECT biblioitems.itemtype, description, biblioitems.itemtype, COUNT(*) AS total
57 FROM itemtypes, biblioitems, items
58 WHERE biblioitems.itemtype=itemtypes.itemtype
59 AND items.biblioitemnumber=biblioitems.biblioitemnumber
60 AND items.holdingbranch=?
61 GROUP BY biblioitems.itemtype
62 ORDER BY itemtypes.description");
64 $sth->execute($branch);
66 if (C4
::Context
->preference('item-level_itypes')) {
67 $sth = $dbh->prepare("
68 SELECT biblioitems.itemtype, description,items.itype AS itemtype, COUNT(*) AS total
70 WHERE items.itype=itemtypes.itemtype
72 ORDER BY itemtypes.description");
75 $sth = $dbh->prepare("SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total
76 FROM itemtypes, biblioitems,items
77 WHERE biblioitems.itemtype=itemtypes.itemtype
78 AND biblioitems.biblioitemnumber = items.biblioitemnumber
79 GROUP BY biblioitems.itemtype
80 ORDER BY itemtypes.description");
84 my ($itemtype, $description,$biblioitems,$total);
87 while (($itemtype, $description,$biblioitems,$total) = $sth->fetchrow) {
94 $line{itemtype
} = $itemtype;
95 $line{count
} = $total;
102 $globalline{loopitemtype
} = \
@results;
103 $globalline{total
} = $grantotal;
104 $globalline{branch
} = $branch;
105 push @mainloop,\
%globalline;