From b40caf0a6b6935748ad78c0a6e8f655e2a3603b9 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 28 Feb 2019 15:16:53 +0100 Subject: [PATCH] Bug 22434: correct item callnumber search link Many places show item callnumber as a link to a search on this callnumber. The correct way is : (opac-)search.pl?q=callnum:%22[% callnumber | uri %]%22 I propose an include that creates think search link. Patch does not create an include for OPAC since callnumber search link is only in display without XSLT which will be obsolete. It juste corrects the filtering with uri instead of url. Test plan : 1) Create an item with callnumber : AAA&1(2)3 2) Check callnumber display and search link ar OK in : 3) Intranet : perform a search in catalog search that displays this item 4) Intranet : perform a search in cataloguing serach that displays this item 5) Intranet : Create a list that displays this item 6) OPAC without XSLT : perform a search in catalog search that displays this item 7) OPAC without XSLT : perform a group search in catalog search that displays this item --- .../prog/en/includes/biblio-search-link.inc | 6 ++++++ .../prog/en/modules/catalogue/results.tt | 14 ++++++++++---- .../prog/en/modules/cataloguing/addbooks.tt | 7 +------ .../prog/en/modules/virtualshelves/shelves.tt | 4 +--- .../bootstrap/en/modules/opac-results-grouped.tt | 4 ++-- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/biblio-search-link.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-search-link.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-search-link.inc new file mode 100644 index 0000000000..70dbd25e1f --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-search-link.inc @@ -0,0 +1,6 @@ +[%~ SET query = '' ~%] +[%~ IF index ~%] + [%~ query = query _ index _ ':' ~%] +[%~ END ~%] +[%~ query = query _ '"' _ term _ '"' ~%] +[% term | html %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 4bd6402659..387280682d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -436,7 +436,7 @@ [% IF ( SEARCH_RESULT.size ) %] ; [% SEARCH_RESULT.size | html %][% END %] [% IF ( SEARCH_RESULT.isbn ) %]ISBN: [% SEARCH_RESULT.isbn | replace('\s\|', ', ') | html %][% END %] [% SEARCH_RESULT.description | html %] [% IF ( SEARCH_RESULT.timestamp ) %] (modified on [% SEARCH_RESULT.timestamp | html %])[% END %] - [% IF ( SEARCH_RESULT.cn_class ) %][[% SEARCH_RESULT.cn_class | html %]][% END %] + [% IF ( SEARCH_RESULT.cn_class ) %][[% INCLUDE 'biblio-search-link.inc' index='callnum' term=SEARCH_RESULT.cn_class %]][% END %]

[% IF ( SEARCH_RESULT.searchhighlightblob ) %]

[% SEARCH_RESULT.searchhighlightblob | html %]

[% END %] @@ -509,7 +509,9 @@ [% END %] [% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname | html %][% END %] [% IF ( available_items_loo.location ) %][% available_items_loo.location | html %][% END %] - [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber | html %]][% END %] + [% IF ( available_items_loo.itemcallnumber ) %] + [[% INCLUDE 'biblio-search-link.inc' index='callnum' term=available_items_loo.itemcallnumber %]] + [% END %] ([% available_items_loo.count | html %]) [% IF item_level_itypes && available_items_loo.description %]
[% available_items_loo.description | html %] @@ -531,7 +533,9 @@ [% END %] [% IF ( onloan_items_loo.branchname ) %][% onloan_items_loo.branchname | html %][% END %] [% IF ( onloan_items_loo.location ) %][% onloan_items_loo.location | html %][% END %] - [% IF ( onloan_items_loo.itemcallnumber ) %][[% onloan_items_loo.itemcallnumber | html %]][% END %] + [% IF ( onloan_items_loo.itemcallnumber ) %] + [[% INCLUDE 'biblio-search-link.inc' index='callnum' term=available_items_loo.itemcallnumber %]] + [% END %] ([% onloan_items_loo.count | html %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue | html %] long overdue[% END %]) date due: [% onloan_items_loo.due_date | $KohaDates %] [% IF item_level_itypes && onloan_items_loo.description %]
[% onloan_items_loo.description | html %] @@ -553,7 +557,9 @@ [% END %] [% IF ( other_items_loo.branchname ) %][% other_items_loo.branchname | html %][% END %] [% IF ( other_items_loo.location ) %][% other_items_loo.location | html %][% END %] - [% IF ( other_items_loo.itemcallnumber ) %][[% other_items_loo.itemcallnumber | html %]][% END %] + [% IF ( other_items_loo.itemcallnumber ) %] + [[% INCLUDE 'biblio-search-link.inc' index='callnum' term=other_items_loo.itemcallnumber %]] + [% END %] [% IF ( other_items_loo.withdrawn ) %]([% AuthorisedValues.GetByCode( 'WITHDRAWN', other_items_loo.withdrawn ) | html %])[% END %] [% IF ( other_items_loo.itemlost ) %]([% AuthorisedValues.GetByCode( 'LOST', other_items_loo.itemlost ) | html %])[% END %] [% IF ( other_items_loo.damaged ) %]([% AuthorisedValues.GetByCode( 'DAMAGED', other_items_loo.damaged ) | html %])[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index eef01b8ed8..cf31076beb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -105,12 +105,7 @@ [% items_loo.count | html %] [% items_loo.branchname | html %] [% IF ( items_loo.location ) %][% items_loo.location | html %][% END %] - [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %] - [% IF ( items_loo.classification ) %] - - [% items_loo.classification | html %] - - [% END %] + [% IF ( items_loo.itemcallnumber ) %][[% INCLUDE 'biblio-search-link.inc' index='callnum' term=items_loo.itemcallnumber %]][% END %]
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 2e34269723..d515bc1226 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -239,9 +239,7 @@ diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt index a5ee7ff648..67b57a8e2d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt @@ -213,7 +213,7 @@ [% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname | html %][% END %] [% IF ( OPACItemsResultsDisplay ) %] [% IF ( available_items_loo.location ) %][% available_items_loo.location | html %][% END %] - [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber | html %]][% END %] + [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber | html %]][% END %] [% END %] ([% available_items_loo.count | html %]), [% END # / FOREACH available_items_loo %] @@ -245,7 +245,7 @@ [% GROUP_RESULT.ccode | html %] [% IF ( ( Koha.Preference( 'opacbookbag' ) = 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %][% END %] [% IF ( GROUP_RESULT.classification ) %] - [% GROUP_RESULT.classification | html %] + [% GROUP_RESULT.classification | html %] [% END %]

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 20f0f1c6fc..9ace77fa47 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -404,7 +404,7 @@ [% IF ( OPACItemsResultsDisplay ) %] [% UNLESS ( singleBranchMode ) %][% available_items_loo.location | html %][% END %] - [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber | html %]][% END %] + [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber | html %]][% END %] [% END %] ([% available_items_loo.count | html %]), -- 2.17.1