mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 14:33:49 +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
|
@ -234,9 +234,10 @@ $GLOBALS['LSobjects']['LSpeople'] = array (
|
|||
'required' => 1,
|
||||
'default_value' => 'toto',
|
||||
'check_data' => array (
|
||||
'alphanumeric' => array(
|
||||
'msg' => 'The first name must contain alphanumeric values only.'
|
||||
),
|
||||
'alphanumeric' => array(
|
||||
'params' => array('with_accents' => true),
|
||||
'msg' => 'The first name must contain alphanumeric values only.'
|
||||
),
|
||||
),
|
||||
'rights' => array(
|
||||
'self' => 'r',
|
||||
|
|
|
@ -37,9 +37,17 @@ class LSformRule_alphanumeric extends LSformRule {
|
|||
* @return boolean true si la valeur est valide, false sinon
|
||||
*/
|
||||
function validate ($value,$options=array(),$formElement) {
|
||||
$regex = '/^[a-zA-Z0-9]+$/';
|
||||
LSsession :: loadLSclass('LSformRule_regex');
|
||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||
|
||||
|
||||
if (isset($options['params']['with_accents']) && $options['params']['with_accents'] == true){
|
||||
$regex = '/^[a-zA-Z0-9àâäéèêëîïôöù]+$/';
|
||||
}
|
||||
else {
|
||||
$regex = '/^[a-zA-Z0-9]+$/';
|
||||
}
|
||||
LSsession :: loadLSclass('LSformRule_regex');
|
||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue