FIX input field of extrafields must keep data if form submit fails.

This commit is contained in:
Laurent Destailleur 2020-08-03 12:31:30 +02:00
parent 576363f353
commit c2bb0431f0

View File

@ -7048,7 +7048,7 @@ abstract class CommonObject
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
{ {
$out .= "\n"; $out .= "\n";
$out .= '<!-- showOptionalsInput --> '; $out .= '<!-- showOptionals --> ';
$out .= "\n"; $out .= "\n";
$extrafields_collapse_num = ''; $extrafields_collapse_num = '';
@ -7186,7 +7186,7 @@ abstract class CommonObject
// HTML, select, integer and text add default value // HTML, select, integer and text add default value
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int'))) if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
{ {
if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key]; if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
else $value = $this->array_options['options_'.$key]; else $value = $this->array_options['options_'.$key];
} }
@ -7270,7 +7270,7 @@ abstract class CommonObject
setListDependencies(); setListDependencies();
}); });
</script>'."\n"; </script>'."\n";
$out .= '<!-- /showOptionalsInput --> '."\n"; $out .= '<!-- /showOptionals --> '."\n";
} }
} }
return $out; return $out;