new:handle new type reference in add and update actions

This commit is contained in:
bahfir abbes 2020-10-15 01:15:45 +01:00
parent 9cc8e6ac99
commit db5292e647

View File

@ -74,7 +74,9 @@ if ($action == 'add' && !empty($permissiontoadd))
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
$value = (GETPOST($key) == '1' ? 1 : 0);
} elseif ($object->fields[$key]['type'] == 'reference') {
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
} else {
$value = GETPOST($key, 'alphanohtml');
}
@ -161,7 +163,9 @@ if ($action == 'update' && !empty($permissiontoadd))
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
$value = (GETPOST($key) == '1' ? 1 : 0);
} elseif ($object->fields[$key]['type'] == 'reference') {
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
} else {
$value = GETPOST($key, 'alpha');
}