diff --git a/core/module/user/user.php b/core/module/user/user.php index 838d7f1a..4288af48 100755 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -598,37 +598,21 @@ class user extends common { // Traitement des données foreach($csv as $item ) { // Données valides - //if( array_key_exists('id', $item) - if( array_key_exists('prenom',$item) + if( array_key_exists('id', $item) + AND array_key_exists('prenom',$item) AND array_key_exists('nom',$item) - //AND array_key_exists('groupe',$item) + AND array_key_exists('groupe',$item) AND array_key_exists('email',$item) AND $item['nom'] AND $item['prenom'] - //AND $item['id'] + AND $item['id'] AND $item['email'] - //AND $item['groupe'] + AND $item['groupe'] ) { - if ( !array_key_exists('id', $item)) { - // Génération de l'identifiant à partir des deux premières lettres du prénom et du nom - $item['id'] = substr($item['prenom'],0,3) . substr($item['nom'],0,3); - } - - // Validation du groupe ou groupe inexistant valant 1 (membre) - if ( !array_key_exists('groupe',$item)) { - // Définition du groupe (membre) - $item['groupe'] = 1; - } else { - - $item['groupe'] = (int) $item['groupe']; - $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) - ? $item['groupe'] : 1; - } - // Suppression d'espaces éventuels au début ou à la fin - $item['email'] = str_replace(' ', '', $item['email']); - $item['id'] = str_replace(' ', '', $item['id']); - $item['groupe'] = str_replace(' ', '', $item['groupe']); - + // Validation du groupe + $item['groupe'] = (int) $item['groupe']; + $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) + ? $item['groupe'] : 1; // L'utilisateur existe if ( $this->getData(['user',helper::filter($item['id'] , helper::FILTER_ID)])) {