diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 97901def506574b870f322afe8b5a7841dc1d356..9719223b40788e07b59275fd2989ac7f92d0d638 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -25,7 +25,7 @@
 /**
  *  \file       htdocs/user/class/user.class.php
  *  \brief      Fichier de la classe utilisateur
- *  \version    $Id: user.class.php,v 1.44 2011/07/04 11:41:02 eldy Exp $
+ *  \version    $Id: user.class.php,v 1.45 2011/07/08 18:49:16 eldy Exp $
  */
 
 require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -99,8 +99,8 @@ class User extends CommonObject
 
 
 	/**
-	 *    Constructeur de la classe
-	 *    @param  DB         Handler acces base de donnees
+	 *    Constructor de la classe
+	 *    @param   DoliDb  $DB     Database handler
 	 */
 	function User($DB)
 	{
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 51ba9f3efabd9097636f5700d1237130bbd4c041..95ff706a916bc977d16e18866251e84b9cda5c7f 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -22,7 +22,7 @@
  *	 \file       htdocs/user/class/usergroup.class.php
  *	 \brief      Fichier de la classe des groupes d'utilisateur
  *	 \author     Rodolphe Qiedeville
- *	 \version    $Id: usergroup.class.php,v 1.10 2011/07/04 11:41:04 eldy Exp $
+ *	 \version    $Id: usergroup.class.php,v 1.11 2011/07/08 18:49:16 eldy Exp $
  */
 
 require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@@ -55,8 +55,8 @@ class UserGroup extends CommonObject
 
 
 	/**
-	 *    Constructor
-	 *    @param  DB         Handler acces base de donnees
+     *    Constructor de la classe
+     *    @param   DoliDb  $DB     Database handler
 	 */
 	function UserGroup($DB)
 	{
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index 956c98924f0670b889e96a91f2b7c74148c1c6c7..7ca187da7a770d2a97685c42742a97e4c44b67ec 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -24,7 +24,7 @@
 /**
  *       \file       htdocs/user/fiche.php
  *       \brief      Tab of user card
- *       \version    $Id: fiche.php,v 1.273 2011/06/29 10:23:33 eldy Exp $
+ *       \version    $Id: fiche.php,v 1.274 2011/07/08 18:49:17 eldy Exp $
  */
 
 require("../main.inc.php");
@@ -215,7 +215,7 @@ if ($_POST["action"] == 'add' && $canadduser)
         {
             $langs->load("errors");
             $db->rollback();
-            if (is_array($edituser->errors) && sizeof($edituser->errors)) $message='<div class="error">'.join('<br>',$langs->trans($edituser->errors)).'</div>';
+            if (is_array($edituser->errors) && count($edituser->errors)) $message='<div class="error">'.join('<br>',$langs->trans($edituser->errors)).'</div>';
             else $message='<div class="error">'.$langs->trans($edituser->error).'</div>';
             $action="create";       // Go back to create page
         }
@@ -308,7 +308,7 @@ if ($action == 'update' && ! $_POST["cancel"])
                 }
             }
 
-            if ($ret >=0 && ! sizeof($edituser->errors))
+            if ($ret >=0 && ! count($edituser->errors))
             {
                 if (GETPOST('deletephoto') && $edituser->photo)
                 {
@@ -347,7 +347,7 @@ if ($action == 'update' && ! $_POST["cancel"])
                 }
             }
 
