Bug 14580

Summary: Warn when accessing Help from error pages
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: Staff interfaceAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: cnorthcott.work, gmcharlt, jonathan.druart, joonas.kylmala, veron
Version: master   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14681
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14580: Silencing warn triggered when accessing Help from an error page

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 Joonas Kylmälä 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
Comment 8 Aleisha Amohia 2020-02-09 22:03:17 UTC
Looks like this has been fixed in master by redirecting to the manual.