Bug 20480: Make KOHA_VERSION available to all templates in all circumstances
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 27 Mar 2018 14:54:51 +0000 (11:54 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Mar 2018 16:38:57 +0000 (13:38 -0300)
commitb03ce512c45544d2b9695f913a2291530cb63362
tree028085f5a59365e7a955c7aaa9814f9d37af0ce4
parentf3f8c669141da6941f7eebaebb157e99a3a5e217
Bug 20480: Make KOHA_VERSION available to all templates in all circumstances

This patch makes C4::Templates::gettemplate set the KOHA_VERSION param
for the template. This way this template parameter, which is required by
(probably) all pages that include CSS/JS content is available in all
circumstances.

A noticeable problem with the current approach is when using the SCO and
SCI modules with wrong/forbidden users: C4::Auth short-circuits and
redirects to the login page, without setting the KOHA_VERSION param.
This patch solves it for good.

To test:
- Enable the SCI module
- Open the browser at
  http://localhost:8080/cgi-bin/koha/sci/sci-main.pl
- Login with the db user (koha_kohadev / password)
=> FAIL: Login failure, but styling is broken
- Apply this patch
- Retry
=> SUCCESS: Everything looks as it should!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Auth.pm
C4/Templates.pm