koha.git
2 years agoBug 29072: Move reference route /cities spec to YAML
Tomas Cohen Arazi [Tue, 21 Sep 2021 12:52:19 +0000 (09:52 -0300)]
Bug 29072: Move reference route /cities spec to YAML

This patch moves the /cities routes spec and related files into YAML so
devs can use it as a reference for future routes.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/cities.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29032: Pre-load ILL backends to speed up response
Tomas Cohen Arazi [Wed, 15 Sep 2021 15:12:33 +0000 (12:12 -0300)]
Bug 29032: Pre-load ILL backends to speed up response

Bug 22440 will rewrite the route and make it even more efficient by
prefetching the related data instead of performing several queries in
loops.

In the meantime, we can make this controller perform better with a
simple intervention: load backends once, and use the
$request->_backend() setter to pre-set it before using the objects.

To test:
1. Perform any usual ILL requests listing, try having several
=> FAIL: Notice it takes a weird amount of time to load
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: It feels fast enough!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 17600: Fix overdrive_proxy and recordedbooks
Jonathan Druart [Mon, 20 Sep 2021 14:14:13 +0000 (16:14 +0200)]
Bug 17600: Fix overdrive_proxy and recordedbooks

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28972: Fix failing tests
Jonathan Druart [Mon, 20 Sep 2021 14:11:35 +0000 (16:11 +0200)]
Bug 28972: Fix failing tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 17600: Remove wrong C4::Context imports
Jonathan Druart [Mon, 20 Sep 2021 12:25:48 +0000 (14:25 +0200)]
Bug 17600: Remove wrong C4::Context imports

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28653: Add new method RefreshIssuesTable
Emmi Takkinen [Fri, 2 Jul 2021 12:05:27 +0000 (15:05 +0300)]
Bug 28653: Add new method RefreshIssuesTable

On patrons check out or details page, after renewing
loans they don't sort correctly when clicking on "Date due"
tab. Page has to be reloaded so that sorting works.
This patch adds new method RefreshIssuesTable to
checkouts.js. When loans are renewed or checked in, issues
table is reloaded to and due dates are sorted correctly.

To test:
1. Add 3 loans for patron.
2. Change due dates so you they are e.g. 07/01, 07/02, 07/04
3. Make sure you have renewal period set e.g. 5 days and
check your RenewalPeriodBase syspref (I use current date there)
4. Renew loan with date due on 07/01, it should now be 07/07
5. Sort loans by date due
=> Note that order from top to bottom is 07/04->07/02->07/07
or 07/07->07/02->07/04, not 07/02->07/04->07/07 as one would
assume.
6. Apply patch and repeat.
=> Note that issues table is reloaded ("Loading..." pop-up is displayed)
and that due dates are in correct order.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: kelly <kelly@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 28653: (QA follow-up) Remove debug message used during development

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 18747: Select All in Add Patron Option in Patron Lists only selects the first...
Owen Leonard [Fri, 27 Aug 2021 16:06:02 +0000 (16:06 +0000)]
Bug 18747: Select All in Add Patron Option in Patron Lists only selects the first 20 entries

This patch corrects the JavaScript functions for the "select all" and
"clear all" action when viewing patrons in a list. Before this
correction, checkboxes which were previously in hidden table rows would
not be checked.

To test, apply the patch and go to Patrons -> Patron Lists

- View a patron list
- If necessary, add multiple patrons to the list so that the number
  exceeds 20.
- Change the number of entries shown by the DataTable: Show [ 50 ]
  entries.
- Click "Select all." All visible checkboxes should be checked.
- Click "Clear all." All checkboxes should be unchecked.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28992: Resolve warning on BIG_LOOP
Marcel de Rooy [Fri, 10 Sep 2021 07:39:40 +0000 (07:39 +0000)]
Bug 28992: Resolve warning on BIG_LOOP

Argument "" isn't numeric in numeric gt (>) at
/usr/share/koha/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
addbiblio.tt line 896.

Came across it when testing 28608. Could have been a QA follow-up.

Test plan:
If you run QA tools on this patch, you should see the warning only
when processing files before patches.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28972: DBIC schema changes
Jonathan Druart [Mon, 20 Sep 2021 12:02:15 +0000 (14:02 +0200)]
Bug 28972: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28972: DBRev 21.06.00.022
Jonathan Druart [Mon, 20 Sep 2021 12:01:08 +0000 (14:01 +0200)]
Bug 28972: DBRev 21.06.00.022

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28972: Make DB rev idempotent
Jonathan Druart [Mon, 20 Sep 2021 11:57:06 +0000 (13:57 +0200)]
Bug 28972: Make DB rev idempotent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28972: Add missing foreign key constraints to holds queue table
Kyle M Hall [Wed, 8 Sep 2021 12:02:05 +0000 (08:02 -0400)]
Bug 28972: Add missing foreign key constraints to holds queue table

The table tmp_holdsqueue is missing a couple key constraints that should
be there, one for biblio and one for borrowers.

Test Plan:
1) "SHOW CREATE TABLE tmp_holdsqueue;" should show no FKs for biblio or borrowers
2) Apply this patch
3) Run updatedatabase.pl
4) "SHOW CREATE TABLE tmp_holdsqueue;" should now show FKs for biblio or borrowers

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: (QA follow-up) Make clean_search_term public
Martin Renvoize [Wed, 1 Sep 2021 14:58:04 +0000 (15:58 +0100)]
Bug 28316: (QA follow-up) Make clean_search_term public

With all the work that's gone into improving the internal
_clean_search_term method I feel we should expose it publically as it's
going to be more widely helpful

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: escape ES ranges if QueryAutoTruncate is enabled
Petro Vashchuk [Mon, 6 Sep 2021 13:46:45 +0000 (16:46 +0300)]
Bug 28316: escape ES ranges if QueryAutoTruncate is enabled

if QueryAutoTruncate enabled we will have any special operators ruined
for example: "test [6 TO 7]" will be converted to "test* [6* TO* 7]"
so no reason to keep ranges when QueryAutoTruncate set to "enabled"

1) enable QueryAutoTruncate at your sysprefs.
2) perform a search using range, for example: "[1999 TO 2020]",
it shouldn't work the way it's supposed to.
3) apply the patch.
4) perform the same search with range, ensure that it works correctly.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: avoid messing up regexes in the search queries
Petro Vashchuk [Mon, 14 Jun 2021 13:38:51 +0000 (16:38 +0300)]
Bug 28316: avoid messing up regexes in the search queries

This patch ensures that the behavior with
QueryRegexEscapeOptions set to values other than
"Escape" still will works as expected.

It does so by storing the contents of regexes
before escaping special characters and
then restores the contents of regexes back to how
it was before, ensuring that searching with regex is possible.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: escape exclamation signs in the query
Petro Vashchuk [Fri, 18 Jun 2021 07:44:56 +0000 (10:44 +0300)]
Bug 28316: escape exclamation signs in the query

Currently having exclamation sign at the end of the query makes ES
search fail, and when you try to search for a book that has exclamation
sign in the tittle (something like "Words! words") won't show results
correctly as it tries to negate everything that is after exclamation
sign, making it impossible to search for books that have in in the title

This patch escapes exclamation signs if it's at the end of the query or
has a space after it, resolving both of the issues listed above.

To reproduce:
1) with ES enabled, search for the book with title that contains
exclamation sight at the end, like "book!", this search should result
 in error.
2) do another search, but this time find/prepare beforehand book with a
title that has exclamation sign with a space after it,
e.g "exclamation! sign", it shouldn't find it as ES treats everything
after that exclamation sign as negation.
2) apply the patch.
3) perform searches from the steep one and two again.
Search from step one should no longer fail, while search from the step
two should find that book.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: escape brackets in the search query
Petro Vashchuk [Tue, 13 Jul 2021 09:13:03 +0000 (12:13 +0300)]
Bug 28316: escape brackets in the search query

This patch screens square and curly brackets which have no special
language meaning.

To reproduce:
1) using ES, search for the book with title that contains
square and/or curly brackets, like "book [second edition]", which will
result in error.
2) apply the patch.
3) search for that book again, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: screen unquoted semicolons and all followup colons
Petro Vashchuk [Fri, 18 Jun 2021 07:43:14 +0000 (10:43 +0300)]
Bug 28316: screen unquoted semicolons and all followup colons

Currently searches like: "book:", ":book" and "host-item:test:n"
cause internal server errors.

This patch adds additional regexes that remove the colons at the start
and end of the query, and another regex that screens all follow-up
colons that go after the first colon to avoid errors when searching for
"host-item:test:n".

To reproduce:
1) using ES, search for the book with title that contains
semicolon at the start or at the end of the line, separated with spaces,
this should cause internal server error.
2) try doing the same with something like "host-item:test:n", it should
result in error as well.
3) apply the patch.
4) repeat steps 1-2, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28316: add tests
Petro Vashchuk [Tue, 15 Jun 2021 07:40:27 +0000 (10:40 +0300)]
Bug 28316: add tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28985: Force positive numbers for itemtype charge fields
Nick Clemens [Fri, 10 Sep 2021 12:12:07 +0000 (12:12 +0000)]
Bug 28985: Force positive numbers for itemtype charge fields

This patch adds a min attribute to the fields on this page and adds
other cost related fields to validator

To test:
1 - Apply patch
2 - Browse to Administration->Item types
3 - Edit or create an item type
4 - Attempt to place a negative or non numeric value in:
    Daily rental charge
    Hourly rental charge
    Default replacement cost
    Processing fee
5 - You should not be able to

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28847: Remove dead code and make regex consistent
Nick Clemens [Mon, 13 Sep 2021 11:53:39 +0000 (11:53 +0000)]
Bug 28847: Remove dead code and make regex consistent

This updates the regex code to match throughout the routine and removes
code that would no longer be reached.

Note that the code to update library name in the query descruiption was
broken before this patch, so removal does not change behaviour

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28847: (follow-up) Handle branch_group_limit
Nick Clemens [Sat, 11 Sep 2021 15:12:31 +0000 (15:12 +0000)]
Bug 28847: (follow-up) Handle branch_group_limit

To test:
1 - Create a library group as an OPAC search group
2 - Enable OpacAddMastheadLibraryPulldown
3 - Browse to:
    http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=t&branch_group_limit=multibranchlimit-1&weight_search=1
4 - Confirm search works and returns correct results
5 - Confirm dropdown is correctly populated

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28847: Only apply JS to branch/multibranch selection if there are search groups
Nick Clemens [Fri, 13 Aug 2021 19:48:48 +0000 (19:48 +0000)]
Bug 28847: Only apply JS to branch/multibranch selection if there are search groups

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28847: Cleanup of branch limitsand fix OPAC_SEARCH_LIMIT
Nick Clemens [Thu, 12 Aug 2021 11:13:46 +0000 (11:13 +0000)]
Bug 28847: Cleanup of branch limitsand fix OPAC_SEARCH_LIMIT

The opac had 'branch_group_limit' parameters which can be simplified to more
closely match intranet code.

Adjust C4::Auth for chaneg above to ensure dropdowns correctly populate

Expand JS to prevent selection of single and multibranch limits

To test:
1 - Enable OpacAddMastheadLibraryPulldown system preference
2 - Ensure branches and groups show as before patch
3 - Ensure single and multibranch limits from masthead apply as expected
4 - Test advanced search page, ensure you cannot select both single and multibranch limit
5 - Follow test plan on 28845 - ensure multibranch limit still correctly pre-selected

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28847: Unit tests
Nick Clemens [Thu, 12 Aug 2021 11:11:54 +0000 (11:11 +0000)]
Bug 28847: Unit tests

Note: tests are very similar between ES and Zebra, however, ES requires the uppercase
OR and doesn't use '=' in the same way. I feel having test coverage in each module is fair and more future
proof in case of changes to search engine

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28847: Move SearchLimitLibrary code to QueryBuilder Modules
Nick Clemens [Thu, 12 Aug 2021 11:02:39 +0000 (11:02 +0000)]
Bug 28847: Move SearchLimitLibrary code to QueryBuilder Modules

This patch removes the code from the search scripts into QueryBuilder
modules.

To test:
1 - Have a library group defined as a search group for both staff and opac
2 - Search on staff client and opac with that group limit and a single branch limit
3 - Note your results/counts
4 - Note the visuals of the search description
5 - Apply patch
6 - Repeat searches
7 - All should work as before

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 21093: In additem.pl set the right stickyduedate for fast add
Lucas Gass [Tue, 7 Sep 2021 22:37:39 +0000 (22:37 +0000)]
Bug 21093: In additem.pl set the right stickyduedate for fast add

To test:
-1 Set the specify due date option to a date, don't check the checkbox
-2 Enter an unknown barcode
-3 Click on fast add
-4 Add a record
-5 Add an item (don't change the barcode!)
-6 The item is checked out to the patron
-7 Verify: The checkbox is "Remember for session" is checked now
-8 APPLY patch
-9 Do steps 1-6 again, this time "Remember for session" should be unchecked
-10 Do steps 1-6 again but this time do check the "Remember for session" checkbox.
-11 It should be properly checked

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28464: Remove useless check that gives the incorrect error message
Kyle M Hall [Wed, 26 May 2021 15:16:13 +0000 (11:16 -0400)]
Bug 28464: Remove useless check that gives the incorrect error message

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 28464: Add unit tests
Kyle M Hall [Wed, 26 May 2021 15:13:44 +0000 (11:13 -0400)]
Bug 28464: Add unit tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 28464: (QA follow-up) Correct test plan

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 28228: Supress plugin related error message
Kyle M Hall [Tue, 30 Jun 2020 16:20:39 +0000 (12:20 -0400)]
Bug 28228: Supress plugin related error message

Use of uninitialized value in subroutine entry at /usr/share/koha/lib/Koha/Plugins/Base.pm line 182.

Test Plan:
1) Install the Kitchen Sink plugin ( it does not have a max versio defined )
2) Note the warning in your logs
3) Apply this patch
4) Restart all the things
5) No warning!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28914: Fix wording in authentication forms
Fridolin Somers [Fri, 27 Aug 2021 18:37:03 +0000 (08:37 -1000)]
Bug 28914: Fix wording in authentication forms

In most authentication forms we see :
Fields "Login:" and "Password:" with a submit button "Log in".

In some places submit button contains "Login", which is confusing for translation.
It is not correct according to terminology https://wiki.koha-community.org/wiki/Terminology#L
Also in opac-user.pl ":" is missing, it generates new translation entries.

