Bug 15822: Fix 500 error when searching if items.onloan=0000-00-00
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 23 Nov 2016 10:06:04 +0000 (10:06 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 9 Dec 2016 16:22:10 +0000 (16:22 +0000)
commit167c74bfd386287783e101989b804077b1020369
tree6a8ab8f70d75252b38fc4756a71f0aefb2030f03
parent32354d8322afd05704d87cb38d9bc032ce8c4ec1
Bug 15822: Fix 500 error when searching if items.onloan=0000-00-00

The calls
  output_pref({ dt => dt_from_string( $date ) })
are wrong and should be replaced with
  output_pref({ str => $date })
For better error handling.

Here we fix the problem of items.onloan when searching

Test plan:
- Set items.onloan=0000-00-00 (UPDATE items SET onloan='0000-00-00')
This can come from old data or bad migration
- Execute a search
=> Without this patch you get
Can't locate object method "ymd" via package "dateonly" (perhaps you forgot to load "dateonly"?) at /home/vagrant/kohaclone/Koha/DateUtils.pm line 225.
=> With this patch you won't get the error

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Search.pm