Modification sur les types, et SoapFault
This commit is contained in:
parent
ff6a7d0670
commit
89514cf074
@ -31,7 +31,6 @@ Type[] = "InfosReg"
|
|||||||
Type[] = "InfosBourseReturn"
|
Type[] = "InfosBourseReturn"
|
||||||
Type[] = "InfosBourse"
|
Type[] = "InfosBourse"
|
||||||
Type[] = "ListeBilansReturn"
|
Type[] = "ListeBilansReturn"
|
||||||
Type[] = "ListeBilansResult"
|
|
||||||
Type[] = "ListeBilans"
|
Type[] = "ListeBilans"
|
||||||
Type[] = "SetSurveillanceReturn"
|
Type[] = "SetSurveillanceReturn"
|
||||||
Type[] = "SurveillancesReturn"
|
Type[] = "SurveillancesReturn"
|
||||||
|
@ -350,13 +350,10 @@ class Entreprise extends WsScore
|
|||||||
$departement = $dep;
|
$departement = $dep;
|
||||||
|
|
||||||
debugLog('I',"Liste des établissements demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
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__);
|
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
} elseif ($siren*1==0) {
|
||||||
elseif ($siren*1==0)
|
|
||||||
{
|
|
||||||
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
}
|
||||||
@ -394,7 +391,7 @@ class Entreprise extends WsScore
|
|||||||
$this->wsLog('etablissements',$siren);
|
$this->wsLog('etablissements',$siren);
|
||||||
$output = new ListeEtablissementsReturn();
|
$output = new ListeEtablissementsReturn();
|
||||||
$output->nbReponses = $nbReponses;
|
$output->nbReponses = $nbReponses;
|
||||||
$output->liste = $result;
|
$output->result = $result;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,19 +411,16 @@ class Entreprise extends WsScore
|
|||||||
|
|
||||||
debugLog('I',"Dirigeants demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
debugLog('I',"Dirigeants demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
if (strlen($siren)<>9)
|
if (strlen($siren)<>9) {
|
||||||
{
|
|
||||||
debugLog('W', "Siren/Siret $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren/Siret $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
} elseif ($siren*1==0) {
|
||||||
elseif ($siren*1==0)
|
|
||||||
{
|
|
||||||
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($histo) $option='histo';
|
if ($histo) $option = 'histo';
|
||||||
else $option='';
|
else $option = '';
|
||||||
$iInsee = new MInsee();
|
$iInsee = new MInsee();
|
||||||
$dirs = $iInsee->getDirigeants($siren, $histo);
|
$dirs = $iInsee->getDirigeants($siren, $histo);
|
||||||
//debugLog('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
//debugLog('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
@ -450,9 +444,7 @@ class Entreprise extends WsScore
|
|||||||
}
|
}
|
||||||
$this->wsLog('dirigeants',$siren,$option);
|
$this->wsLog('dirigeants',$siren,$option);
|
||||||
debugLog('I', 'Nb Dirigeants retournés = '. count($dirs), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('I', 'Nb Dirigeants retournés = '. count($dirs), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
|
|
||||||
$output = new DirigeantsReturn();
|
$output = new DirigeantsReturn();
|
||||||
$output->nbReponses = count($liste);
|
|
||||||
$output->result = $liste;
|
$output->result = $liste;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@ -748,7 +740,6 @@ class Entreprise extends WsScore
|
|||||||
if (empty($niveau)) { $niveau = 2; }
|
if (empty($niveau)) { $niveau = 2; }
|
||||||
if (empty($plus)) { $plus = false; }
|
if (empty($plus)) { $plus = false; }
|
||||||
if ( !in_array($niveau, array(0,1,2,3,4,5)) ) { $niveau = 2; }
|
if ( !in_array($niveau, array(0,1,2,3,4,5)) ) { $niveau = 2; }
|
||||||
$error = new ErrorType();
|
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
debugLog('I',"IndiScore demandée pour $siren en niveau $niveau",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
debugLog('I',"IndiScore demandée pour $siren en niveau $niveau",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||||
if (strlen($siren)>9 || (substr($siren,0,9)*1)<100 ){
|
if (strlen($siren)>9 || (substr($siren,0,9)*1)<100 ){
|
||||||
@ -905,7 +896,6 @@ class Entreprise extends WsScore
|
|||||||
}
|
}
|
||||||
$this->wsLog('indiscore',$siren);
|
$this->wsLog('indiscore',$siren);
|
||||||
$output = new IndiscoreReturn();
|
$output = new IndiscoreReturn();
|
||||||
$output->error = $error;
|
|
||||||
$output->result = $result;
|
$output->result = $result;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@ -914,40 +904,35 @@ class Entreprise extends WsScore
|
|||||||
* Liste de tous les évènements enregistrés à l'INSEE pour une entreprise
|
* Liste de tous les évènements enregistrés à l'INSEE pour une entreprise
|
||||||
* @param string $siren Siren de l'entreprise
|
* @param string $siren Siren de l'entreprise
|
||||||
* @param string $nic
|
* @param string $nic
|
||||||
* @param integer $deb
|
* @param integer $position
|
||||||
* @param integer $max
|
* @param integer $nbRep
|
||||||
* @return InseeReturn
|
* @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->authenticate();
|
||||||
$this->permission('eveninsee');
|
$this->permission('eveninsee');
|
||||||
|
|
||||||
//Initialisation
|
//Initialisation
|
||||||
if (empty($nic)) { $nic = 0; }
|
if (empty($nic)) { $nic = 0; }
|
||||||
if (empty($deb)) { $deb = 0; }
|
if (empty($position)) { $position = 0; }
|
||||||
if (empty($max) || $max>1000) { $max = 1000; }
|
if (empty($nbRep) || $nbRep>1000) { $nbRep = 1000; }
|
||||||
|
|
||||||
debugLog('I',"Liste des évènements pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
debugLog('I',"Liste des évènements pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
if (strlen($siren)<>9)
|
if (strlen($siren)<>9) {
|
||||||
{
|
|
||||||
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
} elseif ($siren*1==0) {
|
||||||
elseif ($siren*1==0)
|
|
||||||
{
|
|
||||||
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
}
|
||||||
|
|
||||||
$iInsee = new MInsee();
|
$iInsee = new MInsee();
|
||||||
$evens = $iInsee->getEvenements($siren, $nic, $deb, $max);
|
$evens = $iInsee->getEvenements($siren, $nic, $position, $nbRep);
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
if (count($evens)>0)
|
if (count($evens)>0) {
|
||||||
{
|
foreach ($evens as $nb=>$even) {
|
||||||
foreach ($evens as $nb=>$even)
|
|
||||||
{
|
|
||||||
$iEven = new InseeEven();
|
$iEven = new InseeEven();
|
||||||
$iEven->Nic = $even['nic'];
|
$iEven->Nic = $even['nic'];
|
||||||
$iEven->Siege = $even['siege'];
|
$iEven->Siege = $even['siege'];
|
||||||
@ -961,10 +946,11 @@ class Entreprise extends WsScore
|
|||||||
$tabRet[] = $iEven;
|
$tabRet[] = $iEven;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog('I', 'Nb évènements retournés = '. count($tabRet), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('I', 'Nb évènements retournés = '. count($tabRet), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->wsLog('evenements',$siren);
|
$this->wsLog('evenements',$siren);
|
||||||
$output = new InseeReturn();
|
$output = new InseeReturn();
|
||||||
$output->nbReponses = count($tabRet);
|
$output->nbReponses = count($tabRet); // @todo : retrouver le nombre total d'évenements
|
||||||
$output->result = $tabRet;
|
$output->result = $tabRet;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@ -1125,13 +1111,10 @@ class Entreprise extends WsScore
|
|||||||
$siren = trim($siren);
|
$siren = trim($siren);
|
||||||
debugLog('I',"TVA demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
debugLog('I',"TVA demandée pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
if (strlen($siren)<>9)
|
if (strlen($siren)<>9) {
|
||||||
{
|
|
||||||
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
} elseif ($siren*1==0) {
|
||||||
elseif ($siren*1==0)
|
|
||||||
{
|
|
||||||
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
}
|
||||||
@ -1209,7 +1192,7 @@ class Entreprise extends WsScore
|
|||||||
}
|
}
|
||||||
$this->wsLog('tribunaux', '', print_r($tabTypes,1));
|
$this->wsLog('tribunaux', '', print_r($tabTypes,1));
|
||||||
$output = new TribunauxReturn();
|
$output = new TribunauxReturn();
|
||||||
$output->tribunaux = $tabRet;
|
$output->result = $tabRet;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1374,7 +1357,7 @@ class Entreprise extends WsScore
|
|||||||
|
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
if (count($tabRet)>0) {
|
if (count($tabRet)>0) {
|
||||||
foreach ($ret as item ) {
|
foreach ($ret as $item ) {
|
||||||
$privileges = new PrivilegesDetail();
|
$privileges = new PrivilegesDetail();
|
||||||
$privileges->numDebiteur = $item['numDebiteur'];
|
$privileges->numDebiteur = $item['numDebiteur'];
|
||||||
$privileges->greffe = $item['greffe'];
|
$privileges->greffe = $item['greffe'];
|
||||||
@ -1407,7 +1390,7 @@ class Entreprise extends WsScore
|
|||||||
$tabRet[] = $privileges;
|
$tabRet[] = $privileges;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->wsLog('privdetail', $siren, print_r($tabTypes,1));
|
$this->wsLog('privdetail', $siren, join(',',$tabTypes));
|
||||||
$output = new PrivilegesDetailReturn();
|
$output = new PrivilegesDetailReturn();
|
||||||
$output->result = $tabRet;
|
$output->result = $tabRet;
|
||||||
return $output;
|
return $output;
|
||||||
@ -1573,7 +1556,7 @@ class Entreprise extends WsScore
|
|||||||
* getSurveillances
|
* getSurveillances
|
||||||
* @param SurveillancesFiltre $filtre
|
* @param SurveillancesFiltre $filtre
|
||||||
* @param integer $deb
|
* @param integer $deb
|
||||||
* @param integer $nbRet
|
* @param integer $nbRep
|
||||||
* @return SurveillancesReturn
|
* @return SurveillancesReturn
|
||||||
*/
|
*/
|
||||||
public function getSurveillances($filtre, $position=0, $nbRep=100)
|
public function getSurveillances($filtre, $position=0, $nbRep=100)
|
||||||
@ -1940,7 +1923,6 @@ class Entreprise extends WsScore
|
|||||||
require_once 'Metier/tmp/configMRatios.php';
|
require_once 'Metier/tmp/configMRatios.php';
|
||||||
$this->authenticate();
|
$this->authenticate();
|
||||||
//Initialisation
|
//Initialisation
|
||||||
$error = new ErrorType();
|
|
||||||
if (empty($page)) $page = 'ratios';
|
if (empty($page)) $page = 'ratios';
|
||||||
$tabRatiosInfos = $tabRatiosSecteurs = $tabBilansR = array();
|
$tabRatiosInfos = $tabRatiosSecteurs = $tabBilansR = array();
|
||||||
$tabRatios2 = $tabRatiosEvol = 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__);
|
debugLog('I',"Liste des Ratios 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__);
|
debugLog('W', "Siren $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$error->errnum =102;
|
$this->sendError('1010');
|
||||||
$error->errmsg = 'Siren inexistant';
|
|
||||||
} elseif ($siren*1==0) {
|
} elseif ($siren*1==0) {
|
||||||
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$error->errnum =102;
|
$this->sendError('1010');
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
$this->authenticate();
|
||||||
if (empty($niveau)) $niveau = 3;
|
if (empty($niveau)) $niveau = 3;
|
||||||
if (empty($id)) $id = 0;
|
if (empty($id)) $id = 0;
|
||||||
$error = new ErrorType();
|
|
||||||
$result = new Rapport();
|
$result = new Rapport();
|
||||||
$filtre = 0;
|
$filtre = 0;
|
||||||
$idAnn = 0;
|
$idAnn = 0;
|
||||||
@ -2169,7 +2147,6 @@ class Entreprise extends WsScore
|
|||||||
$result->Annonces = $this->getAnnonces($siren, $filtre, $idAnn);
|
$result->Annonces = $this->getAnnonces($siren, $filtre, $idAnn);
|
||||||
}
|
}
|
||||||
$output = new RapportReturn();
|
$output = new RapportReturn();
|
||||||
$output->error = $error;
|
|
||||||
$output->result = $result;
|
$output->result = $result;
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@ -2189,66 +2166,61 @@ class Entreprise extends WsScore
|
|||||||
debugLog('I',"Liste des banques demandée pour siren $siren",
|
debugLog('I',"Liste des banques demandée pour siren $siren",
|
||||||
__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||||
|
|
||||||
if ($siren*1>1000){
|
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);
|
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||||
foreach ($res as $tabBanque){
|
$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);
|
||||||
$dateSource=$tabBanque['dateSource'];
|
$res=array_merge($res, $tmp);
|
||||||
$codBanque=$tabBanque['codeBanque'];
|
foreach ($res as $tabBanque){
|
||||||
$codGuichet=$tabBanque['codeGuichet'];
|
$dateSource=$tabBanque['dateSource'];
|
||||||
$libBanque=trim($tabBanque['libBanqueGuichet']);
|
$codBanque=$tabBanque['codeBanque'];
|
||||||
$found=false;
|
$codGuichet=$tabBanque['codeGuichet'];
|
||||||
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
|
$libBanque=trim($tabBanque['libBanqueGuichet']);
|
||||||
|
$found=false;
|
||||||
|
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
|
||||||
|
|
||||||
if ($codBanque>0 && $codGuichet>0 &&
|
if ($codBanque>0 && $codGuichet>0 &&
|
||||||
$dateSource>(date('Y')-4)*10000+101 &&
|
$dateSource>(date('Y')-4)*10000+101 &&
|
||||||
$dateSource<date('Ymd')){
|
$dateSource<date('Ymd')){
|
||||||
$tmp = $iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g',
|
$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",
|
'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);
|
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 (isset($tmp[0])){
|
if (isset($tmp[0])){
|
||||||
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
|
||||||
$adrBanque1=$tmp[0]['adresse1'];
|
$adrBanque1=$tmp[0]['adresse1'];
|
||||||
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
|
||||||
$adrBanqueCP=$tmp[0]['CP'];
|
$adrBanqueCP=$tmp[0]['CP'];
|
||||||
$adrBanqueVille=$tmp[0]['Ville'];
|
$adrBanqueVille=$tmp[0]['Ville'];
|
||||||
} else continue;
|
$found=true;
|
||||||
} 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;
|
|
||||||
}
|
}
|
||||||
} else {
|
if (!$found && $codBanque>0 &&
|
||||||
$error->errnum = 102;
|
$dateSource>(date('Y')-4)*10000+101 &&
|
||||||
$error->errmsg = 'Siren invalide';
|
$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__);
|
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);
|
$this->wsLog('banque', $siren);
|
||||||
$output = new BanquesReturn();
|
$output = new BanquesReturn();
|
||||||
$output->result = $tabRet;
|
$output->result = $tabRet;
|
||||||
@ -2588,13 +2560,10 @@ class Entreprise extends WsScore
|
|||||||
$error = new StatusReturn();
|
$error = new StatusReturn();
|
||||||
//Test connexion à la base de données
|
//Test connexion à la base de données
|
||||||
$db = new WDB('jo');
|
$db = new WDB('jo');
|
||||||
if ($db === false)
|
if ($db === false) {
|
||||||
{
|
|
||||||
$error->statusCode = 1;
|
$error->statusCode = 1;
|
||||||
$error->statusMsg = 'Erreur critique';
|
$error->statusMsg = 'Erreur critique';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$error->statusCode = 0;
|
$error->statusCode = 0;
|
||||||
$error->statusMsg = 'Services disponible (beta)';
|
$error->statusMsg = 'Services disponible (beta)';
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1108,7 @@ class ListeEtablissementsReturn
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $nbReponses;
|
public $nbReponses;
|
||||||
/** @var Etablissement[] */
|
/** @var Etablissement[] */
|
||||||
public $liste;
|
public $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Etablissement
|
class Etablissement
|
||||||
@ -1192,8 +1192,6 @@ class Etablissement
|
|||||||
|
|
||||||
class DirigeantsReturn
|
class DirigeantsReturn
|
||||||
{
|
{
|
||||||
/** @var int */
|
|
||||||
public $nbReponses;
|
|
||||||
/** @var Dirigeant[] */
|
/** @var Dirigeant[] */
|
||||||
public $result;
|
public $result;
|
||||||
}
|
}
|
||||||
@ -1638,7 +1636,7 @@ class TvaReturn
|
|||||||
class TribunauxReturn
|
class TribunauxReturn
|
||||||
{
|
{
|
||||||
/** @var Tribunal[] */
|
/** @var Tribunal[] */
|
||||||
public $tribunaux;
|
public $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Tribunal
|
class Tribunal
|
||||||
@ -1908,19 +1906,11 @@ class InfosBourse
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ListeBilansReturn
|
class ListeBilansReturn
|
||||||
{
|
|
||||||
/** @var ErrorType */
|
|
||||||
public $error;
|
|
||||||
/** @var ListeBilansResult */
|
|
||||||
public $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ListeBilansResult
|
|
||||||
{
|
{
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $nbReponses;
|
public $nbReponses;
|
||||||
/** @var ListeBilans[] */
|
/** @var ListeBilans[] */
|
||||||
public $liste;
|
public $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ListeBilans
|
class ListeBilans
|
||||||
@ -2250,8 +2240,6 @@ class RechercheAnnonce
|
|||||||
|
|
||||||
class IndiscoreReturn
|
class IndiscoreReturn
|
||||||
{
|
{
|
||||||
/** @var ErrorType */
|
|
||||||
public $error;
|
|
||||||
/** @var Indiscore */
|
/** @var Indiscore */
|
||||||
public $result;
|
public $result;
|
||||||
}
|
}
|
||||||
@ -2727,8 +2715,6 @@ class Scores
|
|||||||
|
|
||||||
class RatiosReturn
|
class RatiosReturn
|
||||||
{
|
{
|
||||||
/** @var ErrorType */
|
|
||||||
public $error;
|
|
||||||
/** @var RatiosResult */
|
/** @var RatiosResult */
|
||||||
public $result;
|
public $result;
|
||||||
}
|
}
|
||||||
@ -2842,8 +2828,6 @@ class RatiosSecteur
|
|||||||
|
|
||||||
class RapportReturn
|
class RapportReturn
|
||||||
{
|
{
|
||||||
/** @var ErrorType */
|
|
||||||
public $error;
|
|
||||||
/** @var Rapport */
|
/** @var Rapport */
|
||||||
public $result;
|
public $result;
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,6 @@ Type[] = "ListeSurveillancesCsv"
|
|||||||
Type[] = "RechercheHistoReturn"
|
Type[] = "RechercheHistoReturn"
|
||||||
Type[] = "RechercheHistoCriteres"
|
Type[] = "RechercheHistoCriteres"
|
||||||
Type[] = "RechercheHistoReponses"
|
Type[] = "RechercheHistoReponses"
|
||||||
Type[] = "SurveillancesReturn"
|
|
||||||
Type[] = "SurveillancesResult"
|
|
||||||
Type[] = "SurveillancesCriteres"
|
|
||||||
Type[] = "SurveillancesReponses"
|
|
||||||
Type[] = "ClientReturn"
|
Type[] = "ClientReturn"
|
||||||
Type[] = "ModeleUtilisateurReturn"
|
Type[] = "ModeleUtilisateurReturn"
|
||||||
Type[] = "ModeleUtilisateur"
|
Type[] = "ModeleUtilisateur"
|
||||||
|
@ -1239,66 +1239,6 @@ class RechercheHistoReponses
|
|||||||
public $Texte;
|
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
|
class ClientReturn
|
||||||
{
|
{
|
||||||
/** @var ErrorType */
|
/** @var ErrorType */
|
||||||
|
@ -68,6 +68,7 @@ class WsScore
|
|||||||
|
|
||||||
'1010' => 'Siren invalide',
|
'1010' => 'Siren invalide',
|
||||||
'1020' => 'Siren inexistant',
|
'1020' => 'Siren inexistant',
|
||||||
|
'1030' => 'Aucun résultat pour ce siren en base',
|
||||||
|
|
||||||
'3000' => 'Service disponible',
|
'3000' => 'Service disponible',
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user