https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17502
--- Comment #1 from Marcel de Rooy <m.de.r...@rijksmuseum.nl> --- Created attachment 56916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=56916&action=edit Bug 17502: Resolve internal server error on 0000-00-00 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.) [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. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/