Commit Graph

3392 Commits

Author SHA1 Message Date
Nick Clemens 4fe3333f51 Bug 26518: (QA follow-up) Expect warnings, don't supress them
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a8b89fe66a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 9561eea563)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-16 18:56:51 +01:00
Jonathan Druart 86c8bb9d44 Bug 26518: Hide expected DBI warnings
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1519050205)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 089c12ec09)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-16 18:56:50 +01:00
Jonathan Druart 94ac5fc6be Bug 26518: Use Koha::Biblio[item] in AddBiblio
Bug 26518: Does not return from the catch block

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a1e9453f1d)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit db94f61c23)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-16 18:56:47 +01:00
Nick Clemens 0fdac36bbe Bug 26516: Don't accept incorrect values for copyrightdate/publicationyear
The previous patch rejects incorrect values when saving to the db specifically for copyrightdate
An error is thrown for the int conversion when it fails

Rather than catching things when saving we can fix the value when generated, simply returning null when parsing
the record

To test:
1 - Add a new record to Koha making sure data is valid except 260$c:
    198-
2 - Save the record
3 - It fails
4 - Apply this patch
5 - Restart all the thigns
6 - Repeat
7 - Success!

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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1400890ec)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit c56972ddd3)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-10 14:09:58 +01:00
Nick Clemens 321afcfe74 Bug 25758: Return on_reserve over too_soon when not calling from automatic_renewals cron
Bug 19014 altered CanBookBeRenewed to return (auto_)too_soon over on_reserve

For cron purposes this is the correct behaviour.

For display purposes we wish to see on_reserve over too_soon

This patchset adds a switch to 'CanBookBeRenewed' to alter the priority of these statuses

To test:
 1 - set NoRenewalBeforePrecision to date only
 2 - set a circ rule to auto-renewal=yes, no renewal before=0, checkout period to 7 days
 3 - check item out
 4 - confirm item shows Scheduled For Automatic Renewal in issues table
 5 - place a hold on the item for another patron
 6 - reload issues table for patron 1, confirm checkout still shows "scheduled for automatic renewal" rather than "on hold"
 7 - change No Renewal Before value to 7
 8 - reload issues table for patron 1, confirm checkout now shows "on hold"
 9 - Apply patch
10 - restart_all
11 - Reload the issues table - confirm 'on_hold' still shows
12 - Change No Renewal Before to 0
13 - Refresh issues table, still shows 'On hold'
14 - perl misc/cronjobs/automatic_renewals.pl -v
15 - Result shows 'auto_too_soon'
16 - prove -v t/db_dependent/Circulation.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-11-24 13:01:39 +13:00
Jonathan Druart a57d0fe745 Bug 20804: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3c9c7f4543)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 356d1ca888)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-11-17 17:04:46 +13:00
Alex Buckley 4e55967da5 Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled
Test plan:
1. Check the OAI-PMH:AutoUpdateSets syspref is disabled
2. Run t/db_dependent/OAI/Sets.t tests and confirm tests pass
successfully
3. Enabled the OAI-PMH:AutoUpdateSets syspref
4. Repeat step 2 and confirm the tests fail

5. Apply this patch and restart plack: sudo koha-plack --restart
<instance>
6. Repeat step 2 and confirm the tests now pass
7. Disable the OAI-PMH:AutoUpdateSets syspref and repeat step 2 and
confirm tests still pass

Sponsored-By: Catalyst IT

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>
(cherry picked from commit 913897f3a4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d3254f7e57)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-11-17 16:48:39 +13:00
Jonathan Druart 938b1c8d7c Bug 25913: Get the correct return of AddBiblio
We need the parenthesis to get the biblionumber and not the
biblioitemnumber, in case there is a discrepancy.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 08386fabcb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4b2e6d56f2)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-27 17:35:48 +13:00
Jonathan Druart 4f677624b2 Bug 25913: Prevent get_coins to crash if record does not have title
If a bibliographic record does not have a title, get_coins will crash
with
Can't call method "as_string" on an undefined value at /kohadevbox/koha/Koha/Biblio.pm line 645
Koha::Biblio::get_coins('Koha::Biblio=HASH(0x5558f91bb740)') called at /kohadevbox/koha/catalogue/ISBDdetail.pl line 144

We can handle that situation easily by checking the existence of the
title field.

