Commit Graph

58933 Commits

Author SHA1 Message Date
David Cook 9da5f23f96
Bug 40473: Use better algorithm for calculating Code39 barcode length
This patch uses the PDF::Reuse::Barcode algorithm for calculating barcode
background box length relative to barcode length in order to determine
the actual barcode width and thus the X scale factor required to re-size
that barcode so that it fits on the label width (or rather the
"Barcode width" which is a percentage applied to the label width
to create a narrower usable surface for the barcode and barcode background
box).

To test:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=29
2. Add an item with barcode 123456, add an item with barcode 39999000001310399991,
    and ensure an item with barcode 39999000001310 already exists
3. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=batch
4. Create a patch that uses 3 items using 39999000001310, 2 items with 123456,
    and 2 items with 39999000001310399991
4. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=layout
5. Edit the layout "Label Test"
6. Change the "Barcode width" to 1, and enable "Draw guide boxes", and click "Save"
7. Export the batch using the template "Avery 5160 | 1 x 2-5/8" and the layout "Label Test" and open as PDF
8. Note that the whole barcode fits inside the red guidebox (there should be some
overlap of white on top of the red guidebox but that is normal since we're using 100% of the
barcode label width).
9. Edit the "Label Test" layout to try "Code39 + Modulo43" and "Code39 + Modulo10" and retry batch export
10. Edit the "Label Test" and try different "Barcode width" like the usual default .8
11. Celebrate that your barcodes fit on the label!

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-26 10:36:41 -06:00
Andrew Fuerste Henry 0547534fc3
Bug 40854: Correct menu name in browser.js
To test:
1 - perform a search in the staff interface, click a title to go to biblio details
2 - note lack of search results browsing tools at top left of page
3 - apply patch
4 - repeat your search, click a title to go to biblio details
5 - note browsing results tools at top left of page

Signed-off-by: Kevin Kellenberger <kkellenberger@mrcpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-26 09:10:21 -06:00
David Cook f199a09668
Bug 40748: Check for HTTP URLs and skip shell when using system()
This change checks for HTTP(S) URLs and skips the shell when using
system() so that shell metacharacters aren't interpreted.

Test plan:
0. Apply the patch
1. Insert the following into the Babeltheque_url_update system preference:
$(whoami > /tmp/rce.log)
2. koha-shell kohadev
3. perl misc/cronjobs/social_data/update_social_data.pl
4. Note the script says the following:
$(whoami > /tmp/rce.log) is not a HTTP URL. Aborting.
5. Note also that /tmp/rce.log is not created
6. Change Babeltheque_url_update syspref to something like the following:
http://localhost:8080
7. perl misc/cronjobs/social_data/update_social_data.pl
8. Note that the wget succeeds but the bunzip2 fails (as expected) since
we haven't fetched a bzipped file
9. Try to create a payload that passes the HTTP URL test with shell
metacharacters and note that they're not interpetted and instead
just used as part of a URL string.

Signed-off-by: Jake Deery <jake.deery@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-26 09:10:20 -06:00
Jake Deery 0d89cb1f01
Bug 40748: Fix RCE in update_social_data.pl
This patch fixes an identified RCE in the update_social_data.pl
social_data, which when executed, allows an attacker to run arbitrary
code on the system's shell.

TO TEST:

a)  In the Babeltheque_url_update syspref, wrap any bash in $(), and then
run the update_social_data.pl script.
    *)  For example, $(whoami >
/tmp/rce.log) will output to a file the username the perl script is
running as.
APPLY PATCH
b)  Run the update_social_data.pl script again. The string is now
meta-escaped, and the RCE no longer works.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-26 09:10:20 -06:00
Marcel de Rooy 39fe0a8312
Bug 40766: (QA follow-up) Operator precedence, quoting
Adding parentheses since I was not sure about precedence here. The filter
should be applied to the whole expression.
Adjusted double to single quotes in the second change.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-26 09:10:19 -06:00
Jonathan Druart 638fe291c2
Bug 40766: Prevent XSS on set-library
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-26 09:10:12 -06:00
Jonathan Druart 9af7d9dfd7
Bug 40565: Correctly fix the retrieval of 'id'
For other tables than those from Vue apps, table_node is the node and we
need to retrieve the object before accessing the attr function

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-25 11:07:51 -06:00
Jonathan Druart 7bb704294b
Revert "Bug 40565: (follow-up) Make sure there is a table_node"
This reverts commit addd5e3a0d.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-25 11:07:50 -06:00
Jonathan Druart 9e437a4089
Bug 40876: Apply 'exact' to all attributes when column filtering
If you select an option in a column filter, the "exact" behaviour will
only apply to the first attribute mapped to this column

