koha.git
3 years agoBug 27316: Convert 'undef' for sort to Yes and use Yes/No instead of 0/1
Nick Clemens [Thu, 7 Jan 2021 20:14:33 +0000 (20:14 +0000)]
Bug 27316: Convert 'undef' for sort to Yes and use Yes/No instead of 0/1

This patch changes the interface to remove the undef option
We also update existing mappings and set default of 1

Comment previously indicated undef was treated differently, but in the code we treat undef as 1
That code is untoched to avoid creating problems for older mappings that may be reloaded

To test:
1 - View the ES mappings, note you can set columns to Undef, 0, 1
2 - Set some to undef
3 - Apply patches
4 - Update database
5 - Undef now show as 'Yes'
6 - Confirm you can set columns as Yes/no
7 - Confirm that mandatory columns display correct value when readonly (see issues field)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 27680: Add support for param[] syntax
Tomas Cohen Arazi [Fri, 26 Feb 2021 17:44:23 +0000 (14:44 -0300)]
Bug 27680: Add support for param[] syntax

While not that common nowadays, it is the syntax PHP uses, and
DataTables also generates such thing in 'traditional' mode. We should
support it as well.

This patch adds support for that. It does so by adding _order_by[] to
the reserved param names, and proper handling on the dbic_merge_sorting
helper.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 27680: (QA follow-up) Minor perlcritic issue

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27680: Allow traditional multi-params to work
Martin Renvoize [Fri, 12 Feb 2021 19:25:10 +0000 (19:25 +0000)]
Bug 27680: Allow traditional multi-params to work

This patch allows the preceeding test to pass. Strictly, we want a comma
delimited string for our _order_by parameter, but we cannot easily block
a traditional multi-passed parameter.  As such the 'nice' thing to do is
handle it when such a thing is passed as it will pass through validation
regardless.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27680: Add tests for various ways of passing multi-params
Martin Renvoize [Fri, 12 Feb 2021 14:05:13 +0000 (14:05 +0000)]
Bug 27680: Add tests for various ways of passing multi-params

This patch adds unit test to increase the coverage of parameter that
accept multiple values.  There are a number of different ways end users
can send such parameters and we should test to ensure we are recieving
the correct option.

Options
`?param1=this&param1=that` - traditional multiple pass params
`?param1[]=this&param1[]=that` - php multiple pass params
`?param1=this,that` - comma delimited list param
`?param1=this|that` - pipe delimited list param

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27680: Add support for sorting fields with multiple data points
Martin Renvoize [Fri, 12 Feb 2021 13:14:16 +0000 (13:14 +0000)]
Bug 27680: Add support for sorting fields with multiple data points

This patch adds proper handling for sorting a single column that is
constructed of multiple data entities.. i.e `"data": "string1:string2"`

It does NOT add support for filtering on multiple columns yet.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27680: Take first order column for ordering
Jonathan Druart [Fri, 12 Feb 2021 09:53:27 +0000 (10:53 +0100)]
Bug 27680: Take first order column for ordering

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: remove libyaml-syck-perl, and lower libyaml-libyaml-perl to 0.41 (for...
Mason James [Thu, 18 Feb 2021 13:39:19 +0000 (02:39 +1300)]
Bug 27673: remove libyaml-syck-perl, and lower libyaml-libyaml-perl to 0.41 (for u16)

1/ apply patch
2/ build koha package
3/ confirm that libyaml-libyaml-perl package is installed, and
    libyaml-syck-perl is not

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27754: Correct eslint errors in basket.js
Owen Leonard [Mon, 22 Feb 2021 17:51:16 +0000 (17:51 +0000)]
Bug 27754: Correct eslint errors in basket.js

This patch makes minor changes to basket.js in the staff interface
templates in order to quiet warnings from ESLint. Besides whitespace,
most changes are to correct undeclared or unnecessarily declared
variables.

To test, apply the patch and verify that the cart still works
correctly.

 - Perform a catalog search in the staff interface.
 - Test adding single or multiple items to the cart from the search
   results page.
 - Testing adding and removing titles to the cart from the bibliographic
   detail page.
 - Open the cart and test the various controls in the toolbar to confirm
   that they still work correctly.

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 27578: Initialize searchid as blank when not populated
Nick Clemens [Fri, 29 Jan 2021 13:47:22 +0000 (13:47 +0000)]
Bug 27578: Initialize searchid as blank when not populated

This patch simply sets the searchid to a blank string if not passed in

To test:
1 - Add a new biblio and save it
2 - Check the logs: /var/log/koha/kohadev/plack-intranet-error.log (or similar)
3 - Note warn about uninitialized value
4 - Apply patch
5 - Add a new biblio
6 - No warn

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 25777: Disable misleading datatables table information display z3950
David Cook [Wed, 17 Jun 2020 04:34:02 +0000 (04:34 +0000)]
Bug 25777: Disable misleading datatables table information display z3950

This patch disables the table information display on z3950_search.pl,
since it only includes search result counts for that page, which is
misleading to end users.

To test:
1)  Do not apply the patch
2)  Do a Z39.50 search from cataloguing for "test" against Library of
    Congress.
3)  Note the bottom of the page says "Show 1 to 20 of 20" and
    "Showing page 1 of 501"
4)  Do a Z39.50 search from Acquisitions for "test" against Library of
    Congress (Acquisitions -> Vendor -> Basket -> Add to basket -> From
    external source).
5)  Apply the patch and restart Plack
6)  Repeat Step #2
7)  Note the bottom of the page now only says "Showing page 1 of 501"
8)  Note the search bar is gone
9)  Repeat step #4
10) Note the bottom of the page now only says "Showing page 1 of 501"
11) Note the search bar is gone

Squashed and mixed authorship added below
Co-authored-by: Owen Leonard <oleonard@myacpl.org>
Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27798: Add warning to IndependentBranches system preference
Kyle M Hall [Thu, 25 Feb 2021 18:33:31 +0000 (13:33 -0500)]
Bug 27798: Add warning to IndependentBranches system preference

Test Plan:
1) Apply this patch
2) Search system preferences for IndependentBranches
3) Note the warning about changing the setting on a production system

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD Amended patch:
* Fix commit title
* Don't split the syspref's description, otherwise the sentence will be
split in the POs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27718: (follow-up) add missing return
Andrew Nugged [Wed, 24 Feb 2021 09:45:07 +0000 (11:45 +0200)]
Bug 27718: (follow-up) add missing return

Missing return doesn't allowed for "wantarray" state to DBIXc so sub returned scalar in any context.

Also blank line to match with coding style removed.

Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27718: (bug 24488 follow-up) Hide items not holdable
Jonathan Druart [Wed, 17 Feb 2021 15:11:52 +0000 (16:11 +0100)]
Bug 27718: (bug 24488 follow-up) Hide items not holdable

After bug 24488 was merged Holds to Pull list (/cgi-bin/koha/circ/pendingreserves.pl)
doesn't respect anymore the 'holdallowed' circulation rules (we bisected it to this change).
If we look at the patch "Bug 24488: Show correct first patron details on Holds to pull"
(2285c2d6575) then we can notice that previously the items that were shown in the list
must had holdallowed != 0:

Now it seems like similar circ rule check is missing in the newly rewritten Holds To Pull implementation.
(description copied from comment 0)

Test plan:
Have several pending holds
Mark some item type as not holdable in the circulation rules
Confirm that the non holdable items are no longer listed on the "Holds
to pull" view

Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27718: Add tests
Jonathan Druart [Wed, 17 Feb 2021 15:11:19 +0000 (16:11 +0100)]
Bug 27718: Add tests

Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 7806: DBRev 20.12.00.014
Jonathan Druart [Mon, 1 Mar 2021 10:27:20 +0000 (10:27 +0000)]
Bug 7806: DBRev 20.12.00.014

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 7806: (follow-up) Update to use sanitize_zero_date
Martin Renvoize [Wed, 24 Feb 2021 15:07:38 +0000 (15:07 +0000)]
Bug 7806: (follow-up) Update to use sanitize_zero_date

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>
3 years agoBug 7806: Fix remaining occurrences of 0000-00-00
Jonathan Druart [Fri, 18 Dec 2020 14:16:11 +0000 (15:16 +0100)]
Bug 7806: Fix remaining occurrences of 0000-00-00

We should remove all SQL queries that contain 0000-00-00 and finally
assume we do not longer have such value in our DB (for date type)

We already dealt with such values in previous update DB entries.
The 2 added by this one haven't been replaced already.

The code will now assume that either a valid date exist, or NULL/undef.

Test plan:
QA review is needed and test of the different places where code is
modified.

Not sure about the change from reports/issues_avg_stats.pl

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>
3 years agoBug 27821: Make sanitize_zero_date support datetime and timestamp
Jonathan Druart [Mon, 1 Mar 2021 10:14:32 +0000 (11:14 +0100)]
Bug 27821: Make sanitize_zero_date support datetime and timestamp

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26363: Change SyslogIdentifier to match koha-worker script style
David Cook [Tue, 5 Jan 2021 05:08:54 +0000 (05:08 +0000)]
Bug 26363: Change SyslogIdentifier to match koha-worker script style

This patch changes the SyslogIdentifier so that it matches
the style used by koha-worker.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26363: Provide a systemd unit file for koha-worker in package installs
David Cook [Tue, 6 Oct 2020 06:33:05 +0000 (06:33 +0000)]
Bug 26363: Provide a systemd unit file for koha-worker in package installs

While the packages already have a koha-zebra script that creates a service
using the 'daemon' utility, this unit file template provides an alternative.

Note that currently you'd have to start the service using the following:

```systemctl start koha-worker@NAME.service```

Where NAME is the name of your Koha instance.

The systemctl enable/start commands could be automated more with helper
scripts in debian/scripts, but this is a first step.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26363: Provide a systemd unit file for koha-worker for source installs
David Cook [Tue, 6 Oct 2020 06:30:56 +0000 (06:30 +0000)]
Bug 26363: Provide a systemd unit file for koha-worker for source installs

This patch adds a systemd unit file which gets rewritten according to
the configuration specified by Makefile.PL. This can be linked or
copied to systemd directories for running a systemd service for
background_jobs_worker.pl

Test plan:
1. perl Makefile.PL
1a. Choose "single" installation
1b. Choose "/opt/koha" for a file path
2. make
3. vi blib/KOHA_CONF_DIR/koha-worker.service
4. Verify that PERL5LIB, KOHA_CONF, ExecStart, and SyslogIdentifier
all appear to be correctly filled in

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26457: (QA follow-up) Switch to PK index in UPDATE on issues
Marcel de Rooy [Fri, 26 Feb 2021 10:26:27 +0000 (10:26 +0000)]
Bug 26457: (QA follow-up) Switch to PK index in UPDATE on issues

The deadlock reports tell us that multiple transactions are
waiting for a X lock on a record but using a secondary index
on borrowernumber and itemnumber. Since we have the issue_id
at hand already, we should use that and benefit from the clustered
index (on PK) instead of using a secondary index.

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 26457: Unit test
Nick Clemens [Thu, 24 Dec 2020 12:22:49 +0000 (12:22 +0000)]
Bug 26457: Unit test

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 26457: Throw exception if update of issues table fails
Nick Clemens [Fri, 4 Dec 2020 12:03:52 +0000 (12:03 +0000)]
Bug 26457: Throw exception if update of issues table fails

While this won't prevent the deadlock, it should catch the case where
a deadlock causes the DB update to fail and provide feedback to the user
and rollback the transaction

I don't know how to trigger the deadlock, I can only confirm that we see it, and
that this should catch it.

To test:
1 - Apply patches
2 - Checkout several items to a patron
3 - Confirm that 'Renew all' feature continues to work as expected and all items are renewed

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 27071: (follow-up) Get rid of loop
Tomas Cohen Arazi [Mon, 22 Feb 2021 12:27:12 +0000 (09:27 -0300)]
Bug 27071: (follow-up) Get rid of loop

This patch gets rid of a loop on the librarary's groups siblings, and
acknowledges ->get_hold_libraries returns a proper Koha::Libraries
iterator that can be chained with a new query on the passed branchcode.
This way we only fetch  a count from the DB and no loop needs to take
place on the code.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Libraries.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: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27071: (follow-up) Provide a more meaningful error message
Tomas Cohen Arazi [Tue, 9 Feb 2021 15:26:50 +0000 (12:26 -0300)]
Bug 27071: (follow-up) Provide a more meaningful error message

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27071: Use GetReservesControlBranch to pick the branch
Tomas Cohen Arazi [Tue, 9 Feb 2021 15:14:19 +0000 (12:14 -0300)]
Bug 27071: Use GetReservesControlBranch to pick the branch

Pretty much like the opac-reserve.pl does, this patch makes the staff
request.pl script get the branch from the specialized routine from
C4::Reserves instead of falling back to userenv.

To test:
1. Follow the original test plan:
- Create two local hold groups containing distinct lists of libraries.
- In default rules for all libraries, set Hold Policy = "From local hold group" and Hold pickup library match to "Patron's hold group"
- Make sure AllowHoldPolicyOverride is set to Don't Allow

- Make sure you're logged in at a library in Group 1
- Find a bib with only 1 item from Group 1. Confirm you can place a hold on this title for a patron in Group 1 (correct), but not for a patron in Group 2 (correct).
- Find a bib with only 1 item from Group 2. Confirm you cannot place a hold for a patron from Group 1 (correct), BUT you also cannot place a hold for a patron from Group 2 (incorrect) -- Koha gives the erroneous message "pickupNotInHoldGroup"

- Change your library to a something in Group 2
- Find a bib with only 1 item from Group 1. Confirm you cannot place a hold on this title for a patron in Group 1 (incorrect), and not for a patron in Group 2 (correct).
- Find a bib with only 1 item from Group 2. Confirm you cannot place a hold for a patron from Group 1 (correct), but you can place a hold for a patron from Group 2 (correct)
=> FAIL: Things expected to fail on the plan, fail.
2. Apply this patches
3. Repeat 1
=> SUCCESS: It now works!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27071: More tests for Koha::Library->validate_hold_sibling
Tomas Cohen Arazi [Tue, 24 Nov 2020 14:55:14 +0000 (11:55 -0300)]
Bug 27071: More tests for Koha::Library->validate_hold_sibling

This patch adds tests for more than one non-same sibling libraries in
the hold group. Tests pass which means it is working as expected.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Libraries.t
=> SUCCESS: Tests pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27071: Code simplification
Jonathan Druart [Mon, 23 Nov 2020 14:52:56 +0000 (15:52 +0100)]
Bug 27071: Code simplification

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27071: Fix Hold pickup library when using hold groups
Jonathan Druart [Mon, 23 Nov 2020 14:49:35 +0000 (15:49 +0100)]
Bug 27071: Fix Hold pickup library when using hold groups

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27715: (QA follow-up) Remove conditional declaration
Marcel de Rooy [Sat, 20 Feb 2021 09:57:20 +0000 (09:57 +0000)]
Bug 27715: (QA follow-up) Remove conditional declaration

Resolves:
FAIL critic # Variables::ProhibitConditionalDeclarations: Got 1 violation(s).

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 27715: Use $dbh->quote_identifier to quote untrusted input
Joonas Kylmälä [Fri, 19 Feb 2021 12:18:15 +0000 (14:18 +0200)]
Bug 27715: Use $dbh->quote_identifier to quote untrusted input

The sanitization using regex and \w class of characters might be
enough but given the vast number of unicode characters in \w and
possibility of in the future the database engines interpreting some of
those characters with special meaning it is better to wrap the column
identifier to quotes using $dbh->quote_identifier so it is only
interpreted as identifier and nothing else.

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>
3 years agoBug 27715: Add a deprecation notice
Jonathan Druart [Thu, 18 Feb 2021 14:54:56 +0000 (15:54 +0100)]
Bug 27715: Add a deprecation notice

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
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 27715: Sanitize order by DT params
Jonathan Druart [Thu, 18 Feb 2021 14:49:40 +0000 (15:49 +0100)]
Bug 27715: Sanitize order by DT params

We are not on the safe side when we build the ORDER BY clause from the
DataTables parameters.

I've started to limit the columns by using Koha::Objects->columns, but
for instance for the patron search we need (at least) the columns from
the branches, categories and members tables.
It seems easier, and still safe, to use a regex.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
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 27715: Add tests
Jonathan Druart [Thu, 18 Feb 2021 14:42:48 +0000 (15:42 +0100)]
Bug 27715: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Amended: chmod 755.

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 27715: Remove unused dt_build_having
Jonathan Druart [Thu, 18 Feb 2021 13:49:02 +0000 (14:49 +0100)]
Bug 27715: Remove unused dt_build_having

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Amended: removed warn.

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 27715: Remove unused build_dt_query
Jonathan Druart [Thu, 18 Feb 2021 13:47:03 +0000 (14:47 +0100)]
Bug 27715: Remove unused build_dt_query

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
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 27661: Compiled CSS
Jonathan Druart [Tue, 23 Feb 2021 12:20:08 +0000 (13:20 +0100)]
Bug 27661: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27593: Consistent behavior for club holds route
Tomas Cohen Arazi [Tue, 2 Feb 2021 14:22:50 +0000 (11:22 -0300)]
Bug 27593: Consistent behavior for club holds route

