X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=reports%2Fitemtypes.plugin;h=2da9a88ef30912ba25b0ad9e6b1b6b822b23b263;hb=51e3e31627c38f88671f8ab399b470ec4a02aaec;hp=3f6c677ff865c0e9bffe6c456d50f18eddf6b26e;hpb=a6c9bd0eb55c32d5632625144775271f20aa15f7;p=koha.git diff --git a/reports/itemtypes.plugin b/reports/itemtypes.plugin index 3f6c677ff8..2da9a88ef3 100755 --- a/reports/itemtypes.plugin +++ b/reports/itemtypes.plugin @@ -49,7 +49,7 @@ sub calculate { if ($branch) { if (C4::Context->preference('item-level_itypes')) { $sth = $dbh->prepare(" - SELECT description, items.itype as itemtype, COUNT(*) AS total + SELECT itemtype, description, items.itype as itemtype, COUNT(*) AS total FROM itemtypes,items WHERE items.itype=itemtypes.itemtype AND items.holdingbranch=? @@ -59,7 +59,7 @@ sub calculate { } else { $sth = $dbh->prepare(" - SELECT description, biblioitems.itemtype, COUNT(*) AS total + SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total FROM itemtypes, biblioitems, items WHERE biblioitems.itemtype=itemtypes.itemtype AND items.biblioitemnumber=biblioitems.biblioitemnumber @@ -71,14 +71,14 @@ sub calculate { } else { if (C4::Context->preference('item-level_itypes')) { $sth = $dbh->prepare(" - SELECT description,items.itype AS itemtype, COUNT(*) AS total + SELECT itemtype, description,items.itype AS itemtype, COUNT(*) AS total FROM itemtypes,items WHERE items.itype=itemtypes.itemtype GROUP BY items.itype ORDER BY itemtypes.description"); } else { - $sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total + $sth = $dbh->prepare("SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total FROM itemtypes, biblioitems,items WHERE biblioitems.itemtype=itemtypes.itemtype AND biblioitems.biblioitemnumber = items.biblioitemnumber @@ -87,17 +87,17 @@ sub calculate { } $sth->execute; } - my ($description,$biblioitems,$total); + my ($itemtype, $description,$biblioitems,$total); my $grantotal = 0; my $count = 0; - while (($description,$biblioitems,$total) = $sth->fetchrow) { + while (($itemtype, $description,$biblioitems,$total) = $sth->fetchrow) { my %line; if($count % 2){ $line{toggle} = 1; } else { $line{toggle} = 0; } - $line{itemtype} = $description; + $line{itemtype} = $itemtype; $line{count} = $total; $grantotal += $total; push @results,\%line;