diff --git a/C4/Koha.pm b/C4/Koha.pm index c7aa3ed742..68652ff53f 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -189,7 +189,7 @@ build a HTML select with the following code : sub GetSupportList{ my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); - if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { + if (!$advanced_search_types or $advanced_search_types =~ /itemtypes/) { my $query = qq| SELECT * FROM itemtypes diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t index f285929739..51c21b880d 100644 --- a/t/db_dependent/Suggestions.t +++ b/t/db_dependent/Suggestions.t @@ -9,10 +9,11 @@ use Data::Dumper; use C4::Suggestions; -use Test::More tests =>9; +use Test::More tests =>12; BEGIN { use_ok('C4::Suggestions'); + use_ok('C4::Koha'); } my ($suggestionid, $suggestion, $status, $biblionumber); @@ -26,3 +27,12 @@ ok($suggestion= GetSuggestionFromBiblionumber( $biblionumber ), "GetSuggestionFr ok($suggestion= GetSuggestionInfoFromBiblionumber( $biblionumber ), "GetSuggestionInfoFromBiblionumber OK"); ok(@{SearchSuggestion( {STATUS=>'STALLED'} )}>0, "SearchSuggestion Status OK"); +## Bug 11466, making sure GetSupportList() returns itemtypes, even if AdvancedSearchTypes has multiple values +C4::Context->set_preference("AdvancedSearchTypes", 'itemtypes|loc|ccode'); +my $itemtypes = C4::Koha::GetSupportList(); +ok(scalar @$itemtypes, "Purchase suggestion itemtypes collected, multiple AdvancedSearchTypes"); + +C4::Context->set_preference("AdvancedSearchTypes", 'itemtypes'); +$itemtypes = C4::Koha::GetSupportList(); +ok(scalar @$itemtypes, "Purchase suggestion itemtypes collected, default AdvancedSearchTypes"); +##EO Bug 11466 \ No newline at end of file