From 608693fe45f225109d004ca3329f28a5e59e96e0 Mon Sep 17 00:00:00 2001
From: Fridolin Somers
Date: Wed, 11 Jun 2014 12:25:19 +0200
Subject: [PATCH] Bug 12405 - Search links on callnumber fails on intranet
results page
On intranet results page, the callnumber of items is a search like :
/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=[% result.itemcallnumber |url %]
The callnumber should be URI-escaped to avoid special URI characters like & , ? ...
If the callnumber contains some CCL words or parenthesis, the search will fail, it should be wrapped with double-quotes.
This patch adds this to catalogue/results.pl and catalogue/shelves.pl :
- uri TT filter instead of url
- adds double-quotes using there URI code %22 since its in a HTML attribute using double-quotes
Test plan :
- Edit an item callnumber with : & ABC 123
- Index zebraqueue
- Perform a search returning this item
- Click on the callnumber
=> Without this patch you get no result, because URL parameters are : idx=callnum&q=& ABC 123
=> With this patch you get results
- Set syspref QueryWeightFields off (because this is no bug if on)
- Edit an item callnumber with : AB(C) AND OR
- Index zebraqueue
- Perform a search returning this item
- Click on the callnumber
=> Without this patch you get no result, because the search contains CCL words "OR" and "AND"
=> With this patch you get results
Signed-off-by: Liz Rea
Tested all with and without queryweightfields -
all searches from clicked call numbers for given callnumbers fail without the patch, all are successful with the patch.
---
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 8 ++++----
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
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 0ebcecf..9462fa1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -509,7 +509,7 @@ var holdForPatron = function () {
[% IF ( SEARCH_RESULT.size ) %] ; [% SEARCH_RESULT.size %][% END %] [% IF ( SEARCH_RESULT.isbn ) %]ISBN: [% SEARCH_RESULT.isbn | replace('\s\|', ', ')%][% END %]
[% SEARCH_RESULT.description %]
[% IF ( SEARCH_RESULT.timestamp ) %] (modified on [% SEARCH_RESULT.timestamp %])[% END %]
- [% IF ( SEARCH_RESULT.cn_class ) %][[% SEARCH_RESULT.cn_class %]][% END %]
+ [% IF ( SEARCH_RESULT.cn_class ) %][[% SEARCH_RESULT.cn_class %]][% END %]
[% IF ( SEARCH_RESULT.searchhighlightblob ) %][% SEARCH_RESULT.searchhighlightblob %]
[% END %]
@@ -553,7 +553,7 @@ var holdForPatron = function () {
[% END %]
[% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname %][% END %]
[% IF ( available_items_loo.location ) %][% available_items_loo.location %][% END %]
- [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber %]][% END %]
+ [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber %]][% END %]
([% available_items_loo.count %])
[% IF item_level_itypes && available_items_loo.description %]
[% available_items_loo.description %]
@@ -575,7 +575,7 @@ var holdForPatron = function () {
[% END %]
[% IF ( onloan_items_loo.branchname ) %][% onloan_items_loo.branchname %][% END %]
[% IF ( onloan_items_loo.location ) %][% onloan_items_loo.location %][% END %]
- [% IF ( onloan_items_loo.itemcallnumber ) %][[% onloan_items_loo.itemcallnumber %]][% END %]
+ [% IF ( onloan_items_loo.itemcallnumber ) %][[% onloan_items_loo.itemcallnumber %]][% END %]
([% onloan_items_loo.count %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue %] long overdue[% END %]) date due: [% onloan_items_loo.due_date %]
[% IF item_level_itypes && onloan_items_loo.description %]
[% onloan_items_loo.description %]
@@ -597,7 +597,7 @@ var holdForPatron = function () {
[% END %]
[% IF ( other_items_loo.branchname ) %][% other_items_loo.branchname %][% END %]
[% IF ( other_items_loo.location ) %][% other_items_loo.location %][% END %]
- [% IF ( other_items_loo.itemcallnumber ) %][[% other_items_loo.itemcallnumber %]][% END %]
+ [% IF ( other_items_loo.itemcallnumber ) %][[% other_items_loo.itemcallnumber %]][% END %]
[% IF ( other_items_loo.withdrawn ) %](Withdrawn)[% END %]
[% IF ( other_items_loo.itemlost ) %](Lost)[% END %]
[% IF ( other_items_loo.damaged ) %](Damaged)[% 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 b4e932c..97e47a7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
@@ -383,7 +383,7 @@ function placeHold () {
[% FOREACH result IN itemsloo.ITEM_RESULTS %]
[% result.holdingbranch %] [% IF ( result.location_intranet ) %] ([% result.location_intranet %]) [% END %]
[% IF ( result.itemcallnumber ) %]
- [[% result.itemcallnumber %]]
+ [[% result.itemcallnumber %]]
[% END %]
[% END %]
--
1.9.1