Compare commits

...

30 Commits

Author SHA1 Message Date
Claire DELBOS
2f92777bc6 SD-13 stable before 2017-04-06 16:32:20 +02:00
Claire DELBOS
1c751cf2a4 SD-1 Poss de saisir le siret si absent 2017-03-31 16:19:51 +02:00
Claire DELBOS
8f74f4d930 SD-13 CDC V3 2017-03-30 17:21:39 +02:00
Claire DELBOS
c6716c0f81 fix base sur requete 2017-03-29 12:18:25 +02:00
Claire DELBOS
9adeda59ae SD-1 mep des factures 2017-03-29 09:14:38 +02:00
Claire DELBOS
8cb323a133 SD-22 amelioration esthetique 2017-03-28 15:35:39 +02:00
Claire DELBOS
5442f508a6 SD-22 contacts 2017-03-27 15:41:57 +02:00
Claire DELBOS
601e79f329 SD-12 Correction des appels surnuméraires + histo des conso 2017-03-21 16:16:30 +01:00
Claire DELBOS
a6352a7c97 Stabilisation du cache extranet 2017-03-17 17:23:53 +01:00
Claire DELBOS
12dcdf4f57 Lissage complet des fonction getRapport/getIndiscoreé et getIndiscore 2017-03-14 14:06:31 +01:00
Claire DELBOS
770d6f3b16 Merge branch 'develop' of ssh://git@gogs.sd.lan:10022/SCORES/webservice.git into inextenso 2017-03-09 16:05:46 +01:00
Claire DELBOS
6e5de9a5a0 Before upgrade from develop 2017-03-09 16:02:29 +01:00
Claire DELBOS
ab91971aa4 Decrement fonctionnel 2017-03-08 18:53:40 +01:00
Claire DELBOS
0dbfe9e7f4 Merge branch 'develop' of ssh://git@gogs.sd.lan:10022/SCORES/webservice.git into inextenso 2017-03-07 15:37:29 +01:00
Claire DELBOS
8795eb9138 Avec librairie avant implantation dans le process de connexion 2017-03-03 15:40:56 +01:00
Claire DELBOS
9c23fe2339 Merge branch 'inextenso' of ssh://git@gogs.sd.lan:10022/SCORES/webservice.git into inextenso 2017-03-03 15:24:52 +01:00
Claire DELBOS
ec201b41fa Avec la librairie de decrement avant implantation dans les process 2017-03-03 15:23:36 +01:00
benoitpotier
cc99b1d41e composer.lock 2017-03-03 10:16:05 +01:00
Claire DELBOS
2ee383d310 Correction instabilité 2017-03-03 09:55:54 +01:00
Claire DELBOS
df335ac9d0 Before canUse 2017-03-02 13:56:26 +01:00
Claire DELBOS
cdbc134d2e Avec factorisation de la permission pour plus tard 2017-03-02 11:38:58 +01:00
Claire DELBOS
57a15f7abe Avec test a7e.bigmac 2017-03-01 17:22:03 +01:00
Claire DELBOS
25ea178b80 Re correction pour nouveaux 2017-02-28 17:18:31 +01:00
Claire DELBOS
f848e234fb Correction erreur sur insert 2017-02-28 17:14:07 +01:00
Claire DELBOS
d9e9c1d92d Modukle achat operationnel 2017-02-28 16:50:00 +01:00
Claire DELBOS
e7551303b8 Log des achats 2017-02-28 14:26:31 +01:00
Claire DELBOS
fc52e79c7d Ws operationnel avec Extranet 2017-02-27 18:05:29 +01:00
benoitpotier
9a09028b4a doc service credit progress 2017-02-24 12:10:00 +01:00
benoitpotier
1d4fd45c3f doc service credit progress 2017-02-24 11:50:23 +01:00
benoitpotier
2d0b900e92 add vO.1 service credit 2017-02-23 16:18:08 +01:00
16 changed files with 1221 additions and 147 deletions

94
composer.lock generated
View File

@ -285,16 +285,16 @@
},
{
"name": "doctrine/dbal",
"version": "v2.5.11",
"version": "v2.5.12",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "1b1effbddbdc0f40d1c8f849f44bcddac4f52a48"
"reference": "7b9e911f9d8b30d43b96853dab26898c710d8f44"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/1b1effbddbdc0f40d1c8f849f44bcddac4f52a48",
"reference": "1b1effbddbdc0f40d1c8f849f44bcddac4f52a48",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/7b9e911f9d8b30d43b96853dab26898c710d8f44",
"reference": "7b9e911f9d8b30d43b96853dab26898c710d8f44",
"shasum": ""
},
"require": {
@ -352,7 +352,7 @@
"persistence",
"queryobject"
],
"time": "2017-02-04T21:20:13+00:00"
"time": "2017-02-08T12:53:47+00:00"
},
{
"name": "doctrine/inflector",
@ -481,14 +481,17 @@
"source": {
"type": "git",
"url": "https://github.com/GeSHi/geshi-1.0.git",
"reference": "57e2186cea10332de1e59d03834a0863f981e1a4"
"reference": "c71a0d7aa7520aa2abc1b2d10c8fed1301ea8329"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/57e2186cea10332de1e59d03834a0863f981e1a4",
"reference": "57e2186cea10332de1e59d03834a0863f981e1a4",
"url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/c71a0d7aa7520aa2abc1b2d10c8fed1301ea8329",
"reference": "c71a0d7aa7520aa2abc1b2d10c8fed1301ea8329",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"type": "library",
"autoload": {
"classmap": [
@ -510,25 +513,25 @@
],
"description": "Generic Syntax Highlighter",
"homepage": "http://qbnz.com/highlighter/",
"time": "2016-10-09 19:25:28"
"time": "2017-03-17T06:35:45+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.2.2",
"version": "6.2.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60"
"reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
"reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006",
"reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006",
"shasum": ""
},
"require": {
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.3.1",
"guzzlehttp/psr7": "^1.4",
"php": ">=5.5"
},
"require-dev": {
@ -572,7 +575,7 @@
"rest",
"web service"
],
"time": "2016-10-08T15:01:37+00:00"
"time": "2017-02-28T22:50:30+00:00"
},
{
"name": "guzzlehttp/promises",
@ -627,16 +630,16 @@
},
{
"name": "guzzlehttp/psr7",
"version": "1.3.1",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"shasum": ""
},
"require": {
@ -672,29 +675,36 @@
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation",
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"request",
"response",
"stream",
"uri"
"uri",
"url"
],
"time": "2016-06-24T23:00:38+00:00"
"time": "2017-03-20T17:10:46+00:00"
},
{
"name": "league/csv",
"version": "8.2.0",
"version": "8.2.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/csv.git",
"reference": "ef7eef710810c8bd0cf9371582ccd0123ff96d4b"
"reference": "43fd8b022815a0758d85e925dd92a43fe0d41bb4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/ef7eef710810c8bd0cf9371582ccd0123ff96d4b",
"reference": "ef7eef710810c8bd0cf9371582ccd0123ff96d4b",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/43fd8b022815a0758d85e925dd92a43fe0d41bb4",
"reference": "43fd8b022815a0758d85e925dd92a43fe0d41bb4",
"shasum": ""
},
"require": {
@ -738,20 +748,20 @@
"read",
"write"
],
"time": "2017-01-25T13:32:07+00:00"
"time": "2017-02-23T08:25:03+00:00"
},
{
"name": "mikehaertl/php-shellcommand",
"version": "1.2.3",
"version": "1.2.4",
"source": {
"type": "git",
"url": "https://github.com/mikehaertl/php-shellcommand.git",
"reference": "a628505cd99b201375dd6bcd0b062ee07c8ba556"
"reference": "b0c0bf3ce49a01bd7ddbe07a9bed4ba85b869fa4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/a628505cd99b201375dd6bcd0b062ee07c8ba556",
"reference": "a628505cd99b201375dd6bcd0b062ee07c8ba556",
"url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/b0c0bf3ce49a01bd7ddbe07a9bed4ba85b869fa4",
"reference": "b0c0bf3ce49a01bd7ddbe07a9bed4ba85b869fa4",
"shasum": ""
},
"type": "library",
@ -774,7 +784,7 @@
"keywords": [
"shell"
],
"time": "2017-01-26T08:29:31+00:00"
"time": "2017-02-09T18:28:47+00:00"
},
{
"name": "mikehaertl/php-tmpfile",
@ -814,16 +824,16 @@
},
{
"name": "mikehaertl/phpwkhtmltopdf",
"version": "2.2.0",
"version": "2.2.1",
"source": {
"type": "git",
"url": "https://github.com/mikehaertl/phpwkhtmltopdf.git",
"reference": "318aed9ad8d7622c6d00a0fdf3b199e71d48e47e"
"reference": "877dd0b13d7006cbaa4a272d62152e07310f4bd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikehaertl/phpwkhtmltopdf/zipball/318aed9ad8d7622c6d00a0fdf3b199e71d48e47e",
"reference": "318aed9ad8d7622c6d00a0fdf3b199e71d48e47e",
"url": "https://api.github.com/repos/mikehaertl/phpwkhtmltopdf/zipball/877dd0b13d7006cbaa4a272d62152e07310f4bd3",
"reference": "877dd0b13d7006cbaa4a272d62152e07310f4bd3",
"shasum": ""
},
"require": {
@ -859,20 +869,20 @@
"wkhtmltoimage",
"wkhtmltopdf"
],
"time": "2016-06-02T08:06:45+00:00"
"time": "2017-03-16T10:45:28+00:00"
},
{
"name": "monolog/monolog",
"version": "1.22.0",
"version": "1.22.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558"
"reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558",
"reference": "bad29cb8d18ab0315e6c477751418a82c850d558",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0",
"reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0",
"shasum": ""
},
"require": {
@ -937,7 +947,7 @@
"logging",
"psr-3"
],
"time": "2016-11-26T00:15:39+00:00"
"time": "2017-03-13T07:08:03+00:00"
},
{
"name": "psr/http-message",

View File

@ -0,0 +1,101 @@
<?php
class Metier_Credit_Contact extends Scores_Ws_Server
{
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* Logger
* @var \Monolog\Logger
*/
protected $logger;
/**
* Categorie de message
* @var array
*/
private $subjects=array(
'Le fonctionnement logiciel',
'Vos achats',
'Vos consommations',
'Autre'
);
/**
* Etape de traitement
* @var array
*/
private $stages=array(
'1' => 'En attente de reponse',
'2' => 'En cours de traitement',
'3' => 'Resolu'
);
/**
* Libelle des champs de valeur
* @var array
*/
private $libelles=array(
'id' => 'Reference enregistrement',
'idUSer' => 'Reference utilisateur',
'begin' => 'Message du',
'subject' => 'Categorie',
'message' => 'Message envoyé',
'stage' => 'Etape',
'answer' => 'Suivi'
);
public function __construct($db = null)
{
// Set Database
if ($this->conn === null) {
$this->conn = Zend_Registry::get('doctrine');
} else {
$this->conn = $conn;
}
if (Zend_Registry::isRegistered('logger')) {
$this->logger = Zend_Registry::get('logger');
}
}
/**
* Libelles correspondants aux id
* @return array
*/
public function getLibelles()
{
return array('libelles' => $this->libelles, 'stages' => $this->stages,'subjects' => $this->subjects);
}
public function saveFirstContact($data){
try{
$res=$this->conn->insert('sdv1.credit__contact',$data);
}catch(Exception $e){
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
return false;
}
return true;
}
public function getlisteContacts($idUser){
$sql='select c.*, u.email, u.login,u.nom, u.prenom
from sdv1.credit__contact c inner join sdv1.utilisateurs u on c.idUSer=u.id
where c.idUSer=:idUser
and (stage<3 or (stage=3 and begin>"'.Date('Y-m-d',time()-300*24*3600).'")) order by c.stage asc,c.id desc;';
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$infos=$stmt->fetchAll(PDO::FETCH_ASSOC);
}else{
$infos=array($idUser => 'No message');
}
return $infos;
}
}

