Préparation gestion du mode edition en tant que droit, issue #0000117

This commit is contained in:
Michael RICOIS 2010-05-03 13:48:25 +00:00
parent 2b31a69a52
commit eaeaa9a4e1
14 changed files with 45 additions and 23 deletions

View File

@ -170,7 +170,7 @@ function identite_situationjuridique($situationjuridique, $dateRadiation, $actif
$data = 'Actif au RCS';
}
//Mode Edition
if ($_SESSION['tabInfo']['mode_edition']==1)
if (hasModeEdition())
{
$data.= ' <a href="./?page=saisie&siret='.$siret.'&idEntreprise='.$idEntreprise.'">(Edition)</a>';
}

View File

@ -29,6 +29,7 @@ $definePerms = array(
'INTERNATIONAL' => array( 'init' => '', 'txt' => 'Recherche Internationale'),
'BDF' => array( 'init' => '', 'txt' => 'Banque de France'),
'MONPROFIL' => array( 'init' => '', 'txt' => 'Mon profil'),
'EDITION' => array( 'init' => '', 'txt' => 'Mode Edition'),
);
/*
@ -114,7 +115,17 @@ function formElementPerm($userInfos){
function checkModeEdition($loginVu)
{
$isAuthorized = FALSE;
$authorizedUsers = array('ylenaour', 'jmartory', 'mheitz', 'mpurcarin', 'mcochet', 'aegasse', 'mricois', 'fzicaro', 'sbeaugrand', 'tjactel');
$authorizedUsers = array(
'ylenaour',
'jmartory',
'mheitz',
'mpurcarin',
'mcochet',
'aegasse',
'mricois',
'fzicaro',
'sbeaugrand',
'tjactel');
$isUserAuthorized = FALSE;
foreach($authorizedUsers as $login){
if($_SESSION['tabInfo']['login']==$login){
@ -122,7 +133,10 @@ function checkModeEdition($loginVu)
break;
}
}
if($loginVu==$_SESSION['tabInfo']['login'] && $isUserAuthorized || ($_SESSION['tabInfo']['idClient']==1 && ($_SESSION['tabInfo']['profil']=='Administrateur' || $_SESSION['tabInfo']['profil']=='SuperAdministrateur') ) ){
if ($loginVu==$_SESSION['tabInfo']['login'] && $isUserAuthorized ||
($_SESSION['tabInfo']['idClient']==1 &&
($_SESSION['tabInfo']['profil']=='Administrateur' ||
$_SESSION['tabInfo']['profil']=='SuperAdministrateur') ) ){
$isAuthorized = TRUE;
}
return $isAuthorized;
@ -130,8 +144,14 @@ function checkModeEdition($loginVu)
function hasModeEdition()
{
if($_SESSION['tabInfo']['mode_edition']==1) return true;
else return false;
$userInfos = $_SESSION['tabInfo'];
$perm = 'EDITION';
if ($userInfos['mode_edition']==1 ||
preg_match('/\b'.$perm.'\b/i', $userInfos['droits'])){
return true;
} else {
return false;
}
}
/*
@ -139,8 +159,13 @@ function hasModeEdition()
* @return string
*/
function formElementModeEdition(){
if ($_SESSION['tabInfo']['mode_edition']==1) $strMode='checked'; else $strMode='';
return '<input type="checkbox" name="frmOptions[mode_edition]" value="1" '.$strMode.' class="noborder"/>Edition';
if ($_SESSION['tabInfo']['mode_edition']==1){
$strMode='checked';
} else {
$strMode='';
}
return '<input type="checkbox" name="frmOptions[mode_edition]" value="1" '.
$strMode.' class="noborder"/>Edition';
}

View File

@ -7,7 +7,7 @@ if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page.'-'.$idEntreprise;
}else{ $fileName = $page.'-'.$siret; }
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
if ( cache_exist() && !hasModeEdition() )
{
$rbanque = cache_get('rbanque');
}else{

View File

@ -15,7 +15,7 @@ if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
if( cache_exist() && !hasModeEdition() )
{
$etab = cache_get('etab');
}else{

View File

@ -181,15 +181,12 @@ if (isset($page2) == true) {
cache_filename($fileName);
}
if (cache_exist() &&
!(preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) ||
$_SESSION['tabInfo']['mode_edition'] == 1)) {
if (cache_exist() && !hasModeEdition()) {
$etabs = cache_get('etabs');
// Affichage d'un message d'erreur
if ($etabs === FALSE) {
exit;
}
$firephp->info('CACHE');
} else {
try {
$O = $client->getListeEtablissements($siren);

View File

@ -40,7 +40,7 @@ if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
if($type!=''){ $fileName.= '-'.$type; }
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
if( cache_exist() && !hasModeEdition() ){
$competences = cache_get('competences');
}else{
try {

View File

@ -18,9 +18,8 @@ if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
if( cache_exist() && !hasModeEdition() ){
$conventions = cache_get('conventions');
$firephp->info('CACHE');
}else{
try {
$O = $client->getListeConventions($siren);

View File

@ -17,7 +17,7 @@ if (($siret*1)==0 && ($siren*1)<100){
}
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
if( cache_exist() && !hasModeEdition() ){
$etabs = cache_get('etabs');
//Affichage d'un message d'erreur
if($etabs === FALSE) exit;

View File

@ -36,7 +36,7 @@ if (($siret*1)==0 && ($siren*1)<100){
$fileName = $page2.'-'.$siret;
}
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
if( cache_exist() && !hasModeEdition() )
{
$evens = cache_get('evens');
//Affichage d'un message d'erreur

View File

@ -964,7 +964,7 @@
}
}
}
elseif( $_SESSION['tabInfo']['mode_edition']==1 )
elseif( hasModeEdition() )
{
$href = './?page=greffes&vue=bilans&siret='.$siret.'&option='.$optionUrl;
echo '<br/><a href="'.$href.'" >Forcer téléchargement.</a>';

View File

@ -19,7 +19,7 @@ if($idCom!==FALSE){ $fileName.= '-'.$idCom; }
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
if( cache_exist() && !hasModeEdition() ){
$annonces = cache_get('annonces');
}else{
try {

View File

@ -25,7 +25,7 @@ isset($_REQUEST['unit']) ? $unite = $_REQUEST['unit'] : $unite = '';
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
if( cache_exist() && !hasModeEdition() )
{
$tabBilans = cache_get('tabBilans');
$tabBilan = cache_get('tabBilan');

View File

@ -19,7 +19,7 @@ if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
if ($id > 0) $fileName = $fileName.'-'.$id;
cache_filename($fileName);
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
if( cache_exist() && !hasModeEdition() ){
$marques = cache_get('marques');
$firephp->log($marques,'marques');
}else{

View File

@ -12,7 +12,8 @@ if (isset($_REQUEST['login']) && $_REQUEST['login']!='' &&
}else{
$loginVu=$_SESSION['tabInfo']['login'];
//On affecte la valeur en session de mode edition d'après le résultat du formulaire
if(isset($tabOptions) && !isset($tabOptions['mode_edition']) && $tabOptions['action']=='save'){
if (isset($tabOptions) && !isset($tabOptions['mode_edition']) &&
$tabOptions['action']=='save'){
$_SESSION['tabInfo']['mode_edition']=0;
}
}