Commit Graph

59333 Commits

Author SHA1 Message Date
Marcel de Rooy 0562121424
Bug 28146: Respect ReplytoDefault in error pages
Test plan:
Fill ReplytoDefault.
Check an error page on OPAC and intranet.
Verify that the send mail link refers to that email address.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:41 -06:00
David Cook c53fdd3623
Bug 34164: Redirect to referring URL when doing OIDC/OAuth SSO
This patch makes it so that a successful SSO will return you to
the place where you initiated the SSO. This is especially useful
when doing searches, placing holds, etc.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Set up OIDC SSO using
https://wiki.koha-community.org/wiki/Testing_SSO
2. Go to http://localhost:8081/cgi-bin/koha/circ/circulation-home.pl
3. Do a staff login using SSO
4. Note that you're redirected to
http://localhost:8081/cgi-bin/koha/circ/circulation-home.pl
after the successful login

5. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
6. Do a OPAC SSO login
7. Note that you're returned to
http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
after the successful login

8. Logout of the staff admin and OPAC
9. Note your URL ends in ?logout.x=1
10. Try logging back into them using SSO
11a. Note that you're logged in and not automatically logged out
11b. Note that if you're on the OPAC, you should be redirected
to opac-user.pl instead of opac-main.pl or the root path

12. If you change the domain for the SSO users to something
that your user does not match, try logging in again, and note
that the error message should display on mainpage.pl or opac-main.pl/opac-user.pl
for the OPAC. (This is because these are the pages that show SSO errors.)

Signed-off-by: Lukas Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:40 -06:00
Arthur Suzuki 53f1874892
Bug 29980: Add a cataloguing plugin to check ISBN
Test plan:
- without patch login to Koha
- edit a biblio and put a wrong ISBN in 020a (010a for unimarc).
- leave the input field (looses focus), no warning
- apply patch and do "reset_all" to make a full re-install.
- edit the biblio again and put an invalid ISBN in 020a (010a for unimarc).
- when you leave the input field you should have a warning saying "invalid ISBN".
- the input field should turn yellow
- you can still save the biblio with a wrong isbn, it is just a warning.
- if you apply the patch on an existing install, you must manually link the value builder to your existing frameworks to get it working.

Signed-off-by: Johannes Reuter <reuter@die-bonn.de>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:40 -06:00
Caroline Cyr La Rose 91a02cf4c4
Bug 40615: Update mention of 'My virtual card' in OPACVirtualCard description
This patch updates the OPACVirtualCard description to match the name of
the tab in the OPAC, which has been changed from 'My virtual card' to
'Library card'.

To test:
1. Apply patch
2. Go to Administration > System preferences
3. Search for OPACVirtualCard
4. Read the description of the system preference
   --> It should mention the 'Library card' tab and not the 'My virtual
       card' tab
   --> Make sure the sentence and the spelling are correct

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:39 -06:00
Jonathan Druart 93d680b645
Bug 40918: Fix invoice adjustement reason selection
From
  commit 46f7158f44
  Bug 38714: acqui/invoice.tt

Debugging stuff left, sorry!

Test plan:
1. Go to Acquisition.
2. Create a vendor.
3. Click "Receive Shipment"
4. Enter an invoice number and save.
5. Go to Administration->Authorized Values->Add A Category
6. Name it ADJ_REASON
7. Put in 2 options
8. Go to invoices in Aqusition
9. Add an adjustment (enter an amount and select a reason, then save)
10. The reason is set to "no reason"
11. Go to reports
12. new sql report
select * from aqinvoice_adjustments
13. Run the report and see your reason is saved.
14. go back to the invoice and click save adjustments
15. Run the report and see your reason is saved.

Signed-off-by: Eric Phetteplace <ephetteplace@cca.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:39 -06:00
Fridolin Somers 3aefbaeaf6
Bug 40785: Cronjob cleanup_database.pl remove args in usage first line
Cronjob cleanup_database.pl usage is wrong :
Usage: $0 [-h|--help] [--confirm] (...) [--bg-days DAYS [--bg-type TYPE] ]
Those args has been renamed jobs-days and jobs-type.
Also some args are missing.

