$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' ) {
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 ?
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');
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)
<!--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 -->
</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-->
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
$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();