Commit Graph

9315 Commits

Author SHA1 Message Date
David Cook 68710e3e4c
Bug 38997: Remove outdated developer doc
This change removes a line in the developer doc which is no
longer relevant.

There's not really much to test here.

Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a6713d8849)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:42:37 +02:00
Baptiste Wojtkowski 404280c868
Bug 38619: UNIMARC prices should also be extracted from 071d
When adding a document that does not use 010d as price document, but 071d, the price is not imported from koha since it only checks 010d and 345d.

To reproduce:
1 - Create a Koha item, make sure there is neither 010d or 345d
2 - Add a 071d and fill a price
3 - Export the item as marcxml
4 - If you do not have one: in acquisition, create a vendor, a basket associated to this vendor, and a line associated to this vendor
5 - Add a line to any open basket, select: import "from a new file" and
  select the exported marcxml -> The price in 071 is not imported
6 - Apply patch
7 - Repeat 5 -> the price is properly imported

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 1cb2f97e8c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:42:36 +02:00
Lucas Gass 4a55f34dac
Bug 37883: (follow-up) Increment counts correctly
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d6883d9e3c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:21 +02:00
Lucas Gass 78f09d87bb
Bug 37883: Add logged in branch available, other, and onloan counts
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0a22703807)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:10 +02:00
Jonathan Druart 5d5ccb8073
Bug 40405: Set decreaseLoanHighHolds\* to 0
When reviewing the different sysprefs that had "NULL" as default, I
only found those 2 occurrences that could be problematic. I think we
should default to 0 here.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ca6cbc3cf9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:09 +02:00
Lucas Gass c6986364ef
Bug 23010: Handle error in C4/Items.pm using try/catch
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 316f8bc4b8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:05 +02:00
Lisette Scheer 642802d8cd
Bug 40620: Holds Queue will assign to the lowest item number if multiple branches have the same transport cost
To Test:
Before applying:
1. Turn on the UseTransportCostMatrix system preference
2. Create holds on a record with multiple items. (I used Lanark in KTD)
3. Set the item location to all be the same (I used MID)
4. Set the holds to pickup at Centerville, Fairfield, and Pleasant Valley
5. Set the transport cost matrix to
Centerville\fairfield 1
Centerville\Midway 1
Fairfield\Centerville 1
Fairfield\Midway 1
Midway\Centerville 1
Midway\Fairfield 1
Midway\Pleasant Valley 4

6. Build the holds queue (either turn on realtime hold queue and then edit the bib to update or run the cron on the command line)
7. Run a report: select * from hold_fill_targets where biblionumber=9 order by borrowernumber;
8. Rebuild the hold queue
9. Run the report again, the results should be the same.

10. Apply the patch
11. Run the hold queue again
12. Observe the results should now be different.
13. Try a few more times and ensure the numbers are changing, create some more items at midway and try again to see more variety in numbers.

Signed-off-by: David Flater <flaterdavid@gmail.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5832521086)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-26 20:37:29 +02:00
Martin Renvoize dcd3bdbf28
Bug 40296: (follow-up) Fix booking patron ownership and cancellation logic
This follow-up addresses critical issues in the initial implementation:

1. **Patron Ownership Check**: Only mark bookings as 'completed' when
   the patron checking out the item is the same patron who made the booking

2. **Smart Cancellation**: When another patron checks out an item that
   conflicts with an existing booking:
   - Cancel the booking only if checkout overlaps with actual booking period
   - Respect lead/trail periods - don't cancel if conflict is only during
     preparation periods (allows librarian override scenarios)

3. **Date Logic**: Proper overlap detection using start_date and end_date
   rather than periods extended by lead time

This prevents incorrect booking completion and handles librarian override
scenarios appropriately.

Test plan:
1. Apply previous patch and this follow-up
2. Enable bookings and create a bookable item

Test A - Patron's own booking completion:
3. Create booking for Patron A: start = today, end = +7 days
4. Check out item to Patron A (due date = +5 days)
5. Verify booking status = 'completed'

Test B - Lead period override scenario:
11. Return item, set bookings_lead_period circulation rule = 3 days
12. Create booking for Patron A: start = +5 days, end = +8 days
13. Check out item to Patron B (due date = +4 days) - conflicts with lead period
14. Override the booking conflict warning
15. Verify Patron A's booking status remains 'new' (not cancelled)
16. This respects librarian's decision that item will return in time

Test C - No booking scenario:
17. Return item, ensure no active bookings exist
18. Check out item to any patron
19. Verify checkout works normally without errors

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 2f849fd79c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-26 20:37:26 +02:00
Lucas Gass aeb8648326
Bug 40296: Mark booking as completed when issuing to booking patron
This patch adds logic to automatically mark a patron's booking as
'completed' when they check out the item they have booked.

When AddIssue is called, the system now:
- Checks if there's a conflicting booking for the checkout period
- Marks the booking status as 'completed' if found

This ensures booking status accurately reflects when items are
actually checked out to fulfill bookings.

Test plan:
1. Enable bookings system preference
2. Create a bookable item (set bookable = 1 in items table or via item editor)
3. Create a booking for a patron for that item with start date = today,
   end date = 7 days from now
4. Go to circulation and check out the item to the same patron who made
   the booking
