Bug 26236 - log viewer does not translate the interface properly
Summary: log viewer does not translate the interface properly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-18 13:28 UTC by Jonathan Druart
Modified: 2021-06-14 21:31 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.04, 19.11.10


Attachments
Bug 25872: Fix translating interface from DB term to readable term (1.63 KB, patch)
2020-08-18 13:38 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25872: Fix translating interface from DB term to readable term (1.69 KB, patch)
2020-09-03 08:31 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 25872: Fix translating interface from DB term to readable term (1.76 KB, patch)
2020-09-03 09:07 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 26236: Fix translating interface from DB term to readable term (1.70 KB, patch)
2020-09-03 09:08 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2020-08-18 13:28:13 UTC
viewlog.tt

 83 [% BLOCK translate_log_interface %]
 84 [%    SWITCH log_interface %]
 85 [%        CASE 'INTRANET'    %]Intranet
 86 [%        CASE 'OPAC'        %]OPAC
 87 [%        CASE 'SIP'         %]SIP
 88 [%        CASE 'COMMANDLINE' %]Command-line
 89 [%        CASE 'API'         %]REST API
 90 [%        CASE 'CRON'        %]Cron job
 91 [%        CASE %][% log_interface | html %]
 92 [%    END %]
 93 [% END %]

We don't have CRON in DB, but 'cron', same for all others, they are all lowercase.
Comment 1 Nick Clemens 2020-08-18 13:38:37 UTC
Created attachment 108506 [details] [review]
Bug 25872: Fix translating interface from DB term to readable term

When viewing the logs we try to swith the db values like 'cron' to friendly terms like
'Cron job'

The values we use for building the selectors on the page ar eupper case, but DB values are lower case

If we simply force upper case in the comparison we can ensure we always match correctly

To test:
1 - Enable some 'Logs' setting in System preferences
2 - Perform some action in koha that will log
    Run a cronjob
    Change a syspref
    etc.
3 - Browse to Tools-> Log viewer
4 - Click 'Submit' to see all logs
5 - Note the 'Interface' column contains lower case DB values
6 - Apply patch
7 - Reload the page
8 - Values in interface are now Camel cased and more friendly
Comment 2 Fridolin Somers 2020-09-03 08:31:11 UTC
Created attachment 109586 [details] [review]
Bug 25872: Fix translating interface from DB term to readable term

When viewing the logs we try to swith the db values like 'cron' to friendly terms like
'Cron job'

The values we use for building the selectors on the page ar eupper case, but DB values are lower case

If we simply force upper case in the comparison we can ensure we always match correctly

To test:
1 - Enable some 'Logs' setting in System preferences
2 - Perform some action in koha that will log
    Run a cronjob
    Change a syspref
    etc.
3 - Browse to Tools-> Log viewer
4 - Click 'Submit' to see all logs
5 - Note the 'Interface' column contains lower case DB values
6 - Apply patch
7 - Reload the page
8 - Values in interface are now Camel cased and more friendly

https://bugs.koha-community.org/show_bug.cgi?id=26236
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 3 Fridolin Somers 2020-09-03 08:31:29 UTC
Good catch ;)
Comment 4 Martin Renvoize 2020-09-03 09:07:24 UTC
Created attachment 109595 [details] [review]
Bug 25872: Fix translating interface from DB term to readable term

When viewing the logs we try to swith the db values like 'cron' to friendly terms like
'Cron job'

The values we use for building the selectors on the page ar eupper case, but DB values are lower case

If we simply force upper case in the comparison we can ensure we always match correctly

To test:
1 - Enable some 'Logs' setting in System preferences
2 - Perform some action in koha that will log
    Run a cronjob
    Change a syspref
    etc.
3 - Browse to Tools-> Log viewer
4 - Click 'Submit' to see all logs
5 - Note the 'Interface' column contains lower case DB values
6 - Apply patch
7 - Reload the page
8 - Values in interface are now Camel cased and more friendly

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2020-09-03 09:08:17 UTC
Created attachment 109596 [details] [review]
Bug 26236: Fix translating interface from DB term to readable term

When viewing the logs we try to swith the db values like 'cron' to friendly terms like
'Cron job'

The values we use for building the selectors on the page ar eupper case, but DB values are lower case

If we simply force upper case in the comparison we can ensure we always match correctly

To test:
1 - Enable some 'Logs' setting in System preferences
2 - Perform some action in koha that will log
    Run a cronjob
    Change a syspref
    etc.
3 - Browse to Tools-> Log viewer
4 - Click 'Submit' to see all logs
5 - Note the 'Interface' column contains lower case DB values
6 - Apply patch
7 - Reload the page
8 - Values in interface are now Camel cased and more friendly

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2020-09-03 09:09:23 UTC
Good catch, simple fix.

I corrected the bug number in the commit message to match the bug here.

Passing QA
Comment 7 Jonathan Druart 2020-09-03 13:04:49 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 8 Lucas Gass 2020-09-14 21:42:32 UTC
backported to 20.05.x for 20.05.04
Comment 9 Aleisha Amohia 2020-09-15 11:47:11 UTC
backported to 19.11.x for 19.11.10
Comment 10 Victor Grousset/tuxayo 2020-09-20 19:21:46 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.