Commit graph

7522 commits

Author SHA1 Message Date
c8cc04a397
Bug 35044: (QA follow-up): DRY code before set_additional_fields
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:26 +02:00
27fd0042be
Bug 35044: Add tests
Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:25 +02:00
765c724f98
Bug 37672: Add tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:18 +02:00
e6ef792e10
Bug 37672: Make V1/RecordSources.pm use more helpers
This patch adapts the controller class to match the current guidelines
by makiing use of the provided helpers.

The tests are adapted.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:18 +02:00
5fe1ad8ac6
Bug 35402: Update the OPAC and staff interface to Bootstrap 5
This patch updates the OPAC and staff interface to use Bootstrap 5.
Bootstrap CSS assets are now pulled from node_modules and compiled into
staff-global.css and opac.css at build time. This update lays the
foundations of some other chnages, especially the addition of a dark
mode in the future.

Hundreds of templates have been updated, mostly with updates to the grid
markup. Most of the responsive behavior is still the same with the
exception of improved flexibility of headers and footers in both the
OPAC and staff interface.

The other most common change is to add a new "namespace" to data
attributes used by Bootstrap, e.g. "data-bs-target" or "data-bs-toggle".
Modal markup has also been updated everywhere. Other common changes:
dropdown button markup, alert markup (we now use Bootstrap's "alert
alert-warning" and "alert alert-info" instead of our old "dialog alert"
and "dialog info").

Bootstrap 5 now uses CSS variables which we can override in our own
'_variables.scss' (in both the OPAC and staff) to accomplish a lot of
the style overrides which we previously put in staff-global.scss.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 15:58:41 +02:00
6bc8900fcc
Bug 35026: (follow-up) Create data for tests and do not rely on state of DB
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-21 19:13:52 +02:00
91095d93ef
Bug 35026: (QA follow-up): Fix QA tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:48 +02:00
a91206b893
Bug 35026: Fix unit tests
This patch fixes the unit tests that were failing and also removes some tests that should not be introduced until bug 34355

Test plan:
prove t/db_dependent/Koha/MarcOrder.t

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:47 +02:00
0042b7d1d6
Bug 35026: Add unit tests
This commit adds a set of unit tests for the new methods in Koha::MarcOrder

The two controller functions at the start of the file have not been included as they simply call the functions in these tests

The _stage_file method is also not included as this is a copy of the existing file staging code with the background job functionality removed

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:45 +02:00
Janusz Kaczmarek
da5aa7faba
Bug 32696: Unit tests
Added unit tests.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 17:29:55 +02:00
Aleisha Amohia
0e61e56e57
Bug 37623: Make t/db_dependent/Letters.t idempotent
The tests should be unaffected by system preference settings, such as EmailFieldPrimary.

To test:
1. Log into the staff interface
2. Go to Koha Administration -> Global system preferences, and search for EmailFieldPrimary
3. Change the EmailFieldPrimary preference to something other than 'primary email' and 'first valid email address', i.e. any of the following:

* alternate email
* card number
* secondary email
* selected addresses

4. Run tests t/db_dependent/Letters.t and notice they fail

5. Apply the patch

6. Run the tests again t/db_dependent/Letters.t with different settings of EmailFieldPrimary. The tests should always pass.

Sponsored-by: Pymble Ladies' College
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 17:29:53 +02:00
538868d5f5
Bug 37620: Improve cypress test to reduce random failures
This patch makes some improvements to the Infinite Scroll cypress test to try and prevent random test failures

- Fixes X-Base-Count and X-Total-Count for intercepted requests
- Makes element selection more precise
- Adds an intercepted request returning the requrired result for the filtered search
- Awaits this request before selecting an element from the dropdown
- Awaits all 10 requests triggered by typing "License 50" rather than just the first one
- Ensures that the select dropdown is closed between operations by clicking into another field to remove focus from the select dropdown

Test plan:
1) yarn cypress run --spec t/cypress/integration/InfiniteScrollSelect_spec.ts
or
1) yarn cypress open and select the InfiniteScrollSelect test from the Cypress GUI

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 16:07:16 +02:00
8da67cec72
Bug 37510: Fix Objects.t and remove FIXME
This patch makes the tests check for the added exception instead of the
generic DBIx::Class::Exception.

A FIXME was set in place proposing we should throw a Koha::Exception
instead, so removing the FIXME as that's what this patch actually did.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 14:33:37 +02:00
8830cd7eff
Bug 37628: (follow-up) Remove get_opac_news_by_id
Keep the same behaviour, but wondering why we don't return 'content'
when there is no match.

