koha.git
2 years agoBug 22544: Move GetNewsToDisplay to Koha namespace
Josef Moravec [Wed, 20 Mar 2019 07:36:53 +0000 (07:36 +0000)]
Bug 22544: Move GetNewsToDisplay to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 22544: fix count call - to squash

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move add_opac_item to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:35:23 +0000 (10:35 +0000)]
Bug 22544: Move add_opac_item to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move upd_opac_new to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:30:27 +0000 (10:30 +0000)]
Bug 22544: Move upd_opac_new to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move del_opac_new to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:23:40 +0000 (10:23 +0000)]
Bug 22544: Move del_opac_new to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move get_opac_news to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:17:31 +0000 (10:17 +0000)]
Bug 22544: Move get_opac_news to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move get_opac_new to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 09:14:47 +0000 (09:14 +0000)]
Bug 22544: Move get_opac_new to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28597: Fetch the logged in branchcode for OpacSuggestioninstructions
Nick Clemens [Fri, 18 Jun 2021 13:09:29 +0000 (13:09 +0000)]
Bug 28597: Fetch the logged in branchcode for OpacSuggestioninstructions

To test:
 1 - Set two news items with location 'OpacSuggestioninstructions'
 2 - One should be for all libraries
 3 - One should be for a specific library
 4 - Sign in to opac with user from the specific library
 5 - Add a suggestion
 6 - The instructions only show the all libraries item
 7 - Apply patch
 8 - Reload
 9 - All libraries and specific library items are shown
10 - Allow anonymous suggestions:  AnonSuggestions - Allow
11 - Sign out of opac
12 - Add a suggestion
13 - Only all librares news is visible

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28455: Update wording on TrackLastPatronActivity
Andrew Fuerste-Henry [Thu, 3 Jun 2021 21:11:56 +0000 (21:11 +0000)]
Bug 28455: Update wording on TrackLastPatronActivity

This patch updates the wording on TrackLackPatronActivity to maintain the corrections from bug 28467 and also reflect the change made in this bug. It should now read: The first time each day that a patron either logs into the OPAC, connects to Koha via SIP, or checks an item out, borrowers.lastseen will update with the current date and time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled
Nick Clemens [Tue, 25 May 2021 18:20:25 +0000 (18:20 +0000)]
Bug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28611: Fix width to 50% for additem form elements
Jonathan Druart [Tue, 22 Jun 2021 09:46:55 +0000 (11:46 +0200)]
Bug 28611: Fix width to 50% for additem form elements

This patch suggests to set the width of select and input to 50%

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28299: Make buildKohaItemsNamespace accept Koha::Items
Tomas Cohen Arazi [Mon, 10 May 2021 08:01:02 +0000 (10:01 +0200)]
Bug 28299: Make buildKohaItemsNamespace accept Koha::Items

This patch makes buildKohaItemsNamespace (and its only caller,
XSLTParse4Display) accept a an optional Koha::Items resultset.

This way we don't need to calculate (from the DB) the list of hidden
itemnumbers, but solve it in one query.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28299: Take OpacHiddenItems into account on opac-shelves
Jonathan Druart [Fri, 7 May 2021 09:16:17 +0000 (11:16 +0200)]
Bug 28299: Take OpacHiddenItems into account on opac-shelves

hidden_items was not passed to XSLTParse4Display

2 things:
* Should we hide the biblio record if OpacHiddenItemsHidesRecord is set?
* allow_onshelf_holds is not working like in other scripts, what's the
expected behaviour? If hidden should we completely ignore the item?

Test plan:
1. Without the patch
2. fill OpacHiddenItems with «damaged: [1]»
3. find a record with several item
4. mark one of them as damaged
5. OPAC: go to the record, you shouldn't see the damaged item
6. add the record to a list
7. see the list
8. in Availability you see the damaged item mentioned, this is the issue
9. apply the patches and restart the services
10. the list should not mention the damaged item :D

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28299: Unit tests for buildKohaItemsNamespace
Tomas Cohen Arazi [Mon, 10 May 2021 14:17:57 +0000 (11:17 -0300)]
Bug 28299: Unit tests for buildKohaItemsNamespace

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28462: Remove line breaks in TT tags
Jonathan Druart [Wed, 23 Jun 2021 07:50:55 +0000 (09:50 +0200)]
Bug 28462: Remove line breaks in TT tags

Same as previous patch for other files.
Looks like the problem exists only with IF.

== test plan ==
1. See the problematic strings in a given language
     git grep "\bIF\b" misc/translator/po | grep -v '#' | grep '\bzh-Hant-TW'
2. update the language
   misc/translator/translate update zh-Hant-TW
3. Recheck the problematic strings, they aren't here anymore
4. Check the diff: git diff
   and search the if's with «/-.* IF » to see how the deleted strings
   look like and that it makes sense.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28462: Remove TT tag on several lines - opac-advsearch.tt
Jonathan Druart [Wed, 26 May 2021 14:24:32 +0000 (16:24 +0200)]
Bug 28462: Remove TT tag on several lines - opac-advsearch.tt

It fixes the translation in case the operators have been translated

Test plan:
1. misc/translator/translate update pt-BR
2. In pt-BR-opac-bootstrap.po , find OpacAdvSearchMoreOptions
3. sabotage the translation part, like replacing IF with something else
4. misc/translator/translate install pt-BR
5. enable and use pt-BR and hit opac-advsearch.pl
6. Notice the error
   Template process failed: file error - parse error - /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/pt-BR/modules/opac-advsearch.tt line 409: unexpected token (e)                                                    [% IF (OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size> 0 e extended_options) ou (OpacAdvSearchOptions and OpacAdvSearchOptions.size> 0 e n expandido_options) %] at /kohadevbox/koha/C4/Templates.pm
7. Apply the patch and redo update and install of the language
8. Note that it's now working

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28524: Escape 'rank' in cat_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 12:51:08 +0000 (14:51 +0200)]
Bug 28524: Escape 'rank' in cat_issues_top.pl

It's a MySQL 8 keyword

Test plan:
Turn off strict_sql_modes (there are other problems in this script)
Hit Home Reports > Most-circulated items
Submit the form

Without this patch you got:
  You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'RANK, biblio.biblionumber AS ID, itemcallnumber as CALLNUM,
  ccode as CCODE, loca' at line 1

