Bug 8175 - check logs error or displays incorrectly in details.pl
authorMark Tompsett <mtompset@hotmail.com>
Sun, 2 Sep 2012 12:46:03 +0000 (20:46 +0800)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 12 Oct 2012 19:25:45 +0000 (21:25 +0200)
commitb8f4b1fa146650fc9ff6c47be80e1f5a34863a9f
treea15adb122c4b3111996c6e91191b00638aac73d4
parentcaec1ddfa48b3bf8581b27dc45cba404a47d4a27
Bug 8175 - check logs error or displays incorrectly in details.pl

Changed "$item->{'materials'} ne ''" to
"defined($item->{'materials'}) && $item->{'materials'} =~ /\S/"
in if condition to prevent error when it is NULL, and to
properly capture the intent of printing if there is something
visible.

Cases tested include NULL, '0', '', ' ', and 'blah' by using
 UPDATE items SET materials=NULL where biblionumber=19158;
where the biblionumber was chosen randomly, because only NULL
was in the items.materials field. The NULL case triggers an
error, but it does display correctly.

The ' ' case displays an apparently empty column, which does not
seem to be the intent of the flag that is being set. This is why
a simple $var check is not sufficient.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
catalogue/detail.pl