From 04083e39d5da1a68c629b3f6687973bc6245c739 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Sat, 21 Jan 2012 20:26:02 +0000 Subject: [PATCH] =?UTF-8?q?M=C3=AAme=20code=20que=20la=20version=200.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WsScore/Entreprise/v0.6/Entreprise.php | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/library/WsScore/Entreprise/v0.6/Entreprise.php b/library/WsScore/Entreprise/v0.6/Entreprise.php index 27061ade..bf7c4b2e 100644 --- a/library/WsScore/Entreprise/v0.6/Entreprise.php +++ b/library/WsScore/Entreprise/v0.6/Entreprise.php @@ -1111,31 +1111,29 @@ class Entreprise extends WsScore { $this->authenticate(); - $perm = false; - switch($niveau){ - case 1: - if ( !$this->checkPerm('indiscore') || !$this->checkPerm('indiscorep') ){ - $this->permission('indiscore'); - } - break; - case 2: - if (!$this->checkPerm('indiscore2') || !$this->checkPerm('indiscore2p') ){ - $this->permission('indiscore2'); - } - break; - case 3: - if (!$this->checkPerm('indiscore3') || !$this->checkPerm('indiscore3p') ){ - $this->permission('indiscore3'); - } - break; - } - //Initialisation $accesDist = true; - if (empty($nic)) { $nic = 0; } - if (empty($niveau)) { $niveau = 2; } - if (empty($plus)) { $plus = false; } - if ( !in_array($niveau, array(0,1,2,3,4,5)) ) { $niveau = 2; } + if (empty($nic)) { $nic = 0; } + if (empty($niveau)) { $niveau = 2; } + if (empty($plus)) { $plus = false; } + if ( !in_array($niveau, array(0,1,2,3,4,5)) ) { $niveau = 2; } + $perm = false; + switch($niveau){ + case 1: $perms = array('indiscore', 'indiscorep'); break; + case 2: $perms = array('indiscore2', 'indiscore2p'); break; + case 3: $perms = array('indiscore3', 'indiscore3p'); break; + } + foreach($perms as $item){ + if ( $this->checkPerm($item) ){ + $perm = true; + break; + } + } + if ($perm === false) { + $this->sendError('9002'); + } + + $tabRet = array(); debugLog('I',"IndiScore demandée pour $siren en niveau $niveau",__LINE__,__FILE__, __FUNCTION__, __CLASS__); if (strlen($siren)>9 || (substr($siren,0,9)*1)<100 ){