koha.git
2 years agoBug 29283: Don't attempt to cancel cancelled orders
Nick Clemens [Wed, 20 Oct 2021 13:06:06 +0000 (13:06 +0000)]
Bug 29283: Don't attempt to cancel cancelled orders

When deleting a basket we cancel all the contained orders - when a
basket contains an order that was previously cancelled this can cause
an error if the biblio was deleted

When picking the orders to cancel, we should limit our search
to those not already cancelled.

To test:
- have a basket with at least one order
- click "Cancel order and delete catalog record", confirm cancellation of order and deletion of bib
- click "Delete basket", confirm deletion
- get error "Cannot insert order: Mandatory parameter biblionumber is missing at /kohadevbox/koha/acqui/basket.pl line 136.
 at /usr/share/perl/5.28/Carp.pm line 289"
- apply patch
- restart
- delete the basket
- success!

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26871: Flush SIP2 cache on every SIP request
Joonas Kylmälä [Sun, 10 Oct 2021 11:01:29 +0000 (11:01 +0000)]
Bug 26871: Flush SIP2 cache on every SIP request

SIP connections tend to be long lived, weeks if not months, in the
libraries I see. Basically the connection per SIP machine is initiated
once when the SIP machine boots and then never closed until
maintanance needs to be done. Therefore we need to reset the Koha's L1
caches on every SIP request to get the latest sysprefs and configs
from the memcached cache that is shared between all the Koha
programs (intranet, opac, sip, cronjobs) and is guaranteed to be up to
date.

To test:
 0. Have kohadevbox
 1. Enable IssueLog
 2. In one terminal run the command "perl C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml"
 3. Checkin and return a book using telnet:

    $ telnet localhost 6001
    9300CNterm1|COterm1|CPCPL|
    11YN20211010    10565320211010    105653AOCPL|AA1|AB3999900000001|ACterm1|BON|BIN|
    09N20211010    10564420211010    105644APCPL|AOCPL|AB3999900000001|ACterm1|BIN|

 4. Keep the telnet connection open and go to
    http://localhost:8081/cgi-bin/koha/tools/viewlog.pl and check that
    the *checkout* entry is in the circulation rules 5.
 6. Disable IssueLog
 7. Move back to the telnet prompt and check out and return a book again

    11YN20211010    10565320211010    105653AOCPL|AA1|AB3999900000001|ACterm1|BON|BIN|
    09N20211010    10564420211010    105644APCPL|AOCPL|AB3999900000001|ACterm1|BIN|

 8. Go check out the circulation logs and notice a new entry was added
    when it shouldn't have according to the IssueLog syspref!
 9. Apply patch and repeat steps to notice that the syspref is now
    followed correctly.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 14999: Make sure order prices are not mixed-up
Joonas Kylmälä [Sat, 2 Oct 2021 12:28:52 +0000 (12:28 +0000)]
Bug 14999: Make sure order prices are not mixed-up

We were shifting the price and replacement price for imported orders
only after the line:

> $duplinbatch = $import_batch_id and next if $duplifound;

This lead to the "replacementprice" and "price" query parameters not
being shifted/removed from the list if a duplicate record came across
and caused the prices be applied to the next record being imported.

To reproduce:
 1) Download two records from koha to marcxml file, then cat those:
   cat bib1.marcxml bib2.marcxml > bibs.marcxml
 2) Delete bib2 from koha
 3) Stage bibs.marcxml for import
 4) Create a new order basket, then "Add to basket" using "From a
    staged file" option
 5) Select both bib1 and bib2 and set price & replacement price for
    bib1 to be 99.00 and for bib2 to be 88.00
 6) Click save and notice bib2 was imported with the wrong prices, 99.00!
 7) Apply patch and notice the prices are now correctly set to 88.00.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28573: Replace authority record with Z39.50/SRU creates new authority record
George Veranis [Tue, 12 Oct 2021 21:01:57 +0000 (23:01 +0200)]
Bug 28573: Replace authority record with Z39.50/SRU creates new authority record

When trying to replace an authority record with Z39.50/SRU then a new authority
record is created without deleting the old one and not link the new one with
any record.

This patch fixes that.

Test plan:

1) Try to catalogue a new authority record from cataloguing form.
2) Try to replace that authority record with Z39.50/SRU, then a new authority
record is created and also you have that one that you tried to replace.
3) Apply the patch.
4) Try to replace the authority from step1 with Z39.50/SRU, then is working as
expected.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29364: Revert changes to framework visibility made by Search.t
Jonathan Druart [Fri, 29 Oct 2021 08:33:57 +0000 (10:33 +0200)]
Bug 29364: Revert changes to framework visibility made by Search.t

To recreate run:

drop database koha_kohadev;
create database koha_kohadev;

restart_all

KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t t/db_dependent/Search.t t/db_dependent/Koha/UI/Form/Builder/Item.t
        #   Failed test 'Item types should be sorted by description and an empty entries should be shown'
        #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 127.
        #     Structures begin differing at:
        #          $got = undef
        #     $expected = ARRAY(0x557716b68e98)
        # Itemtypes details: $VAR1 = undef;
        # $VAR2 = [
        #           'BK',
        #           'CF',
        #           'CR',
        #           'ihxGmo7',
        #           'MP',
        #           'MU',
        #           'MX',
        #           'REF',
        #           'VM'
        #         ];

        #   Failed test 'Labels should be correctly displayed'
        #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 130.
        #     Structures begin differing at:
        #          $got = undef
        #     $expected = HASH(0x557716e2e150)
        # Looks like you failed 2 tests of 2.

    #   Failed test 'itemtypes'
    #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 133.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29363: Fix TestBuilder.t if bib 123 does not exist
Jonathan Druart [Fri, 29 Oct 2021 07:59:29 +0000 (09:59 +0200)]
Bug 29363: Fix TestBuilder.t if bib 123 does not exist

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17314: Implement /suggestions routes
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:48:11 +0000 (14:48 -0300)]
Bug 17314: Implement /suggestions routes

This patch introduces routes to handle purchase suggestions, from the
staff POV.

Tests are added as well.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/suggestions.t
=> SUCCESS: Tests pass! And they are meaningful!
3. Play with your favourite REST tool (Postman?)
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17314: OpenAPI spec
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:43:31 +0000 (14:43 -0300)]
Bug 17314: OpenAPI spec

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17314: Unit tests
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:48:54 +0000 (14:48 -0300)]
Bug 17314: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17314: Make TestBuilder set good defaults for Suggestions
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:41:08 +0000 (14:41 -0300)]
Bug 17314: Make TestBuilder set good defaults for Suggestions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoDBRev 21.05.05.003
Mason James [Sun, 31 Oct 2021 00:22:20 +0000 (13:22 +1300)]
DBRev 21.05.05.003

https://bugs.koha-community.org/show_bug.cgi?id=29378

2 years agoBug 28613: Add missing parameters to objects.search-based routes
Tomas Cohen Arazi [Tue, 22 Jun 2021 11:52:56 +0000 (08:52 -0300)]
Bug 28613: Add missing parameters to objects.search-based routes

The objects.search helper provides convenient ways to paginate and a 'q' filter parameter to build complex queries on this Koha::Objects-based routes.

Some routes were created prior to this feature getting introduced. We need to adjust the parameters for all existing objects.search-based routes.

This patch adds that.

The only GET (as in list) routes that would still be missing the
parameters are those about ILL, that are not objects.search based, and
probably need to be rewritten.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29300: Add 22.05 release team to teams.yaml
Martin Renvoize [Thu, 21 Oct 2021 12:10:35 +0000 (13:10 +0100)]
Bug 29300: Add 22.05 release team to teams.yaml

Add the 22.05 release team.

Test plan
1/ Check against
   https://wiki.koha-community.org/wiki/Release_Teams

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29218: Rename .hidden class for DT visibility
Jonathan Druart [Wed, 13 Oct 2021 08:16:00 +0000 (10:16 +0200)]
Bug 29218: Rename .hidden class for DT visibility

.hidden get the CSS that interferes with DT behaviour

.hidden {
    display: none !important;
}

Test this patch with bug 28859.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29272: (QA follow-up) Category setup overrides syspref
Tomas Cohen Arazi [Sun, 24 Oct 2021 22:54:24 +0000 (19:54 -0300)]
Bug 29272: (QA follow-up) Category setup overrides syspref

This patch removes an early short-circuit we had, which wasn't correct
regarding the OpacPasswordChange syspref. If a patron category is
allowed to change password, it overrides the syspref.

To test:
1. Tests still pass.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29272: Make public password changing honour category constraints
Tomas Cohen Arazi [Tue, 19 Oct 2021 13:29:55 +0000 (10:29 -0300)]
Bug 29272: Make public password changing honour category constraints

This patch makes the public API routes validate
$user->category->effective_change_password before allowing the change.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, it allows the first change instead of returning
         403.
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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29272: Regression tests
Tomas Cohen Arazi [Tue, 19 Oct 2021 13:27:53 +0000 (10:27 -0300)]
Bug 29272: Regression tests

This patch introduces regression tests for the described bug.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, excepted failures are considered success

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26374: update from bug 19974 is not idempotent
Nick Clemens [Thu, 3 Sep 2020 16:35:57 +0000 (16:35 +0000)]
Bug 26374: update from bug 19974 is not idempotent

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29318: Remove permission check from overdrive search page
Nick Clemens [Mon, 25 Oct 2021 18:47:22 +0000 (18:47 +0000)]
Bug 29318: Remove permission check from overdrive search page

This removes the 'edit_borrowers' permission from OverDrive search

To test:
1 - Enable OverDrive via koha system preferences
2 - Sign in to opac with a user with no permissions
3 - Perform a search that will return OD results, 'love' works
4 - Click thje "Found XX results in the library's OverDrive collection"
5 - Note you are logged out of Koha
6 - Apply patch
7 - Repeat
8 - Success

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29286: Typo: Librarien will need the manage_auth_values subpermission.
Owen Leonard [Mon, 25 Oct 2021 18:00:12 +0000 (18:00 +0000)]
Bug 29286: Typo: Librarien will need the manage_auth_values subpermission.

This patch fixes a typo in the Cataloging system preferences text.

"Librarien" -> "Librarian"

To test, apply the patch and go to Administration -> System preferences
-> Cataloging.

 - Check the CreateAVFromCataloguing system preference.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29315: Remove warnings from Search.t
Jonathan Druart [Mon, 25 Oct 2021 12:37:54 +0000 (14:37 +0200)]
Bug 29315: Remove warnings from Search.t

The syspref SearchLimitLibrary was requested but I don't know what to
say; this indicates that the test requires updating at
t/db_dependent/Search.t line 198.
The syspref FacetOrder was requested but I don't know what to say; this
indicates that the test requires updating at t/db_dependent/Search.t
line 198.
The syspref OPACResultsUnavailableGroupingBy was requested but I don't
know what to say; this indicates that the test requires updating at
t/db_dependent/Search.t line 198.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29309: (follow-up) Change 'Pay fines' to 'Pay charges'
Katrin Fischer [Sat, 23 Oct 2021 22:54:53 +0000 (00:54 +0200)]
Bug 29309: (follow-up) Change 'Pay fines' to 'Pay charges'

Fixes another occurence of the fines to charges.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29309: Make 'Pay all fines' be 'Pay all charges'
Tomas Cohen Arazi [Fri, 22 Oct 2021 21:59:37 +0000 (18:59 -0300)]
Bug 29309: Make 'Pay all fines' be 'Pay all charges'

It is not just fines, it is also fees, etc.

To test:
1. Have a patron with debt
2. Go to the circulation page for the patron
=> FAIL: There's a button saying 'Pay all fines'
3. Apply this patch and reload page
=> SUCCESS: The button now says 'Pay all charges'
4. Enjoy the new terminology
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29227: Patron messaging preferences digest show as editable but are not
Nick Clemens [Thu, 14 Oct 2021 12:03:31 +0000 (12:03 +0000)]
Bug 29227: Patron messaging preferences digest show as editable but are not

On moremember.pl we load the messaging preferences for display only, we do
not need to load the JS for editing the preferences

To test:
0 - Enable EnhancedMessagingPreferences
1 - Load the detais tab for a member
2 - Note the digest column in messaging preferences is clickable
3 - Apply patch
4 - Reload, it is not clickable
5 - Confirm editing the patron (or their messaging prefs) works as expected

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29306: Fix warning on undefined $_ in Holds.t
Marcel de Rooy [Fri, 22 Oct 2021 08:19:01 +0000 (08:19 +0000)]
Bug 29306: Fix warning on undefined $_ in Holds.t

Use of uninitialized value $_ in concatenation (.) or string at t/db_dependent/Holds.t line 1658.

Results from copying line 70.

Test plan:
Run Holds.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29284: (follow-up) Fix code that I copied from too
Nick Clemens [Thu, 21 Oct 2021 10:31:18 +0000 (10:31 +0000)]
Bug 29284: (follow-up) Fix code that I copied from too

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29284: (follow-up) Improve error logging to prevent warns
Nick Clemens [Thu, 21 Oct 2021 10:26:12 +0000 (10:26 +0000)]
Bug 29284: (follow-up) Improve error logging to prevent warns

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29284: Unit test
Nick Clemens [Thu, 21 Oct 2021 10:08:05 +0000 (10:08 +0000)]
Bug 29284: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29284: Handle the case of an exclamation point in parentheses
Nick Clemens [Wed, 20 Oct 2021 12:49:42 +0000 (12:49 +0000)]
Bug 29284: Handle the case of an exclamation point in parentheses

