Commit graph

6071 commits

Author SHA1 Message Date
Julian Maurice
389b9dfaf4
Bug 31441: Fix Koha::Item::as_marc_field when kohafield = ''
marc_subfield_structure.kohafield can be NULL, but it can also be an
empty string. But in that case, Koha::Item::as_marc_field ignores them,
which means the resulting MARC::Field object has missing data.
This can produce a bug in OPAC ISBD view (and probably other places
where this method is used)

Test plan:
1. Edit the default biblio MARC framework for the item field: find or
   create a subfield that is not linked to a DB column.
   Save even if you made no changes to make sure that
   marc_subfield_structure.kohafield is set to an empty string.
   I'll use 995$Z as an example for the following steps.
2. Add the following to syspref OPACISBD:
    #995|<br>Item:|{995Z}|
3. Create a biblio with an item and put a value into 995$Z
4. Go to the ISBD detail page for this record at OPAC. Confirm that the
   value you entered in 995$Z is not visible
5. Apply patch and restart koha
6. Refresh the ISBD detail page. Confirm that the 995$Z is now visible.
7. Run `prove t/db_dependent/Koha/Item.t`

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-03 08:40:01 -03:00
6f8088805d
Bug 30571: Z3950Servers.t - Add another subtest
Subtest for testing nullability of host, syntax and encoding.

Test plan:
Run prove t/db_dependent/Koha/Z3950Servers.t.
(Note: you need strict mode to pass this test.)

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

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-03 08:29:25 -03:00
c24a67a28d
Bug 30571: Z3950Servers.t - Create subtest for existing tests
No real changes, just moving code and indentation.
Ground work for following patch.

Test plan:
To let the test pass, disable strict_mode in koha-conf.
Run perl t/db_dependent/Koha/Z3950Servers.t. Should pass now.
However, in strict mode or with prove, it should fail.
Run prove t/db_dependent/Koha/Z3950Servers.t. Failed?

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

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-03 08:29:24 -03:00
Julian Maurice
a4f09abd5c
Bug 25375: Fix QueryBuilder.t tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-26 09:53:23 -03:00
e509485161 Bug 29744: (QA follow-up) Only consider PLACK_ENV for underscore
When run under certain circumstances (in jenkins, for example) some ENV
variables are set for convenience, like PLACK_WORKERS and
PLACK_MAX_REQUESTS and is causing some tests to fail (notably, shib
ones).

This patch makes the regex only consider PLACK_ENV when testing for the
underscore case.

Tests are updated accordingly, and they are also rewritten to test for
boolean values instead of empty string, or zero or one, etc. The
implementation shouldn't matter as long as the boolean evaluation is
correct and it is clearer for devs what to expect.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 12:05:05 -03:00
aa4dc15b97
Bug 31105: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:56:46 -03:00
3f70c9d6bc
Bug 23538: Unit tests
Test plan:
1. Run unit tests:
sudo koha-shell <instance>
cd t/db_dependent/Koha
prove -v Patron.t

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: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:37:54 -03:00
87012104bd
Bug 30484: (follow-up) Fix tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:33:48 -03:00
Andrew Isherwood
3b8a4f21be
Bug 30484: Add unit tests
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

https://bugs.koha-community.org/show_bug.cgi?id=28909
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:18:46 -03:00
471facdf26
Bug 25375: Adjust tests and test itemlost, not notforloan
Previous commit correctly lists Zebra availability test, but was a
bad edit. This fixes the availability test to use itemlost

Additiionally, tests were written before limits were agreed. Adjusted
for the current settings

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:01:25 -03:00
Julian Maurice
f48c5bbb8b
Bug 25375: Add tests for the "available" ES field
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:01:24 -03:00
aac6a2f155
Bug 30982: (QA follow-up) No userenv, no jobs
+    # Assume permission if context has no user
+    my $can_manage_background_jobs = 1;
=> This felt a bit unsafe.

Test plan:
Try interface for jobs. Call API with cookie. Call API with OAuth.
Run t/db_dependent/Koha/BackgroundJobs.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:51 -03:00
88cc881521
Bug 30982: API tweaks
This patch makes the following changes to the 'background_jobs' API:

* We now call them 'jobs'
* Removed deprecated query parameter definitions
* Added only_current query parameter
* Controller gets adapted to use $rs->filter_by_current when
  only_current is passed

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:49 -03:00
c1c9700c63
Bug 30982: Add Koha::BackgroundJobs->filter_by_current
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:49 -03:00
b9b3b93d93
Bug 30982: Add tests and implement GET /background_jobs/$id
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:48 -03:00
3734ae1b29
Bug 31389: (QA follow-up) Missing permissions in tests
The following bugs refined permissions a bit, and the change was missing
on the tests:

* 23681
* 30335

Bonus: sorted permissions alphabetically for readability.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:59:17 -03:00
Joonas Kylmälä
8687ad6ef1
Bug 31389: (QA follow-up) Correct test message
The test in question concerns non-superlibrarian staff users.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:39:22 -03:00
897fe20683
Bug 31389: Calculate user permissions in separate function
This patch refactors the setting of user permissions for templates into
a new function, which can be easily unit tested and reduces the amount
of code in C4::Auth::get_template_and_user(). It also aids in the
re-usability of permission checking code.

Test plan:
0) Apply patch and koha-plack --restart kohadev
1) prove t/Koha/Auth/Permissions.t
2) As koha superlibrarian, go to
http://localhost:8081/cgi-bin/koha/tools/tools-home.pl
3) Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl
4) Create new test user with "Staff access..." and "Remaining circulation permissions"
5) Logout of koha superlibrarian
6) Login as test user
7) Note you can only see a limited view of the staff interface
(i.e. no administration, no tools, no reports, etc.)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:39:21 -03:00
Julian Maurice
ca338bae1e
Bug 27550: Add unit test for CloneBudgetHierarchy
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:18:43 -03:00
097b2afb17
Bug 29744: (QA follow-up) Add underscore test, move to OO
The underscore test comes from bug 31468.
Context methods should actually be OO.

Test plan:
Run t/Context.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:11:57 -03:00
9a92ee3194
Bug 31598: Fix random failure on Jenkins for Upload.t
At some point the warn is made conditional for permanent
files. So it failed when TestBuilder picked a zero value
for permanent. Trivial fix.

Test plan:
Run t/db_dependent/Upload.t a few times

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:07:01 -03:00
b1e3398e84
Bug 30359: Unit tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-21 19:02:22 -03:00
848813bccf
Bug 27421: (follow-up) Add exec flag
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-19 15:14:57 -03:00
89e4e2906a
Bug 27421: Add tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-19 15:14:57 -03:00
d8b15c685c
Bug 30025: Split BiblioAddsAuthorities into two sysprefs
This patch adds two new sysprefs:
AutoLinkBiblios
AllowManualAuthorityEditing

Both inherit the setting from BiblioAddsAuhtorities which is removed

To test:
1 -Apply patches
2 - Update database
3 - Confirm old setting is transferred to new option
4 - Confirm you can edit authoriteis manually if AllowManualAuthorityEditing set to allow
5 - Confirm you cannot edit authorities manually if AllowManualAuthorityEditing set to don't allow
6 - Confirm a new bib is linked when AutoLinkBiblios is enabled (set AllowManualAuthorityEditing to add unlinked heading)
7 - Confirm new bib notlinked when AutoLinkBiblios is disabled
8 - Confim new bib not linked when AutoLinkBiblios is enabled, but heading doesn't match an authority and  AutoCreateAuthorities is disabled
9 - Confim new bib linked to new authority when AutoLinkBiblios is enabled, but heading doesn't match an authority and  AutoCreateAuthorities is enabled

Signed-off-by: AFHDubCoLib <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 16:48:30 -03:00
2a1d85fc32
Bug 15348: Add estimated delivery date field to individual orders
This patch allows you to specify an estimated delivery date per order.
The specified estimated delivery date is also considered when searching
for late orders and exporting late orders. You can also edit the
estimated delivery date from the late orders page.

Test plan:
1. Update database, rebuild schema, restart services
2. Go to Acquisitions, search for a vendor, and create a new basket
3. Add an order to the basket. When filling in the accounting details,
notice the new 'estimated delivery date' field, but don't add a date.
Save the order.
4. Confirm no date shows in the estimated delivery date column in the
orders table.
5. Modify the order. Add a date in the estimated delivery date field and
save the order.
6. Confirm the date now shows in the orders table.
7. Close the basket.
8. Go to the Late Orders page.
9. Put estimated delivery date from and to parameters in the search
filters on the left. Ensure the from and to dates encapsulate the date
you entered in the estimated delivery date field for the order.
10. Click Filter and ensure the order shows.
11. Select the checkbox next to the order. Click the Export as CSV button.
12. Open the CSV and confirm the estimated delivery date that you
entered shows as expected in the file.
13. Click Edit under the estimated delivery date. Confirm the estimated
delivery date modal pops up with the correct order line number in the
modal header.
14. Remove the estimated delivery date and click Save.
15. Confirm that the estimated delivery date calculated by Koha now
shows in the late orders table.
16. Select the checkbox next to the order. Click the Export as CSV button.
17. Open the CSV and confirm the calculated estimated delivery date
shows in the CSV.
18. Confirm tests pass: t/db_dependent/Koha/Acquisition/Order.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 10:36:53 -03:00
2ed25b7442
Bug 29144: Remove opac_info from a few tests
Test plan:
Run t/db_dependent/Circulation/GetHardDueDate.t
Run t/db_dependent/Circulation/OfflineOperation.t
Run t/db_dependent/RotatingCollections.t
Run t/db_dependent/api/v1/libraries.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 09:55:20 -03:00
68a900132e
Bug 29144: Add $contents->find_best_match, $library->opac_info
Test plan:
Run t/db_dependent/Koha/AdditionalContents.t
Run t/db_dependent/Koha/Library.t

