Koha-clms/t
Martin Renvoize 58d41bfedf
Bug 42608: Stop hold pickup expiration from week-jumping over closures
Koha::Hold::set_waiting calls Koha::Calendar::days_forward to derive the
holds-shelf expiration date when ExcludeHolidaysFromMaxPickUpDelay is on.
days_forward iterated next_open_days($dt, 1) ReservesMaxPickUpDelay times,
and next_open_days consults get_push_amt for every closed day it
encounters. Under useDaysMode=Dayweek, get_push_amt returns 7 for any
closure that is not a permanently closed weekday -- so an intermediate
Bank Holiday Monday inside the pickup window pushed the cursor a whole
week forward instead of one day, inflating the expiration by seven days.

Dayweek is a loan-due-date concept: it exists to keep a Friday-due loan
due on a Friday across closures. A patron does not pick a weekday for a
hold-shelf collection; staff set the expiration when they trap the item,
and the only thing that should drive it is how many open days the patron
should have to come and collect. days_forward is now decoupled from
useDaysMode and always counts forward one open day at a time, ignoring
closures without consuming them from the count.

next_open_days, prev_open_days, get_push_amt and addDays are unchanged --
loan due-date math keeps the existing Dayweek behaviour.

Test plan:
1. Inside KTD, run the updated unit tests:

     prove t/db_dependent/Calendar.t
     prove t/db_dependent/Hold.t

   Confirm both pass, including the new Bug 42608 sub-tests. These cover
   the full matrix of starting weekdays and useDaysMode values; the
   manual steps below are a single confirmatory pass through the UI.

2. Manual reproduction (UI only -- no database or CLI access needed):
   - Set sysprefs: useDaysMode=Dayweek, ReservesMaxPickUpDelay=6,
     ExcludeHolidaysFromMaxPickUpDelay=ON, ExpireReservesOnHolidays=ON.
   - Administration > Calendar: on a test branch, add one single
     (one-time) holiday -- not weekly/repeating -- on any weekday within
     the next 6 days that isn't already closed (e.g. the day after
     tomorrow, as long as it isn't a Sunday or other closed day). This
     one-off closure inside the pickup window is what triggers the bug.
   - Place a hold on an available item, then check the item in at that
     branch and confirm/trap it. This stamps waitingdate with today's
     date automatically -- no manual date entry required.
   - Check the hold's expiration date (Holds awaiting pickup list, or
     the patron's holds tab):
       Without the fix: expiration lands a full 7 days later than it
       should (today + 6 + 7), from the week-jump.
       With the fix: expiration is today + 6 open days, only skipping
       the one closed day.

3. Verify the existing Calendar mode behaviour is unchanged:
   - Switch useDaysMode to Calendar and repeat step 2 -- the same
     expected expiration date should apply.