5. Check the booking status in the database or via the bookings interface
6. Verify the booking status has changed from 'new' to 'completed'
7. Confirm the checkout was successful and shows normally in patron's
   checkouts list

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a8fd9734c6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-26 20:37:21 +02:00
Laura_Escamilla 3bcfcfbe0a
Bug 39427: Searching lists table by owner can only enter firstname or surname
To test:
1. Ensure that the virtual shelves system preference is enabled
2. Create one or two lists using a patron that has both a first and last name. You don’t have to add items to the list, the list itself is enough.
3. Under the Owner column in the Lists table, search using the patron’s first name. Note that the name is properly filtered.
4. Next, try to search by the last name. It is also properly filtered.
5. Now search using both the first name and the last name together. Note that the results come up empty.
6. Apply the patch.
7. Repeat steps 3–5. Note that the patron shows in the results with just the first name, the last name, and the full name.
7.1. Additionally, try searching with extra spaces (e.g., ' Firstname Surname ' or 'Firstname Surname'). Confirm that results are still correctly shown.
8. Run t/db_dependent/Virtualshelves.t
9. Sign off and have a great day! :D

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9d5d88b0eb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:26 +02:00
Tomas Cohen Arazi 4e1cd02932
Bug 40270: Fix uninitialized value warnings in SIP logging
The SIP server generates warnings when logging account information
for failed logins:

Use of uninitialized value $args[0] in sprintf at /kohadevbox/koha/C4/SIP/Sip.pm line 314
Use of uninitialized value $args[1] in sprintf at /kohadevbox/koha/C4/SIP/Sip.pm line 314

This occurs when $self->{account}->{id} or $self->{account}->{institution}
are undefined during failed authentication attempts.

This patch fixes the issue by:
1. Adding a safer sprintf implementation in siplog that handles undefined values
2. Providing default values for undefined account information in logging calls

To test:
1. Start SIP server
2. Attempt to connect with invalid credentials using sip_cli_emulator.pl:
   ./misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su invaliduser -sp wrongpass -l kohalibrary2 --patron koha -m patron_information
3. Check /var/log/koha/kohadev/sip-output.log
=> FAIL: 'Use of uninitialized value...' warns
4. Apply this patch
5. Repeat 2
=> SUCCESS: No "Use of uninitialized value" warnings appear
=> SUCCESS: Logging shows 'undef/undef' for failed logins instead of empty strings
6. Try a valid login
=> SUCCESS: Still works correctly for valid logins
7. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9cad25967d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:24 +02:00
Tomas Cohen Arazi cd92d22bc0
Bug 40037: (follow-up) Remove redundancy in `before_send_messages`
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 36df107fc9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:13 +02:00
Tomas Cohen Arazi 1a93081bf2
Bug 40037: Remove redundant check in `notices_content` hook handling
I reused an implemented hook in C4::Letters and overlooked the
redundancy in it. This patch clears that.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Plugins/Notices_content_hook.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass! No behavior change!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 17d02662c4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:12 +02:00
Baptiste Wojtkowski 55a98bf3ea
Bug 39180: (QA follow-up) Tidy
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 007d66e314)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:02 +02:00
Nick Clemens 5efebf194a
Bug 39180: Catch exception when updating patron lastseen date
This patch adds a catch during circulatoin actions and passes a message back to the caller

For checkouts and renewals we don't have a method for passing messages so we simply catch the exception
and warn - this seems reasonable, as we have now added a warning on the patron display that they are missing
a guarantor

To test:
 1 - Create a Child type  patron with no guarantor
 2 - Create a patron in a non-child category that can_be_guarantee with no guarantor
 3 - Check out an item to each patron above
 4 - Enable system preference 'ChildNeedsGuarantor' and TrackLastPatronActivityTriggers - select all
 5 - In mysql
    UPDATE borrowers SET datelastseen = '2025-01-01';
 6 - Restart all to clear cache (so update last seen will update)
 7 - Attempt to checkout a book to either patron - 500 error
 8 - Attempt to returnt he books the patrons have checked out - 500 error
 9 - Attempt to renew their items - 500 error
10 - Apply patches, restart all
11 - Repeat checkout, renewal, checkin
12 - On checkout and renewal there should be a warning on the patron page, but actions succeed with no additional problems
13 - On return you get a warning letting you know the action succeeded but there is still a problem to resolve

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 bd32425271)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:01 +02:00
Jonathan Druart 885c2c5662
Bug 40401: Implement Koha::Patron->is_anonymous
The first motivation of this patch is to remove the following warnings
from t/db_dependent/Auth.t:
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497

Actually a correct fix seems to add a new `is_anonymous` method to
Koha::Patron in order to remove the warnings from everywhere else.

Test plan:
Confirm that you cannot log in using the anonymous patron and that the 2
tests are passing
  prove t/db_dependent/Auth.t t/db_dependent/Koha/Patron.t

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 e49602a87e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 21:04:38 +02:00
Martin Renvoize 53488ff01c
Bug 36947: Add system preference for configurable locale-based facet sorting
This follow-up adds two major enhancements to the locale-based facet sorting
implementation:

1. **System Preference Integration**
   - Adds FacetSortingLocale system preference for configurable locale selection
   - Dynamically detects available system locales using Koha::I18N
   - Provides user-friendly dropdown with locale descriptions
   - Supports both Elasticsearch and Zebra search engines

