Commit Graph

60221 Commits

Author SHA1 Message Date
Owen Leonard 1cea1fc4ea
Bug 25314: Make OPAC facets collapse
This patch implements collapsing facets using the Bootstrap Collapse
component.

To test, apply the patch and rebuild the OPAC CSS.

1. Clear your browser cache if necessary.
2. Using the sample data, go to Advanced Search in the OPAC. Check the
   "Books" checkbox under the "Item types" tab and submit.
3. In the left-hand sidebar you should see the facets you normally see,
   but now each one has an arrow icon to show whether the facet is
   expanded or collapsed.
4. All facets should be expanded by default. Adding expanded/collapsed
   settings to system preferences is out of scope for this bug.
5. Test expanding and collapsing facets, as well as the "Show more" link
   under each one.
6. Click the "Fiction" link under the "Collections" facet. When the
   refined search results load you clicked should now have a red "X"
   link next to "Fiction," which should no longer be a link.
   - Because "Fiction" is the only uption under the "Collections" facet,
     the facet is not collapsible. I reasoned that it would be important
     not to let a facet limitation disappear behind hidden facets.
   * The only way I know to do this in the template is to check for
     facets with only one option this has the possibly-unwanted side
     effect of making facets which haven't been selected but still only
     have one option not collapsible. In this example search "Holding
     libraries" and "Topics" show this. I'm open to suggestions on this!
7. Test with the displayFacetCount preference both enabled and disabled.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 2546c08688)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:28:32 +01:00
Tomás Cohen Arazi 1c0c0b3d17
Bug 41616: Silence warning in authority_hooks.t
This patch silences a useless warning that is printed when in ES context.

To test:
1. Launch a KTD instance with ES enabled:
   $ ktd --proxy --name 41616 --search-engine es8 up -d
   $ ktd --name 41616 --wait-ready 120
2. Run:
   $ ktd --name 41616 --shell
  k$ prove t/db_dependent/Koha/Plugins/authority_hooks.t
=> SUCCESS: Tests pass
=> FAIL: You see:

```shell
prove t/db_dependent/Koha/Plugins/authority_hooks.t
t/db_dependent/Koha/Plugins/authority_hooks.t ................. 1/5 Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'elasticsearch_to_document ref record: MARC::Record - ref document: HASH'
Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'elasticsearch_to_document ref record: MARC::Record - ref document: HASH'
t/db_dependent/Koha/Plugins/authority_hooks.t ................. ok
All tests successful.
Files=20, Tests=119, 24 wallclock secs ( 0.04 usr  0.02 sys + 17.89 cusr  2.33 csys = 20.28 CPU)
Result: PASS
```

3. Apply this patch
4. Repeat 2
=> SUCCESS: No tests changes, but no more weird warnings about elasticsearch
5. Sign off :-D
6. Cleanup:
   $ ktd --name 41616 down

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b16a541537)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:22:58 +01:00
grgurmg 68658a780f
Bug 41058: Assign timeout id when delaying issues table load
When AlwaysLoadCheckoutsTable is enabled and a delay is configured,
we were calling setTimeout without capturing the returned id, despite a
`loadIssuesTableDelayTimeoutId` variable already being declared and targetted
by clearTimeout. This prevented the "Load now" button from properly clearing
the pending timeout.

Test plan:
1. Configure a delay (LoadCheckoutsTableDelay > 0) so checkouts table
   loads after N seconds.
2. Go to a patron’s checkouts page.
3. Before the delay completes, click "Load now".
   - Without this patch: an alert window will display a "Something went wrong
	 when loading the table" error once the timeout triggers.
   - With this patch: the pending timeout is cleared; the table loads
     immediately only once.
4. Reload the page with the delay set; wait for the timeout to elapse
   and confirm the table loads normally.

