[Koha-bugs] [Bug 26470] itemnumber not available for plugin hook

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Sep 16 14:24:25 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26470

Martin Renvoize <martin.renvoize at ptfs-europe.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #110135|0                           |1
        is obsolete|                            |

--- Comment #6 from Martin Renvoize <martin.renvoize at 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 at davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize at ptfs-europe.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list