There are too many args, I propose to remove them from there, one need to read the full help.

Test plan:
Run command line `misc/cronjobs/cleanup_database.pl -h`
You see first line:
Usage: misc/cronjobs/cleanup_database.pl

   -h --help          prints this help message, and exits, ignoring all
...

Signed-off-by: Anke Bruns <anke.bruns@gwdg.de>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:38 -06:00
Lisette Scheer b895eb9b7d
Bug 35700: Holds reminder cronjob - Fix --triggered switch if the day to send notice hits concurrent holidays
If the holds reminder cronjob would send a reminder on a holiday,when holidays are taken into account, it also will send it on the subsequent holidays and the first open day.
This bugfix adds a check to the cron when --holidays is set to skip sending the notices for that library if today is a holiday.

To Test:
Before applying:
1. Create a hold for a patron (I used patron 23529000035676 and 39999000000252)
2. Ensure your patron has an email address set and the hold reminder email selected.
3. Set the hold to waiting by checking it and confirming the hold.
4. In Tools->Calendar add a holiday to yesterday and a seperate holiday to today.
5. On the command line (the date should be set to 5 days ago for my commands to work and any dates adjusted accordingly)
koha-mysql kohadev
update reserves set waitingdate="2025-09-25"
exit
perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays --date 2025-09-29
6. Observe that 1 notice would have sent to your patron
7. On the command line
perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays
8. Observe that 1 notice would have sent to your patron
9. On the command line
perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays --date 2025-10-01
10. Observe that 1 notice would have sent to your patron

11. Apply patches
12. Repeat the last command from step 5 and step 7
13. Observe that no notice should be sent for your patron
14. Repeat step 7
15. Observe that a notice should be sent for your patron.
16. Run
perl misc/cronjobs/holds/holds_reminder.pl -days 5 -t -v
17. Confirm the notice should be sent for your patron
18. Sign off

Signed-off-by: Katie Bliss <KEBliss@dmpl.org>

Bug 35700: (QA follow-up) fix POD and $today

This patch replaces the inncorrectly removed POD note and replaces $today with the more correct $date_to_run for checking if we should be skipping sending the message on the day.

Amended-by: Jonathan Druart
Squashed and adjusted commit title

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:38 -06:00
Marcel de Rooy f0991861e2
Bug 40985: Clarify POD of Holds->filter_by_found
Test plan:
Read POD.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:37 -06:00
Martin Renvoize 47546f0849
Bug 40587: Auto-select EAN from QUOTE message when creating EDIFACT orders
When a basket is generated via an EDI QUOTE message, the QUOTE message
includes a library's EAN code (buyer_ean). This patch makes the 'Create
EDIFACT order' button automatically use the EAN from the original QUOTE
message instead of requiring manual EAN selection.

This patch also fixes a bug in process_quote where all baskets in
multi-message QUOTE transports incorrectly used the first message's
buyer_ean, even when subsequent messages had different EANs.

Changes made:

1. Fixed Koha/EDI.pm process_quote auto-order creation to use the correct
   buyer_ean for each message/basket pair in multi-message transports
2. Enhanced acqui/basket.pl to extract and provide the quote_ean from
   QUOTE messages, handling both single and multi-message scenarios
3. Updated basket.tt template to automatically select the EAN from the
   original QUOTE message when available and matching

Test plan:
1. Create a vendor with EDI account and multiple EANs configured
2. Process a QUOTE message that creates a basket
3. Go to the basket page and click "Create EDIFACT order"
4. Verify it automatically uses the EAN from the QUOTE message
   (shows tooltip "Using EAN from original QUOTE message")
5. Test with multi-message QUOTE files to ensure each basket uses
   the correct EAN from its corresponding message
