mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
FIX when 2 extra fields are mandatory in 2 different entities
This commit is contained in:
@@ -4997,7 +4997,10 @@ abstract class CommonObject
|
||||
{
|
||||
foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval)
|
||||
{
|
||||
$sql.=",".$tmpkey;
|
||||
if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
|
||||
{
|
||||
$sql.=",".$tmpkey;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= ") VALUES (".$this->id;
|
||||
@@ -5023,8 +5026,11 @@ abstract class CommonObject
|
||||
{
|
||||
foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval)
|
||||
{
|
||||
if (in_array($tmpval, array('int', 'double'))) $sql.=", 0";
|
||||
else $sql.=", ''";
|
||||
if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
|
||||
{
|
||||
if (in_array($tmpval, array('int', 'double'))) $sql.=", 0";
|
||||
else $sql.=", ''";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user