View | Details | Raw Unified | Return to bug 28010
Collapse All | Expand All

(-)a/Plugins.pm.orig (+29 lines)
Lines 82-87 sub call { Link Here
82
    return @responses;
82
    return @responses;
83
}
83
}
84
84
85
=head2 call_apply
86
87
Calls a plugin method for all enabled plugins, reworking on the same input and returning it.
88
ideally the caller of a plugin must not know how to merge the results
89
so maybe also implement a "merge" method in the plugin 
90
91
    @responses = Koha::Plugins->call_apply($method, $work_var, @args)
92
93
=cut
94
95
sub call_apply {
96
    my ($class, $method, $work_var, @args) = @_;
97
98
    if (C4::Context->config('enable_plugins')) {
99
        my @plugins = $class->new({ enable_plugins => 1 })->GetPlugins({ method => $method });
100
        @plugins = grep { $_->can($method) } @plugins;
101
        foreach my $plugin (@plugins) {
102
            my $work_var = eval { $plugin->$method($work_var, @args) };
103
            if ($@) {
104
                warn sprintf("Plugin error (%s): %s", $plugin->get_metadata->{name}, $@);
105
                next;
106
            }
107
        }
108
109
    }
110
    return $work_var;
111
}
112
113
85
114
86
=head2 GetPlugins
115
=head2 GetPlugins
87
116
(-)a/opac-detail.pl.orig (+10 lines)
Lines 217-222 if ( $xslfile ) { Link Here
217
        $variables = { %$variables, %$plugin_variables };
217
        $variables = { %$variables, %$plugin_variables };
218
    }
218
    }
219
219
220
    $record = Koha::Plugins->call_apply(
221
        'munge_record',
222
        $record,
223
        {
224
            patron      => $patron,
225
            interface   => 'opac',
226
            caller      => 'opac-detail',
227
        }
228
    );
229
220
    $template->param(
230
    $template->param(
221
        XSLTBloc => XSLTParse4Display(
231
        XSLTBloc => XSLTParse4Display(
222
            $biblionumber, $record, "OPACXSLTDetailsDisplay", 1, undef,
232
            $biblionumber, $record, "OPACXSLTDetailsDisplay", 1, undef,

Return to bug 28010