dblayeroo: verify foreign keys are skipped if update and the value is not provided

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3793 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-06-30 09:31:49 +00:00
parent 5927bf7f06
commit 83955b2028

View File

@@ -2532,7 +2532,7 @@ class dblayeroo
// Do not test in update if the field is not provided as it was already
// recorded
if ($update === true && ! array_key_exists ($field, $values))
continue;
continue 2;
if (! array_key_exists ($field, $values))
{
$errors[$field] = sprintf (dgettext ("domframework",
@@ -2554,7 +2554,12 @@ class dblayeroo
$objTmp->displayAdd ($objTmp->primary);
$parentField = explode (",", $params[1]);
foreach (explode (",", $fields) as $key=>$field)
{
if (! key_exists ($field, $values))
$this->DBException (sprintf (dgettext ("domframework",
"Can't check the foreign value for '%s': not provided"), $field));
$objTmp->whereAdd ($parentField[$key], "=", $values[$field]);
}
if (count ($objTmp->execute ()) === 0)
$errors[$field] = sprintf (dgettext ("domframework",
"The value of the foreign key '%s' doesn't exists in foreign table"),