Summary: | In C4/AddBiblio, plugin hook after_biblio_action is triggered before the record is actually saved | ||
---|---|---|---|
Product: | Koha | Reporter: | Arthur Suzuki <arthur.suzuki> |
Component: | Plugin architecture | Assignee: | Arthur Suzuki <arthur.suzuki> |
Status: | Patch doesn't apply --- | QA Contact: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | chris, jonathan.druart, lucas |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22709 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Plugin which demonstrate the issue
Bug 36542: after_biblio_action plugin hook is now called after the dbx transaction is finished |
Description
Arthur Suzuki
2024-04-08 09:11:53 UTC
Created attachment 164589 [details]
Plugin which demonstrate the issue
I made a plugin which demonstrate the issue.
After installing the plugin in KTD, you'll have to open /var/log/koha/plack-intranet-error.log.
Then, if you create a record, you'll see that when the "after_biblio_action" hook is called, the biblio object is available for some Koha::Biblios namespace thanks to some caching mechanism (first warn in the plugin code is not triggered).
However, when the hook is called, it is actually not yet saved to DB.
This can be verified by doing a call to an API during the call, and see that this api call do not find the record.
This test is implemented in the plugin and you will see in the plack-intranet-error.log that the record is not found.
Created attachment 164607 [details] [review] Bug 36542: after_biblio_action plugin hook is now called after the dbx transaction is finished if the patch is applied, the log will contains the record data. We need to log the modified version of the record. We must log after the hook call IMO. We have a merge commit as the code has moved on a little bit. Can you have a quick look please Arthur. |