Fix backport fix not checking mandatory extrafields of type select
This commit is contained in:
parent
5f7b09c97f
commit
918f476c2b
@ -1830,7 +1830,7 @@ class ExtraFields
|
|||||||
function setOptionalsFromPost($extralabels, &$object, $onlykey='')
|
function setOptionalsFromPost($extralabels, &$object, $onlykey='')
|
||||||
{
|
{
|
||||||
global $_POST, $langs;
|
global $_POST, $langs;
|
||||||
$nofillrequired='';// For error when required field left blank
|
$nofillrequired=0;// For error when required field left blank
|
||||||
$error_field_required = array();
|
$error_field_required = array();
|
||||||
|
|
||||||
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
|
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
|
||||||
@ -1861,8 +1861,9 @@ class ExtraFields
|
|||||||
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
|
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
|
||||||
{
|
{
|
||||||
// Check if empty without using GETPOST, value can be alpha, int, array, etc...
|
// Check if empty without using GETPOST, value can be alpha, int, array, etc...
|
||||||
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0')
|
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|
||||||
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
|
|| (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|
||||||
|
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
|
||||||
{
|
{
|
||||||
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
|
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
|
||||||
$nofillrequired++;
|
$nofillrequired++;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user