View File

@ -0,0 +1,221 @@
<?php
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
class Metier_Credit_Decrement extends Scores_Ws_Server
{
protected $conn;
private $session_period=3600;
private $sessionvar=array();
private $rateType;
private $logCost;
public function __construct($db = null)
{
// Set Database
if ($this->conn === null) {
$this->conn = Zend_Registry::get('doctrine');
} else {
$this->conn = $conn;
}
if (Zend_Registry::isRegistered('logger')) {
$this->logger = Zend_Registry::get('logger');
}
}
public function canUse($idLog,$user){
$this->getRateType($user,$idLog);
$canUseResult=new stdClass();
$canUseResult->idLog=$idLog;
$canUseResult->result=false;
if($this->rateType==0){
$canUseResult->result=true;
}else{
$userCredit=$this->getUserCredit($idLog,$user,$this->rateType);
$canUseResult->result=($userCredit>=$this->logCost);
}
$canUseResult->typecredit=$this->rateType;
return $canUseResult;
}
public function setUsed($idLog,$user,$siret='0'){
if(!isset($this->rateType)){
$this->getRateType($user,$idLog);
}
$declog=array(
'idUser' => $user->id,
'idLog' => $idLog,
'login' => $user->login,
'consumption' => $this->logCost,
'siret' => $siret,
'created' => Date('Y-m-d H:i:s'),
);
$res=$this->conn->insert('sdv1.credit__consumption',$declog);
switch($this->rateType){
case 1:
$this->setBalance($user,'');
break;
case 2:
$this->setBalance($user,$idLog);
break;
}
//$newbalance=
//$this->logger->info(implode("##",$declog));
return true;
return $this->logCost.'--->'.$this->rateType;
}
private function setBalance($user, $idLog){
$sql='select * from sdv1.credit__balance where idUser= :idUser and idLog=:idLog;';
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $user->id);
$stmt->bindValue('idLog', $idLog);
$stmt->execute();
if ($stmt->rowCount() > 1) {
//@todo:faire une alerte à supportdev - ce n'est pas bloquant mais ça ne devrait pas se produire
}
if ($stmt->rowCount() >= 1) {
$ratedLog = $stmt->fetch(\PDO::FETCH_ASSOC);
$data=array(
'balance' => $ratedLog['balance']-$this->logCost,
'updated' => Date('Y-m-d H:i:s'),
);
$this->conn->update('sdv1.credit__balance',$data,array('id'=>$ratedLog['id']));
}else{
$data=array(
'idUser' => $user->id,
'login' => $user->login,
'idClient' => $user->idClient,
'idLog' => $idLog,
'balance' => 0-$this->logCost,
'created' => Date('Y-m-d H:i:s'),
);
$this->conn->insert('sdv1.credit__balance',$data);
}
}
private function getRateType($user,$idLog){
if($this->sessionGetRateType()){
return;
}
$this->rateType=0;
$this->logCost=0;
// --- Check Credit Authorization and parameters
$sql = "SELECT rateType,cost FROM sdv1.credit__rate
WHERE IdClient = :clientId AND serviceCode = :serviceCode AND idLog = :idLog" ;
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('clientId', $user->idClient);
$stmt->bindValue('serviceCode', $user->serviceCode);
$stmt->bindValue('idLog', $idLog);
//$this->logger->info($user->serviceCode);
$stmt->execute();
if ($stmt->rowCount() == 1) {
$ratedLog = $stmt->fetch(\PDO::FETCH_OBJ);
$this->rateType=$ratedLog->rateType;
$this->logCost=$ratedLog->cost;
//$this->logger->info(__LINE__ . 'getRateType OK'.$idLog.'-'.$user->idClient);
}else{
$this->rateType=0;
$this->logCost=0;
//$this->logger->info(__LINE__ . 'getRateType KO'.$idLog.'-'.$user->idClient);
}
}
private function sessionGetRateType(){
//@todo: gestion de l'info en session
return false;
}
private function getUserCredit($idLog,$user,$type){
switch($type){
case 1:
//Systeme type Paybox : Credit par utilisateur pour tous les logs
$r=$this->getUserallogs($user);
break;
case 2:
//Systeme type Contrat limité : Credit par log pour tous les utilisateurs d'un client
$r=$this->getLogallusers($idLog,$user->idClient);
break;
}
return $r;
}
private function getUserallogs($user){
$sql = "SELECT SUM(balance) as credit, count(*) as nbLig FROM sdv1.credit__balance
WHERE idUser = :idUser group by idUser" ;
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $user->id);
$stmt->execute();
if ($stmt->rowCount() == 1) {
$ratedLog = $stmt->fetch(\PDO::FETCH_OBJ);
$r=$ratedLog->credit;
if($r==0 and $ratedLog->nbLig==0){
$this->logFirstCredit(1000,$user);
$r=1000;
}
}else{
$r=0;
}
return $r;
}
private function getLogallusers($idLog,$idClient){
$sql = "SELECT SUM(balance) as credit, count(*) as nbLines FROM sdv1.credit__balance
WHERE idClient = :idClient and idLog= :idLog group by idClient,idLog" ;
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $user->id);
$stmt->execute();
if ($stmt->rowCount() == 1) {
$ratedLog = $stmt->fetch(\PDO::FETCH_OBJ);
$r=$ratedLog->credit;
}else{
$r=0;
}
return $r;
}
private function logFirstCredit($val,$user){
if($val>0){
$values=array(
'idUser' => $user->id,
'idCmd' => $user->id.'ww'.time(),
'login' => $user->login,
'nbCredit' => $val,
'amount' =>0,
'amount_ht' => 0,
'amount_tva' => 0,
'currency' => '',
'valid' => 1,
'date_sent' => Date('Y-m-d H:i:s'),
'date_received' => null,
'paybox_answer' => null,
'transaction' => json_encode(array('level' => 'Offre gratuite nouvel abonne','date' =>Date('Y-m-d H:i:s'), 'user' => $user->id)),
'comment' => 'Offre gratuite nouvel abonne'
);
try{
$this->conn->insert('sdv1.credit__paid',$values);
}catch(Exception $e){
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
$values=array(
'idUser' => $user->id,
'login' => $user->login,
'idClient' =>$user->idClient,
'idLog' => '',
'balance' => 1000,
'created' => Date('Y-m-d H:i:s'),
'updated' => null
);
try{
$this->conn->insert('sdv1.credit__balance',$values);
}catch(Exception $e){
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
}
}
}

View File

@ -0,0 +1,241 @@
<?php
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
class Metier_Credit_Information extends Scores_Ws_Server
{
/**
* PDO Connection with Doctrine
* @var \Doctrine\DBAL\Connection
*/
protected $conn;
/**
* Libelle des fonctions ws sous credit
* @var array
*/
public $libelles=array(
'getIdentite' => 'Fiche d\'identité',
'getIdentiteProcol' => 'Fiche procédure collective',
'getListeEtablissements' => 'Liste des établissements',
'getLiens' => 'Liens inter-entreprises',
'getGroupeInfos' => 'Informations Groupe',
'getListeEvenements' => 'Modifications Insee',
'getDirigeants' => 'Liste ou Historique des dirigeants',
'getSynthese' => 'Synthèse financière',
'getBilan' => 'Bilan Compte de résultat',
'getRatios' => 'Ratios financiers',
'getFlux' => 'Flux de trésorerie',
'getListeBilans' => 'Liasse fiscale',
'getInfosBourse' => 'Bourse et Cotations',
'getBanques' => 'Relations bancaires',
'getSubventionList' => 'Subventions',
'getAnnoncesLegales' => 'Annonces légales',
'getAnnoncesBalo' => 'Annonces BALO',
'getAnnoncesBoamp' => 'Annonces BOAMP',
'getListeCompetences' => 'Rubrique de Compétences territoriales',
'getAnnoncesAsso' => 'Annonces JO Associations',
'getListeConventions' => 'Conventions collectives',
'getMarques' => 'Marques déposées',
'getIndiScore' => 'Indiscore',
'getReportSynthese' => 'Rapport de synthèse',
'getRapport' => 'Rapport complet',
'getValo' => 'Valorisation',
);
/**
* tranches autorisées pour les crédits
* @var array
*/
private $tranches=array(
'1' => array(
'200' => array('montant' => 2000,'montantht' => 1667, 'tva' => 333, ),
'500' => array('montant' => 5000,'montantht' => 4167, 'tva' => 833, ),
'1000' => array('montant' => 10000,'montantht' => 8333, 'tva' => 1667, ),
),
'195' => array(
'200' => array('montant' => 2000,'montantht' => 1667, 'tva' => 333, ),
'500' => array('montant' => 5000,'montantht' => 4167, 'tva' => 833, ),
'1000' => array('montant' => 10000,'montantht' => 8333, 'tva' => 1667, ),
),
);
//deux premiers caracteres TVA de EU
private $idtvaintra=array('AT','BE','BG','CY','CZ','DE','DK','EE','EL','ES',
'FI','GB','HU','IE','IT','LT','LU','LV','MT','NL','PL',
'PT','RO','SE','SI','SK');
public function __construct($db = null)
{
// Set Database
if ($this->conn === null) {
$this->conn = Zend_Registry::get('doctrine');
} else {
$this->conn = $conn;
}
if (Zend_Registry::isRegistered('logger')) {
$this->logger = Zend_Registry::get('logger');
}
}
/**
* Recuperation des informations necessaires a la facturation
* @param int $id
*/
public function getInfosFacture($id,$user){
if(intval($id)>0){
$sql='select c.*, u.idClient, u.siret, u.email,u.nom,u.prenom
from sdv1.credit__paid c inner join sdv1.utilisateurs u on c.idUser=u.id
where c.id= :id;';
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $id);
}else{
$sql='select u.idClient, u.siret, u.email,u.nom,u.prenom
from sdv1.utilisateurs u
where u.id= :id;';
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $user->id);
}
$stmt->execute();
if ($stmt->rowCount() == 1) {
$infos['commande']=$stmt->fetch(PDO::FETCH_ASSOC);
}else{
$infos['commande']=null;
return $infos;
}
if(!isset($infos['commande']['siret']) || intval($infos['commande']['siret'])==0){
$infos['societe']=array();
$infos['entrep']=array();
return $infos;
}
$siren=substr($infos['commande']['siret'],0,9);
$nic=substr($infos['commande']['siret'],9,5);
try {
$stmt = $this->conn->prepare('SELECT * FROM insee.identite WHERE SIREN=:siren and nic=:nic');
$stmt->bindValue('siren', $siren);
$stmt->bindValue('nic', $nic);
$stmt->execute();
$infos['societe']=$stmt->fetch(\PDO::FETCH_ASSOC);
} catch (\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
$iInsee = new Metier_Insee_MInsee();
$infos['entrep']= $iInsee->getIdentiteEntreprise($siren, $nic, 0, false);
return $infos;
}
public function getHistoUser($user,$nbligpaid=20,$nbligused=50){
$idUser = $user->id;
if(intval($idUser)==0){
throw new SoapFault('MSG', 'Authentification défectueuse');
}
$this->redresseRapports($idUser);
$sql = "SELECT * FROM sdv1.credit__balance c
WHERE c.idUser=:idUser";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
try {
$stmt->execute();
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
throw(new SoapFault('MSG', 'Acces base impossible'));
}
if ($stmt->rowCount() > 0) {
$res=$stmt->fetch(\PDO::FETCH_ASSOC);
$info->balance=$res;
}else{
$info->balance=null;
}
$sql = "SELECT * FROM sdv1.credit__paid c
WHERE c.idUser=:idUser order by id desc limit ".$nbligpaid;
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->execute();
$info->paid=$stmt->fetchAll(\PDO::FETCH_ASSOC);
$sql = "SELECT * FROM sdv1.credit__consumption c
inner join credit__rate r on c.idLog=r.idLog
WHERE c.idUser=:idUser and r.idClient=:idClient order by c.id desc limit ".$nbligused;
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->bindValue('idClient', $user->idClient);
$stmt->execute();
$info->used=$stmt->fetchAll(\PDO::FETCH_ASSOC);
$info->libelle=$this->libelles;
//$this->wsLog(__FUNCTION__,$idUser,'0');
return $info;
}
public function getMensuelConso($user){
$glue=";";
$idUser = $user->id;
if(intval($idUser)==0){
throw new SoapFault('MSG', 'Authentification défectueuse');
}
$sql = 'SELECT * FROM sdv1.credit__consumption c
inner join credit__rate r on c.idLog=r.idLog
WHERE c.idUser=:idUser and r.idClient=:idClient and created>"'.Date('Y-m-d',time()-31*24*3600).'"
order by c.id desc';
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->bindValue('idClient', $user->idClient);
$stmt->execute();
$info=$stmt->fetchAll(\PDO::FETCH_ASSOC);
$tab=array();
foreach($info as $row){
$tab[]=implode($glue,array(
'date' => $row['created'],
'nb_credit' => $row['consumption'],
'fonction' => $this->libelles[$row['idLog']],
'siren' => substr($row['siret'],0,9)
));
}
return $tab;
}
/*
* Les rapports Complets et Rapports de synthèse font des appels surnuméraires au WS
* Cette fonction corrige ces appels avant affichage
*/
private function redresseRapports($idUser){
if(intval($idUser)==0){
throw new SoapFault('MSG', 'Authentification défectueuse');
}
$sql='select * from sdv1.credit__consumption
where idLog="getReportSynthese" or idLog="getRapport" and idUser=:idUser
and created>"'.Date('Y-m-d',time()-30*24*3600).'" order by id desc;';
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->execute();
$rapports=$stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach($rapports as $row){
$sql='select SUM(consumption) as mtt from sdv1.credit__consumption
where (idLog="getLiens" or idLog="getDirigeants" or idLog="getAnnoncesLegales")
and idUser='.intval($idUser).'
and substr(siret,1,9)="'.substr($row['siret'],0,9).'"
and created>"'.Date('Y-m-d H:i:s',strtotime($row['created'])-10).'"
and created<"'.Date('Y-m-d H:i:s',strtotime($row['created'])+10).'";';
$stmt = $this->conn->prepare($sql);
$stmt->execute();
$res=$stmt->fetch(\PDO::FETCH_OBJ);
if(intval($res->mtt)>0){
$sql='update sdv1.credit__balance set balance=balance+'.$res->mtt.' where idUser='.intval($idUser).';';
$stmt = $this->conn->prepare($sql);
$stmt->execute();
$sql='update sdv1.credit__consumption set consumption=0, idLog=concat(idLog,"free")
where (idLog="getLiens" or idLog="getDirigeants" or idLog="getAnnoncesLegales")
and idUser='.intval($idUser).'
and substr(siret,1,9)="'.substr($row['siret'],0,9).'"
and created>"'.Date('Y-m-d H:i:s',strtotime($row['created'])-10).'"
and created<"'.Date('Y-m-d H:i:s',strtotime($row['created'])+10).'";';
$stmt = $this->conn->prepare($sql);
$stmt->execute();
}
}
}
}

