Bug 7740

Summary: Highlight items in own library in search results/detail page in OPAC
Product: Koha Reporter: Savitra Sirohi <savitra.sirohi>
Component: OPACAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Paul Poulain <paul.poulain>
Severity: new feature    
Priority: P5 - low CC: kyle, melia, nblake, nengard, paul.poulain
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 9980, 10217, 11426    
Attachments: Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 - Highlight items in own library in search results/detail page in OPAC [v3.08.03]
Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 - Highlight items in own library in search results/detail page in OPAC
[Signed off] Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 follow-up: css additions for ccsr theme
Bug 7740 follow-up : removing duplicate declaration
Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 follow-up: css additions for ccsr theme
Bug 7740 - Highlight items in own library in search results/detail page in OPAC
Bug 7740 follow-up: css additions for ccsr theme
Bug 7740 follow-up : removing duplicate declaration
Bug 7740 - Followup - Add Non-XSLT Caveaut to system preference
[PASSED QA] Bug 7740 - Highlight items in own library in search results/detail page in OPAC
[PASSED QA] Bug 7740 follow-up: css additions for ccsr theme
[PASSED QA] Bug 7740 follow-up : removing duplicate declaration
[PASSED QA] Bug 7740 - Followup - Add Non-XSLT Caveaut to system preference

Description Savitra Sirohi 2012-03-19 14:23:28 UTC
My libraries would like to see their library name either highlighted from amongst the pile of libraries that are displayed when one searches for something in the OPAC.  Really what they would like is for their holding to be moved to the front of the pack AND highlighted. 
Where I mean is when one goes to the OPAC and does a keyword search for something, like 'Humger Games.'  A result list is provided to them with brief bibliographic information, an image, and a list of libraries and call numbers in green text (for available items).  It is this listing of libraries in green text that they would like to have altered so that their item is listed first and it is highlighted.  We might also want to explore changing the item listing on an individual record view in the OPAC so that the home library is listed first and all the other libraries are listed alphabetically behind it, but this is a lower priority.
Comment 1 Savitra Sirohi 2012-03-19 14:28:20 UTC
This will work only when user is logged in. 

Items that belong to the user's branch will be shown first and in larger font in both search results. 

The availability status will have no impact, items will be show first and highlighted even if those items are unavailable.

In the catalog detail page (Normal view), the items that belong to the user's branch will be show first and the rows have a different background color.

This is on the OPAC only.

A new system preference HighlightOwnItemsOnOPAC will be created to control this behaviour.
Comment 2 Savitra Sirohi 2012-03-29 12:53:40 UTC
Customer would like to have this behavior for users not logged in to the OPAC. 

Modified design:

We will use the OPAC URL being used (e.g. library1.domain.org) to identify the user's library. Once the library is known we can highlight the items in that library in the OPAC search results and in the OPAC detail page.

The assumption here is that a different URL can be setup for each library on the system that wants to use this feature.

So there could be a common URL for all libraries that are on the particular Koha install, say www.domain.org. And then each library that needs this feature will have their own URL, say library1.domain.org, library2.domain.org.
Comment 3 Nicole C. Engard 2012-03-30 23:51:55 UTC
Savitra,

Would using the URL field in the libraries table work? When you set up a library in the libraries admin area you can enter the branch URL - maybe the pattern of the URL doesn't matter so much if you use that field.  Just an idea ... not sure if I'm at all right in this assumption.

Nicole
Comment 4 Savitra Sirohi 2012-03-31 02:43:55 UTC
Nicole, that won't work, to use something from the library table, we would need to know which library the user belongs to. We don't know that when the user is not logged in.

If setting up a different url for the library is not possible, we can consider asking the user to select her home branch when they visit the home page. The selection can be stored in a cookie. Once the cookie expires (maybe after a few days), they will need to select the branch once again.
Comment 5 Kyle M Hall (khall) 2012-10-31 13:12:12 UTC Comment hidden (obsolete)
Comment 6 Kyle M Hall (khall) 2012-10-31 13:20:05 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall (khall) 2012-10-31 13:39:09 UTC Comment hidden (obsolete)
Comment 8 Owen Leonard 2013-02-06 16:53:10 UTC
This patch no longer applies. Can you rebase and resubmit?
Comment 9 Kyle M Hall (khall) 2013-02-06 20:52:21 UTC Comment hidden (obsolete)
Comment 10 Nora Blake 2013-03-08 20:50:45 UTC
I have tested this and it works the way I would expect it to.

