@@ -, +, @@ 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(-) --- a/C4/Koha.pm +++ a/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; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -419,3 +419,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorsFacetsSeparator',', ', 'UNIMARC authors facets separator', NULL, 'short'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo'); +INSERT INTO systempreferences ( variable, value, explanation, type ) VALUES ( 'SuggestionsHideItemTypes', '', 'Item types to hide from the purchase suggestion forms, delimited by spaces', 'free' ); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6655,6 +6655,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT INTO systempreferences ( variable, value, explanation, type ) VALUES ( 'SuggestionsHideItemTypes', '', 'Item types to hide from the purchase suggestion forms, delimited by spaces', 'free' )"); + print "Upgrade to $DBversion done (Bug 9468 - Add ability to hide items from purchase suggestions forms)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -346,6 +346,11 @@ OPAC: no: "Don't allow" - patrons to make purchase suggestions on the OPAC. - + - "Do not show the following item types for purchase suggestions:" + - pref: SuggestionsHideItemTypes + class: multi + - "(separate item types with spaces)" + - - pref: reviewson choices: yes: Allow --