FIX extrafield required error after submit
This commit is contained in:
parent
23accef5c2
commit
496150d747
@ -1147,7 +1147,7 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
$out .= '<option value=""> </option>';
|
$out .= '<option value="0"> </option>';
|
||||||
foreach ($param['options'] as $key => $val)
|
foreach ($param['options'] as $key => $val)
|
||||||
{
|
{
|
||||||
if ((string) $key == '') continue;
|
if ((string) $key == '') continue;
|
||||||
@ -1258,7 +1258,7 @@ class ExtraFields
|
|||||||
dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
|
dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$out .= '<option value=""> </option>';
|
$out .= '<option value="0"> </option>';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
@ -1323,7 +1323,7 @@ class ExtraFields
|
|||||||
} else {
|
} else {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
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);
|
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||||
$out .= '<option value=""> </option>';
|
$out .= '<option value="0"> </option>';
|
||||||
foreach ($data as $data_key => $data_value) {
|
foreach ($data as $data_key => $data_value) {
|
||||||
$out .= '<option value="' . $data_key . '"';
|
$out .= '<option value="' . $data_key . '"';
|
||||||
$out .= ($value == $data_key ? ' selected' : '');
|
$out .= ($value == $data_key ? ' selected' : '');
|
||||||
@ -2008,8 +2008,8 @@ 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]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|
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]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|
|| (! 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])))
|
|| (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];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user