2009-09-24 16:05:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'cache/cache.php';
|
2009-10-23 13:34:42 +00:00
|
|
|
require_once realpath(dirname(__FILE__)).'/functions.php';
|
2009-09-24 16:05:13 +00:00
|
|
|
|
|
|
|
function scoresws_identite($siret, $siren, $idEntreprise)
|
|
|
|
{
|
|
|
|
global $client, $firephp;
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2009-09-24 16:05:13 +00:00
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'identite-'.$idEntreprise;
|
|
|
|
}else{ $fileName = 'identite-'.$siret; }
|
|
|
|
cache_filename($fileName);
|
|
|
|
|
2009-12-10 09:54:47 +00:00
|
|
|
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
|
2009-09-24 16:05:13 +00:00
|
|
|
{
|
|
|
|
$return = cache_get('etab');
|
|
|
|
}else{
|
|
|
|
$return = null;
|
|
|
|
try {
|
|
|
|
$O = $client->getIdentite($siret, $idEntreprise);
|
|
|
|
$return = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('etab', $return);
|
|
|
|
} catch (SoapFault $fault) {
|
2010-01-12 16:09:49 +00:00
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2010-01-12 16:21:06 +00:00
|
|
|
function scoresws_identitelight($siret, $siren, $idEntreprise)
|
2010-01-12 16:09:49 +00:00
|
|
|
{
|
|
|
|
global $client, $firephp;
|
|
|
|
if (($siret*1)==0 || ($siren*1)<100)
|
2010-03-04 14:43:42 +00:00
|
|
|
{
|
2010-01-12 16:09:49 +00:00
|
|
|
$fileName = 'identitelight-'.$idEntreprise;
|
|
|
|
}
|
|
|
|
else
|
2010-03-04 14:43:42 +00:00
|
|
|
{
|
|
|
|
$fileName = 'identitelight-'.$siret;
|
2010-01-12 16:09:49 +00:00
|
|
|
}
|
|
|
|
cache_filename($fileName);
|
|
|
|
if( cache_exist()
|
2010-03-04 14:43:42 +00:00
|
|
|
&& !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits'])
|
2010-01-12 16:09:49 +00:00
|
|
|
|| $_SESSION['tabInfo']['mode_edition']==1 ) )
|
|
|
|
{
|
|
|
|
$return = cache_get('etab');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$return = null;
|
|
|
|
try {
|
2010-01-12 16:32:30 +00:00
|
|
|
$O = $client->getIdentite($siret, $idEntreprise, false);
|
2010-01-12 16:09:49 +00:00
|
|
|
$return = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('etab', $return);
|
|
|
|
} catch (SoapFault $fault) {
|
2009-09-24 16:05:13 +00:00
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2010-01-05 14:26:15 +00:00
|
|
|
function scoresws_identite_ags($siret, $siren, $idEntreprise)
|
|
|
|
{
|
2010-02-19 18:04:11 +00:00
|
|
|
global $client, $firephp;
|
2010-02-19 15:17:24 +00:00
|
|
|
|
2010-01-05 14:26:15 +00:00
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'identite-'.$idEntreprise;
|
|
|
|
}else{ $fileName = 'identiteags-'.$siret; }
|
|
|
|
cache_filename($fileName);
|
|
|
|
|
2010-01-06 16:16:04 +00:00
|
|
|
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
|
2010-01-05 14:26:15 +00:00
|
|
|
{
|
|
|
|
$return = cache_get('etab');
|
|
|
|
}else{
|
|
|
|
$return = null;
|
|
|
|
try {
|
|
|
|
$O = $client->getIdentiteAGS($siret, $idEntreprise);
|
|
|
|
$return = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('etab', $return);
|
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$firephp->log($return, 'return');
|
|
|
|
return $return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-24 16:05:13 +00:00
|
|
|
function scoresws_annonces($siret, $siren, $idEntreprise, $vue, $idan)
|
|
|
|
{
|
|
|
|
global $client, $firephp;
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2010-02-10 17:27:03 +00:00
|
|
|
//Générer un nom de fichier pour le cache et l'export des fichiers
|
2009-09-24 16:05:13 +00:00
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'annonces-'.$idEntreprise;
|
2009-10-08 13:20:51 +00:00
|
|
|
}else{ $fileName = 'annonces-'.$siren; }
|
2009-09-24 16:05:13 +00:00
|
|
|
if($vue!=''){$fileName.= '-'.$idan;}
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2009-09-24 16:05:13 +00:00
|
|
|
cache_filename($fileName);
|
2009-12-10 09:54:47 +00:00
|
|
|
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
|
2009-09-24 16:05:13 +00:00
|
|
|
$annonces = cache_get('annonces');
|
|
|
|
$return = $annonces;
|
|
|
|
}else{
|
|
|
|
if ($vue=='bodacc' || $_REQUEST['source']==1) $filtre=1;
|
|
|
|
elseif ($vue=='balo') $filtre=2;
|
|
|
|
elseif ($vue=='asso') $filtre=3;
|
|
|
|
else $filtre=0;
|
|
|
|
if ($_SESSION['tabInfo']['entrep']['fj']>9000 && $_SESSION['tabInfo']['entrep']['fj']<9999 && $siren==0)
|
|
|
|
{
|
|
|
|
$filtre=3;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$O = $client->getAnnonces($siren, $filtre, $idan);
|
|
|
|
$annonces = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('annonces', $annonces);
|
|
|
|
$return = $annonces;
|
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
|
|
|
function scoresws_ratios($siret, $siren, $idEntreprise)
|
|
|
|
{
|
2009-10-23 13:34:42 +00:00
|
|
|
global $client, $fileName, $bilansInfos, $ratiosSecteur, $ratiosEntrep, $ratiosInfos, $ratiosSecteur, $page, $firephp;
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2009-09-24 16:05:13 +00:00
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'ratios-'.$idEntreprise;
|
2009-10-08 13:20:51 +00:00
|
|
|
}else{ $fileName = 'ratios-'.$siren; }
|
|
|
|
|
2010-03-04 14:43:42 +00:00
|
|
|
cache_filename($fileName);
|
2009-12-10 09:54:47 +00:00
|
|
|
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
|
2009-09-24 16:05:13 +00:00
|
|
|
{
|
|
|
|
$bilansInfos = cache_get('bilansInfos');
|
|
|
|
$ratiosEntrep = cache_get('ratiosEntrep');
|
|
|
|
$ratiosEntrepEvol = cache_get('ratiosEntrepEvol');
|
|
|
|
$ratiosInfos = cache_get('ratiosInfos');
|
|
|
|
$ratiosSecteur = cache_get('ratiosSecteur');
|
2009-10-23 13:34:42 +00:00
|
|
|
$dataActif = cache_get('dataActif');
|
|
|
|
$dataPassif = cache_get('dataPassif');
|
|
|
|
$dataSIG = cache_get('dataSIG');
|
|
|
|
$return = array(
|
2010-03-04 14:43:42 +00:00
|
|
|
'bilansInfos'=>$bilansInfos,
|
2009-10-23 13:34:42 +00:00
|
|
|
'ratiosEntrep'=>$ratiosEntrep,
|
2010-03-04 14:43:42 +00:00
|
|
|
'ratiosEntrepEvol'=>$ratiosEntrepEvol,
|
2009-10-23 13:34:42 +00:00
|
|
|
'ratiosInfos'=>$ratiosInfos,
|
|
|
|
'ratiosSecteur'=>$ratiosSecteur,
|
2010-03-04 14:43:42 +00:00
|
|
|
'dataActif'=>$dataActif,
|
|
|
|
'dataPassif'=>$dataPassif,
|
2009-10-23 13:34:42 +00:00
|
|
|
'dataSIG'=>$dataSIG
|
|
|
|
);
|
2009-09-24 16:05:13 +00:00
|
|
|
}else{
|
|
|
|
try {
|
2009-10-23 13:34:42 +00:00
|
|
|
$O = $client->getRatios($siren, $page);
|
2009-09-24 16:05:13 +00:00
|
|
|
$bilansInfos = $O['result']['BilansInfos'];
|
|
|
|
$ratiosInfos = $O['result']['RatiosInfos'];
|
|
|
|
$ratiosEntrep = $O['result']['RatiosEntrep'];
|
|
|
|
$ratiosEntrepEvol = $O['result']['RatiosEntrepEvol'];
|
|
|
|
$ratiosSecteur = $O['result']['RatiosSecteur'];
|
2010-02-11 16:01:21 +00:00
|
|
|
if(count($bilansInfos)>0)
|
|
|
|
{
|
|
|
|
$format = formatRatios(
|
2010-03-04 14:43:42 +00:00
|
|
|
$bilansInfos,
|
|
|
|
$ratiosEntrep,
|
|
|
|
$ratiosEntrepEvol,
|
|
|
|
$ratiosInfos,
|
2010-02-11 16:01:21 +00:00
|
|
|
$ratiosSecteur
|
|
|
|
);
|
2010-03-04 14:43:42 +00:00
|
|
|
while ( list($key, $val) = each( $format ) )
|
|
|
|
{
|
|
|
|
${$key} = $val;
|
2010-02-11 16:01:21 +00:00
|
|
|
}
|
2009-09-24 16:05:13 +00:00
|
|
|
}
|
2009-10-08 13:20:51 +00:00
|
|
|
cache_delete();
|
2009-09-24 16:05:13 +00:00
|
|
|
cache_add('bilansInfos', $bilansInfos);
|
|
|
|
cache_add('ratiosEntrep', $ratiosEntrep);
|
|
|
|
cache_add('ratiosEntrepEvol', $ratiosEntrepEvol);
|
|
|
|
cache_add('ratiosInfos', $ratiosInfos);
|
|
|
|
cache_add('ratiosSecteur', $ratiosSecteur);
|
2009-10-23 13:34:42 +00:00
|
|
|
cache_add('dataActif', $dataActif);
|
|
|
|
cache_add('dataPassif', $dataPassif);
|
2010-03-04 14:43:42 +00:00
|
|
|
cache_add('dataSIG', $dataSIG);
|
2009-10-23 13:34:42 +00:00
|
|
|
$return = array(
|
2010-03-04 14:43:42 +00:00
|
|
|
'bilansInfos'=>$bilansInfos,
|
2009-10-23 13:34:42 +00:00
|
|
|
'ratiosEntrep'=>$ratiosEntrep,
|
2010-03-04 14:43:42 +00:00
|
|
|
'ratiosEntrepEvol'=>$ratiosEntrepEvol,
|
2009-10-23 13:34:42 +00:00
|
|
|
'ratiosInfos'=>$ratiosInfos,
|
|
|
|
'ratiosSecteur'=>$ratiosSecteur,
|
2010-03-04 14:43:42 +00:00
|
|
|
'dataActif'=>$dataActif,
|
|
|
|
'dataPassif'=>$dataPassif,
|
2009-10-23 13:34:42 +00:00
|
|
|
'dataSIG'=>$dataSIG
|
|
|
|
);
|
2009-09-24 16:05:13 +00:00
|
|
|
}catch (SoapFault $fault) {
|
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
|
|
|
function scoresws_indiscore($siret, $siren, $idEntreprise)
|
|
|
|
{
|
2010-01-26 18:07:35 +00:00
|
|
|
global $client, $firephp, $niveau;
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2009-09-24 16:05:13 +00:00
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'indiscore-'.$idEntreprise;
|
2009-10-08 13:20:51 +00:00
|
|
|
}else{ $fileName = 'indiscore-'.$siren; }
|
2009-09-24 16:05:13 +00:00
|
|
|
|
|
|
|
cache_filename($fileName);
|
|
|
|
|
2010-03-04 14:43:42 +00:00
|
|
|
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
|
2009-09-24 16:05:13 +00:00
|
|
|
$etab = cache_get('etab');
|
|
|
|
$return = $etab;
|
|
|
|
}else{
|
|
|
|
try {
|
2010-01-26 18:07:35 +00:00
|
|
|
$O = $client->getIndiscore($siren, 0, true, $niveau);
|
2009-09-24 16:05:13 +00:00
|
|
|
$etab = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('etab', $etab);
|
|
|
|
$return = $etab;
|
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
2009-10-08 13:20:51 +00:00
|
|
|
|
|
|
|
function scoresws_dirigeants($siret, $siren, $idEntreprise)
|
|
|
|
{
|
|
|
|
global $client, $firephp;
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2009-10-08 13:20:51 +00:00
|
|
|
if (($siret*1)==0 && ($siren*1)<100) { $fileName = 'dirigeants-'.$idEntreprise;
|
|
|
|
}else{ $fileName = 'dirigeants-'.$siret; }
|
|
|
|
$histo = false;
|
|
|
|
if ($_REQUEST['vue']=='histo'){ $fileName .= '-histo'; $histo=true; }
|
|
|
|
cache_filename($fileName);
|
2010-03-04 16:25:44 +00:00
|
|
|
if( 0 && cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
|
2009-10-08 13:20:51 +00:00
|
|
|
$dirs = cache_get('dirs');
|
|
|
|
$return = $dirs;
|
|
|
|
}else{
|
|
|
|
try {
|
|
|
|
$O = $client->getDirigeants($siren, $histo);
|
|
|
|
$dirs = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('dirs', $dirs);
|
|
|
|
$return = $dirs;
|
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
|
|
|
function scoresws_liens($siret, $siren, $idEntreprise)
|
|
|
|
{
|
|
|
|
global $client, $firephp;
|
2010-03-04 14:43:42 +00:00
|
|
|
|
2009-10-08 13:20:51 +00:00
|
|
|
if (($siret*1)==0 || ($siren*1)<100){
|
|
|
|
$fileName = 'liens-'.$idEntreprise;
|
|
|
|
}else{
|
|
|
|
$fileName = 'liens-'.$siret;
|
|
|
|
}
|
|
|
|
cache_filename($fileName);
|
2009-12-10 09:54:47 +00:00
|
|
|
if( cache_exist() && !( preg_match('/\bsaisie\b/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
|
2009-10-08 13:20:51 +00:00
|
|
|
$liens = cache_get('liens');
|
|
|
|
$return = $liens;
|
|
|
|
}else{
|
|
|
|
try {
|
|
|
|
$O = $client->getLiens($siren, true);
|
|
|
|
$liens = $O['result'];
|
|
|
|
cache_delete();
|
|
|
|
cache_add('liens', $liens);
|
2009-10-12 13:31:05 +00:00
|
|
|
$return = $liens;
|
2009-10-08 13:20:51 +00:00
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
require_once 'soaperror.php';
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $return;
|
2009-10-23 13:34:42 +00:00
|
|
|
}
|