Koha-clms/debian
Chloé Zermatten d2c575a93d
Bug 10190: Complete Vue.js rewrite of Circulation Triggers administration interface
This patch introduces a modern Vue.js-based interface for managing circulation triggers (overdue notice/status triggers), replacing the legacy Tools-based interface with a more intuitive, feature-rich administration page.

New Features

Enhanced Visibility & Navigation
- Exhaustive effective rule lists showing all rules that apply to each context
- Toggle between "all exhaustive rules" and "explicitly set rules" views
- Advanced filtering by patron category and/or item type
- Clear display of fallback/default rules for each context

Rule Management Actions
- Delete triggers (last trigger in a sequence for any given library)
- Reset entire rule sets for a given context (with safeguards)
- Edit existing triggers with improved context awareness
- Add new triggers with intelligent delay constraints

Improved User Experience
- Multi-step form wizard with clear workflow progression
- Context-aware letter template filtering (only shows applicable templates)
- Placeholder values showing fallback rules when clearing inputs
- Dynamic min/max constraints for delay values based on neighboring triggers
- Real-time form validation and feedback
- Partial page reloads (only reload affected sections, not entire page)
- Specific loading messages for different operations

Technical Improvements
- Centralized Vuex store for state management
- Reusable CirculationTriggersForm component
- API clients for libraries, circulation rules, item types, and patron categories
- Consistent async/await pattern throughout
- Separation of repositories, utilities, and services
- Improved naming consistency and code maintainability
- "Dumb" TriggersTable component for better separation of concerns

Test Plan

Prerequisites
1. Log in to staff interface with appropriate permissions (tools_edit_notice_status_triggers)
2. Ensure you have test data: multiple libraries, patron categories, item types, and notice templates
3. Navigate to Administration > Circulation triggers (new interface)

Part 1: Basic Navigation & Interface
1. Verify the new "Circulation triggers" link appears in Administration home under the Circulation section
2. Access the new interface and confirm it loads successfully
3. Verify the default view shows either "All libraries" or your logged-in library based on DefaultToLoggedInLibraryOverdueTriggers system preference
4. Confirm the interface displays a list of triggers organized by context (library/patron category/item type combinations)

Part 2: Viewing and Filtering Rules
1. Toggle between "All exhaustive rules" and "Explicitly set rules" views
  - Verify "All exhaustive rules" shows inherited/fallback rules
  - Verify "Explicitly set rules" shows only rules you've specifically configured
2. Test the patron category filter:
  - Select a specific patron category
  - Confirm only rules for that category are displayed
3. Test the item type filter:
  - Select a specific item type
  - Confirm only rules for that item type are displayed
4. Test combined filters (patron category + item type simultaneously)
5. Clear filters and verify all rules display again

Part 3: Adding New Triggers
1. Click "Add trigger" button
2. Step 1 - Confirm Context:
  - Select Library (required)
  - Select Patron category (required)
  - Select Item type (required)
  - Click "Confirm context"
3. Step 2 - Review Existing Triggers:
  - Verify existing triggers for this context are displayed
  - Note the trigger numbers and delays
4. Step 3 - Configure New Trigger:
  - Enter a delay value (should be constrained by neighboring triggers)
  - Try entering an invalid delay (too low or too high) - verify validation
  - Set "Restricts checkouts" (Yes/No/Fallback to default)
  - Note the placeholder showing the fallback value
  - Select a letter template
  - Verify only templates for the selected library context appear
  - Set "Debarring" options if desired
  - Select "Charged notice fees" if applicable
5. Submit the form
6. Verify the new trigger appears in the list without a full page reload
7. Verify success message is displayed

Part 4: Editing Existing Triggers
1. Locate an existing trigger in the list
2. Click the edit icon/button
3. Verify the form pre-populates with existing values
4. Test delay modification:
  - Try changing the delay within valid bounds - should succeed
  - Try changing delay beyond neighboring triggers - should show validation error
  - Use the increment/decrement buttons to adjust delay
