From bdd09a2647aadfc40d96260d0b7b21ebe9794341 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 3 Oct 2013 08:18:26 -0400 Subject: [PATCH] Bug 9468 - Add ability to hide itemtypes from purchase suggestions forms - QA Followup --- C4/Koha.pm | 20 +++++++++++--------- opac/opac-suggestions.pl | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 6483e4d..3cf7995 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -187,18 +187,20 @@ build a HTML select with the following code : =cut sub GetSupportList{ - my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); + my ( $params ) = @_; + my $use_SuggestionsHideItemTypes = $params->{SuggestionsHideItemTypes}; - my $hidden_item_types = join( ',', map{ qq{'$_'} } split(qq{ }, C4::Context->preference("SuggestionsHideItemTypes") ) ); - my $hide_sql = $hidden_item_types ? "WHERE itemtype NOT IN ( $hidden_item_types )" : qq{}; + my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { - my $query = qq| - SELECT * - FROM itemtypes - $hide_sql - ORDER BY description - |; + + my $where; + if ( $use_SuggestionsHideItemTypes ) { + my $hidden_item_types = join( ',', map{ qq{'$_'} } split(q{ }, C4::Context->preference("SuggestionsHideItemTypes") ) ); + $where = $hidden_item_types ? "WHERE itemtype NOT IN ( $hidden_item_types )" : qq{}; + } + + my $query = qq{ SELECT * FROM itemtypes $where ORDER BY description }; my $sth = C4::Context->dbh->prepare($query); $sth->execute; return $sth->fetchall_arrayref({}); diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 32b5c3d..aa08775 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -100,7 +100,7 @@ if ( $op eq "delete_confirm" ) { exit; } map{ $_->{'branchcodesuggestedby'}=GetBranchInfo($_->{'branchcodesuggestedby'})->[0]->{'branchname'}} @$suggestions_loop; -my $supportlist=GetSupportList(); +my $supportlist = GetSupportList( { SuggestionsHideItemTypes => 1 } ); foreach my $support(@$supportlist){ if ($$support{'imageurl'}){ $$support{'imageurl'}= getitemtypeimagelocation( 'opac', $$support{'imageurl'} ); -- 1.7.2.5