Test plan:
1) Log out if you are logged in
2) Go to staff interface
3) Check you see button "Log in"
4) Go to OPAC page /cgi-bin/koha/opac-user.pl
5) Check you see fields "Login:" and "Password:"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28829: Remove single quote escaping in value_builder/unimarc_field_4XX.pl
Fridolin Somers [Sat, 7 Aug 2021 02:02:09 +0000 (16:02 -1000)]
Bug 28829: Remove single quote escaping in value_builder/unimarc_field_4XX.pl

Since Bug 23777 added To.json, single quote escaping in value_builder/unimarc_field_4XX.pl is useless.

Test plan:
1) Use UNIMARC database
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a : L'avion
4) Create a record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch 463$t contains : L\'avion
=> With patch 463$t contains : L'avion

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>
2 years agoBug 28472: (follow-up) add unit test for the case where location = NULL
Andreas Roussos [Fri, 17 Sep 2021 13:51:51 +0000 (15:51 +0200)]
Bug 28472: (follow-up) add unit test for the case where location = NULL

This patch adds an extra unit test, to cover the case where the
UpdateItemLocationOnCheckin System Preference is set to "_ALL_: CART"
and the item being returned has no shelving location set.

Test plan:

1) Apply the patch provided earlier
2) prove -v t/db_dependent/Circulation/issue.t
   ...and sign off if all tests pass.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
JD amended patch: use 'is' instead of 'ok'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28472: handle items with NULL shelving location
Andreas Roussos [Fri, 2 Jul 2021 11:12:21 +0000 (13:12 +0200)]
Bug 28472: handle items with NULL shelving location

The UpdateItemLocationOnCheckin System Preference can be set to update the
location of ALL items during check in, regardless of their shelving location.
However, this does not currently work 100% as it is excluding items with no
shelving location (i.e. value of NULL in the corresponding database field).

This patch, based on the comment made by Nick Clemens, fixes that.

Test plan (based on the original Bug Description by Andrew Fuerste-Henry):

1) Have a shelving location CART
2) In UpdateItemLocationOnCheckin, enter "_ALL_: CART" (without the quotes)
3) Check in an item that has a shelving location, confirm it changes to CART
4) Check in an item with a NULL shelving location, confirm it doesn't go to CART
5) Apply this patch
6) Repeat step 4): this time the item should move to the CART shelving location

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28986: Remove (All) notation to correctly select rule for editing
Nick Clemens [Thu, 9 Sep 2021 15:21:10 +0000 (15:21 +0000)]
Bug 28986: Remove (All) notation to correctly select rule for editing

This patch updates the JS comparison code to remove the '(All)' hint before comparing
to the current value

To test:
1 - Go to Administration -> Item types
2 - Edit a type to have a parent of another type
3 - Go to Administration -> Circulation and fines rules
4 - Add a rule for all categories for the child itemtype
5 - Add a rule for all categories for the parent itemtype
6 - Click edit on child type, note itemtype dropdown in editor correctly selected
7 - Click edit on parent type - note itemtype dropdown menu refers to 'All' itemtypes
8 - Apply patch
9 - Reload page and edit parent type rule
10 - Itemtype dropdown is correctly populated

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28845: (follow-up) Retain selection when using advanced search
Nick Clemens [Tue, 7 Sep 2021 11:57:48 +0000 (11:57 +0000)]
Bug 28845: (follow-up) Retain selection when using advanced search

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28845: Match against the full limit string, not just the group id
Nick Clemens [Wed, 11 Aug 2021 15:30:36 +0000 (15:30 +0000)]
Bug 28845: Match against the full limit string, not just the group id

To test:
1 - Add to OPAC virtual host in apache conf:
   SetEnv OPAC_SEARCH_LIMIT branch:multibranch-1
   SetEnv OPAC_LIMIT_OVERRIDE 1
   RequestHeader add X-Koha-SetEnv "OPAC_SEARCH_LIMIT branch:multibranchlimit-1"
   RequestHeader add X-Koha-SetEnv "OPAC_LIMIT_OVERRIDE 1"
2 - Enable system preference OpacAddMastheadLibraryPulldown
3 - Create a library group enabled as OPAC search group (or make sure existing group 1 is an OPAC search group)
4 - Load the opac - dropdown does not pree-select the search group
5 - Apply patch
6 - Relaod opac - group is pre-selected!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28676: Cache and retrieve match_count when searching a cached heading
Nick Clemens [Wed, 7 Jul 2021 15:39:43 +0000 (15:39 +0000)]
Bug 28676: Cache and retrieve match_count when searching a cached heading

We use match_count to determine if a new authority record should be created, however,
we were not adding this count to the cache, so if a record returned too many matches on first
lookup, we would create a new record on the second lookup

To test:
1 - Set Linker Module to 'Default'
2 - Enable  AutoCreateAuthorities  and  BiblioAddsAuthorities and  CatalogModuleRelink and LinkerRelink
3 - Add two copies of a single authority via Z39
4 - Add two headings for that authority to a bib record (e.g. a 610 and 710)
5 - Save the record and note a new authority is generated
6 - Repeat and see another is generated
7 - Apply patch
8 - Restart all the things
9 - Save the record again, no new authority created

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28676: Unit test
Nick Clemens [Wed, 7 Jul 2021 15:39:21 +0000 (15:39 +0000)]
Bug 28676: Unit test

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28960: Explicitly call get_column
Martin Renvoize [Tue, 7 Sep 2021 11:14:03 +0000 (12:14 +0100)]
Bug 28960: Explicitly call get_column

This patch adds get_column to ensure we are returning a string value of
a field rather than accidentally triggering a relationship accessor.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 17600: Fix opac/svc/overdrive
Jonathan Druart [Tue, 14 Sep 2021 16:22:13 +0000 (18:22 +0200)]
Bug 17600: Fix opac/svc/overdrive

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28946: (bug 23271 follow-up) Missing occurrence in add_user_search.pl
Jonathan Druart [Fri, 10 Sep 2021 08:03:05 +0000 (10:03 +0200)]
Bug 28946: (bug 23271 follow-up) Missing occurrence in add_user_search.pl

commit f6e0b04f48e8f0a02dbb8d48152646257d9accba
Bug 23271: Replace search_limited with search_with_library_limits

We were modifying the occurrences of:
  Koha::Patron::Categories->search_limited;
with:
  Koha::Patron::Categories->search_with_library_limits;

But between the patch submission and the push, another occurrence has
been added by bug 23590.

Test plan:
Create a new suggestion from staff and click "select manager"
Without the patch, notice the error:
  The method Koha::Patron::Categories->search_limited is not covered by tests!
With the patch applied everything is working correctly

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28921: Remove warning from html_helpers.inc
Didier Gautheron [Mon, 30 Aug 2021 14:26:05 +0000 (16:26 +0200)]
Bug 28921: Remove warning from html_helpers.inc

Argument "" isn't numeric in numeric gt (>) at /home/koha/src/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc line 23.

To test:
1 - Open OPAC main page
2 - Check opac-error.log or plack-opac-error.log for message as above
3 - Apply patch
4 - Open OPAC main page
5 - Check opac-error.log again, there should be no more warnings

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 28149: (follow-up) Add string for job status "new"
Owen Leonard [Tue, 17 Aug 2021 10:17:35 +0000 (10:17 +0000)]
Bug 28149: (follow-up) Add string for job status "new"

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28149: Improve internationalization and formatting on background jobs page
Owen Leonard [Wed, 14 Apr 2021 17:43:38 +0000 (17:43 +0000)]
Bug 28149: Improve internationalization and formatting on background jobs page

This patch adds some logic to the background jobs template in order to
make job status and job type translatable. Output of dates has been
changed to use the KohaDates plugin, using the "with_hours" flag.

This patch also modifies the page title and breadcrumbs so that if one
is viewing the details of a background job the page title and
breadcrumbs reflect this.

I've also added inclusion of the preferences search form in the header,
the default for administration pages which don't have their own search.

To test, apply the patch and go to Administration -> Background jobs.

 - If there are no background jobs listed, submit at least one batch of
   bibliograhpic records and at least one batch of authorty records for
   modification (Tools -> Batch record modification).
   - In the table of background jobs, the status should be shown
     correctly. If you see it capitalized ("Finished") you're seeing the
     new string in the template which will be used for translation.
   - In the "Type" column, you should see either "Batch authority record
     modification" or "Batch bibliographic record modification"
   - In the "Queued," "Started," and "Ended" columns the date should be
     formatted according to your system's dateformat system preference,
     including the time.
  - View the details of a background job. The same changes to status and
    type should be seen on this page, as well as the date formatting of
    the date fields.
    - In the breadcrumbs, confirm that it shows a link to the
      background jobs page followed by "Details if job #X".

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28392: make streettype and B_streettype work with BorrowerUnwantedField
Lucas Gass [Wed, 1 Sep 2021 14:17:21 +0000 (14:17 +0000)]
Bug 28392: make streettype and B_streettype work with BorrowerUnwantedField

To test:
1. Add values to the AV ROADTYPE
2. Go to the BorrowerUnwantedField system preference and attempt to hide streettype and B_streettype.
3. It doesn't work, the fields still show.
4. Apply patch
5. Repeat step 2, it should work now.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 21794: (QA follow-up) Separate city and country with a comma
Joonas Kylmälä [Sat, 4 Sep 2021 18:23:16 +0000 (18:23 +0000)]
Bug 21794: (QA follow-up) Separate city and country with a comma

If only the city and country address information was provided they ended
up being glued together like this: CityCountry. (AddressFormat=US style)

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 21794: Fix display of addresses on details tab in staff when city is empty
Katrin Fischer [Mon, 23 Aug 2021 22:34:13 +0000 (00:34 +0200)]
Bug 21794: Fix display of addresses on details tab in staff when city is empty

If the city field was not filled out on the main or alternate address,
the content of state, country and zipcode wouldn't display on the
Details tab in the patron account in staff.

To test:
- Enter main contact and alternate address without city
- Verify that the address information isn't shown on the details
  tab after saving
- Apply patch
- Verify that the information is displayed now
- Toggle AddressFormat and check display is correct for all settings
- Switch back to US address format
- Try several combinations of empty fields for city, zipcode, country
  and state. The punctuation and whitespace should always appear
  correctly.

Examples:
- Enter just country
- Enter zipcode and country
- ...

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28936: Add sort1/sort2 to borrowers.json
Lucas Gass [Wed, 1 Sep 2021 16:24:52 +0000 (16:24 +0000)]
Bug 28936: Add sort1/sort2 to borrowers.json

To Test:
1. Check the BorrowerMandatoryField and BorrowerUnwantedField system preferences, sort1 and sort2 cannot be hidden or required
2. Apply patch
3. Check the BorrowerMandatoryField and BorrowerUnwantedField system preferences again, you should see sort1 and sort2
4. Since sort1 and sort2 are now added to borrowers.json we must also check the system preferences PatronQuickAddFields & PatronDuplicateMatchingAddFields
5. They should both now include sort1 and sort2, check to make sure they work with these two system preferences
6. Look at the system preferences PatronSelfRegistrationBorrowerMandatoryField, PatronSelfRegistrationBorrowerUnwantedField, and PatronSelfModificationBorrowerUnwantedField
7. sort1 and sort2 should be disabled in these OPAC system preferences

This patch does not attempt to add sort1 or sort2 to the self reg or borrower mod pages. If they should be added, which I am not sure they should, we should do so in a seperate bug

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 10265: (QA follow-up) Make if-else checks consistent
Joonas Kylmälä [Sun, 5 Sep 2021 12:10:17 +0000 (12:10 +0000)]
Bug 10265: (QA follow-up) Make if-else checks consistent

The != '' version doesn't check for the whitespace existing and thus
might have added the punctuation without the partNumber or partName being
inserted at all.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 10265: Keep punctuation for 8xx series added entry fields (MARC21)
Katrin Fischer [Sun, 22 Aug 2021 03:29:47 +0000 (03:29 +0000)]
Bug 10265: Keep punctuation for 8xx series added entry fields (MARC21)

At the moment the punctuation entered for $n $p and is
removed in the part template, which leads to displaying the subfields
without any punctuation and spaces in between.

To test:
- Catalog records with various combinations of 8xx series added
  entry fields. Subfield a, t, n, p and v are the most important.
- Verify the display in OPAC and staff is not great.
- Apply the patch.
- Verify the display in OPAC and staff is improved.

For examples see:
https://www.loc.gov/marc/bibliographic/bd80x83x.html

Important note: At the moment 8xx series added entry fields will only display, when
there is also a 490 ind. 1 = 1 field present.

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28912: Remove duplicated warnings on the about page
Jonathan Druart [Fri, 27 Aug 2021 14:59:43 +0000 (16:59 +0200)]
Bug 28912: Remove duplicated warnings on the about page

Bad conflict resolution

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28912: Prevent Pseudonymization to be set if bcrypt_settings not set
Jonathan Druart [Fri, 27 Aug 2021 14:56:08 +0000 (16:56 +0200)]
Bug 28912: Prevent Pseudonymization to be set if bcrypt_settings not set

If Pseudonymization is set but the bcrypt_settings config used by the
feature is not set, then there is an ugly 500 on checking out.

bad bcrypt settings at /kohadevbox/koha/Koha/PseudonymizedTransaction.pm line 116.

However it's pretty hard to handle correctly this exception (and that's
why it hasn't be done initially). However we could prevent the pref to
be turned on if the config entry is not present.

Test plan:
Remove the bcrypt_settings from the config
Try to turn the syspref on
Add the config
Try to turn the syspref on/off

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
JD amended patch: fix qa failures

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28882: Disable select/hide all links
Jonathan Druart [Wed, 25 Aug 2021 09:47:18 +0000 (11:47 +0200)]
Bug 28882: Disable select/hide all links

We want to prevent non-superlibrarian users to remove superlibrarian
flag.
It's handled already in the controller, but needs to be done
client-side.

Here we are disabling the select/hide all links to remove the remaining
possibility to remove the superlibrarian flag from non-superlibrarian
users.

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
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 28882: permission UI allows selection of superlibrarian permission
Jonathan Druart [Thu, 19 Aug 2021 13:07:50 +0000 (15:07 +0200)]
Bug 28882: permission UI allows selection of superlibrarian permission

With bug 20100 and 22150 we allow to select all the permissions but the
superlibrarian permission, to ease the selection. And we also forbid a
non-superlibrarian user to add superlibrarian permission.

However there is something wrong in the JS code and it's possible to add
the superlibrarian permission. The user is getting an ugly 500 and so
the permission change is not done, but the UI checks must be fixed.

To recreate:
Login with a non-superlibrarian user
Edit permission
Clear all
=> You can select the "superlibrarian" permission

