[Bug 35070] New: Koha plugins implementing "background_jobs" hook can't provide view template
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Bug ID: 35070 Summary: Koha plugins implementing "background_jobs" hook can't provide view template Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Plugin architecture Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org At the moment, Koha plugins implementing the "background_jobs" hook can't provide a template to "View" the job. Instead, you get an error like: Template process failed: file error - background_jobs/plugin_TYPE_ACTION.inc: not found at /kohadevbox/koha/C4/Templates.pm line 127 This should be a pretty easy fix. Basically, Koha::BackgroundJob should have a method that returns "background_jobs/{job type}" and a Koha plugin can override this method to provide its own template. We use the ABSOLUTE option for Template::Toolkit, so you can provide an absolute filepath to a template within the plugin and it'll get processed. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |30410 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30410 [Bug 30410] Add a way for plugins to register background tasks -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Another solution would be to let plugins add paths to Template::Toolkit's INCLUDE_PATH option. It would also allow plugin's templates to INCLUDE their own .inc files -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #2 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 157323 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=157323&action=edit Bug 35070: Proof of concept Add the following methods to your plugin sub template_include_paths { my ($self) = @_; return [ $self->mbf_path('inc'), ] } Then create a file Koha/Plugin/YourPlugin/inc/background_jobs/plugin_NAMESPACE_JOBTYPE.inc with 3 TT BLOCKs: "process", "report" and "js" -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to Julian Maurice from comment #1)
Another solution would be to let plugins add paths to Template::Toolkit's INCLUDE_PATH option. It would also allow plugin's templates to INCLUDE their own .inc files
I was thinking about that the other day. Sounds good to me I think. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #4 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 159205 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159205&action=edit Bug 35070: Add plugin hook template_include_paths It allows to add paths to Template::Toolkit's INCLUDE_PATH option http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH Test plan: 1. Install the modified kitchen sink plugin: git clone --branch template-include-paths \ https://github.com/jajm/dev-koha-plugin-kitchen-sink.git 2. Run misc/devel/install_plugins.pl 3. Restart memcached and koha 4. Go to Administration -> Manage Plugins 5. Run the KitchenSink plugin's tool 6. Click on "Schedule greeting" 7. Go to Administration -> Manage jobs 8. If you don't see any jobs, uncheck "Current jobs only" 9. You should see a job of type "Unknown job type 'plugin_kitchensink_greeter". Click on the "View" button 10. Under the Report section you should see "This is the report block" 11. Under the Detailed messages section you should see "This is the detail block" 12. Open the browser console, you should see a message "This is the js block" -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #5 from Julian Maurice <julian.maurice@biblibre.com> --- Added a test, and forked the kitchen sink plugin so that it's easier to test. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #157323|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #159205|0 |1 is obsolete| | --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 159248 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159248&action=edit Bug 35070: Add plugin hook template_include_paths It allows to add paths to Template::Toolkit's INCLUDE_PATH option http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH Test plan: 1. Install the modified kitchen sink plugin: git clone --branch template-include-paths \ https://github.com/jajm/dev-koha-plugin-kitchen-sink.git 2. Run misc/devel/install_plugins.pl 3. Restart memcached and koha 4. Go to Administration -> Manage Plugins 5. Run the KitchenSink plugin's tool 6. Click on "Schedule greeting" 7. Go to Administration -> Manage jobs 8. If you don't see any jobs, uncheck "Current jobs only" 9. You should see a job of type "Unknown job type 'plugin_kitchensink_greeter". Click on the "View" button 10. Under the Report section you should see "This is the report block" 11. Under the Detailed messages section you should see "This is the detail block" 12. Open the browser console, you should see a message "This is the js block" Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #7 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. The first step in the test plan didn't work for me. Instead, I cloned the repository and moved the dev-koha-plugin-kitchen-sink/Koha directory to /var/lib/koha/kohadev/plugins/. 2. Plugins are already enabled in the kohadev/koha-conf.xml file, with the plugins directory set as /var/lib/koha/kohadev/plugins/ -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |julian.maurice@biblibre.com |ity.org | CC| |tomascohen@gmail.com QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #159248|0 |1 is obsolete| | --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 159901 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159901&action=edit Bug 35070: Add plugin hook template_include_paths It allows to add paths to Template::Toolkit's INCLUDE_PATH option http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH Test plan: 1. Install the modified kitchen sink plugin: git clone --branch template-include-paths \ https://github.com/jajm/dev-koha-plugin-kitchen-sink.git 2. Run misc/devel/install_plugins.pl 3. Restart memcached and koha 4. Go to Administration -> Manage Plugins 5. Run the KitchenSink plugin's tool 6. Click on "Schedule greeting" 7. Go to Administration -> Manage jobs 8. If you don't see any jobs, uncheck "Current jobs only" 9. You should see a job of type "Unknown job type 'plugin_kitchensink_greeter". Click on the "View" button 10. Under the Report section you should see "This is the report block" 11. Under the Detailed messages section you should see "This is the detail block" 12. Open the browser console, you should see a message "This is the js block" Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #9 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 159902 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159902&action=edit Bug 35070: Tidy Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Julian, can you add a test proving plugin authors cannot override (maliciously) core templates? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #11 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 159938 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159938&action=edit Bug 35070: Add test verifying plugins cannot override core templates -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #12 from Julian Maurice <julian.maurice@biblibre.com> --- The added test is not very robust, as it depends on the existence of a specific core template. If this core template is renamed or removed, the test will fail. That's the best I can do right now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Signed Off --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Julian Maurice from comment #12)
The added test is not very robust, as it depends on the existence of a specific core template. If this core template is renamed or removed, the test will fail. That's the best I can do right now.
Tomas, can you please check if Julian's follow-up does what you had in mind? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #159938|0 |1 is obsolete| | --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 160378 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160378&action=edit Bug 35070: Add test verifying plugins cannot override core templates Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- This should be backported to stables, IMHO. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- FAIL t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc FAIL filters missing_filter at line 2 ([%~ 'OVERRIDE' ~%]) Will fix. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #17 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com --- Comment #18 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- t/db_dependent/selenium/00-onboarding.t is failing I am seeing this in the logs: DBIx::Class::Storage::DBI::_dbh_execute(): Table 'koha_kohadev.plugin_data' doesn't exist at /kohadevbox/koha/Koha/Plugins.pm line 122 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 DBIx::Class::Exception::throw('DBIx::Class::Exception', 'Table \'koha_kohadev.plugin_data\' doesn\'t exist', 0) called at /usr/share/perl5/DBIx/Class/Schema.pm line 1118 DBIx::Class::Schema::throw_exception('Koha::Schema=HASH(0x55fc8aec4730)', 'Table \'koha_kohadev.plugin_data\' doesn\'t exist') called at /usr/share/perl5/DBIx/Class/Storage.pm line 113 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |additional_work_needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #19 from Julian Maurice <julian.maurice@biblibre.com> --- Should we add a followup here or on a new bug report ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #20 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 160565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160565&action=edit Bug 35070: Fix get_enabled_plugins when database is not created yet Koha::Plugins::get_enabled_plugins is called by Koha::Plugins::call which is called by C4::Templates->new, which is used in the web installer when the database is not created yet -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #21 from Julian Maurice <julian.maurice@biblibre.com> --- I didn't try t/db_dependent/selenium/00-onboarding.t but I was able to reproduce the error by running the web installer. After the patch I was able to complete the installation and the onboarding process. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 --- Comment #22 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed the follow-up to master. Thanks for taking care of this so quickly! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #23 from Fridolin Somers <fridolin.somers@biblibre.com> --- Hook moved in wiki page : https://wiki.koha-community.org/wiki/Koha_Plugin_Hooks#Implemented_hooks -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|24.05.00 |24.05.00,23.11.02 released in| | --- Comment #24 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.05.00,23.11.02 |24.05.00,23.11.02,23.05.08 released in| | Status|Pushed to stable |Pushed to oldstable CC| |lucas@bywatersolutions.com --- Comment #25 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 23.05.x for upcoming 23.05.08 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|additional_work_needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35070 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=35624 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org