Nora Blake
Comment 11 Kyle M Hall (khall) 2013-03-11 15:36:01 UTC Comment hidden (obsolete)
Comment 12 Melia Meggs 2013-03-11 23:23:43 UTC Comment hidden (obsolete)
Comment 13 Melia Meggs 2013-03-11 23:24:12 UTC
I'm signing off this patch on behalf of Nora.
Comment 14 Paul Poulain 2013-03-22 09:50:54 UTC
Test plan:
 * apply the patch
 * activate the syspref  HighlightOwnItemsOnOPAC  to <<emphasize>>  results from the <<patron home branche>> by moving the results to the front and increasing the size or highlighting the rows for those results. 
 * go to OPAC, and login
 * search for a biblio that has at least 2 items, one at patron branch, one not.
 * in the result list, the item from patron branch is highlighted, the other one isn't
 * in the detail page, same thing

QA comment:
 * the css addition was missing to ccsr theme, i've added it in a follow-up
 * this patch adds a my $branches = GetBranches() in opac-detail. This has also been introduced later, resulting in a perlcritic error. I've fixed it in another follow-up
 * work fine, clean code.
 * tested with and without XSLT. with XSLT, the opac-detail is OK, but the result IS NOT. Looking at koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl, it appears that there is no code to handle this syspref. Please fix & resubmit (and do that for MARC21, NORMARC & UNIMARC please, should be easy once you've made it for MARC21, should be easy to do it for others). I think it's
Comment 15 Paul Poulain 2013-03-22 09:52:00 UTC Comment hidden (obsolete)
Comment 16 Paul Poulain 2013-03-22 09:52:05 UTC Comment hidden (obsolete)
Comment 17 Paul Poulain 2013-03-22 09:52:10 UTC Comment hidden (obsolete)
Comment 18 Kyle M Hall (khall) 2013-03-22 10:43:30 UTC Comment hidden (obsolete)
Comment 19 Kyle M Hall (khall) 2013-03-22 10:43:42 UTC Comment hidden (obsolete)
Comment 20 Kyle M Hall (khall) 2013-03-22 10:44:25 UTC Comment hidden (obsolete)
Comment 21 Kyle M Hall (khall) 2013-03-22 10:44:34 UTC Comment hidden (obsolete)
Comment 22 Kyle M Hall (khall) 2013-03-22 10:44:41 UTC Comment hidden (obsolete)
Comment 23 Kyle M Hall (khall) 2013-03-22 10:44:48 UTC Comment hidden (obsolete)
Comment 24 Kyle M Hall (khall) 2013-03-22 10:47:04 UTC
Talked to Paul, agreed that this would very difficult to implement in XSLT and it would be acceptable just to note this feature only works for non-xslt.
Comment 25 Paul Poulain 2013-03-22 16:29:48 UTC
QA comment
 * passes koha-qa
 * the workaround for non-XSLT is not the best possible option, but at least users are warned.

passed QA
Comment 26 Paul Poulain 2013-03-22 16:32:34 UTC
Created attachment 16811 [details] [review]
[PASSED QA] Bug 7740 - Highlight items in own library in search results/detail page in OPAC

This feature enables a particular library's items to be emphasized and moved
to the first position on the search results and details pages of the OPAC.

It is enabled by the sytem preference HighlightOwnItemsOnOPAC.

To choose which branches items are emphasized, use the system preference
HighlightOwnItemsOnOPACWhich. It has two modes.

If set to PatronBranch, the items emphasized will be those of the same
library as the patron's library. If no one is logged into the opac, no
items will be highlighted.

If set to OpacURLBranch, the library is chosen based on the Apache
environment variable BRANCHCODE.

For example, this could be added to the OPAC section of koha-httpd.conf:
SetEnv BRANCHCODE "CPL"

The point of this feature is to allow each library on a given Koha server
to have a specific subdomain for the opac where that library's items are
empasized. That was http://branch1.opac.mylibrary.org will emphasize the
items of branch1, while http://branch2.opac.mylibrary.org will emphasize
the items of branch2.

Signed-off-by: Melia Meggs <melia@bywatersolutions.com>
Signed-off-by: Nora Blake <nblake@masslibsystem.org>

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 27 Paul Poulain 2013-03-22 16:32:38 UTC
Created attachment 16812 [details] [review]
[PASSED QA] Bug 7740 follow-up: css additions for ccsr theme

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 28 Paul Poulain 2013-03-22 16:32:42 UTC
Created attachment 16813 [details] [review]
[PASSED QA] Bug 7740 follow-up : removing duplicate declaration

the my $branches = GetBranches();
already exist at line 444 (introduced by this patch)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 29 Paul Poulain 2013-03-22 16:32:45 UTC
Created attachment 16814 [details] [review]
[PASSED QA] Bug 7740 - Followup - Add Non-XSLT Caveaut to system preference

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 30 Jared Camins-Esakov 2013-03-23 03:22:55 UTC
This patch has been pushed to master.