Bug 22451: Make Asset plugin use Koha::version instead of version from db
authorJosef Moravec <josef.moravec@gmail.com>
Tue, 26 Feb 2019 13:30:20 +0000 (13:30 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 16 Apr 2019 13:17:32 +0000 (13:17 +0000)
Test plan:
Apply the patch a try to use Koha, css and js files should be used
normally

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha/Template/Plugin/Asset.pm

index 4cbc1bd..08748b4 100644 (file)
@@ -48,6 +48,7 @@ use base qw( Template::Plugin );
 use File::Basename;
 use File::Spec;
 use C4::Context;
+use Koha;
 
 =head1 FUNCTIONS
 
@@ -140,7 +141,8 @@ sub url {
         ".",
     );
 
-    my $version = C4::Context->preference('Version');
+    my $version = Koha::version;
+    $version =~ s/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/$1.$2$3$4/;
     foreach my $dir (@dirs) {
         my $abspath = File::Spec->catfile($root, $dir, $filename);
         if (-e $abspath) {