Bug 39522

Summary: Add hooks to allow 'Valuebuilder' plugins to be installable
Product: Koha Reporter: Jacob O'Mara <jacob.omara>
Component: Plugin architectureAssignee: Jacob O'Mara <jacob.omara>
Status: Failed QA --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, julian.maurice, kyle, lisette, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 39522: Allow Valuebuilders to be installable as plugins
Bug 39522: Add filtering to the plugin home page for valuebuilders
Mark Hofstetter will be following up with unit tests as we worked on this together.
Bug 39522: Add filtering to the plugin home page for valuebuilders
Mark Hofstetter will be following up with unit tests as we worked on this together.
Bug 39522: Add filtering to the plugin home page for valuebuilders
Bug 39522: Allow Valuebuilders to be installable as plugins
Bug 39522: Add filtering to the plugin home page for valuebuilders
Bug 39522: Add unit tests for valuebuilder plugin hooks

Description Jacob O'Mara 2025-04-02 09:35:54 UTC
We should allow the cataloguing or 'valuebuilder' plugins to be installable with the standard plugin architecture.
Comment 1 Jacob O'Mara 2025-04-02 10:12:24 UTC Comment hidden (obsolete)
Comment 2 Jacob O'Mara 2025-04-02 10:12:27 UTC Comment hidden (obsolete)
Comment 3 Jacob O'Mara 2025-04-02 11:46:41 UTC Comment hidden (obsolete)
Comment 4 Jacob O'Mara 2025-04-02 11:46:44 UTC Comment hidden (obsolete)
Comment 5 Jacob O'Mara 2025-04-02 13:07:26 UTC Comment hidden (obsolete)
Comment 6 Jacob O'Mara 2025-04-02 13:07:28 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize (ashimema) 2025-06-24 15:35:29 UTC
Created attachment 183467 [details] [review]
Bug 39522: Allow Valuebuilders to be installable as plugins

This patch adds hooks to allow 'Valuebuilder' plugins to be installable
using the standard plugin architecture for Koha. This enables cataloguing
plugins to be dynamically installed, enabled, and disabled through the
plugin system rather than being hardcoded framework components.

Test plan:
1. Install the example valuebuilder plugin from GitHub
   (https://github.com/Jacobomara901/koha-plugin-value-builder)
2. Go to Administration > Plugins
3. Verify the valuebuilder plugin appears in the plugins list
4. Enable/disable the plugin and confirm the custom valuebuilder
   appears/disappears in the framework configuration
5. Assign the custom valuebuilder to a MARC subfield in the
   bibliographic framework
6. Create/edit a bibliographic record and verify the valuebuilder
   button appears next to the configured subfield
7. Click the valuebuilder button and confirm it functions correctly
8. Disable the plugin and verify the valuebuilder button disappears
9. Re-enable the plugin and confirm functionality is restored
10. Uninstall the plugin and verify it's completely removed

Co-authored-by: Mark Hofstetter <koha@trust-box.at>
Comment 8 Martin Renvoize (ashimema) 2025-06-24 15:35:32 UTC
Created attachment 183468 [details] [review]
Bug 39522: Add filtering to the plugin home page for valuebuilders

This patch adds filtering functionality to the plugin home page to allow
valuebuilder plugins to be displayed alongside other plugins. This ensures
that valuebuilder plugins are properly integrated into the plugin management
interface and can be easily identified and managed by administrators.

Test plan:
1. Install a valuebuilder plugin (following the test plan from the
   previous patch)
2. Go to Administration > Plugins
3. Verify that the valuebuilder plugin appears in the plugins list
4. Confirm that the plugin shows the correct type/category information
5. Use any available filtering options to verify valuebuilder plugins
   can be filtered appropriately
6. Verify that valuebuilder plugins display the same management options
   (enable/disable/configure) as other plugin types
7. Test that plugin status changes are reflected correctly in the
   filtered view

Co-authored-by: Mark Hofstetter <mark@hofstetter.at>
Comment 9 Martin Renvoize (ashimema) 2025-06-24 15:35:34 UTC
Created attachment 183469 [details] [review]
Bug 39522: Add unit tests for valuebuilder plugin hooks

This patch adds comprehensive unit tests for the new valuebuilder plugin
functionality. The tests verify that plugins can provide valuebuilders
through the get_valuebuilder() method and that FrameworkPlugin can
correctly load and integrate with plugin-based valuebuilders.

The tests use a dedicated TestValuebuilder plugin to ensure realistic
testing scenarios without relying on mocks, following the pattern
established in other plugin hook tests.

Test plan:
1. Run the new test file:
   prove t/db_dependent/Koha/Plugins/Valuebuilder_hooks.t
2. Verify all tests pass (9 tests total)
3. Run all plugin tests to ensure no regressions:
   prove t/db_dependent/Koha/Plugins/
4. Verify all plugin tests still pass (113 tests across 19 files)
5. Test the specific functionality:
   - Verify plugins without get_valuebuilder() method are not found as valuebuilders
   - Verify plugins with get_valuebuilder() method are correctly discovered
   - Verify FrameworkPlugin can load plugin-based valuebuilders
   - Verify JavaScript generation works with plugin valuebuilders
   - Verify plugin enable/disable affects valuebuilder availability
6. Confirm FrameworkPlugin integration tests still pass:
   prove t/db_dependent/FrameworkPlugin.t
Comment 10 Martin Renvoize (ashimema) 2025-06-26 07:02:59 UTC
We've now got this running in production on our sites at OpenFifth.  The Homosaurus plugin is a great example of using it.

* https://github.com/openfifth/koha-plugin-homosaurus-value-builder
Comment 11 Owen Leonard 2025-06-26 12:41:07 UTC
This looks like it's working correctly but the QA script has lots of complaints