Test plan:
Login with a non-superlibrarian user
Try to set the superlibrarian permissions to a user
=> not possible
Try the select all/clear all
=> still cannot set the superlibrarian permission

Work to be done:
Login with a non-superlibrarian user
Edit permissions for a superlibrarian user
=> You can remove it, then cannot add it back
Should we allow removal of superlibrarian permission by
non-superlibrarian user?

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
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 28306: Fix t/db_dependent/Koha/Objects.t
Julian Maurice [Tue, 31 Aug 2021 12:00:00 +0000 (14:00 +0200)]
Bug 28306: Fix t/db_dependent/Koha/Objects.t

It looks like a circular dependency problem where methods are
not exported correctly

There is at least one circular dependency here:

    C4::Context -> Koha::Caches -> Koha::Cache -> C4::Context
    (-> means "uses")

The tests pass if C4::Context is loaded early, so the patch does that.

Circular dependencies should be fixed ideally, but it is a little
more complicated, and I don't have the time right now...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: (follow-up) Fix copy error
Nick Clemens [Fri, 3 Sep 2021 15:25:32 +0000 (15:25 +0000)]
Bug 28373: (follow-up) Fix copy error

Previous commit linked all 'default' buttons for sysprefs to OPACXSLTListsDisplay

This adjusts the links

To test:
Click "default" for all 6 XSLT preferences
Confirm the syspref relating to the link is marked 'modified' when clicked

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28938: Correct Flatpickr's default 12hr time formatting
Owen Leonard [Wed, 1 Sep 2021 18:08:49 +0000 (18:08 +0000)]
Bug 28938: Correct Flatpickr's default 12hr time formatting

This patch corrects Flatpickr's default 12 time formatting so that it
uses the formatting token "G" ("Hours, 2 digits with leading zeros")
instead of "h" ("Hours, 2 digits without leading zeros").

This will prevent incorrect times from being saved when the submitted
time is before 12.

- To test, apply the patch go to Administration -> System preferences.
- Set the TimeFormat system preference to "12 hour"
- Find an item which is checked out and renewable.
- Go to Circulation -> Renew and use the date picker to select a time <
  12, e.g. 9:00 AM
- Submit the barcode for renewal.
- Check the patron's account to see the due date of the renewed item: It
  should match the date and time you selected.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 20529: Remove other occurrences of decodeURIComponent from browser.js
Jonathan Druart [Fri, 9 Jul 2021 14:01:43 +0000 (16:01 +0200)]
Bug 20529: Remove other occurrences of decodeURIComponent from browser.js

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 20529: Fix "Return to results" link broken by a double quote
Victor Grousset [Mon, 16 Apr 2018 16:55:48 +0000 (18:55 +0200)]
Bug 20529: Fix "Return to results" link broken by a double quote

(in the search query)

cause: decodeURIComponent used when URI encoding was necessary. (At
least in main usecase of this feature)
It could have been a copy and paste error. From the above
browseRecords() function.

== Test plan ==
1. Search in the staff catalogue «a "alice"»
     Replace a and alice with whatever than will return a result for you
2. Click on the first result
3. Check the "Return to results" link
     It should be like
     staff_url://cgi-bin/koha/catalogue/search.pl?idx=kw&q=a
     This is the bug. Because when clicking the link, your search will be
     'kw,wrdl: a'
     instead of
     'kw,wrdl: a "alice"'
4. Apply this patch.
5. Search in the staff catalogue «a "alice"»
     Replace a and alice with whatever than will return a result for you
6. Click on the first result
7. Check the "Return to results" link
     The link should preserve the full query

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28928: Minor follow-ups to Bug 28376 - Flatpickr introduction
Owen Leonard [Tue, 31 Aug 2021 12:09:44 +0000 (12:09 +0000)]
Bug 28928: Minor follow-ups to Bug 28376 - Flatpickr introduction

This patch corrects three errors in the original Flatpickr introduction
patch:

- Missing document.ready() in borrowers_stats.tt.
- Redundant calendarFirstDayOfWeek setting in caregories.js
- Missing preventDefault() in calendar.inc

The first two issues don't appear to cause any malfunction but are best
practices. The third issue can cause the page to scroll unexpectedly.

To reproduce this bug, go to (for instance) Administration -> Patron
categories -> New category.

 - If necessary, narrow the height of your browser window so that there
   is a vertical scrollbar.
 - Scroll down the page so that the "Until date" field is at the top.
 - Click the "X" next to the field.
 - The page will scroll to the top.

Apply the patch and test again. The page jump should not occur.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25078: Fix indentation and style for additional descriptions
Jonathan Druart [Tue, 31 Aug 2021 08:26:05 +0000 (10:26 +0200)]
Bug 25078: Fix indentation and style for additional descriptions

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26195: Add a way to specify authorised values should be expanded [OAI]
Tomas Cohen Arazi [Thu, 13 Aug 2020 17:50:16 +0000 (14:50 -0300)]
Bug 26195: Add a way to specify authorised values should be expanded [OAI]

This patch introduces a new configuration entry for OAI so the resulting
records include authorised value descriptions instead of codes.

This is off by default.

To test:
1. Create a yaml file with the extended OAI configuration
2. Visit http://kohadev.myDNSname.org:8080/cgi-bin/koha/oai.pl
3. Browse some records
=> SUCCESS: The fields tied to AV show codes.
4. Update your configuration with 'expanded_avs: 1' for one  of the
   defined format like in:

  ---
  format:
    marc21:
      metadataPrefix: marc21
      metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
      schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
      include_items: 0
    marcxml:
      metadataPrefix: marcxml
      metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
      schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
      include_items: 1
      expanded_avs: 1
5. restart_all
6. Repead 3
=> SUCCESS: AV descriptions are returned!
7. Sign off :-D

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28306: Fix POD
Kyle M Hall [Fri, 23 Jul 2021 19:19:30 +0000 (15:19 -0400)]
Bug 28306: Fix POD

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28306: Switch back to using 'mock' instead of 'redefine'
Kyle M Hall [Fri, 23 Jul 2021 19:11:52 +0000 (15:11 -0400)]
Bug 28306: Switch back to using 'mock' instead of 'redefine'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28306: Allow to query database with minimal memory footprint
Julian Maurice [Mon, 10 May 2021 06:54:35 +0000 (08:54 +0200)]
Bug 28306: Allow to query database with minimal memory footprint

The goal is to be able to build a database handler (dbh) and to execute
queries without loading unnecessary stuff. This will be useful to reduce
memory usage of daemons that need to check the database
periodically

The patch provides a new method Koha::Database::dbh which returns a
database handler without loading the DBIx::Class schema. This method is
also used by DBIx::Class, so whether you use DBI or DBIx::Class, the
same method is used to initialize the connection.

The patch also moves some code in order to avoid loading C4::Context:
- C4::Context::timezone moves to Koha::Config
- C4::Context::db_scheme2dbi moves to Koha::Database

To measure memory usage I used the following commands:

* before the patch:
perl -MKoha::Database \
    -E 'Koha::Database->schema->storage->dbh->do("select 1");' \
    -E '$|=1; say $$; sleep 2' \
    | while read pid; do ps -p $pid -o rss=; done

* after the patch:
perl -MKoha::Database \
    -E 'Koha::Database->dbh->do("select 1");' \
    -E '$|=1; say $$; sleep 2' \
    | while read pid; do ps -p $pid -o rss=; done

