diff --git a/catalogue/search.pl b/catalogue/search.pl index 10ec0e39a6..101fd68535 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -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' ) { diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index 9313f0fcfb..9282a7f850 100755 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -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 ? diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index fbfddfcd80..ad6242c3d9 100755 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3b273a15c6..df5b8cb666 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl index 4511761ecf..d58ad06290 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl @@ -91,8 +91,8 @@
| " name="limit" value="mc:"/> | -" name="limit" value=":"/> |