4. Verify loan due-date behaviour is unchanged:
   - With useDaysMode=Dayweek, check out an item whose loan period would
     place its due date on the same closed day used in step 2. Confirm
     the due date still rolls forward by a whole week (the original
     Dayweek intent), proving this patch did not regress
     addDays/addDuration.

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Jackie Usher <jackie.usher@westsussex.gov.uk>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-24 11:48:37 +00:00
..
Acquisition
…
Biblio Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Budgets
…
C4/ClassSplitRoutine Bug 30233: (follow-up) Add tests for _apply_substitution and combined modifiers 2026-08-11 12:39:30 +00:00
External Bug 41479: Remove Baker & Taylor integration 2026-03-24 07:50:10 +01:00
Koha Bug 10190: (QA follow-up): fixes phase six 2026-09-21 16:07:44 +00:00
Number
…
SIP Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Search Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Serials Bug 41330: Unit tests 2026-03-09 17:06:49 -06:00
Template Bug 42136: Add tests 2026-04-28 15:48:21 -06:00
Test Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
cypress Bug 10190: (QA follow-up): fixes phase six 2026-09-21 16:07:44 +00:00
data Bug 41032: Fix Open Fifth missing in plugin repos config 2025-11-26 10:40:25 -07:00
db_dependent Bug 42608: Stop hold pickup expiration from week-jumping over closures 2026-09-24 11:48:37 +00:00
edi_testfiles Bug 30144: Add tests for EDIFACT servicing instruction handling 2026-08-28 16:36:24 +00:00
etc
…
lib Bug 41648: Validate plugin date metadata 2026-08-21 14:31:48 +00:00
mock_templates Bug 42684: Capitalization: No Barcode 2026-06-12 16:24:07 +00:00
00-check-atomic-updates.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
00-load.t Bug 42714: RM follow-up: Fix tests 2026-08-13 11:28:40 +00:00
00-merge-conflict-markers.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
00-testcritic.t
…
00-valid-xml.t Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
Auth.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
AuthoritiesMarc_MARC21.t Bug 41795: Fix failing test in UNIMARC instances 2026-05-01 11:04:33 -06:00
AuthoritiesMarc_UNIMARC.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Barcodes_EAN13.t
…
Barcodes_annual.t
…
Barcodes_hbyymmincr.t
…
Barcodes_incremental.t
…
Biblio.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Biblio2.t
…
Breeding.t Bug 40017: (follow-up) Update GNU license link 2025-10-22 07:42:53 -06:00
Budgets.t
…
Charset.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Circulation_barcodedecode.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ClassSortRoutine.t
…
ClassSortRoutine_Dewey.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
ClassSortRoutine_Generic.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
ClassSortRoutine_LCC.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
ClassSource.t
…
Context.t Bug 39337: Add is_opac_suppressed helper to C4::Context 2026-08-25 08:56:25 +00:00
Contract.t
…
CookieManager.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Creators.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
DateUtils.t
…
EdiInvoice.t
…
Edifact.t Bug 40383: Add unit tests for Koha::Edifact to_json method 2026-03-26 14:21:18 +01:00
Ediorder.t Bug 30144: (QA follow-up) Fix t/Ediorder.t for JSON servicing_instruction format 2026-09-09 12:07:21 +00:00
Ediordrsp.t
…
Form_MessagingPreferences.t Bug 43117: Restore use Test::NoWarnings 2026-09-01 15:42:02 +00:00
HtmlTags.t
…
ImportBatch.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Installer_PerlModules.t
…
ItemCirculationAlertPreference.t
…
Koha_MetadataRecord.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha_SearchEngine_Elasticsearch_Browse.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha_Template_Plugin_HtmlId.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha_Template_Plugin_Koha.t Bug 41107: (follow-up) Use Koha::Status in Koha::Template::Plugin::Koha 2026-03-23 09:33:54 +01:00
Koha_Util_FrameworkPlugin.t
…
Koha_Util_MARC.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha_XSLT_HTTPS.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Labels.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Labels_split_Regex.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Labels_split_ccn.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Labels_split_ddcn.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Labels_split_lccn.t Bug 40680: Fix t/Labels* 2025-12-01 08:34:00 -07:00
Languages.t Bug 39745: Replace more occurrences in selenium tests 2026-02-09 12:57:59 -07:00
Logger.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Members_Messaging.t
…
OpenLibrarySearch.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Output.t Bug 30261: Update unit tests 2026-03-20 11:54:32 +00:00
Output_JSONStream.t
…
Patroncards.t
…
Patroncards_Batch.t
…
Patroncards_Lib.t
…
Patroncards_Patroncard.t
…
Patroncards_Profile.t
…
Patroncards_Template.t
…
RecordProcessor.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Ris.t
…
SMS.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Scheduler.t
…
Scrubber.t Bug 40659: Change Scrubber profile name to opac_virtual_card 2026-04-23 16:04:11 -06:00
Search.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Search_PazPar2.t
…
SimpleMARC.t Bug 28915: Add control field support to Koha::SimpleMARC::update_field() 2026-06-15 15:24:05 +00:00
SuggestionEngine.t
…
SuggestionEngine_AuthorityFile.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
TmplToken.t
…
Token.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
template_filters.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
timezones.t
…