6. Verify fallback behavior when no QUOTE EAN matches available EANs

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:37 -06:00
Martin Renvoize bd01562f5c
Bug 40587: Add tests for multiple message EAN handling in EDI quotes
This patch adds unit tests to verify that when processing EDI QUOTE transports
containing multiple messages with different buyer EANs, each basket gets the
correct EAN for its corresponding message.

Test plan:
1. Run: prove t/db_dependent/Koha/EDI.t
2. Verify the new 'multiple_message_ean_handling' subtest passes
3. Verify that all existing EDI tests continue to pass

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:36 -06:00
Martin Renvoize 213de9af0b
Bug 40866: Remove OVERRIDE state from action-logs.inc
This state is no longer ever set anywhere

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>
2025-10-09 14:58:35 -06:00
Martin Renvoize 4c24c03769
Bug 40866: Add missing override states to action-logs.inc
This follow-up adds missing override state translations that were
discovered during testing. The patchset logs various override states
but some were not covered in the log viewer display template.

Missing states added:
- USERBLOCKEDNOENDDATE: Patron had an indefinite restriction
- CURRENTISSUE: Item is currently checked out to this patron
- UNSEEN: Unseen renewal
- SEEN: Seen renewal

These states are now properly displayed in the action logs viewer
when reviewing circulation override logging.

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>
2025-10-09 14:58:35 -06:00
Martin Renvoize 19dc33c649
Bug 40866: Add unit tests for hold override logging
This patch adds unit tests to verify the hold override logging
functionality implemented in the previous patches. The tests cover the
logging of hold overrides in `C4/Reserves.pm` and the `Koha/REST/V1/Holds.pm`
API endpoint.

To test:
1. Run the following tests and confirm they pass:
   - prove -lrv t/db_dependent/Circulation.t
   - prove -lrv t/db_dependent/Reserves.t
   - prove -lrv t/db_dependent/api/v1/holds.t
2. All tests should pass.

Changes:

t/db_dependent/Circulation.t:
- Added tests for hold override scenarios in circulation.

t/db_dependent/Reserves.t:
- Added tests to verify that hold overrides are correctly logged when
  a hold is placed.

t/db_dependent/api/v1/holds.t:
- Added tests to ensure that the holds API correctly logs overrides
  when a hold is created with the `x-koha-override` header.

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>
2025-10-09 14:58:34 -06:00
Martin Renvoize 1884f68c5b
Bug 40866: Implement Alternative pattern for holds override logging (Part 4)
This patch implements proper override logging for holds following the
Alternative implementation pattern used for checkouts and renewals.

Instead of just removing the orphaned logging code from the original
Bug 9762 implementation, this patch properly implements override logging
by updating AddReserve to accept and log override information, similar
to how AddIssue handles confirmations and forced overrides.

Changes:

C4/Reserves.pm:
- Added JSON qw(to_json) import
- Updated AddReserve to accept confirmations and forced parameters
- Enhanced the existing logaction call to include override information
  in JSON format when overrides are present
- Log format matches the Alternative implementation pattern:
  * hold ID
  * branchcode
  * biblionumber
  * itemnumber
  * confirmations array
  * forced array

Koha/REST/V1/Holds.pm:
- Added confirmations array building in the add() method
- Pass 'HOLD_POLICY_OVERRIDE' confirmation when override_all is true
- Pass confirmations parameter to AddReserve call

reserve/request.pl:
- Removed orphaned original implementation logging code
- Removed unused variables and imports (message, @message, user, etc.)
- Removed C4::Log import

koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc:
- Added 'HOLD_POLICY_OVERRIDE' case to translate_log_override block
- Displays as "Hold policy override" in log viewer

koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt:
- Added JSON display handling for HOLDS module (similar to CIRCULATION)
- Displays hold ID, biblionumber, and optional itemnumber with links
- Shows forced and confirmation overrides using translate_log_override

This ensures hold overrides are logged consistently with the Alternative
implementation pattern, providing proper audit trails for policy overrides
that are properly displayed in the log viewer.

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>
2025-10-09 14:58:34 -06:00
Martin Renvoize 9ce4533b75
Bug 40866: Remove original Bug 9762 implementation remnants (Part 3 - Returns)
This patch removes the duplicate logging code from circ/returns.pl that
was part of the original Bug 9762 implementation.

The original implementation added a separate logaction() call when
ignoring holds on return. This code created a custom JSON log entry
with the message "return an element that is reserved".

However, this logging appears to have been orphaned - there is no
corresponding Alternative implementation for return override logging
in the current codebase. The code was creating log entries but they
were not properly integrated with any override confirmation workflow.

Changes:

circ/returns.pl:
- Removed entire else block that created custom override log entries
- Removed unused variables: $message, @message, $user, $branchcode, $barcode
- Removed C4::Log qw(logaction) import as it's no longer needed

This eliminates the orphaned logging code and ensures returns.pl only
uses standard Koha logging mechanisms.

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>
2025-10-09 14:58:33 -06:00
Martin Renvoize ca47310a3b
Bug 40866: Remove original Bug 9762 implementation remnants (Part 2 - Renewals)
This patch removes the duplicate logging code from renewal scripts
(circ/renew.pl and svc/renew) that was part of the original Bug 9762
implementation.

The original implementation created separate logaction() calls with
custom JSON messages whenever renewal overrides occurred. This caused
double logging alongside the Alternative implementation which properly
logs overrides via the confirmations parameter in AddRenewal.

Changes:

circ/renew.pl:
- Removed unused variables: $user, $branchcode, @message
- Removed separate logaction() calls for override logging
- Changed to use confirmations array with proper codes:
  * 'RENEWAL_LIMIT' for override_limit
  * 'ON_RESERVE' for override_holds
- Removed C4::Log qw(logaction) import

svc/renew:
- Removed unused variables: $borrower, $user, $message, @message
- Removed separate logaction() calls for override logging
- Changed to use confirmations array with proper codes:
  * 'ON_RESERVE' for on_reserve override
  * 'RENEWAL_LIMIT' for too_many override
- Removed C4::Log qw(logaction) import

The Alternative implementation in AddRenewal will now handle all
override logging consistently through the confirmations parameter.

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>
2025-10-09 14:58:33 -06:00
Martin Renvoize 2fea44ff25
Bug 40866: Remove original Bug 9762 implementation remnants (Part 1)
This patch removes the duplicate logging code from the original
Bug 9762 implementation that was not properly removed when the
Alternative implementation was merged.

The original implementation added separate logaction() calls in
CanBookBeIssued and circulation.pl that created additional log
entries with a different JSON format. This caused double logging
when the Alternative implementation (which logs via AddIssue) was
merged on top.

Changes in this patch:

C4/Circulation.pm:
- Removed @message_log array and all pushes to it
- Removed the separate logaction() call at the end of CanBookBeIssued
- Removed 5th return value (@message_log) from CanBookBeIssued
- Removed all if ($issueconfirmed) blocks that were populating @message_log

circ/circulation.pl:
- Removed the problematic line that added OVERRIDDEN to every confirmed
  checkout: $needsconfirmation->{'OVERRIDDEN'} = $issueconfirmed

This addresses the double logging issue where circulation overrides
were being logged twice with different formats.

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>
2025-10-09 14:58:32 -06:00
Martin Renvoize de962e15cf
Bug 40866: Remove unused $message variable from circulation
The $message variable was declared in circ/circulation.pl but never
actually set, making the "No patron matched" template block unreachable.

This is a remnant from old code that was incompletely cleaned when that
functionality was changed/removed.

This patch removes the unused variable, template parameter, and the
unreachable template block.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
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>
2025-10-09 14:58:32 -06:00
Hammat Wele 3c41dfbe3f
Bug 40866: Fix incorrect display of override message on normal checkouts
- The message 'No patron matched Restriction overridden temporarily' was appearing on every checkout, even when no restriction override occurred.
- This was caused by the message being set unconditionally after AddIssue in circ/circulation.pl.
- The message should not appear in circulation.pl, but in the Log Viewer.

To test:

1. Check out an item to a patron normally.
2. 'Restriction overridden temporarily' message appears.
3. Apply patches
4. Repeat 1.
  ---> Verify that no 'Restriction overridden temporarily' message appears.
5. Check out an item that requires an override (e.g., not for loan item with AllowNotForLoanOverride enabled).
  ---> Verify that no 'Restriction overridden temporarily' message appears.
6. Go to Tool -> Log viewer.
7. Enter the borrowernumber in Object field and submit.
  ---> Verify that the 'Restriction overridden temporarily' message is logged correctly.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
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>
2025-10-09 14:58:31 -06:00
Tomás Cohen Arazi 220fdce180
Bug 40915: Add enhanced debug logging for empty critical fields in SIP message parsing
This patch adds debug logging to C4::SIP::Sip::MsgType::_initialize() to help
identify when critical fields (patron_id, item_id) are parsed as empty values.

Empty critical fields in SIP messages can later cause DBIx::Class constraint
errors when passed to Koha::Objects->find() operations, generating confusing
'Odd number of elements in anonymous hash' errors in SIP server logs.

The enhanced logging helps administrators identify the root cause by logging
when empty patron_id or item_id fields are detected during message parsing.

To test:
1. Apply regression tests patch first
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/SIP/MsgType.t
=> FAIL: Debug logging tests fail (no enhanced logging present)
3. Apply this patch
4. Run:
   $ ktd --shell
  k$ prove t/db_dependent/SIP/MsgType.t
=> SUCCESS: All tests pass, debug logging works correctly
5. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:31 -06:00
Tomás Cohen Arazi 499b23d63c
Bug 40915: Add comprehensive regression tests for SIP MsgType message parsing and debug logging
These tests verify that C4::SIP::Sip::MsgType correctly parses SIP messages without
creating problematic arrayref field values, and validates enhanced debug logging for
empty critical fields.

Test Coverage:
• Message parsing with correct protocol versions (PATRON_INFO/HOLD/RENEW use v2, CHECKOUT
uses v1)
• Empty patron_id and item_id field detection with debug logging
• Malformed delimiter handling (double delimiters, trailing empty fields)
• Multiple consecutive empty fields in single message
• Confusing delimiter patterns that could break parsing
• Verification that parsed fields are strings, not arrayrefs
• Working siplog mock infrastructure in C4::SIP::Sip::MsgType

Arrayref Prevention Tests:
Tests verify message parsing DOESN'T create empty arrayrefs that would later cause "Odd
number of elements in anonymous hash" errors when passed to Koha::Objects->find()
operations.

Enhanced Debug Logging Tests:
Tests validate that empty critical fields (patron_id, item_id) are detected during
parsing and generate appropriate debug messages to help troubleshoot downstream
constraint errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:24 -06:00
Jonathan Druart a8cdee1ee7
Bug 15516: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:31 -06:00
Jonathan Druart d90780504f
Bug 39190: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:30 -06:00
Jonathan Druart 2957031428
Bug 40665: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:30 -06:00
Jonathan Druart 1a4f7ad3b1
Bug 36033: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:22 -06:00
Jonathan Druart de85f171fd
Bug 40981: Prevent KohaTable/Holdings_spec.ts to fail randomly
There is a JS warning raised by DT which makes the tests fail:
```
The following error originated from your application code, not from Cypress.

  > DataTables warning detected in log: "DataTables warning: table id=holdings_table - Ajax error. For more information about this error, please see https://datatables.net/tn/7"
```

It is caused by a 404 returned by the API, because DT receives the
response during the afterEach (after the objects have been deleted)

We must wait for the responses when needed.

Test plan:
  cypress run --spec t/cypress/integration/KohaTable/Holdings_spec.ts
should still pass

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 07:25:28 -06:00
Lucas Gass 1cb4b9c4a6
Bug 15516: (follow-up) DBRev nneds to include everything from the kohastructure
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-08 09:53:00 -06:00
Lucas Gass 8831827d03
Bug 37901: (follow-up) Adjust DBRev includes everything from the kohastructure
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-08 09:52:59 -06:00
Lucas Gass 91e99a74e2
Bug 40665: (follow-up) Sync comment for booking_id column
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-08 09:52:52 -06:00
Martin Renvoize 83126898de
Bug 32950: (follow-up) Fix copy_field regression for cross-field operations
The bug 32950 fix introduced a regression that broke copy_field operations
when copying between different fields or when copying a subfield to itself
within the same field.

The original fix correctly handled moving subfields between different
subfields within the same field (e.g., 020$z to 020$a) by using
field_exists() to identify which fields have the source subfield.

However, this logic was applied too broadly:

1. Cross-field operations (e.g., 650$a to 651$a): The fix passed source
   field_numbers to _update_subfield for the target field, causing it to
   look for non-existent target field positions. This resulted in
   insert_fields_ordered creating new fields out of order.

2. Same-field, same-subfield operations (e.g., 952$d to 952$d): The fix
   prevented copying to fields that didn't have the source subfield, but
   the original behavior was correct for duplicating a subfield to itself.

This patch restricts the bug 32950 logic to only apply when:
- Source and target fields are the same AND
- Source and target subfields are different

Additionally, it ensures field_numbers are not passed to _update_subfield
when copying between different fields.

Test plan:
1. Run prove t/SimpleMARC.t
2. All tests should pass, including:
   - Cross-field copy operations (650$a to 651$a)
   - Same-field, different-subfield operations (020$z to 020$a)
   - Same-field, same-subfield operations (952$d to 952$d)

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-07 11:01:21 -06:00
Lucas Gass 2a00442a28
Bug 34596: (follow- up) Fix gnu link
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 14:19:00 -06:00
Tomás Cohen Arazi 7939c4d7d3
Bug 40027: (follow-up) Add .github/ to Makefile.PL
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 14:18:52 -06:00
David Cook 02aba8c0b2
Bug 40622: Use OPAC MARCXML for ILS-DI GetRecords
This change makes it so that the ILS-DI GetRecords output for
"marcxml" will contain the OPAC version of the record.

Test plan:
0. Apply the patches
1. prove t/db_dependent/ILSDI_Services.t
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
3. Click "Settings" to change the framework to Default, and click "Save"
4. Go to http://localhost:8081/cgi-bin/koha/admin/marc_subfields_structure.pl
?op=add_form&tagfield=245&tagsubfield=a&frameworkcode=#subafield
5. Untick the "OPAC" box and click "Save changes"
6. Go to system preferences
7. Change "ILS-DI" to "Enable"
8. Change "ILS-DI:AuthorizedIPs" to 0.0.0.0/0
9. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
10. Note that you cannot see the title in the MARCXML.

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>
2025-10-06 09:15:27 -06:00
David Cook e5a302d968
Bug 40622: Add missing interface parameter
This change adds the missing interface parameter which
Bug 38233 initially added.

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>
2025-10-06 09:15:27 -06:00
Michał Kula d6b95024bc
Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there
Automatically redirect users who try to submit a PR at GitHub to instructions on how to submit patches and close the PR. Better experience for potential new developers (since they get immediate feedback, while still in the flow for submitting the patch).

The sparse checkout of readme is probably required, so that the gh command knows on what repo to work with.

Based on: https://github.com/mozilla-firefox/firefox/blob/main/.github/workflows/close-pr.yml

Signed-off-by: Imani Thomas <imani.thomas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:26 -06:00
Lucas Gass 2bf041ca4c
Bug 40917: Remove extraneous whitespace
To test:
1. Add an required patron attribute
2. Go to the patron form ( memberentrygen.tt )
3. Look at the textarea for the required attribute
4. There is unwanted whitespace characters in the textarea
5. APPLY PATCH
6. Try again, the whitespace should be gone.

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:26 -06:00
Lucas Gass 3ffeb14e4b
Bug 40899: Fix rendering of JSON in data-attribute with html filter
To test:
1. Place a hold on many items
2. Change the "Pickup at:" dropdown" to something else
3. Notice the "Pickup location:" dropdowns do not change with it
4. APPLY PATCH
5. Try steps 1 & 2 again. This time the dropdpwns should adjust accordingly

Signed-off-by: Chip Halvorsen <chip.halvorsen@westlakelibrary.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:25 -06:00
Jonathan Druart e39e568e6a
Bug 32950: Remove unecessary DELETE
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:25 -06:00
Martin Renvoize 346dd2073a
Bug 32950: Fix moving subfield losing values for repeatable fields
Moving one subfield to another was failing for repeatable fields where
the field to be moved doesn't exist in the first instance. When moving
subfields within the same field type (e.g. 020$z to 020$a), existing
subfield values in fields that didn't contain the source subfield were
being overwritten with values from other fields.

This patch fixes the issue by determining which fields actually contain
the source subfield and only updating those corresponding target fields,
preserving existing values in fields that don't have the source subfield.

The fix adds logic to _copy_move_subfield to:
1. Use field_exists() to identify which fields have the source subfield
2. Pass these field numbers to _update_subfield for targeted updates
3. Preserve all existing functionality while fixing the data loss bug

Test plan:
1. Create a MARC modification template to move 020$z to 020$a
2. Create a record with multiple 020 fields:
   - Some with existing $a values
   - Some with $z values to be moved
3. Apply the template
4. Verify existing $a values are preserved
5. Verify $z values are moved to $a only in appropriate fields
6. Verify $z subfields are removed after the move

Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:24 -06:00
Martin Renvoize daa661f86c
Bug 32950: Add test for moving subfield in repeatable fields
This test verifies that when moving subfields between repeatable fields,
existing values in fields that don't contain the source subfield are
preserved.

The test creates multiple 020 fields:
- Some with existing $a values
- Some with $z values to be moved to $a

After applying the move template, it verifies:
- Existing $a values are preserved
- $z values are moved to $a only in fields that had $z
- $z subfields are properly removed after the move

Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:24 -06:00
Tomás Cohen Arazi 20b58e41a7
Bug 40950: Add 'falsy' programming idiom to codespell dictionary
The term 'falsy' is a standard JavaScript idiom referring to values
that evaluate to false in boolean contexts (false, 0, '', null,
undefined, NaN). This is widely used in modern JavaScript and is
part of the official ECMAScript specification terminology. I also
believe it is relevant for Perl.

Codespell currently flags 'falsy' as a misspelling, but this is
incorrect as it's legitimate technical terminology used throughout
our JavaScript codebase and documentation.

Changes:
- Add 'falsy' to codespell exceptions/dictionary
- Allows proper use of JavaScript terminology in code and comments

Test plan:
1. Apply patch
2. Run codespell on files containing 'falsy'
=> SUCCESS: No longer flagged as misspelling
3. Verify 'falsy' usage in JavaScript context works correctly
4. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:23 -06:00
Kyle M Hall a067423f3f
Bug 40953: marc_ordering_process.pl broken due to accidental newline
Executing marc_ordering_process.pl will fail to run with the following errors:

/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 21: =head1: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 23: marc_ordering_process.pl: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 25: =head1: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 27: --confirm]: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 27: --verbose]: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 27: ./marc_ordering_process.pl: No such file or directory
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 29: or,: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 31: 0: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 33: =head1: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 35: This: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 36: If: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 38: =head1: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 40: =over: command not found
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 42: syntax error near unexpected token `newline'
/usr/share/koha/bin/cronjobs/marc_ordering_process.pl: line 42: `=item B<-v|--verbose>'

