]> git.koha-community.org Git - koha.git/log
koha.git
7 months agoBug 35248: Refactor - Move assign_item_for_booking
Martin Renvoize [Wed, 7 Feb 2024 17:10:40 +0000 (17:10 +0000)]
Bug 35248: Refactor - Move assign_item_for_booking

This routine really belongs inside Koha::Booking rather than
Koha::Biblio. This patch moves it there, renames with _ to highlight
it's private nature.

Test plan
1) Confirm that t/db_dependant/Koha/Booking.t still passes, specifically
   the 'store' test.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add tests for Koha::Booking->store
Martin Renvoize [Wed, 7 Feb 2024 17:58:11 +0000 (17:58 +0000)]
Bug 35248: Add tests for Koha::Booking->store

This patch adds tests for the Koha::Booking->store method.

Test plan
1) Run t/db_dependent/Koha/Booking.t and confirm they all pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add unit tests for Koha::Bibilio->bookable_items
Martin Renvoize [Wed, 7 Feb 2024 16:38:20 +0000 (16:38 +0000)]
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items

This patch adds basic unit tests for Koha::Biblio->bookable_items

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add unit tests for Koha::Bibilio->check_booking
Martin Renvoize [Tue, 30 Jan 2024 16:38:08 +0000 (16:38 +0000)]
Bug 35248: Add unit tests for Koha::Bibilio->check_booking

This patch adds basic unit tests for Koha::Biblio->check_booking

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add Koha::Biblio->bookings unit test
Martin Renvoize [Tue, 30 Jan 2024 14:00:17 +0000 (14:00 +0000)]
Bug 35248: Add Koha::Biblio->bookings unit test

This patch adds unit tests for the bookings relationship accessor on
Koha::Biblio objects.

Test plan
1) Run t/db_dependant/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add unit tests for Koha::Booking relations
Martin Renvoize [Tue, 30 Jan 2024 13:53:02 +0000 (13:53 +0000)]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Remove Koha::Booking->intersects
Martin Renvoize [Tue, 30 Jan 2024 11:09:17 +0000 (11:09 +0000)]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add test for Koha::Exceptions::Booking
Martin Renvoize [Tue, 30 Jan 2024 07:45:13 +0000 (07:45 +0000)]
Bug 35248: Add test for Koha::Exceptions::Booking

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Drop ->place_booking
Martin Renvoize [Tue, 30 Jan 2024 07:34:56 +0000 (07:34 +0000)]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add unit tests for Koha::Item->check_booking
Martin Renvoize [Mon, 29 Jan 2024 18:34:46 +0000 (18:34 +0000)]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Unit tests for CanBookBeIssued
Martin Renvoize [Mon, 29 Jan 2024 16:32:09 +0000 (16:32 +0000)]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add unit tests for Koha::Item->find_booking
Martin Renvoize [Tue, 16 Jan 2024 12:47:18 +0000 (12:47 +0000)]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35248: Add unit test for Koha::Item->bookings relation
Martin Renvoize [Tue, 16 Jan 2024 11:31:41 +0000 (11:31 +0000)]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35788: Simplify code
Tomas Cohen Arazi [Mon, 15 Jan 2024 13:43:44 +0000 (10:43 -0300)]
Bug 35788: Simplify code

We should not load DateUtils and deal with DateTime objects and
formatting when we can use the DB for it, using \'NOW()' should be
enough.

This patch makes that change. To test:

1. Apply the previous patches
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Bookings.t
=> SUCCESS: Tests pass!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35788: Test for current day booking
Tomas Cohen Arazi [Mon, 15 Jan 2024 13:35:04 +0000 (10:35 -0300)]
Bug 35788: Test for current day booking

The implemented tests checked past and future dates for filtering
bookings. But `> NOW()` excludes the current date, and this case was not
covered. It is now.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35788: Remove Koha::Template::Plugin::Biblio::BookingsCount
Jonathan Druart [Fri, 12 Jan 2024 13:19:33 +0000 (14:19 +0100)]
Bug 35788: Remove Koha::Template::Plugin::Biblio::BookingsCount

We need a new method filter_by_future in Koha::Bookings.

Additionally this TT plugin's method was not covered by tests. Neither
is the whole Koha::Booking[s] objects btw.

Test plan:
Confirm that the number of bookings is displayed in the "Bookings" tab
in the left menu of the bibliographic record detail page.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35787: Add unit test for filter_by_bookable
Martin Renvoize [Tue, 16 Jan 2024 09:47:10 +0000 (09:47 +0000)]
Bug 35787: Add unit test for filter_by_bookable

Trivial test added for filter_by_bookable

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35787: Remove Koha::Template::Plugin::Biblio::CanBook
Jonathan Druart [Fri, 12 Jan 2024 13:02:29 +0000 (14:02 +0100)]
Bug 35787: Remove Koha::Template::Plugin::Biblio::CanBook

We can replace it with biblio.items.filter_by_bookable, no need to have this TT method.

Additionally there was no test for it.

Test plan:
Make sure the Bookings tab on the left of the biblio detail page is
displayed when needed.

Note that there is also a "Place booking" button that should appear in
the toolbar.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35782: DBRev 23.12.00.007
Katrin Fischer [Fri, 15 Mar 2024 07:36:44 +0000 (07:36 +0000)]
Bug 35782: DBRev 23.12.00.007

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35782: Fix scoping problem with "biblio"
Jonathan Druart [Fri, 12 Jan 2024 14:22:52 +0000 (15:22 +0100)]
Bug 35782: Fix scoping problem with "biblio"

The "biblio" Koha::Biblio object we send from the controller needs to be
accessible from the include files.
To avoid a clash we rename it biblio_info

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>
7 months agoBug 35782: Replace TT plugin's method Biblio::HoldsCount
Jonathan Druart [Fri, 12 Jan 2024 07:44:12 +0000 (08:44 +0100)]
Bug 35782: Replace TT plugin's method Biblio::HoldsCount

We can use biblio.holds.count instead.

The main idea here is to make sure we are passing a Koha::Biblio object
as 'biblio' to all the templates including biblio-view-menu.inc

Test plan:
1. Go to the biblio detail view, click on the different entries in the menu
on the left. Confirm that the "Holds" tab always has the correct number
of Holds display in the parenthesis.

2. Run a search and confirm that the number of holds are still displayed
for each result.

QA:
git grep biblio-view-menu.inc
notice the tt list, open the corresponding perl controllers and confirm
that 'biblio' is passed and that it is a Koha::Biblio object.
The only missing place I found was in viewlog.
Note that we are not removing the TT method yet, we are marking it as
deprecated and also display a warning during the update DB process in
case one of the notice templates is using it.

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>
7 months agoBug 36233: Set select2 width to 100%
Nick Clemens [Thu, 14 Mar 2024 10:58:48 +0000 (10:58 +0000)]
Bug 36233: Set select2 width to 100%

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36233: (follow-up) Fix width and enable clear option
Nick Clemens [Wed, 6 Mar 2024 19:24:30 +0000 (19:24 +0000)]
Bug 36233: (follow-up) Fix width and enable clear option

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36233: Use select2 to load vendors on invoice search
Nick Clemens [Tue, 5 Mar 2024 14:52:16 +0000 (14:52 +0000)]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 33898: Implement reaping for database polling
Kyle M Hall [Fri, 8 Mar 2024 11:07:52 +0000 (06:07 -0500)]
Bug 33898: Implement reaping for database polling

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 33898: Alternative approach with receive frame timeout
Marcel de Rooy [Fri, 8 Mar 2024 07:37:19 +0000 (07:37 +0000)]
Bug 33898: Alternative approach with receive frame timeout

See bug 33898 comment6.

Test plan:
Based on comment12: Stage MARC import and manage. Look at the same
time to the results of ps aux|grep Z. Verify that the lines with
[background_jobs] <defunct> disappear within 10 seconds.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 32671: Prevent selenium/basic_workflow.t to fail if run on slow servers
Jonathan Druart [Mon, 11 Mar 2024 15:41:12 +0000 (16:41 +0100)]
Bug 32671: Prevent selenium/basic_workflow.t to fail if run on slow servers

When submitting the form to create a new patron we are doing a POST
memberentry.pl that is redirecting to moremember.pl

The selenium test is expecting for the end of the request to test the
page's title against "Patron details for ".

But it's only waiting for the POST response (302), not the GET
moremember that will display the patron's details.

You can simulate a slow server using cpulimit: `cpulimit -b -p $PID -l 1`
replacing $PID with the pid of the starman process.

Note that other tests are failing using 1%, but... baby steps.

The current failre:
 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 122
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 125
 #                   'Add patron (test cat description) › Patrons › Koha'
 #     doesn't match '(?^u:Patron details for test_patron_surname)'

The next one (NOT fixed by this patch):

 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
 #                   '
 #
 #             Checkouts (0)#         #         '#     doesn't match '(?^u:Checkouts \(1\))'
 t/db_dependent/selenium/basic_workflow.t .. 14/22 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
 #                   '
 #
 #             Checkouts (1)
 #
 #         '
 #     doesn't match '(?^u:Checkouts \(2\))'
 t/db_dependent/selenium/basic_workflow.t .. 16/22 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
 #                   '
 #
 #             Checkouts (2)
 #
 #         '
 #     doesn't match '(?^u:Checkouts \(3\))'

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36215: (QA follow-up) Fix &? confusion
Katrin Fischer [Fri, 15 Mar 2024 06:57:58 +0000 (06:57 +0000)]
Bug 36215: (QA follow-up) Fix &? confusion

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36232: Fix error in DBRev dealing with OAI-PMH:AutoUpdateSetsEmbedItemData typo
Tomas Cohen Arazi [Mon, 11 Mar 2024 12:44:35 +0000 (09:44 -0300)]
Bug 36232: Fix error in DBRev dealing with OAI-PMH:AutoUpdateSetsEmbedItemData typo

This patch fixes the case of the wrong syspref variable co-existing with
the good one.

OAI-PMH:AutoUpdateSetsEmbedItemData is the only case, as the rest of the
mispelled ones are just case fixes, which would not trigger the same
situation as the `systempreferences` table collation is
case-insentitive.

To test:
1. Run:
   $ ktd --shell
  k$ koha-mysql kohadev
   > INSERT INTO systempreferences VALUES ('OAI-PMH:AutoUpdateSetEmbedItemData',0,'','','YesNo');
   > UPDATE systempreferences SET variable = 'IllCheckAvailability' WHERE variable = "ILLCheckAvailability";
   > INSERT INTO systempreferences VALUES ('IllCheckAvailability',0,'','','YesNo');
=> FAIL: The last command fails because the good and wrong values cannot
coexist
2. Set the version to a prior one:
   > UPDATE systempreferences SET value="23.1200004" WHERE variable like 'version';
3. Run:
  k$ updatedatabase
=> FAIL: You get this error:
ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry 'OAI-PMH:AutoUpdateSetsEmbedItemData' for key 'systempreferences.PRIMARY' at ...
4. Apply this patch
5. Repeat 3
=> SUCCESS: It works!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Mohd Hafiz Yusoff <mhby87@gmail.com>
Signed-off-by: Mohd Hafiz Yusoff <mhby87@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36130: Fetch all batches for the table
Pedro Amorim [Mon, 19 Feb 2024 13:12:25 +0000 (13:12 +0000)]
Bug 36130: Fetch all batches for the table

Test plan, ktd:
- Add 'FreeForm' backend and enable ILLModule, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
- Install a metadata enrichment plugin, e.g.:
https://github.com/PTFS-Europe/koha-plugin-api-pubmed/releases
- Add 21 batches, run the following command in kshell:
for x in {1..21}; do echo "INSERT INTO illbatches (name, backend, library_id, status_code, patron_id) VALUES ('$x', 'FreeForm', 'CPL', 'NEW', 52);"; done | koha-mysql kohadev
- Visit ILL batches page:
<INTRA_URL>/cgi-bin/koha/ill/ill-requests.pl?method=batch_list
- Notice only 20 batches show.
- Apply patch. Notice 20 batches show but now there is a page 2 link.
- Test page 2 works as expected, delete a batch, notice only 1 page with 20 batches shows again.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Edith Speller <edith.speller@ukhsa.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36251: (bug 35329 follow-up) Fix patron search by first letter when placing a...
Jonathan Druart [Thu, 7 Mar 2024 07:50:54 +0000 (08:50 +0100)]
Bug 36251: (bug 35329 follow-up) Fix patron search by first letter when placing a hold

Most of the patrons searches open in a modal. Except:
* the main one (members-home)
* when placing a hold
* when requesting an article
(did I miss one?)

The patron-search.inc BLOCKs need a parent block to know where to locate
the elements (form, table, etc), because we can have several patron
searches on the same page.

Bug 35329 reused '#searchresults':
  10 [% SET search_results_block_id = 'searchresults' %]
which is used on the main patron search.
The ones in the modal are correctly handled: we build the parent node in
the "patron_search_modal" block.
But for the 2 others the parent block id is wrong.

On reserve/request.tt we have one already, so we set the TT variable from the
.tt file
On circ/request-article we don't have one already, so we can reuse
searchresults (could be more specific however to include 'patrons'...)

Test plan:
Browse patrons by first letter when placing a hold and requesting an
article

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36215: Remove limit on fetching bookings
Nick Clemens [Wed, 6 Mar 2024 17:59:10 +0000 (17:59 +0000)]
Bug 36215: Remove limit on fetching bookings

This removes the paging from the bookings request so we take into
account all bookings.

We may want to replace this with date bounded paging in the future, but
lets not try to optimise until we need to.

To test:
 1 - Find a record detail page in Koha staff interface
 2 - Click on a barcode to go to items tab
 3 - Edit 'bookable' to 'yes'
 4 - Return to details page
 5 - Place 5 bookings on a record
 6 - Set system preference RESTDefaultPageSize  2
 7 - Click the 'Bookings' tab on the record details
 8 - Confirm onyl 2 bookings shown in calendar view
 9 - Apply patch, reload
10 - All bookings now show in calendar

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36235: Encode system preference data with encodeURIComponent
Lucas Gass [Tue, 5 Mar 2024 16:25:46 +0000 (16:25 +0000)]
Bug 36235: Encode system preference data with encodeURIComponent

To test:
1. Add some data to a freetext system preference like IntranetUserJS or AdditionalFieldsInZ3950ResultAuthSearch that includes a semicolon;
2. Save the pref and reload the page or check the DB. Everything after the semicolon is removed.
3. Apply patch, try again. Data should remain as is.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36177: Add Cypress tests
Jonathan Druart [Thu, 21 Sep 2023 14:49:22 +0000 (16:49 +0200)]
Bug 36177: Add Cypress tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36177: Cypress tests - cypress-mysql config
Jonathan Druart [Fri, 22 Sep 2023 09:16:21 +0000 (11:16 +0200)]
Bug 36177: Cypress tests - cypress-mysql config

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36177: Cypress tests - yarn add cypress-mysql
Jonathan Druart [Fri, 22 Sep 2023 09:09:18 +0000 (11:09 +0200)]
Bug 36177: Cypress tests - yarn add cypress-mysql

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for tools/stockrotation.pl
Tomas Cohen Arazi [Wed, 6 Mar 2024 15:44:18 +0000 (12:44 -0300)]
Bug 36193: cud- treatment for tools/stockrotation.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for catalogue/stockrotation.pl
Tomas Cohen Arazi [Wed, 6 Mar 2024 11:53:59 +0000 (08:53 -0300)]
Bug 36193: cud- treatment for catalogue/stockrotation.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: Make restore icon consistent in cash registers
Tomas Cohen Arazi [Wed, 6 Mar 2024 11:53:06 +0000 (08:53 -0300)]
Bug 36193: Make restore icon consistent in cash registers

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: (follow-up) Use buttons and don't nest forms
Nick Clemens [Tue, 5 Mar 2024 16:21:31 +0000 (16:21 +0000)]
Bug 36193: (follow-up) Use buttons and don't nest forms

When changing action links into forms, we should use a submit button rather than JS to submit

Receipt cancelling needed a form embedded in the page as we cannot nest forms

Fixed searching on invoice.pl

Fixed resetting mappings (original button did not need cud-)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for restrictions.pl
Tomas Cohen Arazi [Tue, 5 Mar 2024 14:58:37 +0000 (11:58 -0300)]
Bug 36193: cud- treatment for restrictions.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for reset_confirmed on mappings.pl
Tomas Cohen Arazi [Tue, 5 Mar 2024 14:46:15 +0000 (11:46 -0300)]
Bug 36193: cud- treatment for reset_confirmed on mappings.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for debit_types.pl
Tomas Cohen Arazi [Tue, 5 Mar 2024 14:39:53 +0000 (11:39 -0300)]
Bug 36193: cud- treatment for debit_types.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for credit_types.pl
Tomas Cohen Arazi [Tue, 5 Mar 2024 14:32:18 +0000 (11:32 -0300)]
Bug 36193: cud- treatment for credit_types.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for cash_registers.pl
Tomas Cohen Arazi [Tue, 5 Mar 2024 14:23:36 +0000 (11:23 -0300)]
Bug 36193: cud- treatment for cash_registers.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: cud- treatment for Acq order receipt cancelling
Tomas Cohen Arazi [Mon, 4 Mar 2024 22:37:34 +0000 (19:37 -0300)]
Bug 36193: cud- treatment for Acq order receipt cancelling

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: Fix acq receiving
Tomas Cohen Arazi [Mon, 4 Mar 2024 20:44:59 +0000 (17:44 -0300)]
Bug 36193: Fix acq receiving

This patch addresses the CSRF error when receiving in acquisitions.

To test:
1. Have at least one order to receive
2. Follow the steps to receive them
3. Have the logs open:
   $ ktd --shell
  k$ tail -f /var/log/koha/kohadev/*.log
4. Click to confirm receipt
=> FAIL: An error modal is displayed
=> FAIL: There's an error about missing CSRF token in POST
5. Apply this patch
6. Reload everything:
  k$ restart_all
7. Repeat 1-4
=> SUCCESS: Receipt works :-D
=> SUCCESS: No error log
8. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36193: Add more request information on Koha::Middleware::CSRF output
Tomas Cohen Arazi [Fri, 1 Mar 2024 18:24:25 +0000 (15:24 -0300)]
Bug 36193: Add more request information on Koha::Middleware::CSRF output

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36195: Replace POST in itemsearch.tt with GET
Brendan Lawlor [Mon, 11 Mar 2024 17:32:08 +0000 (17:32 +0000)]
Bug 36195: Replace POST in itemsearch.tt with GET

We retrieve a list of records for DT, it does not need to be a POST
request.

Test plan:

1. Try an item search
2. The page loads but pops an alert that says "403: Forbidden" and table stays empty
3. Apply patch
4. Try an item search again and the table loads results

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36195: Replace POST batch_records_ajax.pl with GET
Jonathan Druart [Fri, 8 Mar 2024 12:53:17 +0000 (13:53 +0100)]
Bug 36195: Replace POST batch_records_ajax.pl with GET

We retrieve a list of records for DT, it does not need to be a POST
request.

Test plan:
1. Stage a batch
2. When it's done, click on "view batch"
=> Without this patch the page loads but pops an alert that says "403: Forbidden" and table stays empty

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36195: serials/routing-preview.pl - Fix save and preview
Jonathan Druart [Fri, 1 Mar 2024 14:07:38 +0000 (15:07 +0100)]
Bug 36195: serials/routing-preview.pl - Fix save and preview

No idea why we are passing issue_escaped instead of the id, but this
patch fixes the regression.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36066: (follow-up) Move 403 to 409 when status ne cancelled
Marcel de Rooy [Tue, 5 Mar 2024 14:54:02 +0000 (14:54 +0000)]
Bug 36066: (follow-up) Move 403 to 409 when status ne cancelled

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36066: Only allow cancelled order deletion in API
Marcel de Rooy [Mon, 12 Feb 2024 09:54:04 +0000 (09:54 +0000)]
Bug 36066: Only allow cancelled order deletion in API

Note: I had trouble with listing orders in API without
status, although formally not required according specs.

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36066: Add tests
Marcel de Rooy [Mon, 12 Feb 2024 09:54:04 +0000 (09:54 +0000)]
Bug 36066: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] As Victor discovered, the test with status new in subtest
'delete' needed the authorised user now.

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t
Without the follow-up patch this should FAIL.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35983: Remove extra selected=selected from dropdown menu
Lucas Gass [Fri, 2 Feb 2024 00:04:33 +0000 (00:04 +0000)]
Bug 35983: Remove extra selected=selected from dropdown menu

To test:
1. Admin > Circ & fine rules
2. Select a library at the top of the forms ( #selectlibrary )
3. Try to change the 'Refund lost item replacement fee' to "Refund lost item charge (only if unpaid)".
4. Press save and let the page reload.
5. Look at the dropdown again, the value is now set to "Refund lost item charge and restore overdue fine".
6. APPLY PATCH
7. Try steps 2 - 5 again but this time the value in the dropdown should not change.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35916: Purchase suggestions bibliographic filter should be a "contains" search
Shi Yao Wang [Fri, 23 Feb 2024 19:16:27 +0000 (14:16 -0500)]
Bug 35916: Purchase suggestions bibliographic filter should be a "contains" search

Make all bibliographic information fields filter do a contain match
rather than an exact match

Test plan:
1. Create a purchase suggestion with a multi-word title (e.g. one day in december)
   1.1. Go to Acquisitions > Suggestions > New purchase suggestion
   1.2. Enter a title (e.g. one day in december)
   1.3. Click on Submit your suggestion

2. Search for one of the words in the title
   2.1. In the "Filter by" section, click on Bibliographic information
   2.2. In the title field, enter one of the words of the title (e.g. december)
   2.3. Click Go
   --> No results

3. Apply the patch
4. Redo step 2 and notice there is now a valid result

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36103: Remove the "Cancel hold" link for item level holds
Kyle M Hall [Tue, 27 Feb 2024 13:40:53 +0000 (08:40 -0500)]
Bug 36103: Remove the "Cancel hold" link for item level holds

This link is broken and doesn't make sense from a UI/UX perspective
and thus should be removed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35950: Adjust tests
Lucas Gass [Thu, 29 Feb 2024 21:03:13 +0000 (21:03 +0000)]
Bug 35950: Adjust tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35950: Move AddReturn call into circulation.pl
Lucas Gass [Thu, 29 Feb 2024 20:48:25 +0000 (20:48 +0000)]
Bug 35950: Move AddReturn call into circulation.pl

There should be no change in beahavior. Following the test plan from Bug 35840.

To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35840: (QA follow-up) Tidy and critic fix
Martin Renvoize [Fri, 8 Mar 2024 14:40:01 +0000 (14:40 +0000)]
Bug 35840: (QA follow-up) Tidy and critic fix

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35840: Add unit tests
Lucas Gass [Mon, 29 Jan 2024 19:38:50 +0000 (19:38 +0000)]
Bug 35840: Add unit tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35840: Add option to AddReturn to skip recording of localuse
Lucas Gass [Mon, 29 Jan 2024 18:26:28 +0000 (18:26 +0000)]
Bug 35840: Add option to AddReturn to skip recording of localuse

To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35911: Make archived suggestions not show in patron's account
Shi Yao Wang [Fri, 23 Feb 2024 20:01:43 +0000 (15:01 -0500)]
Bug 35911: Make archived suggestions not show in patron's account

Remove archived suggestions in patron's account page

Test plan:
1. Go to a patron's account in the staff interface
2. Go to the Suggestions tab
3. Click New purchase suggestion and create a suggestion
4. In another browser tab, go to Acquisitions > Suggestions
5. Click the small arrow next to the edit button to the right of the suggestion, and choose Archive (alternatively, check the suggestion's box and click Archive selected)
   --> Suggestion disappears from the suggestions management page (OK)
6. Go back to the tab with the patron's account and refresh
   --> Suggestion is still visible
7. Apply the patch
8. Redo step 6 and notice the suggestion is not visible anymore
9. Redo step 4 and 5 but this time, unarchiving the suggestion
10. Redo step 6 and notice the suggestion is back

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35718: Remove ES6 warnings branches.tt
Lucas Gass [Thu, 29 Feb 2024 22:20:12 +0000 (22:20 +0000)]
Bug 35718: Remove ES6 warnings branches.tt

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35718: Remove ES6 warns from JS system preferences
Lucas Gass [Fri, 5 Jan 2024 19:05:01 +0000 (19:05 +0000)]
Bug 35718: Remove ES6 warns from JS system preferences

To test:
1. Add some JS like this to any of the UserJS system preferences:

$(document).ready( function() {
    let something = 1;
    const another_thing = 2;

    let an_arrow_function = (a, b) => a + b;
    console.log( an_arrow_function(something, another_thing) );
});

2. Notice the icons and warnings to the left of the line numbers:

let is available in ES6
const is available in ES6
arrow_function_syntax is available in ES6

3. APPLY PATCH
4. Try steps 1 and 2 again, the warnings should be gone.
5. Check that the JavaScript still works, in my example it should console.log 3.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36004: Fixed typo in successfully
Laura Escamilla [Tue, 6 Feb 2024 16:13:32 +0000 (16:13 +0000)]
Bug 36004: Fixed typo in successfully

To test:

1. Turn on the syspref 'OpacCatalogConcerns'

2. Go to view a record in the OPAC and click on "Report a concern" in
   the column located on the right-hand side.

3. Fill out the title on the form and leave everything else the same.
   Click on submit and notice that the message on the screen says "Your
   concern was sucessfully submitted."

4. Apply the patch.

5. Submit a new concern. Notice that the text now has "successfully"
   spelled correctly.

6. Sign off and have a great day! :D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36005: Fixed typo in "Your concern was successfully submitted." text
Laura Escamilla [Tue, 6 Feb 2024 16:28:41 +0000 (16:28 +0000)]
Bug 36005: Fixed typo in "Your concern was successfully submitted." text

To test:

1. Turn on the syspref 'CatalogConcerns'

2. Go to view a record in the staff intranet and click on "New catalog concern" which is located in the "+New" dropdown.

3. Fill out the title on the form and leave everything else the same. Click on submit and notice that the message on the screen says "Your concern was sucessfully submitted."

4. Apply the patch.

5. Refresh the page and submit a new concern. Notice that the message now has "successfully" spelled correctly.

6. Sign off and have a wonderful day! :D

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36070: Fix CSS class
Pedro Amorim [Mon, 12 Feb 2024 13:06:10 +0000 (13:06 +0000)]
Bug 36070: Fix CSS class

1) Enable UseRecalls
2) Checkout an item to a patron:
   Top INTRA search bar: pick 'check out' and paste a patron
   cardnumber:
   23529000035676
   press enter
3) Enter an item barcode:
   39999000003154
   Press checkout
4) As user koha/koha, visit OPAC page for this biblio:
   opac-url/cgi-bin/koha/opac-detail.pl?biblionumber=76
5) Notice all sidebar actions on the right have hover effect except for
   'Place recall'

Apply patch, repeat test plan.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36032: Use a single angle in the "Next" button
Raphael Straub [Thu, 8 Feb 2024 09:00:13 +0000 (09:00 +0000)]
Bug 36032: Use a single angle in the "Next" button

The "Next" pagination button in the OPAC result list has a double angle
whereas the "Previous" button only has a single angle. This patch fixes
that error.

To test:
1) Do a search in the OPAC with more than one page of results.
2) Observe that the "Next" button has a double angle whereas the
   "Previous" button has only a single angle.
3) Apply the patch.
4) Repeat steps 1 and 2.
5) Verify that the "Next" button now has a single angle.

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35538: Sort OPAC self registration library list by library name
Owen Leonard [Mon, 18 Dec 2023 19:05:10 +0000 (19:05 +0000)]
Bug 35538: Sort OPAC self registration library list by library name

This patch modifies opac-memberentry.pl so that the list of libraries is
sorted by library name instead of library code.

To test, apply the patch and restart services.

- If using the default testing data you'll have to go to Administration
  -> Libraries and edit one or more libraries so that the library name
  is alphabetically different than the library code. e.g. Centerville ->
  Zanzibar.
- Go the OPAC and click "Create an account" (requires the
  PatronSelfRegistration system preference).
- Under "Home library," the dropdown of libraries should be ordered by
  library name.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36012: Add 'waits' to cypress test
Matt Blenkinsop [Thu, 15 Feb 2024 14:40:04 +0000 (14:40 +0000)]
Bug 36012: Add 'waits' to cypress test

This patch adds cy.wait() in two places where builds have been failing due to timeouts

Test plan:
1) cypress run --spec t/cypress/integration/InfiniteScrollSelect_spec.ts

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35357: Enhance unit tests
Kyle M Hall [Tue, 6 Feb 2024 17:11:12 +0000 (12:11 -0500)]
Bug 35357: Enhance unit tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Fixed typo in test output.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35357: Remove item from holds queue when it is checked out
Kyle M Hall [Thu, 11 Jan 2024 14:31:45 +0000 (09:31 -0500)]
Bug 35357: Remove item from holds queue when it is checked out

Test Plan:
1) Place a hold on an item
2) Build the holds queue
3) Check out the item to a different patron than the one
   targeted in the holds queue
4) Verify the holds queue viewer still shows that item and patron
5) Apply this patch
6) Repeat stepts 1 through 3
7) Verify the holds queue viewer no longer shows that patron and item!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35357: Add unit test
Kyle M Hall [Thu, 11 Jan 2024 14:25:26 +0000 (09:25 -0500)]
Bug 35357: Add unit test

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36056: Clarify subpermissions AND behavior
Tomas Cohen Arazi [Thu, 8 Feb 2024 21:29:54 +0000 (21:29 +0000)]
Bug 36056: Clarify subpermissions AND behavior

Working on bug 31791, I found myself wondering if our current recursive
code in C4::Auth::haspermission() would allow checking AND on
subpermissions.

As it is not documented in the POD or tested, I decided to write some
unit tests for it.

It turned out it was well supported, so I decided to submit the tests,
and a small tweak in the POD to reflect that.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Auth/haspermission.t
=> SUCCESS: Tests pass! The code supports AND on subpermissions!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35469: Add 'manage_bookings' permission to biblios/checkouts
Martin Renvoize [Tue, 19 Dec 2023 13:30:14 +0000 (13:30 +0000)]
Bug 35469: Add 'manage_bookings' permission to biblios/checkouts

This patch adds the manage_bookings subpermission check to the
biblios/{biblio_id}/checkouts endpoint and updates the corresponding
unit test too.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35469: Add 'manage_bookings' subpermission to /checkouts
Martin Renvoize [Fri, 15 Dec 2023 11:37:43 +0000 (11:37 +0000)]
Bug 35469: Add 'manage_bookings' subpermission to /checkouts

This patch adds the 'manage_bookings' permission to allow fetching of
checkouts on the API should the user have 'manage_bookings' but not have
'circulate_remaining_permissions'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35773: Add manage_bookings subpermission to patron searching
Martin Renvoize [Thu, 11 Jan 2024 15:22:49 +0000 (15:22 +0000)]
Bug 35773: Add manage_bookings subpermission to patron searching

This quickly fixes the issue to allowing those who have the
manage_bookings subpermission to also search for users.

It's deliberately bare as I'm keen to subsequently remove it again in
bug 29509 where we will deal with this properly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35924: (QA follow-up): Comment magic number (patron.privacy < 2)
Victor Grousset/tuxayo [Sun, 3 Mar 2024 00:07:30 +0000 (01:07 +0100)]
Bug 35924: (QA follow-up): Comment magic number (patron.privacy < 2)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35924: Hide the print checkins button on the checkin screen for patron's who...
Kyle M Hall [Mon, 29 Jan 2024 11:54:56 +0000 (06:54 -0500)]
Bug 35924: Hide the print checkins button on the checkin screen for patron's who always anonymize

Test Plan:
1) Set a patron's privacy to "Never"
2) Check out a few items to a patron
3) Check in one item
4) Note the "Print checkin slip" diplays
3) Apply this patch
4) Check in an  item
5) Note the option is now missing
6) Set the patron's privacy to "Forever" or "Default"
7) Check in an item
8) Note the print checkins option is back!

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35924: Hide the print checkins button on the patron screens for patron's who...
Kyle M Hall [Mon, 29 Jan 2024 11:51:14 +0000 (06:51 -0500)]
Bug 35924: Hide the print checkins button on the patron screens for patron's who always anonymize

If a patron anonymizes their checkins, the checkin slip cannot retrieve any info to print the checkin slip. We should not show the button in this scenario

Test Plan:
1) Set a patron's privacy to "Never"
2) Note the "Print checkin slip" option in the Print button on the
   patrons toolbar displays
3) Apply this patch
4) Reload the page
5) Note the option is now missing
6) Set the patron's privacy to "Forever" or "Default"
7) Reload the page
8) Note the print checkins option is back!

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36134: Read complete Elasticsearch configuration in about.pl
Lari Taskula [Tue, 20 Feb 2024 01:47:53 +0000 (01:47 +0000)]
Bug 36134: Read complete Elasticsearch configuration in about.pl

When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36212: Add check on barcode before searching items
Marcel de Rooy [Fri, 1 Mar 2024 09:39:35 +0000 (09:39 +0000)]
Bug 36212: Add check on barcode before searching items

Test plan:
Add an item to your database that has no barcode.
Run t/db_dependent/Circulation.t
It will fail without this patch, pass with this patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029
Fridolin Somers [Thu, 8 Feb 2024 11:23:30 +0000 (12:23 +0100)]
Bug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029

UT is failing in jenkins.
Change to use biblio.copyrightdate instead of bilio.medium

Run prove t/db_dependent/Items/AutomaticItemModificationByAge.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36170: Wrong error variable in memberentry
Jonathan Druart [Wed, 21 Feb 2024 12:46:29 +0000 (13:46 +0100)]
Bug 36170: Wrong error variable in memberentry

It is hidding an important error.

$@ is never set here, we need $_ (inside a try-catch)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 34234: Respect display_order in additem.tt and detail.tt
Lucas Gass [Fri, 12 Jan 2024 17:35:24 +0000 (17:35 +0000)]
Bug 34234: Respect display_order in additem.tt and detail.tt

1. APPLY PATCH
2. EnableItemGroups
3. Find a record and add some new item groups with display orders that are different from the order in which the groups were added
4. Check the checkbox next to one or more items and click the link to "Add/move to item group"
5. Ensure display order is correct
6. Now add a new item to the record and scroll down to the dropdown underneath "+ Add to item group"
7. Display order should be correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35892: Populate order price using GetMarcPrice if no price specified
Nick Clemens [Thu, 25 Jan 2024 19:03:00 +0000 (19:03 +0000)]
Bug 35892: Populate order price using GetMarcPrice if no price specified

Previously this happened after the fact, automagically, if no price was included in the order record. We should
rather load the Marc price into the order form if we don't have a price form the '...ToOrder' system preferences

To test:

Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Note that item prices are populated as '6.50' from 949$g
Cancel
Update MarcFieldsToOrder and map price to "020$c"
Add to basket from the staged file
Note the price is not populated, because 020$c contains a dollar sign
Cancel
Apply patch, restart all
Add to basket from the staged file
Note the price is now correctly populated from fallback to GetMarcPrice

Note: GetMarcPrice does some automatic munging, that's why 020$c on it's own doesn't work - this could be done to fields in MarcFieldsToOrder/MarcItemFieldsToOrder but this would be an enhancement.
This bug simply restores the previous behavious, but does it on the front end and is more obvious to the user

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 31427: Remove a few refs to CanBookBeRenewed
Marcel de Rooy [Fri, 1 Mar 2024 10:29:56 +0000 (10:29 +0000)]
Bug 31427: Remove a few refs to CanBookBeRenewed

Actually, the module is not even needed anymore here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 31427: (follow-up) Unit tests
Martin Renvoize [Thu, 26 Oct 2023 08:08:04 +0000 (09:08 +0100)]
Bug 31427: (follow-up) Unit tests

This patch adds a unit test for error precidence where autorenewals is
involved.

It is not comprehensive however, and I'm a little confused by the logic
around cron vs non-cron handling...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 31427: Get auto renewal errors before other renewal errors
David Cook [Thu, 20 Jul 2023 03:22:22 +0000 (03:22 +0000)]
Bug 31427: Get auto renewal errors before other renewal errors

This patch changes CanBookBeRenewed so that automatic renewal
errors pop up before other renewal errors. This means that a book
will be considered "auto_too_soon" before things like "too_many" or
"restricted". (Otherwise, you'll get an email saying you can't renew
a book the day after using your last auto renewal, even though the
earliest renewal isn't available until later.)

Test plan:
0. Apply patch
1. prove t/db_dependent/Circulation.t
2. prove t/db_dependent/Holds.t
3. prove t/db_dependent/Koha/Account/Line.t
4. prove t/db_dependent/Koha/Account.t

Additional tests:
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RestrictionBlockRenewing
6. Change to "block"
7. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AutoRenewalNotices
8. Change to "according to patron messaging preferences"
9. Go to http://localhost:8081/cgi-bin/koha/admin/smart-rules.pl
10. Set "Automatic renewal" to "Yes" and "No renewal before" to 4
11. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
12. Checkout 39999000001310 with a due date 4 days in the future
13. Add a manual restriction
14. Run `perl ./misc/cronjobs/automatic_renewals.pl`
15. Note that it says something like the following:
Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (auto_too_soon)

Instead of something like the following:
Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (restriction)

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36100: (QA follow-up) Move 400 to 409
Marcel de Rooy [Fri, 1 Mar 2024 07:58:00 +0000 (07:58 +0000)]
Bug 36100: (QA follow-up) Move 400 to 409

Duplicate exceptions tend to generate a 409 in our REST API.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36100: Update unit tests for add
Martin Renvoize [Thu, 15 Feb 2024 12:33:26 +0000 (12:33 +0000)]
Bug 36100: Update unit tests for add

This patch updates the unit tests for booking add to confirm that
without readOnly we still return an error should a user attempt to
submit a booking with a booking_id that would clash.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36100: Remove readOnly from bookings definition.
Martin Renvoize [Thu, 15 Feb 2024 10:15:12 +0000 (10:15 +0000)]
Bug 36100: Remove readOnly from bookings definition.

Whilst readOnly feels correct here, swagger doesn't work that way at our
version. It must be removed to restore the ability to edit exising
bookings.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 36047: Remove jQuery selector from conditional
Julian Maurice [Thu, 22 Feb 2024 15:42:27 +0000 (15:42 +0000)]
Bug 36047: Remove jQuery selector from conditional

This prevents the jQuery from breaking if the reason contains an
apostrophe character.

1. Create a suggestion
   1.1. Go to Acquisitions > Suggestions
   1.2. Click New purchase suggestion
   1.3. Enter a title
   1.4. Click Submit your suggestion

2. Update the suggestion to accepted and add a reason with an apostrophe
   2.1. In the suggestions list, check the box next to the suggestion
   2.2. At the bottom of the screen, choose Mark selected as: Accepted
   2.3. In With this reason, choose Others...
   2.4. Enter a reason with an apostrophe (my case was in French :
        Disponible en impression à la demande (POD). S'attendre à un
        long temps d'attente)
   2.5. Click Submit

3. Order the suggestion
   3.1. Go to Acquisitions
   3.2. Search for a vendor
   3.3. Click New > Basket
   3.4. Enter a basket name
        (Optional: for testing I like to change Create items when:
        cataloging the record)
   3.5. Click Save
   3.6. Click Add to basket
   3.7. Click From a suggestion
   3.8. Click Order next to the suggestion
   3.9. Enter order details
   3.10. Click Save
   3.11. Click Close basket
   3.12. Click Yes, close

4. Receive the order
   4.1. Click Receive shipments
   4.2. Enter a Vendor invoice number
   4.3. Click Next
   4.4. Click Receive next to the order
        --> Page stays In processing forever

Apply patch. Repeat. Notice the page now renders correctly.
Extra: Add an entry containg an apostrophe to the SUGGEST authorized
values category and repeat test plan. Confirm everything works as
expected.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35913: Restore price fall back to MarcFieldsToOrder if not set by MarcItemFieldsT...
Nick Clemens [Thu, 25 Jan 2024 19:56:31 +0000 (19:56 +0000)]
Bug 35913: Restore price fall back to MarcFieldsToOrder if not set by MarcItemFieldsToOrder

To test:
Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Select the biblio
Note items have prices
Cancel
Remove 'price' mapping from MarcItemFieldsToOrder
Apply patch
Add to basket from file again
Note item prices, and other fields, come through as expected

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35819: (QA follow-up) Prevent warning on uninitialized retries count
Marcel de Rooy [Mon, 5 Feb 2024 11:13:15 +0000 (11:13 +0000)]
Bug 35819: (QA follow-up) Prevent warning on uninitialized retries count

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35819: Adjust es_indexer_daemon
Jonathan Druart [Tue, 30 Jan 2024 08:30:38 +0000 (09:30 +0100)]
Bug 35819: Adjust es_indexer_daemon

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Add forgotten module
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35819: Improve logging
Jonathan Druart [Fri, 26 Jan 2024 13:25:56 +0000 (14:25 +0100)]
Bug 35819: Improve logging

Log (warn) if the job will be processed later, but add a debug however.

Have a specific log for bad status

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35819: nack and not requeue if frame is invalid
Jonathan Druart [Tue, 23 Jan 2024 09:14:21 +0000 (10:14 +0100)]
Bug 35819: nack and not requeue if frame is invalid

If a frame cannot be correctly processed (most probably because the body
is not valid JSON) then we are not acking or nacking the frame and the
worker is stuck.

In this specific case we should nack without requeuing the frame.

NOTE that requeue must be 'true' or 'false', not 1 or 0, or the default
'true' will be used.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
7 months agoBug 35819: Add simple delay
Marcel de Rooy [Fri, 19 Jan 2024 07:10:02 +0000 (07:10 +0000)]
Bug 35819: Add simple delay

Here I add 500 ms. In my testing with the 1s sleep from the test
plan, I might see one or two 'not found' lines. Obviously things
depend on the time needed before the txn commits. But it will
reduce a flood of these messages.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>