Bugzilla – Attachment 14240 Details for
Bug 7620
OPACNoResult, add search string to available parameters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
OPACNoResult, Add keyword to query string
OPACNoResult-Add-keyword-to-query-string.patch (text/plain), 2.30 KB, created by
Jonathan Druart
on 2012-12-21 15:50:52 UTC
(
hide
)
Description:
OPACNoResult, Add keyword to query string
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-12-21 15:50:52 UTC
Size:
2.30 KB
patch
obsolete
>From 54bdd225d7acb6477611df992d877a867cb2fc15 Mon Sep 17 00:00:00 2001 >From: Lyon3 Team <koha@univ-lyon3.fr> >Date: Thu, 11 Oct 2012 16:12:48 +0200 >Subject: [PATCH] OPACNoResult, Add keyword to query string > >When search failed, this patch gets the keyword(s) and add them >to the string entered by the user to OPACNoResultFound > >http://bugs.koha-community.org/show_bug.cgi?id=7620 >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > .../prog/en/modules/admin/preferences/opac.pref | 1 + > opac/opac-search.pl | 10 ++++++++++ > 2 files changed, 11 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 9239f12..c1870ad 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -239,6 +239,7 @@ OPAC: > - a library select pulldown menu on the OPAC masthead. > - > - 'Display this HTML when no results are found for a search in the OPAC:' >+ - '<br />Note: You can insert placeholders {QUERY_KW} that will be replaced with the keywords of the query.' > - pref: OPACNoResultsFound > type: textarea > class: code >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 73d2c53..9708176 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -761,6 +761,16 @@ for (my $i=0;$i<@servers;$i++) { > } > # no hits > else { >+ my $nohits = C4::Context->preference('OPACNoResultsFound'); >+ if ($nohits and $nohits=~/{QUERY_KW}/){ >+ # extracting keywords in case of relaunching search >+ (my $query_kw=$query_desc)=~s/ and|or / /g; >+ $query_kw = Encode::decode_utf8($query_kw); >+ my @query_kw=($query_kw=~ /([-\w]+\b)(?:[^,:]|$)/g); >+ $query_kw=join('+',@query_kw); >+ $nohits=~s/{QUERY_KW}/$query_kw/g; >+ $template->param('OPACNoResultsFound' =>$nohits); >+ } > $template->param( > searchdesc => 1, > query_desc => $query_desc, >-- >1.7.10.4
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 7620
:
7941
|
8713
|
10219
|
10253
|
12773
|
14236
| 14240