This expands the regex to handle this specific case

To test:
1 - Load record created for last patch
2 - Note analytics error
3 - Apply patch
4 - Restart and reload
5 - No more errorm also no Analytics link
6 - Add a 773$t to a record with title used before:
    Digger does it all (not really!)
7 - reload the initial record
8 - See 'Show analytics' link
9 - Click the link
10 - You should end up on the record you added the 773 to

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29284: Don't die on analytics searching error
Nick Clemens [Wed, 20 Oct 2021 12:46:07 +0000 (12:46 +0000)]
Bug 29284: Don't die on analytics searching error

This patch adds an eval around the call to search for analytic records
It pases a value to the template on the staff side, but logs the warning on
the opac

This seems similar to 'decoding_error' which is noted on staff side, but absent on OPAC

The eval follows the patter used during searching

To test:
1 - Add a title to catalog, with 245a:
    Digger does it all (not really!)
2 - Set searchEngine preference to: Elasticsearch
3 - The record does not load
4 - Apply patch
5 - The record loads, there is a note about analytics at the top fo the record
6 - View record in opac, no note
7 - Check logs on intranet and opac, searching error is logged

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28585: (QA follow-up) Add explicit tests for setting date/date-time attributes
Tomas Cohen Arazi [Thu, 21 Oct 2021 18:33:54 +0000 (15:33 -0300)]
Bug 28585: (QA follow-up) Add explicit tests for setting date/date-time attributes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28585: (QA follow-up) Fix object.t
Martin Renvoize [Thu, 21 Oct 2021 15:08:19 +0000 (16:08 +0100)]
Bug 28585: (QA follow-up) Fix object.t

Object.t was still testing for the return of DateTime objects from
attributes_from_api. I checked all calls to attrbutes_from_api for
reliance of DateTime objects and confirmed they all get passed into
search calls and thus are better served as SQL formatted strings.

I then converted the test to check that the rfc3339 formatted dates
passed in were converted to strings appropriate for feeding into SQL
where statements instead.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
JD amended patch:
  FAIL   spelling
    formated ==> formatted

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28585: (follow-up) Tests for q= supporting date/date-time parameters
Tomas Cohen Arazi [Fri, 25 Jun 2021 14:49:06 +0000 (11:49 -0300)]
Bug 28585: (follow-up) Tests for q= supporting date/date-time parameters

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28585: Use the datetime_parser for handling API dates
Tomas Cohen Arazi [Fri, 25 Jun 2021 14:37:29 +0000 (11:37 -0300)]
Bug 28585: Use the datetime_parser for handling API dates

This patchset takes the GET /patrons route as a sample usage for filtering
on date and date-time (including timestamp) fields.

It then makes Koha::Object->attributes_from_api use the DB storage
datetime parser for format the parameters correctly.

To test:

1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: It doesn't find the patron when filtering by date
3. Apply this patch
4. Repeat 2
=> SUCCESS: It works now!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28585: Regression tests
Tomas Cohen Arazi [Fri, 25 Jun 2021 12:57:11 +0000 (09:57 -0300)]
Bug 28585: Regression tests

This patch adds tests for filtering GET calls with date/date-time
parameters. Tests fail because the feature is not working

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29213: Fix typo ol in member-alt-contact-style.inc
Fridolin Somers [Tue, 12 Oct 2021 18:49:48 +0000 (08:49 -1000)]
Bug 29213: Fix typo ol in member-alt-contact-style.inc

There is a typo in member-alt-contact-style.inc, tag ol is open twice for alternate contact.

Test plan :
1) Create new patron
2) Look at HTML structure in "Alternate contact" section
=> Without patch you see <ol> twice and </ol> once
=> With patch you see once <ol> and </ol>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoUpdate release notes for 21.05.05 release v21.05.05
John Doe [Thu, 28 Oct 2021 13:19:31 +0000 (13:19 +0000)]
Update release notes for 21.05.05 release

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoIncrement version for 21.05.05 release, fix minor version
Kyle M Hall [Thu, 28 Oct 2021 13:15:17 +0000 (09:15 -0400)]
Increment version for 21.05.05 release, fix minor version

2 years agoIncrement version for 21.05.05 release
Kyle M Hall [Thu, 28 Oct 2021 12:28:42 +0000 (08:28 -0400)]
Increment version for 21.05.05 release

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoFix translations for Koha 21.05.05
Kyle M Hall [Thu, 28 Oct 2021 12:27:44 +0000 (08:27 -0400)]
Fix translations for Koha 21.05.05

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoMerge remote-tracking branch 'koha-translate/21.05.05-translate-20211027' into 21...
Kyle M Hall [Thu, 28 Oct 2021 10:31:36 +0000 (06:31 -0400)]
Merge remote-tracking branch 'koha-translate/21.05.05-translate-20211027' into 21.05.x

2 years agoTranslation updates for Koha 21.05.05
Koha translators [Wed, 27 Oct 2021 18:34:07 +0000 (15:34 -0300)]
Translation updates for Koha 21.05.05

2 years agoBug 29134: (follow-up) Specify which borrowernumber
Nick Clemens [Fri, 8 Oct 2021 14:42:48 +0000 (14:42 +0000)]
Bug 29134: (follow-up) Specify which borrowernumber

When performing a search that includes permissions we need to specify we are comparing
the borrowers tabnle borrowernumber

To test:
1 - Browse to Admin->Funds
2 - Edit a fund
3 - Click '+ Add users'
4 - Attempt a search, no results
5 - Check plack-error.log
    C4::Utils::DataTables::Members::search(): DBI Exception: DBD::mysql::st execute failed: Column 'borrowernumber' in IN/ALL/ANY subquery is ambiguous at /kohadevbox/koha/svc/members/search line 80
6 - Apply patch
7 - Repeat 1-3
8 - search for 'a'
9 - Result!

2 years agoBug 29244: Compiled CSS
Kyle Hall [Fri, 22 Oct 2021 15:44:02 +0000 (11:44 -0400)]
Bug 29244: Compiled CSS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29244: Add dialog class where missing in print-notices.tt
Martin Renvoize [Thu, 14 Oct 2021 11:45:05 +0000 (12:45 +0100)]
Bug 29244: Add dialog class where missing in print-notices.tt

