https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42432 Bug ID: 42432 Summary: "On hold due date" input on patron checkouts table is ignored when renewing Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com ## Description Bug 7088 introduced an **"On hold due date"** input in the patron checkouts table footer (file: `koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc`). The input is shown when `AllowRenewalOnHoldOverride` is enabled and the librarian ticks the renew checkbox on any row whose item is on hold for another patron. The intent is that renewals of on-hold items use the value from this input, while non-on-hold renewals use the ordinary "Renewal due date" input. Since Bug 36084 ("svc - renew", Feb 2024, commit `99d776f58e0`), which replaced the `svc/renew` endpoint with a REST API client call, the code that conditionally read the on-hold input was lost. The replaced snippet was: ```js // pre-Bug 36084 var dueDate = isOnReserve ? $("#newonholdduedate input").val() : $("#newduedate").val(); // post-Bug 36084 (current) var dueDate = $("#newduedate").val(); ``` at what is now `koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1041`. The `#newonholdduedate` input is still shown, still mirrored from `#newduedate`, and still flips the `onHoldDueDateSet` flag when edited â but its value is never attached to the `params` object posted to `POST /api/v1/circulation/checkouts/{id}/renewals`. A grep across `*.pl`, `*.pm`, `*.tt`, `*.inc`, `*.js`, `*.yaml` confirms that the form field name `newonholdduedate` (distinct from `renewonholdduedate` used by `circ/renew.pl`) has no consumer. The **Renew** page (`circ/renew.pl`, field `renewonholdduedate`) is unaffected and continues to work. ## Steps to reproduce 1. In a KTD environment, set `AllowRenewalOnHoldOverride = Allow`. 2. Check out item A to patron P1. 3. Place a hold on item A for patron P2. 4. Open P1's Patron details page and scroll to the **Checkouts** table. 5. Tick the **Renew** checkbox on the row for item A. Observe that the **"On hold due date"** input appears in the table footer. 6. In **"Renewal due date"** enter a date two weeks from now (say `2026-05-05`). 7. In **"On hold due date"** enter a clearly-distinct date one month from now (say `2026-05-20`). 8. Click **"Renew or check in selected items"**. 9. Inspect the resulting `issues.date_due` for item A, or observe the value now shown in the refreshed table. ## Expected behaviour `issues.date_due` equals `2026-05-20` (the "On hold due date" value), because item A is on hold. ## Actual behaviour `issues.date_due` equals `2026-05-05` (the "Renewal due date" value). The "On hold due date" value is silently discarded. ## Suggested fix In `koha-tmpl/intranet-tmpl/prog/js/checkouts.js`: - The `renew(item_id)` function (around line 1010) currently takes only the `item_id`. Inside it, look up whether the row is on hold by testing `$("#renew_" + item_id).is("[data-on-reserve]")` (the `data-on-reserve` attribute is already set on the checkbox by the table builder at around line 557). - Around line 1041, restore the conditional: ```js var isOnReserve = $("#renew_" + item_id).is("[data-on-reserve]"); var dueDate = isOnReserve ? $("#newonholdduedate input").val() : $("#newduedate").val(); ``` Keep the existing `if (dueDate && dueDate.length > 0) { params.date_due = dueDate; }` guard so blank values still fall through to the standard loan rule. ## Tests This bug should also introduce regression coverage. There is currently: - No Perl test that exercises `newonholdduedate` form submission. - No Cypress spec covering the on-hold branch of the checkouts-table renewal flow (which is what would have caught the regression in 2024). A Cypress spec under `t/cypress/integration/Circulation/` should: 1. Seed a patron with an on-hold checkout (use existing factories). 2. Visit the patron's checkouts page. 3. Tick the renew checkbox on the on-hold row. 4. Assert the "On hold due date" input is visible. 5. Set distinct dates in "Renewal due date" and "On hold due date". 6. Click "Renew or check in selected items". 7. Assert the refreshed row's displayed due date matches the "On hold due date" value, not the "Renewal due date" value. ## References - Bug 7088 â original feature (commit `c48af49ded4`, 2018) - Bug 36084 â regression point (commit `99d776f58e0`, 2024) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.