2. **Zebra Search Engine Support**
   - Extends locale-based sorting to Zebra (in addition to existing Elasticsearch)
   - Implements _sort_facets_zebra() function in C4::Search
   - Maintains consistent Unicode-aware sorting behavior across search engines

Key Features:
- Dynamic locale detection via Koha::I18N::available_locales()
- Proper module architecture with comprehensive unit tests
- Clean fallback chain: preference → system LC_COLLATE → default
- Admin UI integration in System Preferences → I18N/L10N
- Universal facet sorting for international library systems

Test plan:
1. Apply patch and restart services
2. Install/run database update
3. Navigate to Administration → System Preferences → I18N/L10N
4. Verify "Sort facet names using" dropdown shows available system locales
5. Test facet sorting with different locales and both search engines
6. Run: prove t/Koha/I18N.t t/Koha/SearchEngine/Elasticsearch/Search.t t/db_dependent/Search_FacetSorting.t

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 146aca25f5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:42 +02:00
Jonathan Druart b8d54707ac
Bug 40388: Remove warning from t/Labels.t
Use of uninitialized value $cn_item in sprintf at /kohadevbox/koha/C4/ClassSplitRoutine/LCC.pm line 53.

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 9b0709fb47)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:31 +02:00
Jonathan Druart 686495ae04
Bug 40403: Remove warning from Circulation_holdsqueue.t
Use of uninitialized value in addition (+) at /kohadevbox/koha/C4/Biblio.pm line 3049.

The context is:

3045     my $current_issues = $biblioitem->totalissues // 0;
3046     if ( defined $value ) {
3047         $totalissues = $value;
3048     } else {
3049         $totalissues = $biblioitem->totalissues + $increase;
3050     }
3051     return 0 if $current_issues == $totalissues;    # No need to update if no changes

It feels correct to use $current_issues to suppress the warning

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 5661df2f70)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:29 +02:00
Matthias Le Gac d212c89d81
Bug 34157: Exporting labels as a barcode range can cause 500 error
This fixes the error 500 generated when using the label
generator if you use the "Bibliographic data precedes
barcode" layout type when printing a barcode range.

Test plan:
1. Set up information for testing:
   1.1 Create a new label layout:
       1.1.1 Cataloging > Tools > Label creator
       1.1.2 New > Label layout
       1.1.3 Add these details:
             - Layout name: BZ34157
             - Choose layout type: Bibliographic data precedes barcode
             - Select 'List fieds'
             - Data fields: add some text at the end
                title, author, isbn, issn, itemtype, barcode,
                itemcallnumber, 'Some text'
       1.1.3 Save
   1.2 Ranges of barcode numbers for testing:
       1.2.1 Where the numbers are not used in KTD, and are LOWER than
             the highest barcode number (39999000019193):
             500000 to 500100
       1.2.3 Where the numbers are not used in KTD, and are HIGHER than
             the highest barcode number (39999000019193):
             39999000020000 to 39999000020100
       1.2.2 Where the numbers are used in KTD:
             3999900000001 to 3999900001001
2. Print a barcode range using the ranges in 1.2:
   2.1 Cataloging > Tools > Label creator > Print barcode range
   2.2 Enter the barcode ranges
   2.3 Select a layout to be applied: BZ34157
   2.4 Export
   2.5 Click "Download as PDF"
   2.6 Results for all barcode ranges:
       ==> You get a page with "An error has occured! Error 500...".
3. Repeat step 2, but select the DEFAULT layout for 2.3:
   ==> Results for all barcode ranges: PDFs with barcode labels
       successfully generated
4. Apply the patches and restart everything (restart_all)
5. Repeat steps 2 and 3.
6. Results for all barcode ranges and the BZ34157 and DEFAULT layouts:
   ==> PDFs with barcode labels successfully generated

Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>
Signed-off-by: David Nind <david@davidnind.com>

Bug 34157: (Follow up) Removed the debugging data

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

Bug 34157: (follow-up) Tidiness fix

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Squashed
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0a51460e2c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:17 +02:00
Lari Strand d1f3ba0767
Bug 32934: Correctly honor the no block due date for SIP checkout messages
**Problem:**
When using SIP checkout messages with the "no block" flag, the specified due date
was being ignored. Instead of honoring the provided due date, the system would:
1. Use the due date as the transaction timestamp (incorrect behavior)
2. Calculate a new due date based on circulation rules
3. Return an empty due date field (AH) in the SIP response

This affected SIP2 integrations where external systems needed to specify exact
due dates for checkouts, particularly for offline circulation scenarios.

**Root Cause:**
The `ProcessOfflineIssue` function in C4::Circulation was only returning a
success/failure message, but the SIP checkout transaction needed access to the
resulting checkout object to properly set the due date. The SIP Transaction::Checkout
module was calling `ProcessOfflineIssue` but couldn't retrieve the checkout details
to populate the transaction's due date field.

**Solution:**
1. Modified `ProcessOfflineIssue` to return both the status message AND the checkout
   object: `return ( "Success.", $checkout );`
2. Updated `ProcessOfflineOperation` to handle the new return format by capturing
   only the message: `( $report ) = ProcessOfflineIssue( $operation );`
3. Modified SIP Transaction::Checkout to capture both return values and use the
   checkout object to set the proper due date via `duedatefromissue`
4. Fixed the timestamp parameter to use `dt_from_string` instead of the due date

**Test Plan:**
1. **Unit Tests:**
   - Run `prove t/db_dependent/Circulation/OfflineCirculation.t` to verify
     ProcessOfflineIssue returns checkout object and respects due_date parameter
   - Run `prove t/db_dependent/SIP/Transaction.t` to verify SIP checkout honors
     no_block_due_date parameter

2. **Manual SIP Testing:**
   - Connect to SIP server via telnet on port 6001
   - Send checkout message with no block flag and specific due date:
     `111YN20250115    18000120241201    180001AP|AO|AC|AD|AB<barcode>|AA<cardnumber>|`
   - Verify response contains correct due date in AH field
   - Verify checkout record in database has the specified due date

3. **Regression Testing:**
   - Verify normal SIP checkouts (without no block) still work correctly
   - Verify offline circulation operations continue to function
   - Verify ProcessOfflineOperation still processes queued operations correctly

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
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>
(cherry picked from commit 4d069e5006)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:12 +02:00
Fridolin Somers 8854037fbd
Bug 40277: Remove warn in C4::Koha::GetAuthorisedValues()
When using the OPAC and you are not logged in, there are warnings
in the logs:
[WARN] Use of uninitialized value $branch_limit in concatenation (.) or string

It comes from C4::Koha::GetAuthorisedValues() :
     my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
     my $cache_key    = "AuthorisedValues-$category-$opac-$branch_limit";

C4::Context->userenv->{"branch"} can be undef

The patch fixes using C4::Context::mybranch().

Test plan:
1. Set the OpacAdvancedSearchTypes system preference to something
   other than "itemtypes", for example "loc".
