[Koha-bugs] [Bug 32107] New: Send $self to Plugins->call and call discard_changes inside

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 4 10:07:28 CET 2022


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

            Bug ID: 32107
           Summary: Send $self to Plugins->call and call discard_changes
                    inside
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Plugin architecture
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: m.de.rooy at rijksmuseum.nl
        QA Contact: testopia at bugs.koha-community.org

Resulting from a discussion on IRC and in the QA team. If there is a need for
further discussion, we can continue here.

The idea is: We should no longer $self->store and pass $self->get_from_storage
to the ->call routine.
But we should $self->store, pass $self to Plugins->call, and ->discard_changes
once inside ->call to fetch timestamps and default values from DBMS.

What happens after ->call? Currently, we pass a copy but continue afterwards
with the old $self. Normally, we wont do much more, but this might create
side-effects since we do not operate on the latest data (we ignore changes from
plugins).
If we pass $self, we have the latest state back after ->call. Though we are not
sure if the plugin(s) did a store. If we would do a discard after the plugins
loop in ->call, we actually ignore unsaved changes like we do now too and we do
not disturb the plugins loop inside ->call.

To make it even more explicit, we could add a parameter to ->call that controls
if we do or do not discard after the plugins loop..

Side note: The execution order of plugins seems to be database insert order
when I look at the code in GetPlugins. Theoretically I would rather control
that differently but that could be a topic of another report. Not in this scope
;)

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


More information about the Koha-bugs mailing list