This patch:
- Fixes a malformed response when biblio_id is invalid
- Fixes the return status (400 => 404) when biblio_id is invalid
- Adapts the error strings to be consistent with the Cities.pm file

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27593: Regression tests
Tomas Cohen Arazi [Tue, 2 Feb 2021 14:18:27 +0000 (11:18 -0300)]
Bug 27593: Regression tests

This patch introduces tests for the behaviour change (400 => 404) and
also adds tests for untested (error) behaviours. Notably, the 'Biblio
not found' problematic return value couldn't be triggered, because the
OpenAPI plugin returns a 500 because the response was malformed
(expected { error => 'message' } and it was returning a string).

For the above reason, running the regression tests will show a 500...
instead of the expected 400.

I covered the rest of the codepaths that trigger errors to have full
coverage.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/clubs_holds.t
=> FAIL: Tests fail loudly

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 27733: Add "_sort_by" paramter to pickup_locations API query
Owen Leonard [Fri, 19 Feb 2021 14:42:49 +0000 (14:42 +0000)]
Bug 27733: Add "_sort_by" paramter to pickup_locations API query

On the place hold page in the staff interface, add a "_sort_by"
parameter with the "name" value so that the list of libraries is
returned in name order.

To test, apply the patch and locate a title in the staff interface which
has holds on it.

- View the holds information for that title.
- In the table of exising holds, expand the "Pickup library" dropdown
  for any of the entries. The list of libraries should be in order by
  library name.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27732: JavaScript error on place hold page in the staff interface
Owen Leonard [Fri, 19 Feb 2021 14:27:08 +0000 (14:27 +0000)]
Bug 27732: JavaScript error on place hold page in the staff interface

This patch moves the "$.fn.select2.defaults" definition from the top of
the page to the bottom so that jQuery will be loaded first.

The patch also changes the "dropdownAutoWidth" default so that the
dropdown is sized correctly for its contents, regardless of the width of
the initial <select>.

To test, apply the patch and place a hold in the staff interface for a
title which already has existing holds.

- On the "Place a hold" page, before selecting a patron, you should see
  a table of exising holds. Test the "Pickup library" dropdown. It should
  work correctly.
- The width of the dropdown should accommodate its contents without
  forcing any library name to wrap.
- There should be no errors in the browser console.

Signed-off-by: David Nind <david@davidnind.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 27713: Duplicate search field IDs in MARC framework administration template
Owen Leonard [Tue, 16 Feb 2021 13:48:04 +0000 (13:48 +0000)]
Bug 27713: Duplicate search field IDs in MARC framework administration template

This patch makes a minor change to the MARC framework administration
template so that the ID of a form field on the page isn't a duplicate of
one in the header search form.

To test, apply the patch and go to Administration -> MARC bibliographic
framework -> MARC structure.

- Test the "Search for tag" form field to confirm that it works
  correctly.
- Validate the HTML of the page to confirm that there are no "Duplicate
  ID" errors.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27332: Hide branchcode and note is RenewSerialAddsSuggestion if off
Jonathan Druart [Tue, 5 Jan 2021 08:54:54 +0000 (09:54 +0100)]
Bug 27332: Hide branchcode and note is RenewSerialAddsSuggestion if off

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27332: Use the branchcode from the subscription when renewing
Jonathan Druart [Tue, 5 Jan 2021 07:10:33 +0000 (08:10 +0100)]
Bug 27332: Use the branchcode from the subscription when renewing

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27661: Use td.bg-success for ES and memcached as well
Jonathan Druart [Fri, 19 Feb 2021 07:57:25 +0000 (08:57 +0100)]
Bug 27661: Use td.bg-success for ES and memcached as well

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 27661: (QA follow-up) Use bootstrap classes
Martin Renvoize [Thu, 18 Feb 2021 16:56:21 +0000 (16:56 +0000)]
Bug 27661: (QA follow-up) Use bootstrap classes

This patch removes the local status_* css rules in favour of using the
bg-* rules that are shipped with the bootstrap version we are using and
then updates the relevant lines in the template to use those classes.

We also update the default table styling which adds background color to
the odd table rows so that our local classes take precidence.

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>
3 years agoBug 27661: (QA follow-up) Capitalization
Katrin Fischer [Fri, 12 Feb 2021 15:41:24 +0000 (15:41 +0000)]
Bug 27661: (QA follow-up) Capitalization

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
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 27661: Update about for message broker status
Martin Renvoize [Tue, 9 Feb 2021 13:53:55 +0000 (13:53 +0000)]
Bug 27661: Update about for message broker status

This patch updates the about page with regards to the message broker
status and adds some small formatting improvements for displaying the
status.

Test plan
1/ Run through the yarn build process to update the CSS file.
2/ View the about page without RabbitMQ installed
3/ View the about page with RabbitMQ installed
4/ Note the formatting and message change and signoff

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
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 27729: Fix use of grep and split in CheckReserves
Marcel de Rooy [Fri, 19 Feb 2021 10:17:26 +0000 (10:17 +0000)]
Bug 27729: Fix use of grep and split in CheckReserves

A few lines of code were added to CheckReserves containing the wrong
use of two perl functions: grep and split on bug 25232.
A test was added even making these things pass.

Test plan:
Run t/db../Holds.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@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 27014: (QA follow-up) Add regression tests
Martin Renvoize [Tue, 12 Jan 2021 11:15:28 +0000 (11:15 +0000)]
Bug 27014: (QA follow-up) Add regression tests

This patch adds a regression test for the change introduced in the
patchset.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash
Kyle M Hall [Fri, 13 Nov 2020 13:24:43 +0000 (08:24 -0500)]
Bug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash

Caused by bug 23403 - when performing a checkin we lookup the SIP patron
using the borrowernumber, however, SIP only knows how to find a patron
via cardnumber or userid