View File

@ -73,6 +73,10 @@ class Scores_Ws_Server
'62.210.222.34',
);
protected $idLog = 'unknown';
protected $idMainLog = 'unknown';
/**
* Liste des permissions
* @var array
@ -90,14 +94,14 @@ class Scores_Ws_Server
* @var array
*/
protected $listePrefs = array(
'NAF4' => "Afficher les anciens NAF",
'NACE' => "Afficher les codes NACES",
'NEWS' => "Afficher les news Google&copy;",
'MAPPY' => "Afficher les fa&ccedil;ades d'immeubles",
'NAF4' => "Afficher les anciens NAF",
'NACE' => "Afficher les codes NACES",
'NEWS' => "Afficher les news Google&copy;",
'MAPPY' => "Afficher les fa&ccedil;ades d'immeubles",
'CARTES' => "Afficher les cartes et les plans",
'VOIRSURV' => "Afficher les entités sous surveillances",
'VOIRSURV' => "Afficher les entités sous surveillances",
'DEMANDEREF' => "Demande de référence par defaut",
'RECHREF' => "Afficher le formulaire de recherche par référence",
'RECHREF' => "Afficher le formulaire de recherche par référence",
);
/**
@ -219,6 +223,7 @@ class Scores_Ws_Server
'0904' => "Adresse IP Invalide",
'0905' => "Accès environnement de test non autorisé",
'0906' => "Erreur configuration utilisateur",
'0907' => "Crédits insuffisants",
'1010' => "Siren invalide",
'1011' => "Identifiant invalide",
'1020' => "Siren inexistant",
@ -301,7 +306,6 @@ class Scores_Ws_Server
$siren = $siret;
$nic = '';
}
// Set data by default
$dataInsert = array(
'login' => $this->User->login,
@ -381,8 +385,8 @@ class Scores_Ws_Server
$this->conn->insert('sdv1.logs', $dataInsert);
} catch (\Doctrine\DBAL\DBALException $e) {
}
$this->decLog($this->idLog,$siret);
}
/**
* Authenticate with SoapHeader, Optional (Authentication could be done by sending HTTP Basic header - see the doc)
* @param string $username
@ -452,11 +456,56 @@ class Scores_Ws_Server
* Check permission
* @param string $perm
*/
protected function permission($perm)
protected function permission($perm,$idLog='')
{
if (!$this->checkPerm($perm)) {
$this->sendError('0902');
}
if (!$this->checkCredit($idLog)) {
$this->sendError('0907');
}
}
/**
* Check if user has the money to access payable WebService
* @throws SoapFault
*/
protected function checkCredit($idLog){
//if(empty($idLog)){$idLog=$this->getIdLog();}
//@todo:retirer la securite apres verif
if(!empty($idLog)){
$this->idLog=$idLog;
}
$crdt=new Metier_Credit_Decrement();
$ok=$crdt->canUse($idLog,$this->User);
return $ok->result;
}
/**
* Logs access to payable WebService
* @throws SoapFault
*/
protected function decLog($idLog=null,$siret='0'){
$this->idLog=$idLog;
$crdt=new Metier_Credit_Decrement();
$ok=$crdt->setUsed($this->idLog,$this->User,$siret);
return $ok;
}
/**
* I keep this one oldie but goodie
*
*/
private function getIdLog(){
$tab=explode("#",$_SERVER['CONTENT_TYPE']);
if(count($tab)>1){
$tab=explode('"',$tab);
$idLog=$tab[0];
}else{
$idLog=$this->idLog;
}
$this->logger->info('idLog :'.$idLog);
return $idLog;
}
/**
@ -532,7 +581,7 @@ class Scores_Ws_Server
$qb->select(array(
'u.login', 'u.id', 'u.email', 'u.password', 'u.idClient', 'u.typeCompte', 'u.actif',
'u.filtre_ip', 'u.profil', 'u.civilite', 'u.nom', 'u.prenom', 'u.tel', 'u.fax',
'u.mobile', 'u.pref', 'u.rechRefType', 'u.profil', 'u.nombreConnexions',
'u.mobile', 'u.pref', 'u.rechRefType', 'u.profil', 'u.nombreConnexions', 'u.siret',
'u.dateDerniereConnexion', 'u.droits', 'u.referenceParDefaut', 'u.nbReponses', 'u.lang',
'u.formatMail', 'u.dateDebutCompte', 'u.dateFinCompte', 'u.accesWS', 'u.acceptationCGU',
'c.droits AS droitsClients', 'c.test AS clientTest', 'c.typeScore', 'c.timeout',
@ -783,6 +832,7 @@ class Scores_Ws_Server
$this->User->dateFinCompte = $userInfos->dateFinCompte;
$this->User->acceptationCGU = $userInfos->acceptationCGU;
$this->User->version = $userInfos->version;
$this->User->siret = isset($userInfos->siret)?$userInfos->siret:0;
return true;
}
@ -880,6 +930,7 @@ class Scores_Ws_Server
$this->User->dateFinCompte = $userInfos->dateFinCompte;
$this->User->acceptationCGU = $userInfos->acceptationCGU;
$this->User->version = $userInfos->version;
$this->User->siret = isset($userInfos->siret)?$userInfos->siret:0;
// Add Service Parameter to user definition
$this->User->typeScore = $result->TypeScore;

View File

@ -1468,6 +1468,23 @@ class Account extends Scores_Ws_Server
}
/**
* Change siret
* @param string $siret
* @return boolean
*/
public function setUserSiret($siret)
{
$this->authenticate();
$id = $this->User->id;
$result = $this->conn->update('sdv1.utilisateurs',
array('siret'=>$siret), array('id' => $id));
if ( $result == 1 ) {
return true;
}
return false;
}
/**
* Change password
* @param string $password

View File

@ -0,0 +1,10 @@
<?php
return array(
'GetCredit' => 'GetCredit',
'InfoCredit' => 'InfoCredit',
'MensuelconsoCredit' => 'MensuelconsoCredit',
'PayCredit' => 'PayCredit',
'UseCredit' => 'UseCredit',
'ContactCredit' => 'ContactCredit',
'GetcontactsCredit' => 'GetcontactsCredit',
);

View File

@ -0,0 +1,236 @@
<?php
require_once __DIR__ . '/Types.php';
class Credit extends Scores_Ws_Server
{
protected $libdroits = 'portemonnaie';
/**
* Retourne le nombre de crédit disponible à un utilisateur
* @return int
*/
public function getCredit()
{
$this->authenticate();
$this->permission($this->libdroits);
$idUser = $this->User->id;
try {
$sql = "SELECT * FROM sdv1.credit__balance c
WHERE c.idUser=:idUser";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$rnvpResult = $stmt->fetch(\PDO::FETCH_OBJ);
$credit = $rnvpResult->balance;
}
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
$this->wsLog('credit', $idUser);
return $credit;
}
/**
* Retourne la totalite des infos de crédit à un utilisateur
* @return infoCredit
*/
public function infoCredit()
{
$info=new InfoCredit();
$this->authenticate();
$this->permission($this->libdroits,__FUNCTION__);
$crdt=new Metier_Credit_Information();
$info=$crdt->getHistoUser($this->User,20,50);
return $info;
}
/**
* Retourne la totalite des infos de crédit à un utilisateur
* @return infoCredit
*/
public function mensuelconsoCredit()
{
$info=new mensuelconsoCredit();
$this->authenticate();
$this->permission($this->libdroits,__FUNCTION__);
$crdt=new Metier_Credit_Information();
return $crdt->getHistoUser($this->User,0,10000);
}
/**
* Mettre à jour la table Credit_paid
* @param string ligneCredit
* @return PayCredit
*/
public function payCredit($ligneCredit='')
{
$this->authenticate();
$this->permission($this->libdroits,__FUNCTION__);
$PayCreditResult=new PayCredit();
$ir=(array)json_decode($ligneCredit);
$tab=explode('ww',$ir['idCmd']);
$verifid=$tab[0];
$idUser = $this->User->id;
if($idUser!=$verifid){
throw(new SoapFault('MSG', 'Erreur à l\'enregistrement de votre achat'));
$PayCreditResult->message='Bad data format';
$PayCreditResult->result=false;
return $PayCreditResult;
}
$PayCreditResult->ligneCredit=$ligneCredit;
$PayCreditResult->message='';
if(empty($ir) || !isset($ir['idCmd'])){
throw(new SoapFault('MSG', 'Erreur à l\'enregistrement de votre commande'));
$PayCreditResult->message='Bad data format';
$PayCreditResult->result=false;
return $PayCreditResult;
}
$sql = "SELECT transaction FROM sdv1.credit__paid c
WHERE c.idCmd=:idCmd";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idCmd', $ir['idCmd']);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$row=$stmt->fetch(\PDO::FETCH_ASSOC);
$transaction=(array)json_decode($row['transaction']);
$transaction[]=(array)json_decode($ir['transaction']);
$ir['transaction']=json_encode($transaction);
$r = $this->conn->update('sdv1.credit__paid', $ir,array('idCmd' => $ir['idCmd']));
}else{
$transaction=array();
$transaction[]=(array)json_decode($ir['transaction']);
$r = $this->conn->insert('sdv1.credit__paid', $ir);
}
if($ir['valid']==1){
$sql = "SELECT nbCredit FROM sdv1.credit__paid c
WHERE c.idCmd=:idCmd";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idCmd', $ir['idCmd']);
$stmt->execute();
$payrow=$stmt->fetch(\PDO::FETCH_ASSOC);
$sql = "SELECT balance FROM sdv1.credit__balance c
WHERE c.idUser=:idUser";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('idUser', $idUser);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$brow=$stmt->fetch(\PDO::FETCH_ASSOC);
$balance=$brow['balance']+$payrow['nbCredit'];
$data=array(
'idUser' => $idUser,
'login' => $this->User->login,
'balance' => $balance,
'updated' => Date('Y-m-d H:i:s')
);
$r = $this->conn->update('sdv1.credit__balance', $data,array('idUser' => $idUser));
}else{
$balance=$payrow['nbCredit'];
$data=array(
'idUser' => $idUser,
'login' => $this->User->login,
'balance' => $balance,
'created' => Date('Y-m-d H:i:s')
);
$r = $this->conn->insert('sdv1.credit__balance', $data);
}
}
$PayCreditResult->result=true;
$this->wsLog(__FUNCTION__, $idUser);
return $PayCreditResult;
}
/**
* Decrement sur cache Extranet
* @param string idLog
* @return UseCredit
*/
public function useCredit($idLog,$siren='extranet')
{
$UseCreditResult=new UseCredit();
$UseCreditResult->idLog=$idLog;
$this->authenticate();
$idUser = $this->User->id;
$crdt=new Metier_Credit_Decrement();
$ok=$crdt->canUse($idLog,$this->User);
if(!$ok->result){
$UseCreditResult->result=false;
}else{
$ok=$crdt->setUsed($idLog,$this->User,$siren);
$UseCreditResult->result=true;
}
return $UseCreditResult;
}
/**
* Enregistrement des demandes de contact
* @param string contactdata
* @return ContactCredit
*/
public function contactCredit($contactdata)
{
$data=(array)json_decode($contactdata);
$this->authenticate();
$this->permission($this->libdroits);
$ContactCreditResult=new ContactCredit();
$ContactCreditResult->contactdata=$contactdata;
$crdt=new Metier_Credit_Contact();
$ok=$crdt->saveFirstContact($data);
if(!$ok){
$ContactCreditResult->result=false;
}else{
$ContactCreditResult->result=true;
}
return $ContactCreditResult;
}
/**
* Lecture des demandes de contact
* @return GetcontactsCredit
*/
public function getcontactsCredit(){
$this->authenticate();
$idUser = $this->User->id;
$this->permission($this->libdroits);
$GetcontactsCreditResult=new GetcontactsCredit();
$crdt=new Metier_Credit_Contact();
$GetcontactsCreditResult->result=$crdt->getlisteContacts($idUser);
return $GetcontactsCreditResult;
}
/**
* Recherche des donnees de facturation
* @param integer id
* @return GetfactinfosCredit
*/
public function getfactinfosCredit($id){
$this->authenticate();
$idUser = $this->User->id;
$this->permission($this->libdroits);
$GetfactinfosCreditResult=new GetfactinfosCredit();
$GetfactinfosCreditResult->id=$id;
$crdt=new Metier_Credit_Information();
$GetfactinfosCreditResult->result=$crdt->getInfosFacture($id,$this->User);
return $GetfactinfosCreditResult;
}
public function setsiretCredit($siret){
$this->authenticate();
$idUser = $this->User->id;
$this->permission($this->libdroits);
$GetfactinfosCreditResult=new GetfactinfosCredit();
$GetfactinfosCreditResult->id=$id;
$crdt=new Metier_Credit_Information();
$GetfactinfosCreditResult->result=$crdt->getInfosFacture($id,$this->User);
return $GetfactinfosCreditResult;
}
}

View File

@ -0,0 +1,120 @@
<?php
class GetCredit
{
}
class InfoCredit{
/**
* Etat actuel du compte
* @var array
*/
public $balance;
/**
* 100 derniers Mouvements en entree du compte
* @var array
*/
public $paid;
/**
* 100 derniers Mouvements en sortie du compte
* @var array
*/
public $used;
/**
* Les libelles des codes fonction
* @var array
*/
public $libelle;
}
class MensuelconsoCredit{
/**
* Etat actuel du compte
* @var array
*/
public $balance;
/**
* 100 derniers Mouvements en entree du compte
* @var array
*/
public $paid;
/**
* 100 derniers Mouvements en sortie du compte
* @var array
*/
public $used;
/**
* Les libelles des codes fonction
* @var array
*/
public $libelle;
}
class PayCredit
{
/**
* Success or failed
* @var boolean
*/
public $result;
/**
* Message
* @var string
*/
public $message;
/**
* Params sent
* @var string
*/
public $ligneCredit;
}
class UseCredit
{
/**
* Success or failed
* @var boolean
*/
public $result;
/**
* Params sent
* @var string
*/
public $idLog;
}
class ContactCredit
{
/**
* Success or failed
* @var boolean
*/
public $result;
/**
* Params sent
* @var string
*/
public $contactdata;
}
class GetcontactsCredit
{
/**
* List of contacts
* @var array
*/
public $result;
}
class GetfactinfosCredit
{
/**
* All informations for invoicing
* @var array
*/
public $result;
/**
* Params sent
* @var integer
*/
public $id;
}

