static function updateSociete(&$PDOdb, &$soc, $fk_category = null, $not_in_category = null) { global $langs, $conf, $user, $db; $TUserIdAffected = TCommercialCategory::getAllUserForSociete($PDOdb, $soc->id, $fk_category, $not_in_category); if (!empty($TUserIdAffected)) { foreach ($TUserIdAffected as $idcomm) { // print "Ajout $idcomm dans ".$soc->id."<br>"; $res = $soc->add_commercial($user, $idcomm); } } $listsalesrepresentatives = $soc->getSalesRepresentatives($user); foreach ($listsalesrepresentatives as &$comm) { if (!in_array($comm['id'], $TUserIdAffected)) { $soc->del_commercial($user, $comm['id']); } } }