5. Test clearing values:
  - Clear a field (e.g., delay or restrict checkouts)
  - Verify placeholder shows the fallback/default value
  - Submit with cleared value - should save as null and inherit fallback
6. Change the letter template to a different valid template
7. Submit changes
8. Verify the trigger updates in the list without full page reload
9. Verify the changes persist after refreshing the page

Part 5: Deleting Triggers
1. Identify a trigger that is the last in its sequence
2. Click the delete button/icon
3. Verify a confirmation dialog appears
4. Confirm deletion
5. Verify the trigger is removed from the list without page reload
6. Verify the deletion persists after page refresh
7. Test delete constraints:
  - Try to delete a trigger that's not the last in sequence
  - Verify appropriate error/warning message

Part 6: Resetting Rule Sets
1. Locate a context with explicitly set rules (not just inherited)
2. Ensure this is not the only rule set for this trigger sequence
3. Click the "Reset" button for that context
4. Verify confirmation dialog explains what will be reset
5. Confirm the reset
6. Verify the explicit rules are removed and context now shows inherited rules
7. Verify changes persist after page refresh
8. Test reset constraints:
  - Try to reset when it would leave no rules for that trigger
  - Verify appropriate warning/prevention

Part 7: Context-Specific Behavior
1. Test library-specific letter filtering:
  - Create/edit a trigger for a specific library
  - Verify only letter templates with matching branchcode or default templates appear
  - Switch to a different library context
  - Verify the letter list updates accordingly
2. Test default rules:
  - View rules for "All libraries" / "All patron categories" / "All item types"
  - Verify these are labeled as "Default rule for [context]"
  - Confirm these serve as fallback for more specific rules
3. Test DefaultToLoggedInLibraryOverdueTriggers preference:
  - Set preference to "Yes"
  - Reload circulation triggers page
  - Verify it defaults to your logged-in library
  - Set preference to "No"
  - Verify it defaults to "All libraries"

Part 8: Form Workflow & Validation
1. Test required fields:
  - Try submitting add/edit form without selecting library - should fail
  - Try submitting without patron category - should fail
  - Try submitting without item type - should fail
2. Test stepper navigation:
  - Start adding a trigger
  - Verify you must confirm context before proceeding
  - Verify you see existing triggers before editing/adding
  - Verify trigger form only appears after context confirmation
3. Test cancellation:
  - Start adding/editing a trigger
  - Click Cancel
  - Verify you return to the list without changes
  - Verify no partial data was saved

Part 9: Loading States & Messages
1. On slow connections or with many rules:
  - Verify "Loading context..." appears while fetching context data
  - Verify "Loading rule set information..." appears while fetching rules
  - Verify section-specific loading messages appear during updates
2. After form submission:
  - Verify appropriate success/error messages display
  - Verify loading indicators during async operations

Part 10: Permissions
1. Log in as a user without tools_edit_notice_status_triggers permission
2. Verify the "Circulation triggers" link does not appear in Administration
3. Try accessing /cgi-bin/koha/admin/circulation_triggers directly
4. Verify access is denied

Part 11: Data Integrity & Persistence
1. Create a complex set of rules with multiple triggers across different contexts
2. Refresh the page and verify all rules persist
3. Restart the Koha services
4. Verify all rules still display correctly
5. Check the database circulation_rules table:
  - Verify rules are stored with correct rule_name pattern (overdue_1_delay, etc.)
  - Verify null values are properly stored for inheritance
  - Verify the overdue_X_has_rules rule kind is present

Part 12: Edge Cases
1. Test with no existing triggers - verify empty state message
2. Test with maximum trigger sequences (e.g., trigger 1, 2, 3)
3. Test rapid successive edits
4. Test with special characters in letter template names
5. Test browser back/forward buttons during form workflow

