[Bug 26470] New: itemnumber not available for plugin hook
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Bug ID: 26470 Summary: itemnumber not available for plugin hook Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major 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 The way the hook got placed in Koha::Item->store, it doesn't get the itemnumber populated by the DB. -- 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=26470 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Depends on| |22709 CC| |jonathan.druart@bugs.koha-c | |ommunity.org, | |kyle@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 [Bug 22709] Add hooks to notify plugins of biblio and item changes -- 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=26470 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com 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=26470 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 110119 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110119&action=edit Bug 26470: Regression tests This patch tweaks the test plugin so it composes an exception based on the fact that the hook was called with the item and item_id parameters defined. It then makes the tests expect a specific exception message with information about this. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t => FAIL: Tests fail! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 110120 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110120&action=edit Bug 26470: Store the item before calling the after action hook This patch makes Koha::Item->store call $self->SUPER::store before calling the hook, so things like the itemnumber (AUTO_INCREMENT field) are available to the plugin hook. It does so by storing the output on a temporary variable, to keep the current behaviour of just returning the output from SUPER::store. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t \ t/db_dependent/Koha/Item.t \ t/db_dependent/Koha/Items.t => FAIL: the hooks tests fail. Item.t hasn't been altered so should pass 3. Apply this patch 4. Repeat 2. => SUCCESS: Tests pass! Item.t as well! (i.e. no behaviour change) 5. 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=26470 David Nind <david@davidnind.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=26470 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #110119|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 110134 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110134&action=edit Bug 26470: Regression tests This patch tweaks the test plugin so it composes an exception based on the fact that the hook was called with the item and item_id parameters defined. It then makes the tests expect a specific exception message with information about this. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t => FAIL: Tests fail! Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #110120|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 110135 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110135&action=edit Bug 26470: Store the item before calling the after action hook This patch makes Koha::Item->store call $self->SUPER::store before calling the hook, so things like the itemnumber (AUTO_INCREMENT field) are available to the plugin hook. It does so by storing the output on a temporary variable, to keep the current behaviour of just returning the output from SUPER::store. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t \ t/db_dependent/Koha/Item.t \ t/db_dependent/Koha/Items.t => FAIL: the hooks tests fail. Item.t hasn't been altered so should pass 3. Apply this patch 4. Repeat 2. => SUCCESS: Tests pass! Item.t as well! (i.e. no behaviour change) 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #110134|0 |1 is obsolete| | --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 110185 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110185&action=edit Bug 26470: Regression tests This patch tweaks the test plugin so it composes an exception based on the fact that the hook was called with the item and item_id parameters defined. It then makes the tests expect a specific exception message with information about this. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t => FAIL: Tests fail! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #110135|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 110186 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110186&action=edit Bug 26470: Store the item before calling the after action hook This patch makes Koha::Item->store call $self->SUPER::store before calling the hook, so things like the itemnumber (AUTO_INCREMENT field) are available to the plugin hook. It does so by storing the output on a temporary variable, to keep the current behaviour of just returning the output from SUPER::store. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t \ t/db_dependent/Koha/Item.t \ t/db_dependent/Koha/Items.t => FAIL: the hooks tests fail. Item.t hasn't been altered so should pass 3. Apply this patch 4. Repeat 2. => SUCCESS: Tests pass! Item.t as well! (i.e. no behaviour change) 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Trivial fix with included regression tests.. works as expected Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Martin Renvoize <martin.renvoize@ptfs-europe.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=26470 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23463 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23463 [Bug 23463] Move C4::Items CRUD subroutines to Koha::Item -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.11.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=26470 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #9 from Lucas Gass <lucas@bywatersolutions.com> --- doesn't apply clean to 20.05.x, no backport -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=27003 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org