-            if ($ret >= 0 && ! sizeof($edituser->errors))
+            if ($ret >= 0 && ! count($edituser->errors))
             {
                 $message.='<div class="ok">'.$langs->trans("UserModified").'</div>';
                 $db->commit();
@@ -825,7 +825,7 @@ else
                 $statutUACF = '';
 
                 //On verifie les options du compte
-                if (sizeof($ldap->uacf) > 0)
+                if (count($ldap->uacf) > 0)
                 {
                     foreach ($ldap->uacf as $key => $statut)
                     {
@@ -1609,7 +1609,7 @@ else
                     {
                         $contact = new Contact($db);
                         $contact->fetch($fuser->contact_id);
-                        print ' / '.'<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'</a>';
+                        print ' / <a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'</a>';
                     }
                 }
                 else
@@ -1660,9 +1660,18 @@ else
 
 $db->close();
 
-function dolValidElement($element) {
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.274 $');
+
+
+
+/**
+ * Return if var element is ok
+ * @param   string      $element    Variable to check
+ * @return  boolean                 Return true of variable is not empty
+ */
+function dolValidElement($element)
+{
     return (trim($element) != '');
 }
 
-llxFooter('$Date: 2011/06/29 10:23:33 $ - $Revision: 1.273 $');
 ?>
diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php
index eb159fd4a80ad0564b3c3fa719648261a52b48bc..61c873a23b52b503fef7fd291d31f8274d3f0bca 100644
--- a/htdocs/user/group/fiche.php
+++ b/htdocs/user/group/fiche.php
@@ -21,7 +21,7 @@
 /**
  *       \file       htdocs/user/group/fiche.php
  *       \brief      Onglet groupes utilisateurs
- *       \version    $Id$
+ *       \version    $Id: fiche.php,v 1.68 2011/07/08 18:49:17 eldy Exp $
  */
 
 require("../../main.inc.php");
@@ -35,9 +35,9 @@ $candisableperms=($user->admin || $user->rights->user->user->supprimer);
 // Advanced permissions
 if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
 {
-	$canreadperms=($user->admin || $user->rights->user->group_advance->read);
-	$caneditperms=($user->admin || $user->rights->user->group_advance->write);
-	$candisableperms=($user->admin || $user->rights->user->group_advance->delete);
+    $canreadperms=($user->admin || $user->rights->user->group_advance->read);
+    $caneditperms=($user->admin || $user->rights->user->group_advance->write);
+    $candisableperms=($user->admin || $user->rights->user->group_advance->delete);
 }
 
 $langs->load("users");
@@ -58,17 +58,17 @@ $object = new Usergroup($db);
  */
 if ($action == 'confirm_delete' && $confirm == "yes")
 {
-	if ($caneditperms)
-	{
-		$object->fetch($_GET["id"]);
-		$object->delete();
-		Header("Location: index.php");
-		exit;
-	}
-	else
-	{
-		$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
-	}
+    if ($caneditperms)
+    {
+        $object->fetch($_GET["id"]);
+        $object->delete();
+        Header("Location: index.php");
+        exit;
+    }
+    else
+    {
+        $message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
+    }
 }
 
 /**
@@ -76,114 +76,114 @@ if ($action == 'confirm_delete' && $confirm == "yes")
  */
 if ($_POST["action"] == 'add')
 {
-	if($caneditperms)
-	{
-		$message="";
-		if (! $_POST["nom"])
-		{
-			$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
-			$action="create";       // Go back to create page
-		}
-
-		if (! $message)
-		{
-			$object->nom			= trim($_POST["nom"]);
-			$object->globalgroup	= $_POST["globalgroup"];
-			$object->note		= trim($_POST["note"]);
-
-			$db->begin();
-
-			$id = $object->create();
-
-			if ($id > 0)
-			{
-				$db->commit();
-
-				Header("Location: fiche.php?id=".$object->id);
-				exit;
-			}
-			else
-			{
-				$db->rollback();
-
-				$langs->load("errors");
-				$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'</div>';
-				$action="create";       // Go back to create page
-			}
-		}
-	}
-	else
-	{
-		$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
-	}
+    if($caneditperms)
+    {
+        $message="";
+        if (! $_POST["nom"])
+        {
+            $message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
+            $action="create";       // Go back to create page
+        }
+
+        if (! $message)
+        {
+            $object->nom			= trim($_POST["nom"]);
+            $object->globalgroup	= $_POST["globalgroup"];
+            $object->note		= trim($_POST["note"]);
+
+            $db->begin();
+
+            $id = $object->create();
+
+            if ($id > 0)
+            {
+                $db->commit();
+
+                Header("Location: fiche.php?id=".$object->id);
+                exit;
+            }
+            else
+            {
+                $db->rollback();
+
+                $langs->load("errors");
+                $message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'</div>';
+                $action="create";       // Go back to create page
+            }
+        }
+    }
+    else
+    {
+        $message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
+    }
 }
 
 // Add/Remove user into group
 if ($action == 'adduser' || $action =='removeuser')
 {
-	if ($caneditperms)
-	{
-		if ($userid)
-		{
-			$object->fetch($_GET["id"]);
-			$object->oldcopy=dol_clone($object);
-
-			$edituser = new User($db);
-			$edituser->fetch($userid);
-			if ($action == 'adduser')    $result=$edituser->SetInGroup($object->id,GETPOST('entity'));
-			if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,GETPOST('entity'));
-
-			if ($result > 0)
-			{
-				header("Location: fiche.php?id=".$object->id);
-				exit;
-			}
-			else
-			{
-				$message.=$edituser->error;
-			}
-		}
-	}
-	else
-	{
-		$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
-	}
+    if ($caneditperms)
+    {
+        if ($userid)
+        {
+            $object->fetch($_GET["id"]);
+            $object->oldcopy=dol_clone($object);
+
+            $edituser = new User($db);
+            $edituser->fetch($userid);
+            if ($action == 'adduser')    $result=$edituser->SetInGroup($object->id,GETPOST('entity'));
+            if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,GETPOST('entity'));
+
+            if ($result > 0)
+            {
+                header("Location: fiche.php?id=".$object->id);
+                exit;
+            }
+            else
+            {
+                $message.=$edituser->error;
+            }
+        }
+    }
+    else
+    {
+        $message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
+    }
 }
 
 
 if ($_POST["action"] == 'update')
 {
-	if($caneditperms)
-	{
-		$message="";
-
-		$db->begin();
-
-		$object->fetch($_GET["id"]);
-
-		$object->oldcopy=dol_clone($object);
-
-		$object->nom			= trim($_POST["group"]);
-		$object->globalgroup	= $_POST["globalgroup"];
-		$object->note		= dol_htmlcleanlastbr($_POST["note"]);
-
-		$ret=$object->update();
-
-		if ($ret >= 0 && ! sizeof($object->errors))
-		{
-			$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
-			$db->commit();
-		}
-		else
-		{
-			$message.='<div class="error">'.$object->error.'</div>';
-			$db->rollback();
-		}
-	}
-	else
-	{
-		$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
-	}
+    if($caneditperms)
+    {
+        $message="";
+
+        $db->begin();
+
+        $object->fetch($_GET["id"]);
+
+        $object->oldcopy=dol_clone($object);
+
+        $object->nom			= trim($_POST["group"]);
+        $object->globalgroup	= $_POST["globalgroup"];
+        $object->note		= dol_htmlcleanlastbr($_POST["note"]);
+
+        $ret=$object->update();
+
+        if ($ret >= 0 && ! count($object->errors))
+        {
+            $message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
+            $db->commit();
+        }
+        else
+        {
+            $message.='<div class="error">'.$object->error.'</div>';
+            $db->rollback();
+        }
+    }
+    else
+    {
+        $message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
+    }
 }
 
 
@@ -199,51 +199,51 @@ $fuserstatic = new User($db);
 
 if ($action == 'create')
 {
-	print_fiche_titre($langs->trans("NewGroup"));
-
-	if ($message) { print $message."<br>"; }
-
-	print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
-	print '<input type="hidden" name="action" value="add">';
-
-	print '<table class="border" width="100%">';
-
-	print "<tr>".'<td valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
-	print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
-	
-	// Global group
-	if ($conf->multicompany->enabled)
-	{
-		if ($conf->entity == 1)
-		{
-			print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
-			$checked=(empty($_POST['globalgroup']) ? '' : ' checked');
-			print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
-		}
-		else
-		{
-			print '<input type="hidden" name="globalgroup" value="0" />';
-		}
-	}
-
-	print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
-	if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
-	{
-		require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
-		$doleditor=new DolEditor('note','','',240,'dolibarr_notes','',false);
-		$doleditor->Create();
-	}
-	else
-	{
-		print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
-		print '</textarea>';
-	}
-	print "</textarea></td></tr>\n";
-
-	print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></td></tr>';
-	print "</table>\n";
-	print "</form>";
+    print_fiche_titre($langs->trans("NewGroup"));
+
+    if ($message) { print $message."<br>"; }
+
+    print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+    print '<input type="hidden" name="action" value="add">';
+
+    print '<table class="border" width="100%">';
+
+    print "<tr>".'<td valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
+    print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
+
+    // Global group
+    if ($conf->multicompany->enabled)
+    {
+        if ($conf->entity == 1)
+        {
+            print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
+            $checked=(empty($_POST['globalgroup']) ? '' : ' checked');
+            print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
+        }
+        else
+        {
+            print '<input type="hidden" name="globalgroup" value="0" />';
+        }
+    }
+
+    print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
+    if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
+    {
+        require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+        $doleditor=new DolEditor('note','','',240,'dolibarr_notes','',false);
+        $doleditor->Create();
+    }
+    else
+    {
+        print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
+        print '</textarea>';
+    }
+    print "</textarea></td></tr>\n";
+
+    print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></td></tr>';
+    print "</table>\n";
+    print "</form>";
 }
 
 
@@ -254,78 +254,78 @@ if ($action == 'create')
 /* ************************************************************************** */
 else
 {
-	if ($_GET["id"] )
-	{
-		$object->fetch($_GET["id"]);
-
-		/*
-		 * Affichage onglets
-		 */
-		$head = group_prepare_head($object);
-		$title = $langs->trans("Group");
-		dol_fiche_head($head, 'group', $title, 0, 'group');
-
-		/*
-		 * Confirmation suppression
-		 */
-		if ($action == 'delete')
-		{
-			$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1);
-			if ($ret == 'html') print '<br>';
-		}
-
-		/*
-		 * Fiche en mode visu
-		 */
-
-		if ($action != 'edit')
-		{
-			print '<table class="border" width="100%">';
-
-			// Ref
-			print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
-			print '<td colspan="2">';
-			print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
-			print '</td>';
-			print '</tr>';
-
-			// Name
-			print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
-			print '<td width="75%" class="valeur">'.$object->nom;
-			if (empty($object->entity))
-			{
-				print img_redstar($langs->trans("GlobalGroup"));
-			}
-			print "</td></tr>\n";
-
-			// Note
-			print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
-			print '<td class="valeur">'.dol_htmlentitiesbr($object->note).'&nbsp;</td>';
-			print "</tr>\n";
-			print "</table>\n";
-
-			print '</div>';
-
-			/*
-			 * Barre d'actions
-			 */
-			print '<div class="tabsAction">';
-
-			if ($caneditperms)
-			{
-				print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
-			}
-
-			if ($candisableperms)
-			{
-				print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("DeleteGroup").'</a>';
-			}
-
-			print "</div>\n";
-			print "<br>\n";
-
-
-			dol_htmloutput_errors($message);
+    if ($_GET["id"] )
+    {
+        $object->fetch($_GET["id"]);
+
+        /*
+         * Affichage onglets
+         */
+        $head = group_prepare_head($object);
+        $title = $langs->trans("Group");
+        dol_fiche_head($head, 'group', $title, 0, 'group');
+
+        /*
+         * Confirmation suppression
+         */
+        if ($action == 'delete')
+        {
+            $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1);
+            if ($ret == 'html') print '<br>';
+        }
+
+        /*
+         * Fiche en mode visu
+         */
+
+        if ($action != 'edit')
+        {
+            print '<table class="border" width="100%">';
+
+            // Ref
+            print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
+            print '<td colspan="2">';
+            print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
+            print '</td>';
+            print '</tr>';
+
+            // Name
+            print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
+            print '<td width="75%" class="valeur">'.$object->nom;
+            if (empty($object->entity))
+            {
+                print img_redstar($langs->trans("GlobalGroup"));
+            }
+            print "</td></tr>\n";
+
+            // Note
+            print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
+            print '<td class="valeur">'.dol_htmlentitiesbr($object->note).'&nbsp;</td>';
+            print "</tr>\n";
+            print "</table>\n";
+
+            print '</div>';
+
+            /*
+             * Barre d'actions
+             */
+            print '<div class="tabsAction">';
+
+            if ($caneditperms)
+            {
+                print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
+            }
+
+            if ($candisableperms)
+            {
+                print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("DeleteGroup").'</a>';
+            }
+
+            print "</div>\n";
+            print "<br>\n";
+
+
+            dol_htmloutput_errors($message);
 
             /*
              * Liste des utilisateurs dans le groupe
@@ -335,17 +335,17 @@ else
 
             // On selectionne les users qui ne sont pas deja dans le groupe
             $exclude = array();
-            
+
             $userslist = $object->listUsersForGroup();
-            
+
             if (! empty($userslist))
             {
-            	foreach($userslist as $useringroup)
-            	{
-            		$exclude[]=$useringroup->id;
-            	}
+                foreach($userslist as $useringroup)
+                {
+                    $exclude[]=$useringroup->id;
+                }
             }
-            
+
             if ($caneditperms)
             {
                 print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
@@ -378,38 +378,38 @@ else
 
             if (! empty($userslist))
             {
-            	$var=True;
-            	
-            	foreach($userslist as $useringroup)
-            	{
-            		$var=!$var;
-            		
-            		print "<tr $bc[$var]>";
-            		print '<td>';
-            		print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$useringroup->id.'">'.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.'</a>';
-            		if ($useringroup->admin  && ! $useringroup->entity) print img_redstar($langs->trans("SuperAdministrator"));
-            		else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
-            		print '</td>';
-            		print '<td>'.ucfirst(stripslashes($useringroup->lastname)).'</td>';
-            		print '<td>'.ucfirst(stripslashes($useringroup->firstname)).'</td>';
-            		print '<td align="right">'.$useringroup->getLibStatut(5).'</td>';
-            		print '<td>&nbsp;</td>';
-            		print '<td align="right">';
-            		if ($user->admin)
-            		{
-            			print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'&amp;entity='.$useringroup->usergroup_entity.'">';
-            			print img_delete($langs->trans("RemoveFromGroup"));
-            		}
-            		else
-            		{
-            			print "-";
-            		}
-            		print "</td></tr>\n";
-            	}
+                $var=True;
+
+                foreach($userslist as $useringroup)
+                {
+                    $var=!$var;
+
+                    print "<tr $bc[$var]>";
+                    print '<td>';
+                    print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$useringroup->id.'">'.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.'</a>';
+                    if ($useringroup->admin  && ! $useringroup->entity) print img_redstar($langs->trans("SuperAdministrator"));
+                    else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
+                    print '</td>';
+                    print '<td>'.ucfirst(stripslashes($useringroup->lastname)).'</td>';
+                    print '<td>'.ucfirst(stripslashes($useringroup->firstname)).'</td>';
+                    print '<td align="right">'.$useringroup->getLibStatut(5).'</td>';
+                    print '<td>&nbsp;</td>';
+                    print '<td align="right">';
+                    if ($user->admin)
+                    {
+                        print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'&amp;entity='.$useringroup->usergroup_entity.'">';
+                        print img_delete($langs->trans("RemoveFromGroup"));
+                    }
+                    else
+                    {
+                        print "-";
+                    }
+                    print "</td></tr>\n";
+                }
             }
             else
             {
-            	print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
+                print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
             }
             print "</table>";
             print "<br>";
@@ -428,51 +428,51 @@ else
             print '<tr><td width="25%" valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
             print '<td width="75%" class="valeur"><input size="15" type="text" name="group" value="'.$object->nom.'">';
             print "</td></tr>\n";
-            
+
             // Global group
             if ($conf->multicompany->enabled)
             {
-            	if ($conf->entity == 1)
-            	{
-            		print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
-		            $checked=(empty($object->entity) ? ' checked' : '');
-					print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
-            	}
-            	else
-            	{
-            		$value=(empty($object->entity) ? 1 : 0);
-            		print '<input type="hidden" name="globalgroup" value="'.$value.'" />';
-            	}
+                if ($conf->entity == 1)
+                {
+                    print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
+                    $checked=(empty($object->entity) ? ' checked' : '');
+                    print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
+                }
+                else
+                {
+                    $value=(empty($object->entity) ? 1 : 0);
+                    print '<input type="hidden" name="globalgroup" value="'.$value.'" />';
+                }
             }
-            
-			print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
+
+            print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
             print '<td class="valeur">';
 
-			if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
-			{
-				require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
-				$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true);
-				$doleditor->Create();
-			}
-			else
-			{
-				print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
-				print dol_htmlentitiesbr_decode($object->note);
-				print '</textarea>';
-			}
-			print '</td>';
-			print "</tr>\n";
-			print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>';
-			print "</table>\n";
-			print '</form>';
-
-			print '</div>';
-		}
-
-	}
+            if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
+            {
+                require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+                $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true);
+                $doleditor->Create();
+            }
+            else
+            {
+                print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
+                print dol_htmlentitiesbr_decode($object->note);
+                print '</textarea>';
+            }
+            print '</td>';
+            print "</tr>\n";
+            print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>';
+            print "</table>\n";
+            print '</form>';
+
+            print '</div>';
+        }
+
+    }
 }
 
 $db->close();
 
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.68 $');
 ?>
diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php
index 0d6079fe313d913845d7ad09ee3fd08b5ae0b779..3f72932b347c8360e65afc18c4d5a726758e3343 100644
--- a/htdocs/user/group/ldap.php
+++ b/htdocs/user/group/ldap.php
@@ -21,7 +21,7 @@
  *       \file       htdocs/user/group/ldap.php
  *       \ingroup    ldap
  *       \brief      Page fiche LDAP groupe
- *       \version    $Id$
+ *       \version    $Id: ldap.php,v 1.25 2011/07/08 18:49:17 eldy Exp $
  */
 
 require("../../main.inc.php");
@@ -186,7 +186,7 @@ if ($result > 0)
 	//var_dump($records);
 
 	// Affichage arbre
-	if (sizeof($records) && (! isset($records['count']) || $records['count'] > 0))
+	if (count($records) && (! isset($records['count']) || $records['count'] > 0))
 	{
 		if (! is_array($records))
 		{
@@ -216,5 +216,5 @@ print '</table>';
 
 $db->close();
 
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.25 $');
 ?>
diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php
index a456ee9695450233d5375cd018fce6f20688054e..4c037fb17eeedd37d7358d126e739bee9394a95b 100644
--- a/htdocs/user/ldap.php
+++ b/htdocs/user/ldap.php
@@ -21,7 +21,7 @@
  *      \file       htdocs/user/ldap.php
  *      \ingroup    ldap
  *      \brief      Page fiche LDAP utilisateur
- *      \version    $Id$
+ *      \version    $Id: ldap.php,v 1.30 2011/07/08 18:49:17 eldy Exp $
  */
 
 require("../main.inc.php");
@@ -43,7 +43,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
 $feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
 if ($user->id == $_GET["id"])	// A user can always read its own card
 {
-	$feature2='';
+    $feature2='';
 }
 $result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
 
@@ -53,34 +53,34 @@ $fuser->getrights();
 
 
 /*
-* Actions
-*/
+ * Actions
+ */
 
 if ($_GET["action"] == 'dolibarr2ldap')
 {
-	$message="";
+    $message="";
 
-	$db->begin();
+    $db->begin();
 
-	$ldap=new Ldap();
-	$result=$ldap->connect_bind();
+    $ldap=new Ldap();
+    $result=$ldap->connect_bind();
 
-	$info=$fuser->_load_ldap_info();
-	$dn=$fuser->_load_ldap_dn($info);
-	$olddn=$dn;	// We can say that old dn = dn as we force synchro
+    $info=$fuser->_load_ldap_info();
+    $dn=$fuser->_load_ldap_dn($info);
+    $olddn=$dn;	// We can say that old dn = dn as we force synchro
 
-	$result=$ldap->update($dn,$info,$user,$olddn);
+    $result=$ldap->update($dn,$info,$user,$olddn);
 
-	if ($result >= 0)
-	{
-		$message.='<div class="ok">'.$langs->trans("UserSynchronized").'</div>';
-		$db->commit();
-	}
-	else
-	{
-		$message.='<div class="error">'.$ldap->error.'</div>';
-		$db->rollback();
-	}
+    if ($result >= 0)
+    {
+        $message.='<div class="ok">'.$langs->trans("UserSynchronized").'</div>';
+        $db->commit();
+    }
+    else
+    {
+        $message.='<div class="error">'.$ldap->error.'</div>';
+        $db->rollback();
+    }
 }
 
 
@@ -120,25 +120,25 @@ print "</tr>\n";
 print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
 if ($fuser->ldap_sid)
 {
-	print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
+    print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
 }
 else
 {
-	print '<td>'.$fuser->login.'</td>';
+    print '<td>'.$fuser->login.'</td>';
 }
 print '</tr>';
 
 if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
 {
-	$ldap = new Ldap();
-	$result = $ldap->connect_bind();
-	if ($result > 0)
-  {
-    $userSID = $ldap->getObjectSid($fuser->login);
-  }
-  print '<tr><td width="25%" valign="top">'.$langs->trans("SID").'</td>';
-  print '<td>'.$userSID.'</td>';
-  print "</tr>\n";
+    $ldap = new Ldap();
+    $result = $ldap->connect_bind();
+    if ($result > 0)
+    {
+        $userSID = $ldap->getObjectSid($fuser->login);
+    }
+    print '<tr><td width="25%" valign="top">'.$langs->trans("SID").'</td>';
+    print '<td>'.$userSID.'</td>';
+    print "</tr>\n";
 }
 
 // LDAP DN
@@ -170,7 +170,7 @@ print '<div class="tabsAction">';
 
 if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
 {
-	print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fuser->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
+    print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fuser->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
 }
 
 print "</div>\n";
@@ -194,36 +194,36 @@ $ldap=new Ldap();
 $result=$ldap->connect_bind();
 if ($result > 0)
 {
-	$info=$fuser->_load_ldap_info();
-	$dn=$fuser->_load_ldap_dn($info,1);
-	$search = "(".$fuser->_load_ldap_dn($info,2).")";
-	$records=$ldap->getAttribute($dn,$search);
-
-	//print_r($records);
-
-	// Affichage arbre
-	if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
-	{
-		if (! is_array($records))
-		{
-			print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
-		}
-		else
-		{
-			$result=show_ldap_content($records,0,$records['count'],true);
-		}
-	}
-	else
-	{
-		print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
-	}
-
-	$ldap->unbind();
-	$ldap->close();
+    $info=$fuser->_load_ldap_info();
+    $dn=$fuser->_load_ldap_dn($info,1);
+    $search = "(".$fuser->_load_ldap_dn($info,2).")";
+    $records=$ldap->getAttribute($dn,$search);
+
+    //print_r($records);
+
+    // Affichage arbre
+    if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
+    {
+        if (! is_array($records))
+        {
+            print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
+        }
+        else
+        {
+            $result=show_ldap_content($records,0,$records['count'],true);
+        }
+    }
+    else
+    {
+        print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
+    }
+
+    $ldap->unbind();
+    $ldap->close();
 }
 else
 {
-	dol_print_error('',$ldap->error);
+    dol_print_error('',$ldap->error);
 }
 
 print '</table>';
@@ -233,5 +233,5 @@ print '</table>';
 
 $db->close();
 
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.30 $');
 ?>
diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php
index 5c309faae9b7167d0c50376922dd7163d35157c1..e938755bf55abf9b025ddf305367254952218771 100644
--- a/htdocs/user/param_ihm.php
+++ b/htdocs/user/param_ihm.php
@@ -20,7 +20,7 @@
 /**
  *       \file       htdocs/user/param_ihm.php
  *       \brief      Page to show user setup for display
- *       \version    $Id$
+ *       \version    $Id: param_ihm.php,v 1.52 2011/07/08 18:49:17 eldy Exp $
  */
 
 require("../main.inc.php");
@@ -39,9 +39,9 @@ $canreaduser=($user->admin || $user->rights->user->user->lire);
 
 if ($_REQUEST["id"])
 {
-  // $user est le user qui edite, $_REQUEST["id"] est l'id de l'utilisateur edite
-  $caneditfield=( (($user->id == $_REQUEST["id"]) && $user->rights->user->self->creer)
-		  || (($user->id != $_REQUEST["id"]) && $user->rights->user->user->creer));
+    // $user est le user qui edite, $_REQUEST["id"] est l'id de l'utilisateur edite
+    $caneditfield=( (($user->id == $_REQUEST["id"]) && $user->rights->user->self->creer)
+    || (($user->id != $_REQUEST["id"]) && $user->rights->user->user->creer));
 }
 
 // Security check
@@ -50,8 +50,8 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
 $feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
 if ($user->id == $_REQUEST["id"])	// A user can always read its own card
 {
-	$feature2='';
-	$canreaduser=1;
+    $feature2='';
+    $canreaduser=1;
 }
 $result = restrictedArea($user, 'user', $_REQUEST["id"], '', $feature2);
 if ($user->id <> $_REQUEST["id"] && ! $canreaduser) accessforbidden();
@@ -237,21 +237,21 @@ else
     print '</div>';
 
     print '<div class="tabsAction">';
-	if (! empty($dolibarr_main_demo))
-	{
-		print "<a class=\"butActionRefused\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
-	}
-	else
-	{
-		if ($user->id == $fuser->id || $user->admin)       // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
-	    {
-	        print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$fuser->id.'">'.$langs->trans("Modify").'</a>';
-	    }
-	   	else
-		{
-			print "<a class=\"butActionRefused\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
-		}
-	}
+    if (! empty($dolibarr_main_demo))
+    {
+        print "<a class=\"butActionRefused\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
+    }
+    else
+    {
+        if ($user->id == $fuser->id || $user->admin)       // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
+        {
+            print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$fuser->id.'">'.$langs->trans("Modify").'</a>';
+        }
+        else
+        {
+            print "<a class=\"butActionRefused\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
+        }
+    }
 
     print '</div>';
 
@@ -259,5 +259,5 @@ else
 
 $db->close();
 
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.52 $');
 ?>
diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php
index 8ca37c7cbe9a47f23c5bc77b33f006b36eab4c95..02a4318c340a31a836904a30b38f517e7a13c413 100644
--- a/htdocs/user/passwordforgotten.php
+++ b/htdocs/user/passwordforgotten.php
@@ -20,7 +20,7 @@
 /**
  *       \file       htdocs/user/passwordforgotten.php
  *       \brief      Page to ask a new password
- *       \version    $Id: passwordforgotten.php,v 1.74 2011/07/08 15:52:24 eldy Exp $
+ *       \version    $Id: passwordforgotten.php,v 1.75 2011/07/08 18:49:17 eldy Exp $
  */
 
 define("NOLOGIN",1);	// This means this output page does not require to be logged.
@@ -38,8 +38,8 @@ $langs->load("ldap");
 // Security check
 if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)
 {
-	header("Location: ".DOL_URL_ROOT.'/');
-	exit;
+    header("Location: ".DOL_URL_ROOT.'/');
+    exit;
 }
 
 $action=GETPOST('action');
@@ -60,82 +60,82 @@ if ($action == 'validatenewpassword' && $username && $passwordmd5)
 {
     $edituser = new User($db);
     $result=$edituser->fetch('',$_GET["username"]);
-	if ($result < 0)
-	{
+    if ($result < 0)
+    {
         $message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
-	}
-	else
-	{
-		if (md5($edituser->pass_temp) == $passwordmd5)
-		{
-			$newpassword=$edituser->setPassword($user,$edituser->pass_temp,0);
-			dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
-			//session_start();
-			//$_SESSION["loginmesg"]=$langs->trans("PasswordChanged");
-			header("Location: ".DOL_URL_ROOT.'/');
-			exit;
-		}
-		else
-		{
-	        $message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePassword").'</div>';
-		}
-	}
+    }
+    else
+    {
+        if (md5($edituser->pass_temp) == $passwordmd5)
+        {
+            $newpassword=$edituser->setPassword($user,$edituser->pass_temp,0);
+            dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
+            //session_start();
+            //$_SESSION["loginmesg"]=$langs->trans("PasswordChanged");
+            header("Location: ".DOL_URL_ROOT.'/');
+            exit;
+        }
+        else
+        {
+            $message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePassword").'</div>';
+        }
+    }
 }
 // Action modif mot de passe
 if ($action == 'buildnewpassword' && $username)
 {
-	require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
-	require_once ARTICHOW."/AntiSpam.class.php";
-
-	// We create anti-spam object
-	$object = new AntiSpam();
-
-	// Verify code
-	if (! $object->check('dol_antispam_value',$_POST['code'],true))
-	{
-		$message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
-	}
-	else
-	{
-	    $edituser = new User($db);
-	    $result=$edituser->fetch('',$username,'',1);
-		if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
-		{
-	        $message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
-			$username='';
-		}
-		else
-		{
-			if (! $edituser->email)
-			{
-		        $message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
-			}
-			else
-			{
-				$newpassword=$edituser->setPassword($user,'',1);
-			    if ($newpassword < 0)
-			    {
-			        // Failed
-			        $message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
-			    }
-			    else
-			    {
-			        // Success
-			        if ($edituser->send_password($user,$newpassword,1) > 0)
-			        {
-			        	$message = '<div class="ok">'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'</div>';
-						//$message.=$newpassword;
-						$username='';
-					}
-					else
-					{
-					   	//$message = '<div class="ok">'.$langs->trans("PasswordChangedTo",$newpassword).'</div>';
-					    $message.= '<div class="error">'.$edituser->error.'</div>';
-					}
-			    }
-			}
-		}
-	}
+    require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
+    require_once ARTICHOW."/AntiSpam.class.php";
+
+    // We create anti-spam object
+    $object = new AntiSpam();
+
+    // Verify code
+    if (! $object->check('dol_antispam_value',$_POST['code'],true))
+    {
+        $message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
+    }
+    else
+    {
+        $edituser = new User($db);
+        $result=$edituser->fetch('',$username,'',1);
+        if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
+        {
+            $message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
+            $username='';
+        }
+        else
+        {
+            if (! $edituser->email)
+            {
+                $message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
+            }
+            else
+            {
+                $newpassword=$edituser->setPassword($user,'',1);
+                if ($newpassword < 0)
+                {
+                    // Failed
+                    $message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
+                }
+                else
+                {
+                    // Success
+                    if ($edituser->send_password($user,$newpassword,1) > 0)
+                    {
+                        $message = '<div class="ok">'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'</div>';
+                        //$message.=$newpassword;
+                        $username='';
+                    }
+                    else
+                    {
+                        //$message = '<div class="ok">'.$langs->trans("PasswordChangedTo",$newpassword).'</div>';
+                        $message.= '<div class="error">'.$edituser->error.'</div>';
+                    }
+                }
+            }
+        }
+    }
 }
 
 
@@ -155,18 +155,18 @@ if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_A
 // Select templates
 if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
 {
-	$template_dir = DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/';
+    $template_dir = DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/';
 }
 else
 {
-	if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php"))
-	{
-		$template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
-	}
-	else
-	{
-		$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
-	}
+    if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php"))
+    {
+        $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
+    }
+    else
+    {
+        $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
+    }
 }
 
 $conf->css  = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang;
@@ -174,11 +174,11 @@ $conf_css = DOL_URL_ROOT.$conf->css;
 
 if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
 {
-	$login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
+    $login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
 }
 else
 {
-	$login_background = DOL_URL_ROOT.'/theme/login_background.png';
+    $login_background = DOL_URL_ROOT.'/theme/login_background.png';
 }
 
 if (! $username) $focus_element = 'username';
@@ -196,55 +196,55 @@ $urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
 
 if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
 {
-	$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
+    $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
 }
 elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
 {
-	$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode($mysoc->logo);
-	$width=128;
+    $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode($mysoc->logo);
+    $width=128;
 }
 elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
 {
-	$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
+    $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
 }
 
 // Entity combobox
 $select_entity='';
 if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)  && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX) && ! $disabled)
 {
-	$rowspan++;
-	$lastuser='';
-	$lastentity = GETPOST('entity');
-
-	if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
-	{
-		$prefix=dol_getprefix();
-		$entityCookieName = 'DOLENTITYID_'.$prefix;
-		if (isset($_COOKIE[$entityCookieName]))
-		{
-			include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
-
-			$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
-
-			$entityCookie = new DolCookie($cryptkey);
-			$cookieValue = $entityCookie->_getCookie($entityCookieName);
-			list($lastuser, $lastentity) = explode('|', $cookieValue);
-		}
-	}
-
-	$res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
-	if ($res)
-	{
-		$mc = new ActionsMulticompany($db);
-		$select_entity = $mc->select_entities($lastentity,'tabindex="2"');
-	}
+    $rowspan++;
+    $lastuser='';
+    $lastentity = GETPOST('entity');
+
+    if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
+    {
+        $prefix=dol_getprefix();
+        $entityCookieName = 'DOLENTITYID_'.$prefix;
+        if (isset($_COOKIE[$entityCookieName]))
+        {
+            include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
+
+            $cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
+
+            $entityCookie = new DolCookie($cryptkey);
+            $cookieValue = $entityCookie->_getCookie($entityCookieName);
+            list($lastuser, $lastentity) = explode('|', $cookieValue);
+        }
+    }
+
+    $res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
+    if ($res)
+    {
+        $mc = new ActionsMulticompany($db);
+        $select_entity = $mc->select_entities($lastentity,'tabindex="2"');
+    }
 }
 
 // Security graphical code
 if (function_exists("imagecreatefrompng") && ! $disabled)
 {
-	$captcha = 1;
-	$captcha_refresh = img_refresh();
+    $captcha = 1;
+    $captcha_refresh = img_refresh();
 }
 
 include($template_dir.'passwordforgotten.tpl.php');	// To use native PHP
diff --git a/test/codesniffer/ruleset.xml b/test/codesniffer/ruleset.xml
index 8b2b2e5b28b41e8ce29502a845602e3427798c79..445aa112bfec4cf601229fafd7980dd5b5fd3aa6 100755
--- a/test/codesniffer/ruleset.xml
+++ b/test/codesniffer/ruleset.xml
@@ -176,7 +176,10 @@
 	<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
 
 	<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />
-
+    <rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line">
+        <severity>0</severity>
+    </rule>
+    
     <!-- Already found as a Generic rule -->
 	<!-- <rule ref="PEAR.WhiteSpace.ScopeIndent" /> -->