Modification sur les types, et SoapFault

This commit is contained in:
Michael RICOIS 2011-02-04 15:28:45 +00:00
parent ff6a7d0670
commit 89514cf074
6 changed files with 256 additions and 367 deletions

View File

@ -31,7 +31,6 @@ Type[] = "InfosReg"
Type[] = "InfosBourseReturn"
Type[] = "InfosBourse"
Type[] = "ListeBilansReturn"
Type[] = "ListeBilansResult"
Type[] = "ListeBilans"
Type[] = "SetSurveillanceReturn"
Type[] = "SurveillancesReturn"

View File

@ -350,13 +350,10 @@ class Entreprise extends WsScore
$departement = $dep;
debugLog('I',"Liste des établissements demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if (strlen($siren)<>9)
{
if (strlen($siren)<>9) {
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
elseif ($siren*1==0)
{
} elseif ($siren*1==0) {
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
@ -394,7 +391,7 @@ class Entreprise extends WsScore
$this->wsLog('etablissements',$siren);
$output = new ListeEtablissementsReturn();
$output->nbReponses = $nbReponses;
$output->liste = $result;
$output->result = $result;
return $output;
}
@ -414,19 +411,16 @@ class Entreprise extends WsScore
debugLog('I',"Dirigeants demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$tabRet = array();
if (strlen($siren)<>9)
{
if (strlen($siren)<>9) {
debugLog('W', "Siren/Siret $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
elseif ($siren*1==0)
{
} elseif ($siren*1==0) {
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
if ($histo) $option='histo';
else $option='';
if ($histo) $option = 'histo';
else $option = '';
$iInsee = new MInsee();
$dirs = $iInsee->getDirigeants($siren, $histo);
//debugLog('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
@ -450,9 +444,7 @@ class Entreprise extends WsScore
}
$this->wsLog('dirigeants',$siren,$option);
debugLog('I', 'Nb Dirigeants retournés = '. count($dirs), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$output = new DirigeantsReturn();
$output->nbReponses = count($liste);
$output->result = $liste;
return $output;
}
@ -748,7 +740,6 @@ class Entreprise extends WsScore
if (empty($niveau)) { $niveau = 2; }
if (empty($plus)) { $plus = false; }
if ( !in_array($niveau, array(0,1,2,3,4,5)) ) { $niveau = 2; }
$error = new ErrorType();
$tabRet = array();
debugLog('I',"IndiScore demandée pour $siren en niveau $niveau",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if (strlen($siren)>9 || (substr($siren,0,9)*1)<100 ){
@ -905,7 +896,6 @@ class Entreprise extends WsScore
}
$this->wsLog('indiscore',$siren);
$output = new IndiscoreReturn();
$output->error = $error;
$output->result = $result;
return $output;
}
@ -914,40 +904,35 @@ class Entreprise extends WsScore
* Liste de tous les évènements enregistrés à l'INSEE pour une entreprise
* @param string $siren Siren de l'entreprise
* @param string $nic
* @param integer $deb
* @param integer $max
* @param integer $position
* @param integer $nbRep
* @return InseeReturn
**/
public function getListeEvenements($siren, $nic=0, $deb=0, $max=1000)
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=1000)
{
$this->authenticate();
$this->permission('eveninsee');
//Initialisation
if (empty($nic)) { $nic = 0; }
if (empty($deb)) { $deb = 0; }
if (empty($max) || $max>1000) { $max = 1000; }
if (empty($position)) { $position = 0; }
if (empty($nbRep) || $nbRep>1000) { $nbRep = 1000; }
debugLog('I',"Liste des évènements pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$tabRet = array();
if (strlen($siren)<>9)
{
if (strlen($siren)<>9) {
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
elseif ($siren*1==0)
{
} elseif ($siren*1==0) {
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
$iInsee = new MInsee();
$evens = $iInsee->getEvenements($siren, $nic, $deb, $max);
$evens = $iInsee->getEvenements($siren, $nic, $position, $nbRep);
$tabRet = array();
if (count($evens)>0)
{
foreach ($evens as $nb=>$even)
{
if (count($evens)>0) {
foreach ($evens as $nb=>$even) {
$iEven = new InseeEven();
$iEven->Nic = $even['nic'];
$iEven->Siege = $even['siege'];
@ -961,10 +946,11 @@ class Entreprise extends WsScore
$tabRet[] = $iEven;
}
}
debugLog('I', 'Nb évènements retournés = '. count($tabRet), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->wsLog('evenements',$siren);
$output = new InseeReturn();
$output->nbReponses = count($tabRet);
$output->nbReponses = count($tabRet); // @todo : retrouver le nombre total d'évenements
$output->result = $tabRet;
return $output;
}
@ -1125,13 +1111,10 @@ class Entreprise extends WsScore
$siren = trim($siren);
debugLog('I',"TVA demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$tabRet = array();
if (strlen($siren)<>9)
{
if (strlen($siren)<>9) {
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
elseif ($siren*1==0)
{
} elseif ($siren*1==0) {
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
@ -1209,7 +1192,7 @@ class Entreprise extends WsScore
}
$this->wsLog('tribunaux', '', print_r($tabTypes,1));
$output = new TribunauxReturn();
$output->tribunaux = $tabRet;
$output->result = $tabRet;
return $output;
}
@ -1374,7 +1357,7 @@ class Entreprise extends WsScore
$tabRet = array();
if (count($tabRet)>0) {
foreach ($ret as item ) {
foreach ($ret as $item ) {
$privileges = new PrivilegesDetail();
$privileges->numDebiteur = $item['numDebiteur'];
$privileges->greffe = $item['greffe'];
@ -1407,7 +1390,7 @@ class Entreprise extends WsScore
$tabRet[] = $privileges;
}
}
$this->wsLog('privdetail', $siren, print_r($tabTypes,1));
$this->wsLog('privdetail', $siren, join(',',$tabTypes));
$output = new PrivilegesDetailReturn();
$output->result = $tabRet;
return $output;
@ -1573,7 +1556,7 @@ class Entreprise extends WsScore
* getSurveillances
* @param SurveillancesFiltre $filtre
* @param integer $deb
* @param integer $nbRet
* @param integer $nbRep
* @return SurveillancesReturn
*/
public function getSurveillances($filtre, $position=0, $nbRep=100)
@ -1940,7 +1923,6 @@ class Entreprise extends WsScore
require_once 'Metier/tmp/configMRatios.php';
$this->authenticate();
//Initialisation
$error = new ErrorType();
if (empty($page)) $page = 'ratios';
$tabRatiosInfos = $tabRatiosSecteurs = $tabBilansR = array();
$tabRatios2 = $tabRatiosEvol = array();
@ -1948,192 +1930,189 @@ class Entreprise extends WsScore
debugLog('I',"Liste des Ratios demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if (strlen($siren)<>9){
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$error->errnum =102;
$error->errmsg = 'Siren inexistant';
$this->sendError('1010');
} elseif ($siren*1==0) {
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$error->errnum =102;
$error->errmsg = 'Siren inexistant';
} else {
debugLog('I',"Liste des Ratios demandée pour $siren avant getIdentiteEntreprise",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$iInsee = new MInsee();
$tabIdentite = $iInsee->getIdentiteEntreprise($siren,0,0,false,false);
debugLog('I',"Liste des Ratios demandée pour $siren après getIdentiteEntreprise",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$naf = $tabIdentite['NafEnt'];
$nafLib = $tabIdentite['NafEntLib'];
$efftr = $tabIdentite['Effectif']*1;
$fj = $tabIdentite['FJ'];
$mBil = new MBilans($siren);
$tabBilans = $mBil->listeBilans(true);
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "getRatios sur $siren", print_r($tabBilans, true));
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
if ($nbBilans>0){
$tabRatios = calculRatios($tabBilans, $tabIdentite, true);
}
$nbRatios = count($tabRatios);
debugLog('I',"Liste des Ratios demandée pour $siren après calculRatios ($nbRatios)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
/** Tableau d'infos sur les formules **/
$tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) {
$id = $formule['id']*1;
$libelle = $formule['libelle'];
$unite = $formule['unite'];
$commentaires = $formule['commentaires'];
$tabFormulesInfos[$id] = $formule; //Pour la gestion des unités des ratios secteur
$ratiosInfos = new RatiosInfos();
$ratiosInfos->id = 'r'.$id;
$ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax'];
}
$tabAnnees = array();
foreach ($tabRatios as $i=>$R) {
//Informations sur le bilan
$bilansInfos = new RatiosBilansInfos();
$bilansInfos->dateCloture = $tabBilan[$i]['DATE_CLOTURE']; //@todo : date
$bilansInfos->duree = $tabBilan[$i]['DUREE_MOIS'];
$bilansInfos->devise = $tabBilan[$i]['MONNAIE'];
$bilansInfos->typeBilan = $tabBilan[$i]['CONSOLIDE'];
$bilansInfos->unite = 'U';
if ( substr($tabBilan[$i]['DATE_CLOTURE'],0,4)>1900 ){
$tabAnnees[$i]=substr($tabBilan[$i]['DATE_CLOTURE'],0,4);
}
$tabRatiosEntrep = array();
$tabRatiosEntrepEvol = array();
foreach ( $R as $Ridx=>$Rmont ){
if ($Rmont<>'NS') {
if ( $tabBorneMin[$Ridx]<>'' && $Rmont<$tabBorneMin[$Ridx] ){
$Rmont='<'.$tabBorneMin[$Ridx];
} elseif ( $tabBorneMax[$Ridx]<>'' && $Rmont>$tabBorneMax[$Ridx] ){
$Rmont='>'.$tabBorneMax[$Ridx];
}
}
// RatiosEntrep
$ratiosEntrep = new Ratios();
if (substr($Rmont,0,1)=='N' || substr($Rmont,0,1)=='<' || substr($Rmont,0,1)=='>'){
$ratiosEntrep->id = 'r'.$Ridx;
$ratiosEntrep->val = $Rmont;
} else {
$ratiosEntrep->id = 'r'.$Ridx;
$ratiosEntrep->val = round($Rmont,2);
}
$tabRatiosEntrep[] = $ratiosEntrep;
if (($tabBilan[$i]['CONSOLIDE']=='S' && isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='S'||($tabBilan[$i+1]['CONSOLIDE']=='N'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE']))) ||
($tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='N'||($tabBilan[$i+1]['CONSOLIDE']=='S'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
)
$Rmont=(($R[$Ridx]-$tabRatios[$i+1][$Ridx])*100)/abs($tabRatios[$i+1][$Ridx]);
elseif ( ($tabBilan[$i]['CONSOLIDE']=='S'&&isset($tabRatios[$i+1])&&($tabBilan[$i+2]['CONSOLIDE']=='S'||($tabBilan[$i+2]['CONSOLIDE']=='N'&&$tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
|| ($tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+2]['CONSOLIDE']=='N'||($tabBilan[$i+2]['CONSOLIDE']=='S'&&$tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
)
$Rmont=(($R[$Ridx]-$tabRatios[$i+2][$Ridx])*100)/abs($tabRatios[$i+2][$Ridx]);
else
$Rmont='NS';
// RatiosEntrepEvol
$ratiosEntrepEvol = new Ratios();
if ($Rmont=='NS' || $Rmont<-800 || $Rmont>800){
$ratiosEntrepEvol->id = 'r'.$Ridx;
$ratiosEntrepEvol->val = 'NS';
} else {
$ratiosEntrepEvol->id = 'r'.$Ridx;
$ratiosEntrepEvol->val = number_format($Rmont,2,',',' ');
}
$tabRatiosEntrepEvol[] = $ratiosEntrepEvol;
}
$bilansInfos->RatiosEntrep = $tabRatiosEntrep;
$bilansInfos->RatiosEntrepEvol = $tabRatiosEntrepEvol;
$tabBilansR[] = $bilansInfos;
}
debugLog('I',"Liste des Ratios demandée pour $siren après EVOLUTION",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
// Tableau des ratios secteurs
$tabRatiosSecteurs = array();
if (strlen($naf)>4) $strNaf = " AND naf5='$naf' ";
else $strNaf = " AND naf4='$naf' ";
$strAnnees = implode(',', $tabAnnees);
if ( count($tabAnnees)>0 ){
$iDb = new WDB('jo');
$tabTmp = $iDb->select('ratios_secteurs',
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
false, MYSQL_ASSOC);
$ratiosSecteur = new RatiosSecteur();
$ratiosSecteur->annee = $tabTmp[0]['annee'];
$nbRatiosSec = 0;
$anneePre = $tabTmp[0]['annee'];
foreach ($tabTmp as $tabTmp2) {
if ($anneePre<>$tabTmp2['annee']) {
$tabRatiosSecteurs[] = $ratiosSecteur;
//On réinitialise tout
$ratiosSecteur = new RatiosSecteur();
$ratiosSecteur->annee = $tabTmp2['annee'];
}
$Ridx = $tabTmp2['id'];
if ($tabTmp2['nombre']>$nbRatiosSec){
$nbRatiosSec = $tabTmp2['nombre'];
}
$unite = $tabFormulesInfos[$Ridx]['unite'];
if ($unite=='EUR'){
$montant = round($tabTmp2['ratio']*1000);
} else {
$montant = round($tabTmp2['ratio']);
}
if ($tabBorneMin[$Ridx]<>'' && $montant<$tabBorneMin[$Ridx]){
$montant='<'.$tabBorneMin[$Ridx];
} elseif ($tabBorneMax[$Ridx]<>'' && $montant>$tabBorneMax[$Ridx]){
$montant='>'.$tabBorneMax[$Ridx];
}
$ratiosSecteurListe = new Ratios();
if (substr($montant,0,1)=='N' || substr($montant,0,1)=='<' || substr($montant,0,1)=='>'){
$ratiosSecteurListe->id = 'r'.$Ridx;
$ratiosSecteurListe->val = $montant;
} else {
$ratiosSecteurListe->id = 'r'.$Ridx;
$ratiosSecteurListe->val = round($montant,2);
}
$ratiosSecteur->liste[] = $ratiosSecteurListe;
$anneePre = $tabTmp2['annee'];
}
}
//$tabRatiosSecteurs=array(count($tabTmp), "1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC");
$result = new RatiosResult();
$result->Nom = $tabIdentite['Nom'];
$result->NafEnt = $tabIdentite['NafEnt'];
$result->NafEntLib = $tabIdentite['NafEntLib'];
$result->FJ = $fj;
$result->FJ_lib = $tabIdentite['FJ_lib'];
$result->Siren = $siren;
$result->NbEntNaf = $nbRatiosSec;
$result->BilansInfos = $tabBilansR;
$result->RatiosInfos = $tabRatiosInfos;
$result->RatiosSecteur = $tabRatiosSecteurs;
//Zend_Registry::get('WsLogger')->info(__FUNCTION__." : ".print_r($result,1));
debugLog('I',"Liste des Ratios demandée pour $siren RETURN",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$this->wsLog($page, $siren);
$output = new RatiosReturn();
$output->error = $error;
$output->result = $result;
return $output;
$this->sendError('1010');
}
debugLog('I',"Liste des Ratios demandée pour $siren avant getIdentiteEntreprise",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$iInsee = new MInsee();
$tabIdentite = $iInsee->getIdentiteEntreprise($siren,0,0,false,false);
debugLog('I',"Liste des Ratios demandée pour $siren après getIdentiteEntreprise",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$naf = $tabIdentite['NafEnt'];
$nafLib = $tabIdentite['NafEntLib'];
$efftr = $tabIdentite['Effectif']*1;
$fj = $tabIdentite['FJ'];
$mBil = new MBilans($siren);
$tabBilans = $mBil->listeBilans(true);
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "getRatios sur $siren", print_r($tabBilans, true));
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
if ($nbBilans>0){
$tabRatios = calculRatios($tabBilans, $tabIdentite, true);
}
$nbRatios = count($tabRatios);
debugLog('I',"Liste des Ratios demandée pour $siren après calculRatios ($nbRatios)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
/** Tableau d'infos sur les formules **/
$tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) {
$id = $formule['id']*1;
$libelle = $formule['libelle'];
$unite = $formule['unite'];
$commentaires = $formule['commentaires'];
$tabFormulesInfos[$id] = $formule; //Pour la gestion des unités des ratios secteur
$ratiosInfos = new RatiosInfos();
$ratiosInfos->id = 'r'.$id;
$ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax'];
}
$tabAnnees = array();
foreach ($tabRatios as $i=>$R) {
//Informations sur le bilan
$bilansInfos = new RatiosBilansInfos();
$bilansInfos->dateCloture = $tabBilan[$i]['DATE_CLOTURE']; //@todo : date
$bilansInfos->duree = $tabBilan[$i]['DUREE_MOIS'];
$bilansInfos->devise = $tabBilan[$i]['MONNAIE'];
$bilansInfos->typeBilan = $tabBilan[$i]['CONSOLIDE'];
$bilansInfos->unite = 'U';
if ( substr($tabBilan[$i]['DATE_CLOTURE'],0,4)>1900 ){
$tabAnnees[$i]=substr($tabBilan[$i]['DATE_CLOTURE'],0,4);
}
$tabRatiosEntrep = array();
$tabRatiosEntrepEvol = array();
foreach ( $R as $Ridx=>$Rmont ){
if ($Rmont<>'NS') {
if ( $tabBorneMin[$Ridx]<>'' && $Rmont<$tabBorneMin[$Ridx] ){
$Rmont='<'.$tabBorneMin[$Ridx];
} elseif ( $tabBorneMax[$Ridx]<>'' && $Rmont>$tabBorneMax[$Ridx] ){
$Rmont='>'.$tabBorneMax[$Ridx];
}
}
// RatiosEntrep
$ratiosEntrep = new Ratios();
if (substr($Rmont,0,1)=='N' || substr($Rmont,0,1)=='<' || substr($Rmont,0,1)=='>'){
$ratiosEntrep->id = 'r'.$Ridx;
$ratiosEntrep->val = $Rmont;
} else {
$ratiosEntrep->id = 'r'.$Ridx;
$ratiosEntrep->val = round($Rmont,2);
}
$tabRatiosEntrep[] = $ratiosEntrep;
if (($tabBilan[$i]['CONSOLIDE']=='S' && isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='S'||($tabBilan[$i+1]['CONSOLIDE']=='N'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE']))) ||
($tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='N'||($tabBilan[$i+1]['CONSOLIDE']=='S'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
)
$Rmont=(($R[$Ridx]-$tabRatios[$i+1][$Ridx])*100)/abs($tabRatios[$i+1][$Ridx]);
elseif ( ($tabBilan[$i]['CONSOLIDE']=='S'&&isset($tabRatios[$i+1])&&($tabBilan[$i+2]['CONSOLIDE']=='S'||($tabBilan[$i+2]['CONSOLIDE']=='N'&&$tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
|| ($tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+2]['CONSOLIDE']=='N'||($tabBilan[$i+2]['CONSOLIDE']=='S'&&$tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
)
$Rmont=(($R[$Ridx]-$tabRatios[$i+2][$Ridx])*100)/abs($tabRatios[$i+2][$Ridx]);
else
$Rmont='NS';
// RatiosEntrepEvol
$ratiosEntrepEvol = new Ratios();
if ($Rmont=='NS' || $Rmont<-800 || $Rmont>800){
$ratiosEntrepEvol->id = 'r'.$Ridx;
$ratiosEntrepEvol->val = 'NS';
} else {
$ratiosEntrepEvol->id = 'r'.$Ridx;
$ratiosEntrepEvol->val = number_format($Rmont,2,',',' ');
}
$tabRatiosEntrepEvol[] = $ratiosEntrepEvol;
}
$bilansInfos->RatiosEntrep = $tabRatiosEntrep;
$bilansInfos->RatiosEntrepEvol = $tabRatiosEntrepEvol;
$tabBilansR[] = $bilansInfos;
}
debugLog('I',"Liste des Ratios demandée pour $siren après EVOLUTION",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
// Tableau des ratios secteurs
$tabRatiosSecteurs = array();
if (strlen($naf)>4) $strNaf = " AND naf5='$naf' ";
else $strNaf = " AND naf4='$naf' ";
$strAnnees = implode(',', $tabAnnees);
if ( count($tabAnnees)>0 ){
$iDb = new WDB('jo');
$tabTmp = $iDb->select('ratios_secteurs',
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
false, MYSQL_ASSOC);
$ratiosSecteur = new RatiosSecteur();
$ratiosSecteur->annee = $tabTmp[0]['annee'];
$nbRatiosSec = 0;
$anneePre = $tabTmp[0]['annee'];
foreach ($tabTmp as $tabTmp2) {
if ($anneePre<>$tabTmp2['annee']) {
$tabRatiosSecteurs[] = $ratiosSecteur;
//On réinitialise tout
$ratiosSecteur = new RatiosSecteur();
$ratiosSecteur->annee = $tabTmp2['annee'];
}
$Ridx = $tabTmp2['id'];
if ($tabTmp2['nombre']>$nbRatiosSec){
$nbRatiosSec = $tabTmp2['nombre'];
}
$unite = $tabFormulesInfos[$Ridx]['unite'];
if ($unite=='EUR'){
$montant = round($tabTmp2['ratio']*1000);
} else {
$montant = round($tabTmp2['ratio']);
}
if ($tabBorneMin[$Ridx]<>'' && $montant<$tabBorneMin[$Ridx]){
$montant='<'.$tabBorneMin[$Ridx];
} elseif ($tabBorneMax[$Ridx]<>'' && $montant>$tabBorneMax[$Ridx]){
$montant='>'.$tabBorneMax[$Ridx];
}
$ratiosSecteurListe = new Ratios();
if (substr($montant,0,1)=='N' || substr($montant,0,1)=='<' || substr($montant,0,1)=='>'){
$ratiosSecteurListe->id = 'r'.$Ridx;
$ratiosSecteurListe->val = $montant;
} else {
$ratiosSecteurListe->id = 'r'.$Ridx;
$ratiosSecteurListe->val = round($montant,2);
}
$ratiosSecteur->liste[] = $ratiosSecteurListe;
$anneePre = $tabTmp2['annee'];
}
}
//$tabRatiosSecteurs=array(count($tabTmp), "1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC");
$result = new RatiosResult();
$result->Nom = $tabIdentite['Nom'];
$result->NafEnt = $tabIdentite['NafEnt'];
$result->NafEntLib = $tabIdentite['NafEntLib'];
$result->FJ = $fj;
$result->FJ_lib = $tabIdentite['FJ_lib'];
$result->Siren = $siren;
$result->NbEntNaf = $nbRatiosSec;
$result->BilansInfos = $tabBilansR;
$result->RatiosInfos = $tabRatiosInfos;
$result->RatiosSecteur = $tabRatiosSecteurs;
//Zend_Registry::get('WsLogger')->info(__FUNCTION__." : ".print_r($result,1));
debugLog('I',"Liste des Ratios demandée pour $siren RETURN",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$this->wsLog($page, $siren);
$output = new RatiosReturn();
$output->result = $result;
return $output;
}
/**
@ -2148,7 +2127,6 @@ class Entreprise extends WsScore
$this->authenticate();
if (empty($niveau)) $niveau = 3;
if (empty($id)) $id = 0;
$error = new ErrorType();
$result = new Rapport();
$filtre = 0;
$idAnn = 0;
@ -2169,7 +2147,6 @@ class Entreprise extends WsScore
$result->Annonces = $this->getAnnonces($siren, $filtre, $idAnn);
}
$output = new RapportReturn();
$output->error = $error;
$output->result = $result;
return $output;
}
@ -2189,66 +2166,61 @@ class Entreprise extends WsScore
debugLog('I',"Liste des banques demandée pour siren $siren",
__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if ($siren*1>1000){
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
$res=array_merge($res, $tmp);
foreach ($res as $tabBanque){
$dateSource=$tabBanque['dateSource'];
$codBanque=$tabBanque['codeBanque'];
$codGuichet=$tabBanque['codeGuichet'];
$libBanque=trim($tabBanque['libBanqueGuichet']);
$found=false;
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
if (intval($siren)<=1000) {
$this->sendError('1010');
}
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
$res=array_merge($res, $tmp);
foreach ($res as $tabBanque){
$dateSource=$tabBanque['dateSource'];
$codBanque=$tabBanque['codeBanque'];
$codGuichet=$tabBanque['codeGuichet'];
$libBanque=trim($tabBanque['libBanqueGuichet']);
$found=false;
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
if ($codBanque>0 && $codGuichet>0 &&
$dateSource>(date('Y')-4)*10000+101 &&
$dateSource<date('Ymd')){
$tmp = $iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g',
'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab",
false, MYSQL_ASSOC);
if (isset($tmp[0])){
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
$found=true;
};
}
if (!$found && $codBanque>0 &&
$dateSource>(date('Y')-4)*10000+101 &&
$dateSource<date('Ymd')){
$tmp = $iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", false, MYSQL_ASSOC);
if ($codBanque>0 && $codGuichet>0 &&
$dateSource>(date('Y')-4)*10000+101 &&
$dateSource<date('Ymd')){
$tmp = $iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g',
'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab",
false, MYSQL_ASSOC);
if (isset($tmp[0])){
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
} else continue;
} else continue;
$banque = new Banque();
$banque->codeBanque = $codBanque;
$banque->codeGuichet = $codGuichet;
$banque->libBanque = $libBanque;
$banque->adresse1 = $adrBanque1;
$banque->adresse2 = $adrBanque2;
$banque->cp = $adrBanqueCP;
$banque->ville = $adrBanqueVille;
$tabRet[] = $banque;
$found=true;
};
}
} else {
$error->errnum = 102;
$error->errmsg = 'Siren invalide';
if (!$found && $codBanque>0 &&
$dateSource>(date('Y')-4)*10000+101 &&
$dateSource<date('Ymd')){
$tmp = $iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", false, MYSQL_ASSOC);
if (isset($tmp[0])){
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
} else continue;
} else continue;
$banque = new Banque();
$banque->codeBanque = $codBanque;
$banque->codeGuichet = $codGuichet;
$banque->libBanque = $libBanque;
$banque->adresse1 = $adrBanque1;
$banque->adresse2 = $adrBanque2;
$banque->cp = $adrBanqueCP;
$banque->ville = $adrBanqueVille;
$tabRet[] = $banque;
}
debugLog('I',"Liste des banques pour siren $siren : ".count($tabRet).' banques',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if (count($tabRet)==0) {
$error->errnum = 256454;
$error->errmsg = 'Aucune relation bancaire en base';
}
$this->wsLog('banque', $siren);
$output = new BanquesReturn();
$output->result = $tabRet;
@ -2588,13 +2560,10 @@ class Entreprise extends WsScore
$error = new StatusReturn();
//Test connexion à la base de données
$db = new WDB('jo');
if ($db === false)
{
if ($db === false) {
$error->statusCode = 1;
$error->statusMsg = 'Erreur critique';
}
else
{
} else {
$error->statusCode = 0;
$error->statusMsg = 'Services disponible (beta)';
}

View File

@ -1108,7 +1108,7 @@ class ListeEtablissementsReturn
/** @var int */
public $nbReponses;
/** @var Etablissement[] */
public $liste;
public $result;
}
class Etablissement
@ -1192,8 +1192,6 @@ class Etablissement
class DirigeantsReturn
{
/** @var int */
public $nbReponses;
/** @var Dirigeant[] */
public $result;
}
@ -1638,7 +1636,7 @@ class TvaReturn
class TribunauxReturn
{
/** @var Tribunal[] */
public $tribunaux;
public $result;
}
class Tribunal
@ -1908,19 +1906,11 @@ class InfosBourse
}
class ListeBilansReturn
{
/** @var ErrorType */
public $error;
/** @var ListeBilansResult */
public $result;
}
class ListeBilansResult
{
/** @var int */
public $nbReponses;
/** @var ListeBilans[] */
public $liste;
public $result;
}
class ListeBilans
@ -2250,8 +2240,6 @@ class RechercheAnnonce
class IndiscoreReturn
{
/** @var ErrorType */
public $error;
/** @var Indiscore */
public $result;
}
@ -2727,8 +2715,6 @@ class Scores
class RatiosReturn
{
/** @var ErrorType */
public $error;
/** @var RatiosResult */
public $result;
}
@ -2842,8 +2828,6 @@ class RatiosSecteur
class RapportReturn
{
/** @var ErrorType */
public $error;
/** @var Rapport */
public $result;
}

View File

@ -79,10 +79,6 @@ Type[] = "ListeSurveillancesCsv"
Type[] = "RechercheHistoReturn"
Type[] = "RechercheHistoCriteres"
Type[] = "RechercheHistoReponses"
Type[] = "SurveillancesReturn"
Type[] = "SurveillancesResult"
Type[] = "SurveillancesCriteres"
Type[] = "SurveillancesReponses"
Type[] = "ClientReturn"
Type[] = "ModeleUtilisateurReturn"
Type[] = "ModeleUtilisateur"

View File

@ -1239,66 +1239,6 @@ class RechercheHistoReponses
public $Texte;
}
class SurveillancesReturn
{
/** @var ErrorType */
public $error;
/** @var SurveillancesResult */
public $result;
}
class SurveillancesResult
{
/** @var SurveillancesCriteres */
public $criteres;
/** @var int */
public $nbReponses;
/** @var int */
public $nbReponsesTotal;
/** @var int */
public $duree;
/** @var array */
public $mots;
/** @var SurveillancesReponses[] */
public $reponses;
}
class SurveillancesCriteres
{
/** @var string */
public $siren;
/** @var string */
public $nic;
/** @var string */
public $source;
}
class SurveillancesReponses
{
/** @var string */
public $source;
/** @var string */
public $email;
/** @var string */
public $siren;
/** @var string */
public $nic;
/** @var string */
public $ref;
/** @var string */
public $dateAjout;
/** @var string */
public $dateDerEnvoi;
/** @var string */
public $encoursClient;
/** @var string */
public $rs;
/** @var string */
public $cp;
/** @var string */
public $ville;
}
class ClientReturn
{
/** @var ErrorType */

View File

@ -68,6 +68,7 @@ class WsScore
'1010' => 'Siren invalide',
'1020' => 'Siren inexistant',
'1030' => 'Aucun résultat pour ce siren en base',
'3000' => 'Service disponible',