ie.
+    is( $additional_contents, undef );
should certainly be
+    is( $additional_contents->{content}->count, 0 );

WNC amended patch - tidied

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 17:33:51 +02:00
30a5baa706
Bug 37510: Unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 17:33:46 +02:00
0c029ee849
Bug 37508: (QA follow-up) Use ->check_columns
Add shebang to Guided.t too.

Test plan:
See also previous commits.
Try sql like:
  select access_token from oauth_access_tokens

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 16:22:26 +02:00
aebc7ba8db
Bug 37508: (QA follow-up) Move check to Koha::Report, extend
Do not allow password but allow password_expiry_days etc.
Do not allow token, secret and uuid too.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 16:22:25 +02:00
8e05b3933b
Bug 37508: Test for errors when returning an aliased password column
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 16:22:24 +02:00
Aleisha Amohia
947865f83b
Bug 37508: Throw error if password column is detected in SQL report
This enhancement prevents SQL queries from being run if they would return a password field from the database table.

To test:

1. Run tests and notice they fail t/db_dependent/Reports/Guided.t

2. Apply patch and restart services

3. Create a public report with an SQL report which would access a password column in a database table
4. Try to run the report. Notice you are met with an error and the results are not shown.
5. Access the JSON URL, you should not get the results and should be shown an error
6. Confirm tests pass t/db_dependent/Reports/Guided.t

Sponsored-by: Reserve Bank of New Zealand
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 16:22:23 +02:00
4c5425bd2f
Bug 37575: Typo 'AutoCreateAuthorites' in about.pl
Typo in system preference name 'AutoCreateAuthorites' ->  'AutoCreateAuthorit[i]es'

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-16 16:22:18 +02:00
6a7f86f634
Bug 36169: (QA follow-up) Tidy tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-09 18:44:55 +02:00
54ef9bd775
Bug 36169: Patron categories with type='Staff' should be able to have guarantees
Library staff - whose patron category has a type='Staff' should be able to have guarantees added.

Test plan:
1) Create a 'Library staff' patron category with 'Category type' = 'Staff'

2) Create a patron account using the 'Library staff' patron category

3) Notice the '+ Add guarantee' button is not displayed in the members toolbar for the 'Library staff' patron you created

4) Apply patches and restart services

5) Refresh your browser window

6) Notice the '+ Add guarantee' button is now displaying for the 'Library staff' patron

7) Confirm you can successfully add a guarantee

8) Run unit test t/db_dependent/Koha/Patrons.t

Sponsored-By: Waitaki District Council, New Zealand
Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-09 18:44:55 +02:00
9a8a534c8a
Bug 36758: (QA follow-up) Tidy Ticket.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-09 18:44:53 +02:00
4e99c1bc85
Bug 36758: (QA follow-up) Fix some typos
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-09 18:44:52 +02:00
d4d9bf97e9
Bug 36758: Unit tests for assignee notification trigger
This patch adds unit tests for the TICKET_ASSIGNED trigger being
introduced with this patchset.

Test plan
1) Run the unit tests prior to the next patch and confirm they fail
2) Apply the next patch and confirm the unit tests now pass

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-09 18:44:51 +02:00
Johanna Räisä
f5c8393480
Bug 36217: Fix background jobs page's include_last_hour filter
Test plan:
1) Create a background job
2) Go to the background jobs page
3) See your job listed
4) Unselect "include_last_hour" from the filter
5) Verify that the job is not listed
6) Apply the patch
7) perl build-resources.PL
8) Repeat steps 1-3
9) Verify that the job is now listed
10) prove t/db_dependent/Koha/BackgroundJobs.t
11) Verify that the tests pass

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-09 17:36:19 +02:00
d5f0191bda
Bug 37373: (follow-up) Add id and adjust tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-08 15:53:28 +02:00
411a885829
Bug 36515: (QA follow-up) Tidy code
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-02 19:00:05 +02:00
4923a5841e
Bug 36515: Add unit tests
Test plan:
1. Run unit tests
ktd --shell
prove t/SimpleMARC.t

Sponsored-by: Education Services Australia SCIS
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-02 19:00:04 +02:00
897f4f319b
Bug 37389: (QA follow-up) Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-02 18:59:55 +02:00
bbf52b754f
Bug 37389: Add tests
prove t/Koha/REST/Plugin/Query.t
prove t/db_dependent/Koha/Objects/Mixin/ExtendedAttributes.t

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-02 18:59:53 +02:00
c1fa65d72d
Bug 37535: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 18:22:36 +02:00
35e9ac9b0a
Bug 37018: Add 400 response definition to all routes
This patch adds a test for well defined 400 responses on all verbs and
paths on the API spec.