With this patch applied you see the report result view

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28523: Escape 'rank' in bor_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 12:54:47 +0000 (14:54 +0200)]
Bug 28523: Escape 'rank' in bor_issues_top.pl

It's a MySQL 8 keyword

Test plan:
Turn off strict_sql_modes (there are other problems in this script)
Hit Home Reports > Patrons with the most checkouts
Submit the form

Without this patch you got:
    You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to
    use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues`

With this patch applied you see the report result view

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28409: Adjust regression test
Jonathan Druart [Thu, 24 Jun 2021 07:55:23 +0000 (09:55 +0200)]
Bug 28409: Adjust regression test

We are no longer expecting an URI escaped value but a corrected category
value, either 1 or 2.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28409: Simplify data validation
Jonathan Druart [Fri, 21 May 2021 07:09:53 +0000 (09:09 +0200)]
Bug 28409: Simplify data validation

Simplify the affectation then trust it.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
JD Amended patch: remove duplicate comma

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28409: Comprehensively validate category in opac-shelves.pl
David Cook [Fri, 21 May 2021 06:52:25 +0000 (06:52 +0000)]
Bug 28409: Comprehensively validate category in opac-shelves.pl

Default to a category of 1 (ie Private). Only allow input of 1
or 2 (ie Public)

== Test plan ==
1. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?category=function(){window.location.href%20=%20%27https://git.koha-community.org/stats/koha-master/authors.html%27}()
2. Note that you are redirected to another website
3. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?op=add&shelfname=foo&category=9
4. Note that you can't see this list in the Lists (but it has been added to the database)
5. Apply the patch & restart services
6. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?category=function(){window.location.href%20=%20%27https://git.koha-community.org/stats/koha-master/authors.html%27}()
7. Note that you are not redirected to another website
8. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?op=add&shelfname=bar&category=9
9. Note that "bar" has been added as a Private list

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28615: (follow-up) Disable strict mode explicitly
Tomas Cohen Arazi [Tue, 29 Jun 2021 15:24:52 +0000 (12:24 -0300)]
Bug 28615: (follow-up) Disable strict mode explicitly

So Debian 9's version of Test::MockModule doens't have ->redefine, and
Ubuntu 20.04's doesn't recognise qw(nostrict). So the only solution is
to just remove the keywords use completely and move back to using
->mock, as the rest of the codebase.

FIXME: using ->mock might be hiding some errors (like a method not being
defined/removed) and should be avoided. ->redefine will explode if the
method doesn't already exist, which is what we want, to catch this kind
of errors. That's why ->mock in strict mode is forbidden. We should try
packaging a newer Test::MockModule ourselves.

Tested on master-buster, master-stretch and master-focal.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28615: (follow-up) Newer Test::MockModule forbid ->mock
Tomas Cohen Arazi [Tue, 29 Jun 2021 14:18:12 +0000 (11:18 -0300)]
Bug 28615: (follow-up) Newer Test::MockModule forbid ->mock

In strict mode, ->mock is forbidden and ->redefine needs to be used
instead. I tested this on buster to see if it breaks something, but it
doesn't.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28615: Fix t/Auth_with_shibboleth.t
Tomas Cohen Arazi [Mon, 28 Jun 2021 18:28:49 +0000 (15:28 -0300)]
Bug 28615: Fix t/Auth_with_shibboleth.t

This patch makes t/Auth_with_shibboleth.t use the new
t::lib::Mocks::Logger tools

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28615: Add a simple way to mock Koha::Logger
Tomas Cohen Arazi [Mon, 28 Jun 2021 18:22:33 +0000 (15:22 -0300)]
Bug 28615: Add a simple way to mock Koha::Logger

This patch introduces a new way to mock and test Koha::Logger.

As the POD says, it is used by calling

    my $logger = t::lib::Mocks::Logger->new();

It then provides convenient methods for testing the logging itself per
log-level:

* warn_is
* warn_like
* debug_is
* debug_like
...

Methods for counting the logging activity and also for clearing the mock
buffer are provided as well. This is covered in the POD and also on the
follow-up, that makes use of this to fix Auth_with_shibboleth.t

To test:

1. Run:
   $ kshell
  k$ prove t/Auth_with_shibboleth.t
=> FAIL: Tests fail! It expects some warns but they are not returned by
the lib
2. Apply this patches
3. Repeat 1
=> SUCCESS: Tests pass! The tests now use the new lib, and they
correctly find the logging Auth_with_shibboleth.pm does on function
calls.
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
3 years agoBug 28571: Remove C4::Auth::_session_log
Jonathan Druart [Wed, 16 Jun 2021 13:28:01 +0000 (15:28 +0200)]
Bug 28571: Remove C4::Auth::_session_log

It's not used and must be removed

Test plan:
  % git grep _session_log
must not return any result.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28606: Remove $DEBUG and $ENV{DEBUG}
Jonathan Druart [Tue, 22 Jun 2021 10:54:15 +0000 (12:54 +0200)]
Bug 28606: Remove $DEBUG and $ENV{DEBUG}

We should remove the debug statements or use Koha::Logger when we want
to keep it.

Test plan:
Confirm that occurrences of remaining occurrences of DEBUG need to be
kept (historical scripts for instance)
Confirm that the occurrences removed by this patch can be removed
Confirm that the occurrences replaced by Koha::Logger are correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks good to me, noting a few minor points on BZ.

JD amended patch: replace "warn #Finished" with "#warn Finished", and
put the statement on a single line

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28601: Fix 'Home' breadcrumd on circulation-home.pl
Nick Clemens [Fri, 18 Jun 2021 15:45:42 +0000 (15:45 +0000)]
Bug 28601: Fix 'Home' breadcrumd on circulation-home.pl

To test:
1 - Got to 'Circulation'
2 - Click 'Home' in breadcrumbs
3 - You are still in circulation home
4 - Apply patch
5 - reload page
6 - Click 'Home'
7 - Success!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28600: (bug 18989 follow-up) Resolve variable scope issue
Tomas Cohen Arazi [Fri, 18 Jun 2021 18:20:30 +0000 (15:20 -0300)]
Bug 28600: (bug 18989 follow-up) Resolve variable scope issue

This patch fixes a scope issue. Originally, a variable declared as

our $borcat

was replaced by

my $patron

This patch makes the method not rely on global variables, but have a
parameter for the patron, and thus things are clearer.

To test:
1. Open the OPAC detail page for a record
=> FAIL: The logs show some errors about the $patron variable not
available in the scope
2. Apply this patch
3. Repeat 1
=> SUCCESS: No errors
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28588: (follow-up) Make the API use the new method
Tomas Cohen Arazi [Fri, 18 Jun 2021 19:34:00 +0000 (16:34 -0300)]
Bug 28588: (follow-up) Make the API use the new method

This patch adapts the controller method for resolving a return claim so
it uses the Koha::Checkouts::ReturnClaim method instead.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28588: Add Koha::Checkouts::ReturnClaim->resolve
Tomas Cohen Arazi [Fri, 18 Jun 2021 19:15:15 +0000 (16:15 -0300)]
Bug 28588: Add Koha::Checkouts::ReturnClaim->resolve

This patch introduces a high-level method for resolving claims.
The behavior intends to replace the code in the API controller that is
used for resolving a claim.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> SUCCESS: Tests pass
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28588: Unit tests
Tomas Cohen Arazi [Fri, 18 Jun 2021 19:14:43 +0000 (16:14 -0300)]
Bug 28588: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output
Tomas Cohen Arazi [Fri, 18 Jun 2021 21:32:37 +0000 (18:32 -0300)]
Bug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output

This patch fixes a double-encoding issue with MiJ output.

Mojolicious' *text* renderer encodes the passed information according to
the request context. [1]

MARC::Record::MiJ->to_mij, conveniently encodes the string before
output [2].

This causes double encoding.

So the solution to this situation, is to use the *data* renderer, which
doesn't perform any encoding [3].

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests contain diacritics and fail!
3. Have a record with diacritics
4. Try the API routes for fetching a biblio:
   $ curl --location --request GET 'http://localhost:8080/api/v1/public/biblios/144' \
          --header 'Accept: application/marc-in-json'
   (replace the record id with the one you've chosen)
=> FAIL: Boo, double encoding
5. Bonus point: you can try it on the non-public route, but you need
   more configuration boilerplate (basic auth, permissions). If you look
   at the fix, you will understand the tests cover it and no need to
   complicate yourself.
6. Apply this patch
7. Repeat 2
=> SUCCESS: Tests pass!
8. Repeat 4 (and maybe 5)
=> SUCCESS: No double encoding! Yay!
9. Sign off :-D

[1] https://metacpan.org/release/MRAMBERG/Convos-0.5/view/local/lib/perl5/Mojolicious/Guides/Rendering.pod#Rendering-text
[2] https://metacpan.org/dist/MARC-File-MiJ/source/lib/MARC/Record/MiJ.pm#L111
[3] https://metacpan.org/release/MRAMBERG/Convos-0.5/view/local/lib/perl5/Mojolicious/Guides/Rendering.pod#Rendering-data

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28604: Regression tests
Tomas Cohen Arazi [Fri, 18 Jun 2021 21:30:56 +0000 (18:30 -0300)]
Bug 28604: Regression tests

This patch introduces regression tests for the encoding issue with MiJ
output.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28480: (QA follow-up) Add unit test
Nick Clemens [Fri, 11 Jun 2021 18:02:11 +0000 (18:02 +0000)]
Bug 28480: (QA follow-up) Add unit test

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28480: Add q parameters for GET /patrons
Tomas Cohen Arazi [Fri, 28 May 2021 11:34:29 +0000 (08:34 -0300)]
Bug 28480: Add q parameters for GET /patrons

This patch adds the q query parameters to the route.

To test:
1. Try the route with the following query parameter:
   q={"patron_id":2}
   i.e. GET /api/v1/patrons?q={"patron_id":2}
=> FAIL: You get a bad request respose
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: You get the patron
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28581: (QA follow-up) Fix method on unblessed reference
Marcel de Rooy [Mon, 21 Jun 2021 08:47:59 +0000 (08:47 +0000)]
Bug 28581: (QA follow-up) Fix method on unblessed reference

Speaks for itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28581: Enhance POD for EnqueueLetter
Martin Renvoize [Thu, 17 Jun 2021 13:47:07 +0000 (14:47 +0100)]
Bug 28581: Enhance POD for EnqueueLetter

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28581: Use 'from_email_address' where appropriate
Martin Renvoize [Thu, 17 Jun 2021 13:30:59 +0000 (14:30 +0100)]
Bug 28581: Use 'from_email_address' where appropriate

This patch replaces a few more trivial cases where we were using
library->branchemail with a fallback to KohaAdminEmail to just use the
new library->from_email_address method directly instead.

There were also a couple of cases where we were passing borrowernumber
and the patrons library from address too.. this is unneccesary as the
code in _send_email_massage will already default to patron library from
address if we do not pass an override.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added a semicolon.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28581: (QA follow-up) Prevent code failure
Martin Renvoize [Thu, 17 Jun 2021 13:12:23 +0000 (14:12 +0100)]
Bug 28581: (QA follow-up) Prevent code failure

This patch prevents a fatal error when both $params->{from} and
$params->{borrowernumber} are undefined. We fallback to
KohaAdminEmailAddress before finally falling through to setting a
failure status for the message if that last fallback is not found.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28581: Use from_email_address in the codebase
Marcel de Rooy [Thu, 17 Jun 2021 09:59:18 +0000 (09:59 +0000)]
Bug 28581: Use from_email_address in the codebase

Adding only a few (trivial) cases now. Changes in C4::Letters
are not trivial after all..
We now add the KohaAdminEmail fallback implicitly when the from
address was still empty. The extra check makes us not rely on
a do or die action in Email::Stuffer.

Test plan:
Run password recovery or membership expiry cron.
Check sender address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28581: Add 'from_email_address' method and use in Koha::Patron
Martin Renvoize [Thu, 17 Jun 2021 08:54:46 +0000 (09:54 +0100)]
Bug 28581: Add 'from_email_address' method and use in Koha::Patron

This patch adds a new 'from_email_address' method to Koha::Library to
return the appropriate email address to use as the 'from' field for
email notices from the library.

We then update Koha::Patron->queue_notice to use this new method instead
of the incorrect inbound_email_address.

I also update the POD for inbound_email_address to clarify it's use
case.

Test plan

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26205: DBRev 21.06.00.005
Jonathan Druart [Wed, 23 Jun 2021 13:08:36 +0000 (13:08 +0000)]
Bug 26205: DBRev 21.06.00.005

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26205: (QA follow-up) Add punctuation and widen pref description a bit
Katrin Fischer [Tue, 1 Jun 2021 08:16:52 +0000 (08:16 +0000)]
Bug 26205: (QA follow-up) Add punctuation and widen pref description a bit

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26205: (QA follow-up) Change OPACNEWS to just NEWS
Katrin Fischer [Tue, 1 Jun 2021 08:15:49 +0000 (08:15 +0000)]
Bug 26205: (QA follow-up) Change OPACNEWS to just NEWS

As news are usable in OPAC and staff interface, I suggest changing the code
to just be NEWS instead of OPACNEWS.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26205: (QA follow-up) Capitalization: OPAC News
Katrin Fischer [Tue, 1 Jun 2021 08:13:11 +0000 (08:13 +0000)]
Bug 26205: (QA follow-up) Capitalization: OPAC News

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26205: Add logging of news items
Lucas Gass [Wed, 12 May 2021 18:20:16 +0000 (18:20 +0000)]
Bug 26205: Add logging of news items

To test:

1. Apply patch, updatedatabase, restart_all
2. Make sure the system pref 'NewsLog' is turned on.
3. Go to the Koha News tool and create a new news item.
4. View the logs and display only the OPAC News module
5. You should see your new news, it will include the lang (
   OPACheader_en ) and the content of the news item.
6. Filter the logs so the only action is 'Add', your new news item
   should appear
7. Modify some news items
8. They should appear in the logs now as modification.
9. Make sure you can filter the action to 'Modify' and can confirm it
   works
10. Delete some news items
11. They should appear in the logs now as deletinon
12. Make sure you can filter the action to 'Delete' and can confirm it
    works

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28516: Prevent failures if borrower_attribute_types.mandatory=1
Jonathan Druart [Fri, 4 Jun 2021 13:36:59 +0000 (15:36 +0200)]
Bug 28516: Prevent failures if borrower_attribute_types.mandatory=1

TestBuilder will generate an integer for the
Koha::Patron::Attribute::Type object, but if 1 is picked some tests are
failing randomly
At least t/db_dependent/Koha/Patrons.t and t/db_dependent/Koha/Patrons/Import.t
The expection "Missing mandatory extended attribute" is raised when the
patron is stored.

Test plan:
The following script should return 0 when the patch is applied:

"""
use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;
my $x = $builder->build_object(
    {
        class => 'Koha::Patron::Attribute::Types',
    }
);
say $x->mandatory;
"""

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28616: (bug 28220 follow-up) Replace Data::Printer with simple warn
Jonathan Druart [Wed, 23 Jun 2021 07:40:36 +0000 (09:40 +0200)]
Bug 28616: (bug 28220 follow-up) Replace Data::Printer with simple warn

$_ is an exception that will be stringify in scalar context. We don't
need Data::Printer here.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28572: Set missing __LOG_DIR__ variable in zebra_config.pl
Tomas Cohen Arazi [Tue, 22 Jun 2021 19:14:16 +0000 (16:14 -0300)]
Bug 28572: Set missing __LOG_DIR__ variable in zebra_config.pl

This patch makes zebra_config.pl create a temporary directory for logs
and sets it in ENV so, when called, rewrite-config.PL sets it correctly.

It also adds the new syspref Reference_NFL_Statuses to the big mock to
silence many warnings introduced by bug 21260.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28572: Fix Search.t
Jonathan Druart [Tue, 22 Jun 2021 14:57:50 +0000 (16:57 +0200)]
Bug 28572: Fix Search.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28572: Fix misc/admin/koha-preferences
Jonathan Druart [Tue, 22 Jun 2021 14:57:29 +0000 (16:57 +0200)]
Bug 28572: Fix misc/admin/koha-preferences

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28598: Update DateFormat and TimeFormat descriptions to remove warnings
Andrew Fuerste-Henry [Fri, 18 Jun 2021 13:15:34 +0000 (13:15 +0000)]
Bug 28598: Update DateFormat and TimeFormat descriptions to remove warnings

To test, confirm that the warnings are present without the patch and gone with it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28572: Remove C4::Debug
Jonathan Druart [Fri, 18 Jun 2021 09:25:16 +0000 (11:25 +0200)]
Bug 28572: Remove C4::Debug

We are using Koha::Logger when it makes sense to keep the info,
otherwise we simply remove it

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 28572: Replace missing occurrence in misc/admin/koha-preferences

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28591: Don't pass debug to get_template_and_user
Jonathan Druart [Fri, 18 Jun 2021 09:34:54 +0000 (11:34 +0200)]
Bug 28591: Don't pass debug to get_template_and_user

There is a "debug" parameter we are passing from the controller scripts
to C4::Auth::get_template_and_user, but it's not actually used!

Test plan:
Confirm the assumption
Review the changes from this patch

Generated with:
perl -p -i -e 's#\s*debug\s*=\>\s*(0|1),?\s*##gms' **/*.pl

git checkout misc/devel/update_dbix_class_files.pl # Wrong catch
+ Manual fix in acqui/neworderempty.pl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28590: Remove get_shelves_userenv and set_shelves_userenv
Jonathan Druart [Fri, 18 Jun 2021 08:27:01 +0000 (10:27 +0200)]
Bug 28590: Remove get_shelves_userenv and set_shelves_userenv

They are no longer used since bug 7310, now we are using
Koha::Virtualshelves->get_some_shelves

Test plan:
Create some lists, login at the OPAC and confirm that you see
the list in the navbar (top)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28570: Remove log to /tmp file from bor_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 13:24:31 +0000 (15:24 +0200)]
Bug 28570: Remove log to /tmp file from bor_issues_top.pl

This is unusual and must not be done.
Removing it.

Test plan:
Use the "Home > Reports > Patrons with the most checkouts" report and
confirm that it is working correctly after you applied this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28514: Set lang to default is not passed
Jonathan Druart [Tue, 22 Jun 2021 09:57:00 +0000 (11:57 +0200)]
Bug 28514: Set lang to default is not passed

It fixes the following test:
    #   Failed test 'no lang passed, default is returned'
    #   at t/db_dependent/Koha/Notices.t line 105.
    #          got: 'es-ES'
    #     expected: 'default'
    # Looks like you failed 1 test of 7.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28242: added captions to tables and legends to forms
Wainui Witika-Park [Sun, 2 May 2021 09:52:18 +0000 (09:52 +0000)]
Bug 28242: added captions to tables and legends to forms

Ensured that in the OPAC, all tables have relevant captions and all forms have relevant legends.

Many of these have class="sr-only" so they are not visible but will be
available for people who use screen-readers.

To test:
1) Go to OPAC
2) Apply patch and dependencies
3) Check that on all pages, any tables have a caption (many of them will
    not be visible, but will be in the markup code)
4) Check that on all pages, any forms have a legend (many of them will
    not be visible, but will be in the markup code)
5) Check that the captions are appropriate and relevant
6) Check that the legends are appropriate and relevant

Sponsored-by: Catalyst IT
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28563: (QA follow-up) Fix unit test
Katrin Fischer [Mon, 14 Jun 2021 19:24:42 +0000 (19:24 +0000)]
Bug 28563: (QA follow-up) Fix unit test

Add the new preference to the UsageStats.t

To test:
- Run t/db_dependent/UsageStats.t
- Watch it pass :)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28563: Add AllowHoldItemTypeSelection to HEA
Tomas Cohen Arazi [Mon, 14 Jun 2021 15:26:20 +0000 (12:26 -0300)]
Bug 28563: Add AllowHoldItemTypeSelection to HEA

This patch adds the mentioned syspref to the sysprefs list, shared for
statistical purposes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28508: Use "Invoice number" instead of "Invoice no" on the invoice search filter
Owen Leonard [Wed, 9 Jun 2021 10:59:31 +0000 (10:59 +0000)]
Bug 28508: Use "Invoice number" instead of "Invoice no" on the invoice search filter

This patch corrects instances of the abbreviated phrase "Invoice no."
from the templates, making it "Invoice number." Also corrected: An
instance of "Bookseller" is replaced with "Vendor."

To test, apply the patch and confirm that the phrase is correct in these
cases:

- Acquisitions -> Invoices: Check the "Search filters" form in the
  left-hand sidebar.
  -> View an invoice: Check the label in the form.
- Acquisitions -> Vendor -> Receive shipments: Check the table of
  invoices.
- Acquisitions -> Orders search (in the search header) -> Advanced
  search: Check the labels in the form.

Signed-off-by: Salman Ali <salman.ali@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Note: I fixed Salman's SO line

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28418: Show template_id of MARC modification templates
Owen Leonard [Fri, 21 May 2021 18:10:14 +0000 (18:10 +0000)]
Bug 28418: Show template_id of MARC modification templates

This patch adds an "id" column to the table of MARC modification
templates. The table is now a DataTable with table settings, with the
new column hidden by default to preserve the existing configuration.

To test, apply the patch and restart services.

 - Go to Administration -> MARC modification templates.
 - If necessary, add two or more templates.
 - Confirm that table of templates displays as a DataTable, with all
   associated sorting, filtering, export, etc.
 - The "id" column should be hidden by default.
 - Confirm that column visibility controls work correctly.
 - Confirm that the table settings found under Administration -> Table
   settings work correctly to set the default visibility of the table
   columns.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27882: Move external search results links out of page heading
Owen Leonard [Fri, 5 Mar 2021 15:19:40 +0000 (15:19 +0000)]
Bug 27882: Move external search results links out of page heading

This patch modifies the JavaScript which adds search result information
to the OPAC search results page which is returned from OverDrive,
Recorded Books, or Open Library. The information now displays below the
page heading instead of inside it.

To test you must have OpenLibrarySearch enabled, OverDrive-related
preferences populated (OverDriveClientKey, OverDriveClientSecret,
OverDriveLibraryID), or RecordedBooks preferences (RecordedBooksClientSecret,
RecordedBooksDomain, RecordedBooksLibraryID).

This patch was written with OverDrive and Open Library results active.

- Apply the patch and perform a search in the OPAC catalog.
- On the search results page you should see results for your external
  services appear below the page heading ("You search returned..."),
  e.g.

  "Found 20257 results in the library's OpenLibrary collection"
  "Found 337 results in the library's OverDrive collection"

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27498: (follow-up) Update to display logic
Katrin Fischer [Sun, 21 Mar 2021 13:11:25 +0000 (13:11 +0000)]
Bug 27498: (follow-up) Update to display logic

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27498: Add a link for the Hold Ratios to Acquisitions home page
Owen Leonard [Wed, 3 Feb 2021 12:04:31 +0000 (12:04 +0000)]
Bug 27498: Add a link for the Hold Ratios to Acquisitions home page

This patch adds a link to the hold ratios report in the Acquisitions
sidebar menu under the "reports" heading.

To test, apply the patch and go to Acquisitions. The link to the hold
ratios report should be there and it should work correctly.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26838: Compiled CSS changes
Jonathan Druart [Mon, 21 Jun 2021 11:55:58 +0000 (13:55 +0200)]
Bug 26838: Compiled CSS changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26838: Improve styling of checkin message
Owen Leonard [Fri, 30 Oct 2020 12:33:54 +0000 (12:33 +0000)]
Bug 26838: Improve styling of checkin message

This patch makes some changes to the style and use of the "problem"
class in the staff interface:

- Remove the background color
- Remove the extra line height

Some changes to the template:

 - Remove the problem class from the checkin message. The checkin
   message configuration determines whether the dialog is an alert or a
   message-style dialog.
 - Add Font Awesome icons to the "problem" messages in patron details
   and serials collection. This is to help emphasize the message for
   users  who might have difficulty seeing the color difference.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - Go to Administration -> Item types and configure a checkin message
   for an item type: Add a message and select "Message" as the checkin
   message type.
 - Check in an item with that item type and confirm that you see the
   checkin message. It should be displayed in a message-style dialog
   without any additional styling.
 - Change the item type configuration to use "Alert" as the checkin
   message type. Confirm that the correct style is shown in this case as
   well.

 - Locate a patron with a NULL value in borrowers.password. View the
   detail page for that patron.
 - Under the "Library use" heading, the "Password" line should contain a
   link with the text "Undefined," preceded by a red-colored Font
   Awesome  icon.

 - In Serials, locate a subscription which is expired.
 - View the details for the subscription, and then open "serial
   collection" from the sidebar menu.
 - On the serial collection page there should be a cell in the
   subscription summary table showing the message "Subscription expired"
   preceded by a red-colored Font Awesome icon.

Signed-off-by: Salman Ali <salman.ali@inLibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 8280: Add koha set and item fields to pqf.properties
Nick Clemens [Fri, 11 Jun 2021 12:15:35 +0000 (12:15 +0000)]
Bug 8280: Add koha set and item fields to pqf.properties

This patch adds a 'koha' set to the pqf properties and maps some basic
koha fields to all for searchign

To test:
1 - Apply patch
2 - cp etc/z3950/pqf.properties /etc/koha/sites/kohadev/z3950/pqf.properties
3 - sudo koha-z3950-responder --restart kohadev
4 - Test a search:
    curl -XGET "http://localhost:2100/biblios?version=1.1&operation=searchRetrieve&query=koha.itemtype=BK&maximumRecords=60&recordSchema=marcxml"
5 - Test other fields added:
    koha.withdrawn
    koha.lost
    koha.classification-source
    koha.materials-specified
    koha.damaged
    koha.restricted
    koha.cn-sort
    koha.notforloan
    koha.ccode
    koha.itemnumber
    koha.homebranch
    koha.holdingbranch
    koha.location
    koha.barcode
    koha.onloan
    koha.itemtype

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Copied the changes from z3950 to zebradb too.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 8280: Sync whitespace differences between pqf config files
Marcel de Rooy [Fri, 18 Jun 2021 06:48:38 +0000 (06:48 +0000)]
Bug 8280: Sync whitespace differences between pqf config files

Test plan:
Diff etc/zebradb/pqf.properties with the etc/z3950 one.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27600: Remove password check from `add_hold`
Martin Renvoize [Mon, 10 May 2021 15:30:31 +0000 (16:30 +0100)]
Bug 27600: Remove password check from `add_hold`

As suggested in the bugzilla comments, the add_hold method also
doesn't require the password checking code.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27600: Remove password check from `cancel_hold`
Martin Renvoize [Mon, 10 May 2021 15:09:17 +0000 (16:09 +0100)]
Bug 27600: Remove password check from `cancel_hold`

As suggested in the bugzilla comments, the cancel_hold method also
doesn't require the password checking code.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27600: Remove password check from SIP2 `renew_all`
Martin Renvoize [Wed, 3 Feb 2021 10:03:31 +0000 (10:03 +0000)]
Bug 27600: Remove password check from SIP2 `renew_all`

This patch removes the password check code from the renew_all method for
SIP2. This is required, as many units send an empty AD field in the SIP
message which can cause the transaction to fail.. but the authentication
should have already taken place earlier in the session.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27600: Add unit test
Martin Renvoize [Wed, 3 Feb 2021 10:16:30 +0000 (10:16 +0000)]
Bug 27600: Add unit test

This patch adds a basic unit test to catch the case where patron_pwd is
sent to renew_all as an empty string.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it fail
2/ Apply second patch
3/ Re-run the above test and watch it pass.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15788: DBRev 21.06.00.004
Jonathan Druart [Mon, 21 Jun 2021 11:56:17 +0000 (11:56 +0000)]
Bug 15788: DBRev 21.06.00.004

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15788: Make the API require the new permission
Tomas Cohen Arazi [Sat, 12 Jun 2021 13:55:22 +0000 (10:55 -0300)]
Bug 15788: Make the API require the new permission

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15788: (QA follow-up) Simplify query in update
Tomas Cohen Arazi [Sat, 12 Jun 2021 13:43:09 +0000 (10:43 -0300)]
Bug 15788: (QA follow-up) Simplify query in update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15788: Use delete_borrowers permission
Martin Renvoize [Tue, 12 Jan 2021 14:24:41 +0000 (14:24 +0000)]
Bug 15788: Use delete_borrowers permission

Link the new delete_borrowers sub-permission to the delete actions.

Test plan
1/ Remove the delete_borrowers permission from a staff user
2/ Check that the user cannot use the 'Delete' option from the members
menu.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15788: Add delete_borrowers permission
Martin Renvoize [Tue, 12 Jan 2021 14:06:45 +0000 (14:06 +0000)]
Bug 15788: Add delete_borrowers permission

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28514: Remove getletter
Jonathan Druart [Thu, 3 Jun 2021 11:01:43 +0000 (13:01 +0200)]
Bug 28514: Remove getletter

The way we handle notice templates is confusing (see bug 27660, bug 26787, bug 28487).

This patch remove C4::Letters::getletter and use either Koha::Notice::Templates->find
or the newly created methods ->find_effective_template that will do
all necessary to return the correct template.

Test plan:
- Create and modify notice templates
- Make sure you have TranslateNotices turned on and that some notices
templates have a translated version
- Use holds_reminder.pl and overdue_notices.pl cronjobs and confirm that
the generated notices are the expected ones
- Test also pos/printreceipt.pl
- And finally test some other notices (CHECKIN, RENEWAL for instance)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Amended by removing comment for $params={%$params}

JD amended patch:
* Add missing POD
* Fix spelling (dont  ==> don't)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28264: (QA follow-up) Impliment fix for debit_type_code
Martin Renvoize [Tue, 11 May 2021 08:39:42 +0000 (09:39 +0100)]
Bug 28264: (QA follow-up) Impliment fix for debit_type_code

The fix for the debit_type line was also missing.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28264: Transaction type is empty is cash register statistics wizard report
Ivan Dziuba [Thu, 6 May 2021 19:33:02 +0000 (15:33 -0400)]
Bug 28264: Transaction type is empty is cash register statistics wizard report

To test:
1) Go into a patron file and add some manual fees and pay them
2) Go to Reports > Statistics wizards > Cash register
3) In the form, choose Transaction type: All transactions
4) Click "Submit"
5) Note that the Transaction type column is empty
6) In the form, choose Output: To a file
7) Click "Submit"
8) Open the file in a spreadsheet software (I use LibreOffice)
9) The Transaction type column IS NOT empty

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26860: facets.inc refactor availability facet
Fridolin Somers [Tue, 27 Oct 2020 10:48:30 +0000 (11:48 +0100)]
Bug 26860: facets.inc refactor availability facet

To prepare new facet, this patch refactors the availability facet,
without any change in restult.
Appart from an id 'facet-availability', like other facets.

Test plan:
1) Perform a search in staff interface
2) Check availability facet displays well
3) Click on it
4) Check availability facet displays well

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12169: Fix SIPconfig.xml, restore missing end tag
Kyle M Hall [Fri, 7 May 2021 15:16:54 +0000 (11:16 -0400)]
Bug 12169: Fix SIPconfig.xml, restore missing end tag

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12169: Use pid file in sipserver shutdown
Colin Campbell [Thu, 1 May 2014 14:17:44 +0000 (15:17 +0100)]
Bug 12169: Use pid file in sipserver shutdown

Change sample SIPConfig to request server writes a pid file

Use this pid in shutdown rather than the current open to error
method.

Have also added to the Config parameters to ensure that the sipserver
runs as the correct user and sets its own session id. These are always
useful but makes it easier for users to run up the sipserver as root at
boot time similarly to apache, mysql etc

Added to the sample config where to locate other server parameter
documentation.

Removed from the sample config the unedifying, unwanted and
purely historical http example

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27348: Fix test on ALTERNATE_INDEXER_DAEMON in koha-indexer
Jonathan Druart [Thu, 7 Jan 2021 09:55:35 +0000 (10:55 +0100)]
Bug 27348: Fix test on ALTERNATE_INDEXER_DAEMON in koha-indexer

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27348: Fix test on INDEXER_PARAMS in koha-indexer
David Cook [Thu, 7 Jan 2021 00:22:03 +0000 (00:22 +0000)]
Bug 27348: Fix test on INDEXER_PARAMS in koha-indexer

koha-indexer doesn't test INDEXER_PARAMS correctly which causes errors
to display when stopping/starting the daemon.

This patch fixes the test so that the variable is tested as a string,
so that no errors are created and the params are passed correctly.

Test plan:
0. Apply patch
1. vi /etc/default/koha-common
2. Add the following to the bottom of the file:
INDEXER_PARAMS="-daemon -sleep 6"
3. cp debian/scripts/koha-indexer /usr/sbin/koha-indexer
4. koha-indexer --stop kohadev
5. Note no errors
6. koha-indexer --start kohadev
7. Note no errors
8. ps -efww | grep "indexer"
9. Note that rebuild_zebra.pl has the arguments "-daemon -sleep 6"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28443: Terminology: Issuing should be Checking out
Owen Leonard [Mon, 7 Jun 2021 16:36:20 +0000 (16:36 +0000)]
Bug 28443: Terminology: Issuing should be Checking out

This patch modifies the title element of the batch checkout page so that
it uses the phrase "Batch check out" instead of "Issuing."

To test, apply the patch and enable BatchCheckouts system preference.

- Open a patron for checkout who has a category included in the
  BatchCheckoutsValidCategories system preference.
- Click the "Batch check out" tab and confirm that the page's title is
  correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28428: Capitalization: Password Updated
Owen Leonard [Mon, 24 May 2021 10:58:00 +0000 (10:58 +0000)]
Bug 28428: Capitalization: Password Updated

This patch corrects the case of two headings on the "Change password"
page in the staff interface.

As far as I can tell these strings are never seen because the page
redirects to the patron detail page instead of redisplaying after a new
password or username is submitted.

A visual inspection of the patch may be the only test.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28476: Update info in docs/teams.yaml file
Mason James [Sun, 6 Dec 2020 05:33:58 +0000 (18:33 +1300)]
Bug 28476: Update info in docs/teams.yaml file

to test...
 1/ apply patch
 2/ view 'about' page to confirm info is updated

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Looks good.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 28476: Update info in docs/teams.yaml file (2)

oops, correct info

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28280: itemtype page, add price formatting
Didier Gautheron [Tue, 4 May 2021 07:15:52 +0000 (09:15 +0200)]
Bug 28280: itemtype page, add price formatting

To Test:
1- create an item type with a 'Default replacement cost' and a
'Processing fee (when lost)'
2- numbers are displayed with 6 decimals.
4- apply patch
5- numbers are displayed with 2 decimals.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28522: Correct eslint errors in staff-global.js
Owen Leonard [Mon, 7 Jun 2021 12:26:02 +0000 (12:26 +0000)]
Bug 28522: Correct eslint errors in staff-global.js

This patch makes minor corrections to staff-global.js in order to quiet
warnings from ESLint. This includes:

- Remove unused variables
- Declare undeclared variables
- Update list of global and exported variables and functions
- Correct whitespace
- Remove an unused function (paramOfUrl)

To test, apply the patch and clear your browser cache if necessary.

- Confirm that the first search header form field has focus when
  switching bewteen pages.
- Confirm that text entered in any search header form field persists
  when you switch search header form tabs, e.g. a word typed into the
  "Check out" tab is copied to the "Check in" form when you switch to
  that tab.
- Perform a search from the "Search the catalog" tab in the header. On
  the search results page and any following detail page your search term
  should remain in the header search form.
- From a bibliographic detail page, confirm that selecting a list from
  the "Add to list" button menu correctly triggers a popup window.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28427: Terminology: Shelf should be list
Owen Leonard [Mon, 24 May 2021 10:24:59 +0000 (10:24 +0000)]
Bug 28427: Terminology: Shelf should be list

This patch corrects the title element on the download list page in the
staff interface.

The affected page should never be seen by the user because other
error-handling should take precedence. In order to see it you have to
set up such an error:

- Log into the staff client as a user with existing lists.
- Open the Lists page.
- Open one of your lists in a new tab.
- In the original tab, delete the list you opened.
- In the tab showing the contents of the list, click the "Download" menu
  button and select an option.
- You should be redirected to a page with an error message at the top.
- The title of this page should be correct: "Download list."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28423: JavaScript error on MARC modifications page
Owen Leonard [Fri, 21 May 2021 17:11:09 +0000 (17:11 +0000)]
Bug 28423: JavaScript error on MARC modifications page

This patch makes a minor change to the MARC modifications template so
that the "mmtas" variable isn't defined if there is no JSON to be
assigned as its value.

To test, apply the patch and go to Administration -> MARC modification
templates.

 - If necessary, add a template with at least one action.
 - Check the browser console, there should be no errors.
 - Click the "Edit" button corresponding to one of the template actions.
 - The details of the action should load correctly in the edit form and
   there should be no errors in the console.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28582: Fix hashref in a warning message
Marcel de Rooy [Thu, 17 Jun 2021 09:38:15 +0000 (09:38 +0000)]
Bug 28582: Fix hashref in a warning message

Can't enqueue letter HASH(0x55edf1806850)

Test plan:
If you cancel an article request when there is no email address
(no branch email, no KohaAdminEmailAddress), Koha warns.
Verify that the warning now contains the letter code.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28545: Noisy uninitialized warn at opac-MARCdetail.pl line 313
Marcel de Rooy [Thu, 10 Jun 2021 14:02:16 +0000 (14:02 +0000)]
Bug 28545: Noisy uninitialized warn at opac-MARCdetail.pl line 313

Test plan:
You do not even need a NULL value in a authorised value controlled
item field, a zero in damaged or withdrawn is enough to trigger the
warnings. (Because only the 1 is linked to an authvalue.)

Check your plack-opac-error.log before and after applying this change.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Without the patch I had at least four warnings per item: withdrawn,
lost, damaged and notforloan.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28479: Use primary keys to check object existence in TestBuilder
Joonas Kylmälä [Fri, 28 May 2021 10:33:24 +0000 (13:33 +0300)]
Bug 28479: Use primary keys to check object existence in TestBuilder

The TestBuilder::build_object function used any foreign keys to check
whether an object already exists or not. This brought incorrectly
results of unrelated objects because using any other keys other than
primary keys don't guarantee our results to point to one single
object. For example, as is put here in the unit test, if you created
two items with the same biblionumber and then tried to create a hold
using build_object() we were using the biblionumber to check whether
an item was linked to the hold already. Thus, we were checking whether
a random item was already linked to the hold instead of the one we
wanted either by passing it explicitly to build_object() or the one
build_object() created implicitly. This also resulted in following
warnings when there were more than one match:

DBIx::Class::Storage::DBI::select_single(): Query returned more than
one row.  SQL that returns multiple rows is DEPRECATED for ->find and
->single at /kohadevbox/koha/t/lib/TestBuilder.pm line 235

To test:
 $ prove t/db_dependent

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28388: Preserve "Browse results" when "view plain" is clicked
Jonathan Druart [Fri, 21 May 2021 07:37:54 +0000 (09:37 +0200)]
Bug 28388: Preserve "Browse results" when "view plain" is clicked

This patch modifies the way search sessions are preserved in the OPAC so
that viewing the "plain MARC" view will not cause the search context to
be lost.

To test, apply the patch and make sure OpacBrowseResults is enabled.

- Perform a search in the OPAC which will return multiple search
  results.
- View the details of one of the search results.
  - You should see a "Browse results" box in the right-hand sidebar.
- Click the "MARC view" link.
  - If you click back to the "Normal view" now, the results browser
    should still appear.
  - From the MARC view, click the "view plain" link.
  - Return to the "Normal view."
    - Before the patch: The results browser is gone.
    - After the patch: The results browser is still there.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28511: Road types in OPAC should prefer OPAC description if one exists
Owen Leonard [Mon, 7 Jun 2021 18:47:25 +0000 (18:47 +0000)]
Bug 28511: Road types in OPAC should prefer OPAC description if one exists

This patch modifies the patron entry form in the OPAC so that if street
types are defined in authorized values, the OPAC description is
preferred.

To test, apply the patch and go to Administration -> Authorized values.

- Add or edit entries in the "ROADTYPE" category.
  - Some entries should have only the "Description" set, while others
    should have "Description" and "Description (OPAC)".
- In the OPAC, open the patron registration page. Check the "Stree type"
  drop down in the "Main address" section.
  - For entries which have an OPAC description, this value should show.
  - For entries without an OPAC description the default should show.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28422: OPAC MARC detail view doesn't correctly evaluate holdability
Owen Leonard [Mon, 24 May 2021 15:55:43 +0000 (15:55 +0000)]
Bug 28422: OPAC MARC detail view doesn't correctly evaluate holdability

This patch modifies the MARC detail view in the OPAC so that it
evaluates whether a title can be placed on hold in the same way it is
done on the "normal" detail page and the ISBD detail page. This allows
for consistency in the display of the "Place hold" link.

To test, apply the patch and log into the OPAC.

 - Perform a search which will return results, at least one of which can
   be placed on hold.
 - View the detail page, the MARC detail page, and the ISBD detail page.
   In each case the "Place hold" link should appear in the sidebar.
 - View the same pages for a record which cannot be placed on hold to
   confirm that the link doesn't appear. For instance:
   - All items are not for loan.
   - All items are lost.
   - There are no items attached.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21286: Add Corporate-name as phrase to zebra indexes
Nick Clemens [Mon, 24 May 2021 13:13:10 +0000 (13:13 +0000)]
Bug 21286: Add Corporate-name as phrase to zebra indexes

When using Zebra for searching, Koha performs a number of searches in order
to improve relevancy. This means that even for 'wordlist' search, we perform a phrase search.

When selecting 'Corporate-name' as an index, this expansion of the search causes errors and fails
the search

We can fix this for 'Corporate-name' searches by adding a phrase index

To test:
 1 - Edit koha-conf.xml and uncomment the zebra debug line and add 'request' to the list
 2 - Restart all
 3 - tail -f /var/log/koha/kohadev/zebra-output.log
 4 - Edit a record to add a 110 field e.g. 'House plants'
 5 - Enable syspref IntranetCatalogSearchPulldown
 6 - Search for 'Corporate name' and term 'House plants'
 7 - No results
 8 - View the log, see 'ERROR' and full search terms listed
 9 - Apply patch
10 - copy the zebra files to the production instance:
    cp etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml
    cp etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
11 - restart all
12 - rebuild: sudo koha-rebuild-zebra -v -f kohadev
13 - Repeat search
14 - Success!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>