Bug 12432 - Saved reports tabs not working

In release 3.14.05.000 the tabs on the Saved Reports page worked
correctly but after upgrading to 3.16.00.000 the tabs stop working.
Visually the tabs change but the table of reports is not filtered. There
are no errors reported in the browser console.

Test Plan:
1) Attempt to filter saved reports by group tabs
2) Note no matter the tab you select, all reports appear
3) Apply this patch
4) Repeat step 1
5) Note the reports are now filtered correctly

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described with the
second patch applied as well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 273e86c045ad7e34a3eedeee0c5d3328af8a7605)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 12432 [QA Followup] - Make "All" tab work when switching back to it

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 911127588b4c0b71a18f1f474324f302447eba09)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10893: fix location facet in UNIMARC

Location facet in UNIMARC is void. In the code, it is build
on 995$c, while location is store in 995$e (see record.abs).
This patch replace 995$c with 995$e in Koha.pm

To test :
1. Use a UNIMARC Koha instance with ONE branch, and SEVERAL
    locations
2. Make a search in opac and staff interface : no location
    facet on the left side of the screen
3. apply the patch
4. Make the same search : location facets will be displayed

NOTE: I, Mark Tompsett, rebased this. I confirmed that 995$c
      should be 995$e (wiki, Holdings_data_fields_(9xx) page)
      Also note that the code relocated based on bug 10078,
      causing the patch to not apply.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: The location facet did not appear in master, but after
      applying the patch, it did appear.
      Because of the code being moved, it is no longer affected
      by the branch count or singleBranchMode.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes wrong subfield code for UNIMARC.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 81cc05cbd6ea31151a03989edd1ffb3f775c3582)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 12211: fix wrong home link in bootstrap public catalog login page

In bootstrap opac-auth.tt, the link to "Home" in breadcrumbs leads
to #, it should lead to opac-main.pl like in all other pages.

Test plan :
 - Use boostrap opac theme
 - Go to cgi-bin/koha/opac-user.pl when not logged
=> without patch, clicking on Home does not change the page
=> with patch, clicking on Home leads to opac-main.pl

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Link ok, no errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit c5de0df104c65289a04d7d16f5b56daa7667b13b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 12451 - circulation rule cant be edited if itemtype contains a space character

When an itemtype description contains a space character like " Book"
(often used to set this itemtype as first in sorted lists), the edition
of an existing circulation rule does not work, it selects the default
itemtype. Same for patron category.

It's because the JavaScript code performs a trim on value existing in
table itm = itm.replace(/^\s*|\s*$/g,''); This patch adds trim on select
options in editing line.

Test plan :
- Create an itemtype with a leading or trailling space in description :
  ie " Book"
- Go to cgi-bin/koha/admin/smart-rules.pl
- Create a rule with this itemtype, Unit=hours and Hard due date=Exactly
  on 31/12/2015 (any date)
- Click on Edit on this rule line
  => Without this patch, the default itemtype is selected in edition
     line
  => With this patch, the correct itemtype is selected in edition line

Check others selects are ok :
  - Create a rule with Unit=hours and Hard due date=Exactly on
    31/12/2015 (any date)
  - Click on Edit on this rule line
    => The correct options are selected
Same tests with a patron category containing a leading or trailling space in description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4b316bf85681fca76b45463b7152f2e34a018c55)
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&amp;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 <liz@catalyst.net.nz>
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.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described - no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 05ace0b38085a11fbdd7c031a8a251243544b564)