Merge branch 'develop'

This commit is contained in:
Michael RICOIS 2017-01-09 14:20:59 +01:00
commit 3a0297f7f2
12 changed files with 2021 additions and 3389 deletions

View File

@ -1701,7 +1701,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
$identite = $result;
}
}
if (count($identite)>0) {
if (count($identite) > 0) {
// --- Actif
$identite['Actif'] = 1;
if (array_key_exists('insEVE', $identite)) {
@ -1743,11 +1743,11 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
}
rsort($tabDates);
$dateProcol = str_replace('-', '', $tabDates[0])*1;
if ($this->dureePlan>0 && date('Ymd')<$this->finPlan) {
if ($this->dureePlan > 0 && date('Ymd') < $this->finPlan) {
$identite['SituationJuridique'] = 'PL';
}
// Plan révolu
elseif ($this->dureePlan>0 && date('Ymd')>=$this->finPlan) {
elseif ($this->dureePlan > 0 && date('Ymd') >= $this->finPlan) {
$identite['SituationJuridique'] = '';
}
// Appel de jugement
@ -1758,9 +1758,13 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
else {
$identite['SituationJuridique'] = 'P';
}
} elseif (count($this->getAnnoncesLegales($siren, 0, 'A', false)) > 0) {
}
// Absorption
elseif (count($this->getAnnoncesLegales($siren, 0, 'A', false)) > 0) {
$identite['SituationJuridique'] = 'A';
} elseif (count($this->getAnnoncesLegales($siren, 0, 'D', false)) > 0) {
}
// Dissolution
elseif (count($this->getAnnoncesLegales($siren, 0, 'D', false)) > 0) {
$identite['SituationJuridique'] = 'D';
}
// Fin Situation Juridique
@ -2568,91 +2572,123 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
if ($this->debug) {
file_put_contents('procol.log', "=== Situation Juridique ===\n");
}
$tabProcol = $this->getAnnoncesLegales($siren, 0, 'P', false);
if (count($tabProcol) > 0) {
$tabAnn = $this->getAnnoncesLegales($siren, 0, '', false, false);
if (count($tabAnn) > 0) {
// Date de dernière mise à jour
$tabDates = array();
foreach ($tabProcol as $iProcol => $procol) {
$tabDates[] = $procol['dateJugement'];
foreach ($tabAnn as $iAnn => $ann) {
$tabDates[] = $ann['dateInsertionSD'];
}
rsort($tabDates);
$dateProcol = str_replace('-', '', $tabDates[0])*1;
// Plan
if ($this->dureePlan > 0 && date('Ymd') < $this->finPlan) {
if ($this->debug) {
file_put_contents('procol.log', "Plan (PL) : ".$this->dureePlan."-".$this->finPlan."\n", FILE_APPEND);
}
$tabRet['SituationJuridique'] = 'PL';
}
// Plan révolu
elseif ($this->dureePlan > 0 && date('Ymd') >= $this->finPlan) {
if ($this->debug) {
file_put_contents('procol.log', "Plan revolu : ".$this->dureePlan."-".$this->finPlan."\n", FILE_APPEND);
}
$tabRet['SituationJuridique'] = '';
}
// Appel de jugement
elseif ($this->appelJugement) {
$tabRet['SituationJuridique'] = 'PA';
}
// Jugement de cloture après LJ
elseif ($this->SituationCloture) {
if ($this->debug) {
file_put_contents('procol.log', "Cloture (CL) "."\n", FILE_APPEND);
}
$tabRet['SituationJuridique'] = 'CL';
}
// En cours de procédure
else {
if ($this->debug) {
file_put_contents('procol.log', "Procol (P) "."\n", FILE_APPEND);
}
$tabRet['SituationJuridique'] = 'P';
$tabRet['dateMajANN'] = Metier_Util_Date::dateT('Y-m-d', 'Y-m-d', $tabDates[0]);
if ($tabRet['dateMajANN'] == '--') {
$tabRet['dateMajANN'] = '';
} else {
$dateAnnLastCompare = DateTime::createFromFormat('Y-m-d', $tabRet['dateMajANN']);
}
// RAZ SituationJuridique si cutoff plus récent que dernière procol
$stmt = $this->conn->executeQuery("SELECT encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate FROM jo.scores_cutoff WHERE siren=$siren");
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($result['scoreSolv'] > 0) {
//Tri des dates de procol
$tabDates = array();
foreach ($tabProcol as $iProcol=>$procol) {
$tabDates[] = $procol['dateJugement'];
// Procol
$tabProcol = $this->getAnnoncesLegales($siren, 0, 'P', false);
if (count($tabProcol) > 0) {
$tabDates = array();
foreach ($tabProcol as $iProcol => $procol) {
$tabDates[] = $procol['dateJugement'];
}
rsort($tabDates);
$dateProcol = str_replace('-', '', $tabDates[0])*1;
// Plan
if ($this->dureePlan > 0 && date('Ymd') < $this->finPlan) {
if ($this->debug) {
file_put_contents('procol.log', "Plan (PL) : ".$this->dureePlan."-".$this->finPlan."\n", FILE_APPEND);
}
rsort($tabDates);
$dateProcol = str_replace('-', '', $tabDates[0])*1;
if ($result['dateUpdate'] > $result['dateInsert']) {
$dateMaj = str_replace('-', '', $result['dateUpdate']);
} else {
$dateMaj = str_replace('-', '', $result['dateInsert']);
$tabRet['SituationJuridique'] = 'PL';
}
// Plan révolu
elseif ($this->dureePlan > 0 && date('Ymd') >= $this->finPlan) {
if ($this->debug) {
file_put_contents('procol.log', "Plan revolu : ".$this->dureePlan."-".$this->finPlan."\n", FILE_APPEND);
}
if ($dateProcol <= $dateMaj) {
$tabRet['SituationJuridique'] = '';
$tabRet['SituationJuridique'] = '';
}
// Appel de jugement
elseif ($this->appelJugement) {
$tabRet['SituationJuridique'] = 'PA';
}
// Jugement de cloture après LJ
elseif ($this->SituationCloture) {
if ($this->debug) {
file_put_contents('procol.log', "Cloture (CL) "."\n", FILE_APPEND);
}
$tabRet['SituationJuridique'] = 'CL';
}
// En cours de procédure
else {
if ($this->debug) {
file_put_contents('procol.log', "Procol (P) "."\n", FILE_APPEND);
}
$tabRet['SituationJuridique'] = 'P';
}
// RAZ SituationJuridique si cutoff plus récent que dernière procol
$stmt = $this->conn->executeQuery("SELECT encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate FROM jo.scores_cutoff WHERE siren=$siren");
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($result['scoreSolv'] > 0) {
//Tri des dates de procol
$tabDates = array();
foreach ($tabProcol as $iProcol => $procol) {
$tabDates[] = $procol['dateJugement'];
}
rsort($tabDates);
$dateProcol = str_replace('-', '', $tabDates[0])*1;
if ($result['dateUpdate'] > $result['dateInsert']) {
$dateMaj = str_replace('-', '', $result['dateUpdate']);
} else {
$dateMaj = str_replace('-', '', $result['dateInsert']);
}
if ($dateProcol <= $dateMaj) {
$tabRet['SituationJuridique'] = '';
}
}
}
}
// Absorption
if ($identite['SituationJuridique'] == '') {
$tabAnn = $this->getAnnoncesLegales($siren, 0, 'A', false);
$nbAnn = count($tabAnn);
if (count($tabAnn) > 0) {
$dateAnn = $tabAnn[$nbAnn-1]['dateInsertionSD'];
$dateAnnCompare = DateTime::createFromFormat('Y-m-d H:i:s', $dateAnn);
$dateAnnCompare->add(new DateInterval('P364D'));
if ($dateAnnCompare >= $dateAnnLastCompare) {
$tabRet['SituationJuridique'] = 'A';
}
}
}
// Dissolution
if ($identite['SituationJuridique'] == '') {
$tabAnn = $this->getAnnoncesLegales($siren, 0, 'D', false);
$nbAnn = count($tabAnn);
if (count($tabAnn) > 0) {
$dateAnn = $tabAnn[$nbAnn-1]['dateInsertionSD'];
$dateAnnCompare = DateTime::createFromFormat('Y-m-d H:i:s', $dateAnn);
$dateAnnCompare->add(new DateInterval('P364D'));
if ($dateAnnCompare >= $dateAnnLastCompare) {
$tabRet['SituationJuridique'] = 'D';
}
}
}
} elseif (count($this->getAnnoncesLegales($siren, 0, 'A', false)) > 0) {
$tabRet['SituationJuridique'] = 'A';
} elseif (count($this->getAnnoncesLegales($siren, 0, 'D', false)) > 0) {
$tabRet['SituationJuridique'] = 'D';
}
if ($this->debug) {
file_put_contents('procol.log', "SituationJuridique = ".$tabRet['SituationJuridique']."\n", FILE_APPEND);
}
// Fin Situation Juridique
// Date de dernière mise à jour
$tabAnn = $this->getAnnoncesLegales($siren, 0, '', false, false);
$tabDates=array();
foreach ($tabAnn as $iAnn=>$ann) {
$tabDates[] = $ann['dateInsertionSD'];
}
rsort($tabDates);
$tabRet['dateMajANN'] = Metier_Util_Date::dateT('Y-m-d', 'Y-m-d', $tabDates[0]);
if ($tabRet['dateMajANN'] == '--') {
$tabRet['dateMajANN'] = '';
}
$timer['getAnnoncesLegales']=microtime(true);
$timer['getAnnoncesLegales'] = microtime(true);
}
if (($tabInsee['CJ'] > 0 && $tabInsee['CJ'] < 20
@ -3380,7 +3416,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
}
}
if (strtoupper($entrep['typeBilan'])=='S') {
$mBil = new Metier_Partenaires_MBilans(0, $this->iDb);
$mBil = new Metier_Partenaires_MBilans();
$tabTmp = $mBil->bilanSimplifie2Normal($tabBilan);
$tabBilan = array_merge($tabTmp, $tabBilan);
}
@ -4691,7 +4727,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1311, 1312, 1313,
1500, 1501, 1502, 1503, 1504
))) {
$mBil = new Metier_Partenaires_MBilans($siren, $this->iDb);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans(false);
$derExercice = 0;
foreach ($tabBilans as $idx => $bilan) {
@ -4715,7 +4752,8 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
}
// --- Dissolution mais bilan après événements
elseif ($rubrique == 'D') {
$mBil = new Metier_Partenaires_MBilans($siren, $this->iDb);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans(false, 3);
$derExercice = 0;
foreach ($tabBilans as $idx => $bilan) {
@ -6548,7 +6586,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
'Sigle' => $row['sigle'],
'Enseigne' => $row['enseigne'],
'Adresse' => trim(preg_replace('/ +/', ' ',
trim($row['adr_num'] .' '. $$row['adr_btq'] .' '. $row['adr_typeVoie']
trim($row['adr_num'] .' '. $row['adr_btq'] .' '. $row['adr_typeVoie']
.' '. $row['adr_libVoie']))),
'Adresse2' => trim(preg_replace('/ +/', ' ', $row['adr_comp'])),
'CP' => $row['adr_cp'],

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ class Metier_Partenaires_MRnvp
public $nomTronque = 0;
protected $tabAdrCQ=array(
protected $tabAdrCQ = array(
10 => 'Adresse correcte',
20 => 'Adresse correcte (Voie non reconue dans un CEDEX ou BP)',
21 => 'Adresse correcte mais numéro de facade hors borne (petite ville)',
@ -43,7 +43,7 @@ class Metier_Partenaires_MRnvp
{
$rep = $this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
$tabDevises = array();
foreach ($rep as $k=>$dev) {
foreach ($rep as $k => $dev) {
$tabDevises[$dev['devInpi']*1] = $dev['devIso'];
}
@ -469,7 +469,7 @@ class Metier_Partenaires_MRnvp
public function normaliseRS($nomLong, $taille=38, $debug=false)
{
$nomCourt = preg_replace('/[^A-Z0-9%@&\'\(\)\"\-\*\/\s\+]/', '', trim(strtoupper($nomLong)));
$tabMots = split("[^[:alpha:]]+", $nomCourt);
$tabMots = preg_split("[^[:alpha:]]+", $nomCourt);
$passage = 0;
$this->nomTronque = 0;
while (strlen($nomCourt) > $taille) {

View File

@ -229,7 +229,7 @@ class Metier_Partenaires_MTva
array(15,52,46,26,24,82,49,36,25),
array(64,86,30,05,51,75,58,66,28),
array(16,23,14,81,78,68,67,96,31),
array(65,57,95,60,08,61,76,29,34),
array(65,57,95,60, 8,61,76,29,34),
array(17,91,79,39,35,54,85,59,37),
array(66,28,63,18,62,47,94,89,40),
);

View File

@ -998,10 +998,10 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
} else {
$SAISONAT='P';
}
$CAPITAL=$tabIdentite['Capital'];
$CAPITAL = $tabIdentite['Capital'];
$CAPITAL_NBACTION = $tabIdentite['CapitalNbActions'];
$CAPITAL_MTACTION = $tabIdentite['CapitalMtActions'];
if ($CAPITAL>0) {
if ($CAPITAL > 0) {
switch ($tabIdentite['CapitalType']) {
case 'V': $CAPITAL_TYPE = 'variable'; break;
case 'S': $CAPITAL_TYPE = 'fixe'; break;
@ -1049,7 +1049,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
// --- Liste des bilans
$tabBilan = $tabBil = $tabRegX = array();
$mBil = new Metier_Partenaires_MBilans($siren, $iDb);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans($accesDist);
$NBBILAN = count($tabBilans);
if ($NBBILAN > 0) {
@ -2207,7 +2208,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$TYPEMERE='PM';
}
}
$mBilA = new Metier_Partenaires_MBilans($lien->siren, $iDb);
$mBilA = new Metier_Partenaires_MBilans();
$mBilA->setSiren($lien->siren);
$tabBilansA = $mBilA->listeBilans(false, 2);
$nbBilansA = count($tabBilansA);
if ($nbBilansA > 0) {

File diff suppressed because it is too large Load Diff

View File

@ -3331,7 +3331,8 @@ class Entreprise extends Scores_Ws_Server
}
$millesime = Metier_Util_Date::dateT('Ymd','d/m/Y',$millesime);
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilan = $mBil->getBilan($millesime, $typeBilan, $ref, true);
$resultBilan = new Bilan();
@ -3376,7 +3377,8 @@ class Entreprise extends Scores_Ws_Server
$this->sendError('1010');
}
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans(true);
foreach($tabBilans as $bilan)
{
@ -3561,7 +3563,8 @@ class Entreprise extends Scores_Ws_Server
$efftr = $tabIdentite['Effectif']*1;
$fj = $tabIdentite['FJ'];
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans(true);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();

View File

@ -2730,7 +2730,8 @@ class Entreprise extends Scores_Ws_Server
//Ratios
global $tva, $mBil, $efftr, $tabInfla;
require_once 'Metier/Scores/MRatios.php';
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans($accesPartenaire, 5);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
@ -4250,7 +4251,8 @@ class Entreprise extends Scores_Ws_Server
}
$millesime = Metier_Util_Date::dateT('Ymd','d/m/Y',$millesime);
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilan = $mBil->getBilan($millesime, $typeBilan, $ref, true);
// --- Bilan condidentiel
@ -4315,7 +4317,8 @@ class Entreprise extends Scores_Ws_Server
$this->sendError('1010');
}
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans(true);
foreach($tabBilans as $bilan) {
$element = new ListeBilans();
@ -4627,7 +4630,8 @@ class Entreprise extends Scores_Ws_Server
}
// Ratios
$mBil = new Metier_Partenaires_MBilans($siren);
$mBil = new Metier_Partenaires_MBilans();
$mBil->setSiren($siren);
$tabBilans = $mBil->listeBilans($accesPartenaire, 5);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();

View File

@ -1,22 +0,0 @@
<?php
return array(
'ErrorType' => 'ErrorType',
'SearchMandatairesReturn' => 'SearchMandatairesReturn',
'SearchMandataire' => 'SearchMandataire',
'SetInfosEntrepReturn' => 'SetInfosEntrepReturn',
'SetInfosMandataire' => 'SetInfosMandataire',
'SetMandataireReturn' => 'SetMandataireReturn',
'SupprAnnonceCollecteReturn' => 'SupprAnnonceCollecteReturn',
'MandataireReturn' => 'MandataireReturn',
'MandataireDetail' => 'MandataireDetail',
'MandatairesReturn' => 'MandatairesReturn',
'Mandataire' => 'Mandataire',
'DupliqueAnnonceReturn' => 'DupliqueAnnonceReturn',
'AnnonceCollecteReturn' => 'AnnonceCollecteReturn',
'AnnonceCollecte' => 'AnnonceCollecte',
'AnnonceEvenement' => 'AnnonceEvenement',
'ListeJalCollecteReturn' => 'ListeJalCollecteReturn',
'JalCollecte' => 'JalCollecte',
'SupprAnnonceReturn' => 'SupprAnnonceReturn',
'DupliqueAnnonceReturn' => 'DupliqueAnnonceReturn',
);

File diff suppressed because it is too large Load Diff

View File

@ -1,258 +0,0 @@
<?php
class ErrorType
{
/**
* Numéro d'erreur
* @var int
*/
public $errnum = 0;
/**
* Message d'erreur
* @var string
*/
public $errmsg = '';
}
class SearchMandatairesReturn
{
/** @var ErrorType */
public $error;
/** @var SearchMandataire[] */
public $result;
}
class SearchMandataire
{
/** @var string */
public $id;
/** @var string */
public $mand;
}
class SetInfosEntrepReturn
{
/** @var ErrorType */
public $error;
/** @var boolean */
public $result;
}
class SetInfosMandataire
{
/** @var int */
public $id = 0;
/** @var string */
public $sirenGrp;
/** @var string */
public $sirenMand;
/** @var string */
public $Nom;
/** @var string */
public $Prenom;
/** @var string */
public $type;
/** @var string */
public $stagiaire;
/** @var string */
public $coursAppel;
/** @var string */
public $coursAppel2;
/** @var string */
public $tribunal;
/** @var string */
public $Statut;
/** @var string */
public $adresse;
/** @var string */
public $adresseComp;
/** @var string */
public $cp;
/** @var string */
public $ville;
/** @var string */
public $tel;
/** @var string */
public $fax;
/** @var string */
public $email;
/** @var string */
public $web;
/** @var string */
public $contact;
}
class SetMandataireReturn
{
/** @var ErrorType */
public $error;
/** @var boolean */
public $result;
}
class SupprAnnonceCollecteReturn
{
/** @var ErrorType */
public $error;
/** @var boolean */
public $result;
}
class MandataireReturn
{
/** @var ErrorType */
public $error;
/** @var MandataireDetail */
public $result;
}
class MandataireDetail
{
/** @var string */
public $Nom;
/** @var string */
public $Prenom;
/** @var string */
public $tribunal;
/** @var string */
public $adresse;
/** @var string */
public $adresseComp;
/** @var string */
public $ville;
/** @var string */
public $email;
/** @var string */
public $web;
/** @var string */
public $contact;
}
class MandatairesReturn
{
/** @var Mandataire[] */
public $result;
}
class Mandataire
{
/** Identifiant interne du mandataire
* @var string
*/
public $id;
/** Nom et coordonnées du mandataire
* @var string
*/
public $mand;
}
class DupliqueAnnonceReturn
{
/** @var ErrorType */
public $error;
/** @var int */
public $result;
}
class AnnonceCollecteReturn
{
/** @var ErrorType */
public $error;
/** @var AnnonceCollecte */
public $result;
}
class AnnonceCollecte
{
/** @var string */
public $id;
/** @var string */
public $siren;
/** @var string */
public $raisonSociale;
/** @var string */
public $adresse;
/** @var string */
public $codePostal;
/** @var string */
public $ville;
/** @var string */
public $dateJugement;
/** @var AnnonceEvenement[] */
public $even;
/** @var string */
public $dateSource;
/** @var string */
public $dateCessationPaiement;
/** @var string */
public $dateEffetFinP;
/** @var string */
public $tribunal;
/** @var string */
public $numero;
/** @var string */
public $montant;
/** @var string */
public $actionsNb;
/** @var string */
public $inter1type;
/** @var string */
public $inter1id;
/** @var string */
public $inter1nom;
/** @var string */
public $inter2type;
/** @var string */
public $inter2id;
/** @var string */
public $inter2nom;
/** @var string */
public $inter3type;
/** @var string */
public $inter3id;
/** @var string */
public $inter3nom;
/** @var string */
public $complement;
/** @var string */
public $nouvActivite;
/** @var string */
public $nouvDir;
/** @var string */
public $nouvAdr;
/** @var string */
public $nouvFJ;
/** @var string */
public $source;
}
class AnnonceEvenement
{
/** @var int */
public $CodeEven;
/** @var string */
public $LibEven;
}
class ListeJalCollecteReturn
{
/** @var ErrorType */
public $error;
/** @var JalCollecte[] */
public $result;
}
class JalCollecte
{
/** @var string */
public $id;
/** @var string */
public $nom;
}
class SupprAnnonceReturn
{
/** @var ErrorType */
public $error;
/** @var boolean */
public $result;
}

View File

@ -54,7 +54,6 @@ return array(
'actif' => true,
'versions' => array(
'0.2' => array( 'actif' => true, 'defaut' => true),
'0.1' => array( 'actif' => false, 'defaut' => false ),
),
'idClient' => array(1),
),