Merge pull request #4 from pstructures/pstructures-boolean-addupdatedelete
Added Boolean Support
This commit is contained in:
commit
7f05f35993
@ -75,6 +75,8 @@ if ($action == 'add' && !empty($permissiontoadd))
|
|||||||
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
|
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
|
||||||
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
||||||
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
||||||
|
} elseif ($object->fields[$key]['type'] == 'boolean') {
|
||||||
|
$value = (GETPOST($key) == 'on' ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
$value = GETPOST($key, 'alphanohtml');
|
$value = GETPOST($key, 'alphanohtml');
|
||||||
}
|
}
|
||||||
@ -156,6 +158,8 @@ if ($action == 'update' && !empty($permissiontoadd))
|
|||||||
}
|
}
|
||||||
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
||||||
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
||||||
|
} elseif ($object->fields[$key]['type'] == 'boolean') {
|
||||||
|
$value = (GETPOST($key) == 'on' ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
$value = GETPOST($key, 'alpha');
|
$value = GETPOST($key, 'alpha');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user