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 243-248 sub GetPlugins { Link Here
243
            next unless $plugin->is_enabled or
243
            next unless $plugin->is_enabled or
244
                        defined($params->{all}) && $params->{all};
244
                        defined($params->{all}) && $params->{all};
245
245
246
            # Check metadata for required perl modules
247
            my $libs = $plugin->get_metadata->{libs};
248
            my @missing_libs;
249
            foreach my $lib (@$libs) {
250
                unless ( check_install( module => $lib->{module} ) ) {
251
                    push( @missing_libs, $lib );
252
                }
253
            }
254
            if (@missing_libs) {
255
                push @plugins, { error => 'missing_libs', name => $plugin_class, libs => \@missing_libs };
256
                next;
257
            }
258
246
            # filter the plugin out by metadata
259
            # filter the plugin out by metadata
247
            my $plugin_metadata = $plugin->get_metadata;
260
            my $plugin_metadata = $plugin->get_metadata;
248
            next
261
            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 155-164 Link Here
155
                                            <span class="label label-warning">ERRORS</span>
155
                                            <span class="label label-warning">ERRORS</span>
156
                                        </td>
156
                                        </td>
157
                                        [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
157
                                        [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
158
                                            <td colspan="8">Error found whilst attempting to load plugin</td>
158
                                            <td colspan="8">
159
                                        [% ELSE %]
159
                                        [% ELSE %]
160
                                            <td colspan="8">Error found whilst attempting to load plugin</td>
160
                                            <td colspan="7">
161
                                        [% END %]
161
                                        [% END %]
162
163
                                        [% IF plugin.error == 'missing_libs' %]
164
                                            This plugin requires the following missing modules to be installed:
165
                                            <ul>
166
                                                [% FOREACH l IN plugin.libs %]
167
                                                    <li>[% l.module | html %]</li>
168
                                                [% END %]
169
                                            </ul>
170
                                        [% ELSE %]
171
                                            Error found whilst attempting to load plugin
172
                                        [% END %]
173
                                        </td>
162
                                    </tr>
174
                                    </tr>
163
                                    [% ELSE %]
175
                                    [% ELSE %]
164
                                    <tr>
176
                                    <tr>
165
- 

Return to bug 35603