eg. on the patron search we have "Libraries" mapped to library.name and
library.library_id. If you select Centerville/CPL, the generated q
parameter will be {name: CPL, id: {like: "%CPL%"}}

This is caused by:
    if (value.match(/^\^(.*)\$$/)) {
        value = value.replace(/^\^/, "").replace(/\$$/, "");
On the second parameter we have lost the ^$ markers

Moving it out of the loop fixes the problem (and does not impact the
other behaviours: we search the same value for all the attributes

Test plan:
Create a library with code=CPLL and use if for a patron
Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl
Click search
Select "Centerville" in the "Libraries" column filter
=> Without this patch you get the patrons from CPL and CPLL
=> With this patch applied only patrons from CPL are listed

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>
2025-09-25 11:07:42 -06:00
Lucas Gass addd5e3a0d
Bug 40565: (follow-up) Make sure there is a table_node
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 16:14:54 -06:00
Tomás Cohen Arazi cd44d6e430
Bug 40872: (follow-up) Tidy opac/unapi
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 09:25:06 -06:00
Tomás Cohen Arazi 406e2534ae
Bug 40872: List opac/unapi as a Perl file
This patch makes `tidy.pl` treat the file as a Perl one.

To test:

1. Run:
   $ ktd --shell
  k$ misc/devel/tidy.pl opac/unapi
=> FAIL: You get:

```
Cannot guess filetype for opac/unapi at /kohadevbox/koha/Koha/Devel/Files.pm line 241.
```
2. Apply this patch
3. Repeat 1
=> SUCCESS: The file is now tidy.
4. Sign off :-D

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 09:25:05 -06:00
Lucas Gass 5ceb2c78e9
Bug 40870: Set the fund code to selected on acqui/neworderempty.pl
To tes:
1- add an order to a basket in acquisitions
2- confirm your order shows in the basket with a fund code selected
3- click Modify on your order
4- note that Fund is empty in the modify form and you need to re-select it
5. APPLY PATCH
6. Try steps 1 -4 again, the correct fund should be set on page load

Signed-off-by: Wendy Bartlett <wbartlett@cuyahogalibrary.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 09:25:05 -06:00
Jonathan Druart b7bd25885e
Bug 40684: Adjust permissions for vendors
The acquisition config route should be accessible to users
with at least one acquisition subpermission or erm permission.

The list vendors route should be accessible to users with the erm
permission.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 09:25:04 -06:00
Tomás Cohen Arazi 6b478e0da9
Bug 40163: (follow-up) Fix wrong GNU links and update test
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 09:25:04 -06:00
Jonathan Druart cc72eabc5f
Bug 40858: Search merge conflict on files part of the git index
Same as bug 34303 and bug 33743, our test suite must parse/process files
that are part of the index, not all the other files.

It's currently failing on kohadev-db-request.txt that is owned by root.
But it's not part of the Koha codebase, this file should not be tested.

There were also node_modules and po files that were processed.

Test plan:
  prove t/00-merge-conflict-markers.t
must now return gren

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>
2025-09-24 09:25:03 -06:00
Jonathan Druart 36bd4bd7b4
Bug 40858: Rename context 'all' with 'core'
All was not returning all the files present in the git index, but all
Koha core files. Let's rename it with 'core' to remove ambiguity.

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>
2025-09-24 09:24:55 -06:00
Tomás Cohen Arazi a5545d990d
Bug 40855: Replace raw SQL in Standard backend edititem with add_or_update_attributes
This patch refactors the edititem() method in the Standard ILL backend
to use the modern add_or_update_attributes() method instead of raw SQL
delete-all-and-recreate operations.

Problems with the old approach:
- 40+ lines of raw SQL bypassing ORM validation
- Inefficient delete-all-then-insert pattern
- Complex conditional SQL based on column existence
- Manual transaction handling and error-prone bind parameters
- Difficult to maintain and debug

Benefits of the new approach:
- Single line replaces 40+ lines of raw SQL
- Uses ORM validation and relationships
- Only updates attributes when values actually change
- Automatic backend column handling
- Consistent with other modernized Standard backend methods
- Better performance and maintainability

The refactoring:
- Removes all raw SQL queries (DELETE and INSERT statements)
- Removes manual transaction handling
- Removes conditional column existence checks
- Replaces with single add_or_update_attributes() call
- Maintains identical functionality and behavior

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/ILL/Backend/Standard.t
=> SUCCESS: Tests pass! Refactoring maintains compatibility
3. Test ILL request editing in Standard backend:
   - Edit existing ILL request metadata
   - Add/modify custom fields
   - Verify attributes updated correctly
=> SUCCESS: Same functionality, cleaner implementation
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:34 -06:00
Tomás Cohen Arazi c8fc47d88b
Bug 40855: Add unit tests for Standard ILL backend edititem method
This patch adds comprehensive unit tests for the edititem() method in the
Standard ILL backend to establish baseline behavior before refactoring.

The tests cover:
- Form stage (initial load) - displays current attributes for editing
- Commit stage (form submission) - processes updates with validation
- Core field updates (title, author, year, etc.)
- Custom field handling (null-delimited key/value pairs)
- Attribute persistence after updates

These tests demonstrate the current raw SQL implementation behavior
and will ensure the upcoming refactoring maintains compatibility.

Current behavior tested:
- edititem() uses multi-stage workflow (init -> form -> commit)
- Validation requires 'type' and 'branchcode' fields
- Custom fields use null-delimited strings for multiple values
- Method returns 'create' (not 'edititem') in commit stage
- Raw SQL delete-all-and-recreate pattern for attribute updates

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/ILL/Backend/Standard.t
=> SUCCESS: Tests pass! Current edititem behavior documented
3. Tests establish baseline for upcoming refactoring
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:33 -06:00
Tomás Cohen Arazi f1f0963f62
Bug 40850: (follow-up) Use add_or_update_attributes in Standard backend
This patch updates the Standard ILL backend to use the new
add_or_update_attributes() method instead of the problematic
extended_attributes() method that only supports adding new
attributes.

Changes:
- Request creation: Use add_or_update_attributes() for setting metadata
- Request migration: Use add_or_update_attributes() for copying attributes

Benefits:
- Eliminates duplicate key errors when updating existing requests
- Cleaner code - removes array-to-hash conversion boilerplate
- More efficient - only updates attributes when values change
- Consistent with new Koha::ILL::Request API patterns

Locations updated:
- add_request(): Request creation with metadata (line ~1017)
- migrate(): Request migration copying attributes (line ~731)

Test plan:
1. Apply patch
2. Test ILL request creation in Standard backend:
   - Create new ILL request with metadata
   => SUCCESS: Request created with attributes
3. Test ILL request migration:
   - Migrate existing request to new request
   => SUCCESS: Attributes copied correctly
4. Test updating existing request metadata:
   - Edit request and update metadata fields
   => SUCCESS: No duplicate key errors
5. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:33 -06:00
Tomás Cohen Arazi ea3065aeef
Bug 40850: (follow-up) Use add_or_update_attributes in copyright clearance methods
This patch simplifies the set_copyright_clearance_confirmed() method
to use the new add_or_update_attributes() method instead of custom
update/create logic.

Benefits:
- Reduces code complexity from 20+ lines to 6 lines
- Eliminates duplicate update/create logic
- Uses the new standardized method for attribute management
- Maintains all existing functionality and test coverage

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/ILL/Request.t
=> SUCCESS: Tests pass! Copyright clearance methods work with new implementation
3. Test copyright clearance workflow still works in ILL module
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:32 -06:00
Tomás Cohen Arazi 4753b73285
Bug 40850: Add `Koha::ILL::Request->add_or_update_attributes`
Currently, ILL backends and plugins must implement custom logic to update
existing extended attributes on ILL requests, as the core extended_attributes()
method only supports adding new attributes and throws duplicate key errors when
attempting to update existing ones. This has led to code duplication across
multiple ILL plugins (Rapido, INNReach, SLNP) that all implement identical
add_or_update_attributes() methods, and forces the Standard backend to use
error-prone patterns when managing request metadata.

This patch adds add_or_update_attributes() method to Koha::ILL::Request that
provides a safe, efficient way to add new attributes or update existing ones
in a single operation, eliminating duplicate key errors and reducing code
duplication.

The method:
- Accepts a hashref of attribute type => value pairs
- Updates existing attributes only when values actually change
- Creates new attributes when they don't exist
- Skips undefined or empty values to avoid constraint errors
- Uses transactions for atomicity
- Returns the request object for method chaining

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/ILL/Request.t
=> SUCCESS: Tests pass! New method works correctly
3. Test adding new attributes works
4. Test updating existing attributes works
5. Test mixed add/update operations work
6. Test empty/undefined values are skipped
7. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:32 -06:00
Tomás Cohen Arazi 059d5d569b
Bug 40262: (follow-up) Refactor copyright clearance to use dedicated methods
This patch refactors the copyright clearance confirmation functionality
to follow proper separation of concerns by moving business logic from
the controller to the model.

Changes:
- Add set_copyright_clearance_confirmed() method to Koha::ILL::Request
- Add get_copyright_clearance_confirmed() method to Koha::ILL::Request
- Update controller to use dedicated method instead of direct attribute manipulation
- Update staff template to use the new dedicated accessor method
- Add comprehensive test coverage for both methods

Benefits:
- Improved separation of concerns (business logic in model)
- Consistency with existing patterns (get_type, get_type_disclaimer_value)
- Better reusability and testability
- Centralized attribute name management

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/ILL/Request.t
=> SUCCESS: Tests pass! New methods work correctly
3. Test ILL copyright clearance workflow still works:
   - Enable ILLModule
   - Create HTML customization for ILLModuleCopyrightClearance
   - Create OPAC ILL request with copyright clearance
   - Verify confirmation is saved and displayed in staff interface
4. Sign off :-D

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

PA amended: Test file name in commit message

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:31 -06:00
Pedro Amorim e8cc5a8d2f
Bug 40262: (QA follow-up): Fix compatibility with ILLOpacUnauthenticatedRequest
This patch fixes the copyrightclearance_confirmed not saving if submitting an unauthenticated ILL request.

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:31 -06:00
Pedro Amorim d572cdebcc
Bug 40262: Save and display copyrightclearance_confirmed
Test plan, k-t-d:
1) Enable ILLModule
2) Add a new HTML customization, visit:
<staff_url>/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=html_customizations&editmode=wysiwyg
3) Pick ILLModuleCopyrightClearance as the 'Display location'
4) Pick a 'Publication date' in the past
5) Add a title and content. Save.
6) Create a new ILL request in the OPAC, visit:
<opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard
7) Notice the copyright clearance step is shown. Click 'Yes'.
8) Enter a 'type' and (optionally) some metadata. Click 'Create'.
9) Go back to the module in Staff UI and pick the request just created through the OPAC, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl
10) Notice the message 'Patron has confirmed copyright clearance for this request' is shown next to the patron in the the request details

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:30 -06:00
Tomás Cohen Arazi b8981d52a4
Bug 40163: (follow-up) Fix Bugzilla URL
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:30 -06:00
Tomas Cohen Arazi 1873d97c07
Bug 40163: Fix several http addresses in the code docs
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:29 -06:00
Marcel de Rooy ae78ea6e5e
Bug 40586: (QA follow-up) Add comment about effective notforloan status
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:28 -06:00
Marcel de Rooy 4551cb4f42
Bug 40586: Show negative notforloan status in holds table on opac-user
If an item is on order, it may take a while before becoming available.
Showing that too on the opac-user page is helpful for the user and
may reduce questions.

