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

(-)a/Koha/Plugins.pm (-1 / +14 lines)
Lines 22-28 use Modern::Perl; Link Here
22
use Array::Utils qw( array_minus );
22
use Array::Utils qw( array_minus );
23
use Class::Inspector;
23
use Class::Inspector;
24
use List::MoreUtils qw( any );
24
use List::MoreUtils qw( any );
25
use Module::Load::Conditional qw( can_load );
25
use Module::Load::Conditional qw( can_load check_install );
26
use Module::Load;
26
use Module::Load;
27
use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/;
27
use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/;
28
use Try::Tiny;
28
use Try::Tiny;
Lines 220-225 sub GetPlugins { Link Here
220
            next unless $plugin->is_enabled or
220
            next unless $plugin->is_enabled or
221
                        defined($params->{all}) && $params->{all};
221
                        defined($params->{all}) && $params->{all};
222
222
223
            # Check metadata for required perl modules
224
            my $libs = $plugin->get_metadata->{libs};
225
            my @missing_libs;
226
            foreach my $lib (@$libs) {
227
                unless ( check_install( module => $lib->{module} ) ) {
228
                    push( @missing_libs, $lib );
229
                }
230
            }
231
            if (@missing_libs) {
232
                push @plugins, { error => 'missing_libs', name => $plugin_class, libs => \@missing_libs };
233
                next;
234
            }
235
223
            # filter the plugin out by metadata
236
            # filter the plugin out by metadata
224
            my $plugin_metadata = $plugin->get_metadata;
237
            my $plugin_metadata = $plugin->get_metadata;
225
            next
238
            next
(-)a/Koha/Plugins/Base.pm (-1 / +1 lines)
Lines 196-202 sub get_metadata { Link Here
196
196
197
    #FIXME: Why another encoding issue? For metadata containing non latin characters.
197
    #FIXME: Why another encoding issue? For metadata containing non latin characters.
198
    my $metadata = $self->{metadata};
198
    my $metadata = $self->{metadata};
199
    defined($metadata->{$_}) && utf8::decode($metadata->{$_}) for keys %$metadata;
199
    defined($metadata->{$_}) && !ref $metadata->{$_} && utf8::decode($metadata->{$_}) for keys %$metadata;
200
    return $metadata;
200
    return $metadata;
201
}
201
}
202
202
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt (-3 / +14 lines)
Lines 154-163 Link Here
154
                                            <span class="label label-warning">ERRORS</span>
154
                                            <span class="label label-warning">ERRORS</span>
155
                                        </td>
155
                                        </td>
156
                                        [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
156
                                        [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
157
                                        <td colspan="7">Error found whilst attempting to load plugin</td>
157
                                            <td colspan="7">
158
                                        [% ELSE %]
158
                                        [% ELSE %]
159
                                        <td colspan="6">Error found whilst attempting to load plugin</td>
159
                                            <td colspan="6">
160
                                        [% END %]
160
                                        [% END %]
161
162
                                        [% IF plugin.error == 'missing_libs' %]
163
                                            This plugin requires the following missing modules to be installed:
164
                                            <ul>
165
                                                [% FOREACH l IN plugin.libs %]
166
                                                    <li>[% l.module | html %]</li>
167
                                                [% END %]
168
                                            </ul>
169
                                        [% ELSE %]
170
                                            Error found whilst attempting to load plugin
171
                                        [% END %]
172
                                        </td>
161
                                    </tr>
173
                                    </tr>
162
                                    [% ELSE %]
174
                                    [% ELSE %]
163
                                    <tr>
175
                                    <tr>
164
- 

Return to bug 35603