The print notices template had it's own implimentation of a message
dialog. To make it consistent with other area's, we should add the
dialog class.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29244: Move message inside dialog and remove width
Martin Renvoize [Thu, 14 Oct 2021 11:43:56 +0000 (12:43 +0100)]
Bug 29244: Move message inside dialog and remove width

This patch moves the message css rules inside the dialog ruleset to
clarify their intention and removes the width so it inherits from the
dialog class.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29298: Add 'Managing library' column to table settings for histsearch
Jonathan Druart [Thu, 21 Oct 2021 09:46:07 +0000 (11:46 +0200)]
Bug 29298: Add 'Managing library' column to table settings for histsearch

Bug 14669 added the column to the table but forgot to add it to the
table settings yml file

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29271: (follow-up) Remove changes to accounts.inc
Nick Clemens [Thu, 21 Oct 2021 10:03:30 +0000 (10:03 +0000)]
Bug 29271: (follow-up) Remove changes to accounts.inc

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29216: Correct --where documentation in update_patrons_category.pl
Caroline Cyr La Rose [Fri, 15 Oct 2021 14:03:52 +0000 (10:03 -0400)]
Bug 29216: Correct --where documentation in update_patrons_category.pl

This patch removes two misleading examples of the --where parameter
documentation in update_patrons_category.pl

To test:

1. Apply patch
2. In your favourite text editor, open misc/cronjobs/update_patrons_category.pl
3. Look for the documentation for the --where parameter (around line 133 or so)
4. Make sure the examples and their explanations make sense
5. Sign off :)

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29225: Don't hide subgroup filter on pag load
Nick Clemens [Thu, 14 Oct 2021 12:28:30 +0000 (12:28 +0000)]
Bug 29225: Don't hide subgroup filter on pag load

When we auto select the last used tab, we hit code that hides the Subgroup
dropdown

Clicking to other tabs shows the dropdown again

There is code on the tab selection to hide subgroups on the 'All' tab,
the other line seems superfluous

To test:
1 - Create a report and assign a group and subgroup, creating if necessary
2 - Browse to "Reports->Use saved"
3 - Click on the tab for the report you just created, see the subgroups dropdown
4 - Reload the page, Subgroups dropdown disappears
5 - Apply patch
6 - Relaod the page
7 - It's back!
8 - Confirm dropdown filters as expected

Signed-off-by: Donna <donna@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29279: Use class for targets
Jonathan Druart [Thu, 21 Oct 2021 08:19:55 +0000 (10:19 +0200)]
Bug 29279: Use class for targets

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29279: Don't sort holds ratio numeric columns as 'natural'
Nick Clemens [Tue, 19 Oct 2021 16:47:50 +0000 (16:47 +0000)]
Bug 29279: Don't sort holds ratio numeric columns as 'natural'

TO test:
1 - Place a variety of holds on some records
2 - Place more holds on records with low biblionumbers and less on ones with high biblionumbers
3 - Go to Circulation->Holds ratios
4 - Set the ration to 1 and load the report
5 - Sort by the 'Holds ratio' column and note it is incorrect
6 - Apply patch
7 - Confirm sort works correctly on first three columns and call numbers column

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29271: (QA follow-up) Fetch and send descriptions to template
Nick Clemens [Wed, 20 Oct 2021 14:06:29 +0000 (14:06 +0000)]
Bug 29271: (QA follow-up) Fetch and send descriptions to template

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29271: (QA follow-up) Add missing filter
Katrin Fischer [Tue, 19 Oct 2021 21:09:00 +0000 (21:09 +0000)]
Bug 29271: (QA follow-up) Add missing filter

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29271: Fix cash register report results
Nick Clemens [Tue, 19 Oct 2021 13:03:07 +0000 (13:03 +0000)]
Bug 29271: Fix cash register report results

This patch changes accounts.inc to use the credit/debit type codes directly
rather than needlessly fetching the credit_type/debit_type object jsut to get
the code. This allows the BLOCK to work on non-object lines

We also only pass a debit or credit type to csv (accountline cannot be both)

empty-line.inc is also removed in favor of correcting the markup

one more column added to total line

To test:
1 - Add some debits and credits to accounts
2 - Browse to Reports->Cash register
3 - Select transaction type 'All transactions'
4 - Output to screen
5 - Run report
6 - Note transaction types column is empty
7 - Output to a file
8 - Run report
9 - Open file and note:
      amount column is out of place
      extra line before total
10 - Apply patch
11 - Repeat and note display and export are correct

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25030: (QA follow-up) Fix tests
Nick Clemens [Tue, 19 Oct 2021 10:34:38 +0000 (10:34 +0000)]
Bug 25030: (QA follow-up) Fix tests

Fluid is not a valid value for cxn_pool - valid values are:
Sniff,Static,NoPing

AddAuthority call calls index - the indexing call was trying to access
the ES server with mocked values and dying when they were invalid

This patch uses a correct value for cxn_pool and inserts directly into DB
to avoid indexing

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25030: (QA follow-up) Add POD
Nick Clemens [Mon, 18 Oct 2021 11:09:00 +0000 (11:09 +0000)]
Bug 25030: (QA follow-up) Add POD

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25030: Implement IncludeSeeFromInSearches with Elasticsearch
Julian Maurice [Tue, 10 Nov 2020 14:22:21 +0000 (15:22 +0100)]
Bug 25030: Implement IncludeSeeFromInSearches with Elasticsearch

Test plan:
1. Create an authority with at least a 1XX$a and a 4XX$a, for instance:
    100 $a Foo
    400 $a Bar
2. Create a biblio and add a link to this authority using the
   cataloguing plugin
3. Disable syspref IncludeSeeFromInSearches
4. Reindex the biblio. You should be able to find it when searching
   'Foo' but not when searching 'Bar'
5. Enable syspref IncludeSeeFromInSearches
6. Reindex the biblio. You should be able to find it when searching
   'Foo' and also when searching 'Bar'
   without the patch, 'Bar' doesn't yeld results. With it, it does.
7. prove t/db_dependent/Koha/SearchEngine/Elasticsearch.t

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Lucy Vaux-Harvey <lucy.vaux-harvey@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29215: (bug 3137 follow-up) Fix guarantor block toggle
Jonathan Druart [Tue, 19 Oct 2021 09:50:37 +0000 (11:50 +0200)]
Bug 29215: (bug 3137 follow-up) Fix guarantor block toggle

The guarantor template must be kept hidden, always.

Test plan:

Edit a patron with a guarantor, click the legend of the "patron
guarantor" block and confirm that the template is not shown

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 20277: Improve 773 link when $a is present
Katrin Fischer [Sun, 22 Aug 2021 04:07:02 +0000 (04:07 +0000)]
Bug 20277: Improve 773 link when $a is present