Test plan:
Pick an item and set notforloan to On order (-1) or another custom
negative notforloan status.
Put an item level hold on that item.
Go to the OPAC user page of that patron. Verify that the AV description
is added now to the status column of the holds table.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:28 -06:00
Lucas Gass fd1adddb35
Bug 40679: Fix display of cancellation reason dropdown
To test:
1. Have some holds
2. Go to reserve/request.pl?biblionumber=x for your biblionumber
3. Change at least one hold priority to 'del'
4. Notice the toolbar above the table with Update Hold, Cancel selected, Cancellation reason now looks wonky.
5. APPLY PATCH
6. Try again, the display of the toolbar should be better.

Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:27 -06:00
Jonathan Druart 71619f90e5
Bug 40861: Remove warning from serials/acqui-search-result.pl
Odd number of elements in anonymous hash at /kohadevbox/koha/serials/acqui-search-result.pl line 84.

it's coming from closedate that is empty, and output_pref that will
reach this return:
278     if ($str) {
279         local $@;
280         $dt = eval { dt_from_string($str) };
281         Koha::Exceptions::WrongParameter->throw("Invalid date '$str' passed to output_pref") if $@;
282     }
283
284     return if !defined $dt;    # NULL date

if str is undef, we don't enter if l.278 and return l.284
which will shift the elements of the hash (because of the list context)