The change on 23403 was to avoid using an 'id' that didn't always exist
(as some users don't have a userid or cardnumber

When checking in, however, we are not passed a user cardnumber or
borrowernumber, so we don't have those on hand to get the patron.

Test Plan:
1) Check in an item via SIP, note patron is not found
2) Apply this patch
3) Restart all the things!
4) Check in an item via SIP, patron should be found!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27714: Prevent Koha::NewsItem->author to explode
Jonathan Druart [Wed, 17 Feb 2021 11:03:56 +0000 (12:03 +0100)]
Bug 27714: Prevent Koha::NewsItem->author to explode

If the author of a news has been removed, Koha::NewsItem->author must
not explode

DBIC result _type  isn't of the _type Borrower at t/db_dependent/Koha/News.t line 68.

Test plan:
 prove t/db_dependent/Koha/News.t
must return green, and changes must be consistent

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 23675: Add leader and default value for ACQ
Jonathan Druart [Mon, 8 Feb 2021 10:52:17 +0000 (11:52 +0100)]
Bug 23675: Add leader and default value for ACQ

When UseACQFrameworkForBiblioRecords is set, the ACQ framework will be
use when ordering.
But the leader is not defined for this framework and then we will face
encoding issues (I haven't go far investigating this as the suggested
solution worked correctly).

The idea is to define a 000 and default to '     nam a22     7a 4500'
(which is what returns the marc21_leader.pl plugin) for ACQ.

Test plan:
0. Apply this patch and reset_all
1. Create a new basket and place a new order
2. Note that the leader is now displayed on top of the other ACQ
subfields
3. Fill in 245 with "❤️", "ö" or other UTF-8 characters you like
4. Save
5. Notice that 245$a in biblio_metadata is correctly filled with the
title you entered

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26051: We should sort callnumber based on cn-sort
Nick Clemens [Fri, 8 Jan 2021 13:14:42 +0000 (13:14 +0000)]
Bug 26051: We should sort callnumber based on cn-sort

In zebra we sort by callnumber using 8007 cn-sort

We should do the same in elasticsearch

To test:
1 - Have Koha using Elasticsearch
2 - Perform a search
3 - Attempt to sort by callnumber
4 - Error in logs: No mapping found for [local-classification__sort]
5 - Apply patch
6 - Restart all
7 - Perform a search and sort by callnumber
8 - Success!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: David Nind <david@davidnind.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 26051: Add sort=1 on cn-sort in mappings.yaml
Fridolin Somers [Fri, 22 Jan 2021 08:02:11 +0000 (09:02 +0100)]
Bug 26051: Add sort=1 on cn-sort in mappings.yaml

Signed-off-by: David Nind <david@davidnind.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 23929: Invoice adjustments should filter inactive funds
Blou [Tue, 26 Jan 2021 20:36:31 +0000 (15:36 -0500)]
Bug 23929: Invoice adjustments should filter inactive funds

Looking at invoice details, this makes the Adjustments Fund dropdown act
exactly like the Shipping Fund dropdown above, with a Show inactive
checkbox to help filter (by default) the inactive funds out of the list.

Test plan:
0) requires a database with inactive (old) funds along with active ones.
1) Go to invoice details page
2) Click "Add adjustment"
3) Open the drop down beside the Fund label, you should see EVERY fund in database.
4) Compare with behavior of Shipping fund dropdown above.  Not every fund is listed there
5) Apply patch
6) Now behavior is the same, only active fund are listed by default.
7) click "Show inactive" checkbox and see all the funds in the dropdown.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27731: Remove hold class from individual OPAC search result hold link
Owen Leonard [Fri, 19 Feb 2021 11:46:16 +0000 (11:46 +0000)]
Bug 27731: Remove hold class from individual OPAC search result hold link

This patch removes the "hold" class from the "Place hold" link
associated with each search result in the OPAC. The class isn't required
for any functionality or style and it unintentionally triggers the "hold
multiple" JS function which requires that a checkbox be checked.

To test, apply the patch and log into the OPAC as a user who can place
holds.

- Perform a catalog search which will return multiple results.
- Click the "Place hold" link under any search result.
- You should be taken to the hold confirmation page.
- On the search results page, confirm that the "Place hold" link at the
  top of the search results still works to place multiple holds at once.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistration...
Jonathan Druart [Thu, 4 Feb 2021 16:37:26 +0000 (17:37 +0100)]
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail

If categorycode is selected in
PatronSelfRegistrationBorrowerUnwantedField and
PatronSelfRegistrationVerifyByEmail is turned on, the patron self registration
fails with

   [You must provide a patron's category to validate password's strength
   and length] at /usr/share/perl5/Exception/Class/Base.pm line 88

Test plan:
0. Select categorycode in PatronSelfRegistrationBorrowerUnwantedField
   and turn on PatronSelfRegistrationVerifyByEmail
1. Self register a patron
2. Confirm that it works as expected with this patch applied.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27534: Add missing ON UPDATE/DELETE clause to message_transport_type_fk
Jonathan Druart [Wed, 27 Jan 2021 08:43:02 +0000 (09:43 +0100)]
Bug 27534: Add missing ON UPDATE/DELETE clause to message_transport_type_fk

Bug 9016 (3.15.00.039) added message_transport_type_fk but the ON DELETE
CASCADE ON UPDATE CASCADE clause was missing from the updatedatabase
entry.
If we are upgrading from an old version, 20.06.00.058 will fail on
updating the message_transport_type, with
"Cannot delete or update a parent row: a foreign key constraint fails".

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26997: (QA follow-up) Fix Typo
Martin Renvoize [Fri, 19 Feb 2021 12:14:55 +0000 (12:14 +0000)]
Bug 26997: (QA follow-up) Fix Typo