At the moment $t (Title) and $a (Main heading - author) are both
searched in ti,phr, which sometimes may work, as ti contains the
full 245 field, including $c with author information. But often
$c will not match what is in 100$a, so the search fails.

This splits the search string so we search for $t in with ti,phr
and for $a in au.

To test:
- Make sure UseControlnumber is deactivated
- Search for a record with an author in 100 in your catalog
  Example from sample data: Programming Perl / Tom Christiansen, Brian D. Foy & Larry Wall.
- Add a child record using New > Add child record
- Verify that in 773 $a and $t are filled in
- Complete mandatory fields and save the record
. In OPAC and staff interface:
- Verify the link in the detail page is doing a search with ti,phr
- Verify the link works/doesn't work (more likely the latter)
- Apply patch
- Verify the link has changed and (now) works

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29243: Correct call when adding items from staged records
Nick Clemens [Thu, 14 Oct 2021 11:30:21 +0000 (11:30 +0000)]
Bug 29243: Correct call when adding items from staged records

To test:
1 - Populate system preference  NewItemsDefaultLocation
2 - Stage a file of marc records
3 - Create an acquisitions basket with 'AcqCreateItems' set to 'ordering'
4 - Attempt to add to basket from your staged file
5 - You get a 500 error, and in the logs:
    Can't use string ("") as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/Items.pm line 1605.
6 - Apply patch
7 - Repeat #4
8 - Success!

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29157: Date and Datetime attributes cannot be set NULL
Tomas Cohen Arazi [Thu, 7 Oct 2021 18:28:40 +0000 (15:28 -0300)]
Bug 29157: Date and Datetime attributes cannot be set NULL

This patch makes Koha::Object->attribute_from_api allow setting
attributes the undef value. The original implementation passed the value
directly to dt_from_string, which made the attribute be set the current
date.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t \
           t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail! Our code is buggy!
3. Apply this patch
4. Repeat 2
=> SUCCESS! Fix fixed this thing!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29157: Regression tests
Tomas Cohen Arazi [Thu, 7 Oct 2021 18:16:01 +0000 (15:16 -0300)]
Bug 29157: Regression tests

This patch implements regression tests for the filed bug.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28956: Correct default tax rate on orderreceive
Wainui Witika-Park [Mon, 6 Sep 2021 23:15:39 +0000 (23:15 +0000)]
Bug 28956: Correct default tax rate on orderreceive

When there is more than one tax rate defined in system preferences, and
a vendor has a tax rate that is not 0%, then when you are receiving an
order in a basket for that vendor, the default tax rate should be the
correct non 0 rate. This should be seen in acqui/orderreceive.

To test:
1) Go to staff client
2) Go to Koha administration
3) Search for "tax rate" in system preferences
4) Add 0|0.15 into the preference
5) Create a vendor
6) Set vendor tax rate to 15%
7) Add a new basket to vendor
8) Add to basket
9) Add any sample order to basket - add actual cost
10) Close basket
11) Receive shipment
12) Make invoice
13) Click on Receive in the table
14) Should be on orderreceive.pl page
15) Observe tax rate default is 0%
16) Apply patch
17) Refresh page
18) Observe tax rate default is 15%

Sponsored-by: Catalyst IT
Signed-off-by: Julien Sicot <julien.sicot@univ-rennes2.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28579: Typo: No record have been imported because they all match an existing...
Owen Leonard [Thu, 7 Oct 2021 15:44:03 +0000 (15:44 +0000)]
Bug 28579: Typo: No record have been imported because they all match an existing record in your catalog.

This patch corrects a grammatical error in text which might be shown
when adding records from a staged file to a basket. It corrects this:

  "No record have been imported because they all match an existing
  record in your catalog."

..to this:

  "No records have been imported because they all match existing
  records in your catalog."

To see the error in Koha, apply the patch and export some records from
Koha (Tools -> Export) and then re-import them using Tools -> Stage MARC
for import.

- Go to Acquisitions -> Vendor -> Basket -> Add to basket -> From a
  staged file.
- Click the "Add to order" button corresponding to the file you just
  uploaded.
- Select all records and define default accounting details.
- When you click "Save" you should see the error message.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28470: Typo: Are you sure you with to chart this report?
Owen Leonard [Thu, 7 Oct 2021 14:19:56 +0000 (14:19 +0000)]
Bug 28470: Typo: Are you sure you with to chart this report?

This patch corrects the text of a warning on the report results page,
from this:

_("Fetching full chart data for reports with many rows can cause
performance issues. Are you sure you with to chart this report?")

...to this:

_("Fetching full chart data for reports with many rows can cause
performance issues. Are you sure you want to chart this report?")

To test, apply the patch and go to Reports -> Use saved.

 - Run a report which, unlimited, will return more than 1000 rows.
 - Click the "Fetch all data for chart" button.
 - You should be asked for confirmation. Check that the text is correct.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29172: (follow-up) Amend preference text for control fields
Katrin Fischer [Mon, 4 Oct 2021 18:21:02 +0000 (18:21 +0000)]
Bug 29172: (follow-up) Amend preference text for control fields

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29172: Make CustomCoverImagesURL compatible with control fields
Jonathan Druart [Tue, 5 Oct 2021 11:57:04 +0000 (13:57 +0200)]
Bug 29172: Make CustomCoverImagesURL compatible with control fields

Bug 22445 added CustomCoverImagesURL that deals with MARC fields, but
control fields were not supported.

Test plan:
Turn CustomCoverImages on
Fill CustomCoverImagesURL with https://covers.openlibrary.org/b/isbn/{006}-M.jpg
Add an isbn in 006 (0596001738 will work)
Go to the detail page of the bibliographic record and confirm that you
see a cover image.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 24698: QA fixes
Joonas Kylmälä [Sun, 3 Oct 2021 11:51:22 +0000 (11:51 +0000)]
Bug 24698: QA fixes

This is a squashed patch of the following patches:

Bug 24698: (QA follow-up) Fix errors caused by more strict exports being introduced

The original patch "Bug 24698: Add plugin and template files for
unimarc authority leader" doesn't work without explictly importing the
methods from C4::Auth and C4::Output due to the default exports being
changed in those modules after the patch was made.

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Remove debug info being outputted to the template

This is only needed during development.

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Align variables with whitespace

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Remove dead code

These were left off from the copy&paste taken from
unimarc_field_100_authorities.pl

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Fix formatting and typos

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Remove passing of authnotrequired parameter

It should only be used when we want to override the default of auth
being required.

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Make plugin script executable

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Use spaces instead of tabs

This makes the QA script happy.

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Filter untrusted input to prevent XSS

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Don't specify select element's size if it is 1

This is to make the QA script happy, in order to not to break
Bootstrap CSS rules, see Bug 28066 for more info

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (QA follow-up) Don't specify script type explictly

It's makes the QA script complain because the option doesn't have any
effect nowadays:

https://www.w3.org/TR/2017/REC-html52-20171214/obsolete.html#warnings-for-obsolete-but-conforming-features
Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 24698: (follow-up) remove HTML select option for Series

The IFLA authorities format specification defines only the letters a-l
as possible values for authority leader 000 character position 9 ("Type
of entity"). Therefore, the first option from the HTML select dropdown
menu (" - Series") must be removed.

Mentored-by: Andreas Roussos <a.roussos@dataly.gr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 24698: Add plugin and template files for unimarc authority leader
George Veranis [Fri, 12 Mar 2021 11:51:57 +0000 (12:51 +0100)]
Bug 24698: Add plugin and template files for unimarc authority leader

In Unimarc installations when adding/editing an authority record there is no
Tag Editor for the leader field ( 000 ).

This patch fixes that.

Test plan:

1) Try to catalogue a new authoritry and check if on field 000 you can find
the Tag Editor.
2) Apply the patch.
3) In the authorities framework view the subfields of field 000 and select for
plugin option the value unimarc_leader_authorities.pl.
4) Restart memcached / plack if needed.
5) Repeat step 1 and notice if the Tag Editor is visible and click it to open
new window in order to manage the field contents and press OK.
6) Check the value of the generated leader.

Signed-off-by: Esther <estherm@sodapsringsid.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29193: Specify paging as false in circ-patron-search-results.js
Nick Clemens [Thu, 7 Oct 2021 19:34:01 +0000 (19:34 +0000)]
Bug 29193: Specify paging as false in circ-patron-search-results.js

This patch removes paging from patron searches using circ-patron-search-results.js

To test:
1 - Browse to a record
2 - Click on the 'Holds' tab
3 - Search for 'a' in patrons
4 - Note you see only 20 results
5 - Sort by name and note that you see different results
6 - Apply patch
7 - Reload page and search
8 - Note you see all results

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28748: Prepare pickup locations for overridden holds
Nick Clemens [Wed, 6 Oct 2021 11:57:19 +0000 (11:57 +0000)]
Bug 28748: Prepare pickup locations for overridden holds

The logic in request.pl only passes pickup locations if a hold is allowed,
they are not calculated when the hold is overridden.

This patch copies the pickup locations code into the override conditional,
adjusting to mark the item overridden

This also highlights an condition of override:
If a hold is allowed, but there are no valid pickup locations the override
is not allowed.

To test:
 1 - Set a holds rule to allow on-shelf holds only if all unavailable
 2 - Set AllowHoldPolicyOverride to 'Allow'
 3 - Find a record with several items available
 4 - Attempt to place a hold
 5 - The items have a yellow triangle, but no pickup locations
 6 - Place an item level hold
 7 - Note the hold has no pickup location
 8 - Cancel the hold
 9 - Apply patch and restart all
10 - Attempt hold again
11 - Items still have yellow triangle, but there are dropdowns for pickup location
12 - Place an item level hold, verify a pickup location is set
13 - Cancel the hold
14 - Alter circ rule to allow on shelf holds
15 - Change 'Default checkout, hold and return policy' - 'Hold pickup library match' to "item's hold group"
16 - Ensure there is no group for the item
17 - Attempt to place hold
18 - Override is not allowed 'No valid pickup locations'

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29135: Fix handling of deleted items in OAI-PMH provider
Ere Maijala [Thu, 30 Sep 2021 19:53:15 +0000 (22:53 +0300)]
Bug 29135: Fix handling of deleted items in OAI-PMH provider

When the OAI-PMH provider was configured to include item information
in the returned records, deleting an item would cause the record to
be reported as deleted. The provider also did some useless checks when
determining the timestamp of a deleted record. These checks only had
a performance impact.

To test:
1) Create /var/lib/koha/kohadev/OAI.yaml with:

format:
  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

2) Set preference OAI-PMH to Enable
3) Set preference OAI-PMH:ConfFile to /var/lib/koha/kohadev/OAI.yaml
4) Delete an item from a record
5) View the page: http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marcxml
6) Note the record is now listed as deleted
7) Run prove -v t/db_dependent/OAI/

Sponsored-by: The National Library of Finland
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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29131: Row striping breaks color coding on item circulation alerts
Owen Leonard [Tue, 5 Oct 2021 12:12:34 +0000 (12:12 +0000)]
Bug 29131: Row striping breaks color coding on item circulation alerts

The CSS we use for table row "striping," which uses 'tbody
tr:nth-child(odd),' is often difficult to work with because it takes a
lot of increased specificity to override the default. Bootstrap
compounds this by adding its own similar CSS.

In order to overcome this I've added '!important' to the CSS embedded in
the item circulation alerts page. I normally would avoid '!important'
but since this CSS is only relevant to this page I think it's
appropriate.

This patch also adds [% FILTER collapse %] around the <style> block and
does some reindenting, so ignore whitespace when using diff to see the
changes clearly.

To test, apply the patch and go to Administration -> Item circulation
alerts.

- Check the "Legend" table. The first cells should be distinct colors:
  red, pink, and green.
- In the "Checkout" table, table cells should be green by default.
  Clicking in one of the cells should turn it red with the text
  "Disabled for all."
- Use the "Select a library" dropdown to pick a library.
- Clicking in any green cell should turn the cell pink and add the text
  "Disabled for XXX" where XXX is the branchcode.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29062: Unit tests
Nick Clemens [Thu, 7 Oct 2021 13:13:20 +0000 (13:13 +0000)]
Bug 29062: Unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29062: (QA follow-up) Add comment
Marcel de Rooy [Wed, 6 Oct 2021 13:32:55 +0000 (13:32 +0000)]
Bug 29062: (QA follow-up) Add comment

Wrapped it in a TODO ;)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29062: (follow-up) Adjust SendCirculationAlert
Nick Clemens [Mon, 4 Oct 2021 18:43:52 +0000 (18:43 +0000)]
Bug 29062: (follow-up) Adjust SendCirculationAlert

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29062: Use primary key issued_id to fetch old_issues for letters
Nick Clemens [Wed, 22 Sep 2021 11:49:14 +0000 (11:49 +0000)]
Bug 29062: Use primary key issued_id to fetch old_issues for letters

The code currently uses itemnumber to fetch old_issues for notices.
This doesn't seem to be used in any current notices except the CHECKINSLIP:
SELECTY letter.code,content FROM letter WHERE content LIKE 'old\\_%'\G

For issues we use itemnumber, however, issues has a constraint to limit issues for an itemnumber to 1
Old issues has no such constraint, we try to rectify this in the old code by adding 'ORDER BY returndate DESC LIMIT 1"