Test plan:
1. Create a record without 245
2. Enable COinSinOpac
4. Go to the ISBD detail view
=> It must not fail with this patch applied

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 64c939ca80)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d9599a6d33)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-27 17:35:41 +13:00
Jonathan Druart c3d0d7050a Bug 26414: Tidy the tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3cd40f7baf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 496cd5d36e)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-27 16:56:31 +13:00
Alexis Ripetti 028b7e6b8d Bug 26414: Unable to export Withdrawn status using CSV profile
When using CSV profiles to export MARC records, it is impossible to export the withdrawn status. I suspect it is because withdrawn is in 952$0 and 0 is considered null rather than an actual 0.

Test Plan :
1) Go to Tools > CSV profiles
2) Click on New CSV profile
3) Enter a profile name (ex. Simple record)
4) In the Profile MARC fields field enter the following (for MARC21)
245a|100a|952o|9520
5) Save your profile
6) Go to Search and search for something
7) Add a couple of things in your cart
8) Go to your cart
9) Click on Download and choose your CSV profile
10) Open the file and notice the 9520 column contains the whole of the 952 field and not just the withdrawn status
11) Apply patch
12) Redo steps 9) and 10)

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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b048d155bf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 937e831ea3)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-27 16:56:23 +13:00
Lucas Gass 56baaffb55 Bug 18958: (Rmaint follow-up) Adjust number of tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 2e5961b2c3)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-20 14:32:34 +13:00
Nick Clemens 8383009cc6 Bug 18958: (follow-up) Ensure hold fill target reserve_id is set for all hold types
MapItemsToHoldRequests has three sections: Local holds, item level holds, bib level holds

Only one of them was setting the reserve_id. This patch makes al three set it and adds tests

To test:
1 - Repeat test plan on bug
2 - sudo koha-mysql kohadev
    SELECT * FROM hold_fill_targets
3 - Ensure reserve_id is set at appropriate times
4 - prove -v  t/db_dependent/HoldsQueue.t

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

Bug 18958: (QA follow-up) Fix number of tests

In HoldsQueue.t

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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b255ca7c6e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit bac2e6892a)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-20 14:32:24 +13:00
Nick Clemens f679369773 Bug 18958: Make hold_fill_targets specific to reserves
After looking at Marcel's comments, the problem is in our matching
to hold_fill_targets - rather than adjusting to find filled/waiting holds we
could ensure that hold_fill_targets only refers to the specific hold it
is intended to

This patch is clearer, if slightly less performant than last (we now return all
the reserves and have to find the 'highest')

Test Plan:
 1 - Create and use a patron that can place multiple record level holds per record
 2 - Create a record with X items, each at a different library
 3 - Place X 'Next available' holds on the record for the patron using the 'Holds to place' box
 4 - perl misc/cronjobs/holds/build_holdsqueue.pl
 5 - Check in LibraryA's copy as LibraryA and confirm the hold
 6 - Revisit request.pl for the record, notice the next hold in line is now item-specific
 7 - Checkout the item to the patron, notice the remaining hold is marked waiting
 8 - Attempt to place another hold for your patron, notice that it requires an item-specific hold
 8 - Apply this patch
 9 - Repeat steps 1-5
10 - Revisit request.pl for the record, notice the next hold in line has *not* become item-specific
11 - Checkout the item to the patron, ensure the first hold is filled and the second remains record level
12 - Repeat whole test plan without building holds queue to confirm holds are still treated correctly

Signed-off-by: Andrew Fuerste-Henry <andrew@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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0bfe336c7b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a120656eca)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-20 14:32:05 +13:00
Nick Clemens 39dd8a565d Bug 18958: Unit tests
Signed-off-by: Bonnie Gardner <bgardner@cityoflewiston.org>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

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

JD amended patch: perltidy and simplify item/biblio creation

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7ee2495f32)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e4b60c4156)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-20 14:30:22 +13:00
Nick Clemens c2be412ade Bug 25273: Make match-heading rely on authority type configuration
The match-heading field is a special field used only by the linker, not accessible
to staff or patrons via the interface. This field is used to store the constructed
'search form' used for matching bib headings to authority fields.

In bug 24269 I attempted to use the mappings defined in the inferface and also inject the search term.
This did not work as too many subfields were indexed on their own and leading to false matches.
In this bug we remove the mappings for this field, and create it ourselves during
the indexing process. The C4::Headings module is still used to generate the correct form,
however, the mappings are set based on the authority types in the system. This gives the user
the ability to add new typoes, but prevents mapping changes from breaking linker functionality