It will give you the RSS (Resident Set Size) of the perl process in kB

What I get:
* before the patch: between 96.9MB and 97.2MB
* after the patch: between 17.8MB and 18.2MB

Note that if a timezone is configured (either from $KOHA_CONF or
TZ environment variable), Koha will load DateTime::Timezone to check if
it's valid, and it increases RSS to 36MB

Another interesting metric is the number of modules loaded:
* before the patch:
perl -MKoha::Database \
    -E 'Koha::Database->schema->storage->dbh;' \
    -E 'say scalar keys %INC'

Result: 567

* after the patch:
perl -MKoha::Database \
    -E 'Koha::Database->dbh;' \
    -E 'say scalar keys %INC'

Result: 51

Test plan:
1. Apply the patch & restart starman
2. Make sure Koha is still ok (ie. can access the database, does not
have encoding issues, ...)
3. Run the tests in t/Context.t, t/Koha/Config.t,
t/db_dependent/Koha/Database.t, t/timezones.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28774: DBRev 21.06.00.021
Jonathan Druart [Tue, 31 Aug 2021 08:16:49 +0000 (10:16 +0200)]
Bug 28774: DBRev 21.06.00.021

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28774: Don't store blank values for rental discount
Nick Clemens [Wed, 28 Jul 2021 12:23:50 +0000 (12:23 +0000)]
Bug 28774: Don't store blank values for rental discount

This patch adds 'can_be_blank => 0' for the rentaldiscount rule to prevent
storing blank values in the database

Additionally, if there is no charge we do not need to check for a discount
and can simply return

To test:
1 - Set rental discount to "" to a rule in circulation rules
2 - Checkout an item that will follow this rule
3 - Check the intranet log:
    [WARN] Argument "" isn't numeric in subtraction (-) at /kohadevbox/koha/C4/Circulation.pm line 3385.
4 - Apply patch and restart all
5 - Update database
6 - Set the rule to "" again
7 - Check the DB, no rule is stored
    SELECT * FROM circulation_rules WHERE rule_name = 'rentaldiscount';
8 - Checkout the item again
9 - No warns in log

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: DBRev 21.06.00.020
Jonathan Druart [Tue, 31 Aug 2021 08:15:28 +0000 (10:15 +0200)]
Bug 28373: DBRev 21.06.00.020

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: Add warning if custom stylesheets are defined
Nick Clemens [Mon, 30 Aug 2021 19:53:40 +0000 (19:53 +0000)]
Bug 28373: Add warning if custom stylesheets are defined

This patch adds a check of the current XSLT prefs and warns to check the new pref
if any are not set to default

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: Add note to XSLT prefs about the new pref
Nick Clemens [Mon, 30 Aug 2021 19:53:07 +0000 (19:53 +0000)]
Bug 28373: Add note to XSLT prefs about the new pref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: (follow-up) QA fixes
Nick Clemens [Mon, 23 Aug 2021 14:12:26 +0000 (14:12 +0000)]
Bug 28373: (follow-up) QA fixes

Use fully qualified subroutine name
Don't return explicit undef

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: (QA follow-up) Fix typo in system preference description
Katrin Fischer [Thu, 3 Jun 2021 21:47:42 +0000 (21:47 +0000)]
Bug 28373: (QA follow-up) Fix typo in system preference description

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28373: (QA follow-up) Add . to end of system preference description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: Add PassItemMarcToXSLT system preference
Nick Clemens [Tue, 18 May 2021 15:06:43 +0000 (15:06 +0000)]
Bug 28373: Add PassItemMarcToXSLT system preference

Default stylesheets do not reference item fields for XSLT display, however, we
spend time translating the values in the item fields.

This patch adds a system preference, PassItemMarcToXSLT. and unless enabled we remove
item fields before processing

To test:
1 - Perform some search on the staff client and opac
2 - Use the console (F12) to view the time spent on the network tab
3 - Note performance
4 - Apply patch, updatedatabase, restart_all
5 - Repeat searches
6 - Note that display has not changed
7 - Note performance, results should display slightly faster

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28373: Unit test
Nick Clemens [Tue, 6 Jul 2021 12:32:19 +0000 (12:32 +0000)]
Bug 28373: Unit test

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28885: Skip invalid biblios for OpacBrowseResults
Kyle M Hall [Thu, 19 Aug 2021 14:49:34 +0000 (10:49 -0400)]
Bug 28885: Skip invalid biblios for OpacBrowseResults

If a record is deleted from Koha, but is for some reason not deleted from the search indexes, OpacBrowseResults can cause an ISE if the deleted record is in the search results for any given item. OpacBrowseResults loops through the search results, and checks if there is a biblionumber, but does *not* check to see if a result was pulled from the database for that biblionumber. It simply assumes the result must exist.

We should be checking to ensure the biblionumber was valid before operating on the biblio object.

Test Plan:
1) Use zebra for searching
2) Disable koha-indexer
3) Enable OpacBrowseResults
4) Perform a search
5) Delete an item in the search results
6) View on of the remaining items in the search results
7) Note the error
8) Apply this patch
9) Restart plack
10) Reload the page
11) The error should be gone!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22690: Fix the tracklink feature
Jonathan Druart [Tue, 31 Aug 2021 06:23:01 +0000 (08:23 +0200)]
Bug 22690: Fix the tracklink feature

With the FK we must set to undef/NULL, not 0.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28376: Compiled CSS
Jonathan Druart [Mon, 30 Aug 2021 16:08:26 +0000 (18:08 +0200)]
Bug 28376: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28376: Replace jQueryUI date/timepicker with Flatpickr
Owen Leonard [Thu, 20 May 2021 15:48:58 +0000 (15:48 +0000)]
Bug 28376: Replace jQueryUI date/timepicker with Flatpickr

