Bug 15098 - Itemtype description missing from facets for itypes in a search group
Summary: Itemtype description missing from facets for itypes in a search group
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bernardo Gonzalez Kriegel
QA Contact: Testopia
URL:
Keywords:
Depends on: 15092
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-01 14:33 UTC by Katrin Fischer
Modified: 2016-06-21 21:40 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 15098: Itemtype description missing from facets for itypes in a search group (2.19 KB, patch)
2015-11-04 12:38 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 15098: Itemtype description missing from facets for itypes in a search group (2.40 KB, patch)
2015-11-04 13:08 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 15098: Itemtype description missing from facets for itypes in a search group (2.46 KB, patch)
2015-11-05 07:03 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2015-11-01 14:33:31 UTC
If the itemtype is marked as hidden in OPAC, only the itype code is shown in the facets.
Comment 1 Marc Véron 2015-11-03 16:51:05 UTC
Hi Katrin,

I do not know how to reproduce the issue.
What I did:
- Mark a item type as hidden in Opac

- This item type no longer appears in Opac on advanced search,
  as advertised near "Hide in Opac": "(if checked, items of this 
  type will be hidden as filters in OPAC's advanced search)"

- Go to Opac. Do a search.

- Item Types appear at teh left in facets. They all have their names
  ( Books, E-Book ...)
Comment 2 Bernardo Gonzalez Kriegel 2015-11-03 17:02:21 UTC
For me the problem is not when hideinopac is set, but when the item type is assigned to a search group (talking about Item types in facets)
Comment 3 Katrin Fischer 2015-11-03 19:59:14 UTC
I think Bernardo is right - I had testd those 2 new features and probably named the wrong cause. Changing bug title - thx for testing!
Comment 4 Marc Véron 2015-11-03 22:48:05 UTC
Following findings:

opac/opac-search.pl line 213 calls GetItemTypesCategorized
and then resolves the codes to the descriptions

But C4/Koha.pm, GetItemTypesCategorized, line 303 has:
SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0  (...)

If I remove the WHERE clause, the label appears in the facet as expected (Books isntead of BK in my test case).

I think this is the place for some more digging. Where is GetItemTypesCategorized used, is it possible to remove the where clause without side effects (No, I'm afraid), do we need a variant without where clause for the facets?
Comment 5 Bernardo Gonzalez Kriegel 2015-11-03 23:08:04 UTC
(In reply to Marc Véron from comment #4)
> 
> If I remove the WHERE clause, the label appears in the facet as expected
> (Books isntead of BK in my test case).
> 
> I think this is the place for some more digging. Where is
> GetItemTypesCategorized used, is it possible to remove the where clause
> without side effects (No, I'm afraid), do we need a variant without where
> clause for the facets?

I'm afraid not.GetItemTypesCategorized is used to get item types and search groups.

But as you said, we need to dig a little more :)
Comment 6 Bernardo Gonzalez Kriegel 2015-11-04 12:38:28 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2015-11-04 13:08:38 UTC Comment hidden (obsolete)
Comment 8 Katrin Fischer 2015-11-05 07:03:41 UTC
Created attachment 44455 [details] [review]
[PASSED QA] Bug 15098: Itemtype description missing from facets for itypes in a search group

This patch adds a second variable to hold item types info
just for facets.

In case we have an item type in a search category, it's description
is removed from GetItemTypesCategorized, which is good for advanced
search, but no for facets

A second var is needed which holds all item type info.

To test:
On top of Bug 15092 patches (no really needed, but I write this on top
of them)
1) Add an item type to a search group
2) Do a search in opac, in facets will see only item type code,
no description, for that item type
3) Apply the patch
4) Repeat search, now description must be present

Followed test plan including translated descriptions. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi (tcohen) 2015-11-05 12:55:56 UTC
Patch pushed to master.

Thanks Bernardo!