From 946f4e910e9450ac13ef98e1418819aa7821c790 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 3 Dec 2014 14:21:16 -0500 Subject: [PATCH] LP#1198465 Allow null fields to stay null in to_fieldmapper() In CDBI.pm, we can convert DB objects to Fieldmapper objects using to_fieldmapper(). Part of the conversion was forcing stringification, which does what we need for nested objects, but also converts 'nulls' (undefineds) to 'empty' values. This causes problems when trying to write these Fieldmapper objects back to the DB using cstore (or the like). This commit simply lets undefined values stay that way, which in turn prevents NULLs from trying to become empty strings in the DB. Signed-off-by: Dan Wells --- Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm index c3a0cf027a..d8391b8edc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm @@ -178,7 +178,7 @@ sub to_fieldmapper { if (ref($obj)) { for my $field ( $fm->real_fields ) { - $fm->$field( ''.$obj->$field ); + $fm->$field( ''.$obj->$field ) if defined $obj->$field; } } -- 2.11.0