From 1fc82b997dc7f89983334fc828d8d35bc98aecd4 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 23 Jan 2013 14:23:08 -0500 Subject: [PATCH] Bug 9468 - Add ability to hide items from purchase suggestions forms Test Plan: 1) Apply patch 2) Run updatedatabase.pl 3) Add some itemtypes to the new system pref SuggestionsHideItemTypes 4) Make a purchase suggestion 5) Verify those item types set in SuggestionsHideItemTypes do not appear in the pulldown menu for "Item type" --- C4/Koha.pm | 9 +++++++-- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/opac.pref | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 3892468..7a7a043 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -187,11 +187,16 @@ build a HTML select with the following code : sub GetSupportList{ my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); + + 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{}; + if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { my $query = qq| SELECT * - FROM itemtypes - order by description + FROM itemtypes + $hide_sql + ORDER BY description |; my $sth = C4::Context->dbh->prepare($query); $sth->execute; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d5d15d7..7dfc214 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -406,3 +406,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded