Merge pull request #13669 from pstructures/new-devlelop

Add default values to extrafields
This commit is contained in:
Laurent Destailleur 2020-04-22 01:06:04 +02:00 committed by GitHub
commit 2541d41809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7117,6 +7117,13 @@ abstract class CommonObject
{
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix, 'alpha', 3)) : $this->array_options['options_'.$key];
}
// HTML, select, integer and text add default value
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];
else $value = $this->array_options['options_'.$key];
}
$labeltoshow = $langs->trans($label);
$helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]);