issue #0000930 : Droits et Facturation
This commit is contained in:
parent
06d3b54bc7
commit
9a56f94384
@ -41,10 +41,16 @@ class WsScore
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of Client
|
* Name of Client
|
||||||
* @var unknown
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $serviceClientName = null;
|
public $serviceClientName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version of service
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $serviceVersion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all application IPs
|
* List all application IPs
|
||||||
* @var array
|
* @var array
|
||||||
@ -65,6 +71,9 @@ class WsScore
|
|||||||
'IPARI' => "Investigation par l'image IparI©",
|
'IPARI' => "Investigation par l'image IparI©",
|
||||||
'HISTOBODACC' => "Historique des annonces bodacc",
|
'HISTOBODACC' => "Historique des annonces bodacc",
|
||||||
'INVESTIG' => "Investigation",
|
'INVESTIG' => "Investigation",
|
||||||
|
'SEARCHENT' => "Recherche Entreprise",
|
||||||
|
'SEARCHDIR' => "Recherche Dirigeant",
|
||||||
|
'SEARCHACT' => "Recherche Actionnaire",
|
||||||
|
|
||||||
//IDENTITE
|
//IDENTITE
|
||||||
'IDENTITE' => "Fiche d'identité",
|
'IDENTITE' => "Fiche d'identité",
|
||||||
@ -137,7 +146,8 @@ class WsScore
|
|||||||
protected $listeCategory = array(
|
protected $listeCategory = array(
|
||||||
'RECHERCHE' => array(
|
'RECHERCHE' => array(
|
||||||
'label' => "Recherche",
|
'label' => "Recherche",
|
||||||
'droits' => array('RECHCSV', 'IPARI', 'HISTOBODACC', 'INVESTIG'),
|
'droits' => array('RECHCSV', 'IPARI', 'HISTOBODACC', 'INVESTIG', 'SEARCHENT',
|
||||||
|
'SEARCHDIR', 'SEARCHACT'),
|
||||||
),
|
),
|
||||||
'IDENTITE' => array(
|
'IDENTITE' => array(
|
||||||
'label' => "Identité",
|
'label' => "Identité",
|
||||||
@ -360,15 +370,25 @@ class WsScore
|
|||||||
$test=0;
|
$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
|
//Update count access to a service
|
||||||
$sql = "UPDATE logsCount SET conso=conso+1 WHERE jour=CURDATE() AND idClient=".$this->tabInfoUser['idClient'].
|
$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);
|
$iDbCrm->query($sql);
|
||||||
$updateOk = $iDbCrm->getAffectedRows();
|
$updateOk = $iDbCrm->getAffectedRows();
|
||||||
//If not insert
|
//If not insert
|
||||||
if ($updateOk==0) {
|
if ($updateOk==0) {
|
||||||
$sql = "INSERT INTO logsCount (jour, idClient, service, login, log, conso) ".
|
$sql = "INSERT INTO logsCount (jour, idClient, service, log, conso) ".
|
||||||
"VALUES (NOW(), ".$this->tabInfoUser['idClient'].", '".$pricing[0]['service']."', '".$pricing[0]['login']."', '".$service."', 1) ";
|
"VALUES (NOW(), ".$this->tabInfoUser['idClient'].", '".$loginService."', '".$service."', 1) ";
|
||||||
$iDbCrm->query($sql);
|
$iDbCrm->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,11 +477,21 @@ class WsScore
|
|||||||
|
|
||||||
protected function checkLimit($log)
|
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
|
//Read if client has pricing for this service
|
||||||
$pricing = $iDbCrm->select('clientsTarif', 'login, service',
|
$pricing = $iDbCrm->select('clientsTarif', 'login, service',
|
||||||
"log='".$log."' AND idClient=" . $this->tabInfoUser['idClient'] .
|
"log='".$log."' AND idClient=" . $this->tabInfoUser['idClient'] .
|
||||||
" AND (service='".$this->tabInfoUser['service']."' OR service='') AND (login='".$this->tabInfoUser['login']."' OR login='') ".
|
" AND service='".$loginService."'" .
|
||||||
" ORDER BY service, login DESC LIMIT 1");
|
" ORDER BY dateDebut DESC LIMIT 1");
|
||||||
|
|
||||||
if ( count($pricing)>0 ) {
|
if ( count($pricing)>0 ) {
|
||||||
//Limit
|
//Limit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user