Commit graph

5294 commits

Author SHA1 Message Date
fa100d8e5e Bug 28220: prevent patron to be created if attributes not stored
Using a transaction

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-17 12:29:23 +02:00
6e769cc004 Bug 28220: Add tests to import
failure expected, we need to add a transaction

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-17 12:29:23 +02:00
c6b3537ff7 Bug 28220: Deal with merge
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-17 12:29:23 +02:00
06fe908a4e Bug 28200: Remove unit test using abbreviated format
This patch removes the unit test that uses the abbreviated format,
since it's not supported in newer versions of Net::Netmask without
a workaround.

Test plan:
0. Set up Koha dev environment on Debian 11
1. perl t/Koha/Middleware/RealIP.t
2. Tests should pass

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alvaro Cornejo <cornejo.alvaro@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-17 12:29:14 +02:00
98263bf009 Bug 18989: (QA follow-up) Make Koha::Biblio->hidden_in_opac aware of OpacHiddenItemsHidesRecord
This patch makes the method aware of the new syspref. It will only eval
the rules against items if the OpacHiddenItemsHidesRecord syspref is
set.

Tests are added to reflect this.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-12 14:12:07 +02:00
1489950a59 Bug 23406: Unit test
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-11 15:37:42 +02:00
e5d42896b8 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>
2021-05-11 14:46:10 +02:00
741d8a0e53 Bug 28272: Fix many things...
This patch could've been splitted into several. But, overall, adding
additionalAttributes: false made the API fail on requests that send
extra info (i.e. cases in which a dev added an attribute to the
underlaying class/table and forgot to deal with it on the API (either
adding it on the spec, or removing it from the response using
Koha::Class::to_api_mapping).

- Koha::Account::Line was missing: credit_type, interface, status,
  register_id and credit_number. I decided to call cash_register_id, and
  to remove credit_number from the response.
  FIXME: We need consensus on a name for the credit_number attribute, and
  add it to the response on the API. It deserves a separate bug. Too
  opinionated for a last-minute fix.
- Koha::Club::Hold::add was returning bad auto-calculated values on
  field that (also) wasn't specified on the spec. Needs a test.
- import_batch_profile had a typo: id_profile vs. profile_id.
- error.json: In this case I reverted the change. This is because some
  routes are adding more 'info' with the error message, and I consider
  this should be done in a more generic approach. Time is required for
  us to think about this. So don't break the API in the meantime.
  FIXME: Implement a generic way to add a payload to error messages on
  the API. Maybe something to work on while on bug 28020.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-11 09:04:13 +02:00
3a3c3aad6f Bug 28108: Fix filtering
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-10 15:52:53 +02:00
1cc8a77c28 Bug 26995: Remove references to relationship column
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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-10 15:46:55 +02:00
Petro Vashchuk
17fbf29d0e Bug 28286: show "Place hold" button if item is holdable
This patch adds "filter_by_for_hold" method in "Items.pm" and
uses it in "cat-toolbar.inc" instead of "filter_by_for_load".

Also this patch removes "filter_by_for_loan" method.

To reproduce the bug:
1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX	that has
item with notforloan value set as "Ordered" (-1)
2) see that button "Place hold" is not present
3) apply the patch
4) refresh the page and ensure that "Place hold" button appears even if
item is "Ordered"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-10 15:46:55 +02:00
c05872ff1d Bug 24154: (follow-up) Make parameter and variable more explicit, add tests
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-10 10:27:53 +02:00
311b0b3c21 Bug 28281: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-07 14:44:00 +02:00
e9d97e9e65 Bug 28278: Uncomment and test access_dirs
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-07 14:44:00 +02:00
Julian Maurice
9d19e85d04 Bug 28278: Add unit test for Koha::Config::read_from_file
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-07 14:44:00 +02:00
Ere Maijala
e74d86a343 Bug 27584: Refactor OAI-PMH paging to improve performance
Includes the following optimizations:
- Use next biblionumber instead of large offset in the queries.
- Use unions instead of subqueries
- Avoid fetching item timestamps when items are not included.

Test plan:

1. Without the patch, try harvesting a Koha database with (and without for good measure) `include_items: 1` in the OAI-PMH configuration file pointed to by preference OAI-PMH:ConfFile and take note of performance. For useful metrics the database must be large enough to not fit in InnoDB buffers or OS file cache.
2. Apply the patch.
3. Run tests: prove -v t/db_dependent/OAI
4. Try again the harvesting from step 1 and compare performance with step 1.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-07 14:44:00 +02:00
Lari Taskula
aa45099442 Bug 14723: Additional delivery notes to messages
This patch adds additional delivery notes to messages in message queue as there
can be multiple reasons for a delivery to fail.

Currently in message_queue we are given only two delivery statuses for messages,
"sent" and "failed". When the status becomes failed, we have no idea why it fails.

This feature can be useful with SMS gateway providers. Many SMS gateways inform
the application the reason of SMS delivery failure. With this feature, this
information can now be stored. As well as for emails, instead of simply logging
failures, we can now store the reason of failure directly into the message row
of message_queue.

Test plan:

1. Enable EnhancedMessagingPreferences syspref
2. Find a borrower with notices at members/notices.pl
3. Observe that there is no column for Delivery notes
4. Apply patch and run the given database update
5. Repeat step 1.
6. Observe that there is now a column for Delivery notes

Sponsored-by: Hypernova Oy

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-07 13:48:55 +02:00
9fab281e54 Bug 27577: Unit test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-06 15:52:38 +02:00
640ba470cf Bug 28288: Prevent XSISBN.t to fail if service is returning 500
16:00:45 koha_1       | WARNING: URL Request Failed 500 read timeout
16:00:45 koha_1       | WARNING: URL Request Failed 500 read timeout
16:00:45 koha_1       | WARNING: URL Request Failed 500 Can't connect to www.librarything.com:443
16:00:45 koha_1       | # Looks like you planned 6 tests but ran 5.
16:00:45 koha_1       | [13:59:51] t/db_dependent/XISBN.t
16:00:45 koha_1       | Dubious, test returned 255 (wstat 65280, 0xff00)
16:00:45 koha_1       | Failed 1/6 subtests
16:00:45 koha_1       | 	(less 3 skipped subtests: 2 okay)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 16:38:27 +02:00
f22a7e3239 Bug 28254: Add missing tests for PUT and POST
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 15:05:37 +02:00
5627f69b2c Bug 28254: Simplify tests
This is only cosmetic, and maybe personal preferences.
It seems easier to create the library object with the pickup_library we
want to use.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 15:04:41 +02:00
102deb8cd9 Bug 28254: (QA follow-up) override -> force
After some discussion we decided that the parameter should be called
'force' for pushign through an action against policy. (as per the
Transfers work).

We decided to stick to 'override' at the API level however as it
highlights the 'human interaction' element of the call.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:08 +02:00
e3baa979cf Bug 28254: Unit tests
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>
2021-05-04 14:22:08 +02:00
de25586ba0 Bug 28254: Add 'override' parameter to Koha::Hold->set_pickup_location
This patch adds a new parameter to the method. If passed+true it makes
the method skip the pickup validation test.

Tests and POD added for this change.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:08 +02:00
542db8c440 Bug 27898: Unit tests
This patch adds unit tests for the PUT /holds/:hold_id route so it
accepts the x-koha-override header and is able to override pickup
location constraints.

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

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>
2021-05-04 14:22:04 +02:00
e5d5fbdd3e Bug 27797: (QA follow-up) Pickup locations can be overridden too
This patch adds regression tests for overridding pickup locations, which
was inadvertedly not covered by the original dev. What this does, is
moving the $can_override variable definition above, and avoid returning
400 if conditions are not met for the passed pickup_library_id, when
$can_override is true.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:04 +02:00
35f7e0ca1c Bug 27797: (QA follow-up) Make tests more robust
This patch makes the tests mock things so the complex holds scenarios
where existing data could interfere, don't get in the middle with what
we need to test.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Nothing broke

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:04 +02:00
01209c228d Bug 27797: (QA follow-up) Additional tests and operator change
I added a few tests to cover additional cases and found the operator precedence
was failing, switched 'and' to '&&'

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:04 +02:00
66e7d7fd94 Bug 27797: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:03 +02:00
25b08f9989 Bug 27760: Improve readabiliity using map
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:02 +02:00
91ce8a098c Bug 27760: Make authenticate_api_request call stash_overrides
By making this method call the helper, we make sure the overrides
hashref is available to any controller to make us of it.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \
           t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass! The helper works as expected and the
authenticate_api_request method invokes it!
3. Sign off :-D

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:02 +02:00
c2cc6b401a Bug 27760: Add stash_overrides helper
This patch adds a simple helper that reads the x-koha-override request
header, and processes it to stash a hashref with the passed overrides.

No check on the overrides themselves is done, as they should be
validated using the OpenAPI spec.

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-04 14:22:02 +02:00
5047557cbf Bug 27932: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:19:01 +02:00
92db5e2247 Bug 28217: Prevent several non-repeatable attributes to be merged
When using the patron merge feature it's possible to generate a patron
with several non-repeatable attributes.

This patch prevents that.

Test plan:
Create 2 patron attribute types, one repeatable and one non-repeatable
Create 2 patrons and add them repeatable attributes
Add a non-repeatable attribute to one of them
Merge the 2 patrons
=> It succeeds, the resulting patron has all the repeatable attribute
and the non-repeatable one.

Do it again but this time add non-repeatable to both patrons
Merge them
=> It fails, you should see an error on the UI
  Merge failed! The following error was reported: Tried to add more than one non-repeatable attributes. type=TYPE value=VALUE.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:07:32 +02:00
a4da4b7568 Bug 28250: Remove upload of debug for Selenium failures
We added an upload of the source page and of the screenshot but both services are discontinued.

If we need them back we must host them ourselves.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:07:31 +02:00
e751ce8cf2 Bug 28249: Prevent Selenium->wait_for_element_visible to fall in an infinite loop
Stop if max_retries is reached

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:07:31 +02:00
0bc1f7d0fa Bug 27636: (QA follow-up) Unit tests for AutoReconcile
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:07:31 +02:00
e2ba01d982 Bug 27636: Be explicit on the exception we expect
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:07:31 +02:00
7c88df8289 Bug 27636: (QA follow-up) Fix tests and validate
This patch fixes the tests for when a negative amount is passed to the
pay method.  Prior to now, a negative amount would have been passed
through and recorded. This was inconsistent with all other accounts
methods and has been deprecated to ensure consistent amounts handling.

