@@ -, +, @@ - Make sure you can do a search that returns exactly one hit - Apply this patch - Do the search and verify the default behaviour of skipping the result list and going straight to detail view is in place - Toggle the OPACShowResultListOfOne syspref and make sure the behaviour corresponds to the setting. --- .../atomicupdate/bug25885-show-result-list-for-one-hit.perl | 9 +++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/searching.pref | 6 ++++++ opac/opac-search.pl | 6 ++++-- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug25885-show-result-list-for-one-hit.perl --- a/installer/data/mysql/atomicupdate/bug25885-show-result-list-for-one-hit.perl +++ a/installer/data/mysql/atomicupdate/bug25885-show-result-list-for-one-hit.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) + VALUES ('OPACShowResultListOfOne','0','Show the result list even if there is only one hit.',NULL,'YesNo') + }); + + NewVersion( $DBversion, 25885, 'OPACShowResultListOfOne, show result list if there is only one hit' ); +} --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -493,6 +493,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'), ('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'), ('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'), +('OPACShowResultListOfOne', '0', NULL, 'Show the result list even if there is only one hit.', 'YesNo'), ('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'), ('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'), ('OrderPriceRounding','','|nearest_cent','Local preference for rounding orders before calculations to ensure correct calculations','Choice'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -273,6 +273,12 @@ Searching: 1: "Display" 0: "Don't display" - ' Koha record level itemtype info on detail and result pages in the OPAC and staff interface. This info also displays if the item-level_itypes system preference is set to bibliographic record.' + - + - pref: OPACShowResultListOfOne + choices: + 1: "Show" + 0: "Don't show" + - ' the result list if there is only one hit. This is especially useful if you use a service like OverDrive and want to display the link on the result list, without automatically redirecting to detail view for a single hit.' Did you mean/spell checking: - - "Swedish service for spellchecking.
" --- a/opac/opac-search.pl +++ a/opac/opac-search.pl @@ -789,9 +789,11 @@ for (my $i=0;$i<@servers;$i++) { $template->param( EnableOpacSearchHistory => 1 ); } - ## If there's just one result, redirect to the detail page + # If there's just one result, redirect to the detail page unless this + # funtionality has been turned off with the syspref OPACShowResultListOfOne if ($total == 1 && $format ne 'rss' - && $format ne 'opensearchdescription' && $format ne 'atom') { + && $format ne 'opensearchdescription' && $format ne 'atom' + && C4::Context->preference('OPACShowResultListOfOne') == 0 ) { my $biblionumber=$newresults[0]->{biblionumber}; if (C4::Context->preference('BiblioDefaultView') eq 'isbd') { print $cgi->redirect("/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=$biblionumber"); --