To test:
 1 - Start form a sample database with ElasticSearch working
 2 - Download via Z39.50 2 authorities, one of which is a narrower heading of the other, e.g.:
    Waterworks
    Waterworks - Costs
 3 - Place a heading for the broader term in a record. e.g. Waterworks
       In 650$a, without the cataloguing authority plugin. We don't want
       the link created now.
       You need syspref BiblioAddsAuthorities => allow
 4 - Make sure linker is set to default
 5 - Attempt to link the records
       misc/link_bibs_to_authorities.pl
 6 - Linking fails
 7 - Apply patch
 8 - refresh index settings (if using a custom file, remove 'match-heading')
       You can reset mappings in the UI or run this:
       misc/search_tools/rebuild_elasticsearch.pl -v -d -r
 9 - Reindex ES
10 - Try to link again
11 - It succeeds!
12 - Run the tests
     prove t/db_dependent/Koha/SearchEngine/Elasticsearch.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Bug 25273: (follow-up)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ce161fda9b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5597b666e4)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-10-20 13:54:22 +13:00
Aleisha Amohia 23b83e138c Merge branch 'new/security-release-19.11.10' into 19.11.x 2020-09-22 10:19:14 +12:00
Tomas Cohen Arazi 4241305b75 Bug 26322: [19.11.x] Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-09-22 10:15:03 +12:00
Joonas Kylmälä f28cfa7682 Bug 26271: Add failing test to reveal issue with patrons API endpoint
When manager_id is null/undef the API returns error code 500.

To test:
 1) Notice failure when running
    prove t/db_dependent/api/v1/patrons_accounts.t

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>
(cherry picked from commit 898cd3b82e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 00570ae969)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-09-15 23:42:16 +12:00
Jonathan Druart c9d3eb03ba Bug 24147: Don't assume search_related will return ordered values
This test is failing randomly because it assume the order is always the
same. But it's not.

Note: Koha::Objects->search_related is never used , last use removed from
  commit 9aa724cdf2
  Bug 19599: Speed anonymise_issue_history up
We should keep it however IMO

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e10dc50328)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e550f25a01)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-09-09 22:16:31 +12:00
Kyle M Hall 21f47a0dfd Bug 25903: Add unit tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 49f5200374)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 73c246238b)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-09-09 21:25:14 +12:00
Nick Clemens 1b2eedbea9 Bug 26078: Prevent generating a new transfer from return policy when resolving a transfer
To test:
- Have 2+ branches
- Set your default return policy to Item returns to issuing library
- Find an item with holding branch of Branch A
- Set your library to Branch B
- Check item in
- Koha generates a transfer to Branch A. In doing so, it sets the item holding branch to Branch B
- Set your library to Branch A
- Check item in
- Koha generate a transfer to Branch B. In doing so, it sets the item holding branch to Branch A
- Set you library to Branch A
- Check the item in
 . . . Repeat indefinitely.
 Apply patch
 Repeat
 No more loop

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4767112320)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8bd9c4b4fd)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-09-09 16:00:22 +12:00
Kyle M Hall 5646b2a6f7 Bug 25786: Holds Queue building may target the wrong item for item level requests that match holds queue priority
Bug 23934 removed the limitation that prevented item level holds from
getting local holds priority. The problem is the code has never checked
if the item level hold matches the given item! This means the wrong item
may be requested to fill an item level hold.

Test Plan:
1) Create 3 items on a record
2) Place a hold for the 2nd item you created
4) Ensure that hold would be picked up by local holds priority
5) Build the holds queue
6) Note the holds queue is asking for the wrong item!
7) Apply this patch
8) Rebuild the holds queue
9) Holds queue should now be asking for the correct item!

Signed-off-by: Kim Peine <kim@williston.lib.vt.us>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b17a04dd07)
(cherry picked from commit c6a1277fdb)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-19 17:56:59 +12:00
Kyle M Hall 85a648431b Bug 25783: Modify calls to AddReserve to match Koha 19.11.x AddReserve prototype
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-19 17:52:42 +12:00
Tomas Cohen Arazi 97ba8f85d7 Bug 25783: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kim Peine <kim@williston.lib.vt.us>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dd4970860d)
(cherry picked from commit ad6b6db41e)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-19 17:50:10 +12:00
Aleisha Amohia b98ca4bf46 Merge branch 'new/security-release-19.11.09' into 19.11.x
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-19 07:11:07 +12:00
Jonathan Druart bbb16926c2 Bug 24663: [19.11.x] Remove authnotrequired if set to 0
It defaults to 0 in get_template_and_user

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-25 15:45:46 +12:00
Nick Clemens a6d5004569 Bug 23634: (QA follow-up) Adjust tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-25 15:36:30 +12:00
Martin Renvoize ccd95fdb45 Bug 23634: (QA follow-up) Catch all email cases in API
The API was only catching the primary email change case, but we need to
catch email, emailpro and B_email.