Note: You may need to set ListOwnershipUponPatronDeletion to
delete to fix a pending issue in patron->delete with lists.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 09:55:19 -03:00
14cfdfd727 Bug 31236: Add ability to send custom item fields via SIP using Template Toolkit
Koha has been able to send arbitrary item fields via the "item_field" parameter in the config. We have partners that need the ability to created custom item fields from templates, as the item_fields feature cannot accomplish what they need. We need to add a templated custom field feature for items, similar to what we have for patrons.

Test Plan:
1) Apply this patch
2) Choose a SIP login to use, edit that account and add the following
   *inside* the login section:
   <custom_item_field field="IN" template="[% item.itemnumber %]" />
3) Restart SIP
4) Run an item information query
5) Note the itemnumber is sent in the IN field!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: fixed tests count
2022-09-12 17:44:36 -03:00
1e9f6e61d5
Bug 20058: (QA follow-up) Simplify test code
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 17:39:38 -03:00
David Gustafsson
66d2696b3e
Bug 20058: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 17:39:38 -03:00
daf2e4b3c2
Bug 30921: Replace C4::XSLT::transformMARCXML4XSLT with RecordProcessor
This patch removes the last remaining uses of transformMARCXML4XSLT and
replaced them with the equivilent RecordProcessor usage.

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

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 16:26:34 -03:00
cffd36bcb4
Bug 31250: (QA follow-up) The future will be easier
As requested by Jonathan, we need more flexibility ;)
Here it comes.

Test plan:
Run t/CookieManager.t

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 15:34:11 -03:00
cb036faf2c
Bug 31250: Deny clearing cookies with numeric suffix
This change allows us to add catalogue_editor_ to the deny list
in koha-conf.xml and keep cookies like catalogue_editor_123.

Test plan:
Run t/CookieManager.t

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

To test:
1 - Sign in to staff client
2 - Search for records and edit one
3 - Switch to advanced editor
4 - View cookies (F12/developer panel/storage tab)
5 - Note cookie like 'catalogue_editor_##' with value 'advanced'
6 - Log out
7 - note cookie value deleted
8 - Log in and search/edit a record
9 - Basic editor loads
10 - Apply patch
11 - Add line to koha-conf as described in second patch
12 - Restart all
13 - Switch to advanced editor
14 - Cookie value updated
15 - Logout
16 - Cookie value remains
17 - Log in and search/edit
18 - Confirm advanced editor loads

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 15:34:11 -03:00
f60a9c50dc
Bug 27981: (QA follow-up) GetMarcBiblio was removed from codebase
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 15:28:08 -03:00
ab358f06da
Bug 27981: (follow-up) Fix tests
Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 15:17:36 -03:00
Nuño López Ansótegui
62b2fc31bd
Bug 27981: Add option to automatically set 001 to the biblionumber
This patch adds a new system preference:
autoControlNumber

The option "biblionumber" will set field 001 to the biblionumber when you create a new record
or edit an existing record and clear the 001 field.

If a value is present in 001 when saving the record it will be preserved.

If set to 'OFF' the 001 field wil not be touched

When duplicating a record the 001 will be removed if autoControlNumber is set

To test:
 1 - Apply patches and updatedatabase
 2 - Create a new record with no 001 field
 3 - Save and view the MAC, confirm there is no 001
 4 - Set the system preference to 'biblionumber'
 5 - Edit the record you created previously
 6 - Note the 001 is prepopulated with the biblionumber
 7 - Delete the field
 8 - Save the record
 9 - View the MARC, the 001 is filled with biblionumber
10 - Edit the record
11 - Set the 001 to a different value "Not the biblionumber"
12 - Save
13 - View the marc and confirm the value you entered is retained
14 - Edit a record with an existing 001 that is not the biblionumber
15 - Save and confirm 001 is not updated

