FIX when 2 extra fields are mandatory in 2 different entities
This commit is contained in:
parent
032aa869e4
commit
a1fe1bb58c
@ -4997,7 +4997,10 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval)
|
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;
|
$sql .= ") VALUES (".$this->id;
|
||||||
@ -5023,8 +5026,11 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval)
|
foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval)
|
||||||
{
|
{
|
||||||
if (in_array($tmpval, array('int', 'double'))) $sql.=", 0";
|
if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
|
||||||
else $sql.=", ''";
|
{
|
||||||
|
if (in_array($tmpval, array('int', 'double'))) $sql.=", 0";
|
||||||
|
else $sql.=", ''";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -796,7 +796,7 @@ class ExtraFields
|
|||||||
{
|
{
|
||||||
if ($tab->entity != 0 && $tab->entity != $conf->entity)
|
if ($tab->entity != 0 && $tab->entity != $conf->entity)
|
||||||
{
|
{
|
||||||
// This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field
|
// This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field without default value
|
||||||
if ($tab->fieldrequired && is_null($tab->fielddefault))
|
if ($tab->fieldrequired && is_null($tab->fielddefault))
|
||||||
{
|
{
|
||||||
$this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type;
|
$this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user