Lines 278-291
sub GetItemTypes {
Link Here
|
278 |
|
278 |
|
279 |
=head2 GetItemTypesCategorized |
279 |
=head2 GetItemTypesCategorized |
280 |
|
280 |
|
281 |
Returns item types but grouped by category if available. |
281 |
$categories = GetItemTypesCategorized(); |
|
|
282 |
|
283 |
Returns a hashref containing search categories. |
284 |
A search category will be put in the hash if at least one of its itemtypes is visible in OPAC. |
282 |
The categories must be part of Authorized Values (DOCTYPECAT) |
285 |
The categories must be part of Authorized Values (DOCTYPECAT) |
283 |
|
286 |
|
284 |
=cut |
287 |
=cut |
285 |
|
288 |
|
286 |
sub GetItemTypesCategorized { |
289 |
sub GetItemTypesCategorized { |
287 |
my $dbh = C4::Context->dbh; |
290 |
my $dbh = C4::Context->dbh; |
288 |
# Order is important, so that partially hidden search |
291 |
# Order is important, so that partially hidden (some items are not visible in OPAC) search |
289 |
# categories will be visible. hideinopac=0 must be last. |
292 |
# categories will be visible. hideinopac=0 must be last. |
290 |
my $query = qq| |
293 |
my $query = qq| |
291 |
SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0 |
294 |
SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0 |
Lines 313-327
sub GetItemTypesCategorized {
Link Here
|
313 |
while ( my $IT = $sth->fetchrow_hashref ) { |
316 |
while ( my $IT = $sth->fetchrow_hashref ) { |
314 |
$itemtypes{ $IT->{'itemtype'} } = $IT; |
317 |
$itemtypes{ $IT->{'itemtype'} } = $IT; |
315 |
} |
318 |
} |
316 |
|
|
|
317 |
return ( \%itemtypes ); |
319 |
return ( \%itemtypes ); |
318 |
} |
320 |
} |
319 |
|
321 |
|
320 |
=head2 GetItemTypesByCategory |
322 |
=head2 GetItemTypesByCategory |
321 |
|
323 |
|
322 |
$category = category filter |
324 |
@results = GetItemTypesByCategory( $searchcategory ); |
323 |
|
325 |
|
324 |
Returns the itemtypes that are grouped into the category. |
326 |
Returns the itemtype code of all itemtypes included in a searchcategory. |
325 |
|
327 |
|
326 |
=cut |
328 |
=cut |
327 |
|
329 |
|