Commit Graph

3435 Commits

Author SHA1 Message Date
Jonathan Druart 1a50ee4917 Bug 28929: Add selenium tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

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

Bug 28929: (follow-up) Add exec flag to tests

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

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

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2021-09-14 22:15:55 +00:00
Jonathan Druart 69dde73e18 Bug 28802: Fix Asset.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit bd572eccc4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a4ed8dcd16)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 9d67025452)

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2021-09-08 01:12:37 +00:00
Jonathan Druart 3de01174f3 Bug 28632: Prevent api/v1/patrons.t to fail on dates comparison
#   Failed test 'Returned patron from update matches expected'
 #   at t/db_dependent/api/v1/patrons.t line 537.
 #     Structures begin differing at:
 #          $got->{updated_on} = '2021-07-27T13:33:53+00:00'
 #     $expected->{updated_on} = '2021-07-27T13:33:52+00:00'
 # Looks like you failed 1 test of 42.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5d92267018)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 832f488744)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit f7e574b98d)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit f7e574b98d)
2021-09-08 01:06:10 +00:00
Marcel de Rooy ad8e8c2a3b Bug 28644: [19.11.x] Fix calling borrowernumber on undefined value
If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2021-09-08 01:00:53 +00:00
Wainui Witika-Park 9fa649e345 Revert "Merge branch '19.11.xbug28644' into rmaint_19.11.x"
This reverts commit 2d8b74f96d, reversing
changes made to c1e2202dd3.
2021-09-08 00:46:45 +00:00
Marcel de Rooy 04a5bbe1a1 Bug 28644: [19.11.x] Fix calling borrowernumber on undefined value
If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2021-09-07 23:58:28 +00:00
Tomas Cohen Arazi c1a76b0d80 Bug 28604: Regression tests
This patch introduces regression tests for the encoding issue with MiJ
output.

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

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fc1e15029f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 083f1133d5)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 541f85701f)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 541f85701f)
2021-09-07 04:07:31 +00:00
Tomas Cohen Arazi e302db70b3 Bug 28586: (follow-up) updated_by should be set
This patch makes the route set the 'updated_by' attribute as well, when
resolving a return claim through the API.

Tests are added for this behavior.

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

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

Signed-off-by: David Nind <david@davidnind.com>

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

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 343bf361e0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ab02ae9c43)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit b6e26af2ec)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit b6e26af2ec)
2021-07-12 01:10:35 +00:00
Nick Clemens 86b64a733a Bug 28482: [19.11.x] Unit test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Fix test rebase

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2021-07-08 01:54:54 +00:00
Jonathan Druart bbf6d587b8 Bug 28409: Adjust regression test
We are no longer expecting an URI escaped value but a corrected category
value, either 1 or 2.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 9aef1ef5a52527bafe1e3663d0e645d01d086599)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 9aef1ef5a52527bafe1e3663d0e645d01d086599)
2021-06-27 04:49:35 +00:00
Wainui Witika-Park 948106546d Revert "Bug 28409: Adjust regression test"
This reverts commit befd3f8721.
2021-06-27 04:14:59 +00:00
Jonathan Druart befd3f8721 Bug 28409: Adjust regression test
We are no longer expecting an URI escaped value but a corrected category
value, either 1 or 2.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 72684085cf)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 72684085cf)
2021-06-21 18:35:29 +00:00
Nick Clemens 34671f3713 Bug 27203: Adjust unit tests
It seems the issue here is that the price passed in is a string, and not a number, so the tax
value is not calculated when no unitprice is provided

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e5d42896b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6eb3790ff4)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 59c30d4239)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-05-25 16:41:44 +02:00
Jonathan Druart 5bb2b5bafc Bug 27968: Fix framework import if isurl has an incorrect value
If isurl is set to undef in the DB, it will be exported as an empty
string, which is an invalid value for isurl (int)

Incorrect integer value: '' for column 'isurl'