As the code is not used by default and buggy I think we can make a change to using 'issue_id' as the key and
announcing the change - it prevents leaky data

To test:
1. Check something out to patron A. Check it in.
2. Check something out to patron B. Check it in.
3. Check something out to patron C. Check it in and print the check-in slip. (Leave the checkin paghe open)
4. You will see the checkin repeat itself 3 times, one for each line in old_issues.
5. Apply patch and restart_all
6. Click the 'Print checkin slip' button again
7. You see a single checkin
8. Checkout a different item to patron A. Check it in and print the check-in slip
9. See the correct checkins

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29175: finishreceive: Replace , by ;
Marcel de Rooy [Tue, 5 Oct 2021 13:02:38 +0000 (13:02 +0000)]
Bug 29175: finishreceive: Replace , by ;

This certainly is one of my shortest fixes ever ;)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28930: Keep cardnumber be editable after server side form validation fails during...
Andreas Jonsson [Tue, 31 Aug 2021 12:50:03 +0000 (12:50 +0000)]
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration.

Test plan:

- Enable the system preference PatronSelfRegistration
- Make sure  PatronSelfRegistrationBorrowerUnwantedField does not
  contain cardnumber.
- Set the system preference  GDPR_Policy to "Enforce".
- In the OPAC click "Log in to your account" and "Register here".
- Fill out the form with valid data, but make sure you leave the
  checkbox under "GDPR consent" unchecked.
- Submit the form
- You will get back the form with the error message "You have not filled
  out all required fields. Please fill in all missing fields and
  resubmit."
- Without patch: cardnumber is not editable, and there is no input
  element for borrower_cardnumber (so the cardnumber will be lost when
  resubmitting the form)
- With patch: cardnumber is editable.

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29128: Remove the other whitespace in browse shelf link
Jérémy Breuillard [Tue, 28 Sep 2021 13:14:45 +0000 (13:14 +0000)]
Bug 29128: Remove the other whitespace in browse shelf link

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29128: Remove whitespace in browse shelf link
Lucas Gass [Mon, 27 Sep 2021 20:16:22 +0000 (20:16 +0000)]
Bug 29128: Remove whitespace in browse shelf link

To test:
-Turn on OPACShelfBrowser and make sure you have some itemcallnumbers
-Go to detail page and see the link: (Browse shelf )
-Apply patch and look at the link again, it should be: (Browse shelf)

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29004: Update GoogleOpenIDConnect preference to make it clear that it is OPAC...
Owen Leonard [Mon, 13 Sep 2021 13:37:55 +0000 (13:37 +0000)]
Bug 29004: Update GoogleOpenIDConnect preference to make it clear that it is OPAC-only

This patch modifies the description of the GoogleOpenIDConnect and
related preferences to make it clear that GoogleOpenIDConnect affects
OPAC logins and that the preferences are related.

To test, apply the patch and go to Administration -> System preferences.

Search for "google," and confirm that the descriptions of
GoogleOpenIDConnect and related preferences look clear and correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28303: Fix plugins system with multiple pluginsdir settings
Michael Hafen [Fri, 7 May 2021 20:13:49 +0000 (14:13 -0600)]
Bug 28303: Fix plugins system with multiple pluginsdir settings

C4/Templates::badtemplatecheck mucks with the config('pluginsdir') array ref.
This makes sure it operates on a copy of the array.

To test:
   1) $ prove t/db_dependent/Templates.t

Signed-off-by: David Nind <david@davidnind.com>
JK: Fix commit message styling and add test plan

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28303: Add unit test for badtemplatecheck
Joonas Kylmälä [Sun, 3 Oct 2021 10:53:40 +0000 (10:53 +0000)]
Bug 28303: Add unit test for badtemplatecheck

This tests that pluginsdir value is not modified by the call to
badtemplatecheck to make sure badtemplatecheck operates with its own
copy of pluginsdir configuration value.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29133: Correct select2 strings
Jonathan Druart [Wed, 29 Sep 2021 09:05:04 +0000 (11:05 +0200)]
Bug 29133: Correct select2 strings

We are using 'max'/'min' when the arguments are 'maximum'/'minimum'.
Also using %n, %d when only %s is working in .format()

Have a look at https://github.com/select2/select2/blob/45f2b83ceed5231afa7b3d5b12b58ad335edd82e/src/js/select2/i18n/en.js
It's Select2 v.4.0.13, the one we are using. We should match what's
there.

Test plan:
Bug 29002 is using minimumInputLength, you can see the difference when
selecting a patron:
 "Please enter %s or more characters"
vs
 "Please enter 3 or more characters"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Bug 29133: (follow-up) Fix for argument mismatch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
JK: fix typo in commit message
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29134: Use a subquery to increase performance of patron attributes search
Nick Clemens [Wed, 29 Sep 2021 12:26:59 +0000 (12:26 +0000)]
Bug 29134: Use a subquery to increase performance of patron attributes search

This patch generates a subquery and checks if a borrowrnumber is in the results to add patrons
to search results

To test:
 1 - Generate a bunch of patrons:
    SELECT surname, firstname, branchcode, categorycode FROM ( SELECT surname FROM borrowers ORDER BY rand() ) a,( SELECT firstname FROM borrowers ORDER BY rand() ) b,( SELECT branchcode FROM borrowers ORDER BY rand() ) c,( SELECT categorycode FROM borrowers ORDER BY rand() ) d LIMIT 50000
 2 - Add a patron attribute to the system and make it searchable - I used code 'TEST'
 3 - Add a value for this attribute to many patrons:
   INSERT INTO borrower_attributes (borrowernumber,code,attribute) SELECT borrowernumber, 'TEST','alphabet' FROM borrowers LIMIT 10000;
 4 - In staff client got 'Patrons'
 5 - Open the browser console (F12) and view the netwrok tab
 6 - Perform a patron search for 'a'
 7 - Note the time it takes for 'search' to complete in console
 8 - Apply patch, restart_all
 9 - Repeat search
10 - Note it is much faster
11 - prove -v t/db_dependent/Utils/Datatables_Members.t

NOTE: I tested with 500k patrons and 100k attributes - search returned in ~2 seconds with patch
and did not return before I got impatient without patch

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29148: Check if hold is item or bib level
Lucas Gass [Thu, 30 Sep 2021 22:11:32 +0000 (22:11 +0000)]
Bug 29148: Check if hold is item or bib level

To test:
1 - place an item level hold, it says: [one of the barcodes] or any available
2 - place a bib level hold, it says: [one of the barcodes] or any available
3 - Apply patch
4 - item level hold should say: Only [barcode]
5 - bib level hold should say: [one of the barcodes] or any available

