mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-16 15:33:02 +01:00
Add with_accents parameter to LSformRule_alphanumeric and set config.LSobjects.LSpeople to use it
This commit is contained in:
parent
3ed59a28bd
commit
ebf26c4591
2 changed files with 15 additions and 6 deletions
|
@ -235,6 +235,7 @@ $GLOBALS['LSobjects']['LSpeople'] = array (
|
||||||
'default_value' => 'toto',
|
'default_value' => 'toto',
|
||||||
'check_data' => array (
|
'check_data' => array (
|
||||||
'alphanumeric' => array(
|
'alphanumeric' => array(
|
||||||
|
'params' => array('with_accents' => true),
|
||||||
'msg' => 'The first name must contain alphanumeric values only.'
|
'msg' => 'The first name must contain alphanumeric values only.'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -37,9 +37,17 @@ class LSformRule_alphanumeric extends LSformRule {
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
function validate ($value,$options=array(),$formElement) {
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($options['params']['with_accents']) && $options['params']['with_accents'] == true){
|
||||||
|
$regex = '/^[a-zA-Z0-9àâäéèêëîïôöù]+$/';
|
||||||
|
}
|
||||||
|
else {
|
||||||
$regex = '/^[a-zA-Z0-9]+$/';
|
$regex = '/^[a-zA-Z0-9]+$/';
|
||||||
|
}
|
||||||
LSsession :: loadLSclass('LSformRule_regex');
|
LSsession :: loadLSclass('LSformRule_regex');
|
||||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue