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:
@@ -2514,10 +2514,21 @@ class dblayeroo
|
|||||||
"Field '%s' mandatory and not provided"), $field);
|
"Field '%s' mandatory and not provided"), $field);
|
||||||
continue;
|
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]) &&
|
if (! is_string ($values[$field]) && ! is_integer ($values[$field]) &&
|
||||||
! is_null ($values[$field]))
|
! is_null ($values[$field]))
|
||||||
$errors[$field] = sprintf (dgettext ("domframework",
|
$errors[$field] = sprintf (dgettext ("domframework",
|
||||||
"Field '%s' not a string nor a integer"), $field);
|
"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))
|
switch ($this->fieldTypeLight ($field))
|
||||||
{
|
{
|
||||||
case "integer":
|
case "integer":
|
||||||
|
|||||||
Reference in New Issue
Block a user