This is due to an inadvertent newline before the shebang of the script.

Test Plan:
1) Run ./misc/cronjobs/marc_ordering_process.pl
2) Note the error
3) Apply this patch
4) Run ./misc/cronjobs/marc_ordering_process.pl
5) No error!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:23 -06:00
Laura_Escamilla 7be401fcbd
Bug 40886: Ensure patron messages display in proper chronological order
1. Create several random patron circ messages with different dates. I used the following sql for my ktd:
    -- INSERT INTO messages (borrowernumber, branchcode, message_type, message, message_date)
SELECT
    51 AS borrowernumber,
    'CPL' AS branchcode,
    ELT(FLOOR(1 + (RAND() * 3)), 'L','B','E') AS message_type,  -- L=Staff note, B=OPAC, E=Email (adjust to your codes)
    CONCAT('Random test message ', FLOOR(RAND()*1000)) AS message,
    DATE_ADD(CURDATE(), INTERVAL -FLOOR(RAND() * 1825) DAY) AS message_date  -- random day in last ~5 years (5*365)
FROM (
    SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
    UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10
) AS x;

2. View the patron account and notice that messages are sorted by type, but not by date.
3. Apply the patch and restart_all
4. Refresh the patron account page and clear the browser cache if necessary.
5. View the patron account again and notice that the messages are still sorted by type, but they are also sorted in descending order (newest to oldest).
6. Sign off and have a great day!

Signed-off-by: Jen Tormey <jntormey@dmpl.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:22 -06:00
Lucas Gass ac80486f2e
Bug 40916: Fix another occurance
Signed-off-by: Michelle <mspinney@clamsnet.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:22 -06:00
Lucas Gass 83159051fe
Bug 40916: Fix evaluation when editing a list
1. Create a list
2. Sort this list by: title
3. Save
4. Edit the list, changing the the "Sort this list by:" to copyrightdate
5. Try to edit it again to any other type of sort. Save
6. Look again, it is reverted to copyrightdate
7. APPLY PATCH, restart_all
8. Now when you edit the list any value you use in "Sort this list by:" should be retained.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:21 -06:00
Lucas Gass d6e5ee20b1
Bug 40655: Fix logic of adding the disabled class
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:21 -06:00
Emily Lamancusa d42ce0a368
Bug 40888: Fix op drop-downs in advanced search
To test:
1. Go to the Advanced search page
2. Click "More options"
--> Note that the first line in the "Search" section has a drop-down for
    operation (and/or/not), but subsequent lines do not. It should be
    the other way around. Also, the alignment is strange.
3. Apply patch and refresh page
--> All lines except for the first line now have an op drop-down, and
    the alignment looks correct.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:20 -06:00
Laura_Escamilla 932c1c07dd
Bug 40897: Resized the field lengths to ensure even lengths
To test:
1. Select an existing record and manage items (or create a new record) so that you are on the additem.pl form.
2. Notice that the fields are uneven lengths.
3. Apply the patch. Do a yarn build and restart_all. Clear your browser cache if necessary.
4. Refresh the additem.pl page and notice that the fields are all the same length now.
5. Sign off and have a great day!

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:20 -06:00
Arthur Suzuki 7e4f2f7c29
Bug 40904: Fix item search by shelving location on catalogue/details.pl
Test plan :
- before patch on ktd, go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=155
- in the holdings table search for "general" like "General Stacks".
- see that no items appear
- apply patch
- repeat the search
- all items appear now.

Signed-off-by: Mathieu <mathsabypro@gmail.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:19 -06:00
Marcel de Rooy 013a469b45
Bug 40929: Add $hold test in opac-modrequest
Test plan:
Login at OPAC.
Pass an unexisting reserve_id in a opac-modrequest.pl URL.
Verify that you get a 403 redirect.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-06 09:15:19 -06:00