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

@ -41,10 +41,16 @@ class WsScore
/**
* Name of Client
* @var unknown
* @var string
*/
public $serviceClientName = null;
/**
* Version of service
* @var string
*/
public $serviceVersion = null;
/**
* List all application IPs
* @var array
@ -65,6 +71,9 @@ class WsScore
'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é",
@ -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é",
@ -360,15 +370,25 @@ 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);
}
@ -457,11 +477,21 @@ 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