This patch also introduces basic validation to prevent negatives being
entered into the UI.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-30 17:07:31 +02:00
061c4c3f11 Bug 28202: Unit test
Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.

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>
2021-04-28 11:16:14 +02:00
0e5c00da4f Bug 17202: Unit tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-28 11:07:06 +02:00
46b2f5b488 Bug 27842: Add tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-28 11:07:06 +02:00
62444c1b9f Bug 28230: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 28230: Add execute bit to test

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-28 11:07:05 +02:00
8fce3401e7 Bug 28234: TestBuilder->build_sample_biblio should set UTF-8 encoding for record
This patch makes the build_sample_biblio method, correctly set the UTF-8
flag for the MARC::Record object.

Tests are added.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/TestBuilder.t
FAIL: Tests fail! An unexpected encoding warning shows
3. Apply this patch
4. Repeat 2
=> SUCCESS: No warning! Tests pass!
5. Sign off :-D

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-28 10:34:36 +02:00
e5f43c6868 Bug 28234: Regression tests
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>
2021-04-28 10:34:36 +02:00
3181539df6 Bug 27636: Update failing test
It would appear that ->pay didn't fully respect AccountAutoReconcile!

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 16:23:49 +02:00
4bb73229b8 Bug 27636: Add payin_amount to Koha::Account
This patch adds a `payin_amount` method to the Koha::Account as a modern
replacement to the `pay` method.

The new method uses the `add_credit` and `Koha::Account::Line->apply`
methods internally for consistency and returns the created credit
Koha::Account::Line result.

Test plan
1/ Run t/db_dependent/Koha/Account.t

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 16:23:49 +02:00
479c8d997e Bug 27995: Unit tests
This patch updates the unit tests for Koha::Account::Line->apply to
reflect the change we wish to make to the return value.

Instead of returning the scalar amount of available credit left on the
credit line after calling apply, we want to return the full, updated,
Koha::Account::Line object including Koha::Object::Messages for the
result of renewals that may have taken place.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 16:23:49 +02:00
d9a508a499 Bug 26734: (QA follow-up) Unit tests for C4::Letters
This patch adds unit tests for the addition of 'include handling' to the
C4::Letters template toolkit functionality.

Test plan
1/ Run t/db_dependant/Letters/TemplateToolkit.t

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 16:23:49 +02:00
Emmi Takkinen
95cbefe12d Bug 26405: Prevent Circulation.t failing on 'AddRenewal left both fines'
Bug 23051 added option to skip calculating fines even when
"CalculateFinesOnReturn" is enabled. Due this Circulation.t
fails on  test  "AddRenewal left both fines" if
"CalculateFinesOnReturn"  is disabled on ones system.
Mocking syspref while testing fixes failig tests.

To test:
1. Disable "CalculateFinesOnReturn".
2. Run prove t/db_dependent/Circulation.t
=> Tests fail
3. Apply patch.
4. Run prove t/db_dependent/Circulation.t again
=> Tests are succesful

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 16:23:49 +02:00
0140f1e626 Bug 28144: Add a regression test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 16:23:49 +02:00
9dbe57b564 Bug 28210: Add issue, replacementprice, and set onloan so check-in tests work
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 11:24:02 +02:00
bc0cf683ee Bug 28210: Unit test
Add a unit test to check that skip_record_index is adhered to when
passed to LostItem with the force_mark_returned option enabled.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 11:24:02 +02:00
7b15138278 Bug 27281: (QA follow-up) Fix Indexer Test
With bug 27281 we removed a call to reset an items holdingbranch back to
the 'frombranch' of the transfer.  This is correct, as with bug 23129
(and friends) we ensure that the holdingbranch was not changed at
transfer request time and instead would only be updated at the reciept
of transfer. As such, it's safe to remove the update here as it would be
just setting the same branch as is already present.

However, when removing this ModItem call, I neglected to realise that
also remoes the requirement for passing around the defered indexing bit
as we no longer need to trigger a re-index as there's not any change to
the item.

This patch therefore cleans up the POD for LostItem, removes the no
longer references 'params' parameter and drops the corresponding index
test.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 11:19:45 +02:00
b9d14bc5a0 Bug 24446: (follow-up) Fix tests
The tests were failing because we weren't actually changing the item, so store was doing nothing.

We need to transfer 'from' a new branch so that the holdingbranch is changed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-27 11:19:11 +02:00
dfa381167a Bug 23971: Fix UsageStats.t
Hum, what's the point of these tests?

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 12:45:41 +02:00
0cdde98445 Bug 27971: Enhance unit tests
This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
35d1c7c41c Bug 27971: Update void method to use double entry accounting
This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
91775dc298 Bug 24300: (QA follow-up) Enhance test and catch failures
The tests did not include testing for offset lines. This patch adds such
tests and updates the function to pass them

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
9a92554c6b Bug 24300: (QA follow-up) Add Unit Tests
Doh! I forgot the unit tests first time around!

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
6c9d15ba49 Bug 27896: Remove DeleteTransfer
This patch removes the last mentions of DeleteTransfer

