]> git.koha-community.org Git - koha.git/commit
Bug 26470: Store the item before calling the after action hook
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 15 Sep 2020 19:23:05 +0000 (16:23 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 18 Sep 2020 08:38:01 +0000 (10:38 +0200)
commit4b3657b3d6762d148b57324c7211ede743c15c5b
tree33ad6af581b7b7ed81223d5263e983eccd0149aa
parent99a640fd75118475f5443093a3b815e3ce148b8f
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Item.pm