Bug 14580 - Warn when accessing Help from error pages
Summary: Warn when accessing Help from error pages
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
: 14681 (view as bug list)
Depends on:
Reported: 2015-07-21 04:06 UTC by Aleisha Amohia
Modified: 2017-10-23 14:52 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:

Bug 14580: Silencing warn triggered when accessing Help from an error page (1.05 KB, patch)
2015-07-21 04:09 UTC, Aleisha Amohia
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2015-07-21 04:06:34 UTC
When on an error page (ie 404.pl), clicking the Help link triggers a warn in the error log: 

help.pl: Use of uninitialized value $lang in concatenation (.) or string at /home/vagrant/kohaclone/help.pl line 52.
Comment 1 Aleisha Amohia 2015-07-21 04:09:15 UTC
Created attachment 41107 [details] [review]
Bug 14580: Silencing warn triggered when accessing Help from an error page

To test:

1) Go to an error page (ie cgi-bin/koha/errors/404.pl or just going to an invalid link will do it)
2) Click 'Help'
3) Notice warn
4) Apply patch and refresh page
5) Click 'Help'
6) Notice warn is gone and help still loads as it should
Comment 2 cnorthcott.work 2015-08-14 04:09:05 UTC
Patch applies correctly, warn silenced as expected. Signed off.
Comment 3 j.kylmala 2015-08-14 11:24:51 UTC
The problem is with C4::Templates::themelanguage function, it doesn't return anything in this situation. Should we fix that function instead, because bug 14681 has the same problem and I'm thinking other pages might have it too. I tried to look into a fix to that function but didn't come up with any clever fix. One idea was to default to some default themes/language but then we cannot know if they're installed or not.
Comment 4 Jonathan Druart 2015-08-18 14:39:07 UTC
We would like a global solution here.
themelanguage should be fixed not to return undef.
Comment 5 Aleisha Amohia 2015-12-13 22:32:57 UTC
*** Bug 14681 has been marked as a duplicate of this bug. ***
Comment 6 Aleisha Amohia 2015-12-23 19:40:47 UTC
Correction: This is triggered when there is no available Help for that page. You can test with Tools -> Rotating Collections too as this currently has no Help (Bug 13177)
Comment 7 Aleisha Amohia 2015-12-23 19:58:21 UTC
I'm going to add on to this bug - When you click 'Add help' to create a help page where there isn't one, it doesn't open and gives this error: 
edithelp.pl: print() on closed filehandle $fh at /home/vagrant/kohaclone/edithelp.pl line 82
which means the file open is failing