issue #0000930 : Droits et Facturation

This commit is contained in:
Michael RICOIS 2012-12-21 16:10:18 +00:00
parent 06d3b54bc7
commit 9a56f94384

View File

@ -20,7 +20,7 @@ class WsScore
* @var unknown
*/
protected $dbConfig;
/**
* User information
* @var array
@ -32,19 +32,25 @@ class WsScore
* @var string
*/
public $serviceName = null;
/**
* Is a customize service
* @var boolean
*/
public $serviceClient = false;
/**
* Name of Client
* @var unknown
* @var string
*/
public $serviceClientName = null;
/**
* Version of service
* @var string
*/
public $serviceVersion = null;
/**
* List all application IPs
* @var array
@ -59,13 +65,16 @@ class WsScore
* @var array
*/
protected $listeDroits = array (
//RECHERCHE
'RECHCSV' => "Export des résultats de la recherche",
'IPARI' => "Investigation par l'image IparI©",
'HISTOBODACC' => "Historique des annonces bodacc",
'INVESTIG' => "Investigation",
'SEARCHENT' => "Recherche Entreprise",
'SEARCHDIR' => "Recherche Dirigeant",
'SEARCHACT' => "Recherche Actionnaire",
//IDENTITE
'IDENTITE' => "Fiche d'identité",
'IDPROCOL' => 'Fiche procédure collective',
@ -74,11 +83,11 @@ class WsScore
'GROUPE' => "Informations et organigramme du groupe",
'EVENINSEE' => 'Évènements INSEE',
'AVISINSEE' => 'Avis de situation INSEE',
//DIRIGEANT
'DIRIGEANTS' => "Liste des dirigeants",
'DIRIGEANTSOP' => "Liste des dirigeants opérationnels",
//FINANCE
'SYNTHESE' => "Synthèse",
'RATIOS' => "Ratios",
@ -88,14 +97,14 @@ class WsScore
'UPLOADBILAN' => "Saisie de bilan",
'BOURSE' => "Bourse & cotations",
'BANQUE' => "Relations bancaires",
//JURIDIQUE
'ANNONCES' => "Annonces légales",
'INFOSREG' => "Informations réglementée",
'COMPETENCES' => "Compétences territoriales",
'CONVENTIONS' => "Conventions collectives",
'MARQUES' => "Marques déposées",
//EVALUATION
'INDISCORE' => 'indiScore©',
'INDISCORE2' => 'Rapport synthetique',
@ -106,12 +115,12 @@ class WsScore
'SCORECSF' => 'Score CSF',
'ENQUETEC' => 'Enquête commerciale',
'AVISCREDIT' => 'Avis de crédit personnalisé',
//PIECES
'KBIS' => 'Extrait RCS',
'ACTES' => 'Pièces officielles',
'PRIVILEGES' => 'Privilèges',
//SURVEILLANCES
'SURVANNONCE' => 'Surveillance des annonces légales',
'SURVINSEE' => 'Surveillance des événements INSEE',
@ -122,13 +131,13 @@ class WsScore
'SURVPAIEMENTS' => 'Surveillance des paiements',
'SURVLIENS' => 'Surveillance des liens financiers',
'SURVPRIV' => 'Surveillance des privilèges',
//OPTIONS
'MONPROFIL' => 'Mon profil',
'EDITION' => 'Mode Edition',
'PORTEFEUILLE' => 'Portefeuille',
'SURVLISTE' => 'Liste des surveillances',
//DIVERS
'INTERNATIONAL' => 'Recherche Internationale',
'BDF' => 'Banque de France',
@ -137,7 +146,8 @@ class WsScore
protected $listeCategory = array(
'RECHERCHE' => array(
'label' => "Recherche",
'droits' => array('RECHCSV', 'IPARI', 'HISTOBODACC', 'INVESTIG'),
'droits' => array('RECHCSV', 'IPARI', 'HISTOBODACC', 'INVESTIG', 'SEARCHENT',
'SEARCHDIR', 'SEARCHACT'),
),
'IDENTITE' => array(
'label' => "Identité",
@ -181,7 +191,7 @@ class WsScore
'droits' => array('INTERNATIONAL', 'BDF'),
),
);
/**
* List preferences
* @var array
@ -196,7 +206,7 @@ class WsScore
'DEMANDEREF' => "Demande de référence par defaut",
'RECHREF' => "Afficher le formulaire de recherche par référence",
);
/**
* List logs for facturation
* @var unknown_type
@ -288,7 +298,7 @@ class WsScore
'label' => "Informations groupe",
),
);
/**
* List of error code send as SoapFault
* @var unknown_type
@ -321,7 +331,7 @@ class WsScore
define ('TIME', substr(DATETIME,8,6));
define ('DATE_LISIBLE', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
define ('TIME_LISIBLE', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
//Load database configuration
$c = Zend_Registry::get('config');
$this->dbConfig = $c->profil;
@ -360,18 +370,28 @@ class WsScore
$test=0;
}
//Get login service
$sql = "SELECT * FROM utilisateurs_service WHERE login='".$this->tabInfoUser['login']."'";
$result = $iDbCrm->query($sql);
if ( mysql_num_rows($result) == 0 ) {
$loginService = 'default';
} else {
$row = mysql_fetch_assoc($result);
$loginService = $row['serviceCode'];
}
//Update count access to a service
$sql = "UPDATE logsCount SET conso=conso+1 WHERE jour=CURDATE() AND idClient=".$this->tabInfoUser['idClient'].
" AND service='".$pricing[0]['service']."' AND login='".$pricing[0]['login']."' AND log='".$service."'";
" AND service='".$loginService."' AND log='".$service."'";
$iDbCrm->query($sql);
$updateOk = $iDbCrm->getAffectedRows();
//If not insert
if ($updateOk==0) {
$sql = "INSERT INTO logsCount (jour, idClient, service, login, log, conso) ".
"VALUES (NOW(), ".$this->tabInfoUser['idClient'].", '".$pricing[0]['service']."', '".$pricing[0]['login']."', '".$service."', 1) ";
$sql = "INSERT INTO logsCount (jour, idClient, service, log, conso) ".
"VALUES (NOW(), ".$this->tabInfoUser['idClient'].", '".$loginService."', '".$service."', 1) ";
$iDbCrm->query($sql);
}
if (strlen($siret)==14) {
$siren = substr($siret,0,9);
$nic = substr($siret,9,5);
@ -379,7 +399,7 @@ class WsScore
$siren=$siret;
$nic='';
}
$rs = '';
$cp = '';
$vil = '';
@ -454,15 +474,25 @@ class WsScore
}
}
protected function checkLimit($log)
{
//Get login service
$sql = "SELECT * FROM utilisateurs_service WHERE login='".$this->tabInfoUser['login']."'";
$result = $iDbCrm->query($sql);
if ( mysql_num_rows($result) == 0 ) {
$loginService = 'default';
} else {
$row = mysql_fetch_assoc($result);
$loginService = $row['serviceCode'];
}
//Read if client has pricing for this service
$pricing = $iDbCrm->select('clientsTarif', 'login, service',
"log='".$log."' AND idClient=" . $this->tabInfoUser['idClient'] .
" AND (service='".$this->tabInfoUser['service']."' OR service='') AND (login='".$this->tabInfoUser['login']."' OR login='') ".
" ORDER BY service, login DESC LIMIT 1");
" AND service='".$loginService."'" .
" ORDER BY dateDebut DESC LIMIT 1");
if ( count($pricing)>0 ) {
//Limit
}
@ -503,14 +533,14 @@ class WsScore
{
if ($this->tabInfoUser['idClient']==1)
return true;
if ($this->checkPerm('edition'))
return true;
return false;
}
/**
* checkAuth
* @param string $login
@ -602,12 +632,12 @@ class WsScore
* Acces WS, block access to other apps
*/
if ($tabRep['accesWS']==1) {
// Webservice user don't need access to others apps
if ( in_array($ipConnexion, $this->listApplicationIp) && $tabRep['idClient']!=1 ) {
return '0901';
}
// For customized version, check user is in the good service
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
foreach( $clients as $section => $params ){
@ -619,9 +649,9 @@ class WsScore
|| strtolower($this->serviceClientName)!=$wsClients[$this->tabInfoUser['idClient']] ) ){
return '0901';
}
}
return true;
}
debugLog('W',"CheckAuth $login/$password incorrect (IP=$ipConnexion)", __LINE__,__FILE__, __FUNCTION__, __CLASS__);