Merge pull request #15011 from bafbes/abb120348

fix:boolean values in showinputfield function are 1 and 0 not 'on' and 'off'
This commit is contained in:
Laurent Destailleur 2020-10-14 17:18:02 +02:00 committed by GitHub
commit 820bf5b393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,7 @@ 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) == 'on' ? 1 : 0);
$value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
} else {
$value = GETPOST($key, 'alphanohtml');
}