Bug 38387

Summary: Automatic item modification at checkin/checkout
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: CatalogingAssignee: Julian Maurice <julian.maurice>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: new feature    
Priority: P5 - low CC: kebliss, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16698
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 38387: Automatic item modification at checkin/checkout
Bug 38387: Automatic item modification at checkin/checkout
Bug 38387: Remove remaining references to deleted system preferences

Description Julian Maurice 2024-11-07 11:24:40 UTC
Same as UpdateLocationOnCheckin and UpdateLocationOnCheckout but more generic and with a UI
Comment 1 Julian Maurice 2024-11-07 11:26:50 UTC Comment hidden (obsolete)
Comment 2 Julian Maurice 2024-11-07 11:36:04 UTC
Created attachment 174117 [details] [review]
Bug 38387: Automatic item modification at checkin/checkout

This replaces system preferences UpdateItemLocationOnCheckin and
UpdateItemLocationOnCheckout by a new cataloguing tool

The new tool allows to modify any `items` column, based on "rules".
Each rule can have multiple conditions (or zero) and multiple
substitutions.
Conditions can be made on any `biblio`, `biblioitems` or `items` column.
The new value can be a fixed string (as with UpdateItemLocationOn*
sysprefs) or the value of another `items` column, using the syntax:
$items.<column> (for instance: $items.permanent_location)

The tool's UI is based on "automatic item modifications by age" so it
should feel very similar.

Test plan.
1. Set a value for UpdateItemLocationOnCheckin and
   UpdateItemLocationOnCheckout. They will be transferred to the new
   tool
2. Apply patch, run updatedatabase, update DBIC schema, restart
3. Go to "Cataloging > Item modifications by event"
4. Verify that UpdateItemLocationOn* sysprefs content has been
   transferred correctly:

   - If syspref content had a key '_ALL_', you should have only one rule
     with no conditions. Other keys are ignored. Otherwise, each
     key-value pair is transformed to a new rule with one condition
     ("items.location = <YAML key>") and one substitution
     ("items.location = <YAML value>")
   - The string '_BLANK_' is transformed to an empty string (''),
     whether it's a key or a value
   - The string '_PERM_' is transformed to '$items.permanent_location'
     when it's a value
   - For each created rule, another substitution is added
     ("items.permanent_location = <YAML value>") unless the value is
     'PROC' or 'CART'

    This should match the current behavior.
5. Add other rules if needed, check out/check in some items and see your
   modifications applied.
6. prove t/db_dependent/Koha/Item/trigger_automatic_modifications_by_event.t

Sponsored-by: Médiathèques Valence Romans Agglo
Comment 3 Julian Maurice 2024-11-07 12:34:32 UTC
Created attachment 174184 [details] [review]
Bug 38387: Remove remaining references to deleted system preferences

Namely, UpdateItemLocationOnCheckin and UpdateItemLocationOnCheckout