Merge pull request #14656 from OPEN-DSI/v10-fix-extrafields-select-required
FIX no empty value in required extrafield
This commit is contained in:
commit
377c44eeab
@ -1147,7 +1147,7 @@ class ExtraFields
|
||||
}
|
||||
|
||||
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out.='<option value="0"> </option>';
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val)
|
||||
{
|
||||
if ((string) $key == '') continue;
|
||||
@ -1258,7 +1258,7 @@ class ExtraFields
|
||||
dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
$out .= '<option value="0"> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
@ -1323,7 +1323,7 @@ class ExtraFields
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||
$out .= '<option value="0"> </option>';
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($data as $data_key => $data_value) {
|
||||
$out .= '<option value="' . $data_key . '"';
|
||||
$out .= ($value == $data_key ? ' selected' : '');
|
||||
@ -2008,8 +2008,8 @@ class ExtraFields
|
||||
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
|
||||
{
|
||||
// Check if empty without using GETPOST, value can be alpha, int, array, etc...
|
||||
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]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|
||||
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && !in_array($this->attributes[$object->table_element]['type'][$key], array('select', 'sellist')) && $_POST["options_".$key] != '0')
|
||||
|| (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && in_array($this->attributes[$object->table_element]['type'][$key], array('select', 'sellist')))
|
||||
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
|
||||
{
|
||||
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user