Part 13: Comparison with Legacy Interface
1. Access the old interface if still available (via Tools menu)
2. Create a trigger using the new interface
3. Verify it appears correctly in the old interface (if applicable)
4. Create a trigger using the old interface (if still available)
5. Verify it appears correctly in the new interface

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-10 14:24:25 +00:00
..
docs Bug 32736: Add --all-queues switch to koha-worker 2026-01-12 10:26:06 -07:00
scripts Bug 43159: Restore localisation of PERL5LIB and KOHA_HOME 2026-07-31 13:40:33 +00:00
source Bug 32994: Remove compiled files from src (2) 2023-02-22 10:03:25 -03:00
templates Bug 10190: Complete Vue.js rewrite of Circulation Triggers administration interface 2026-09-10 14:24:25 +00:00
README.build
…
bd-to-depends
…
build-git-snapshot Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
changelog Update debian/changelog file: 22.12.00-3 2023-02-20 09:44:12 -03:00
clean Bug 32994: Remove compiled files from src (2) 2023-02-22 10:03:25 -03:00
compat
…
control Bug 42087: Add dependency to debian/control 2026-06-26 11:56:55 +00:00
control.in Bug 25691: Replace link to non-existing README with wiki link 2024-01-16 12:06:08 +01:00
copyright Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-common.README.Debian
…
koha-common.bash-completion Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-common.config Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-common.cron.d
…
koha-common.cron.daily Bug 23260: Add cronjob anonymize_last_borrowers.pl 2026-03-05 08:33:46 -07:00
koha-common.cron.hourly Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-common.cron.monthly Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-common.default Bug 36550: allow defaults to be defined for koha-elasticsearch 2026-04-15 11:37:17 -06:00
koha-common.dirs
…
koha-common.docs Bug 35713: Remove outdated debian/docs/LEEME.Debian file 2024-01-11 12:10:45 +01:00
koha-common.init Bug 33108: (follow-up) Don't let restart die if ES indexer not running 2023-03-20 09:39:48 -03:00
koha-common.install Bug 33108: koha-es-indexer added 2023-03-20 09:39:45 -03:00
koha-common.links
…
koha-common.logrotate
…
koha-common.postinst Bug 36954: (follow-up) Return to the two logfiles pattern 2025-02-18 10:55:27 +01:00
koha-common.preinst Bug 25485: Remove tiny_mce symlink during pre install of deb package 2020-05-20 09:15:13 +01:00
koha-common.service Bug 33371: Add [Install] section to koha-common.service 2023-06-01 11:55:28 -03:00
koha-common.templates
…
koha-core.bash-completion Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-core.config Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha-core.default Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-core.dirs Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-core.docs Bug 35713: Remove outdated debian/docs/LEEME.Debian file 2024-01-11 12:10:45 +01:00
koha-core.init Bug 32922: (follow-up) Fix two additional occurences 2023-02-20 09:44:07 -03:00
koha-core.install Bug 33108: koha-es-indexer added 2023-03-20 09:39:45 -03:00
koha-core.links Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-core.logrotate Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-core.postinst Bug 36954: (follow-up) Return to the two logfiles pattern 2025-02-18 10:55:27 +01:00
koha-core.preinst Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-core.templates Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-full.postinst Bug 26672: Add additional koha-core and koha-full files to ./debian 2020-11-25 16:18:03 +01:00
koha-post-install-setup Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
koha.README.Debian
…
koha.apache-ports
…
koha.config
…
koha.dirs
…
koha.install
…
koha.postinst Bug 25691: Replace link to non-existing README with wiki link 2024-01-16 12:06:08 +01:00
koha.postrm
…
koha.prerm
…
list-deps Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
rules Bug 33168: (follow-up) Swap spaces for tabs 2023-04-04 11:26:20 +02:00
unavailable.html
…
update-control
…

README.build

In order to build .deb packages, following debian packages need to be present
(installed): 
devscripts
pbuilder
dh-make
fakeroot

As root (or sudo) execute:
pbuilder create

Executing build-git-snapshot without any arguments will leave package and the
rest in some pbuilder dir, eg. /var/cache/pbuilder/result It is highly
recommended that --buildresult option is used.