Signed-off-by: Mike Grgurev <mike.grgurev@mainlib.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c8800512ab)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:22:05 +01:00
David Cook c6a94016aa
Bug 41647: Fix self-checkin to use responsive CSS
Test plan:
0. Apply the patch
1. Enable the SelfCheckInModule system preference
2. Go to http://localhost:8080/cgi-bin/koha/sci/sci-main.pl
3. Enter barcode 39999000004571 into input box, click "Submit",
then click "Check in"
4. Using your F12 dev tools, look at the interface with different
widths
5. Note that the page looks good on both large and small screens
6. Note that the page stays contained to the small screen size
and you don't have to scroll horizontally to see all the content

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ea16d2288d)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:21:45 +01:00
David Cook f1927e780e
Bug 41518: Only show autorenewal text if autorenewal allowed
This change makes the "Scheduled for automatic renewal" text appear
in the staff interface and OPAC only if both the issue has auto_renew
and the borrower has autorenew_checkouts set. These are the criteria that
automatic_renewals.pl uses for processing automatic renewals.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Checkout an item as an automatic renewal
(ie either set it as Automatic renewal using the checkout option or have
 the circ and fines rules set to use Automatic renewals)
3. View the checkout in both the staff interface and the OPAC
4. Note that they both show "Scheduled for automatic renewal" or
"This item is scheduled for auto renewal" for the OPAC
5. In the patron record change "Allow auto-renewal of items" from
"Yes" to "No"
6. Note that the text talking about the item being scheduled
for automatic renewal no longer displays

Bonus points:
1. Run 'perl ./misc/cronjobs/automatic_renewals.pl -v'
2. Note that the automatic renewal doesn't show when "Allow auto-renewal
of items" is set to "No" but it does show when it's set to "Yes"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f73b738db3)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:21:30 +01:00
Paul Derscheid eb27fbc610
Bug 41887: Skip clash detection on terminal status transition
- Booking::store runs item-level and biblio-level clash
  detection unconditionally on every call
- During checkout, C4::Circulation sets the booking status to
  'completed' and calls ->store(), which triggers clash checks
- Combined with false positives from Biblio::check_booking
  (e.g. checkouts on non-bookable sibling items inflating the
  unavailable count), this throws
  Koha::Exceptions::Booking::Clash resulting in a 500 error
- Running clash detection on a terminal transition is
  unnecessary regardless; skip it for cancelled/completed
- Add _is_final_status_transition() helper that inspects the
  dirty columns to detect completed/cancelled transitions
- Guard both clash detection blocks with the new helper

To test:
1. Have a biblio with two items: one bookable, one not
   (bookable = 0).
2. Create a booking on the bookable item.
3. Check out the non-bookable item to a patron.
4. Check out the bookable item to the booking patron (this
   triggers the completed transition via C4::Circulation).
5. Without the patch: 500 error from
   Koha::Exceptions::Booking::Clash.
6. Apply the patch.
7. Repeat steps 2-4.
8. Verify the checkout succeeds and the booking transitions
   to completed.
9. Run: prove t/db_dependent/Koha/Booking.t
   and confirm the new subtest "store() skips clash
   detection on terminal status transition" passes.

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ee667d3ddf)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:21:08 +01:00
Paul Derscheid 1929fe47d3
Bug 40896: (follow-up) Fix bfcache double-toggle on form button elements
- Track pending reset timeouts in a WeakMap keyed by element
- Clear any pending timeout in the pageshow handler before re-enabling
- Prevents the resumed setTimeout from re-disabling the button after
  bfcache restoration

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c39021d1bc)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:20:22 +01:00
Paul Derscheid 0c0b6b487e
Bug 40896: (follow-up) Use icon wrapper elements and visibility toggling
- Wrap icons in semantic container elements for visibility toggling
- Create throttled-button.inc with Template Toolkit BLOCKs to reduce duplication
- Extract throttle logic to throttledButton.js with event delegation
- Make timeout configurable via data-throttle-timeout attribute
- Replace string-based modal generation with template element to support
  SSR

To test:
1) Follow the test plan from the previous commit
2) Additionally verify the throttled button behavior works in all locations:
   - Reports list table: "Run" button for each saved report
   - Report toolbar: "Run report" button (when viewing/editing a report)
   - Parameters form: "Run the report" button
   - Edit SQL form: "Update and run SQL" button
   - Preview SQL modal: "Run report" button (click "Preview SQL" in dropdown)
3) For each location, confirm:
   - Button shows play icon initially
   - Upon click, button becomes disabled with spinner icon
   - Button has aria-busy="true" when disabled
   - After navigation/submission, button state is handled correctly
4) Test the modal button specifically:
   - Open Preview SQL modal from any report dropdown
   - Click "Run report" in the modal
   - Verify throttle behavior works for this dynamically created button
5) Verify that the set timeout works well, I thought 120 seconds is too
   long if you go back via bfcache (back button in the browser). You'd
   have to either reload or wait 2 minutes for the button to become
   interactive again.
6) Sign off

Signed-off-by: Jake Deery <jake.deery@openfifth.co.uk>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 53cc39ae2d)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:20:21 +01:00
Jake Deery 7d71525ec5
Bug 40896: Disable run report buttons upon click
This patch will disable the run report button found on both the list page, and the individual operation pages (e.g. run, edit, saved successfully). This will stop librarians from unintentionally crashing their Koha system, by pressing the run report button repeatedly when there is no need to re-request it.

TO TEST:
a)  go to /cgi-bin/koha/reports/guided_reports.pl?op=list
b)  create three new sql test reports:
    *)  Name: Test report #1, SQL: SELECT count(*) FROM biblio
    *)  Name: Test report #2, SQL: SELECT count(*) FROM items
    *)  Name: Test report #3, SQL: SELECT * FROM items WHERE items.dateaccessioned =  <<Date accessioned|date>>
c)  run all of the above test reports, noticing how the run report button can be activated repeatedly
APPLY PATCH
d)  redo step a
e)  run test report #1 from the table, notice how now the button can only be activated once before it is greyed out and the play button is replaced with a spinner
f)  return to the list, edit test report #2 from the table, click run report from the edit page, and notice how this run report button exhibits the same behaviour as the button in step e
g)  return to the list, run test report #3, select a date, click run report from this page, and notice again how the run report button exhibits the same behaviour as the buttons in steps e and f
SIGN OFF

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9067b2aafe)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:20:20 +01:00
Paul Derscheid 63bc6f9dd0
Bug 41886: Filter checkouts to bookable items in check_booking
- Biblio::check_booking counts current checkouts toward the
  unavailable pool to detect booking clashes
- It counts checkouts on ALL items for the biblio, including
  non-bookable ones (e.g. items with an excluded item type)
- When only a subset of items are bookable, checkouts on
  non-bookable siblings incorrectly reduce the available pool,
  producing false clashes
- Restrict the checkout query to only count items whose
  itemnumber is in the bookable items set

To test:
1. Have a biblio with at least two items, where one item is
   bookable and the other is not (bookable = 0).
2. Check out the non-bookable item to a patron.
3. Attempt to create a booking for the bookable item.
4. Without the patch: a clash is detected even though the
   bookable item is available.
5. Apply the patch.
6. Repeat steps 2-3.
7. Verify the booking succeeds without a false clash.
8. Run: prove t/db_dependent/Koha/Biblio.t
   and confirm the new subtest
   "checkouts on non-bookable items do not cause false clashes"
   passes.

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 560520305c)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 09:18:55 +01:00
Jacob O'Mara 296978829d
DBRev 25.11.03.001
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:52:35 +01:00
Nick Clemens 51d503cd4f
Bug 41131: Don't allow limiting transfers from/to a single branch
We say that you cannot limit transfers internally within a branch, but
it seems we do allow you to, and don't show you when we do

To test:
1 - Go to Admin->Library transfer limits
2 - On a branches page, uncheck the box for that branch
    e.g. don't allow FIC to transfer to CPL from CPL
3 - Save
4 - Note the box is still checked
5 - Check the DB
    SELECT * FROM branch_transfer_limits;
6 - There is a line to/from CPL!
7 - Apply patches
8 - updatedatabase
9 - Repeat 5 - the line is deleted!
10 - Try to create the rule again, not the box is now disabled
11 - Be sneaky, enable the box, uncheck it and save, no rule created
12 - Be sneaky, edit the HMTL for another button to make it limiting CPL to CPL, save, no rule created
13 - Sign off

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4c82ff273b)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:50:10 +01:00
David Cook 4b0b03609c
Bug 41599: Fix output_error in acquisitions_stats.pl
This patch changes the incorrect usage of output_error
in acquisitions_stats.pl so that it uses a HTTP status
code instead of an arbitrary string.

Test plan:
0. Apply the patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/reports/acquisitions_stats.pl
2. Use your F12 HTML inspector to find the "Line" radio buttons that you've
selected and remove the values for those elements
3. Click "Submit" at the bottom of the screen
4. Note that you get a 403 error (if bug 30803 applied - otherwise it's a 404 error)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 017b157b7d)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:49:41 +01:00
Jonathan Druart 1db1157f90
Bug 30803: Raise exception if $error is not passed
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6b61f010f4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:49:12 +01:00
Jonathan Druart 4610a18e00
Bug 30803: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 06c557cfad)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:49:11 +01:00
David Cook 9b4de43725
Bug 30803: Don't hardcode 404 into output_error
This patch removes the hardcoded "404 Not Found" status
code and reason phrase from output_error and instead
uses just the code passed into the function.

Test Plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29
2. Note normal OPAC 404 error

Bonus points:
1. Change 404 to 403 in the first output_error in opac/tracklinks.pl
2. koha-plack --restart kohadev
3. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29
4. Note normal OPAC 403 error

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit beea9253e5)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:49:10 +01:00
Janusz Kaczmarek b65fa54bc0
Bug 41864: (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of elements in anonymous hash
After introducing Bug 40966 opac-search.pl, when invoked in the
simple form (not as advanced search) generates warnings like:

[WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.

Test plan:
==========
1. Perform a simple search from main OPAC page.
2. Check the content of plack-opac-error.log. You should see a
   warning like:
   [WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.
3. Apply the patch ; restart_all.
4. Repeat p. 1. There should be no new warning now.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 184e966de4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:48:34 +01:00
Lucas Gass 17c567fc5e
Bug 41761: Do not update accountlines.date when editing a note
To test:
0. APPLY PATCH, restart_all
1. Create an accountline and make note of the accountline.date
2. On that accoutnline edit the note.
3. Confirm that the accountline.date does NOT update.

Signed-off-by: Juliet Heltibridle <jheltibridle@rcplib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1c50f6b774)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:47:22 +01:00
Andreas Roussos cf6ec7138b
Bug 41337: Add missing Bash variable to `koha-create`
When creating a new Koha instance using the two-step workflow
(`koha-create --request-db <instance>`, followed by
`koha-create --populate-db <instance>`), some log files under
/var/log/koha/<instance>/ end up with incorrect ownership.

Specifically, intranet-error.log and opac-error.log are owned
by root:root instead of <instance>-koha:<instance>-koha.

This patch fixes that.

Test plan (tailored for KTD):

1) Before applying this patch, run the following commands
   inside your KTD Koha container:

   $ sudo koha-create --request-db test1
   $ SQLPASS=`sudo grep password: test1-db-request.txt | cut -c 16-`
   $ mysql -hdb -uroot -ppassword -e "CREATE DATABASE koha_test1;"
   $ mysql -hdb -uroot -ppassword -e "GRANT ALL PRIVILEGES ON koha_test1.* TO 'koha_test1'@'%' IDENTIFIED BY '${SQLPASS}';"
   $ mysql -hdb -uroot -ppassword -e "FLUSH PRIVILEGES;"
   $ sudo koha-create --populate-db test1

   $ ls -l /var/log/koha/test1/
     total 8
     -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:35 indexer-error.log
     -rw-r--r-- 1 test1-koha test1-koha 1278 Feb  9 15:35 indexer-output.log
     -rw-r--r-- 1 root       root          0 Feb  9 15:35 intranet-error.log
     -rw-r--r-- 1 root       root          0 Feb  9 15:35 opac-error.log
     -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:35 worker-error.log
     -rw-r--r-- 1 test1-koha test1-koha 1828 Feb  9 15:35 worker-output.log
     -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:35 zebra-error.log
     -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:35 zebra-output.log

   Notice the incorrect user/group ownership on two
   files: `intranet-error.log` and `opac-error.log`.

2) Apply this patch, remove the `test1` instance along
   with the database request text file, and copy the
   modified script to its system-wide location:

   $ sudo koha-remove test1
   $ sudo rm test1-db-request.txt
   $ sudo cp debian/scripts/koha-create /usr/sbin/koha-create

3) Repeat the commands in Step 1. This time, the output of
   the last command should resemble the following:

   total 8
   -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:42 indexer-error.log
   -rw-r--r-- 1 test1-koha test1-koha 1520 Feb  9 15:42 indexer-output.log
   -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:42 intranet-error.log
   -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:42 opac-error.log
   -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:42 worker-error.log
   -rw-r--r-- 1 test1-koha test1-koha 1828 Feb  9 15:42 worker-output.log
   -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:42 zebra-error.log
   -rw-r--r-- 1 test1-koha test1-koha    0 Feb  9 15:42 zebra-output.log

   All files should now have the correct user/group ownership.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7ee861e256)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:47:00 +01:00
John Doe 090166f825
Bug 41036: (QA follow-up) use nowarnings
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f9bab53f22)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:46:34 +01:00
Lari Taskula 30371eff7d
Bug 41036: Log errors in Koha::ImportBatch->new_from_file
To test:
1. prove t/db_dependent/Koha/ImportBatch.t
2. Observe success

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>
(cherry picked from commit f54cce344c)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:46:31 +01:00
Lari Taskula caac4811f4
Bug 41036: Add tests
To test:
1. Apply only this patch, do not yet apply the next one
2. prove t/db_dependent/Koha/ImportBatch.t
3. Observe tests failing

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>
(cherry picked from commit bcf4531288)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:46:30 +01:00
Slava Shishkin 5c35b252ee
Bug 41675: Fix Quick add patron username being overwritten
Test plan:
1. In system preferences, set PatronQuickAddFields to include userid
   (Username).
2. Go to Patrons and choose Quick add new patron.
3. Fill at least Surname, Card number, and Username
   (use a value clearly different from a surname-based username).
4. Save the patron.
5. Observe on the patron details page that Username is auto-generated
   (not the value entered in quick add).
6. Apply this patch.
7. Repeat steps 2-4 with a new patron.
8. Verify on the patron details page that Username now matches the
   value entered in quick add.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit cea8d5aa6b)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:46:14 +01:00
Marcel de Rooy e5d688bf88
Bug 36752: Remove confusing TODOs
As Jan Kissig correctly mentioned on the BZ report, the various
summary info on charged items etc. are included.
This is done via the summary_info sub.

Note that the TODOs about
    BZ FID_HOLD_ITEMS_LMT
    CA FID_OVERDUE_ITEMS_LMT
    CB FID_CHARGED_ITEMS_LMT
are still valid. This is not included yet.

Test plan.
Since we are just removing comments, read the code.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0cc3190122)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:45:37 +01:00
Kyle M Hall fd9678efec
Bug 41818: Add unit tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8959185536)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:45:24 +01:00
Jake Deery ca8c626fdf
Bug 41818: Add new Koha::Patron::Message method to SIP2
This bug adds Koha::Patron::Message::message_without_newlines, which has been added to C4::SIP::ILS::Patron in lieu of Koha::Patron::Message::message. The aim of this change is to prevent SIP2 units from crashing out when they encounter a patron message with newlines (\n or \r) in it, as units generally use a newline character to denote the end of a SIP2 transaction.

To test:
a)  go to /cgi-bin/koha/sip2/institutions
    *)  create an institution, name CPL, timeout 300, the rest default
b)  go to /cgi-bin/koha/sip2/accounts
    *)  create an account, userid koha, institution CPL, terminator crlf, the rest default
c)  go to /cgi-bin/koha/members/moremember.pl?borrowernumber=51
    *)  click add message in toolbar
    *)  enter some multi-line message e.g. test[RETURN]1[RETURN]2[RETURN]3[RETURN][RETURN][RETURN]
d)  run tail -f /var/log/koha/kohadev/sip-output.log, keep this window open
e)  run ./misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l CPL --patron 42 -m patron_information
f)  look at the tail log, notice how the MSG 64 line has a newline before the final pipe (|) character
== APPLY PATCH ==
g)  restart_all
h)  repeat steps e-f
i)  notice how in the tail log, the MSG 64 line now has the final pipe character contiguously placed with the successive characters
== SIGN OFF ==

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>
(cherry picked from commit ab88c85f3b)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:45:23 +01:00
Lucas Gass afd493f26d
Bug 41417: Fix client variable in cataloging.js
To test:
1. Find or create a record in Kkoha.
2. From the record detail page click "Edit" and "Manage items"
3. Begin adding a new item
4. For any of the dropdowns that contain an authorized value ( LOST, DAMAGED, WITHDRAWN, CCODE, LOC ) click on the dropdown and begin typing an AV that doesn't exist.
5. You should see the text (select to create) appear, click it.
6. Now a modal appears "Create a new authorized value"
7. Fill out the required parts and click 'Save'.
8. Kaboom, 500 error:
9. APPLY PATCH, clear browser cache.
10. Try again, this time it should work.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0dc0da7a3b)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:45:05 +01:00
Nick Clemens 87e55c8ff5
Bug 41393: Set the correct reply to address for advance notices
This patch additionally fetches the reply to address for advance notices

To test:
1 - Have some issues that will be due soon for a patron(s)
    Checkout with the due date set to tomorrow
2 - Verify the patron(s) have an email defined, verify the issuing branch has a reply to set
3 - Verify the patron(s) have messaging preference set to receive Advance notices by email 1 day in advance
4 - perl misc/cronjobs/advance_notices.pl -v -c
5 - Check the message queue
    SELECT * FROM message_queue WHERE borrowernumber={##}
6 - Note no rpely to is set
7 - Apply patch
8 - perl misc/cronjobs/advance_notices.pl -v -c
9 - Check the message queue
10 - Confirm newer message has the reply to populated
11 - Ensure the issued item has a different homebranch with a reply to address se
12 - perl misc/cronjobs/advance_notices.pl -v -c --frombranch item-homebranch
13 - Confirm message has correct reply to
14 - Set patron to want digest in messaging preferences
15 - Generate notices
16 - Confirm digets has the right reply to

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tidied inline
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d7028939da)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:44:47 +01:00
Kyle M Hall 8349a8b211
Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix
We can add a toolbar of buttons to
A) batch enable all cells
B) batch populate empty cells with a value
C) batch disable empty cells

Test plan:
1) Apply this patch
2) Visit the TCM editor
3) Try out the 3 new buttons, verify they behave correctly

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>
(cherry picked from commit 081a139904)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:44:25 +01:00
Marcel de Rooy f4a5119f0c
Bug 28528: (QA follow-up) Remove "Koha 3" reference
Thats quite old :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b8742964db)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:43:55 +01:00
Roman Dolny 4b93bb7503
Bug 28528: bulkmarcimport delete option doesn't delete biblio_metadata
When using bulkmarcimport with the -d switch should not only delete
biblio, biblioitems and items, but also biblio_metadata.

I haven't checked if a FK takes care of the data, but if it does,
we should still also reset the AUTO_INCREMENT:...

Test plan:
==========
1. Check (and notice) the number of records in the biblio (bCount) and
   biblio_metadata (bmCount) tables. Check the AUTO_INCREMENT value
   for these tables (bAI, bmAI).
2. Import bibliographic records with delete, turn off foreign key checks
   and non-existent filename:
   misc/migration_tools/bulkmarcimport.pl -b -d -fk -file=non-exist-file
==> "Could not open..." is OK, file doesn't exist.
3. Repeat p. 1 and compare with previously noticed:
   bCount => 0 (OK)
   bmCount => unchanged (NOT OK)
   bAI => 1 (OK)
   bmAI => unchanged (NOT OK)
4. Apply the patch.
5. Repeat p. 2-3:
   bCount => 0 (OK)
   bmCount => 0 (changed, OK)
   bAI => 1 (OK)
   bmAI => 1 (changed, OK)

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8ec1b421bf)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:43:53 +01:00
Hammat Wele 7c335d98f1
Bug 40787: Plugins buttons misaligned when search box is enabled
The buttons in the plugins home page ("Upload plugin" and "View plugins by class") become misaligned when you have the git repository search bar.

To test:

1. Add a github/gitlab repository in koha-conf.xml
  - In ktd shell, open /etc/koha/sites/kohadev/koha-conf.xml
  - Somewhere under <config> insert the following (or your own)

<plugin_repos>
  <repo>
   <name>Solutions inLibro</name>
   <org_name>inLibro</org_name>
   <service>github</service>
  </repo>
</plugin_repos>

  - Save the file
  - restart_all

2. Go to Administration > Manage plugins
--> Buttons are misaligned

3. Apply the patch

4. Run command « yarn build »

5. Repeat step 2
--> buttons are aligned nicely

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7b54b74b36)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:43:23 +01:00
Pedro Amorim 643fbded69
Bug 41916: Update Cypress tests
Button is now 'Save' not 'Submit' after bug 40191

On ktd:
cypress run --spec t/cypress/integration/SIP2/*

All tests must pass

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit fb921843ab)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:42:02 +01:00
Pedro Amorim b016ae79a0
Bug 41916: Clean-up obsolete code
No longer needed after bug 40191, but because both that and bug 37893 went in close to each other, this remained.
Removing this fixes the toolbar buttons on the SIP2 account form and fixes the console warning that was causing a failure in cypress tests

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6f137822f7)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:42:01 +01:00
Marcel de Rooy c3cba269f9
Bug 41097: (QA follow-up) Clarify POD
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 47d88a6429)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:41:06 +01:00
Nick Clemens 53ac8f6291
Bug 41097: Don't use original record twice
This patch prevents us from passing the same record twice into the choose subs
to avoid a situation where the original record is not chosen as the one to keep
and we try to merge/delete the same record twice

To test:
1 - Run the script on a test system that you can reset
    perl misc/maintenance/dedup_authorities.pl -v -v --confirm -a="PERSO_NAME"
2 - Note duplication of entries in the output like:
    Merging 1660,1662 into 1660.
    Updated 0 biblios
    Deleting 1662
    Merge done.
3 - Note how many records are merged
4 - Run again to confirm nothing is merged, i.e. the script removed the dupes
5 - Reset your DB
6 - Apply patch
7 - Run the script again
8 - Note entries no longer have duplicated ids:
    Merging 1662 into 1660.
9 - Note the same number of records are merged
10 - Run again and confirm nothing is merged
11 - Sign off!

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>
(cherry picked from commit 7a5fa4cd50)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:41:04 +01:00
Kyle M Hall 380e9a72c4
Bug 41811: SIP server will inadvertently remove non-alphanumeric characters from the end of a message
If a message ends in a non-alphanumeric character, that character is stripped from the message.

For example:
6300120260210    182641          AOMPL|AA23529000035676(|

64              00120260210    182831000000000000000000000000AOCPL|AA23529000035676|AEHenry Acevedo|BLY|BHUSD|BV0|CC5|BD4345 Library Rd. Springfield, MA 44224|BF(212) 555-1212|PB19580530|PCS|PIY|AFGreetings from Koha. |

versus:
6300120260210    182641          AOMPL|AA23529000035676(|ACkoha|

64YYYY          00120260210    182835000000000000000000000000AOCPL|AA23529000035676(|AE|BLN|AFInvalid cardnumber|

The former should be returning the same "Invalid cardnumber" message the latter does.

Test Plan ( assumes you are using KTD ):
1) Install telnet: sudo apt install -y telnet
2) telnet 127.0.0.1 6001
3) Log in with: 9300CNkoha|COkoha|CPMPL|
4) Send the patron information request: 6300120260210    183346          AOMPL|AA23529000035676(|
5) Note you get a patron back
6) Apply this patch
7) Restart SIP!
8) Repeat steps 2-5
9) Noe you doe not get a patron back in the response!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 791648b643)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:40:42 +01:00
Pedro Amorim f2fad39765
Bug 41857: Only find singly suggestion by id if 'edit_form'
All ops that iterate on editsuggestions can potentially have multiple suggestionid and don't need stored_suggestion
cud-update_status
cud-delete
cud-archive
cud-unarchive
cud-update_itemtype
cud-update_manager

I'm unsure if op = 'else' should also be included with edit_form

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 86d36eacc0)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:39:05 +01:00
Pedro Amorim c40ac8da8a
Bug 41857: Use suggesteddate_from and suggesteddate_to
From URL params. I believe this was an overupdate from bug 39721.

Test plan:
1) Create a new suggestion:
http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl?op=add_form&branchcode=
2) Add a title and submit.
3) From the table, select the suggesiton (check the box).
4) Click the 'submit' under 'Update manager' or 'Delete selected'.
5) Error

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3eaaf784cb)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:39:04 +01:00
Pedro Amorim 8802471db6
Bug 41857: Remove suggestion
I don't understand why we need this here, but it seems to be picking up a leftover suggestion from a previous loop.
This code itself is not within a loop, so it doesnt have the hashref containing suggestiontype from suggestion.pl.
It's trying to access suggestiontype from Koha::Suggestion which causes an explosion

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0ff67af58a)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:39:02 +01:00
Baptiste Wojtkowski f0dd777cae
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>
(cherry picked from commit 344d66e4d4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:38:35 +01:00
Baptiste Wojtkowski 4b0b94bb0d
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>
(cherry picked from commit ba0b968a5a)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:38:34 +01:00
Baptiste Wojtkowski 97a7266946
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>
(cherry picked from commit 1a5bb27e8a)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:38:33 +01:00
Paul Derscheid e2ffcfb893
Bug 37707: (QA follow-up) Fix incorrect bold date expectations in Cypress test
- The test for circulation rules date calculations did not account for
  the start date being bold, only the period endpoint dates
- place_booking.js explicitly adds the selected start date to boldDates
  (boldDates = [new Date(startDate)]), giving it the "title" class
- The verification loop checking for unexpected bold dates then failed
  when it encountered the start date, which was bold but not expected
- Add clearZoneStart to expectedBoldDates to match actual behavior

To test:
- yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts
- Verify that the "should handle circulation rules date calculations and visual feedback" test now passes

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9c7b02b365)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:31 +01:00
Paul Derscheid 5e82d33938
Bug 37707: (QA follow-up) Fix grammatical error
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 871b18bd47)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:31 +01:00
Paul Derscheid de98eb3714
Bug 37707: (QA follow-up) Fix typo in comment
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5c24a2e3ff)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:30 +01:00
Martin Renvoize 22c930464d
Bug 37707: (follow-up) Add comprehensive Cypress tests for bookings modal
Reorganize and expand Cypress tests into three focused spec files:

bookingsModalBasic_spec.ts:
- Modal initialization and field interactions
- Form validation and submission
- Edit booking functionality
- 'Any item' booking with server-side item selection

bookingsModalDatePicker_spec.ts:
- Flatpickr initialization and constraints
- Date range validation
- Circulation rules (issue length, renewals)
- Lead/trail period conflict detection
- 'Any item' mode date availability
- Event dots for existing bookings

bookingsModalTimezone_spec.ts:
- Cross-timezone date display
- Multi-day booking spans
- Conflict detection with timezone awareness
- API round-trip date preservation
- Month boundary handling

Add shared test utilities to e2e.js for date helpers.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b591400ac1)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:29 +01:00
Martin Renvoize eb134a6127
Bug 37707: (follow-up) Refactor place_booking.js for maintainability
Extract utility functions and reduce code duplication:

- Add toInt(), startOfDay(), datesOverlap(), isDateInRange() helpers
- Simplify containsAny() using Set and Array.some()
- Refactor isItemAvailableForPeriod() to use new utilities
- Refactor getAvailableItemsOnDate() and isDateDisabledForSpecificItem()
- Extract submit handler helpers: getAvailableItemsForPeriod(),
  buildBookingPayload(), createTimelineItem(), showBookingError(),
  showBookingSuccess(), refreshBookingsTable(), setPickerDates()
- Replace parseInt() calls with toInt() for consistency
- Simplify modal reset handler with jQuery method chaining

No functional changes - prepares codebase for future Vue conversion.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0f5d2e457c)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:29 +01:00
Martin Renvoize 5cfcb61907
Bug 37707: (follow-up) Fix timezone handling for bookings
Fix date handling issues that caused bookings to shift by a day
when the browser timezone differs from the server timezone:

- Normalize dates to browser timezone for calendar display
- Use dayjs without UTC conversion for bookingsByDate keys
- Extract local date and send as explicit UTC day boundaries
- Preserve user's selected DATE regardless of browser timezone

Timeline display:
- Convert server dates to library timezone for display
- Add $timezone() and $toDisplayDate() helper functions

This ensures that a booking for "June 15" displays and saves as
June 15 regardless of the user's timezone offset.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 70b53f7baf)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:28 +01:00
Martin Renvoize d84a14742a
Bug 37707: (follow-up) Support lead/trail periods for 'any item' bookings
When booking "any item of type X", lead/trail period handling must
consider that multiple items may be available:

- Track per-item conflicts instead of global conflicts
- Only disable dates when ALL items of the type have conflicts
- Find closest "all items booked" dates for visual feedback
- Use mathematical search (180 days) to detect conflicts across
  month boundaries

Visual feedback for 'any item' mode:
- Show lead/trail periods around "all items booked" dates
- These represent dates where no item of the type is available

Skip redundant class-based conflict checks since mathematical
detection already handles cross-month boundary cases.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6a17417359)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-13 08:33:27 +01:00