FIX: commonobject: don't require notnull field if default set
This commit is contained in:
parent
1dc466e1fb
commit
893ce55852
@ -62,7 +62,7 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
|||||||
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
|
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
|
||||||
|
|
||||||
$object->$key=$value;
|
$object->$key=$value;
|
||||||
if ($val['notnull'] > 0 && $object->$key == '')
|
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
||||||
@ -117,7 +117,7 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
|||||||
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
|
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
|
||||||
|
|
||||||
$object->$key=$value;
|
$object->$key=$value;
|
||||||
if ($val['notnull'] > 0 && $object->$key == '')
|
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
||||||
|
|||||||
@ -6278,7 +6278,7 @@ abstract class CommonObject
|
|||||||
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
|
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
|
||||||
|
|
||||||
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
|
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
|
||||||
if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]))
|
if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default']))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user