We were also not accounting for any of the emails (on PUT or from the
DB) being undefined.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-25 15:36:27 +12:00
Tomas Cohen Arazi f0276149f4 Bug 23634: Secure the email on the API
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-25 15:34:36 +12:00
Tomas Cohen Arazi 6b9e3dfae1 Bug 23634: Add tests for is_superlibrarian
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-25 15:30:10 +12:00
Jonathan Druart 9c7069aab8 Bug 25641: [19.11.x] Fix XSLT_Handler.t failures on U20
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-18 02:16:37 +12:00
Nick Clemens 45f3645aeb Bug 26000: Unit test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-19 17:32:53 +12:00
Nick Clemens 2cd1258b28 Bug 25882: Unit test
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1a2d7f1eac)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit dbc7f861d4)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 21:30:07 +12:00
Josef Moravec dc6bd27e2f Bug 26009: (QA follow-up) It does not harm to test more
Test plan:
prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
--> should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d08ce1d940)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 877cc214f0)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 10:53:35 +12:00
Nick Clemens e8e2afd195 Bug 26009: Add facet size to home/holdingbranch
To test:
0 - Set DisplayLibraryFacets to 'both' and FacetMaxCount to 20
1 - Have more than 10 branches
2 - Have items in each of those branches
3 - Enable ES, set system preference SearchEngine to Elasticsearch
4 - Search for '*'
5 - Expand homebranch/holdingbranch facets
6 - Note you only get 10
7 - Apply patch
8 - Repeat search
9 - Now you get all your facets

Signed-off-by: Michael Springer <mspringer@mylakelibrary.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4dd1672c1b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 18215fbc57)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 10:53:23 +12:00
Nick Clemens f02072241f Bug 25683: Patron with no accountlines should have 0 outstanding (not NULL)
Test plan:
- Have a patron with nothing in accountlines
- run update_patron_categories to find patrons with fines under $5 (-fu=5)
  - Your patron is not found
  - Give your patron a manual charge of $1
  - rerun the cron, your patron is found
  - pay off your patron's fine, putting their balance at $0
  - rerun the cron, your patron is found

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>
(cherry picked from commit 09146f4a99)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6ae42c8c3c)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 10:36:25 +12:00
Jonathan Druart 0a127a78e9 Bug 26162: Wait for the table to be refreshed
The previous patch did not work as expected. We still got a
StaleElementReference exception.
But this time on
10:43:47 selenium_1   | Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"branchname\"]"}
Because we found the one that existed on the page, not the one sent back
in AJAX.

The idea of this patch is to search for the "Showing 1 to X of Y entries" info and wait for X == Y

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 70ff3bafa0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ce8a819b5f)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 09:57:32 +12:00
Tomas Cohen Arazi 2b0bd07a2d Bug 26143: Regression tests
This patch introduces tests for the per_page=-1 handling use case. From
now on per_page=-1 means 'all resources'.

On writing this I noticed that we always paginate results no matter
what, but there was a weird condition under which on pagination headers
were sent back to the API consumer. This is highlighted in the precedent
patch, which is not the -1 situation this one tries to tackle.

Both pagination and searching are broken with per_page=-1, which is a
standard, and we actually didn't explicitly set a way to request all
resources.

To verify this:
1. Apply the previous tests patch and this one
2. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Pagination.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Things are damn broken

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d20bc39d75)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9a4910812f)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 09:49:24 +12:00
Jonathan Druart c106d5a29d Bug 26043: Fix random failure from Holds.t
#   Failed test 'Test ModReserveMinusPriority()'
 #   at t/db_dependent/Holds.t line 202.
 #          got: undef
 #     expected: '1605'
 # Looks like you failed 1 test of 66.

It is coming from Koha::Patron->holds that is ordering by reservedate,
so "sometimes" they are ordered in reverse (at least it's my
understanding of the problem).

