Resolves bug 2250: RFC: New System Preference to Determine which 'Types' and associated icons to display in advanced Search
For documentation, please indicate that as part of profiling, staff can refer to the AdvancedSearchTypes system preference to choose where to draw the advanced search 'Types' from. Currently this is implemented as a choice, between itemtypes and ccodes, but it's been designed to work with any authorised value so long as an index exists for searching by that authorised value. By default, and if this syspref doesn't exist, it will pull from itemtypes as before.
This commit is contained in:
parent
89d34a7c48
commit
6c9b83fbdc
|
|
@ -216,28 +216,44 @@ my $categories = GetBranchCategories(undef,'searchdomain');
|
|||
|
||||
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
|
||||
|
||||
# load the itemtypes
|
||||
# load the Type stuff
|
||||
# load the Type stuff
|
||||
my $itemtypes = GetItemTypes;
|
||||
my @itemtypesloop;
|
||||
my $selected=1;
|
||||
my $cnt;
|
||||
my $imgdir = getitemtypeimagesrc('intranet');
|
||||
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
|
||||
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
|
||||
|
||||
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
|
||||
my %row =( number=>$cnt++,
|
||||
imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
|
||||
ccl => 'itemtype',
|
||||
code => $thisitemtype,
|
||||
selected => $selected,
|
||||
description => $itemtypes->{$thisitemtype}->{'description'},
|
||||
count5 => $cnt % 4,
|
||||
);
|
||||
$selected = 0 if ($selected) ;
|
||||
push @itemtypesloop, \%row;
|
||||
$selected = 0 if ($selected) ;
|
||||
push @itemtypesloop, \%row;
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
} else {
|
||||
my $advsearchtypes = GetAuthorisedValues($advanced_search_types);
|
||||
for my $thisitemtype (@$advsearchtypes) {
|
||||
my %row =(
|
||||
number=>$cnt++,
|
||||
imageurl=> $imgdir."/".$thisitemtype->{'imageurl'},
|
||||
ccl => $advanced_search_types,
|
||||
code => $thisitemtype->{authorised_value},
|
||||
selected => $selected,
|
||||
description => $thisitemtype->{'lib'},
|
||||
count5 => $cnt % 4,
|
||||
);
|
||||
push @itemtypesloop, \%row;
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
|
||||
# load the ccodes
|
||||
# my ($ccodecount,@ccode_loop) = GetCcodes();
|
||||
# $template->param(ccodeloop=>\@ccode_loop,);
|
||||
|
||||
# The following should only be loaded if we're bringing up the advanced search template
|
||||
if ( $template_type eq 'advsearch' ) {
|
||||
|
|
|
|||
|
|
@ -209,5 +209,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
|
|||
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
|
||||
('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC WARNING: MARC21 Only','YesNo'),
|
||||
('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on OPAC WARNING: MARC21 Only','YesNo');
|
||||
|
||||
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice');
|
||||
-- FIXME: add FrameworksLoaded, noOPACUserLogin, ReadingHistory ?
|
||||
|
|
|
|||
|
|
@ -209,3 +209,4 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
|
|||
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OPACShelfBrowser','1','','Active le parcours des rayonnages sur la page de détail','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC WARNING: MARC21 Only','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on OPAC WARNING: MARC21 Only','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice');
|
||||
|
|
|
|||
|
|
@ -1622,6 +1622,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
|||
SetVersion ($DBversion);
|
||||
}
|
||||
|
||||
$DBversion = "3.00.00.089";
|
||||
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
||||
$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice')");
|
||||
print "Upgrade to $DBversion done (added new AdvancedSearchTypes syspref)\n";
|
||||
SetVersion ($DBversion);
|
||||
}
|
||||
|
||||
=item DropAllForeignKeys($table)
|
||||
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@
|
|||
<!--TMPL_LOOP Name="itemtypeloop"-->
|
||||
<td>
|
||||
<!-- TMPL_IF name="imageurl"--><img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" /><!-- /TMPL_IF -->
|
||||
<input type="checkbox" id="mc-<!--TMPL_VAR Name="number" -->" name="limit" value="mc:<!--TMPL_VAR Name="code" -->" />
|
||||
<label for="mc-<!--TMPL_VAR Name="number" -->"><!--TMPL_VAR Name="description" --></label></td>
|
||||
<input type="checkbox" id="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->" name="limit" value="<!-- TMPL_VAR NAME="ccl" -->:<!--TMPL_VAR Name="code" -->" />
|
||||
<label for="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->"><!--TMPL_VAR Name="description" --></label></td>
|
||||
<!-- TMPL_UNLESS name="count5" --></tr><tr><!-- /TMPL_UNLESS -->
|
||||
<!--/TMPL_LOOP-->
|
||||
<!-- FIXME: for validation, avoid generating empty row -->
|
||||
|
|
|
|||
|
|
@ -191,11 +191,11 @@
|
|||
</fieldset></div>
|
||||
<!-- /BOOLEAN SEARCH OPTIONS -->
|
||||
<div id="advsearch-itemtype" class="container">
|
||||
<h3>Itemtype limit to any of the following:</h3>
|
||||
<h3>Limit type to: match any of the following:</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<!--TMPL_LOOP Name="itemtypeloop"-->
|
||||
<td><input type="checkbox" id="mc-<!--TMPL_VAR Name="number" -->" name="limit" value="mc:<!--TMPL_VAR Name="code" -->"/><!-- TMPL_IF name="imageurl"--><img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" /><!-- /TMPL_IF -->
|
||||
<td><input type="checkbox" id="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->" name="limit" value="<!-- TMPL_VAR NAME="ccl" -->:<!--TMPL_VAR Name="code" -->"/><!-- TMPL_IF name="imageurl"--><img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" /><!-- /TMPL_IF -->
|
||||
<!--TMPL_VAR Name="description" --></td>
|
||||
<!-- TMPL_UNLESS name="count5" --></tr><tr><!-- /TMPL_UNLESS -->
|
||||
<!--/TMPL_LOOP-->
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
use strict;
|
||||
|
||||
sub kohaversion {
|
||||
our $VERSION = "3.00.00.088";
|
||||
our $VERSION = "3.00.00.089";
|
||||
# version needs to be set this way
|
||||
# so that it can be picked up by Makefile.PL
|
||||
# during install
|
||||
|
|
|
|||
|
|
@ -125,25 +125,44 @@ my $categories = GetBranchCategories(undef,'searchdomain');
|
|||
|
||||
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
|
||||
|
||||
# load the itemtypes
|
||||
# load the Type stuff
|
||||
my $itemtypes = GetItemTypes;
|
||||
my @itemtypesloop;
|
||||
my $selected=1;
|
||||
my $cnt;
|
||||
my $imgdir = getitemtypeimagesrc('opac');
|
||||
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
|
||||
|
||||
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
|
||||
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
|
||||
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
|
||||
my %row =( number=>$cnt++,
|
||||
imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
|
||||
ccl => 'itemtype',
|
||||
code => $thisitemtype,
|
||||
selected => $selected,
|
||||
description => $itemtypes->{$thisitemtype}->{'description'},
|
||||
count5 => $cnt % 4,
|
||||
);
|
||||
$selected = 0 if ($selected) ;
|
||||
push @itemtypesloop, \%row;
|
||||
$selected = 0 if ($selected) ;
|
||||
push @itemtypesloop, \%row;
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
} else {
|
||||
my $advsearchtypes = GetAuthorisedValues($advanced_search_types);
|
||||
for my $thisitemtype (@$advsearchtypes) {
|
||||
my %row =(
|
||||
number=>$cnt++,
|
||||
imageurl=> $imgdir."/".$thisitemtype->{'imageurl'},
|
||||
ccl => $advanced_search_types,
|
||||
code => $thisitemtype->{authorised_value},
|
||||
selected => $selected,
|
||||
description => $thisitemtype->{'lib'},
|
||||
count5 => $cnt % 4,
|
||||
);
|
||||
push @itemtypesloop, \%row;
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
|
||||
# # load the itypes (Called item types in the template -- just authorized values for searching)
|
||||
# my ($itypecount,@itype_loop) = GetCcodes();
|
||||
|
|
|
|||
Loading…
Reference in New Issue