Bug 41107: (follow-up) Use Koha::Status in Koha::Template::Plugin::Koha
This patch makes the template plugin used for rendering the Koha version use the introduced method. I did this checks: ```shell cd koha-tmpl git grep Koha.Version ``` The places Koha.Version is used, it is used as: * `Koha.Version.maintenance` * `Koha.Version.release` * Assigned to a variable like this `SET koha_version = Koha.Version` All occurences of the `koha_version` template variable are: * `koha_version.development` * `koha_version.major` * `koha_version.minor` This implies the newly added `.version` attribute has no undesired side effects in templates. Note: plugins-home.tt has a different use of a variable named the same, which is unrelated. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/Koha_Template_Plugin_Koha.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
parent
68c8b8f13f
commit
f64051cddb
|
|
@ -24,6 +24,7 @@ use base qw( Template::Plugin );
|
|||
use C4::Context;
|
||||
use Koha::Token;
|
||||
use Koha;
|
||||
use Koha::Status;
|
||||
use Koha::Cache::Memory::Lite;
|
||||
use Koha::ContentSecurityPolicy;
|
||||
|
||||
|
|
@ -131,16 +132,7 @@ Missing POD for Version.
|
|||
=cut
|
||||
|
||||
sub Version {
|
||||
my $version_string = Koha::version();
|
||||
my ( $major, $minor, $maintenance, $development ) = split( '\.', $version_string );
|
||||
|
||||
return {
|
||||
major => $major,
|
||||
minor => $minor,
|
||||
release => $major . "." . $minor,
|
||||
maintenance => $major . "." . $minor . "." . $maintenance,
|
||||
development => ( $development ne '000' ) ? $development : undef,
|
||||
};
|
||||
return Koha::Status->new()->version();
|
||||
}
|
||||
|
||||
=head3 GenerateCSRF
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ subtest "Koha::Template::Plugin::Koha::Version tests" => sub {
|
|||
minor => $minor,
|
||||
release => $major . "." . $minor,
|
||||
maintenance => $major . "." . $minor . "." . $maintenance,
|
||||
development => $development
|
||||
development => $development,
|
||||
version => $version,
|
||||
},
|
||||
"Correct development version"
|
||||
);
|
||||
|
|
@ -82,7 +83,8 @@ subtest "Koha::Template::Plugin::Koha::Version tests" => sub {
|
|||
minor => $minor,
|
||||
release => $major . "." . $minor,
|
||||
maintenance => $major . "." . $minor . "." . $maintenance,
|
||||
development => undef
|
||||
development => undef,
|
||||
version => $version,
|
||||
},
|
||||
"Correct maintenance version"
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue