[Bug 22709] New: Add hooks to notify plugins of biblio and item changes
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Bug ID: 22709 Summary: Add hooks to notify plugins of biblio and item changes Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- We should have a way to make *Biblio *Item methods trigger actions on plugins. Maybe if we have a message queue, then enqueue messages for registered plugins (i.e. to avoid synchronous calls). -- 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=22709 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org, | |kyle@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- This could be easily implemented by reusing the zebraqueue table, but adding new targets based on configured notifiable plugins. Hmmm -- 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=22709 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- 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=22709 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 90950 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=90950&action=edit Bug 22709: Unit tests This patch introduces tests for new plugin hooks added to C4::Biblio::{Add|Mod|Del}Biblio and C4::Items::{Add|Mod|Del}Item. They are tested together as for creating an item you need to first create a biblio and tests looks basically the same. The testing strategy is - Make sure the plugin is passed the right params - Throw an exception at plugin-level, to be trapped by the C4::Biblio and C4::Items lib, and converted into a warning. So we test for the warning. - Also, the fact that C4::Biblio and C4::Items warns, means the exception was cought, and then Koha won't break on faulty plugins or fatal errors from plugins. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 90951 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=90951&action=edit Bug 22709: Add after biblio/item action hooks This patch introduces after-action hooks for - C4::Biblio::{Add|Mod|Del}Biblio - C4::Items::{Add|Mod|Del}Biblio After the action has taken place, a call to a helper method is done, which loops through all plugins implementing the hooks, and calls the plugin method. The related object is passed, along with an 'action' string specifying the action that took place, and the object id (which is specially important for the 'Del' case). To test: - Apply this patchset - Run: $ kshell k$ prove t/db_dependent/Biblio_and_Items_plugin_hooks.t => SUCCESS: Tests pass! - Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- Unit tests are failing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 91186 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91186&action=edit Bug 22709: (follow-up) Mock enable_plugins config entry 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=22709 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Kyle M Hall from comment #4)
Unit tests are failing.
Thanks for testing! I've added a follow-up to fix the issue. I didn't notice I forgot to mock the enable_plugins config entry. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #90950|0 |1 is obsolete| | Attachment #90951|0 |1 is obsolete| | Attachment #91186|0 |1 is obsolete| | --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 91223 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91223&action=edit Bug 22709: Unit tests This patch introduces tests for new plugin hooks added to C4::Biblio::{Add|Mod|Del}Biblio and C4::Items::{Add|Mod|Del}Item. They are tested together as for creating an item you need to first create a biblio and tests looks basically the same. The testing strategy is - Make sure the plugin is passed the right params - Throw an exception at plugin-level, to be trapped by the C4::Biblio and C4::Items lib, and converted into a warning. So we test for the warning. - Also, the fact that C4::Biblio and C4::Items warns, means the exception was cought, and then Koha won't break on faulty plugins or fatal errors from plugins. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 91224 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91224&action=edit Bug 22709: Add after biblio/item action hooks This patch introduces after-action hooks for - C4::Biblio::{Add|Mod|Del}Biblio - C4::Items::{Add|Mod|Del}Biblio After the action has taken place, a call to a helper method is done, which loops through all plugins implementing the hooks, and calls the plugin method. The related object is passed, along with an 'action' string specifying the action that took place, and the object id (which is specially important for the 'Del' case). To test: - Apply this patchset - Run: $ kshell k$ prove t/db_dependent/Biblio_and_Items_plugin_hooks.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 91225 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91225&action=edit Bug 22709: (follow-up) Mock enable_plugins config entry Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 91226 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91226&action=edit Bug 22709: (follow-up) Move new test file into a Plugins subdirectory Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Kyle M Hall from comment #10)
Created attachment 91226 [details] [review] Bug 22709: (follow-up) Move new test file into a Plugins subdirectory
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Good idea! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91223|0 |1 is obsolete| | --- Comment #12 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 91244 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91244&action=edit Bug 22709: Unit tests This patch introduces tests for new plugin hooks added to C4::Biblio::{Add|Mod|Del}Biblio and C4::Items::{Add|Mod|Del}Item. They are tested together as for creating an item you need to first create a biblio and tests looks basically the same. The testing strategy is - Make sure the plugin is passed the right params - Throw an exception at plugin-level, to be trapped by the C4::Biblio and C4::Items lib, and converted into a warning. So we test for the warning. - Also, the fact that C4::Biblio and C4::Items warns, means the exception was cought, and then Koha won't break on faulty plugins or fatal errors from plugins. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91224|0 |1 is obsolete| | --- Comment #13 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 91245 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91245&action=edit Bug 22709: Add after biblio/item action hooks This patch introduces after-action hooks for - C4::Biblio::{Add|Mod|Del}Biblio - C4::Items::{Add|Mod|Del}Biblio After the action has taken place, a call to a helper method is done, which loops through all plugins implementing the hooks, and calls the plugin method. The related object is passed, along with an 'action' string specifying the action that took place, and the object id (which is specially important for the 'Del' case). To test: - Apply this patchset - Run: $ kshell k$ prove t/db_dependent/Biblio_and_Items_plugin_hooks.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91225|0 |1 is obsolete| | --- Comment #14 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 91246 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91246&action=edit Bug 22709: (follow-up) Mock enable_plugins config entry Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91226|0 |1 is obsolete| | --- Comment #15 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 91247 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91247&action=edit Bug 22709: (follow-up) Move new test file into a Plugins subdirectory Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com Status|Signed Off |Passed QA QA Contact|testopia@bugs.koha-communit |josef.moravec@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |19.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #16 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #17 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Do we have documentation for this and other new hooks? Should this be added to the kitchen sink plugin? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #18 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Katrin Fischer from comment #17)
Do we have documentation for this and other new hooks? Should this be added to the kitchen sink plugin?
Good point. Will add them to KitchenSink ASAP. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Started a wiki page too... content to be added ;) https://wiki.koha-community.org/wiki/Koha_Plugin_Hooks -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #20 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #21 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #22 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Awesome \o/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #23 from David Cook <dcook@prosentient.com.au> --- Nice! A few years ago, I was thinking it would be great to add hooks like this, but never got around to doing it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #24 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- I could backport to stable but maybe this needs the plugins performance patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #25 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Fridolin SOMERS from comment #24)
I could backport to stable but maybe this needs the plugins performance patch.
Indeed. And we noticed a slight performance hit we need to address. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 --- Comment #26 from Kyle M Hall <kyle@bywatersolutions.com> --- (In reply to Tomás Cohen Arazi from comment #25)
(In reply to Fridolin SOMERS from comment #24)
I could backport to stable but maybe this needs the plugins performance patch.
Indeed. And we noticed a slight performance hit we need to address.
Agreed, with the performance patch, the addition time is essentially negligible. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |23395 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23395 [Bug 23395] batch operations on biblios/items should be able to pass a list of plugins -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Architecture, internals, |Tools |and plumbing | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Tools |Plugin architecture -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |new feature -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This new feature allows release notes| |plugin authors to implement | |`after_biblio_action` and | |`after_item_action` methods | |which may be used to take | |various actions upon biblio | |and item creations, | |modifications and | |deletions. | | | |**Warning**: | |Care should be taken when | |installing any plugins and | |only plugins you trust | |should be used. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |26470 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 [Bug 26470] itemnumber not available for plugin hook -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |29274 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29274 [Bug 29274] z_reset.t is wrong -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=29273 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |34786 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34786 [Bug 34786] after_biblio_action hooks: find after delete makes no sense -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=36542 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org