To test duplication:
1 - Edit a record as duplicate when using the advanced editor
2 - Confirm the 001 does not load, but record saves correctly
3 - Edit the record
4 - Switch to 'basic editor'
5 - Save, then view record
6 - Edit as duplicate in basic editor
7 - Confirm the 001 is removed
8 - Confirm the 001 is added on save

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

Signed-off-by: Thomas Klausner <domm@plix.at>

Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 15:17:36 -03:00
14f52725d3
Bug 31351: (QA follow-up) Trivial string fix
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 14:04:41 -07:00
99b15ee5df
Bug 31351: (QA follow-up) Extend the encode/decode test
Adding some Unicode stuff.
And missing txn couple.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:59:11 -07:00
727193dead
Bug 31351: (QA follow-up) Adjust tests accordingly
Test plan:
Run t/db_dependent/Koha/BackgroundJob.t
Run t/db_dependent/Koha/BackgroundJobs.t
Prove t/db_dependent/Koha/BackgroundJobs

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:59:07 -07:00
c5810c3605
Bug 31401: (QA follow-up) Remove Koha.ArePluginsEnabled, it is no longer needed
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:55:37 -07:00
df184560a5
Bug 31023: Unit tests
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:52:35 -07:00
e36e6c55a7
Bug 28290: (follow-up) Unit test
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:50:37 -07:00
d32a205a69
Bug 27272: Remove GetItemsInfo, GetItemsLocationInfo and GetHostItemsInfo
With the different bug reports we removed the calls for those 3
subroutines. We can remove them now.

Test plan:
git grep their names and you should not find any occurrences in the code
base

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-31 17:50:51 -03:00
8bd4edebf9
Bug 29697: (QA follow-up) Remove useless warning
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-31 12:34:39 -03:00
73bde2cca3
Bug 29697: (QA follow-up) Make tests less fragile
This patch makes the tests less fragile to existing data. It does so by
making sure that when checking if the item would be hidden by
OpacHiddenItems and lost status, the item is not skipped, and thus the
notforloan value, as retrieved from the search engine is picked for the
notforloan_count calculation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-31 12:31:53 -03:00
02326ebf24
Bug 30016: Remove GetOpenIssue subroutine
This patch adjusts the code that uses GetOpenIssue to use/find a Koha::Checkout object
instead

To test:
1 - Add a course to course reserves
2 - Create an item with barcode TESTKOC
3 - Add the item to a course
4 - Checkout the item
5 - View course details on stff and opac and confirm item shows as checked out and due date displays
6 - prove t/db_dependent/Circulation/issue.t t/db_dependent/Circulation.t t/db_dependent/CourseReserves.t
7 - Browse to Circulation->Upload offline circulation
8 - Upload a file to return the item: https://wiki.koha-community.org/wiki/Koha_offline_circulation_file_format
9 - Confirm item is returned

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-31 08:50:37 -03:00
3a5fb22ad8
Bug 31473: Fix fragile test about bad OpacHiddenItems conf
There's been a behavior change in recent MariaDB that made some cases
deal with truncated data in DOUBLE context instead of DECIMAL.

Probably this:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-27380

This made the affected test fail consistently on those versions.

This trick for checking OpacHiddenItems is correct (as introduced on bug
28125 doesn't really make use of the warning, just prints it in
about.pl) so one option was to just check for a warning.

I decided to keep the test, but add the optional DECIMAL|DOUBLE check on
the qr. This way other eventual changes will make it fail and serve as a
warning in case something more relevant changes.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-26 16:49:30 -03:00
73c3c5d2f1
Bug 31112: (QA follow-up) Reduce database queries
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-26 15:59:24 -03:00
Joonas Kylmälä
15f622ecc1
Bug 31112: CanBookBeRenewed: take into account patrons with more than 1 hold to a biblio
If a single patron had more than 1 hold to a biblio and there was only one
available item we allowed incorrectly renewing the checkout when
AllowRenewalIfOtherItemsAvailable was set to "Allow". This
changes CanBookBeRenewed so that it makes sure all the holds are
filled and not just one per patron.

To test:
 1) prove t/db_dependent/Circulation.t
 2) (Optional, as unit test is provided)
    - Set AllowRenewalIfOtherItemsAvailable = Allow
    - Create biblio with three items
    - Checkout one item to patron A
    - Add two biblio-level holds for patron B
    - Try to renew patron A's checkout with and without this patch.
    - Notice that without this patch the renewal succeeds even though we
      one unfilled hold left. After applying the patch the renewal should
      fail.

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

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-26 15:59:03 -03:00