The tests verify:

* Presence of 400 response definition
* The description must start with 'Bad request' (needs coding guideline)
* If DBIC queries are allowed on the route, then `invalid_query` needs
  to be mentioned in the description.

All routes get fixed to make the tests pass.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ prove xt/api.t
=> SUCCESS: Tests pass!

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 17:26:44 +02:00
c77c44be6d
Bug 37018: Handle exception in unhandled_exception() helper
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 17:26:43 +02:00
470db1620f
Bug 37018: Unit 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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 17:26:40 +02:00
5a6b8c4166
Bug 37018: Regression tests
This patch adds regression tests. With the current codebase, the
malicious query returns a 200. It should be caught and a 400 needs to be
returned.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: It returns a 200
3. Once the rest of the patches are ready, repeat 2
=> SUCCESS: It returns a 400

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 17:26:39 +02:00
a4fef6b201
Bug 37146: Add tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-01 17:26:37 +02:00
3d76ccdf94
Bug 37476: Unit tests
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-26 14:50:45 +01:00
a0f89e7e98
Bug 37378: Tidy
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-26 14:49:18 +01:00
fb768ebbb8
Bug 37378: Unit test
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-26 14:49:18 +01:00
43985e90db
Bug 36936: (QA follow-up) Make the test work on MySQL 8.x
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-07-25 14:46:41 -03:00
4a4469fd6a
Bug 35539: Remove 'issuelimit' column/field from categories table
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:11:16 +01:00
581903289d
Bug 35539: Remove 'finetype' column/field from categories table
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:11:14 +01:00
6d4b201823
Bug 35539: Remove 'bulk' column/field from categories table
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:11:08 +01:00
728e83bb47
Bug 36996: Add z3950Status system preference
This bug adds a new system preference 'z3950Status' which takes a yaml block and marks any items matching
the conditions as unavailable via z3950 results

It obeys the existing z3950 extra fields, adding item ststus to field $k

To test:
0 - Apply patch, update database
1 - Setup your koha to use itself as a z39 source in Administration/Z3950/SRU servers:
    host: localhost
    port 2100
    database: biblios
    syntax: MARC21 (or UNIMARC if applicable)
2 - Uncomment the config line in /etc/koha/sites/kohadev/z3950/config.xml
    Also make sure to remove the backslashes escaping the hyphens
3 - Restart all
4 - Cataloging - New from Z3950
5 - Search your records, view the marc to confirm status subfield $k is included
6 - Add items to a record with various statuses (lost,damaged,withdrawn) and itemtypes
7 - Edit syspref AdditionalFieldsInZ3950ResultSearch o add 952$k
8 - Search for record above - confirm statuses show as expected
9 - Edit new syspref z3950Status - confirm the language of the pref makes sense
    itype: [BK]
    ccode: [REF]
10 - Search z39 again and confirm items and collection codes are marked 'SYSPREF' in $k
11 - Edit Authorized values - add category Z3950_STATUS
12 - Add authorized vlaue: SYSPREF with Description: System preferenced
13 - Restart all
14 - Search z39 again and confirm statuses show new description

Sponsored by: Northeast Kansas Library System <https://www.nekls.org>
Sponsored by: South East Kansas Library System <https://www.sekls.org>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-23 16:53:03 +01:00
Aleisha Amohia
227c38a3c9
Bug 23781: Tests for Recalls messaging preferences
- t/db_dependent/Koha/Recall.t
- t/db_dependent/Koha/Recalls.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-23 16:38:04 +01:00
a5710c49db
Bug 28762: (QA follow-up): fix number of tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-23 16:04:07 +01:00
fdefef1444
Bug 28762: Rename not_for_loan as effective_not_for_loan_status
This patch updates the method name to follow current conventions.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-23 16:04:07 +01:00
4e6d9d13bf
Bug 28762: Replace is_notforloan with not_for_loan
This patch replaces the use of is_notforloan with not_for_loan and
removes the older is_notforloan method and tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-23 16:04:06 +01:00
0d5c224cc3
Bug 28762: Confirm return of not_for_loan in boolean context matches is_notforloan
This patch is simply here to prove that is_notforloan is just
not_for_loan but in a boolean context.. we'll remove it in the next
patch.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-23 16:04:06 +01:00