From ca79fba39096ee78b915579a5692a08b355a0375 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 1 Aug 2017 08:54:55 +0000 Subject: [PATCH] dblayeroo: insert/update null are not checked against the field format dblayeroo: insert/update null are checked against the "NOT NULL" definition git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3854 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dblayeroo.php b/dblayeroo.php index 56bb72c..d7755ea 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -2514,10 +2514,21 @@ class dblayeroo "Field '%s' mandatory and not provided"), $field); continue; } + if (in_array ("not null", $params) && + $values[$field] === null) + { + $errors[$field] = sprintf (dgettext ("domframework", + "Field '%s' null and defined as not null")); + continue; + } if (! is_string ($values[$field]) && ! is_integer ($values[$field]) && ! is_null ($values[$field])) $errors[$field] = sprintf (dgettext ("domframework", "Field '%s' not a string nor a integer"), $field); + // Do not check the format if the value to store is null. It will never + // matche any format. + if ($values[$field] === null) + continue; switch ($this->fieldTypeLight ($field)) { case "integer":