MRncs : Intervenants

This commit is contained in:
Michael RICOIS 2017-01-12 11:36:16 +01:00
parent caf10cc374
commit 338399980a

View File

@ -650,110 +650,121 @@ class Metier_Partenaires_MRncs
}
}
/**
* Intervenants
* @param string $siren
* @return array
*/
public function getIntervenants($siren)
{
$tabJuge = $this->getListeJugements($siren);
$tabDepots =$tabDeja = array();
$tabDepots = $tabDeja = array();
$tabAdm = array(
'A'=>'Administrateur judiciaire',
'C'=>'Commissaire au plan',
'D'=>'Commissaire au concordat',
'H'=>'Huissier',
'J'=>'Juge Commissaire',
'K'=>'Juge Commissaire suppléant',
'L'=>'Liquidateur',
'M'=>'Mandataire judiciaire',
'N'=>'Notaire',
'O'=>'Opposition',
'R'=>'Représentant des créanciers',
'S'=>'Syndic',
'T'=>'Conciliateur',
'U'=>'Curateur',
'V'=>'Avocat',
'A' => 'Administrateur judiciaire',
'C' => 'Commissaire au plan',
'D' => 'Commissaire au concordat',
'H' => 'Huissier',
'J' => 'Juge Commissaire',
'K' => 'Juge Commissaire suppléant',
'L' => 'Liquidateur',
'M' => 'Mandataire judiciaire',
'N' => 'Notaire',
'O' => 'Opposition',
'R' => 'Représentant des créanciers',
'S' => 'Syndic',
'T' => 'Conciliateur',
'U' => 'Curateur',
'V' => 'Avocat',
);
foreach ($tabJuge as $iDepot => $depot) {
if ($depot['adm1code']>0 && !in_array($depot['adm1code'], $tabDeja)) {
if ($depot['adm1code'] > 0 && !in_array($depot['adm1code'], $tabDeja)) {
$tabDepots[] = array(
'codEven' => $depot['codEven'],
'libEven' => $depot['libEven'],
'dateEffet' => $depot['dateEffet'],
'admid' => $depot['adm1id'],
'admcode' => $depot['adm1code'],
'admtype' => $depot['adm1type'],
'admfonction' => $depot['adm1fonction'],
'codEven' => $depot['codEven'],
'libEven' => $depot['libEven'],
'dateEffet' => $depot['dateEffet'],
'admid' => $depot['adm1id'],
'admcode' => $depot['adm1code'],
'admtype' => $depot['adm1type'],
'admfonction' => $depot['adm1fonction'],
'admnom' => $depot['adm1nom'],
'admadrNum' => $depot['adm1adrNum'],
'admadrInd' => $depot['adm1adrInd'],
'admadrNum' => $depot['adm1adrNum'],
'admadrInd' => $depot['adm1adrInd'],
'admadrType' => $depot['adm1adrType'],
'admadrVoie' => $depot['adm1adrVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
'admadr2' => $depot['adm1adr2'],
'admadrCP' => $depot['adm1adrCP'],
'admadrVille' => $depot['adm1adrVille'],
'admadr2' => $depot['adm1adr2'],
'admadrCP' => $depot['adm1adrCP'],
'admadrVille' => $depot['adm1adrVille'],
);
$tabDeja[] = $depot['adm1code'];
}
if ($depot['adm2code']>0 && !in_array($depot['adm2code'], $tabDeja)) {
$tabDepots[]=array(
'codEven' => $depot['codEven'],
'libEven' => $depot['libEven'],
'dateEffet' => $depot['dateEffet'],
'admid' => $depot['adm2id'],
'admcode' => $depot['adm2code'],
'admtype' => $depot['adm2type'],
'admfonction' => $depot['adm2fonction'],
if ($depot['adm2code'] > 0 && !in_array($depot['adm2code'], $tabDeja)) {
$tabDepots[] = array(
'codEven' => $depot['codEven'],
'libEven' => $depot['libEven'],
'dateEffet' => $depot['dateEffet'],
'admid' => $depot['adm2id'],
'admcode' => $depot['adm2code'],
'admtype' => $depot['adm2type'],
'admfonction' => $depot['adm2fonction'],
'admnom' => $depot['adm2nom'],
'admadrNum' => $depot['adm2adrNum'],
'admadrInd' => $depot['adm2adrInd'],
'admadrNum' => $depot['adm2adrNum'],
'admadrInd' => $depot['adm2adrInd'],
'admadrType' => $depot['adm2adrType'],
'admadrVoie' => $depot['adm2adrVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
'admadr2' => $depot['adm2adr2'],
'admadrCP' => $depot['adm2adrCP'],
'admadrVille' => $depot['adm2adrVille'],
'admadr2' => $depot['adm2adr2'],
'admadrCP' => $depot['adm2adrCP'],
'admadrVille' => $depot['adm2adrVille'],
);
$tabDeja[] =$depot['adm2code'];
$tabDeja[] = $depot['adm2code'];
}
}
if (count($tabDepots)>0) {
$strTypes="IN ('J','K','H','V','N')";
$forceRecherche=false;
$strDates="AND ABS(DATEDIFF(dateJugement, '".$depot['dateEffet']."'))<60 ";
if (count($tabDepots) > 0) {
$strTypes = "IN ('J','K','H','V','N')";
$forceRecherche = false;
$strDates = "AND ABS(DATEDIFF(dateJugement, '".$depot['dateEffet']."'))<60 ";
} else {
$strTypes="<>''";
$forceRecherche=true;
$strDates='';
$strTypes = "!=''";
$forceRecherche = true;
$strDates = '';
}
$tabTmp=$this->iDb->select('jo.annonces',
'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom, dateSource, dateInsert, source, tribunal, raisonSociale',
"siren=$siren $strDates AND ( inter1type $strTypes OR inter2type $strTypes OR inter3type $strTypes OR inter4type $strTypes ) AND typeEven BETWEEN 1000 AND 2000 ORDER BY dateJugement DESC", false, MYSQL_ASSOC);
if (isset($tabTmp[0])) {
$depot=$tabTmp[0];
$tabRet['dateCessationPaiement']=$depot['dateCessationPaiement'];
$sql = "SELECT id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id,
inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type,
inter4id, inter4nom, dateSource, dateInsert, source, tribunal, raisonSociale
FROM jo.annonces WHERE siren=:siren $strDates
AND ( inter1type $strTypes OR inter2type $strTypes OR inter3type $strTypes OR inter4type $strTypes )
AND typeEven BETWEEN 1000 AND 2000 ORDER BY dateJugement DESC";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', $siren);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
$tabRet['dateCessationPaiement'] = $depot['dateCessationPaiement'];
for ($i=1; $i<4; $i++) {
if (($forceRecherche && !in_array($tabTmp['inter'.$i.'type'], $tabDeja)) ||
($tabTmp['inter'.$i.'type']=='J' || $tabTmp['inter'.$i.'type']=='K' ||
$tabTmp['inter'.$i.'type']=='H' || $tabTmp['inter'.$i.'type']=='V' ||
$tabTmp['inter'.$i.'type']=='N')) {
$tabDepots[]=array( 'codEven' => $depot['typeEven'],
'libEven' => $depot['typeEven'],
'dateEffet' => $depot['dateJugement'],
'admid' => $depot['inter'.$i.'id'],
'admcode' => $depot['inter'.$i.'id'],
'admtype' => $depot['inter'.$i.'type'],
'admfonction' => $tabAdm[$depot['inter'.$i.'type']],
'admnom' => $depot['inter'.$i.'nom'],
'admadrNum' => '',
'admadrInd' => '',
'admadrType' => '',
'admadrVoie' => '',
'admadr2' => '',
'admadrCP' => '',
'admadrVille' => '',
);
$tabDeja[]=$tabTmp['inter'.$i.'type'];
if (($forceRecherche && !in_array($result['inter'.$i.'type'], $tabDeja))
|| in_array($result['inter'.$i.'type'], array('J', 'K', 'H', 'V', 'N'))) {
$tabDepots[] = array(
'codEven' => $result['typeEven'],
'libEven' => $result['typeEven'],
'dateEffet' => $result['dateJugement'],
'admid' => $result['inter'.$i.'id'],
'admcode' => $result['inter'.$i.'id'],
'admtype' => $result['inter'.$i.'type'],
'admfonction' => $tabAdm[$result['inter'.$i.'type']],
'admnom' => $result['inter'.$i.'nom'],
'admadrNum' => '',
'admadrInd' => '',
'admadrType' => '',
'admadrVoie' => '',
'admadr2' => '',
'admadrCP' => '',
'admadrVille' => '',
);
$tabDeja[] = $result['inter'.$i.'type'];
}
}
}
return $tabDepots;
}
@ -987,7 +998,7 @@ class Metier_Partenaires_MRncs
/**
* Dirigeants principaux
* @param sstring $siren
* @param string $siren
* @param number $nbDirs
* @return array
*/
@ -996,7 +1007,8 @@ class Metier_Partenaires_MRncs
$siren = $siren*1;
$tabRet = array();
$sql = "SELECT siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert
$sql = "SELECT siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date,
naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert
FROM jo.rncs_dirigeants WHERE siren=:siren AND actif%10=1 ORDER BY fonction_code DESC";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', $siren);
@ -1041,8 +1053,10 @@ class Metier_Partenaires_MRncs
}
}
} else {
$sql = "SELECT siren, raisonSociale, '' AS dirRS, IF(sexe='M', 'M', IF(sexe='F', 'MME', '')) AS civilite, nom, prenom, nomUsage AS naissance_nom, dateNaiss AS naissance_date, lieuNaiss AS naissance_lieu, 1050 AS fonction_code, 'Personne Physique' AS fonction_lib, 0 AS cinf, dateFer AS dateFin, flux, dateInsert
FROM jo.rncs_entrep WHERE siren=:siren";
$sql = "SELECT siren, raisonSociale, '' AS dirRS, IF(sexe='M', 'M', IF(sexe='F', 'MME', '')) AS civilite,
nom, prenom, nomUsage AS naissance_nom, dateNaiss AS naissance_date, lieuNaiss AS naissance_lieu,
1050 AS fonction_code, 'Personne Physique' AS fonction_lib, 0 AS cinf, dateFer AS dateFin, flux, dateInsert
FROM jo.rncs_entrep WHERE siren=:siren";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', $siren);
$stmt->execute();