We force the scalar and we are good.

There was no side-effect because closedate was the last of the list.

Note that total (and the 'count(*)' key) is not used in the template.

Test plan:
Create an order for a basket of the first vendor "My vendor" and hit
http://localhost:8081/cgi-bin/koha/serials/acqui-search-result.pl?supplier=d
Without this patch you get the warning
Odd number of elements in anonymous hash at /kohadevbox/koha/serials/acqui-search-result.pl line 84.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:27 -06:00
Jonathan Druart 825172c9f2
Bug 40565: Fix column filters on item search
The item search table is different from the other tables.
It is using server-side but its own way (not using the REST API).

Test plan:
Search items and filter using the column filters: collections, library,
item types, AVs, etc.

QA: I am not very happy with this patch but, feel free to suggest a
better fix!
Note that "results" was too generic and it felt better to adjust it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:18 -06:00
Jonathan Druart 6d52128345
Bug 39526: Do not insert the pref if renamed
The upgrade DB must be idempotent
if run twice, the second pass fails with
DBI Exception: DBD::mysql::db do failed: Duplicate entry 'ElasticsearchPreventAutoTruncate' for key 'PRIMARY' at /kohadevbox/koha/C4/Installer.pm line 825

We should not insert the pref if it has been renamed already.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-22 16:26:19 -06:00
Tomás Cohen Arazi 071b6322c7
Bug 38967: (follow-up) Force 'op' parameter
This fixes a failing test:

To test:
1. Run:
   $ ktd --shell
  k$ prove xt/find-missing-op-in-forms.t
xt/find-missing-op-in-forms.t .. 2/3
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-22 16:26:11 -06:00
Lucas Gass fffaa16d33
Bug 39190: Fix t/Koha/Auth/Permissions.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:27 -06:00
Lucas Gass 9e719cd1d3
Bug 35761: DBRev 25.06.00.018
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:26 -06:00
Tomás Cohen Arazi 0c41c436c9
Bug 39190: (follow-up) Two QA fixes
This patch:

* Removes unused logger object instantiation
* Adds missing Test::NoWarnings to the API tests

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:26 -06:00
Tomas Cohen Arazi a5f72d7362
Bug 39190: Rename id => file_transport_id and remove mapping
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:25 -06:00
Tomas Cohen Arazi 67a7901663
Bug 39190: Rename API from sftp_servers to file_transports
This patch renames the entire API structure from SFTP-specific to generic
file transport terminology to reflect the polymorphic nature of the system.

API Changes:
- Endpoints: /config/sftp_servers -> /config/file_transports
- Parameters: sftp_server_id -> file_transport_id
- Definitions: sftp_server -> file_transport
- Controller: Config::SFTP::Servers -> Config::File::Transports

File Changes:
- api/v1/swagger/definitions/sftp_server.yaml -> file_transport.yaml
- api/v1/swagger/paths/config_sftp_servers.yaml -> config_file_transports.yaml
- Koha/REST/V1/Config/SFTP/Servers.pm -> Koha/REST/V1/Config/File/Transports.pm
- t/db_dependent/api/v1/sftp_servers.t -> file_transports.t