Feel free to squash this ;)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26997: CAST AS CHAR to prevent the error
Jonathan Druart [Fri, 19 Feb 2021 09:52:45 +0000 (10:52 +0100)]
Bug 26997: CAST AS CHAR to prevent the error

To prevent the DBMS to fail on 0000-00-00 we can cast it as a char and
compare.
This patch also moves to a subroutine, in case we need to adjust (or
reuse) it later.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26997: Remove 0000-00-00 from aqorders.datecancellationprinted
Jonathan Druart [Fri, 13 Nov 2020 12:59:46 +0000 (13:59 +0100)]
Bug 26997: Remove 0000-00-00 from aqorders.datecancellationprinted

This patch remove the 0000-00-00 from the WHERE condition from
ordered.pl and spent.pl to prevent an error under MySQL 8

It also fixes the wrong values in DB (if possible, ie. under other DBMS
that MySQL 8)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26997: Fix upgrade process under MySQL 8
Jonathan Druart [Wed, 11 Nov 2020 13:22:50 +0000 (14:22 +0100)]
Bug 26997: Fix upgrade process under MySQL 8

If you are coming from an old version of Koha, you may face an upgrade
error for the SQL query using 0000-00-00.
The idea was to fix it, but actually the DBMS will raise an error (not
blocking the upgrade process however).

We can hide them to not cause confusion

Errors are like:
DBD::mysql::db do failed: Incorrect date value: '0000-00-00' for column 'suggesteddate' at row 1 [for Statement "UPDATE suggestions SET suggesteddate = '1970-01-01' WHERE suggesteddate = '0000-00-00';"] at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 23312.

Test plan:
Checkout an old version of Koha (3.20, not older)
Insert a dump, install Koha
Checkout a recent version of Koha, apply the patch (or use master)
Execute the upgrade process
You should not see the errors

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26208: Perform batch checkin/renewals serially rather than asynchronously
Nick Clemens [Thu, 3 Dec 2020 19:13:15 +0000 (19:13 +0000)]
Bug 26208: Perform batch checkin/renewals serially rather than asynchronously

The issue here seems to be that when multiple requests hit at once they may not register that the renewal
performed by the request should lift restrictions on the account.

To mitigate this we can simply perform the renewals one after the other.

To test:
1 - have multiple overdue items on one patron
2 - run overdues.pl with triggers set to generate a restriction
3 - renew all overdues with the Renew All button
4 - restriction is not removed even though patron no longer has overdue items
5 - Apply patch
6 - Make all items overdue again
7 - Click Renew All
8 - Items are renewed and restriction removed
9 - Checkout items to patron again (overdue or not)
10 - Click 'Select all' in checkin column
11 - Click 'Renew/Checkin selected items'
12 - Confirm checkin succeeds as before patches

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26208: (follow-up) Remove debugging statements

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27131: Improve POD for the new method
Jonathan Druart [Thu, 18 Feb 2021 11:00:42 +0000 (12:00 +0100)]
Bug 27131: Improve POD for the new method

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27694: use HTML filtering on News Tool textarea
Lucas Gass [Fri, 12 Feb 2021 15:57:22 +0000 (15:57 +0000)]
Bug 27694: use HTML filtering on News Tool textarea

To test:
1. Add some HTML enties to your codemirror in the News Tool. Example: <option value="(itype:DVD and loc:*NEW) AND NOT index-term-genre:&quot;television&quot;">Movies</option>
2. Save and re-eneter the tool, the HTML entites have been converted
3. Apply patch
4. Try again, HTML entities should not be converted

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27131: (QA follow-up) POD and comments
Marcel de Rooy [Thu, 18 Feb 2021 07:47:11 +0000 (07:47 +0000)]
Bug 27131: (QA follow-up) POD and comments

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 27131: Add tests for get_items_that_can_fill
Jonathan Druart [Tue, 5 Jan 2021 08:29:07 +0000 (09:29 +0100)]
Bug 27131: Add tests for get_items_that_can_fill

Signed-off-by: Andrew Nugged <nugged@gmail.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 27131: Add get_items_that_can_fill
Jonathan Druart [Wed, 2 Dec 2020 08:23:42 +0000 (09:23 +0100)]
Bug 27131: Add get_items_that_can_fill

Signed-off-by: Andrew Nugged <nugged@gmail.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 24469: Move the new queries to a dedicated ImportBatch subroutine
Jonathan Druart [Fri, 12 Feb 2021 09:27:43 +0000 (10:27 +0100)]
Bug 24469: Move the new queries to a dedicated ImportBatch subroutine

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: POD line for $import_record_id.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24469: Record biblionumber in import_biblio when adding to basket via file
Jonathan Druart [Wed, 12 Feb 2020 15:22:02 +0000 (16:22 +0100)]
Bug 24469: Record biblionumber in import_biblio when adding to basket via file

The column import_biblios.matched_biblionumber was not populated when an
order is created from a staged file.

Test plan:
A/ Create a new order from a stage file.
Use the "Save" button at the bottom of the "Add orders from" page
Then note the matched_biblionumber value. It should be populated correctly

B/ Import again the same record, this time you will have to use the "Add
order" link in the list of order (ie. not the "Save" button)
Note the matched_biblionumber value. It should be populated correctly

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Sarah Daviau <sdaviau@arlingtonva.us>
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 27719: Apply _escape_str and _escape_price where needed
Agustin Moyano [Wed, 17 Feb 2021 15:49:32 +0000 (12:49 -0300)]
Bug 27719: Apply _escape_str and _escape_price where needed

This bug replaces calls for .escapeHtml and format_price for there null
checking counterparts

To test:

1: have a fresh Koha Testing Docker
2: have a basket set to create item records on ordering
3: populate basket from a marc file, only setting price and fund for the items
4: close basket
5: click to Receive, create invoice
6: on parcel.pl, "Processing" alert never resolves
CHECK => The console shows:
parcel.pl?invoiceid=1:810 Uncaught TypeError: Cannot read property 'format_price' of null
    at render (parcel.pl?invoiceid=1:810)
    at datatables.min_20.1200012.js:57
    at Object.b.fnGetData (datatables.min_20.1200012.js:51)
    at B (datatables.min_20.1200012.js:56)
    at Ha (datatables.min_20.1200012.js:64)
    at P (datatables.min_20.1200012.js:68)
    at vb (datatables.min_20.1200012.js:79)
    at datatables.min_20.1200012.js:76
    at i (datatables.min_20.1200012.js:74)
    at Object.success (datatables.min_20.1200012.js:75)

And that error points toward:
                        "data": "replacement_price",
                        "render": function(data, type, row, meta) {
                            return (row.replacement_price).format_price();
                        },
                    },
7: apply patch
8: redo steps 5 and 6
SUCCESS => "Processing" alert doesn't hangs, and prices with null values
are empty.

Sponsored-by: Virginia Polytechnic Institute and State University
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>
3 years agoBug 24108: DBRev 20.12.00.013
Jonathan Druart [Wed, 17 Feb 2021 15:28:41 +0000 (15:28 +0000)]
Bug 24108: DBRev 20.12.00.013

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24108: Remove extra spaces
Jonathan Druart [Tue, 16 Feb 2021 11:17:29 +0000 (12:17 +0100)]
Bug 24108: Remove extra spaces

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24108: (QA follow-up) Add staff detail page to syspref description
Katrin Fischer [Mon, 15 Feb 2021 21:48:04 +0000 (22:48 +0100)]
Bug 24108: (QA follow-up) Add staff detail page to syspref description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24108: (QA follow-up) Add missing comma in sysprefs.sql
Katrin Fischer [Mon, 15 Feb 2021 21:47:28 +0000 (22:47 +0100)]
Bug 24108: (QA follow-up) Add missing comma in sysprefs.sql

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24108: Make export file names consistent
Nick Clemens [Mon, 11 Jan 2021 14:57:45 +0000 (14:57 +0000)]
Bug 24108: Make export file names consistent

This patch renames the systempreference to be a bit clearer and uses
explicit options rather than a yes/no

Additionally it standardizes the export from the advanced cataloging editor
with that from the details page

To test:
 1 - Apply patches
 2 - Update database and restart all the things
 3 - Open a record in the advanced editor and save it as marc and xml
 4 - Note the file name is 'bib-{biblionumber.{format}'
 5 - Edit the syspref 'DefaultSaveRecordFileID' to be control number
 6 - Repeate 3-4 on a record with and without a control number
 7 - If control number present fiule name should be 'record-{controlnumber}.{format}'
 8 - Otherwise it should be as above
 9 - Repeat tests from the details page of a record
10 - Repeat tests from the opac details page of a record

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 24108: (QA follow-up) Adjust wording and use perl for update file
Nick Clemens [Mon, 11 Jan 2021 14:08:35 +0000 (14:08 +0000)]
Bug 24108: (QA follow-up) Adjust wording and use perl for update file

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 24108: (follow-up) Fix typo with .xml extension
John Doe [Tue, 1 Dec 2020 18:45:50 +0000 (18:45 +0000)]
Bug 24108: (follow-up) Fix typo with .xml extension

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch:
* Fix author's patch

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24108: Advanced editor: configure if biblionumber or control number is used for...
Cori Lynn Arnold [Tue, 1 Dec 2020 18:16:23 +0000 (18:16 +0000)]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" (renamed in
follow-up patch with "DefaultSaveRecordFileID") which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch:
* Remove change to obsolete sysprefs.sql
* Fix author's patch
* Update commit message to tell the syspref has been renamed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26274: (QA follow-up) Fix the order of summary groups
Martin Renvoize [Wed, 17 Feb 2021 15:00:15 +0000 (15:00 +0000)]
Bug 26274: (QA follow-up) Fix the order of summary groups

The grouped income/outgoing summaries were not being explicitly
ordered and it appears the default ordering for MySQL 8 is different to
that of MariaDB and previous versions of MySQL and as such was causing
test failures for that version. This patch adds an explicit sort on the
'description' for each debit_type and credit_type grouping.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: Fix t/Context.t
Jonathan Druart [Wed, 17 Feb 2021 08:20:59 +0000 (09:20 +0100)]
Bug 27673: Fix t/Context.t

YAML::XS is not failing on that string, it generates
  'uno - dos' => "asd"

This new string is not YAML valid because of
"found a tab character that violate intendation"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: (follow-up) Fix encoding issues - Dump
Jonathan Druart [Fri, 12 Feb 2021 14:37:22 +0000 (15:37 +0100)]
Bug 27673: (follow-up) Fix encoding issues - Dump

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: (QA follow-up) Remove unused YAML::XS import
Joonas Kylmälä [Thu, 11 Feb 2021 14:49:18 +0000 (14:49 +0000)]
Bug 27673: (QA follow-up) Remove unused YAML::XS import

The last use of this module was removed in commit
"Bug 27673: Fix encoding issues - Dump".

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: Fix encoding issues - Dump
Jonathan Druart [Thu, 11 Feb 2021 09:52:44 +0000 (10:52 +0100)]
Bug 27673: Fix encoding issues - Dump

Same as Load, but for Dump.

Test plan:
Edit ES mappings, replace withdrawn's label with "withdrawn ✔️ ❤️ ★"
Export the mappings
  perl misc/search_tools/export_elasticsearch_mappings.pl > admin/searchengine/elasticsearch/mappings.yaml
Reset mappings from the UI
=> Notice that the label is correct

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: Rename C4::Circulation decode to _decode
Jonathan Druart [Thu, 11 Feb 2021 09:44:04 +0000 (10:44 +0100)]
Bug 27673: Rename C4::Circulation decode to _decode