View File

@ -13,7 +13,12 @@ class Entreprise extends Scores_Ws_Server
public function getIdentite($siret, $id = 0)
{
$this->authenticate();
$this->permission('identite');
if(isset($this->freeservice) && $this->freeservice){
$idLog='freeservice';
}else{
$idLog= __FUNCTION__ ;
}
$this->permission('identite', $idLog);
//Initialisation
if (empty($id)) { $id = 0; }
@ -297,7 +302,7 @@ class Entreprise extends Scores_Ws_Server
public function getIdentiteProcol($siret, $id=0, $forceVerif=false)
{
$this->authenticate();
$this->permission('idprocol');
$this->permission('idprocol',__FUNCTION__);
$this->logger->info("Identité AGS demandée pour siret $siret (id=$id)");
@ -660,7 +665,12 @@ class Entreprise extends Scores_Ws_Server
public function getLiens($siren, $actifsUniquement = true)
{
$this->authenticate();
$this->permission('liens');
if(isset($this->freeservice) && $this->freeservice){
$idLog='freeservice';
}else{
$idLog= __FUNCTION__ ;
}
$this->permission('liens',$idLog);
// Initialisation
if (empty($actifsUniquement)) { $actifsUniquement = true; }
@ -739,7 +749,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeEtablissements($siren, $dep = 0, $actif = -1, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('etablissements');
$this->permission('etablissements',__FUNCTION__);
//Initialisation
if (empty($dep)) { $dep = 0; }
@ -807,7 +817,12 @@ class Entreprise extends Scores_Ws_Server
public function getDirigeants( $siren , $histo = false)
{
$this->authenticate();
$this->permission('dirigeants');
if(isset($this->freeservice) && $this->freeservice){
$idLog='freeservice';
}else{
$idLog= __FUNCTION__ ;
}
$this->permission('dirigeants',$idLog);
//Initialisation
if (empty($histo)) { $histo = false; }
@ -864,7 +879,12 @@ class Entreprise extends Scores_Ws_Server
public function getAnnonces($siren, $filtre = 1, $idAnn = '', $position = 0, $nbRep = 100)
{
$this->authenticate();
$this->permission('annonces');
if(isset($this->freeservice) && $this->freeservice){
$idLog='freeservice';
}else{
$idLog= __FUNCTION__ ;
}
$this->permission('annonces',$idLog);
//Initialisation
if (empty($filtre)) { $filtre = 1; }
@ -1164,7 +1184,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesLegales($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces',__FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = null; }
@ -1269,7 +1289,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesAsso($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces',__FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = 0; }
@ -1358,7 +1378,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesBoamp($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces', __FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = ''; }
@ -1458,7 +1478,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesBalo($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces',__FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = null; }
@ -1556,12 +1576,21 @@ class Entreprise extends Scores_Ws_Server
$perm = false;
//@todo : Gestion des droits
switch($niveau){
case 3: $perms = array('indiscore3', 'indiscore3p'); break;
case 2: $perms = array('indiscore2', 'indiscore2p', 'indiscore3', 'indiscore3p'); break;
case 1: $perms = array('indiscore', 'indiscorep'); break;
case 3:
$perms = array('indiscore3', 'indiscore3p');
$idLog='getReportSynthese';
break;
case 2:
$perms = array('indiscore2', 'indiscore2p', 'indiscore3', 'indiscore3p');
$idLog='getReportSynthese';
break;
case 1:
$perms = array('indiscore', 'indiscorep');
$idLog='getIndiScore';
break;
}
foreach($perms as $item){
if ( $this->checkPerm($item) ){
if ( $this->checkPerm($item, $idLog) ){
$perm = true;
break;
}
@ -1782,6 +1811,7 @@ class Entreprise extends Scores_Ws_Server
$this->wsLog('indiscore+',$siren);
} else
$this->wsLog('indiscore',$siren);
//$this->decLog($idLog);
return $output;
}
@ -1795,7 +1825,7 @@ class Entreprise extends Scores_Ws_Server
public function getValo($siren, $nic=0, $niveau=2)
{
$this->authenticate();
$this->permission('indiscore');
$this->permission('indiscore',__FUNCTION__);
//Initialisation
$accesDist = true;
@ -2045,7 +2075,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=1000)
{
$this->authenticate();
$this->permission('eveninsee');
$this->permission('eveninsee',__FUNCTION__);
//Initialisation
if (empty($nic)) { $nic = 0; }
@ -2767,7 +2797,7 @@ class Entreprise extends Scores_Ws_Server
public function getInfosReg( $siren, $id = false )
{
$this->authenticate();
$this->permission('infosreg');
$this->permission('infosreg',__FUNCTION__);
//Initialisation
if (empty($id)) $id = false;
@ -2832,7 +2862,7 @@ class Entreprise extends Scores_Ws_Server
public function getInfosBourse($siren)
{
$this->authenticate();
$this->permission('bourse');
$this->permission('bourse', __FUNCTION__);
//Initialisation
$error = new ErrorType();
@ -2917,32 +2947,32 @@ class Entreprise extends Scores_Ws_Server
$source = strtolower($source);
switch ($source) {
case 'insee':
$this->permission('survinsee');
$this->permission('survinsee',__FUNCTION__);
break;
case 'bilans':
$this->permission('survbilan');
$this->permission('survbilan',__FUNCTION__);
break;
case 'actes':
$this->permission('survactes');
$this->permission('survactes',__FUNCTION__);
break;
case 'privileges':
$this->permission('survpriv');
$this->permission('survpriv',__FUNCTION__);
break;
case 'dirigeants':
$this->permission('survdirigeants');
$this->permission('survdirigeants',__FUNCTION__);
break;
case 'score':
$this->permission('survscore');
$this->permission('survscore',__FUNCTION__);
break;
case 'paiements':
$this->permission('survpaiements');
$this->permission('survpaiements',__FUNCTION__);
break;
case 'liens':
$this->permission('survliens');
$this->permission('survliens',__FUNCTION__);
break;
case 'annonces':
default:
$this->permission('survannonce');
$this->permission('survannonce',__FUNCTION__);
break;
}
@ -3032,7 +3062,7 @@ class Entreprise extends Scores_Ws_Server
public function getSurveillances($filtre, $position=0, $nbRep=100)
{
$this->authenticate();
$this->permission('survliste');
$this->permission('survliste',__FUNCTION__);
//Initialisation
if (empty($position)) $position = 0;
@ -3307,7 +3337,7 @@ class Entreprise extends Scores_Ws_Server
public function getBilan($siren, $millesime, $typeBilan='N', $ref='')
{
$this->authenticate();
$this->permission('liasse');
$this->permission('liasse',__FUNCTION__);
//Initialisation
if (empty($typeBilan)) { $typeBilan = 'N'; }
@ -3346,6 +3376,7 @@ class Entreprise extends Scores_Ws_Server
}
$this->wsLog('bilan',$siren, $millesime.':'.$typeBilan.':'.$ref);
$resultBilan->POSTES = $tabPoste;
$this->decLog('getBilan');
return $resultBilan;
}
@ -3358,7 +3389,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeBilans($siren)
{
$this->authenticate();
$this->permission('liasse');
$this->permission('liasse',__FUNCTION__);
//Initialisation
$tabRet = array();
@ -3443,7 +3474,7 @@ class Entreprise extends Scores_Ws_Server
public function rechercheAnnonce($source, $dateAnnee, $numParution, $numAnnonce)
{
$this->authenticate();
$this->permission('histobodacc');
$this->permission('histobodacc',__FUNCTION__);
//Initialisation
$tabRet = array();
@ -3529,7 +3560,7 @@ class Entreprise extends Scores_Ws_Server
public function getRatios($siren, $page='ratios')
{
$this->authenticate();
$this->permission('ratios');
$this->permission('ratios',__FUNCTION__);
global $tva, $tabFormules, $mBil, $tabBilan, $efftr, $tabInfla;
$tabFormules = include APPLICATION_PATH . '/../library/Metier/Scores/Data/TabFormules.php';
@ -3745,6 +3776,7 @@ class Entreprise extends Scores_Ws_Server
public function getRapport($siren, $niveau=3, $id=0, $plus=false, $ref='', $encours=0, $email='')
{
$this->authenticate();
$this->checkCredit(__FUNCTION__);
if (empty($niveau)) $niveau = 3;
if (empty($id)) $id = 0;
$result = new Rapport();
@ -3767,7 +3799,7 @@ class Entreprise extends Scores_Ws_Server
if ($perm === false) {
$this->sendError('0902');
}
$this->freeservice=true;
$accesDist=true;
$nivComment=2;
if ($niveau==1){
@ -3786,6 +3818,7 @@ class Entreprise extends Scores_Ws_Server
$result->Ratios = $this->getRatios($siren, $page="rapport$niveau");
$result->Annonces = $this->getAnnonces($siren, $filtre, $idAnn);
}
$this->freeservice=false;
return $result;
}
@ -3797,7 +3830,7 @@ class Entreprise extends Scores_Ws_Server
public function getBanques($siren)
{
$this->authenticate();
$this->permission('searchent',__FUNCTION__);
//Initialisation
$iDb = new Metier_Util_Db();
$tabRet = array();
@ -3874,7 +3907,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeCompetences($siret, $type, $codeInsee)
{
$this->authenticate();
$this->permission('competences');
$this->permission('competences',__FUNCTION__);
//Initialisation
$error = new ErrorType();

View File

@ -3,6 +3,7 @@ require_once __DIR__ . '/Types.php';
class Entreprise extends Scores_Ws_Server
{
private $freeService=false;
/**
* Retourne les informations identitaires de l'entreprise ou de l'établissement demandé
* @param string $siret Siren de l'entreprise ou siret de l'établissement
@ -12,7 +13,7 @@ class Entreprise extends Scores_Ws_Server
public function getIdentite($siret, $id = 0)
{
$this->authenticate();
$this->permission('identite');
$this->permission('identite',__FUNCTION__);
//Initialisation
if (empty($id)) { $id = 0; }
@ -283,7 +284,7 @@ class Entreprise extends Scores_Ws_Server
public function getAvisRncs($siren)
{
$this->authenticate();
$this->permission('avisrncs');
$this->permission('avisrncs',__FUNCTION__);
$len = strlen($siren);
if ( $len != 9 ) {
@ -470,7 +471,7 @@ class Entreprise extends Scores_Ws_Server
public function getIdentiteProcol($siret, $id=0, $forceVerif=false)
{
$this->authenticate();
$this->permission('idprocol');
$this->permission('idprocol',__FUNCTION__);
$this->logger->info("Identité AGS demandée pour siret $siret (id=$id)");
@ -826,7 +827,7 @@ class Entreprise extends Scores_Ws_Server
public function getLiens($siren, $type = null)
{
$this->authenticate();
$this->permission('liens');
$this->permission('liens',__FUNCTION__);
//Load country table
try {
@ -1043,7 +1044,7 @@ class Entreprise extends Scores_Ws_Server
public function getLiensById($id, $type = null)
{
$this->authenticate();
$this->permission('liens');
$this->permission('liens',__FUNCTION__);
try {
$countryM = new Application_Model_JoTabPays();
@ -1260,7 +1261,7 @@ class Entreprise extends Scores_Ws_Server
public function getLienRef($id)
{
$this->authenticate();
$this->permission('liens');
$this->permission('liens',__FUNCTION__);
$refM = new Application_Model_JoLiensRef();
@ -1359,7 +1360,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeEtablissements($siren, $dep = 0, $actif = -1, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('etablissements');
$this->permission('etablissements',__FUNCTION__);
//Initialisation
if (empty($dep)) { $dep = 0; }
@ -1424,7 +1425,7 @@ class Entreprise extends Scores_Ws_Server
public function getDirigeants( $siren , $histo = false)
{
$this->authenticate();
$this->permission('dirigeants');
$this->permission('dirigeants',__FUNCTION__);
//Initialisation
if (empty($histo)) { $histo = false; }
@ -1460,7 +1461,7 @@ class Entreprise extends Scores_Ws_Server
$dirigeant->DateFct = $dir['DateFct']; //@todo : date
$liste[] = $dirigeant;
}
$this->wsLog('dirigeants',$siren,$option);
$this->wsLog('dirigeants',$siren,$histo);
$this->logger->info( 'Nb Dirigeants retournés = '. count($dirs));
$output = new DirigeantsReturn();
$output->result = $liste;
@ -1569,7 +1570,7 @@ class Entreprise extends Scores_Ws_Server
$annonce->TribunalSiret = $ann['TribunalSiret'];
$annonce->Rubrique = $ann['Rubrique'];
$annonce->typeAnnonce = $ann['typeAnnonce'];
$annonce->texteRectificatif = $ann['texteRectificatif'];
$annonce->texteRectificatif = isset($ann['texteRectificatif'])?$ann['texteRectificatif']:null;
$annonce->texteAnnonce = $ann['texteAnnonce'];
$annonce->libFJ = $ann['libFJ'];
$annonce->codFJ = $ann['codFJ'];
@ -1584,7 +1585,7 @@ class Entreprise extends Scores_Ws_Server
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
$annonce->evenements = $evens;
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
$annonce->Lien_Annonce_Pdf = isset($ann['Lien_Annonce_Pdf'])?$ann['Lien_Annonce_Pdf']:null;
$liste[] = $annonce;
}
@ -1785,7 +1786,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesLegales($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces',__FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = null; }
@ -1875,7 +1876,7 @@ class Entreprise extends Scores_Ws_Server
$annonce->DateParution = $ann['DateParution']; //@todo : date
$annonce->Departement = $ann['Departement'];
$annonce->Tribunal = $ann['Tribunal'];
$annonce->TribunalCode = $ann['TribunalCode'];
$annonce->TribunalCode = isset($ann['TribunalCode'])?$ann['TribunalCode']:null;
$annonce->TribunalSiret = $ann['TribunalSiret'];
$annonce->Rubrique = $ann['Rubrique'];
$annonce->typeAnnonce = $ann['typeAnnonce'];
@ -1911,7 +1912,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesAsso($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces', __FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = 0; }
@ -2006,7 +2007,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesBoamp($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces',__FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = ''; }
@ -2139,7 +2140,7 @@ class Entreprise extends Scores_Ws_Server
public function getAnnoncesBalo($siren, $idAnn = null, $filtre = null, $position = 0, $nbRep = 20)
{
$this->authenticate();
$this->permission('annonces');
$this->permission('annonces', __FUNCTION__);
//Initialisation
if (empty($idAnn)) { $idAnn = null; }
@ -2238,9 +2239,26 @@ class Entreprise extends Scores_Ws_Server
$perm = false;
//@todo : Gestion des droits
switch($niveau){
case 3: $perms = array('indiscore3', 'indiscore3p'); break;
case 2: $perms = array('indiscore2', 'indiscore2p', 'indiscore3', 'indiscore3p'); break;
case 1: $perms = array('indiscore', 'indiscorep'); break;
case 4:
$perms = array('indiscore', 'indiscorep');
$niveau=1;
$idLog='getReportSynthese';
break;
case 3:
$perms = array('indiscore3', 'indiscore3p');
$idLog='getRapport';
break;
case 2:
$perms = array('indiscore2', 'indiscore2p', 'indiscore3', 'indiscore3p');
$idLog='getRapport';
break;
case 1:
$perms = array('indiscore', 'indiscorep');
$idLog='getIndiScore';
break;
default:
$idLog='getIndiScore';
break;
}
foreach($perms as $item){
if ( $this->checkPerm($item) ){
@ -2251,7 +2269,11 @@ class Entreprise extends Scores_Ws_Server
if ($perm === false) {
$this->sendError('0902');
}
if($this->freeService){
$this->checkCredit('freeService');
}else{
$this->checkCredit($idLog);
}
$tabRet = array();
$this->logger->info("IndiScore demandée pour $siren en niveau $niveau");
if (strlen($siren) > 9 || (substr($siren,0,9)*1) < 100 ){
@ -2473,7 +2495,6 @@ class Entreprise extends Scores_Ws_Server
} else {
$this->wsLog('indiscore',$siren);
}
return $output;
}
@ -2487,8 +2508,8 @@ class Entreprise extends Scores_Ws_Server
public function getValo($siren, $nic=0, $niveau=2)
{
$this->authenticate();
$this->permission('VALORISATION');
$this->permission('VALORISATION',__FUNCTION__);
$this->checkCredit(__FUNCTION__);
//Initialisation
$accesPartenaire = true;
if (APPLICATION_ENV == 'development') {
@ -2911,7 +2932,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=50)
{
$this->authenticate();
$this->permission('eveninsee');
$this->permission('eveninsee',__FUNCTION__);
//Initialisation
if (empty($nic)) { $nic = 0; }
@ -3655,7 +3676,7 @@ class Entreprise extends Scores_Ws_Server
public function getInfosReg( $siren, $id = null )
{
$this->authenticate();
$this->permission('infosreg');
$this->permission('infosreg',__FUNCTION__);
//Initialisation
if (empty($id)) $id = null;
@ -3718,7 +3739,7 @@ class Entreprise extends Scores_Ws_Server
public function getInfosBourse($siren)
{
$this->authenticate();
$this->permission('bourse');
$this->permission('bourse', __FUNCTION__ );
//Initialisation
$error = new ErrorType();
@ -4302,7 +4323,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeBilans($siren)
{
$this->authenticate();
$this->permission('liasse');
$this->permission('liasse',__FUNCTION__);
//Initialisation
$tabRet = array();
@ -4574,7 +4595,7 @@ class Entreprise extends Scores_Ws_Server
public function getRatios($siren, $page='ratios')
{
$this->authenticate();
$this->permission('ratios');
$this->permission('ratios','get'.ucfirst($page));
//Initialisation
if (empty($page)) $page = 'ratios';
@ -4869,7 +4890,8 @@ class Entreprise extends Scores_Ws_Server
if ($perm === false) {
$this->sendError('0902');
}
$this->checkCredit('getRapport');
$this->freeService=true;
$accesDist=true;
$nivComment=2;
if ($niveau==1){
@ -4888,6 +4910,8 @@ class Entreprise extends Scores_Ws_Server
$result->Ratios = $this->getRatios($siren, $page="rapport$niveau");
$result->Annonces = $this->getAnnonces($siren, $filtre, $idAnn);
}
$this->decLog('getRapport',$siren);
$this->freeService=false;
return $result;
}
@ -4899,7 +4923,7 @@ class Entreprise extends Scores_Ws_Server
public function getBanques($siren)
{
$this->authenticate();
$this->permission('banque');
$this->permission('banque',__FUNCTION__);
//Initialisation
$iDb = new Metier_Util_Db();
@ -4975,7 +4999,7 @@ class Entreprise extends Scores_Ws_Server
public function getListeCompetences($siret, $type, $codeInsee)
{
$this->authenticate();
$this->permission('competences');
$this->permission('competences',__FUNCTION__);
//Initialisation
$error = new ErrorType();
@ -5292,7 +5316,7 @@ class Entreprise extends Scores_Ws_Server
public function getSubventionList($companyId, $type = null, $offset = 0, $nbItems = 100)
{
$this->authenticate();
$this->permission('identite',__FUNCTION__);
//Init
if ( intval($companyId) == 0 ) {
$this->sendError('1010');

View File

@ -12,7 +12,7 @@ class Entreprise extends Scores_Ws_Server
public function getIdentite($siret, $id = 0)
{
$this->authenticate();
$this->permission('identite');
$this->permission('identite',__FUNCTION__);
//Initialisation
if (empty($id)) { $id = 0; }
@ -348,7 +348,7 @@ class Entreprise extends Scores_Ws_Server
public function getAvisRncs($siren)
{
$this->authenticate();
$this->permission('avisrncs');
$this->permission('avisrncs',__FUNCTION__);
$len = strlen($siren);
if ( $len != 9 ) {
@ -540,7 +540,7 @@ class Entreprise extends Scores_Ws_Server
public function getRNVP($companyId, $type = null)
{
$this->authenticate();
$this->permission('RNVP');
$this->permission('RNVP',__FUNCTION__);
// --- Identifiant SD : source + id
if ($type === null) {
@ -820,7 +820,7 @@ class Entreprise extends Scores_Ws_Server
public function getGreffeAffaireList($companyId, $tiers = 'DE', $p = 0, $limit = 20)
{
$this->authenticate();
$this->permission('contentieux');
$this->permission('contentieux', __FUNCTION__);
if ( strlen($companyId) != 9 ) {
throw new SoapFault('ERR', 'Identifiant incorrect.');
@ -932,7 +932,7 @@ class Entreprise extends Scores_Ws_Server
public function getGreffeAffaireDetail($id)
{
$this->authenticate();
$this->permission('contentieux');
$this->permission('contentieux', __FUNCTION__);
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
@ -1252,7 +1252,7 @@ class Entreprise extends Scores_Ws_Server
protected function getIndiScore($companyId)
{
$this->authenticate();
$this->permission('INDISCORE');
$this->permission('INDISCORE',__FUNCTION__);
/*
Evaluation indiscore d'une entreprise
Ne pas renvoyer les commentaires tabCommentaires
@ -1268,14 +1268,14 @@ class Entreprise extends Scores_Ws_Server
$output = new Indiscore();
$output = $this->formatIndiscore($indiscoreStruct);
$this->decLog(__FUNCTION__);
return $output;
}
protected function getReportSynthese($companyId)
{
$this->authenticate();
$this->permission('INDISCORE2');
$this->permission('INDISCORE2',__FUNCTION__);
$siren = substr($companyId, 0, 9);
if (intval($siren) < 100 ) {
@ -1291,6 +1291,7 @@ class Entreprise extends Scores_Ws_Server
$indiscoreStruct = $scoring->calculIndiScore($siren);
//$ratiosStruct = $this->getRatios($siren);
$this->decLog(__FUNCTION__);
}
@ -1299,7 +1300,7 @@ class Entreprise extends Scores_Ws_Server
{
$this->authenticate();
$this->permission('INDISCORE3');
$this->permission('INDISCORE3',__FUNCTION__);
$reportStruct = new Report();

View File

@ -300,7 +300,7 @@ class Interne extends Scores_Ws_Server
public function getListeConventions($siren)
{
$this->authenticate();
$this->permission('identite',__FUNCTION__);
//Initialisation
$error = new ErrorType();
$tabRet = array();
@ -554,7 +554,7 @@ class Interne extends Scores_Ws_Server
public function getMarques($siren, $idDepot=0)
{
$this->authenticate();
$this->permission('marques');
$this->permission('marques',__FUNCTION__);
$this->logger->info("Liste des marques déposées pour le siren $siren");
if (empty($idDepot)) $idDepot = 0;
@ -2102,7 +2102,7 @@ class Interne extends Scores_Ws_Server
public function getGroupeInfos($siren)
{
$this->authenticate();
$this->checkCredit(__FUNCTION__);
if ( strlen($siren)!=9 || intval($siren)<100 ){
$this->logger->warning( "Siren $siren incorrect");
$this->sendError('1010');

View File

@ -18,7 +18,7 @@ class Pieces extends Scores_Ws_Server
public function getKbis($siren, $diffusion = 'T', $reference = '')
{
$this->authenticate();
$this->permission('KBIS');
$this->permission('KBIS',__FUNCTION__);
$siren = substr($siren, 0, 9);
@ -61,7 +61,6 @@ class Pieces extends Scores_Ws_Server
throw new SoapFault('ERR', "Application error");
}
}
switch ($diffusion) {
// Demande de KBIS par email
@ -179,7 +178,7 @@ class Pieces extends Scores_Ws_Server
// @todo : Code Saisie + Date saisie
$this->authenticate();
$this->checkCredit(__FUNCTION__);
if (empty($position)) {
$position = 0;
}
@ -368,7 +367,7 @@ class Pieces extends Scores_Ws_Server
public function getBilan($identifiant, $dateCloture, $type, $diffusion, $reference = '')
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes',__FUNCTION__);
if (strlen($identifiant) != 9) {
$this->sendError('1010');
@ -552,6 +551,7 @@ class Pieces extends Scores_Ws_Server
public function getActes($identifiant, $position = 0, $nbRep = 200)
{
$this->authenticate();
$this->checkCredit(__FUNCTION__);
if ( empty($position) ) {
$position = 0;
@ -622,7 +622,7 @@ class Pieces extends Scores_Ws_Server
public function getActe($identifiant, $diffusion, $depotNum, $depotDate, $acteType, $acteNum, $acteDate, $reference = '')
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes', __FUNCTION__);
if (strlen($identifiant) != 9) {
$this->sendError('1010');
@ -767,7 +767,7 @@ class Pieces extends Scores_Ws_Server
public function setActeCmdEmail($id, $email)
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes', __FUNCTION__);
$validator = new Zend_Validate_EmailAddress();
if ( !$validator->isValid($email) ){
@ -828,7 +828,7 @@ class Pieces extends Scores_Ws_Server
public function setBilanCmdEmail($id, $email)
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes', __FUNCTION__);
$validator = new Zend_Validate_EmailAddress();
if ( !$validator->isValid($email) ){
@ -889,7 +889,7 @@ class Pieces extends Scores_Ws_Server
public function setKbisCmdEmail($id, $email)
{
$this->authenticate();
$this->permission('KBIS');
$this->permission('KBIS', __FUNCTION__);
$validator = new Zend_Validate_EmailAddress();
if ( !$validator->isValid($email) ){
@ -952,7 +952,7 @@ class Pieces extends Scores_Ws_Server
public function setKbisCmdLetter($id, $infos)
{
$this->authenticate();
$this->permission('KBIS');
$this->permission('KBIS', __FUNCTION__);
// --- Vérification que la commande existe
try {
@ -1004,6 +1004,7 @@ class Pieces extends Scores_Ws_Server
public function getAssoActes($companyId, $type = null)
{
$this->authenticate();
$this->checkCredit(__FUNCTION__);
// --- Lecture de la table des actes associations
try {
@ -1050,7 +1051,7 @@ class Pieces extends Scores_Ws_Server
public function getAssoActe($companyId, $type = null, $date)
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes',__FUNCTION__);
// --- Lecture table des actes associations
try {
@ -1106,7 +1107,7 @@ class Pieces extends Scores_Ws_Server
public function setAssoStatut($companyId, $type = null)
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes',__FUNCTION__);
$inseeM = new Metier_Insee_MInsee();
if ($type == 'siren') {
@ -1158,7 +1159,7 @@ class Pieces extends Scores_Ws_Server
public function setAssoStatutDetail($id, $data)
{
$this->authenticate();
$this->permission('actes');
$this->permission('actes',__FUNCTION__);
// --- Vérification que la commande existe
try {
@ -1235,7 +1236,7 @@ class Pieces extends Scores_Ws_Server
public function setPrivileges($companyId, $doc = null)
{
$this->authenticate();
$this->permission('privileges');
$this->permission('privileges',__FUNCTION__);
$inseeM = new Metier_Insee_MInsee();
$result = $inseeM->getIdentiteLight($companyId);
@ -1280,7 +1281,7 @@ class Pieces extends Scores_Ws_Server
public function setPrivilegesEmail($id, $email)
{
$this->authenticate();
$this->checkCredit(__FUNCTION__);
$validator = new Zend_Validate_EmailAddress();
if ( !$validator->isValid($email) ){
throw new SoapFault('ERR', "Adresse email invalide.");

View File

@ -14,6 +14,13 @@ return array(
),
'idClient' => array(1),
),
'credit' => array(
'actif' => true,
'versions' => array(
'0.1' => array( 'actif' => true, 'defaut' => 'beta' ),
),
'idClient' => array(1,195),
),
'entreprise' => array(
'actif' => true,
'versions' => array(
@ -40,8 +47,8 @@ return array(
'order' => array(
'actif' => true,
'versions' => array(
'0.1' => array( 'actif' => true, 'defaut' => true ),
),
'0.1' => array( 'actif' => true, 'defaut' => true ),
),
),
'pieces' => array(
'actif' => true,

View File

@ -16,4 +16,5 @@ if (APPLICATION_ENV == 'development'){
// --- Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap()->run();