Signed-off-by: Azucena <Azucena.Aguayo@uvu.edu>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28352: Only check authorised values mapped to DB fields
Nick Clemens [Wed, 26 May 2021 11:42:02 +0000 (11:42 +0000)]
Bug 28352: Only check authorised values mapped to DB fields

The errors reported seem to be caused by authorised values mapped to MARC fields
but not mapped to a koha field.

We should additionally make sure to check the Default framework

Also, adding comment to indicate we only check records with items, because we do

TO test:
1 - In a framework that is not the default map a MARC field to an authorised value, but not a koha field
2 - In SQL, force the kohafield to NULL for the mapping you just make
    UPDATE marc_subfield_structure SET kohafield = NULL WHERE frameworkcode='BKS' and authorised_value='HINGS_AS'
3 - perl misc/maintenance/search_for_data_inconsistencies.pl
4 - get the following errors:
Use of uninitialized value $tmp_kohafield in pattern match (m//) at /kohadevbox/koha/misc/maintenance/search_for_data_inconsistencies.pl line 151.
Use of uninitialized value $tmp_kohafield in substitution (s///) at /kohadevbox/koha/misc/maintenance/search_for_data_inconsistencies.pl line 154.
Can't call method "get_column" on an undefined value at /kohadevbox/koha/misc/maintenance/search_for_data_inconsistencies.pl line 157.
5 - Apply patch
6 - Repeat
7 - No more errors

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29139: Only pass the offsets for lines the credit was applied to
Tomas Cohen Arazi [Thu, 30 Sep 2021 13:02:20 +0000 (10:02 -0300)]
Bug 29139: Only pass the offsets for lines the credit was applied to

On writing the regression tests, I noticed the CREATE offset was added
to the template. The idea behind passing the offsets is that we can
print information about the lines that got the credit applied. Having
the CREATE offset is meaningless, and (worse) would require users to add
logic to skip it. And all the payment information is already passed in
the 'credit' variable anyway.

This patch filters the credit_offsets by type, leaving the APPLY ones
only.

To test:
1. Apply up to the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Account.t
=> FAIL: 3 offsets, including the CREATE one, boo!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Only the two APPLY offsets are returned!
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: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29139: Add regression tests
Tomas Cohen Arazi [Thu, 30 Sep 2021 13:01:19 +0000 (10:01 -0300)]
Bug 29139: Add regression tests

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: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29139: Add exceptions to relation accessors
Martin Renvoize [Thu, 30 Sep 2021 08:28:29 +0000 (09:28 +0100)]
Bug 29139: Add exceptions to relation accessors

We already had exceptions on the many-to-many links, but we didn't have
them for the middle table. The underlying dbic relations make it clear
which id's are being used for linking.  A 'credit' has 'credit_offsets',
a 'debit' has 'debit_offsets'.

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: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29139: Fix incorrect relation call
Martin Renvoize [Thu, 30 Sep 2021 08:14:15 +0000 (09:14 +0100)]
Bug 29139: Fix incorrect relation call

The bug here was worse than originally thought. We were calling the
wrong relation too.. we should probably add some exceptions to catch
this, it confuses me every single time!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29139: $line->debit_offsets doesn't honor list context
Tomas Cohen Arazi [Wed, 29 Sep 2021 19:27:04 +0000 (16:27 -0300)]
Bug 29139: $line->debit_offsets doesn't honor list context

Being based on _new_from_dbic (discussion on bug 28883), makes the
assignment incorrect:

my @account_offsets = $payment->debit_offsets;

This patch explicitly makes the resultset be assigned as a list by
calling *as_list*.

To test:
1. Have UseEmailReceipts disabled
2. Have a patron with a debt of 6
3. Make a payment of 2
=> SUCCESS: All good
4. Enable UseEmailReceipts
5. Repeat 3
=> FAIL: You get something like:

ERROR PROCESSING TEMPLATE: undef error - The method Koha::Account::Offsets->debit is not covered by tests!

Trace begun at /kohadevbox/koha/Koha/Objects.pm line 595
Koha::Objects::AUTOLOAD('Koha::Account::Offsets=HASH(0x561cbe2ac930)') called at input text line 6
eval {...} at input text line 6
eval {...} at input text line 23

6. Apply this patch
7. Repeat 3
=> SUCCESS: It doesn't explode anymore!
8. 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: 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: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29137: DBRev 21.05.04.003
Kyle Hall [Fri, 8 Oct 2021 13:47:57 +0000 (09:47 -0400)]
Bug 29137: DBRev 21.05.04.003

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29137: Add new syspref to disable AV creation within the cataloguing module
Jonathan Druart [Thu, 30 Sep 2021 06:56:36 +0000 (08:56 +0200)]
Bug 29137: Add new syspref to disable AV creation within the cataloguing module

"I don't like this patch at all!"
"We will see a cataloger revolt if we do not find a way to make this
optional for catalogers."

I imagined a hord of catalogers running behind me and I got scared.

This patch will allow to turn the new feature added by bug 25728 off.

Test plan:
Confirm that the new CreateAVFromCataloguing will permit to turn the
feature off.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28826: DBRev 21.05.04.002
Kyle Hall [Fri, 8 Oct 2021 13:32:21 +0000 (09:32 -0400)]
Bug 28826: DBRev 21.05.04.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28826: Add FacetOrder system preference
Nick Clemens [Fri, 6 Aug 2021 18:50:35 +0000 (18:50 +0000)]
Bug 28826: Add FacetOrder system preference

This bug adds a system preference to control ordering of facets and
adds the control to both Zebra and Elasticsearch

To test:
1 - Have a koha that can use both Zebra and ES
2 - Set 'displayFacetCount' to true
3 - Search in ES and Zebra
4 - Note facets in Zebra sorted alphabetically, ES by usage
5 - Apply patch, updatedatabase
6 - Search in ES and Zebra, facets are alphabetically sorted in both
7 - Find new syspref FacetOrder and set to 'by usage'
8 - Search in both engines, facets sorted by usage

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27155: Include identifier test in Biblio_and_Items_plugin_hooks.t
Marcel de Rooy [Tue, 28 Sep 2021 11:50:22 +0000 (11:50 +0000)]
Bug 27155: Include identifier test in Biblio_and_Items_plugin_hooks.t

The biblio and item action hooks pass a biblionumber or itemnumber now
to the plugin at time of deletion.
This patch adds a tiny refinement to Biblio_and_Items_plugin_hooks.t
and the associated test plugin to be sure of that.

Test plan:
Run t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28484: (QA follow-up) POD fix
Nick Clemens [Tue, 28 Sep 2021 20:33:46 +0000 (20:33 +0000)]
Bug 28484: (QA follow-up) POD fix

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>