Test plan
1/ Grep the codebase for DeleteTransfer
2/ It should no longer exist

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
b5db8e9a37 Bug 27281: (QA follow-up) Restore test for holdingbranch
I inadvertantly removed the test that varified that the items
holdingbranch is unaffected by the call to LostItem. This restores such
a test and adds a few comments to clarify the test transfers.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
2a1fb1406a Bug 27281: (QA follow-up) Fix typo
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
7d2da13822 Bug 27281: (follow-up) Clean up LostItem test
The LostItem test was rather messy, and wasn't actually testing much in
reality. This patch cleans it up and adds testing for transfer queue
handling of ListItem cancellations.

Test plan
1/ Confirm t/db_dependent/Circulation.t still passes
2/ Read the tests before and after and confirm that they test what is
required.
3/ Signoff

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
dcd1f2faed Bug 27281: Add unit test for Koha::Item->get_transfers
In the previous patch we introduced the new get_transfers method to the
Koha::Item object. This patch adds proper unit tests for that addition.

Test plan
1/ Apply patches and confirm t/db_dependent/Koha/Item.t passes.
2/ Signoff

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

JD amended patch: fix spelling reqeusted ==> requested

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
7e2679528e Bug 23971: Rename pref with AcquisitionLog
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
Andrew Isherwood
a2609228dc Bug 23971: (follow-up) Make changes for 26582
This commit makes changes necessary to allow this bug to be dependent on
Bug 23562:

- Move basket closure logging from C4::Acquisision::CloseBasket to Koha::Acquisition::Basket::close
- Move basket closure unit test from t/db_dependent/Acquisition.t to
t/db_dependent/Koha/Acquisition/Basket.t

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
Andrew Isherwood
ab61e94dc9 Bug 23971: (follow-up) Fix tests
Following a discussion with Tomás on Slack, this commit implements the
following suggestions:

- Switch from ->find to ->search in tests. ->find is only ever going to return 0
or 1 rows, which doesn't help us if there is breakage which results in
more than 1 row being returned, the test would fail due to ->find not
expecting more than 1 row, but we should be testing for it. So switching
to ->search returns all matching rows.
- Moved tests into their own subtest, they had the potential to pollute
surrounding tests
- Remove all action logs before each test, this ensures we're only
testing the result of the current test

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
Andrew Isherwood
e7aeda0e34 Bug 23971: (follow-up) Add unit tests
This commit adds unit tests for the logging done in Acquisitions.pm

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-23 11:58:49 +02:00
01f0e04172 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>
2021-04-23 10:03:30 +02:00
f096a8dffc Bug 16787: (follow-up) Add and adjust ILSDI tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 17:31:03 +02:00
fee4a653f4 Bug 28002: Unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:12 +02:00
d84ca49570 Bug 28157: Regression tests
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:12 +02:00
5a8855b789 Bug 28157: Add Koha::Patron->can_log_into
This patch adds a new method that tells if the patron is allowed to be
logged into certain library.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:12 +02:00
49d764e413 Bug 23666: (follow-up) Adjust to new exceptions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:12 +02:00
4d011bd998 Bug 23666: Add PATCH /patron/:patron_id/extended_attributes/:extended_attribute_id
This patch adds the described route. It is designed to use the
underlying libraries' methods to update an existing attribute.

The tests cover the use cases.

Note: I added handling for two exceptions that can only occur on bad
data (i.e. not by using our codebase). This are:
- Koha::Exceptions::Patron::Attribute::InvalidType
- Koha::Exceptions::Patron::Attribute::NonRepeatable

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_extended_attributes.t
=> SUCCESS: Tests pass!
3. PLay with the route
=> SUCCESS: Expected behavior!
4. Sign off :-D

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:11 +02:00
12b6d1f792 Bug 23666: (QA follow-up) Fix wrong required permissions
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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:11 +02:00
6e964b1228 Bug 23666: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:11 +02:00
0cabe5e184 Bug 23195: (follow-up) One text invoice should be open
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:11 +02:00
2d505e5ba0 Bug 23195: Unit tests
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:50:11 +02:00
0f23622041 Bug 16787: 'Too many holds' message appears inappropriately and is missing data
This patch alters C4/Reserves.pm to pass back 'noReservesAllowed' when
allowedreserves=0. This allows passing to the user an appropriate
message about the availability of items for holds

This patch also fixes a FIXME about using effective_itemtype to fetch item rules

To test:
1 - Set one itemtype to allow no holds
2 - Set 'Holds per record' to 0 for another itemtype/patron combination
3 - Create or find 2 records, each with items only of the itemtypes above
3 - Attempt to place a hold for a patron on each record above
4 - The message will be 'Too many holds'
5 - Apply patch and repeat
6 - Message should be "Cannot place hold: no item are available to be placed on hold"
7 - Try placing a multihold with either record above and a holdable record,
  message should end "Cannot place hold on some items'
8 - prove -v t/db_dependent/Holds.t

