Bug 39864 - Cannot save automatic item modifications by age rules
Summary: Cannot save automatic item modifications by age rules
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Emily Lamancusa (emlam)
QA Contact: Testopia
URL:
Keywords: RM_priority
Depends on: 38714
Blocks:
  Show dependency treegraph
 
Reported: 2025-05-08 17:56 UTC by Emily Lamancusa (emlam)
Modified: 2025-05-09 13:23 UTC (History)
2 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39864: Move save button back into form (5.33 KB, patch)
2025-05-09 13:22 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Emily Lamancusa (emlam) 2025-05-08 17:56:05 UTC
To reproduce:
1. Go to Cataloging > Automatic item modifications by age
2. Click Edit rules
3. Click Add rule
4. Enter some values, such as:
    age -> 365
    age field -> items.dataaccessioned
    substitution -> items.withdrawn = 1
5. Click Save
--> Nothing happens, and the save button remains highlighted

Git bisect points to bug 38714
Comment 1 Emily Lamancusa (emlam) 2025-05-08 18:09:01 UTC
Ah, it's because there are two separate TT sections that check if op = edit_form, with the "save" button in the first section and the actual form fields in the second section. The opening <form> tag was in the first TT IF block, and the closing </form> tag was in the second TT IF block farther down the page. This is not allowed as of 38714, so the opening <form> tag was moved into the second TT IF block...which left the save button out of the form!

Hopefully this won't be too big of a refactor to fix...
Comment 2 Emily Lamancusa (emlam) 2025-05-09 13:22:28 UTC
Created attachment 182172 [details] [review]
Bug 39864: Move save button back into form

The save button for automatic item modification rules got moved outside
of the form during the refactor for bug 38714. This happened because
the form was spread between two separate IF blocks that checked the same
condition, which is no longer allowed as of 38714.

This patch consolidates the conditional blocks and moves the submit
button back inside its form.

To test:
1. Go to Cataloguing > Item modifications by age
2. Click Add Rules, and then Add Rule to create a new rule
3. Fill in some reasonable values, for example:
   Age in days: 365
   Age field: items.itemlost_on
   Substitutions: items.withdrawn = 1
4. Click save
--> Nothing happens!
5. Apply patch, refresh, the page, and fill values in again if needed
6. Click save again
--> The rule is saved!
7. Confirm the Edit rules, Add rule, and Cancel buttons still work
    i. Click Edit rules
    --> The rule you just created should now be editable
    ii. Click Add rule
    --> A new form for a second rule should be added to the page
    iii. Click Cancel
    --> The change is cancelled and the page returns to "List of rules"
        view