To prevent conflict with Encode::encode

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: Fix encoding issues
Jonathan Druart [Thu, 11 Feb 2021 09:37:13 +0000 (10:37 +0100)]
Bug 27673: Fix encoding issues

There is a difference between YAML::Load and YAML::XS::Load
From YAML::XS pod:
"YAML::XS only deals with streams of utf8 octets"

Test plan:
We are going to test 1 occurence and QA will confirm others don't
contain typos.
0. Don't apply the patches
1. Create a new itemtype with code=❤️
2. Create a new item using this itemtype (to biblionumber=1 will work)
3. Fill OpacHiddenItems with
 itype: [❤️]
4. Search for "street shuffle" or any terms that will return the biblio
Notice that the item is there (there is an error in logs)
5. Apply the patches
6. Repeat 4 and confirm that the item is now hidden

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27673: Replace YAML with YAML::XS
Jonathan Druart [Wed, 10 Feb 2021 14:28:10 +0000 (15:28 +0100)]
Bug 27673: Replace YAML with YAML::XS

From tht YAML pod:

"""
This module has been released to CPAN as YAML::Old, and soon YAML.pm will be changed to just be a frontend interface module for all the various Perl YAML implementation modules, including YAML::Old.

If you want robust and fast YAML processing using the normal Dump/Load API, please consider switching to YAML::XS. It is by far the best Perl module for YAML at this time. It requires that you have a C compiler, since it is written in C.
"""

See also
https://gitlab.com/koha-community/qa-test-tools/-/merge_requests/35

Test plan:
Try some place where YAML::XS is not used and confirm that it works
correctly

QA note: This patch removes some uses of YAML that were not useful

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27707: (bug 26639 follow-up) Fix renewals when RenewalSendNotice is set
Jonathan Druart [Tue, 16 Feb 2021 08:06:03 +0000 (09:06 +0100)]
Bug 27707: (bug 26639 follow-up) Fix renewals when RenewalSendNotice is set

Since bug 26639 we have auto savepoint enabled and the LOCK TABLE query
in C4::Circulation::SendCirculationAlert is not correctly handled.
From the MySQL doc that is copied few lines before, "LOCK TABLE will
commit any transactions", but here we don't have a savepoint and the
release for a non-existent savepoint will throw a DBI exception.

This patch removes the unecessary transaction and prevent the following
error when a renewal is done:
> DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_0 does not exist [for Statement "RELEASE SAVEPOINT savepoint_0"] at /usr/share/koha/lib/C4/Circulation.pm line 3590

Test plan:
1. Enable RenewalSendNotice
2. Add some email address to patron and select the email box from the message preference "Item checkout and renewal" in order to receive renewal emails.
3. Check 1 item out to a patron
4. Renew it

Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27569: Fix ODS export - take empty string into account
Jonathan Druart [Mon, 1 Feb 2021 14:57:24 +0000 (15:57 +0100)]
Bug 27569: Fix ODS export - take empty string into account

If a cell contains an empty string it was not taken into account.

Test plan:
Same as CSV but with ODS

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27569: Change av for 100$2
Jonathan Druart [Mon, 1 Feb 2021 14:56:08 +0000 (15:56 +0100)]
Bug 27569: Change av for 100$2

Switch from "#" to ""

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27569: Add tests for ODS export
Jonathan Druart [Mon, 1 Feb 2021 14:27:53 +0000 (15:27 +0100)]
Bug 27569: Add tests for ODS export

Looks ok so far

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27569: Fix CSV export for biblio frameworks
Jonathan Druart [Mon, 1 Feb 2021 13:50:52 +0000 (14:50 +0100)]
Bug 27569: Fix CSV export for biblio frameworks

The CSV import of the biblio frameworks is broken.
A change in LibreOffice resulted in CSV not formatted how the
C4::ImportExportFramework code is expected.
This code is quite broken, it expects all the CSV cells to be quoted.

The "add tests" patch shows the different between what we expected
before this patch, and what is the new version generated by LibreOffice.

Test plan:
Export a biblio framework in CSV
Open it with LibreOffice and save it undef a different name
Create a new biblio framework and use the new file to construct it
Compare the 2 frameworks and make sure they are identical

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27569: Add tests
Jonathan Druart [Mon, 1 Feb 2021 13:54:15 +0000 (14:54 +0100)]
Bug 27569: Add tests

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27569: Don't hide errors!
Jonathan Druart [Mon, 1 Feb 2021 14:27:19 +0000 (15:27 +0100)]
Bug 27569: Don't hide errors!

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27569: Remove non mysql code
Jonathan Druart [Mon, 1 Feb 2021 14:59:37 +0000 (15:59 +0100)]
Bug 27569: Remove non mysql code

Remove a bit of the confusion by removing unless code (not related to
mysql)

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.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 27706: (bug 24488 follow-up) Fix libraries column filter
Jonathan Druart [Mon, 15 Feb 2021 09:34:15 +0000 (10:34 +0100)]
Bug 27706: (bug 24488 follow-up) Fix libraries column filter

From commit 2285c2d65752dcc899d3fdcff634e6927a1cbbf0
     Bug 24488: Show correct first patron details on Holds to pull

               $('select', this).change( function () {
-                  var filter_value = $(this).val();
-                  holdst.fnFilter( filter_value, 5, true );
+                  holdst.fnFilter( $(this).child().val(), 5 );
               });

This does not make sense, we need to filter on $(this).val(), it's a
select element.

Test plan:
Place some holds
Hit the pending holds page
Use the "libraries" column filter and confirm that it works correctly

Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27380: Add missing use statement
Jonathan Druart [Tue, 16 Feb 2021 09:15:38 +0000 (10:15 +0100)]
Bug 27380: Add missing use statement

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27604: Deal with empty pref
Jonathan Druart [Tue, 16 Feb 2021 08:30:20 +0000 (09:30 +0100)]
Bug 27604: Deal with empty pref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>