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
This commit is contained in:
2017-08-01 08:54:55 +00:00
parent c63a30eebf
commit ca79fba390

View File

@@ -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":