From 9a47e3867c81b0a78c1367971350df885656aa5d Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 4 May 2017 14:22:47 +0000 Subject: [PATCH] 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 --- dblayeroo.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dblayeroo.php b/dblayeroo.php index 92c269c..11650ba 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -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'"),