Bugzilla – Attachment 160725 Details for
Bug 35728
Add option to NOT redirect to result when search returns only one record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35728: Add ability to NOT redirect to result when search returns only one record
Bug-35728-Add-ability-to-NOT-redirect-to-result-wh.patch (text/plain), 4.81 KB, created by
David Nind
on 2024-01-09 20:22:59 UTC
(
hide
)
Description:
Bug 35728: Add ability to NOT redirect to result when search returns only one record
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-01-09 20:22:59 UTC
Size:
4.81 KB
patch
obsolete
>From 7a2beb7dcba4adf22069d3bec4e3b517f5ea97e7 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 8 Jan 2024 23:04:25 +0000 >Subject: [PATCH] Bug 35728: Add ability to NOT redirect to result when search > returns only one record > >This enhancement adds a new system preference RedirectToSoleResult. By default it is enabled, which matches current behaviour - to redirect to the detail page if it is the only search result. > >To test: > >1) Apply the patch, install database updates, restart services. >2) Go to Koha Administration -> Global system preferences. The RedirectToSoleResult system preference is in the Searching tab. Confirm it is enabled (set to "Redirect") by default. >3) Conduct a catalogue search on the staff interface that you know will return a single result. Confirm you are redirected to the detail page. >4) Do the same search on the OPAC. Confirm you are redirected to the detail page. >5) Go back to the system preferences and disable the RedirectToSoleResult system preference by setting it to "Don't redirect" >6) Do the searches again on the staff interface and OPAC. Confirm you are NOT redirected to the detail page, and the search results page shows as expected. > >Sponsored-by: Education Services Australia SCIS >Signed-off-by: David Nind <david@davidnind.com> >--- > catalogue/search.pl | 17 +++++++++-------- > opac/opac-search.pl | 16 ++++++++++------ > 2 files changed, 19 insertions(+), 14 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index e3da85daee..fe7de8b01c 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -610,19 +610,20 @@ for (my $i=0;$i<@servers;$i++) { > } > > ## If there's just one result, redirect to the detail page unless doing an index scan >- if ($total == 1 && !$scan) { >+ if ( $total == 1 && !$scan && C4::Context->preference('RedirectToSoleResult') ) { > my $biblionumber = $newresults[0]->{biblionumber}; >- my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); >- my $views = { C4::Search::enabled_staff_search_views }; >- if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { >+ my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); >+ my $views = {C4::Search::enabled_staff_search_views}; >+ if ( $defaultview eq 'isbd' && $views->{can_view_ISBD} ) { > print $cgi->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber&found1=1"); >- } elsif ($defaultview eq 'marc' && $views->{can_view_MARC}) { >+ } elsif ( $defaultview eq 'marc' && $views->{can_view_MARC} ) { > print $cgi->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=$biblionumber&found1=1"); >- } elsif ($defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC}) { >- print $cgi->redirect("/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=$biblionumber&found1=1"); >+ } elsif ( $defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC} ) { >+ print $cgi->redirect( >+ "/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=$biblionumber&found1=1"); > } else { > print $cgi->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&found1=1"); >- } >+ } > exit; > } > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index ae864ee30c..693572001e 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -746,16 +746,20 @@ for (my $i=0;$i<@servers;$i++) { > } > > ## If there's just one result, redirect to the detail page >- if ($total == 1 && $format ne 'rss' >- && $format ne 'opensearchdescription' && $format ne 'atom') { >- my $biblionumber=$newresults[0]->{biblionumber}; >- if (C4::Context->preference('BiblioDefaultView') eq 'isbd') { >+ if ( $total == 1 >+ && $format ne 'rss' >+ && $format ne 'opensearchdescription' >+ && $format ne 'atom' >+ && C4::Context->preference('RedirectToSoleResult') ) >+ { >+ my $biblionumber = $newresults[0]->{biblionumber}; >+ if ( C4::Context->preference('BiblioDefaultView') eq 'isbd' ) { > print $cgi->redirect("/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=$biblionumber"); >- } elsif (C4::Context->preference('BiblioDefaultView') eq 'marc') { >+ } elsif ( C4::Context->preference('BiblioDefaultView') eq 'marc' ) { > print $cgi->redirect("/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=$biblionumber"); > } else { > print $cgi->redirect("/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber"); >- } >+ } > exit; > } > if ($hits) { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35728
:
160668
|
160722
|
160723
|
160724
|
160725
|
164214
|
164215