Fix default value on extrafields
This commit is contained in:
parent
47c0231fb8
commit
e23a88732e
@ -4594,23 +4594,28 @@ abstract class CommonObject
|
|||||||
}else {
|
}else {
|
||||||
$colspan='3';
|
$colspan='3';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case "view":
|
case "view":
|
||||||
$value=$this->array_options["options_".$key];
|
$value=$this->array_options["options_".$key];
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
if (isset($_POST["options_" . $key])) {
|
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
|
||||||
if (is_array($_POST["options_" . $key])) {
|
$getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values.
|
||||||
// $_POST["options"] is an array but following code expects a comma separated string
|
if (isset($getposttemp)) {
|
||||||
$value = implode(",", $_POST["options_" . $key]);
|
if (is_array($getposttemp)) {
|
||||||
|
// $getposttemp is an array but following code expects a comma separated string
|
||||||
|
$value = implode(",", $getposttemp);
|
||||||
} else {
|
} else {
|
||||||
$value = $_POST["options_" . $key];
|
$value = $getposttemp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$value = $this->array_options["options_" . $key];
|
$value = $this->array_options["options_" . $key]; // No GET, no POST, no default value, so we take value of object.
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//var_dump($value);
|
||||||
|
|
||||||
if ($extrafields->attribute_type[$key] == 'separate')
|
if ($extrafields->attribute_type[$key] == 'separate')
|
||||||
{
|
{
|
||||||
$out .= $extrafields->showSeparator($key);
|
$out .= $extrafields->showSeparator($key);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user