dblayeroo: do not test the foreign keys in update mode if the value is not provided
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3574 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -2340,10 +2340,17 @@ class dblayeroo
|
||||
// - If foreign keys, check if the value is set in the constraint
|
||||
foreach ($this->foreign as $field=>$params)
|
||||
{
|
||||
// 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;
|
||||
if (! array_key_exists ($field, $values))
|
||||
{
|
||||
$errors[$field] = sprintf (dgettext ("domframework",
|
||||
"The field '%s' must be test on foreign, but is not provided"),
|
||||
$field);
|
||||
continue;
|
||||
}
|
||||
if (! array_key_exists ($params[0], $this->setForeignObj))
|
||||
$this->DBException (sprintf (dgettext ("domframework",
|
||||
"No foreign object configured to test the foreign key for table '%s'"),
|
||||
|
||||
Reference in New Issue
Block a user