This patch is a proof of concept demonstrating how jQueryUI date & time
pickers could be replaced using the Flatpickr library
(https://flatpickr.js.org/).

NEW: I've modified the default configuration of Flatpickr instances so
that a "Clear date" link is automatically appended. This eliminates the
need to add a button to the markup and event handling for each case.

NEW: Date/time formatting should be corrected in this revised patch.

The patch modifies three pages as test cases:
 - Circulation -> Renew (with SpecifyDueDates enabled), to demonstrate
   date and time selection.
   - NEW: You can also test the datepicker shown when you renew an
     on-hold item. This demonstrates a configuration which requires that
     the selection be after today.
 - Administration -> Patron categories -> New category, to demonstrate a
   calendar-only date picker enforcing a date after today.
 - NEW: Reports -> Patrons. The "Date of birth" fields are linked so
   that the second cannot be before the first.

I've made some customizations to the default Flatpickr library's CSS and
incorporated it into staff-global.scss, so you must rebuild the staff
client SCSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

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>
2 years agoBug 26302: (follow-up) DBRev 21.06.00.019
Jonathan Druart [Mon, 30 Aug 2021 16:06:42 +0000 (18:06 +0200)]
Bug 26302: (follow-up) DBRev 21.06.00.019

oops

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26302: DBRev 21.06.00.019
Jonathan Druart [Mon, 30 Aug 2021 15:08:58 +0000 (17:08 +0200)]
Bug 26302: DBRev 21.06.00.019

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26302: (QA follow-up) Prefix prefs with OPAC
Marcel de Rooy [Mon, 30 Aug 2021 14:18:20 +0000 (14:18 +0000)]
Bug 26302: (QA follow-up) Prefix prefs with OPAC

git grep -l "ResultsMaxItems" | xargs sed -i -e "/ResultsMaxItems/ s/ResultsMaxItems/OPACResultsMaxItems/g"

And line:
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl:    <xsl:variable name="OPACResultsMaxItems" select="number(marc:sysprefs/marc:syspref[@name='resultsMaxItems']+0)"/>

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 26302: Make syspref's names start with uppercase
Jonathan Druart [Mon, 30 Aug 2021 13:18:40 +0000 (15:18 +0200)]
Bug 26302: Make syspref's names start with uppercase

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 26302: (QA follow-up) Prevent empty call numbers
Marcel de Rooy [Mon, 9 Aug 2021 11:55:11 +0000 (11:55 +0000)]
Bug 26302: (QA follow-up) Prevent empty call numbers

This does not make the code easier, but here we go:

Suppose resultsMaxItems == 2.
If we would normally list two call numbers like:
    Liberty (2) [Call number: PERL F 1, PERL F 2].
If one call number would be empty, we now list:
    Liberty (2) [Call number: PERL F 1, ...].
And when both are empty, we only show a number:
    Liberty (2).

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>
2 years agoBug 26302: (QA follow-up) Reset preference values
Marcel de Rooy [Mon, 9 Aug 2021 09:51:36 +0000 (09:51 +0000)]
Bug 26302: (QA follow-up) Reset preference values

Mimic current behavior.

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>
2 years agoBug 26302: Refactor Availability block in OPAC results xslt
Marcel de Rooy [Thu, 5 Aug 2021 11:43:16 +0000 (11:43 +0000)]
Bug 26302: Refactor Availability block in OPAC results xslt

Decided finally to do a larger refactor here. Hopefully we improved
consistency and removed some redundancy. And the two new prefs provide
additional functionality.

Most significant changes:
[1] Clearer distinction of the Availability line in three parts:
    Available, Reference and Unavailable.
    For Unavailable we loop thru branches now too.
[2] Calling template to list item data (including location or ccode).
    Made the separate Location line obsolete.
[3] The tests around OPACItemLibrary are removed since we now look at
    resultbranch from XSLT.pm.
[4] Removed code replication for various 'other' statuses like Checked out.
[5] Obsoleted three xslt key indexes, singleBranchMode.
[6] Apply the two prefs to control number of listed items.

Test plan:
You may play with: OPACResultsLibrary (home/holding), OPACItemLocation
(library, callno, location, ccode), resultsMaxItems[Unavailable] (numbers),
Reference_NFL_Statuses (list of notforloan codes in reference part).

[1] Create a biblio with various items on a few branches. Fill call number,
    location and ccode too. Set home branch and holdingbranch differently.
[2] Toggle the preferences, and verify display within OAPC search results.

Example with prefs (home, callnumber, 2, 2):
Availability: Items available for loan: Centerville (2)Call number: perl A 4, PERL D 1. Items available for reference: Fairfield: Not For Loan (1)Call number: PERL A 5. Not available: Centerville: Checked out (1)Call number: PERL A 3. Centerville: Ordered (1)Call number: PERL B 1. Centerville: Staff Collection (2)Call number: PERL A 2, PERL E 1. Centerville: Withdrawn (1)Call number: PERL B 2. Fairfield: Withdrawn (1)Call number: PERL C 1.

Same data with prefs (holding, callnumber, 2, 2):
Availability: Items available for loan: Centerville (1)Call number: PERL D 1. Liberty (1)Call number: perl A 4. Items available for reference: Centerville: Not For Loan (1)Call number: PERL A 5. Not available: Centerville: Checked out (1)Call number: PERL A 3. Centerville: Staff Collection (1)Call number: PERL A 2. Centerville: Withdrawn (1)Call number: PERL B 2. Fairfield: Ordered (1)Call number: PERL B 1. Fairfield: Withdrawn (1)Call number: PERL C 1. Liberty: Staff Collection (1)Call number: PERL E 1.

Same data with prefs (holding, library, n/a, n/a):
Availability: Items available for loan: Centerville (1). Liberty (1). Items available for reference: Centerville: Not For Loan (1). Not available: Centerville: Checked out (1). Centerville: Staff Collection (1). Centerville: Withdrawn (1). Fairfield: Ordered (1). Fairfield: Withdrawn (1). Liberty: Staff Collection (1).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
2 years agoBug 26302: Changes for substatus, resultbranch in XSLT.t
Marcel de Rooy [Thu, 5 Aug 2021 12:24:31 +0000 (12:24 +0000)]
Bug 26302: Changes for substatus, resultbranch in XSLT.t

Test plan:
Run t/db_dependent/XSLT.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
2 years agoBug 26302: Add resultbranch and other status in C4/XSLT
Marcel de Rooy [Thu, 5 Aug 2021 11:43:16 +0000 (11:43 +0000)]
Bug 26302: Add resultbranch and other status in C4/XSLT

Groundwork for changes in the OPAC results xslt.

NOTE: Adds both new prefs too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
2 years agoBug 26302: Add dbrev for two new prefs
Marcel de Rooy [Thu, 24 Jun 2021 13:43:20 +0000 (13:43 +0000)]
Bug 26302: Add dbrev for two new prefs

Adding two prefs:
    resultsMaxItems
    resultsMaxItemsUnavailable

Test plan:
Check Preferences/OPAC/Appearance.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
2 years agoBug 28736: fix requirements for the correct error message to show up
Petro Vashchuk [Mon, 26 Jul 2021 09:27:40 +0000 (12:27 +0300)]
Bug 28736: fix requirements for the correct error message to show up

There is existing error message in the code stating:
"Unable to understand your search query, please rephrase and try again."
which fits perfectly but because it looks for "ParseException" in the
warning output it doesn't show up on this page as it's actually
"parse_exception".

This patch makes that it's also checked if "parse_exception" is present
in the warning output.

Side note:
"ParseException" reaction code was added here:
    e0f6c4dc Bug 12478: improve error reporting a bit
Search::Elasticsearch seems propagates clean ES JSON answer,
and in current ES version inside of $@ it contains "parse_exception"
string in dumped JSON answer ("'type' => 'parse_exception'").
Old seeked phrase "ParseException" wasn't reproduced, only in ES logs
("Caused by: org.apache.lucene.queryparser.classic.ParseException:
 Cannot parse ..."). Check for both phrases won't complicate future
changes, but this note added for reference and code cleanup if needed.

To reproduce:
1) using ES search for something like "// ^ ! { } [ ] .. , <>" that
will for sure break the syntax of ES.
2) after the search query fails note that the error is
"Unable to perform your search. Please try again."
3) apply the patch
4) search for the same thing again
5) error message should be "Unable to understand your search query,
please rephrase and try again." now.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28843: Add view and edit buttons to result of MARC record import
Owen Leonard [Wed, 11 Aug 2021 12:21:19 +0000 (12:21 +0000)]
Bug 28843: Add view and edit buttons to result of MARC record import

This patch adds "View" and "Edit" buttons to the output of the result of
a MARC record import.

To test, apply the patch and go to Tools -> State MARC for import.

 - Import a file of MARC records.
 - Click the "Manage staged records" button.
 - In the table of staged records the last column labeled "Records"
   should be empty.
 - Click "Import this batch into the catalog."
 - The table of records will be shown again, and this time the last
   column should contain "View" and "Edit" buttons for each row.
 - Confirm that the buttons work correctly, opening the correct record
   for viewing and editing.

Test with both bibliographic and authority records to confirm that the
correct view and edit pages open for each.

EDIT: Add permission check for "Edit" link
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 24019: Patron batch modification based on borrowernumber
Owen Leonard [Wed, 19 May 2021 10:55:17 +0000 (10:55 +0000)]
Bug 24019: Patron batch modification based on borrowernumber

This patch adds batch patron modifications based on borrowernumber. The
user can choose to upload a file of borrowernumbers or submit a list of
borrowernumbers in a textarea, just like they can with card numbers.

To test, apply the patch and prepare files containing borrowernumbers
and card numbers. Patron lists should be enabled, and you should have at
least one patron list with patrons on it.

- Go to Tools -> Batch patron modification.
- You should see three tabs: "By card number," "By borrowernumber," and
  "By patron list."
- Test each option for batch patron modifications:
  - By card number file
  - By card number list
  - By borrowernumber file
  - By borrowernumber list
  - By patron list
- In each case the correct batch should be submitted, and modifications
  should finish correctly..
- There should be an "order of operations" for card numbers and
  borrowernumbers:
  - If a file is uploaded AND a list of numbers is entered, the list of
    numbers should be used.
- Batches should only get submitted from the active tab.
  - If you upload a file or enter card numbers in one tab and then
    switch to another tab and submit numbers from there, the original
    tab's batches should be ignored.

Signed-off-by: kelly mcelligott <kelly@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28456: Add WHERE option to membership_expiry cronjob
Nick Clemens [Tue, 25 May 2021 18:46:37 +0000 (18:46 +0000)]
Bug 28456: Add WHERE option to membership_expiry cronjob

Some libraries have a large amount of accounts and want to be able to limit how many email reminders they send.
Adding a where statement will allow for flexibility

To test:
1 - Set some borrowers to expire soon
2 - Set MembershipExpiryDaysNotice to 10
3 - perl misc/cronjobs/membership_expiry.pl -c -v -n --before 100 --after 100
4 - Note the patrons that yo uadjusted show up
5 - Limit by various patron fields, e.g.
    perl misc/cronjobs/membership_expiry.pl -c -v -n --before 100 --after 100 --where="lastseen IS NULL"
    perl misc/cronjobs/membership_expiry.pl -c -v -n --before 100 --after 100 --where="lastseen IS NOT NULL"
    perl misc/cronjobs/membership_expiry.pl -c -v -n --before 100 --after 100 --where="surname LIKE '%a%'"
    perl misc/cronjobs/membership_expiry.pl -c -v -n --before 100 --after 100 --where="surname NOT LIKE '%a%'"
6 - Confirm expected results
7 - perl misc/cronjobs/membership_expiry.pl
8 - Confirm the help message makes sense

Signed-off-by: Azucena Aguayo <azucena.aguayo@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Replace two inclue by include.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 20688: Add accesskeys for transfers
Nick Clemens [Wed, 26 May 2021 10:11:26 +0000 (10:11 +0000)]
Bug 20688: Add accesskeys for transfers

To test:
1 - Disable AutomaticItemReturn systme preference
2 - Check in an item that does not float at a branch no it's home
3 - Test new accesskeys for I,N,Y,P
4 - With transfer confirmed check the item in at a wrong branch
5 - Test accesskeys Y,P,X

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 20688: Add accesskeys to hold modals
Nick Clemens [Wed, 26 May 2021 09:57:37 +0000 (09:57 +0000)]
Bug 20688: Add accesskeys to hold modals

This patch adds accesskey elements to the hold modals during checkin

For tips on how to access the accesskeys:
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey

To test:
1 - Place some holds on items
2 - Check in an item with a hold at a branch that requires transfer
3 - Use accesskey I to ignore
4 - Use accesskey Y to confirm and transfer
5 - Check in again
6 - Use accesskey Y to confirm
7 - Repeat 4-6 with a new hold but use the accesskey P to print the slip
8 - Check in the item again ans use accesskey X to cancel

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 28830: Add cni index for 003
Martin Renvoize [Mon, 9 Aug 2021 11:06:30 +0000 (12:06 +0100)]
Bug 28830: Add cni index for 003

This patch adds the cni/Control-number-identifier index to enable
searches to use the 003 field.

Test plan
1/ Apply patch
2/ Re-index using updated configurations
3/ Confirm cni:number searches yield the expected results
4/ Signoff

Split-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 28838: add unique IDs to sco-main.tt impossible errors
Lucas Gass [Tue, 10 Aug 2021 14:18:23 +0000 (14:18 +0000)]
Bug 28838: add unique IDs to sco-main.tt impossible errors

To test:
1. Apply patch
2. Go SCO and try to checkout some items that will generate some of the
   following errors:

The system does not recognize this barcode.
You have checked out too many items and can't check out any more.
This item is checked out to someone else.
You cannot renew this item again.
This item is not for loan.
You owe the library [% DEBT | $Price %] and cannot check out.
This item has been withdrawn from the collection.
This item is restricted.
This item is on hold for another patron.
This item belongs to another branch.
Your account has expired.
Your account has been suspended.
This card has been declared lost.
Your contact information seems to be incomplete.
Due date is not valid.
Item must be checked out at a circulation desk.

3. The display should be exactly as it was without the patch but if you
   use the browsers dev tools you should be able to inscept each error
   message and see that it is now wrapped in a <span> with an ID.

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 28810: replace housebould detail inputs with textarea
Lucas Gass [Tue, 3 Aug 2021 21:24:17 +0000 (21:24 +0000)]
Bug 28810: replace housebould detail inputs with textarea

To test:
1. apply patch
2. enable housebound module
3. go to a patron and look at the housebound tab
4. Edit the detials.
5. The preferred materials, subjects, authors, referral, and note inputs should be replace with much larger textareas.
6. You should now be able to added line breaks, so fill out each of the fields adding some line breaks. I added something like:
Fiction authors: Frank Herbert
Non-fiction authors: Malcolm Gladwell

7. Save changes
8. Now when you look at the housebound details those line breaks should be preserved and much easier to read.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.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 28695: Add shelving location column to overdue.tt
Lucas Gass [Thu, 8 Jul 2021 20:57:58 +0000 (20:57 +0000)]
Bug 28695: Add shelving location column to overdue.tt

To test:
1. have some overdues
2. go to the overdue report on the circulation page (overdue.tt)
3. no shelving location
4. apply patch and restart the things
5. look at the overdue report again and there should be a Shelving location column
6. make sure it is accurate
7. go to table settings and make sure you can properly hide the column. test other columns in the table and make sure they are still hiding correctly as well

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
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>
2 years agoBug 28893: Remove unused opac/rss directory
Jonathan Druart [Wed, 25 Aug 2021 08:49:30 +0000 (10:49 +0200)]
Bug 28893: Remove unused opac/rss directory

RSS feeds are now generated using opac/opac-search.pl (format=rss).

But prior to
  commit 09df0de35fcb5b1645490bd3ec9d9a77ec7923a1
  Removing obsolete RSS <link> tags and the scripts
it was using opac/opac-rss.pl, which used opac/rss

The directory should have been removed by this commit.

Test plan:
Confirm that this directory is useless and can be removed.

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>