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

(-)a/Koha/Plugins/Base.pm (+24 lines)
Lines 369-374 sub disable { Link Here
369
    return $self;
369
    return $self;
370
}
370
}
371
371
372
sub is_for_newer_koha {
373
    my ($self)         = @_;
374
    my $actual_version = Koha::version;
375
    my $min_version    = $self->get_metadata->{minimum_version};
376
    return 0 unless $min_version;
377
    return ( _version_to_number($actual_version) < _version_to_number($min_version) ) ? 1 : 0;
378
}
379
380
sub is_for_older_koha {
381
    my ($self)         = @_;
382
    my $actual_version = Koha::version;
383
    my $max_version    = $self->get_metadata->{maximum_version};
384
    return 0 unless $max_version;
385
    return ( _version_to_number($actual_version) > _version_to_number($max_version) ) ? 1 : 0;
386
}
387
388
sub _version_to_number {
389
    my $koha_version = shift;
390
    return 0 unless defined($koha_version);
391
    # Version in metadata may be 18.11, 20.05.02, 21.05.00.006 ...
392
    $koha_version =~ s/(.*\..*)\.?(.*)\.?(.*)/$1$2$3/;
393
    return $koha_version;
394
}
395
372
1;
396
1;
373
__END__
397
__END__
374
398
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt (-2 / +2 lines)
Lines 151-163 Link Here
151
                                    <td>
151
                                    <td>
152
                                        [% plugin.metadata.description | html %]
152
                                        [% plugin.metadata.description | html %]
153
153
154
                                        [% IF ( plugin.metadata.minimum_version && koha_version < plugin.metadata.minimum_version ) %]
154
                                        [% IF ( plugin.is_for_newer_koha ) %]
155
                                            <div class="dialog alert">
155
                                            <div class="dialog alert">
156
                                                Warning: This report was written for a newer version of Koha. Run at your own risk.
156
                                                Warning: This report was written for a newer version of Koha. Run at your own risk.
157
                                            </div>
157
                                            </div>
158
                                        [% END %]
158
                                        [% END %]
159
159
160
                                        [% IF ( plugin.metadata.maximum_version && koha_version > plugin.metadata.maximum_version ) %]
160
                                        [% IF ( plugin.is_for_older_koha ) %]
161
                                            <div class="dialog alert">
161
                                            <div class="dialog alert">
162
                                                Warning: This plugin was written for an older version of Koha. Run at your own risk.
162
                                                Warning: This plugin was written for an older version of Koha. Run at your own risk.
163
                                            </div>
163
                                            </div>
(-)a/plugins/plugins-home.pl (-2 lines)
Lines 46-52 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
46
if ($plugins_enabled) {
46
if ($plugins_enabled) {
47
47
48
    $template->param(
48
    $template->param(
49
        koha_version => C4::Context->preference("Version"),
50
        method       => $method,
49
        method       => $method,
51
    );
50
    );
52
51
53
- 

Return to bug 29008