Bug 16430

Summary: Mainpage.pl dies if library is not set
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: Architecture, internals, and plumbingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: blocker    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 16430 - Mainpage.pl dies if library is not set
Bug 16430 - Mainpage.pl dies if library is not set

Description Kyle M Hall (khall) 2016-05-03 12:56:53 UTC
On a fresh install of Koha, logging in I was met with:

Invalid dateformat parameter () at /home/vagrant/kohaclone/Koha/DateUtils.pm line 112.

It appears that if the library is not set, you get this message on mainpage.pl. Needless to say, this adds difficulty in setting up a fresh install of Koha!
Comment 1 Kyle M Hall (khall) 2016-05-03 12:58:50 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall (khall) 2016-05-03 13:04:58 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall (khall) 2016-05-03 13:07:51 UTC
On further testing, I think this may be a much deeper problem than this.
Comment 4 Kyle M Hall (khall) 2016-05-03 13:16:35 UTC
The root case is a change in dt_from_string:

$date_format = C4::Context->preference('dateformat') unless $date_format;

This line means that if the caller does not pass a format, the native preferred format is assumed. When not logged in, $date_format will be empty and cause an error. There are also many calls to dt_from_string where no format is passed which will cause other errors.
Comment 5 Jonathan Druart 2016-05-03 13:25:11 UTC
I'd keep the die, to catch next issues of the same kind.
Comment 6 Jonathan Druart 2016-05-03 14:32:06 UTC
I do not recreate, did you fix the sysprefs.sql file before? See bug 16418
Comment 7 Jonathan Druart 2016-11-10 08:55:55 UTC
This one was invalid, it was caused by a syntax error in sysprefs.sql