Rebase - Fix test expectation

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:37:14 +02:00
78f6bb6fa1 Bug 23207: Regression tests
This patch introduces a regression test for the case the automatic
checkin happens after the date due. In that case the item souldn't
really be overdue, and the checkin should be recorded with the date due
as return date.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts.t
=> FAIL: The feature doesn't behave correctly

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 14:37:14 +02:00
Agustin Moyano
afa9359d19 Bug 23207: Add test
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Hasina Akhter <HasinaA@pascolibraries.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-22 10:08:32 +02:00
c5b715a853 Bug 23271: Fix random failure from Categories.t
#   Failed test 'The branch limitation should have been stored and retrieved'
 #   at t/db_dependent/Koha/Patron/Categories.t line 57.
 #     Structures begin differing at:
 #          $got->[0] = 'fm0A1a'
 #     $expected->[0] = 'vNquBvCa'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 17:25:23 +02:00
6a941e5b86 Bug 23271: Prevent crash if called without parameters
Can't use an undefined value as a HASH reference at /kohadevbox/koha/Koha/Objects/Limit/Library.pm line 87.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 15:25:07 +02:00
f6e0b04f48 Bug 23271: Replace search_limited with search_with_library_limits
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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 15:25:07 +02:00
5c0c623168 Bug 23271: Use Koha::Object::Limit::Library for Koha::Patron::Categories
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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 15:25:07 +02:00
ff3d99eded Bug 23271: (QA follow-up) Make search_with_library_limits fallback to userenv if required
This patch makes  the generic method rely on C4::Context->userenv if the
library_id is not passed.

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 15:25:07 +02:00
f4568e7f7c Bug 26703: Fix selenium tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 15:25:07 +02:00
c71dda04c6 Bug 20854: Add more CAS tests
This patch aims to add full test coverage for 'logout_cas' the way we do
it nowadays (in a subtest, mocking things, etc). It is provided as a
separate patch so we can test the follow-up tidy and see no behavior
change.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Auth_with_cas.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Apply the refactoring follow-up
5. Repeat 3
=> SUCCESS: Tests still pass!
6. Sign off :-D

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 10:51:29 +02:00
Matthias Meusburger
91307707ed Bug 20854: Allow correct redirect on logout for Cas servers 3.0 and superior.
Test plan:

 1) Apply the patch
 2) Set the system preference casLogout to "Yes"
 3) Set the new system preference CasServerVersion to "CAS 3 or superior"
 4) Check that you are redirected to Koha after a CAS logout from a CAS 3 server
 5) Set the new system preference CasServerVersion to "CAS 2 or inferior"
 6) Check that you are redirected to Koha after a CAS logout from a CAS 2 server

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 10:51:29 +02:00
078c88ea95 Bug 27857: Remove unecessary $attribute_type3 var
It could be created with mandatory=1 and will make tests fail

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 10:44:58 +02:00
d667150e16 Bug 27857: Start a transaction foreach subtest
There is a random failure

     # Looks like you planned 15 tests but ran 2.

 #   Failed test 'extended_attributes'
 #   at t/db_dependent/Koha/Patron.t line 664.
 Missing mandatory extended attribute (type=B0vCQxlI)# Looks like your test exited with 255 just after 7.
 [17:00:24] t/db_dependent/Koha/Patron.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 09:45:03 +02:00
9294ab967a Bug 18729: Add more tests
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>
2021-04-16 16:27:29 +02:00
bf2c59a182 Bug 18729: Add PUT /holds/{hold_id}/pickup_location
This patch adds a route to overwrite the current pickup location.

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>
2021-04-16 16:27:29 +02:00
491147896d Bug 28156: Rename Koha::Account::Line->renewal with is_renewal
It's a boolean, it must be named is_*

Test plan:
Confirm that
  prove t/db_dependent/Koha/Account/Line.t
is still returning green

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 16:20:56 +02:00
d1213134a6 Bug 15986: Rename send_notice to queue_notice and update test count
Signed-off-by: Kim Gnerre <kgnerre@hotchkiss.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 14:15:37 +02:00
f719371662 Bug 15986: Add a script for sending hold waiting reminder notices
This patch adds a script for sending holds reminder notice to patrons.

We add a 'send_notice' routine to Koha::Patrons - this will either send using the patron's
email prefs, or allow forcing of a single method via the cron

To test:
 1 - Create an email hold reminder notice for a single library (Koha module: Holds, code HOLDREMINDER, branch: CPL)
 2 - Set some waiting holds today for patrons at CPL, ensure those patrons have 'email' as the transport for hold filled notices
 3 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -n -li CPL
 4 - You should see the patrons here would have received emails
 5 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -li CPL
 6 - You should see the emails that were sent
 7 - Check the patron notices tab to confirm
 8 - Note a ptron with two holds waiting receives only one notice
 9 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -li CPL -days 3
10 - No notices are sent
11 - Adjust the waiting date for the holds:
    UPDATE reserves SET waitingdate=DATE_SUB(CURDATE(), INTERVAL 3 DAY) WHERE waitingdate = CURDATE();
12 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -li CPL -days 3
13 - Confirm the holds are now reminded
14 - Set yesterday as a holiday for CPL
15 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -n -li CPL -holidays -days 3
16 - Notices should not be sent
17 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -n -li CPL -holidays -days 2
18 - Notices should be sent again
19 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -n -holidays -days 2
20 - Should get feedback that notice was not found for other libraries
21 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -n -holidays -days 2 -mtt sms
22 - Notice is not found
23 - Add the notice for sms
24 - perl misc/cronjobs/holds_reminder.pl -v -lettercode HOLDREMINDER -n -holidays -days 2 -mtt sms
25 - The notice should be sent
26 - Check patrons messaging tab to confirm
27 - prove -v t/db_dependent/Koha/Patrons.t