Updated References:
- swagger.yaml: paths, definitions, parameters, tags
- Template JavaScript: API URLs and variable names
- Controller: package name, variable names, error messages
- Tests: endpoints, parameters, descriptions
- API mapping: to_api_mapping field name correction

To test:
1. Apply this patch
2. Run: yarn api:bundle (to regenerate swagger bundle)
3. Run: prove t/db_dependent/api/v1/file_transports.t
4. All API tests should pass
5. Verify admin interface uses new API endpoints
6. Test CRUD operations work correctly

The API now consistently uses 'file_transports' terminology matching
the polymorphic file transport system that supports FTP, SFTP, and
future transport types.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:25 -06:00
Tomas Cohen Arazi 03ae77d8db
Bug 39190: Rename admin interface from sftp_servers to file_transports
Renamed admin interface files and URLs to reflect the evolution from
'SFTP servers' to 'File transports' functionality:

- admin/sftp_servers.pl -> admin/file_transports.pl
- sftp_servers.tt -> file_transports.tt
- Updated all URL references in templates and admin menu
- Updated body id from admin_sftp_servers to admin_file_transports

The functionality is now future-proof for the addition of new file
transports, so the naming should reflect his broader scope.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:24 -06:00
Tomas Cohen Arazi 7ec377f20c
Bug 39190: Regression tests for polymorphic object creation
This patch adds comprehensive tests to verify that Koha::File::Transports
correctly returns polymorphic objects based on the transport field value.

The tests cover:
- build_object() polymorphic creation
- search() with polymorphic resultset iteration
- find() with polymorphic object return

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/File/Transports.t
=> FAIL: Tests fail - objects return base Koha::File::Transport
   instead of polymorphic Koha::File::Transport::SFTP/FTP classes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:24 -06:00
Tomas Cohen Arazi ab18d5a989
Bug 39190: Fix circular dependency causing C3 MRO failures
Resolved circular dependency chain:
Transport.pm → TestTransport.pm → Transports.pm → SFTP.pm → Transport.pm

Changed 'use Koha::BackgroundJob::TestTransport' to runtime 'require'
in the _post_store_trigger method to break the dependency cycle.

This fixes the C3 method resolution order failures in
Koha::File::Transport::FTP and Koha::File::Transport::SFTP.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:23 -06:00
Tomas Cohen Arazi 264b60d4a0
Bug 39190: Adjust permission across the board
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:23 -06:00
Tomas Cohen Arazi 1286c924b0
Bug 39190: Adjust schema to new structure
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:22 -06:00
Tomas Cohen Arazi acf2f642b4
Bug 39190: Rename 'sftp_servers' to 'file_transports'
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:21 -06:00
Martin Renvoize 3499e15287
Bug 39190: Add transport to test
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:21 -06:00
Martin Renvoize df10cb02d4
Bug 39190: Update API's to reference new classes
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:20 -06:00
Martin Renvoize 9f8b5ed883
Bug 39190: Redirect Schema to new classes
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:20 -06:00
Martin Renvoize c4d4c94567
Bug 39190: Remove replaced test_connection
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:19 -06:00
Martin Renvoize f92a1b8e14
Bug 39190: Remove test routine from API
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-19 13:23:19 -06:00