Test plan:
Export framework structure in CSV and ODS, then reimport it and check that
all the subfields are important correctly

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 01f0e04172)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5b4dd72d3a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 08c2408a3d)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-05-24 20:32:29 +02:00
Fridolin Somers f7a988503b Bug 26517: Add unit test
Run prove t/db_dependent/Members.t

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>
(cherry picked from commit 7697cc23b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d3883575b7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 60bb013164)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-04-22 15:13:39 +02:00
Nick Clemens 5867cf7a40 Bug 26457: [19.11.x] Throw exception if update of issues table fails
While this won't prevent the deadlock, it should catch the case where
a deadlock causes the DB update to fail and provide feedback to the user
and rollback the transaction

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

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

Signed-off-by: David Nind <david@davidnind.com>

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

Bug 26457: Unit test

Signed-off-by: David Nind <david@davidnind.com>

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

Bug 26457: (QA follow-up) Switch to PK index in UPDATE on issues

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-24 00:39:44 +01:00
Nick Clemens ab1bed4f46 Bug 27784: Unit tests
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 5e0dbf0adb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e16cd2afc5)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 9dda7ba2d3)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-23 07:20:38 +01:00
Victor Grousset/tuxayo eba92984dd Bug 27569: (RMaint follow-up) Fix test data
It had the additional column "important" which didn't exist yet in 19.11

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-22 05:23:00 +01:00
Jonathan Druart bb91b7a8a6 Bug 24398: Fix 500 when viewing a single news item at the OPAC
Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
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 c596f450d9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9266846b91)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 1be8ada8a7)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-19 01:00:12 +01:00
Jonathan Druart 8b5898b7b3 Bug 27569: Change av for 100$2
Switch from "#" to ""

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f0f1d27dd2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0e825b548e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit f919eabb4c)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-16 18:06:05 +01:00
Jonathan Druart 46a3dc58d9 Bug 27569: Add tests for ODS export
Looks ok so far

Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ce92a756a8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 31d1d65d44)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit df7b796cc9)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-16 18:06:05 +01:00
Jonathan Druart 451bff07f8 Bug 27569: Add tests
Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7c11f05626)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 63e674c960)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 658533a734)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-03-16 18:06:04 +01:00
Joonas Kylmälä 45d8d5f004 Bug 27715: Use $dbh->quote_identifier to quote untrusted input
The sanitization using regex and \w class of characters might be
enough but given the vast number of unicode characters in \w and
possibility of in the future the database engines interpreting some of
those characters with special meaning it is better to wrap the column
identifier to quotes using $dbh->quote_identifier so it is only
interpreted as identifier and nothing else.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-23 22:32:55 +01:00
Jonathan Druart 82180902d8 Bug 27715: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Amended: chmod 755.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-23 22:32:50 +01:00
Nick Clemens 4f4cddebd7 Bug 27554: Clarify and add tests for update_category_to
This patch adds a comment to the existing tests, clarifying what they test, and verifying the expected patron is affected. The
original test should be broken by 26307 when the behvaiour is prevented

I additionally add a test for 'too old'

To test:
1 - Apply patch
2 - Prove tests, they should pass
3 - Verify the comments make sense

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

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

JD amended patch: behvaiour ==> behaviour
and add more info to the commit title

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ecb6703d7a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1a71d41196)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 1a5fdef579)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-11 00:10:46 +01:00
Tomas Cohen Arazi 6617d5f699 Bug 27580: Regression tests
This test makes all the generated sample items have undef copynumber,
and all rules are added copynumber => [ 2 ] on the tests as
suggested by Andrew on his failing example.

The tests are expected to pass. i.e. copynumber is clearly not equal to
2, so those items shouldn't be hidden.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> FAIL: Tests fail! undef is considered in [ 2 ]

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

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>
(cherry picked from commit 00ea18282e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d767dc54a6)
(cherry picked from commit 27bc87fed7)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-10 01:55:30 +01:00
Tomas Cohen Arazi 5d67f204e6 Bug 27333: Regression tests
Test for the right exceptions

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 3ece596486)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 388ad3f198)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit c3418816b9)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-09 00:19:24 +01:00
Martin Renvoize cb294fa488 Bug 24254: (QA follow-up) Inlines opachiddenitems handling
We decided to inline the opachiddenitems filter as we don't believe it
will be used exclusively.

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 67f5a26077)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-01 21:15:36 +01:00
Tomas Cohen Arazi 809b3308ef Bug 24254: Implement separate filters and add patron param
This patch introduces two new methods for stacking filters on
Koha::Items:

- filter_out_lost
_ filter_out_opachiddenitems

This two filters are what actually happened inside the
filter_by_visible_in_opac. Everything is covered by tests.

In the process I added a Koha::Patron param to the method that is
internally used to decide if the OPACHiddenItems syspref needs to be
honoured or not. This *could* be better done with a fallback to
C4::Context->userenv if no param is passed.

I decided to leave that part for later, if we really find it would help
(e.g. if bug 10589 gets some action and we really need something here to
 handle that).

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 172747f9ad)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-01 21:15:36 +01:00
Tomas Cohen Arazi f2872b7fa8 Bug 24254: Read the OpacHiddenItems preference internally
After discussing the 'rules' parameter usefulness we decided it was not
the best idea, and the gains in terms of 'performance' would me
meaningless (in-memory caching of sysprefs). This patch makes a really
minor tweak to the tests so they mock the C4::Context->yaml_preference
method, but keeping the same original rules to highlight no behaviour
change takes place.

Then the rules parameter is removed from the calls, and the tests should
keep passing.

A minor change to make $rules = undef is made to highlight the // {}
behaviour when reading the syspref..

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

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 2369428d70)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-01 21:15:36 +01:00
Tomas Cohen Arazi dad15b74f6 Bug 24254: Compare itemlost with 0
On C4::Search and C4::Circulation the uses of the items.itemlost field
highlight the fact that the comparisson itemlost <= 0 was wrong, as it
is evaluated as a Perl boolean.

The column can only be an int and NOT NULL, so we need to check if it is
0 to ponder if not hidden.

This patch changes the tests to reflect this, and adjust the
Koha::Items->filter_by_visible_in_opac implementation to adapt to this.

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

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 4ffe7ddac0)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-01 21:15:36 +01:00
Tomas Cohen Arazi 6a48e25b01 Bug 24254: Unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit ff6d138faf)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-01 21:15:36 +01:00
Jonathan Druart 14a9309824 Bug 27196: [19.11.x] Don't explode if item that is waiting if checked in by SIP
AddReserve doesn't take a hash in 19.11 - amended the call in the tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-02-01 21:15:31 +01:00
Victor Grousset/tuxayo 79b65f536b Revert "Bug 27196: [20.05.x] Don't explode if item that is waiting if checked in by SIP"
Patch not working, forgot to undo the backport before pushing.

This reverts commit e8ea682d49.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-01-23 02:04:11 +01:00
Jonathan Druart e8ea682d49 Bug 27196: [20.05.x] Don't explode if item that is waiting if checked in by SIP
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 5f1bcdf49a)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-01-23 01:19:42 +01:00
Jonathan Druart 29d4cfbdb8 Bug 27004: Prevent claim resolution to fail
If the account of the patron who created a claim is removed, then the
claim won't be resolvable.
Trying to resolve the claim will result in a 500:
[2020/12/21 10:05:55] [ERROR] PUT /api/v1/return_claims/1/resolve: unhandled exception (Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy)<<[created_by is mandatory]>> Koha::REST::Plugin::Exceptions::__ANON

We should not check if created_by exist when we update an existing hold,
only when we create it.