Test plan:
Run the test file several times (from 20 to 60x), it must never fail
with this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 80a611797b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c98a283d11)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 09:34:04 +12:00
Jonathan Druart 6f7e48d75f Bug 25852: Add tests
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.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>
(cherry picked from commit e330e4ec22)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 57e3f2ed7b)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-17 08:38:27 +12:00
Nick Clemens f4899bafe3 Bug 24379: Make login_attempts not nullable
While the column defaults to 0 in Koha::Object->store we set to NULL if NULLABLE

When trying to reset a patrons password we check that the account is not administratively locked:
login_attempts != -1

This query does not return rows where login_attempts IS NULL. It will return accounts where login_attempts = 0

Let's default to 0 like we intend

To test:
1 - Create a new patron
2 - Note their login_attempts is NULL
    SELECT login_attempts FROM borrowers ORDER BY borrowernumber DESC LIMIT 1
3 - Enable  OpacResetPassword
4 - Attempt to reset password before logging in, you cannot
5 - Apply patch, updatedatabase, restart_all, update schema
6 - Create another patron
7 - Their login attempts should be 0
8 - Attempt to reset password, it works!

Bug 24379: Fix the test

First we create a patron using TestBuilder to get a hashref of valid
info. Then we delete it and create a new patron using Koha::Patron->new
Once stored, we should call discard_changes to make the calculated
values available in the currenct object.

Bug 24379: Don't drop default of 0 for login attempts

When moving the column we drop the default, this means that DBs upgraded form earlier versions
get the wrong values set

To test:
1 - Checkout 16.11.x
2 - Reset all
3 - Checkout master
4 - updatedatabase
5 - SHOW CREATE TABLE borrowers;
6 - Note the column login_attempts defaults to NULL
7 - Apply patch(es)
8 - Repeat
9 - Now it defaults ot 0 (and has NOT NULL if applied all)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7bb31cffae)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6d675b61ad)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-08-05 12:04:55 +12:00
Nick Clemens df53ab0094 Bug 23086: Unit test
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 40b6e1b8a1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1a6e51934d)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-31 03:19:03 +12:00
Nick Clemens 63802370ef Bug 25724: Unit tests
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Jason Robb <jrobb@sekls.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 028e9a07db)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit bc1e7669bd)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-31 03:14:40 +12:00
Jonathan Druart e1df84e9ec Bug 25729: Prevent Charges/Fees.t to fail on slow server
We must use t::lib::Dates::compare to compare dates

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fcd659b2d4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ddfec0a706)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-31 03:12:22 +12:00
Nick Clemens fe86de9047 Bug 25566: Add option to ignore found holds and use it when checking high holds
To test:
 1 - Find or create a record with 10 items
 2 - Set sysprefs:
     decreaseLoanHighHolds - enable
     decreaseLoanHighHoldsDuration - 2
     decreaseLoanHighHoldsValue - 2
     decreaseLoanHighHoldsControl  - 'over the number of holdable items'/dynamic
 3 - Set circ rules to allow 1 hold per record on the relevant record
 4 - Place 3 holds on the record
 5 - Check one item in and confirm hold to set to waiting
 6 - Issue to the patron with the waiting hold
 7 - Get a notice that loan period is decreased
 8 - Don't confirm the checkout
 9 - Apply patch
10 - Restart all the things
11 - Repeat checkout, no decrease this time!

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 96a8710350)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d59536e289)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-31 01:15:53 +12:00
Aleisha Amohia 4bc5656927 [19.11.x] Bug 25850: Tests fail when useDaysMode is not set to Calendar
t/db_dependent/Calendar.t tests fail

This patch is needed as long as useDaysMode is checked in
Koha::Calendar->_init

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-31 00:43:58 +12:00
Martin Renvoize ca186563c1 Bug 25850: Add tests for weekday holidays
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4ed4e468d2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e6522ea63c)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-30 23:58:04 +12:00
Nick Clemens 3a8c118931 Bug 25850: (QA follow-up) use dt_from_string
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 92970a9aba)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f63c82a30f)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-30 23:57:55 +12:00
Martin Renvoize 0656ff9a99 Bug 25850: Regression Test
This patch adds a unit test to test for an infinite loop as highlighted
by the bug.

Test plan
1/ Run the test before applying the fix
2/ The test should fail for 'Sundays'
3/ Apply the subsquent patch
4/ Re-run the test
5/ It should now pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 95c8d19530)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f5f3269e25)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-07-30 23:57:29 +12:00