2. Go to OPAC without logging in, and perform a search.
3. Check the /var/log/koha/kohadev/plack-opac-error.log and note
   the warnings in the log:
   [WARN] Use of uninitialized value $branch_limit in concatenation (.) or ...
   (Alternative, tail the logs: tail -f /var/log/koha/kohadev/*.log
4. Apply the patch.
5. Repeat step 2 and check that there are no longer any warnings.
6. Sign off.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d60deb348c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:31 +02:00
Martin Renvoize a5949e7575
Bug 37305: Remove C4::Biblio::prepare_host_field
This patch updates the only use of prepare_host_field to use the well
tested Koha::Biblio->generate_marc_host_field method instead and then
removes the aforementioned prepare_host_field method from C4::Biblio.

Test plan
1) Ensure the "enhanced workflow" for creating analytics still functions
   as expected.

Sponsored-by: Open Fifth <https://openfifth.co.uk>
Signed-off-by: Heather Hernandez <flyingendpaper@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3e627d7a77)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:29 +02:00
Emmi Takkinen a57bd07127
Bug 34776: Add unit tests for sub restore_form_values
Test that input values don't change when send to the
sub restore_form_values.

To test prove t/Form_MessagingPreferences.t

Sponsored-by: Koha-Suomi Oy
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 2c4a89801e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:22 +02:00
Emmi Takkinen 8d496f1bed
Bug 34776: Restore patron messaging preferences if error occurs during new account creation
If error occurs while creating a new patron messaging
preferences are either lost or reseted as default
fro patron category. This patch adds new method
restore_form_values to restore already added messaging
preferences.

To test:
1. Enable syspref EnhancedMessagingPreferences.
2. Create a new patron but cause an error to prevent it from
saving (e.g. add wrong age).
3. Add messaging preferences for patron (if there are default
preferences, add also new ones or remove defaults).
4. Attempt to save.
=> Note that messaging preferences were lost and you need to
readd them.
5. Apply this patch.
6. Repeat steps from 2 to 4.
=> Note that messaging preferences which you added are kept
even if error occurs.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
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 8ed31509ae)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:21 +02:00
Martin Renvoize 1ab7ccde18
Bug 40079: (follow-up) Improve test coverage and fix undef handling
This patch modernizes the Scrubber.t unit test with comprehensive
coverage following Koha best practices:

- Uses subtest structure for logical grouping
- Tests all scrubber types (default, comment, note)
- Includes security testing for XSS prevention
- Covers edge cases and error handling
- Tests new list elements added in previous commits

Also fixes C4::Scrubber to handle undef parameters cleanly by
treating them as 'default' type instead of generating warnings.

Test plan:
1. Run prove t/Scrubber.t
2. Verify all tests pass without warnings
3. Confirm comprehensive coverage of module functionality

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 21f3340442)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:17 +02:00
Martin Renvoize 421968355e
Bug 40079: (follow-up) Add dl, dt, dd tags to notes profile scrubber
Adds support for HTML description list elements (dl, dt, dd) to the
'note' profile in the HTML scrubber configuration. This allows
librarians to use description lists in note fields for better
structured content presentation.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9ef8f098d8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:16 +02:00
Martin Renvoize fb2899f311
Bug 40079: Add ul/ol and li to allowed tags in notes profile
This patch add the unordered list, ordered list and list item html tags
to the list of allowed tags in C4::Scrubber.

Test plan:
1) Add a course reserve and include the following in the public note
   field:
   <ul>
     <li>First item</li>
     <li>Second item</li>
   </ul>
2) View the course details page and note "First item Second item" all
   appears on the same line (the ul and li tags have been stripped)
3) View the course reserves page and note the same issue in the public
   notes field of the table display
4) Apply this patch
5) Repeat 2 and 3 and note you now have a bullet pointed list displayed
   in both places
6) The display of the note on the details page may look mis-aligned..
   that will be dealt with on it's own bug

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 ddad4e81a2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-10 22:47:16 +02:00
Tomas Cohen Arazi be076f254f
Bug 40055: Make MoveReserve be passed objects instead of ids
The `MoveReserve` method is called once, in `AddIssue`. The latter has the related `Koha::Item` object already fetched from the DB, but it passed the `itemnumber` which is used by `MoveReserve` to fetch the item from the DB. This should not happen.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Reserves* \
           t/db_dependent/Koha/Hold* \
           t/db_dependent/Hold* \
           t/db_dependent/Circulation*
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1886165eae)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-24 11:30:06 +02:00
Lisette Scheer 64e37b6e1f
Bug 36020: Port default recall notices to Template Toolkit
The following notices relating to recalls all need to be updated to use Template Toolkit syntax:

RETURN_RECALLED_ITEM
PICKUP_RECALLED_ITEM
RECALL_REQUESTER_DET

To test:
1) Observe the default notice contains <<>> tags
2) Apply the patch
3) reset_all
4) Check that the notice is now all in template toolkit [%  %] tags with html selected
5) Enable recalls
6) Enable SMS
7) Check an item out to a patron
8) Make sure the patron has a primary email, sms, and recall notices enabled
9) Make sure a secondary patron has a primary email, sms, and recall notices enabled
10) Generate a recall on the checked out item for the second patron
11) Check the first patron's notices tab to confirm the return recalled item notice generated properly.
12) Check the item back in and generate the recall slip and confirm it generated correctly.
13) Check the second patron's notices tab to confirm the pickup recalled item notice generated properly.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 98c0cf2648)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-24 11:30:05 +02:00
Marcel de Rooy 4efb86aec8
Bug 40119: (QA follow-up) Small additional comment
The reference to this bug report may be helpful to understand
later why we did so.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 01526ef545)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:48 +02:00
Janusz Kaczmarek ba31b8cc35
Bug 40119: Merge should not leave empty 6XX subfield $2 (MARC 21)
Currently, when removing 040 $f from authority record with 008/11 =
'z' (MARC 21), merge function removes the content of $2 subfield in
linked 6XX fields, leaving the 6XX $2 subfield empty.  This is not
correct.  We should not have empty subfields in a MARC record.

Instead, the old content of the $2 subfield should be retained (if
auth 008/11 is still = 'z').

Test plan:
==========
1. Have an authority record with 008/11 = 'z' and 040 $f = 'whatever'.
2. Link the record to a bibliographic 6XX.
3. Edit the authority record, removing 040 $f.
4. Go to bibliographic record and in modal "MARC preview" from Normal
   view notice that 6XX $2 exists but is empty. This is wrong.
5. Apply the patch ; restart all.
6. Repeat p. 1.-4. Note that the content of 6XX $2 has not been
   removed.

Sponsored-by: Ignatianum University in Cracow
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 bd43ebdc5e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:47 +02:00
Tomas Cohen Arazi 036d940d54
Bug 39911: Remove redundant warn
Following the original test plan you notice, `THIS IS A TEST` is printed
twice:

* In the logs.
* In STDERR for the SIP server.

The latter is redundant, and also problematic for
`xt/author/pod_coverage.t` which fails the `no warnings` tests because
of that.

To test:
1. Run:
   $ ktd --shell
  k$ prove xt/author/pod_coverage.t
=> FAIL: Scary errors, lots of them
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Follow the original bug test plan
=> SUCCESS: There's `THIS IS A TEST` in the logs, which was the author's
goal in the first place.
5. Sign off :-D
6. Visit bug 40144 :-P

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9a4fd4facb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:47 +02:00
Kyle M Hall 90aca69657
Bug 39911: Add POD
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 702d1d2792)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:46 +02:00
Kyle M Hall 7c06904612
Bug 39911: Trap DIE signals in SIP server
At some point our SIP server stopped logging fatal errors to either logs or standard error. We should restore this vital functionality.

Test Plan:
1) Apply the first patch which will cause the patron information request
   to fail
2) Stop the SIP server
3) Start it again with: perl /kohadevbox/koha/C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
4) Trigger the failure with the following command:
   ./misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l MPL --patron koha -m patron_information
5) Note "THIS IS A TEST" is not found in logs or stderr
6) Apply the second patch
7) Repeat steps 2-4
8) Note the error message is now visible from stderr at the command line
   and also in the SIP log

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f214db14dd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:42 +02:00
David Cook f72d9f2962
Bug 40087: Remove "tag" and "staff" scrubber profiles
This patch removes unused "tag" and "staff" scrubber profiles.

Test plan:
0. Apply the patch
1. prove t/Koha/Plugins/HtmlScrubber.t
2. prove t/Scrubber.t
3. Grep around the code for C4::Scrubber and make sure "tag"
and "staff" aren't used as arguments for C4::Scrubber

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 e846abeeb7)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:41 +02:00
Tomas Cohen Arazi 3284f58e95
Bug 40034: Only check notforloan on itemtype if it exists
This patch makes the code in `CheckReserves` survive the non-existence
of the referenced item type in the `items` table for the passed item.

To test:
1. Apply the regression tests
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Reserves.t
=> FAIL: Tests explode like this:

```
Can't call method "notforloan" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 870.
```

3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 854783c836)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:34 +02:00
Nick Clemens 812cca9610
Bug 39558: Update biblio and biblioitems timestamps explicitly
This patch simply adds 'timestamp = current_timestamp()' to the SQL statements
run when editing a biblio. This ensures the tables timestamps are kept in sync

To test:
1 - Choose a biblio in the database and make an update to a 650 field
2 - Check the timestamps in MySQL:
    SELECT biblio.timestamp, biblioitems.timestamp, biblio_metadata.timestamp FROM biblio JOIN biblioitems USING (biblionumber) JOIN biblio_metadata USING (biblionumber) WHERE biblionumber=9;
3 - Note the timestamps
4 - Edit the same 650 again
5 - Check the timestamps and note that the biblio_metadata is updated, but the others are not
6 - Apply patch, restart all
7 - Update the 650 again
8 - Check the timestamps, all are updated!
9 - Sign off

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 0aa820de32)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-17 21:43:04 +02:00
Jonathan Druart 83a96dd270
Bug 39834: Replace some tabs with spaces
In order to remove false positives with the QA script we should replace some tabs with spaces.

There are more but I wanted to make sure no regression would be
introduced

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 492e6814a1)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-17 21:42:59 +02:00
Nick Clemens 9c81bdf529
Bug 38477: Only charge a new lost fine when the last patron to return the item matches the original fined patron
Set these sysprefs:
- FinesMode: Calculate and Charge
- WhenLostForgiveFine: Forgive
- WhenLostChargeReplacementFee: Charge

In circ rules:
- Have a rule that charges fines
- Set Refund lost item replacement fee to "Refund lost item charge and charge new overdue fine"

1 - Have/create item with replacement price
2 - Check item out to patron 1, due date in past
3 - Run fines.pl
4 - confirm fines on patron 1
5 - mark item lost
6 - confirm replacement cost generated and fine forgiven on patron 1
7 - check item in
8 - confirm replacement cost forgiven and new fine generated on patron 1
9 - check item out to patron 2, due date in future
10 - check item in
11 - mark item lost (no replacement fee generated because item is not checked out)
12 - in database, update date_due for checkout to patron 2, set to a date in the past
13 - check item in
14 - confirm patron 2 now has a fine
15 - Apply patches, restart all
16 - Repeat test plan with another item and confirm no fine is added for patron 2

Note: At step 12 we're pushing the date_due of the old issue into the past to make date_due<curdate(). In production, this comes up when there are days between steps 10 and 13.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 67c95addeb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-17 21:42:58 +02:00
David Cook ec01689dc0
Bug 39184: Turn off ABSOLUTE and EVAL_PERL for user-entered templates
This change turns off ABSOLUTE and EVAL_PERL for user-entered templates,
as these options can allow for arbitrary code execution and information
disclosure.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Create a Notice for Reports with a report like:
[% IF ( x == 1 ) %]
One
[% ELSE %]
Two
[% END %]
3. Run a report using this template
4. The report should show "Two"
5. Turn on CHECKOUT emails for a test patron
6. Perform a checkout
7. Look at the CHECKOUT email and note that the email body
is correctly generated

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Would be good to have this fixed as the default.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
The test plan should include PERL blocks or absolute paths! Tested those
instead. Testing x==1 seems irrelevant.
I tried:[% PERL %]print 1;[% END %] and [% INCLUDE /app/Dockerfile_1 %]
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-26 18:45:48 +02:00
Matthias Meusburger f51ec30438
Bug 38142: (follow-up) Choose language to report from authority to bibliographic record
- Rename LanguageToReportOnMerge system preference to LanguageToUseOnMerge
 - Use "use" instead of "report" in system preference description
 - Mark this feature as UNIMARC-only.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-20 15:15:33 +02:00
Tomas Cohen Arazi 83f8ba4eee
Bug 39870: Add `notices_content()` plugin hook
This patch adds a hook for adding information to notices context from
plugins.

The method is passed all the `GetPreparedLetter()` paramerters so it
gets all the context for calculating the values to pass the template.

The main target use for this hook is ILL, where we need to identify
candidate ILL requests related to the filled hold for printing the right
ILL-related message.

The implementation is generic so it can be used for any other use case.

To test:
1. Apply the unit tests
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Plugins/Notices_content_hook.t
=> FAIL: The hook is not implemented, the letter doesn't include
plugin-calculated data the tests expect.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-15 09:20:50 +02:00
Lisette Scheer df6af909b6
Bug 20747: (follow-up) Fix hold queue to work with LocalHoldPriority Group options
This fixes the holds queue and associated tests.
I also updated the sql file to fix an issue and the LocalHoldsPriority tests to fix a typo.

I'm working on final unit tests for the holds queue for all the options for QA but I wanted to get the queue changes ready for sign-off.

UPDATED TEST PLAN

This patch adds new options to the LocalHoldsPriority system preference to allow for the following options:
'None'                 the equivalent to 'Don't' pre-patch
'GiveLibrary'          the equivalent to 'Do' pre-patch
'GiveLibraryAndGroup'  Allows for checking the library first, then hold groups
'GiveGroup'            Allows to prioritize within a group without prioritizing any library first.

The included patches will update the preference in existing installations to maintain current behavior.

To Test:
BEFORE APPLYING THE PATCH

/Tip/
I kept the following tabs open:
-The holds screen (for suspending, checking order, etc)
-Check in screen (can ignore holds to keep them all in place)
-Holds to Pull with "All" for Libraries
-System Preferences

/Setup Groups and confirm current behavior/
1. Set the following system preferences:
-" LocalHoldsPriority " system preference to "Give"
-"LocalHoldsPriorityPatronControl" to "home library"
-"LocalHoldsPriorityItemControl" to "home library"
-"RealTimeHoldsQueue" to "Enable"

2. Create 2 Library Groups
  - Set them to be hold groups
  - I called mine group 1 & group 2
3. Add 2 libraries each to each group.
  - Group 1
    - Centerville
    - Fairfield
  - Group 2
    - Fairview
    - Franklin
4. Find a patron for each branch in the groups
  - Centerville - Changed 23529000035676 (Henry)
  - Fairfield - Changed 23529000050113 (Jordan)
  - Fairview - Changed 23529001000463 (Edna)
  - Franklin - 	23529000121682 (Nicole)
5. Find a record with at least 2 items
6. If needed change the home and holding libraries so you have at least one item for each hold group
  - Centerville - 39999000000252
  - Fairview - Changed 39999000000238
7. Place 2 record level holds for the record.
  - One for 23529000035676 (Henry) for pickup at Centerville (Priority 1)
  - One for 23529001000463 (Edna) for pickup at Fairview (Priority 2)
8. Check in 39999000000238. The hold popup should be for the second hold (Henry), not the first (Edna.) Ignore the hold
9. Edit the record then save to trigger real time queue update
10. On the Holds Queue (submit after each set of changes):
- Centerville should be for Henry
- Fairview should be for Edna

/apply patch and confirm behavior still works/
10. Apply patch
11. Rebuild the database then restart_all (in sandboxes it's an action, in ktd " dbic && updatedatabase && restart_all ")
12. Confirm that " LocalHoldsPriority " is set to "Give Library"
13. Repeat steps 8-10, behavior should be the same.

/ check library then library group setting/
14. Change " LocalHoldsPriority " to "Give library then library group"
15. Set the following record level holds for the record in the following order:
*You can add Jordan and Nicole's, then rearrange the order.
    - Pickup at Fairfield -  23529000050113 (Jordan)
    - Pickup at Franklin - 	23529000121682 (Nicole)
    - Pickup at Centerville - 23529000035676 (Henry)
    - Pickup at Fairview -  23529001000463 (Edna)
17. Check in 39999000000252 - should try and fill to Centerville - 23529000035676 (Henry)
17. Check in 39999000000238 - should try and fill to Fairview -  23529001000463 (Edna)
18. On the Hold Queue:
- Centerville should be for Henry
- Fairview should be for Edna
19. Suspend the hold for 23529001000463 (Edna)
20. Check in 39999000000238 should try and fill to 23529000121682 (Nicole) (ignore the hold)
21. On the Holds Queue:
- Centerville should be for Henry
- Fairview should be for Nicole

/ check library group setting /
22. Reset the holds to match step 15.
23. Change " LocalHoldsPriority " to "Give group"
24. Check in 39999000000252 - should try and fill to Fairfield (Jordan) (ignore the hold)
25. Check in 39999000000238 - should try and fill to Franklin (Nicole) (ignore the hold)
26. On the Holds Queue:
- Centerville should be for Jordan
- Fairview should be for Nicole

/check no priority /
27. Change " LocalHoldsPriority " to "Don't give"
28. Reset the holds to match step 15.
29. Check in 39999000000238 - Should fill to Fairfield (Jordan) (ignore the hold)
30. Check in 39999000000252 - Should fill to Fairfield hold (Jordan) (ignore the hold)
31. On the Holds Queue:
- Centerville should be for Jordan
- Fairview should be for Nicole

/Also check/
Item level holds behave as expected
Different combinations of LocalHoldsPriorityItemControl and LocalHoldsPriorityPatronControl

Sponsored by: Cape Libraries Automated Materials Sharing
Sponsored by: Northeast Kansas Library System (NEKLS)

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-15 08:34:20 +02:00
Lisette Scheer e061d0a718
Bug 20747: Allow LocalHoldsPriority to fill by hierarchical groups system rather than individual library
This patch adds new options to the LocalHoldsPriority system preference to allow for the following options:
'None'                 the equivalent to 'Don't' pre-patch
'GiveLibrary'          the equivalent to 'Do' pre-patch
'GiveLibraryAndGroup'  Allows for checking the library first, then hold groups
'GiveGroup'            Allows to prioritize within a group without prioritizing any library first.

The included patches will update the preference in existing installations to maintain current behavior.

To Test:
BEFORE APPLYING THE PATCH
/Setup Groups and confirm current behavior/
1. Set the " LocalHoldsPriority " system preference to "Give", "LocalHoldsPriorityPatronControl" to "home library" and "LocalHoldsPriorityItemControl" to "home library"
2. Create 2 Library hold Groups
  - I called mine group 1 & group 2
3. Add 2 libraries each to each group.
  - Group 1
    - Centerville
    - Fairfield
  - Group 2
    - Fairview
    - Franklin
4. Find a patron for each branch in the groups
  - Centerville - 23529000035676 (Henry)
  - Fairfield - Changed 23529000050113
  - Fairview - Changed 23529001000463 (Edna)
  - Franklin - 	23529000121682
5. Find a record with at least 2 items
6. If needed change the home and holding libraries so you have at least one item for each hold group
  - Centerville - 39999000000252
  - Fairview - Changed 39999000000238
7. Place 2 record level holds for the record.
  - One for 23529000035676 for pickup at Centerville (Priority 1)
  - One for 23529001000463 for pickup at fairview (Priority 2)
8. Check in 39999000000238. The hold popup should be for the second hold, not the first.

/apply patch and confirm behavior still works/
9. Apply patch
10. Rebuild the database then restart_all (in sandboxes it's an action, in ktd " dbic && updatedatabase && restart_all ")
11. Confirm that " LocalHoldsPriority " is set to "Give Library"
12. Repeat steps 7-8, behavior should be the same.

/ check library then library group setting/
13. Change " LocalHoldsPriority " to "Give library then library group"
14. Set the following record level holds for the record:
    - Pickup at Fairfield -  23529000050113
    - Pickup at Franklin - 	23529000121682
    - Pickup at Centerville - 23529000035676 (Henry)
    - Pickup at Fairview -  23529001000463 (Edna)
15. Check in 39999000000252 - should try and fill to Centerville - 23529000035676 (Henry)
16. Check in 39999000000238 - should try and fill to Fairview -  23529001000463 (Edna)
17. Cancel the hold for 23529001000463
18. Check in 39999000000238 should try and fill to 23529000121682

/ check library group setting /
19. Reset the holds to match step 14.
20. Check in 39999000000252 - should try and fill to Fairfield
21. Check in 39999000000238 - should try and fill to Franklin

/check no priority /
22. Reset the holds to match step 14.
23. Check in 39999000000238 - Should fill the Fairfield hold
24. Check in 39999000000252 - Should fill the Franklin hold

/Also check/
Item level holds behave as expected
Different combinations of LocalHoldsPriorityItemControl and LocalHoldsPriorityPatronControl

Sponsored by: Cape Libraries Automated Materials Sharing
Sponsored by: Northeast Kansas Library System (NEKLS)

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-15 08:34:18 +02:00
Nick Clemens 0049543314
Bug 39842: Populate current location for SIP item with holdingbranch
This patch simply adds the holdingbranch to the SIP item as current_location

To test:
1 - Find an item and check it in at a different location than its homebranch
2 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR -m item_information --item 39999000004151
3 - Note no AP field is returned
4 - Apply patch, restart all
5 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR -m item_information --item 39999000004151
6 - You see the current holdingbranch in the AP field
7 - Return the item to its homebranch
8 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR -m item_information --item 39999000004151
9 - Confirm home and holding branches are the same now

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-09 09:12:05 +02:00
Emmi Takkinen a2f190f01f
Bug 38356: (follow-up) Add code block to handle CURRENTISSUE message
Package C4::SIP::ILS::Transaction::Checkout was missing block to
handle new "CURRENTISSUE" message. This patch adds this block
so tests should no longer fail.

To test prove t/db_dependent/SIP/Message.t

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-08 11:49:13 +02:00
Nick Clemens 1df229719c
Bug 38650: Only fill title level holds, or holds on the exact item
We change the conditions for filling holds to require that either:
- the hold is title level
- the hold is on the exact item

To test:
 1 - Place a hold for patron A on item #1 of a record
 2 - Place a hold for patron B on item #2 of a record
 3 - Issue item #2 to patron A - their hold on item #1 is filled incorrectly, check the item in
 4 - Apply patch, restart all
 5 - Place hold for patron A on item #1
 6 - Issue item #2 to patron A - their hold on item #1 is not filled, check the item in
 7 - Cancel that hold
 8 - Place a title level hold for the record for patron A
 9 - Check item #1 in at a different branch and confirm transfer
 9 - Issue item #2 to patron A
10 - The hold is filled as title level, even though item #1 was selected for the hold, check the item in
11 - Place an item level hold for item #2 for patron A
12 - Issue item #2 to patron A, hold is filled

Signed-off-by: Stephanie Petruso <spetruso@aacpl.net>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-08 07:59:07 +02:00
Lucas Gass f79aec38b8
Bug 39603: Make sure authorised value category is ITEMTYPECAT
To test:
1. Add some AVs for ITEMTYPECAT and set some of your item types to be in that Search category. I made one called OTHER
2. Go to the OPAC advanced search page, the item types should be correctly displaying under ITEMTYPECAT with the correct description from ITEMTYPECAT.
3. Create a new AV called OTHER in a different category like 'ERM_AGREEMENT_CLOSURE_REASON'. Make the description something different like 'Wrong description'.
4. Now go back to the OPAC advanced search.
5. Notice your OTHER option now reads 'Wrong description'.
6. APPLY PATCH and restart_all
7. Try again, the OPAC descriptions should now be correct.

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-07 14:29:58 +02:00
Fridolin Somers 0a32b7371f
Bug 39735: Fix typo in system preference call 'OPACFineNoRenewalsIncludeCredit'
Typo in system preference call 'OPACFineNoRenewalsIncludeCredit'
=> 'OPACFineNoRenewalsIncludeCredits'

Test plan :
Run : prove t/db_dependent/Circulation.t
Run test plan of Bug 23293

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-07 14:29:53 +02:00