Commit Graph

60281 Commits

Author SHA1 Message Date
Fridolin Somers d0cdf16a45
Bug 41043: Use op 'add_form' and 'edit_form' in oai servers
Since CSRF protection, 'op' arg for creating/editing an object uses add_form and edit_form.
This is missing only in admin/oai_servers.pl

This patch also removes TT variable add_form to avoid confusion

Test plan :
1) Create a new OAI repository
2) Enter mandatory datas in form and save
3) Edit this repository
4) Copy this repository

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:11 -07:00
Pedro Amorim 9c9ba87468
Bug 36360: Add tests
prove t/db_dependent/Koha/Patrons.t

Test plan, k-t-d:
1) Enable ILLModule
2) Create an ILL request for patron 'John', visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
3) Type 'John' and pick the only result. Set a type and library. Click 'Create'.
4) Go to patrons search and search for 'jo':
<staff_url>/cgi-bin/koha/members/members-home.pl
5) Tick the checkbox for John and someone else from the list. Click 'Merge selected patrons' from the top toolbar
6) Select the other patron (not John) as the 'patron to keep'. Click Merge patrons.
7) Notice '1 Illrequest was merge' message shows.
8) Visit the ILL list table, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl
9) Notice the ILL request now belongs to the other patron, not John (who no longer exists).

Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:11 -07:00
Pedro Amorim 7277f04342
Bug 36360: Add Illrequest to list of stuff to consider merging
Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:10 -07:00
Nick Clemens 643da6f9cd
Bug 41206: Add collection code to transfers to receive
This patch adds the collection code to the transfers to receive report
It wraps it in a span for styling/hiding

To test:
1 - Transfer some books with collection code set to another branch
2 - Sign in as that branch
3 - Circulation -> Transfers to receive
4 - No collection code shown
5 - Apply patch
6 - Refresh
7 - See collection code

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:10 -07:00
Baptiste Wojtkowski fa23e8c145
Bug 39722: (follow-up) Remove find
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:09 -07:00
Baptiste Wojtkowski fac53ff21a
Bug 39722: Remove GetSuggestionFromBiblionumber from C4/Suggestions.pm
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:09 -07:00
Pedro Amorim 62db27bc7c
Bug 41281: Only skip metadata if empty or undefined
1) Enable ILLModule
2) Create an ILL request:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
3) Pick any type, add '42' for cardnumber and any library
4) Edit item metadata (assuming ID 1):
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?op=edititem&illrequest_id=1
5) Click 'Add new field' under 'Custom fields'
6) Add any value for 'key' e.g. "test" and '0' for value.
7) Click 'Update'. Notice the custom field doesn't show.
8) Apply patch. Refresh. Verify it shows now.

Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:08 -07:00
Baptiste Wojtkowski 5262ff688b
Bug 41695: Fix rejecter in suggestion.pm
TEST PLAN:
1 - Apply tests patch
2 - Run 'prove t/db_dependent/Koha/Suggestions.t' -> it fails on
rejecter
3 - Apply this patch
4 - Run 'prove t/db_dependent/Koha/Suggestions.t' -> it works

Note: this patch also provide tests for remaining accessors in the
subtest

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:08 -07:00
Baptiste Wojtkowski e99ad89f7c
Bug 41695: Unit tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:07 -07:00
Baptiste Wojtkowski 344d66e4d4
Bug 39721: Add test for accepter
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:07 -07:00
Baptiste Wojtkowski ba0b968a5a
Bug 39721: Changes suggestion_ref in order to remove it
suggestion_ref is quite messy, it needs to be reworked in order to use
objects in suggestion.pl.

As far as I studied, it is used as
- the whole input from forms,
- the default content to input in a form
- the content that will be amended in order to propose another hash to
  modSuggestion. However, ModSuggestion will be removed so we don't need
  such a hash
- every suggestion that need to be updated using the "change selected
  suggestion" tool
- create the object suggestion_only, whose purpose is still unclear to
  me.

As a result it is created by :
> 25 my $suggestion_ref = { $input->Vars };
And by removing a number of keys depending on the use of suggestion_ref
in the script.

In this patch, we remove every code made to use suggestion_ref as the
source object for form and use another variable, $stored_suggestion which is an object.

In next patch we aim at fully removing $suggestion_ref, which is still
used by ModSuggestion

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:06 -07:00
Baptiste Wojtkowski 1a5bb27e8a
Bug 39721: Remove GetSuggestion from C4/Suggestions.pm
1 - Create suggestion
2 - Display a suggestion
3 - Amend a suggestion
To do with and without patch

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Amended-by: Jonathan Druart
tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:06 -07:00
Lucas Gass 3b149f0f50
Bug 33544: (RM follow-up) Add new line
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:05 -07:00
Laura_Escamilla 99e1ae7aa2
Bug 33544: (QA follow-up) fixed misspelled attribute
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:05 -07:00
Martin Renvoize 9954466c10
Bug 33544: Move biblio ID into title link
This patch removes the separate biblio_id column and instead embeds
the biblio link directly within the title field of the details column,
reducing table width while maintaining access to the full record.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:04 -07:00
Pedro Amorim 589c6112b4
Bug 33544: Update columns_settings.yml for consolidated details column
This patch removes the now-unused individual column definitions from
columns_settings.yml, replacing them with a single 'details' column
configuration.

Note: Fields combined into a single column are no longer individually
sortable. I believe this is acceptable for the ILL requests fields selected
for display consolidation to reduce horizontal overflow.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:04 -07:00
Martin Renvoize 9a3a9515bb
Bug 33544: Combine title details into single column
This patch consolidates the separate title details fields (title,
author, year, etc.) into a single combined column in the ILL requests
table for improved display and reduced horizontal scrolling.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:03 -07:00
Owen Leonard 290db21792
Bug 41350: Terminology: Biblio was already issued
This patch updates the string found in action logs, "Biblio was already
issued" replacing it with "An item from this bibliographic record is
already checked out."

To test, apply the patch and go to Administration -> System preferences.

- Set the AllowMultipleIssuesOnABiblio preference to "Don't allow."
- Locate a bibliographic record with more than one available item.
- Check out one of the items to a patron, then another.
- You should be asked for confirmation, "Patron has already checked out
  another item from this record. Check out anyway?"
  - Confirm the checkout.
- Go to Tools -> Log viewer and set both "Display from" and "Display to"
  set to today, and submit.
  - In the log you should see an entry containing the updated string:
    "An item from this bibliographic record is already checked out"

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:03 -07:00
Owen Leonard b1c004c064
Bug 41677: Use template wrapper for tabs: OAI repositories
This patch updates the OAI repositories search include to use WRAPPERs
for the Bootstrap tabs markup.

To test, apply the patch and go to Administration -> OAI repositories.

- The search form in the header should have three options: Search OAI
  repositories, Check out, and Search catalog.
- Each tab should activate correctly, and each search form should should
  work as expected.*
  * Note that the OAI repositories form searches by repository name
    using a "Starts with" search.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:02 -07:00
Tomás Cohen Arazi 8895b74bee
Bug 41619: Add Koha::CSV
This patch introduces Koha::CSV, a wrapper around Text::CSV_XS that
provides consistent defaults and methods for CSV generation across Koha.

The class:
- Inherits CSV delimiter from CSVDelimiter system preference
- Enforces security defaults (binary=1, formula='empty')
- Provides convenient methods for common CSV operations
- Allows per-instance configuration overrides

This establishes a foundation for standardizing CSV exports throughout
Koha, eliminating inconsistencies in CSV generation and providing a
testable, maintainable approach to CSV handling.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/Koha/CSV.t
=> SUCCESS: Tests pass!
3. Tests cover:
   - Default initialization with CSVDelimiter preference
   - Preference value inheritance (comma, semicolon, tabulation)
   - Constructor parameter overrides
   - add_row() method with various data types
   - combine() and string() methods
   - print() to filehandle
   - Proper quote escaping and empty field handling
4. Sign off :-D

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:02 -07:00
Pedro Amorim ab14eb2bca
Bug 41214: (QA follow-up): Tidy fix
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:01 -07:00
Matt Blenkinsop 76d7a0bc72
Bug 41214: Apply the same logic to table columns
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:01 -07:00
Matt Blenkinsop 4c316e25cd
Bug 41214: Convert hideIn to a callback to allow total removal of fields via syspref
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:00 -07:00
Pedro Amorim 0c0f4cc360
Bug 41214: Add cypress test
cypress run --spec t/cypress/integration/SIP2/Accounts.ts --config video=false,screenshotOnRunFailure=false

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:00 -07:00
Pedro Amorim 4544e70b37
Bug 41214: Only show cash register if UseCashRegisters sys pref is enabled
Test plan:
1) Add a new account:
http://localhost:8081/cgi-bin/koha/sip2/accounts/add
2) Notice the 'cash register' field does not show
3) Enable UseCashRegisters sys pref
4) Repeat 1 (or edit an existing account). Refresh the page.
5) Notice the 'cash register' field now shows

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:16:51 -07:00
Lucas Gass 115629bab3
Bug 39438: (RM follow-up): Fix failing test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 10:43:09 -07:00
Lucas Gass 2aaf585013
Revert "Bug 41173: Fix ERM breadcrumb causing page reload"
This reverts commit 7a614e4c67.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 09:58:58 -07:00
Lucas Gass 071ed864cf
Revert "Bug 41173: Add a Cypress test"
This reverts commit 8af1ad8688.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 09:58:51 -07:00
Kyle M Hall 6592be6a08
Bug 41781: Holds queue builder ( build_holds_queue.pl ) fails if HoldsQueueParallelLoopsCount is greater than 1
If HoldsQueueParallelLoopsCount is set to a value greater than 1, build_holds_queue.pl will fail with the message:

Can't locate object method "new" via package "Parallel::ForkManager" (perhaps you forgot to load "Parallel::ForkManager"?) at /kohadevbox/koha/C4/HoldsQueue.pm line 205.

Test Plan:
1) Run misc/cronjobs/holds/build_holds_queue.pl
2) Note the error message
3) Run misc/cronjobs/holds/build_holds_queue.pl
4) Note the error message is gone!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 07:21:03 -07:00
Lucas Gass 928abfcdc2
Bug 39916: (RM follow-up) Tidy
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 07:21:02 -07:00
Paul Derscheid 37c8b7544e
Bug 39916: (QA follow-up) Fix startRange class lost on month navigation
When selecting a booking start date that triggers month navigation
(e.g., selecting Feb 1 while viewing January), the flatpickr calendar
would lose the 'startRange' CSS class on the selected date. This
occurred because setting maxDate in the onChange handler triggered a
calendar redraw, and flatpickr only applies startRange during the
initial click event, not during redraws.

This caused the Cypress test "should handle date range validation
correctly" to fail on dates near month boundaries (e.g., January 30).

The fix re-applies the startRange class after the maxDate is set,
using setTimeout to ensure it runs after the redraw completes. A
guard ensures this only happens when exactly one date is selected,
preventing interference with end date selection.

To test:
- Apply patch
- Open a biblio detail page with bookable items
- Click "Place booking"
- Select a patron, pickup location, and item
- In the date picker, click a date that's in the next month
  (visible in the "next month" area of the calendar)
- Verify the selected date shows the startRange styling (highlighted
  as the range start)
- Select an end date
- Verify the range is properly selected and the form can be submitted
- Run Cypress tests:
  yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts
- Verify all tests pass

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 07:21:01 -07:00
Matt Blenkinsop ca3c191d08
Bug 39438: (follow-up) Remove agreement_id from periods before comparing to result
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 07:21:01 -07:00
Jonathan Druart 849f67988f
Bug 41076: Adjust our perl tidiness for v20250105
Generated using
  `perl misc/devel/tidy.pl --perl`

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-05 09:03:51 -07:00
Pedro Amorim f06c5fc5e6
Bug 39971: (QA follow-up): Tidy fix
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:26 -07:00
Nick Clemens 76378efa72
Bug 39971: (QA follow-up) Unit tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:25 -07:00
Pedro Amorim 9a4e6a87df
Bug 39971: Add query param
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:25 -07:00
Pedro Amorim 20e00d408f
Bug 39971: Add POD
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:24 -07:00
Pedro Amorim e0824a79bf
Bug 39971: Move patron_attributes_form method to a class
This makes it reusable, documentable, and testable.

This is changing code without adding a new feature or fixing a bug.
The first test plan should be to just make sure that the existing functionality is kept intact, i.e. rendering and saving the patron attribute types in the form.

As to why we need this, we're maintaining the ILL Actions plugin where we have a feature to quickly add a patron. This is designed to be as minimal as possible, but if there are any mandatory patron attribute types, those need to be considered.
To test this:
1) Apply patches and enable ILLModule syspref.
2) Install the plugin:
https://github.com/openfifth/koha-plugin-ill-actions/releases/tag/v2.4.0
3) Add a mandatory patron attribute type, you can edit the existing one in k-t-d, visit:
   <staff_url>/cgi-bin/koha/admin/patron-attr-types.pl?op=edit_attribute_type&code=SHOW_BCODE
5) Tick the 'Staff interface mandatory' checkbox
6) Create a new ILL request, visit:
   <staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
7) Notice there's a '+Add new user' link next to the cardnumber input at the bottom of the form. Click that.
8) Notice there's a 'Additional attributes and identifiers' section. This is only possible (without writing it again) because of the patches here.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:24 -07:00
Pedro Amorim b57ff25c9a
Bug 39971: Move form rendering to reusable tt block
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:23 -07:00
Lucas Gass 26c8ed7d8f
Bug 30331: DBRev 25.12.00.018
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:23 -07:00
Lucas Gass 2428d00989
Bug 30331: Update tests, mock the system preference
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:22 -07:00
Lucas Gass 2df89cf721
Bug 30331: Update system preference descriptions
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:22 -07:00
Lucas Gass d1ec0e47b2
Bug 30331: Unit tests
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:21 -07:00
Lucas Gass 2817e8f930
Bug 30331: Implement manual and automatic renewal base period
To test:

1. APPLY PATCH, updatedatabase, restart_all
2. Go to your circulation rules and do the following:
    -Automatic renewal: Yes
    -No renewal before: 5
    -No automatic renewal before: 5
    -Renewal period: 5

3. Set ManualRenewalPeriodBase to "the old due date of the checkout".
4. Set  AutomaticRenewalPeriodBase to "current date".

5. Check out an item and set the due date to 2 days from today
6. Attempt to manually renewal the item.
7. Notice the new date is calculated based on the old checkout date.
8. Check out an item another item and set the due date to 2 days from today.
9. Run `perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v`
10. Notice the new date is calculated based on the current date.

11. Set ManualRenewalPeriodBase to "current date".
12. Set  AutomaticRenewalPeriodBase to "the old due date of the checkout".

13. Check out an item and set the due date to 2 days from today
14. Attempt to manually renewal the item.
15. Notice the new date is calculated based on the current date.
16. Check out an item another item and set the due date to 2 days from today.
17. Run `perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v`
18. Notice the new date is calculated based on the old checkout date.

Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:21 -07:00
Lucas Gass 15d83804b3
Bug 30331: Rename RenewalPeriodBase as ManualRenewalPeriodBase and add AutomaticRenewalPeriodBase sys pref
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:20 -07:00
Martin Renvoize e58d39671f
Bug 39584: Fix end date disable to check selected item, not all items
When a specific item is selected in the booking modal, the end date
disable logic was incorrectly checking if ALL bookable items were
unavailable before disabling a date. This meant dates with existing
bookings for the selected item remained selectable if other items
were available.

Now when a specific item is selected (booking_item_id != 0), the
logic checks if that specific item is in the unavailable_items list.
The "all items unavailable" check is only used when "Any item" is
selected.

This aligns the end date selection behavior with the start date
selection behavior, which already correctly checks only the selected
item.

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:20 -07:00
Martin Renvoize 22c8829738
Bug 39584: Fix trail period incorrectly limiting max booking date
This commit fixes a bug where the trail period was preventing selection
of the maximum end date allowed by circulation rules, even when there
were no booking conflicts in the trail period.

The Problem:
============
The hover logic in place_booking.js checked if ANY disabled date fell
within the trail period and would prevent selection. However, dates can
be disabled for multiple reasons:
1. They conflict with an existing booking (correct reason to disable)
2. They are beyond the maxDate set by circulation rules (incorrect!)
3. They are in the past

When hovering over the max selectable end date, the trail period would
extend beyond the maxDate. Those dates were disabled by flatpickr
automatically, and the code incorrectly interpreted this as a booking
conflict, preventing selection of the otherwise valid max date.

The Fix:
========
Modified the trail period conflict check (lines 995-1005) to only
consider dates that are within the max date range. Disabled dates
beyond the maxDate are now ignored when checking for trail conflicts.

Before:
  if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) {
      trailDisable = true;
  }

After:
  if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) {
      const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null;
      if (!maxDate || elemDate.isSameOrBefore(maxDate)) {
          trailDisable = true;
      }
  }

This ensures trail periods only prevent selection when they conflict
with actual bookings, not when they extend beyond the circulation
rules' maximum date.

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:19 -07:00
Martin Renvoize 9284a43817
Bug 39584: Add Cypress tests for bookings lead and trail period behavior
This commit adds comprehensive Cypress tests for the lead and trail period
functionality in the bookings modal date picker. These tests validate the
hover effects, conflict detection, and date selection constraints.

The tests use cy.clock() to fix "today" to June 10, 2026, enabling
deterministic testing without date arithmetic complications.

Test coverage includes:
- Lead period visual hints (CSS classes on hover)
- Lead period conflict prevention with past dates
- Lead period conflict prevention with existing bookings
- Trail period visual hints (CSS classes on hover)
- Trail period conflict prevention with existing bookings
- Max date selection when trail period is clear (no false restrictions)

Test setup:
- Fixed date: June 10, 2026
- Lead period: 2 days
- Trail period: 3 days
- Issue length: 3 days with 2 renewals of 2 days each
- Max booking period: 7 days
- Blocker booking: June 25-27 (tests both lead and trail conflicts)

Test phases:
1. Hover June 13 - lead period (June 11-12) is clear, no leadDisable
2. Select June 13, hover June 16 - trail period (June 17-19) is clear
3a. Hover June 11 - lead period includes past date (June 9), leadDisable
3b. Hover June 29 - lead period overlaps blocker (June 27), leadDisable
4. Select June 20, hover June 23 - trail overlaps blocker, trailDisable
5. Select June 13, hover June 20 (max) - trail is clear, selectable

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:19 -07:00
Lucas Gass a4208f711b
Bug 40364: DBRev 25.12.00.017
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:18 -07:00
Lucas Gass 7c82ec83b7
Bug 40364: Add new permission to t/Koha/Auth/Permissions.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-30 10:54:18 -07:00