[Koha-bugs] [Bug 17502] Problems with 0000-00-00
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Oct 27 14:42:18 CEST 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17502
--- Comment #2 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Created attachment 56917
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=56917&action=edit
Bug 17502: Resolve internal server error on 0000-00-00 (with Plack)
This patch makes the following changes:
[1] In Koha/DateUtils.pm, sub output_pref:
Add a test if $dt is really a DateTime before calling method ymd.
Preventing a crash like:
Can't locate object method "ymd" via package "dateonly"
Change [2] fixes a specific call where this went wrong, but this test
may still catch one or two other occurrences in the code.
[2] In C4/Search.pm, sub searchResults:
Scalarize the return value of dt_from_string as a hash parameter for
output_pref. Like:
{ dt => scalar dt_from_string( $date ), dateonly => 1 }
If the sub would return undef (without adding scalar), the hash would
have an odd number of elements. (A warning is suppressed in C4/Search.)
For a value of 0000-00-00 in item.onloan, this resolves an internal
server error on a search with this item in the results.
[3] Adds a few unit tests in t/DateUtils.t.
Note: I opened up another report to prevent having 000-00-00 in item dates.
Test plan:
[1] Without this patch: Put a 0000-00-00 in items.onloan for one item.
(Make 952 $q visible and just enter some text in it.)
[2] Verify that a search on opac/intranet that includes this item, results
in a crash. (Plack will just say: Internal server error.)
NOTE: With Jessie and Plack, the search crashes. On a Wheezy without
Plack, it did not crash.
[3] Apply this patch. (Restart Plack.)
[4] Verify that the same search now does not fail.
[5] Run the adjusted unit test t/DateUtils.t
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list