Sponsored by: The Hotchkiss School (http://www.hotchkiss.org/)

Signed-off-by: Kim Gnerre <kgnerre@hotchkiss.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 14:15:37 +02:00
21ed3887fb Bug 21325: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 14:15:37 +02:00
8277db5fe6 Bug 21325: Fix t/db_dependent/Auth.t test
This patch fixes some warnings in t/db_dependent/Auth.t.

Note that it doesn't add any tests.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 13:56:46 +02:00
559950cae6 Bug 28123: Fix expected value in unit test
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 12:28:18 +02:00
71574961f7 Bug 28125: Display a warning on the about page for OPACHiddenItems is needed
If OPACHiddenItems is containing badly construct it will lead to
inconsistent behaviours. For instance the holds view will not display
any items, when the detail page will display all of them (because we are
not using the same code, we are in transition to merge it).

This patch suggests to add a warning to the about page in case the query
generated by Koha::Items->filter_by_visible_in_opac produces a warning

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

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

Bug 28125: (QA follow-up) Fix missing filter

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 12:28:17 +02:00
1dfa520da5 Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no category passed
GetBorrowersToExpunge must not crash if called with an empty patron
category list

Test plan:
Call delete_patrons.pl with and without patron categories. The script
must work as expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-16 12:28:17 +02:00
6eea10dc53 Bug 27927: Add Unit Tests
Add a unit test to check that 'FORGIVEN' credits do not prompt an
auto-renewal with `RenewAccruingItemWhenPaid` enabled.

Test plan
1/ Apply the test patch
2/ Run t/db_dependent/Koha/Account/Line.t and confirm it fails
3/ Apply subsequent patch
4/ Re-run the test and confirm it passes

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>
2021-04-16 12:28:17 +02:00
66ad8f7727 Bug 25508: Add Unit Tests
Enhance the unit tests to check for the return values of
Koha::Account->pay.

Test plan
1/ Apply just this patch
2/ Run t/db_dependent/Koha/Account.t and watch it fail
3/ Apply the rest of the patch series
4/ Run t/db_dependent/Koha/Account.t and watch it pass
5/ Signoff

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>
2021-04-16 12:01:49 +02:00
b795660540 Bug 21260: (follow-up) Consolidate preference
The bug added a local preference. This should now become a real one.
Renamed in the process to better reflect its use.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-14 16:05:53 +02:00
b010b69052 Bug 21549: Make filter_by_last_update returns a Koha::Objects-based object
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-14 15:34:27 +02:00
6c58590f58 Bug 21549: Rename filter_by_dateexpiry with filter_by_expiration_date
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-14 15:34:27 +02:00
b4ad6987f7 Bug 21549: Use filter_by_last_update from filter_by_dateexpiry
To not reengineer the patch this patch does not remove the new
subroutine but make it use the logic from
Koha::Objects->filter_by_last_update

It also adds a new parameter "days_inclusive"

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-14 15:34:27 +02:00
9cad75c394 Bug 21549: (follow-up) Switch to filter_by
See QA remarks.

Test plan:
Run t/db_dependent/Koha/Patrons.t

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-14 15:34:27 +02:00
1e85ac9612 Bug 21549: Lock expired patron accounts
Adding a search on locked patrons to the search_expired in cron script.
This prevents relocking.

Test plan:
Prove Koha/Patrons.t

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

Signed-off-by: Michal Denar <black23@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-14 15:34:27 +02:00
48ac552699 Bug 24695: Move to Koha::Report->is_sql_valid
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-12 15:27:50 +02:00
Pasi Kallinen
ba5be802e0 Bug 24695: Improve SQL report validation
The saved SQL report code validates the SQL in multiple places:
when saving, when updating, and when executing the query.
Move the validation code into Koha::Reports, and write tests for it.

Test plan:
1) Apply patch
2) Create a new valid SQL report, save it (success)
3) Create a new illegal SQL report, try to save (fails)
4) Update already saved SQL report by adding one of
   the forbidden words, eg. delete or drop (saving will fail)
5) Edit a save_sql in the database, changing it to eg.
   "drop borrowers", and try to execute it (fails)
6) Prove t/db_dependent/Koha/Reports.t

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no qa errors.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-12 15:27:50 +02:00
d57c65c2bd Bug 28031: Add missing txn_begin in Attribute.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:34 +02:00
a431cb8ddf Bug 28031: Fix patron.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:34 +02:00
f382fafae0 Bug 28031: Regression tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:34 +02:00
e453ff963a Bug 27857: (follow-up) Use a more fine-grained exception for mandatory attributes
On using this dev for the API, I found that the original FKConstraint
exception was too generic, and could be confused with those risen by
Koha::Patron->store. So this patch changes the exception that is thrown
in Koha::Patron->extended_attributes

The change is reflected on the test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t
=> SUCCESS: Tests pass, and they include the new exception
3. Sign off :-D

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:30 +02:00
0d59e57508 Bug 27857: Get the right column
This patch makes the search for mandatory attribute types actually use
'code' instead of 'class' for comparisson.

Tests are added to cover this behavior.

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:30 +02:00
881b610db6 Bug 27857: Add handling for globally mandatory attributes
This patch adds handling for globally mandatory extended attributes and
the corresponding unit tests.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:30 +02:00
9e7903dfd6 Bug 27857: Regression tests
This patch adds regression tests for the changed behavior.
Koha::Patron->extended_attributes will now throw exceptions and rollback
on invalid attributes.

The existing tests are amended so they don't try to deal with skipping
bad attributes.

Specific subtests are added for error situations.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t
=> FAIL: Tests fail because the new behavior is not implemented.

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>
2021-04-09 15:43:30 +02:00
1746f28670 Bug 27857: Move extended_attributes tests to Koha/Patron.t
They really belong here. both Patron.t and Patrons.t got lengthy and it
is not intuitive to look for tests for a Koha::Patron method in the
Patrons.t file.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t \
           t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass, no new stuff
4. Sign off :-D

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>
2021-04-09 15:43:29 +02:00
3ee844ff56 Bug 28056: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:29 +02:00
4f3ad7112f Bug 27858: (follow-up) Consistency in stringified exception
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:26 +02:00
032c66bfc9 Bug 27858: Unit tests
This patch introduces unit tests for the new exception to be thrown.
It generates a new extended attribute type, keeps the randomly generated
'code' and deletes the object. This way we can be sure the code doesn't
exist on the DB. It then tries to generate an attribute of that type, to
force the exception to be thrown.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:26 +02:00
e2fe2d217f Bug 27858: Reorganize tests
This patch renames the tests file, and also groups subtests by method.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:26 +02:00
577a405407 Bug 27833: (follow-up) Add InvalidType exception
Working on bug 27857 showed we needed one more exception, for when the
passed attribute type is invalid.

This patch adds the Koha::Exceptions::Patron::Attribute::InvalidType
exception. It adds a format for stringifying it, and tests are added.
The previous exceptions tests lacked one case, so I add them on this
patch as well.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-09 15:43:26 +02:00
e43ce6cc7f Bug 27833: Add 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>
2021-04-09 15:43:26 +02:00
1444fa7641 Bug 27833: Make Koha::Exceptions::Patron::Attribute::* have parameters
This patch adds a 'field' to this exceptions. They now have an
'attribute' parameter referencing the object itself,

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

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>
2021-04-09 15:43:26 +02:00
f3e81738c8 Bug 28097: Mock finesModes to disable recalculation
Since bug 8338 the recalcuated zero amount fine is subsequently removed
in _FixOverduesOnReturn which causes this test to fail if finesMode is
'production' and 'CalculateFinesOnReturn' is enabled.

Perhaps we should be 'VOID'ing fines rather than completely deleting
them, but that's a question for another day.

Test plan
1/ Enable finesMode in the staff client
2/ Run the test and watch it fail
3/ Apply the patch
4/ Run the test and watch it pass

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-08 15:37:40 +02:00
850ad30393 Bug 28013: Unit tests
Cover the case of multiple patrons and multiple items that can fill them

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 16:28:07 +02:00
a620c1bb11 Bug 28078: (follow-up) Add param check to 'itemAlreadyOnHold' test
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 16:28:06 +02:00
d3adcec676 Bug 28078: Add 'ignore_hold_counts' param to CanItemBeReserved
This patch adds an optional param 'ignore_hold_counts' to the routine, while still forbidding holds when 0 are allowed

To test:
1 - prove -v t/db_dependent/Holds.t

Signed-off-by: David Nind <david@davidnind.com>
JK: Commit message amended: Fixed title formatting
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 16:28:06 +02:00
b46d69de37 Bug 27069: Adjust tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 16:08:04 +02:00
f98c4cec8e Bug 27894: Unit tests
This patch adds tests for the changed behavior.

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>
2021-04-07 16:08:04 +02:00
2eb0ac6a3e Bug 26498: (QA follow-up) Add handling for update
This follow-up adds handling for updates as well as the create action as
highlighted by Jonathans comments.  We also adds tests for these cases.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 13:10:31 +02:00
Emmi Takkinen
9fe3c489f4 Bug 26498: Set default expiration date for holds
Koha doesn't automatically set expiration date for holds
so they can live in the system forever. This patch adds
new sysprefs to control setting of default expiration
date for holds. Note that expiration date is only set
if input field for it is left blank.

To test:
1. Apply patch and update database.
2. Enable syspref "DefaultHoldExpirationdate" and set some values
to "DefaultHoldExpirationdatePeriod" and
"DefaultHoldExpirationdateUnitOfTime".
3. Add some holds for patron from staff client or OPAC and leave
expiration date input field blank.
=> Holds expiration date should be set according your settings
4. Disable "DefaultHoldExpirationdate" and repeat step 3.
=> Expiration date shouldn't be set.

Also prove prove t/db_dependent/Hold.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 13:10:31 +02:00
James O'Keeffe
2b607d8414 Bug 24000: Some modules do not return 1
This patch adds "1;" to the end of the following perl files:
Koha/Filter/MARC/EmbedItemsAvailability.pm
Koha/Filter/MARC/EmbedSeeFromHeadings.pm
Koha/Filter/MARC/Null.pm
Koha/Item/Search/Field.pm
Koha/SearchEngine.pm
misc/translator/VerboseWarnings.pm
t/lib/Koha/Plugin/Test.pm

This indicates the succesful execution of the initialization code.

Test plan:
Ensure that there are no other perl files that need "1;", but dont have
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>
2021-04-06 15:56:30 +02:00
fb77238117 Bug 21958: Allow 'e' subfield for authorities
This bug specifically changed the code to allow for e in authority record

This is a tricky issue, see link for discussion:
https://www.loc.gov/marc/marbi/2008/2008-dp05-1.html

It seems to be allowed, but possibly not useful?

In either case I think for now we can allow in the test to fix this error
and possibly open a new bug for further discussion

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-06 15:56:30 +02:00
789a7a8634 Bug 28017: (follow-up) Fix Letters.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-06 15:53:28 +02:00
cb03909af6 Bug 27921: Log correct timestamp for HOLD MODIFY when set waiting
The HOLD MODIFY log at the end of ModReserveAffect is not using an
up-to-date $hold object.

$hold is modified at
1201         $hold->set_waiting($desk_id);
But not refreshed before logged (and so the timestamp is not logged
correctly).

Test plan:
Turn on HoldsLog
Place an item on hold
Check it in to mark it waiting

Confirm that the timestamp logged is the one from the check in, not when
you created the hold

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 18:51:37 +02:00
6840e8d6fb Bug 28017: Test IPs are supported
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 18:51:37 +02:00
d949c4fc20 Bug 28017: Regression tests
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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 18:51:37 +02:00
93a297a7a2 Bug 27928: FindDuplicate should use simple_search_compat
This patch switches from calling SimpleSearch directly to using the compat
method so that Elastic is used when it is the chosen search engine

To test:
 1 - Set SearchEngine syspref to 'Zebra'
 2 - Add a suggestion with an existing title, e.g.:
   'E street shuffle'
 3 - Confirm you get a duplication warning
 4 - Change SearchEngine to ES
 5 - Repeat get same warning
 6 - sudo koha-zebra --stop
    'ps aux | grep zebra'  to confirm they are stoped
    'sudo pkill -9 zebra' if they arent;
 7 - Repeat suggestion - no duplication warning (because zebra returns nothing)
 8 - Delete the suggestion
 9 - Apply patches
10 - Restart all the things, stop zebra
11 - Repeat suggestion
12 - Successful warning from ES
13 - prove -v t/db_dependent/Search.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>
2021-04-01 18:03:23 +02:00
87cc346e48 Bug 27993: Add unit tests
This patch adds a unit test to check that 'in_transit' takes
datecancelled into account.

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 17:58:49 +02:00
07741c30b6 Bug 21260: Introduce local pref to affect status grouping
Introducing a local preference Available_NFL to control which not for
loan statuses are considered to be 'available for reference'.
Standard value is '1|2' which comes down to the former >0 when using
the initial Koha defaults.

Test plan:
[1] Pick a biblio with an available item A, an item B with notforloan 1,
    an item C with notforloan 2 and two damaged items. (Former patch.)
    Include it in a OPAC search. You should see:
        Available: A. Reference: B, C. Not-available: Damaged(2).
[2] Add local pref Available_NFL with value '1'. Repeat the search.
    You should see now:
        Available: A. Reference: B. Not-available: S.C.(1), Damaged(2).
    [where S.C. stands for Staff Collection]
[3] Run test t/db_dependent/XSLT.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: ava li <rubyli208@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 17:58:49 +02:00
faf33a27ab Bug 21958: (QA follow-up) Correct indirect object notation
Our coding guidelines now forbit indirect object notation calling.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 17:13:56 +02:00
Ere Maijala
016bb29b60 Bug 21958: Fix bibliographic record field comparison with authority
This makes the comparison between bibliographic field and authority field more robust and per subfield. This makes the comparison not consider the same e.g. the following fields:

$a Test User
$a Test $b User

The actual issue cannot be as easily reproduced with the patches for bug 21826 applied, but here's a test plan anyway:

1. Make sure tests pass (especially t/db_dependent/AuthoritiesMarc*)
2. Make sure authority linking still works properly
3. Make sure authority and biblio frameworks allow subfield i
4. Make sure that even if you add subfield i to 700 in biblio, authority link is kept the same
5. Make sure that even if you add subfield i to the authority record, the authority link is kept the same

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 17:13:56 +02:00
ad55a2b4d8 Bug 28023: Regression tests
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>
2021-04-01 17:06:42 +02:00
539c9e5c9b Bug 26705: (QA follow-up) Do not rely on latest Email::MIME
This patch makes the implementation use lower-level methods to deal with
headers. So the Email::MIME library in Debian 9 works.

Params are sorted for testing purposes.

To test:
1. Apply this patch
2. Run the tests
=> SUCCESS: Things pass in D9+
3. Sign off :-D

Thanks Kyle!

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 17:06:41 +02:00
8d7bd9a8e7 Bug 26705: (QA follow-up) Clarify test result
Simple output string improvement to fix the copy/paste of the previous
tests comment string.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-01 17:06:40 +02:00