Test plan:
- Login with patron A
- set a value to syspref ClaimReturnedLostValue
- Check an item out
- Claim returned it
- Login with patron B
- Delete patron A
- Resolve the claim
- ERROR in api-error.log an UI never confirming the resolution
- apply patch & restart services
- Resolve the claim
- it works

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 92dbe80902)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8e3f33e5d6)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit a5c20fc188)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-01-15 02:02:38 +01:00
Tomas Cohen Arazi 3c6577d239 Bug 27004: Regression tests
This patch introduces regression tests for the change in
Koha::Checkouts::ReturnClaim->store.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> FAIL: Tests fail

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c4702149b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f1b6a5321b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 4d05aeb9c3)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-01-15 02:00:34 +01:00
Victor Grousset/tuxayo 42aab4343e Bug 27055: Fix compatibility with newer Firefox+Selenium version
Fix "submit is not a function error"
A submit button should not be named "submit", in this case, it's id.
https://stackoverflow.com/questions/833032/submit-is-not-a-function-error-in-javascript

Fix some uses of get_attribute()

Fix a fail by setting a global implicit_wait_timeout, default value is 0
in our lib. Other libs set it higher which helps to not have to manually
deal with part of the timing issues.

Fix: remove usage of click_when_visible() because it doesn't work with
elements not in the top of the page. Because they are off screen.

Fix: use $driver->quit() in error_handler to not forget an open Firefox.
With the current version, it fills /dev/shm and fails with around 5
Firefox opened.
Also use quit() it at the end of every script.

Fix: filling item fields, to fill only the displayed one (not those
with display:none)

== Test plan ==
1. Update selenium/standalone-firefox to the latest version [1]
2. prove t/db_dependent/selenium/authentication.t
3. It fails with: arguments[0].form.submit is not a function
4. Apply patch
5. Retest
6. Success

[1] In koha-testing-docker you can do it with
docker-compose.yml:
     selenium:
-        image: selenium/standalone-firefox:2.53.1-americium
+        image: selenium/standalone-firefox

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3c3406257e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 51fcc453f9)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 09518a3773)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2021-01-13 20:01:51 +01:00
Nick Clemens 77a2f4191f Bug 27166: Unit tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 409d1114d9)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-24 15:29:49 +01:00
Nick Clemens e5f7075705 Bug 25189: Unit tests
Adds new test for not adding authority if some already exist

Also replaces use of 'SearchAuthorities' as it is Zebra specific

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>
(cherry picked from commit 258d0b0ecd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6a395eab2d)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-18 23:14:36 +01:00
Jonathan Druart 608512179c Bug 12430: Fix Search.t failure
t/db_dependent/Search.t ..
    #   Failed test 'buildQuery should keep 0 value'
    #   at t/db_dependent/Search.t line 669.
    #          got: 'su,phr=(rk=(0)) '
    #     expected: 'su,phr=0(rk=(0)) '

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a37ba7903d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f7b4f0bccb)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit b8eaa1de2e)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-17 15:16:06 +01:00
Jonathan Druart fd65876883 Bug 12430: Fix selenium/regressions.t failure
Test failed with
    # Looks like you planned 4 tests but ran 3.
t/db_dependent/selenium/regressions.t .. 2/5
 #   Failed test 'OPAC - Remove from cart'
 #   at t/db_dependent/selenium/regressions.t line 109.
Error while executing command: clickElement: An unknown server-side error occurred while processing the command.: Element is not clickable at point (583.7000122070312, 14). Other element would receive the click: <a class="page-link" href="/cgi-bin/koha/opac-search.pl?idx=kw&amp;q=d&amp;offset=420&amp;sort_by=relevance_dsc&amp;count=20" aria-label="Go to the last page"></a>

https://pic.infini.fr//Qhq7pLBq/jT9wZ7F1
The remove from basket link for the biblio 3 is hidden by the floating
toolbar.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 48e74cebed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 965ad535b5)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 64ccd1c482)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-17 15:16:05 +01:00
Martin Renvoize f4fd2f0aff Bug 27079: Unit tests
Add a unit test to check for floating point errors in UpdateFine
relating to catching matching CalcFine amounts compared to DB amount
values.

Test plan
1/ Run the unit test and confirm it fails
2/ Apply the second patch in the series
3/ Run the unit test and confirm it passes

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit bb7ef5294f)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2020-12-16 22:53:11 +01:00
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