5 description => "Add permission for creating saved search filters",
8 my ($dbh, $out) = @$args{qw(dbh out)};
10 INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
11 (3, 'manage_search_filters', 'Manage custom search filters');
13 say $out "Added manage_search_filters permission";
14 unless( TableExists( 'search_filters' ) ){
16 CREATE TABLE `search_filters` (
17 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
18 `name` varchar(255) NOT NULL COMMENT 'filter name',
19 `query` mediumtext NULL DEFAULT NULL COMMENT 'filter query part',
20 `limits` mediumtext NULL DEFAULT NULL COMMENT 'filter limits part',
21 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
22 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
23 PRIMARY KEY (`search_filter_id`)
24 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
26 say $out "Added search_filters table";
28 say $out "search_filters table already created";
31 INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
32 ('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo')
34 say $out "Added SavedSearchFilters system preference";