2013-11-05 11:18:30 +00:00
< ? php
class MRncs
{
public $tabFctDir = array (
100 => array ( 'codeSd' => '1300' , 'lib' => 'Président' ),
110 => array ( 'codeSd' => '1306' , 'lib' => 'Président du conseil d\'administration' ),
120 => array ( 'codeSd' => '1301' , 'lib' => 'Président directeur Général' ),
140 => array ( 'codeSd' => '1650' , 'lib' => 'Gouverneur' ),
150 => array ( 'codeSd' => '1651' , 'lib' => 'Sous-gouverneur' ),
200 => array ( 'codeSd' => '0900' , 'lib' => 'Gérant' ),
210 => array ( 'codeSd' => '0912' , 'lib' => 'Gérant non associé' ),
300 => array ( 'codeSd' => '0400' , 'lib' => 'Co-gérant' ),
400 => array ( 'codeSd' => '0709' , 'lib' => 'Directeur général' ),
410 => array ( 'codeSd' => '0713' , 'lib' => 'Directeur général non administrateur' ),
420 => array ( 'codeSd' => '0708' , 'lib' => 'Directeur général unique' ),
430 => array ( 'codeSd' => '0704' , 'lib' => 'Directeur général délégué' ),
500 => array ( 'codeSd' => '1800' , 'lib' => 'Vice-président' ),
600 => array ( 'codeSd' => '0100' , 'lib' => 'Administrateur' ),
610 => array ( 'codeSd' => '0101' , 'lib' => 'Administrateur délégué' ),
700 => array ( 'codeSd' => '1308' , 'lib' => 'Président du directoire' ),
900 => array ( 'codeSd' => '1307' , 'lib' => 'Président du conseil de surveillance' ),
1200 => array ( 'codeSd' => '0209' , 'lib' => 'Associé-gérant' ),
1300 => array ( 'codeSd' => '0603' , 'lib' => 'Contrôleur de gestion' ),
4000 => array ( 'codeSd' => 'A' , 'lib' => 'Administrateur judiciaire' ),
4100 => array ( 'codeSd' => '1900' , 'lib' => 'Liquidateur' ),
4300 => array ( 'codeSd' => '0108' , 'lib' => 'Administrateur provisoire' ),
4400 => array ( 'codeSd' => '1401' , 'lib' => 'Représentant en France d\'une société étrangère' ),
7000 => array ( 'codeSd' => 'U' , 'lib' => 'Curateur' ),
7100 => array ( 'codeSd' => 'C' , 'lib' => 'Commissaire au plan' ),
7200 => array ( 'codeSd' => 'S' , 'lib' => 'Syndic' ),
7300 => array ( 'codeSd' => 'D' , 'lib' => 'Commissaire au concordat' ),
7500 => array ( 'codeSd' => 'R' , 'lib' => 'Représentant des créanciers' ),
7600 => array ( 'codeSd' => 'M' , 'lib' => 'Mandataire judiciaire' ),
7800 => array ( 'codeSd' => 'M' , 'lib' => 'Mandataire judiciaire' ),
9100 => array ( 'codeSd' => 'T' , 'lib' => 'Conciliateur' ),
);
public $tabDevises = array ();
public $tabPays = array ();
public $tabTribunaux = array ();
public $tabMandataires = array ();
public $tabJugements = array ();
private $iDb ;
/** Partie Extranet IMR Infogreffe **/
public $body = '' ;
public $referer = '' ;
public $codeRetour = '' ;
public $libErreur = '' ;
public $cookie = '' ;
public $infoIMR = array ();
public $maxDemJour = 10 ;
2014-12-18 10:31:05 +00:00
public $matching = NULL ;
2013-11-05 11:18:30 +00:00
2015-01-20 16:32:59 +00:00
public function __construct ( $db = null )
2013-11-05 11:18:30 +00:00
{
2014-06-02 08:41:24 +00:00
if ( $db === null ) {
$this -> iDb = new WDB ();
} else {
$this -> iDb = $db ;
}
$this -> tabDevises = $this -> getTabDevisesInpi ();
$this -> tabPays = $this -> getTabPaysInpi ();
$this -> tabTribunaux = $this -> getTabTribunaux ();
$this -> tabMandataires = $this -> getTabMandataires ();
$this -> tabJugements = $this -> getTabJugements ();
2013-11-05 11:18:30 +00:00
}
2015-01-20 16:32:59 +00:00
public function getLibFctDir ( $codeFonctionDirectionRncs )
{
2013-11-05 11:18:30 +00:00
$codeFonctionDirectionRncs = $codeFonctionDirectionRncs * 1 ;
return $this -> tabFctDir [ $codeFonctionDirectionRncs ][ 'lib' ];
}
2015-01-20 16:32:59 +00:00
public function getCodFctBodaccFctDir ( $codeFonctionDirectionRncs )
{
2013-11-05 11:18:30 +00:00
$codeFonctionDirectionRncs = $codeFonctionDirectionRncs * 1 ;
return $this -> tabFctDir [ $codeFonctionDirectionRncs ][ 'codeSd' ];
}
/**
* Initialisation du tableau privé des devises Inpi <=> ISO
* @ return array
*/
private function getTabDevisesInpi ()
{
$cache = dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'DevisesInpi.php' ;
if ( file_exists ( $cache ) ) {
return include $cache ;
} else {
$rep = $this -> iDb -> select ( 'tabDevises' , 'devInpi, devIso' , 'devInpi>0' , false , MYSQL_ASSOC );
$tabDevises = array ();
foreach ( $rep as $k => $dev )
$tabDevises [ $dev [ 'devInpi' ] * 1 ] = $dev [ 'devIso' ];
return $tabDevises ;
}
}
/** Récupération du code ISO de la devise numérique de l ' Inpi
**
** @ param integer $devise
** @ return string Devise ISO
**/
public function getDeviseInpi ( $numDeviseInpi ) {
if ( $numDeviseInpi * 1 > 0 && isset ( $this -> tabDevises [ $numDeviseInpi * 1 ]))
return $this -> tabDevises [ $numDeviseInpi * 1 ];
else
return '' ;
}
/**
*
* @ return array
*/
public function getTabJugements ()
{
$cache = dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'Jugements.php' ;
if ( file_exists ( $cache ) ) {
return include $cache ;
} else {
$rep = $this -> iDb -> select ( 'tabJugeRncs' , 'codJugement, codEven' , '1' , false , MYSQL_ASSOC );
$tabJug = array ();
foreach ( $rep as $k => $dev )
$tabJug [ $dev [ 'codJugement' ] * 1 ] = $dev [ 'codEven' ];
return $tabJug ;
}
}
public function getCodeEvenJugementInpi ( $codJugementInpi ) {
if ( $codJugementInpi * 1 > 0 && isset ( $this -> tabJugements [ $codJugementInpi * 1 ]))
return $this -> tabJugements [ $codJugementInpi * 1 ];
else
return $codJugementInpi ;
}
/**
* Initialisation du tableau privé des pays Inpi <=> ISO
* @ return array
*/
private function getTabPaysInpi ()
{
$cache = dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'PaysInpi.php' ;
if ( file_exists ( $cache ) ) {
return include $cache ;
} else {
$rep = $this -> iDb -> select ( 'tabPays' , 'codePaysInpi, codPays' , 'codePaysInpi>0' , false , MYSQL_ASSOC );
$tabPays = array ();
foreach ( $rep as $k => $dev )
$tabPays [ $dev [ 'codePaysInpi' ] * 1 ] = $dev [ 'codPays' ];
return $tabPays ;
}
}
/** Tableau des mandataires suceptibles d 'être tranmis par l' INPI
**/
private function getTabMandataires () {
$tabTmp = $this -> iDb -> select ( 'tabMandataires' , " UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact " , " TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC " , true , MYSQL_ASSOC );
$tabMandSD = array ();
foreach ( $tabTmp as $mand ) {
$tabMandSD [] = array ( 'id' => $mand [ 'id' ],
'siren' => $mand [ 'sirenMand' ],
'nom' => $mand [ 'Nom' ],
'prenom' => $mand [ 'Prenom' ],
'type' => $mand [ 'type' ],
'adr1' => $mand [ 'adresse' ],
'adr2' => $mand [ 'adresseComp' ],
'cp' => $mand [ 'cp' ],
'ville' => $mand [ 'ville' ],
'tel' => $mand [ 'tel' ],
'fax' => $mand [ 'fax' ],
'email' => $mand [ 'email' ],
);
}
return $tabMandSD ;
}
2014-12-18 10:31:05 +00:00
/**
* Donne l ' id du mandataire en fonction de son libellé INPI
* @ param unknown $strNomPrenom
* @ param string $adresse
* @ param string $cp
* @ param string $ville
* @ param string $debug
* @ return boolean | Ambigous < multitype :>
*/
public function getIdMandataireInpi ( $strNomPrenom , $adresse = '' , $cp = '' , $ville = '' , $debug = false )
{
2013-11-05 11:18:30 +00:00
$id = false ;
2014-12-18 10:31:05 +00:00
$cp2 = substr ( $cp , 0 , 2 );
$this -> matching = NULL ;
if ( trim ( $strNomPrenom ) == '' ) return false ;
2013-11-05 11:18:30 +00:00
2014-12-18 10:31:05 +00:00
//echo "Recherche de '$strNomPrenom, $adresse, $cp $ville' dans les mandataires S&D :".EOL;
$tabTmp = $this -> iDb -> select ( 'tabMandataires' ,
" id, Nom, Prenom, adresse, adresseComp, cp, ville, MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST (' $strNomPrenom $adresse $ville ' IN NATURAL LANGUAGE MODE) AS score " ,
" TYPE IN ('A', 'M') AND (Nom<>'' OR Prenom <>'') AND MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST (' $strNomPrenom $adresse $ville ' IN NATURAL LANGUAGE MODE) ORDER BY score DESC LIMIT 0,10 " , false , MYSQL_ASSOC );
$nbRet = count ( $tabTmp );
if ( $nbRet == 0 ) {
return false ;
} elseif ( $nbRet == 1 ) {
//print_r($tabTmp);
$this -> matching = $tabTmp [ 0 ][ 'score' ];
return $tabTmp [ 0 ][ 'id' ];
} else {
foreach ( $tabTmp as $i => $iRet ) {
// echo "Recherche de '$strNomPrenom, $adresse, $cp $ville' dans les mandataires S&D :".EOL;
if ( $debug ) echo " je compare ' $cp ' avec ' " . $iRet [ 'cp' ] . " ' et ' $ville ' avec ' " . $iRet [ " ville " ] . " ' (score= " . $iRet [ 'score' ] . " ) " . EOL ;
if ((( $iRet [ 'cp' ] == $cp || substr ( $iRet [ 'cp' ], 0 , 2 ) == $cp2 ) && ( $iRet [ " ville " ] == $ville || preg_replace ( '/ 0/' , ' ' , $iRet [ " ville " ]) == $ville ) || ( strpos ( $iRet [ " ville " ], $ville ) > 0 && $nbRet == 1 ) || $iRet [ " score " ] > 17 ) ||
( $cp == '' && $ville == '' && $iRet [ " score " ] > 6.88 )) {
//print_r($iRet);
$this -> matching = $iRet [ 'score' ];
return $iRet [ 'id' ];
2013-11-05 11:18:30 +00:00
}
}
}
2014-12-18 10:31:05 +00:00
2013-11-05 11:18:30 +00:00
return $id ;
}
/** Récupération du code ISO du code pays numérique de l ' Inpi
**
** @ param integer $pays
** @ return string Devise ISO
**/
public function getPaysInpi ( $numPays ) {
if ( $numPays * 1 > 0 )
return $this -> tabPays [ $numPays * 1 ];
else
return '' ;
}
/**
* Initialisation du tableau privé des codes tribunaux Greffes / Inpi avec le libellé Bodacc
* @ return array
*/
private function getTabTribunaux ()
{
$cache = dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'Tribunaux.php' ;
if ( file_exists ( $cache ) ) {
return include $cache ;
} else {
$rep = $this -> iDb -> select ( 'tribunaux' , 'triNumGreffe, triNom, triId, triCode' , 'triNumGreffe IS NOT NULL' , false , MYSQL_ASSOC );
$tabTribunaux = array ();
foreach ( $rep as $k => $dev ) {
$tabTribunaux [ $dev [ 'triNumGreffe' ] * 1 ][ 'Id' ] = $dev [ 'triId' ];
$tabTribunaux [ $dev [ 'triNumGreffe' ] * 1 ][ 'Nom' ] = $dev [ 'triNom' ];
$tabTribunaux [ $dev [ 'triNumGreffe' ] * 1 ][ 'Code' ] = $dev [ 'triCode' ];
}
return $tabTribunaux ;
}
}
/**
* Libellé des FJ
* @ param unknown $code_forme_juridique
* @ return string
*/
private function getLibelleFJ ( $code_forme_juridique )
{
$fj = $code_forme_juridique * 1 ;
if ( $fj > 0 && $fj < 10000 ) {
$tmp = $this -> iDb -> select ( 'tabFJur' , 'libelle AS LibFJ' , " code= $fj " );
return @ $tmp [ 0 ][ 0 ];
} else
return 'En instance de chiffrement' ;
}
/**
* Libellé des NAF
* @ param unknown $codeNaf
* @ return Ambigous <>
*/
private function getLibelleNaf ( $codeNaf )
{
2015-04-24 15:42:19 +00:00
$ret = $this -> iDb -> query ( " SELECT libNaf700 AS LibNaf FROM jo.tabNaf4 WHERE codNaf700=' $codeNaf '
UNION SELECT libNaf5 AS LibNaf FROM jo . tabNaf5 WHERE codNaf5 = '$codeNaf' " );
$res = $this -> iDb -> fetch ( MYSQL_ASSOC );
2013-11-05 11:18:30 +00:00
return $res [ 'LibNaf' ];
}
/** Récupération du libellé du code numérique du tribunal Greffe ou Inpi
**
** @ param integer $numTribunal
** @ return string Nom du tribunal
**/
public function getLibTribunal ( $numTribunal ) {
if ( $numTribunal * 1 > 0 )
return $this -> tabTribunaux [ $numTribunal * 1 ][ 'Nom' ];
else
return '' ;
}
/** Récupération du code Bodacc du code numérique du tribunal Greffe ou Inpi
**
** @ param integer $numTribunal
** @ return string Code Bodacc du tribunal
**/
public function getCodeBodaccTribunal ( $numTribunal ) {
if ( $numTribunal * 1 > 0 )
return $this -> tabTribunaux [ $numTribunal * 1 ][ 'Code' ];
else
return '' ;
}
/** Récupération de l ' identifiant S & D du code numérique du tribunal Greffe ou Inpi
**
** @ param integer $numTribunal
** @ return string Numéro interne de tribunal S & D
**/
public function getIdTribunal ( $numTribunal ) {
if ( $numTribunal * 1 > 0 )
return $this -> tabTribunaux [ $numTribunal * 1 ][ 'Id' ];
else
return '' ;
}
/** Retourne les informations de l ' établissements demandé ou du siège actif ou dernier siège inactif
*
* @ param integer $siren Siren de l ' entreprise
* @ param integer $nic Nic de l ' établissement . Si absent , renvoi les informations du siège actif ou du dernier siège actif
* @ return array
*/
public function getIdentiteEtab ( $siren , $nic = 0 )
{
$siren = $siren * 1 ;
$nic = $nic * 1 ;
if ( $nic > 0 ) $strSql = " AND nic= $nic " ;
else $strSql = " AND siege=1 ORDER BY actif DESC, nic DESC " ;
$rep = $this -> iDb -> select ( 'rncs_etab' , 'siren, nic, siege, actif, enseigne, nomCommercial, adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3, naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate' , " siren= $siren $strSql " , false , MYSQL_ASSOC );
2014-06-10 09:26:30 +00:00
if ( count ( $rep ) == 0 ) {
return false ;
}
$entrep = $rep [ 0 ];
2013-11-05 11:18:30 +00:00
if ( $entrep [ 'jourUpdate' ] <> '0000-00-00' ) $dateMaj = $entrep [ 'jourUpdate' ];
else $dateMaj = $entrep [ 'flux' ];
if ( trim ( $entrep [ 'adresse1' ]) == '' ) $adresse1 = trim ( preg_replace ( '/ +/' , ' ' , $entrep [ 'adrNumVoie' ] . ' ' . strtoupper ( $entrep [ 'adrIndRep' ]) . ' ' . strtoupper ( $entrep [ 'adrLibVoie' ])));
else $adresse1 = trim ( strtoupper ( $entrep [ 'adresse1' ]));
if ( trim ( $entrep [ 'adresse2' ]) == '' ) $adresse2 = trim ( strtoupper ( $entrep [ 'adrComp' ]));
else $adresse2 = trim ( strtoupper ( $entrep [ 'adresse2' ]));
if ( trim ( $entrep [ 'adresse3' ]) == '' ) $adresse3 = '' ;
else $adresse3 = trim ( strtoupper ( $entrep [ 'adresse3' ]));
2014-06-10 09:26:30 +00:00
$tabIdentite = array (
'siren' => $entrep [ 'siren' ],
'nic' => $entrep [ 'nic' ],
'siret' => $entrep [ 'siren' ] . $entrep [ 'nic' ],
'actif' => $entrep [ 'actif' ],
'actifEt' => $entrep [ 'actif' ],
'siege' => $entrep [ 'siege' ],
'enseigne' => strtoupper ( $entrep [ 'enseigne' ]),
'nomCommercial' => strtoupper ( $entrep [ 'nomCommercial' ]),
'adrNumVoie' => $entrep [ 'adrNumVoie' ],
'adrIndRep' => strtoupper ( $entrep [ 'adrIndRep' ]),
2014-07-11 07:25:04 +00:00
'adrLibVoie' => strtoupper ( $entrep [ 'adrLibVoie' ]),
2014-06-10 09:26:30 +00:00
'adrTypeVoie' => strtoupper ( $entrep [ 'adrTypeVoie' ]),
'adrVoie' => strtoupper ( $entrep [ 'adrVoie' ]),
'adrComp' => strtoupper ( $entrep [ 'adrComp' ]),
'cp' => strtoupper ( $entrep [ 'cp' ]),
'commune' => strtoupper ( $entrep [ 'commune' ]),
'adresse1' => $adresse1 ,
'adresse2' => $adresse2 ,
'adresse3' => $adresse3 ,
'nafEtab' => $entrep [ 'naf' ],
'nafEtabLib' => $this -> getLibelleNaf ( $entrep [ 'naf' ]),
'dateFerEtab' => $entrep [ 'dateFermeture' ],
'dateMajEtab' => $dateMaj ,
);
2013-11-05 11:18:30 +00:00
return array_merge ( $tabIdentite , $this -> getInfosEntrep ( $siren ));
}
/**
*
* @ param unknown $siren
* @ return multitype : number unknown mixed string Ambigous Ambigous <>
*/
public function getInfosEntrep ( $siren )
{
$siren = $siren * 1 ;
$rep = $this -> iDb -> select ( 'rncs_entrep' , 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate' , " siren= $siren " , false , MYSQL_ASSOC );
2014-06-10 09:26:30 +00:00
if ( count ( $rep ) > 0 ) {
$entrep = $rep [ 0 ];
if ( $entrep [ 'jourUpdate' ] <> '0000-00-00' ) $dateMaj = $entrep [ 'jourUpdate' ];
else $dateMaj = $entrep [ 'flux' ];
$tabIdentite = array (
'siren' => $entrep [ 'siren' ],
'sirenValide' => $entrep [ 'sirenValide' ],
'actif' => $entrep [ 'actif' ],
'actifEn' => $entrep [ 'actif' ],
'numGreffe' => $entrep [ 'numGreffe' ],
'triCode' => $entrep [ 'triCode' ],
'triId' => $entrep [ 'triId' ],
'libGreffe' => preg_replace ( '/^(TC |TGI |TGIcc |TMX |Tribunal Inconnu)/Ui' , '' , $this -> getLibTribunal ( $entrep [ 'numGreffe' ] * 1 )),
'numRC' => $entrep [ 'numRC2' ],
'raisonSociale' => strtoupper ( $entrep [ 'raisonSociale' ]),
'nom' => strtoupper ( $entrep [ 'nom' ]),
'prenom' => strtoupper ( $entrep [ 'prenom' ]),
'nomUsage' => strtoupper ( $entrep [ 'nomUsage' ]),
'sigle' => strtoupper ( $entrep [ 'sigle' ]),
'dateNaiss' => $entrep [ 'dateNaiss' ],
'lieuNaiss' => strtoupper ( $entrep [ 'lieuNaiss' ]),
'sexe' => $entrep [ 'sexe' ],
'pays' => $entrep [ 'pays' ],
'cj' => $entrep [ 'cj' ],
'cjLib' => $this -> getLibelleFJ ( $entrep [ 'cj' ]),
'nafEnt' => $entrep [ 'naf' ],
'nafEntLib' => $this -> getLibelleNaf ( $entrep [ 'naf' ]),
'capital' => $entrep [ 'capitalMontant' ] + ( $entrep [ 'capitalCent' ] / 100 ),
'capitalDev' => $entrep [ 'capitalDevIso' ],
'capitalType' => $entrep [ 'capitalType' ],
'dateImma' => $entrep [ 'dateImma' ],
'dateRad' => $entrep [ 'dateRad' ],
'provisoires' => $entrep [ 'provisoires' ],
'dateMajEnt' => $dateMaj ,
);
return $tabIdentite ;
}
return false ;
2013-11-05 11:18:30 +00:00
}
/**
*
* @ param string $siren
* @ param string $dateDepot AAAA - MM - JJ
* @ return array
*/
public function getListeDepots ( $siren , $dateDepot = null )
{
2014-06-10 09:26:30 +00:00
$where = " e.siren= $siren ORDER BY e.dateDepot DESC, e.codeInterne ASC " ;
2013-11-05 11:18:30 +00:00
if ( null != $dateDepot ) {
$where = " e.siren= $siren AND e.dateDepot=' $dateDepot ' " ;
}
$rep = $this -> iDb -> select (
'rncs_even e LEFT JOIN tabEvenRncs l ON e.codeEven=l.codeEven' ,
'e.siren, e.codeInterne, e.dateDepot, e.codeEven, l.libEven, e.flux, DATE(e.dateInsert) AS dateInsert' ,
$where , false , MYSQL_ASSOC );
$tabDepots = array ();
if ( count ( $rep ) > 0 ) {
foreach ( $rep as $iDepot => $depot ) {
$tabDepots [] = array (
'codDepot' => $depot [ 'codeEven' ],
'libDepot' => $depot [ 'libEven' ],
'datDepot' => $depot [ 'dateDepot' ],
'refDepot' => $depot [ 'codeInterne' ],
'datRncs' => $depot [ 'flux' ],
'datSed' => $depot [ 'dateInsert' ],
);
}
}
return $tabDepots ;
}
/**
*
* @ param unknown $siren
* @ return multitype : multitype : NULL unknown Ambigous < multitype :>
*/
public function getListeJugements ( $siren )
{
$siren = $siren * 1 ;
2014-07-11 07:25:04 +00:00
$rep = $this -> iDb -> select (
'rncs_jugements j, tabJugeRncs l, tabEvenements e' ,
' siren , j . dateEffet , j . codeJugement , j . flux , l . libJugement , e . codEven , e . libEven ,
adm1id , adm1codeFct , adm1type , adm1nom , adm1adrNum , adm1adrInd , adm1adrType , adm1adrLibVoie , adm1adrVoie , adm1adr1 , adm1adr2 , adm1adr3 , adm1adrCP , adm1adrVille ,
adm2id , adm2codeFct , adm2type , adm2nom , adm2adrNum , adm2adrInd , adm2adrType , adm2adrLibVoie , adm2adrVoie , adm2adr1 , adm2adr2 , adm2adr3 , adm2adrCP , adm2adrVille ' ,
" j.siren= $siren AND j.codeJugement=l.codJugement AND l.codEven=e.codEven ORDER BY j.dateEffet DESC " , false , MYSQL_ASSOC );
2013-11-05 11:18:30 +00:00
$tabDepots = array ();
foreach ( $rep as $iDepot => $depot ) {
2014-07-11 07:25:04 +00:00
$tabDepots [] = array (
'codEven' => $depot [ 'codEven' ],
'libEven' => $depot [ 'libEven' ],
'dateEffet' => $depot [ 'dateEffet' ],
'adm1id' => $depot [ 'adm1id' ],
'adm1code' => $depot [ 'adm1codeFct' ],
'adm1type' => $depot [ 'adm1type' ],
'adm1fonction' => @ $this -> getLibFctDir ( $depot [ 'adm1codeFct' ]),
'adm1nom' => $depot [ 'adm1nom' ],
'adm1adrNum' => $depot [ 'adm1adrNum' ],
'adm1adrInd' => $depot [ 'adm1adrInd' ],
'adm1adrType' => $depot [ 'adm1adrType' ],
'adm1adrVoie' => $depot [ 'adm1adrLibVoie' ], // @todo : adm1adr1, , adm1adr3,
'adm1adr2' => $depot [ 'adm1adr2' ],
'adm1adrCP' => $depot [ 'adm1adrCP' ],
'adm1adrVille' => $depot [ 'adm1adrVille' ],
'adm2id' => $depot [ 'adm2id' ],
'adm2code' => $depot [ 'adm2codeFct' ],
'adm2type' => $depot [ 'adm2type' ],
'adm2fonction' => @ $this -> getLibFctDir ( $depot [ 'adm2codeFct' ]),
'adm2nom' => $depot [ 'adm2nom' ],
'adm2adrNum' => $depot [ 'adm2adrNum' ],
'adm2adrInd' => $depot [ 'adm2adrInd' ],
'adm2adrType' => $depot [ 'adm2adrType' ],
'adm2adrVoie' => $depot [ 'adm2adrLibVoie' ], // @todo : adm1adr1, adm1adr2, adm1adr3,
'adm2adr2' => $depot [ 'adm2adr2' ],
'adm2adrCP' => $depot [ 'adm2adrCP' ],
'adm2adrVille' => $depot [ 'adm2adrVille' ],
);
2013-11-05 11:18:30 +00:00
}
return $tabDepots ;
}
2014-06-10 09:26:30 +00:00
public function getEvenements ( $siren , $nic = 0 , $type = '' , $dateDeb = '' , $dateFin = '' )
{
2014-07-11 07:25:04 +00:00
$tabEven = array (
'p120' => 'Réactivation de l\'entreprise' ,
'p410' => 'Cessation juridique de l\'entreprise' ,
'pCAP' => 'Modification du capital social' ,
'pCAT' => 'Modification du type de capital' ,
'pCJ' => 'Modification de la forme juridique' ,
'pIMM' => 'Modification de la date d\'immatriculation' ,
'pRAD' => 'Modification de la date de radiation' ,
'pNTR' => 'Modification du greffe d\'enregistrement' ,
'pNRC' => 'Modification du numéro du RC' ,
'pNOM' => 'Modification de la dénomination' ,
);
2013-11-05 11:18:30 +00:00
$tabRet = array ();
$siren = $siren * 1 ;
if ( $nic > 0 ) $strNic = " AND nic= $nic " ;
if ( $type <> '' ) $strType = " AND champs=' $type ' " ;
if ( $dateDeb <> '' ) $strDateDeb = " AND flux>=' $dateDeb ' " ;
if ( $dateFin <> '' ) $strDateFin = " AND flux<=' $dateFin ' " ;
2014-07-11 07:25:04 +00:00
$rep = $this -> iDb -> select (
'rncs_modifs' ,
'siren, nic, `table`, champs, valeur, flux, dateInsert' ,
" siren= $siren $strNic $strType $strDateDeb $strDateFin AND `table`='rncs_entrep' ORDER BY flux DESC " , false , MYSQL_ASSOC );
2013-11-05 11:18:30 +00:00
foreach ( $rep as $iModif => $modif ) {
$codEve = array ();
switch ( $modif [ 'champs' ]) {
case 'actif' :
if ( $modif [ 'valeur' ] * 1 == 0 ) $codEve [] = '410' ; // Cessation
elseif ( $modif [ 'valeur' ] * 1 == 1 ) $codEve [] = '120' ; // Réactivation
break ;
case 'raisonSociale' : $codEve [] = 'NOM' ; break ;
case 'capitalMontant' : $codEve [] = 'CAP' ; break ;
case 'capitalType' : $codEve [] = 'CAT' ; break ;
case 'cj' : $codEve [] = 'CJ' ; break ;
case 'dateImma' : $codEve [] = 'IMM' ; break ;
case 'dateRad' : $codEve [] = 'RAD' ; break ;
case 'numGreffe' : $codEve [] = 'NTR' ; break ;
case 'numRC2' : $codEve [] = 'NRC' ; break ;
}
2014-07-11 07:25:04 +00:00
foreach ( $codEve as $even ) {
$tabRet [] = array (
'codeEven' => 'P' . $even ,
'nic' => 0 ,
'siretAssocie' => 0 ,
'typeSiretAss' => 0 ,
'siege' => 1 ,
'libEven' => $tabEven [ 'p' . trim ( $even )],
'libEvenDet' => '' ,
'dateMAJ' => $modif [ 'dateInsert' ],
'dateEven' => $modif [ 'flux' ],
);
}
2013-11-05 11:18:30 +00:00
}
}
2014-06-10 09:26:30 +00:00
public function getIntervenants ( $siren )
{
2013-11-05 11:18:30 +00:00
$tabJuge = $this -> getListeJugements ( $siren );
$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' ,
);
foreach ( $tabJuge as $iDepot => $depot ) {
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' ],
'admnom' => $depot [ 'adm1nom' ],
'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' ],
);
$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' ],
'admnom' => $depot [ 'adm2nom' ],
'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' ],
);
$tabDeja [] = $depot [ 'adm2code' ];
}
}
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 = '' ;
}
$tabTmp = $this -> iDb -> select ( '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' ];
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' ];
}
}
}
return $tabDepots ;
}
/** Mettre à jour un dossier IMR dans le prochain Flux
* @ param $siren Siren de l ' entreprise à mettre à jour dans les IMR
* @ param $origineDemande Origine de la demande ( 'client' , 'interne' , 'privileges' , 'ancienort' )
* @ param $focerMAJ Forcer la mise à jour même si dossier déjà transmit
*/
public function majDossierIMR ( $siren , $origineDemande = '' , $focerMAJ = false ) {
$this -> infoIMR = array ();
if ( $siren * 1 == 0 ) {
$this -> libErreur = 'Siren invalide !' ;
return false ;
}
$query_timeout = 5 ;
$query_proxy = '221.130.13.39' ;
$query_proxy = '61.35.191.250:8080' ;
$query_proxy = '198.7.242.41:3128' ;
$query_proxy = '' ;
if ( INFOGREFFE_DISPO_WEB ) {
/** Accueil **/
$url = 'http://www.infogreffe.fr/ged-extranet/accueil.do' ;
while ( 1 ) {
//echo date('YmdHis')." - 1. Deb $url ".$this->codeRetour.EOL;
$page = getUrl ( $url , '' , '' , $this -> referer , false , 'www.infogreffe.fr' , false , '' , $query_proxy , $query_timeout );
$this -> codeRetour = $page [ 'code' ];
//echo date('YmdHis')." - 1. FIN $url ".$this->codeRetour.EOL;
if ( $this -> codeRetour <> '400' ) break ;
sleep ( 1 );
}
$this -> body = $page [ 'body' ];
if ( $this -> codeRetour <> '200' ) {
print_r ( $page );
$this -> libErreur = 'Erreur Infogreffe 200a !' ;
return false ;
}
$this -> cookie = $page [ 'header' ][ 'Set-Cookie' ];
$this -> referer = $url ;
sleep ( 1 );
/** Formulaire de login **/
$url = 'http://www.infogreffe.fr/ged-extranet/connexion.do' ;
while ( 1 ) {
//echo date('YmdHis')." - 2. Deb $url ".$this->codeRetour.EOL;
$page = getUrl ( $url , '' , '' , $this -> referer , false , 'www.infogreffe.fr' , false , '' , $query_proxy , $query_timeout );
//echo date('YmdHis')." - 2. FIN $url ".$this->codeRetour.EOL;
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '400' ) break ;
sleep ( 1 );
}
$this -> body = $page [ 'body' ];
if ( $this -> codeRetour <> '200' ) {
print_r ( $page );
$this -> libErreur = 'Erreur Infogreffe 200b !' ;
return false ;
}
$this -> referer = $url ;
sleep ( 1 );
/** Etape de logon **/
$url = 'http://www.infogreffe.fr/ged-extranet/login.do' ;
$postData = array ( 'codeClient' => '0034' ,
'codeAbonne' => '0002' ,
'password' => '369852' ,
);
while ( 1 ) {
//echo date('YmdHis')." - 3. Deb $url ".$this->codeRetour.EOL;
$page = getUrl ( $url , $this -> cookie , $postData , $this -> referer , false , 'www.infogreffe.fr' , false , '' , $query_proxy , $query_timeout );
$this -> codeRetour = $page [ 'code' ];
//echo date('YmdHis')." - 3. FIN $url ".$this->codeRetour.EOL;
if ( $this -> codeRetour <> '400' ) break ;
sleep ( 1 );
}
$this -> body = $page [ 'body' ];
if ( $this -> codeRetour <> '200' ) {
print_r ( $page );
$this -> libErreur = 'Erreur Infogreffe 200c !' ;
return false ;
}
if ( ! preg_match ( '/Bienvenue SCORES ET DECISIONS/' , $this -> body )) {
$this -> libErreur = 'Erreur Infogreffe Extranet : Connexion incorrecte !' ;
return false ;
}
$this -> referer = $url ;
sleep ( 1 );
/** Page de formulaire de demande de réémission de dossier IMR **/
$url = 'http://www.infogreffe.fr/ged-extranet/demandeReemissions.do' ;
while ( 1 ) {
//echo date('YmdHis')." - 4. Deb $url ".$this->codeRetour.EOL;
$page = getUrl ( $url , $this -> cookie , '' , $this -> referer , false , 'www.infogreffe.fr' , false , '' , $query_proxy , $query_timeout );
$this -> codeRetour = $page [ 'code' ];
//echo date('YmdHis')." - 4. FIN $url ".$this->codeRetour.EOL;
if ( $this -> codeRetour <> '400' ) break ;
sleep ( 1 );
}
$this -> body = $page [ 'body' ];
if ( $this -> codeRetour <> '200' ) {
print_r ( $page );
$this -> libErreur = 'Erreur Infogreffe 200d !' ;
return false ;
}
$this -> referer = $url ;
sleep ( 1 );
/** Saisie du siren à contrôler dans le formulaire AJAX adéquat **/
$url = 'http://www.infogreffe.fr/ged-extranet/rechercheReemissions.do' ;
$postData = array ( 'siren' => $siren );
//$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', '', 5);
while ( 1 ) {
//echo date('YmdHis')." - 5. Deb $url ".$this->codeRetour.EOL;
$page = getUrl ( $url , $this -> cookie , $postData , $this -> referer , false , 'www.infogreffe.fr' , false , '' , $query_proxy , $query_timeout );
$this -> codeRetour = $page [ 'code' ];
//echo date('YmdHis')." - 5. FIN $url ".$this->codeRetour.EOL;
if ( $this -> codeRetour <> '400' ) break ;
sleep ( 1 );
}
$this -> body = $page [ 'body' ];
if ( $this -> codeRetour <> '200' ) {
print_r ( $page );
$this -> libErreur = 'Erreur Infogreffe 200e !' ;
return false ;
}
$this -> referer = $url ;
// Le retour AJAX est il positif ?
if ( preg_match ( '/<div class="message-erreur">(.*)<\/div>/Uis' , $this -> body , $matches ))
$this -> infoIMR [ 'message-erreur' ] = trim ( preg_replace ( '/ +/' , ' ' , strip_tags ( $matches [ 1 ])));
if ( preg_match ( '/<div class="titreEntreprise">(?:.*)<b>(.*)<\/b>(?:.*)<\/div>/Uis' , $this -> body , $matches ))
$this -> infoIMR [ 'titreEntreprise' ] = trim ( preg_replace ( '/ +/' , ' ' , strip_tags ( $matches [ 1 ])));
if ( preg_match ( '/<div id="adresse">(.*)<\/div>/Uis' , $this -> body , $matches ))
$this -> infoIMR [ 'adresse' ] = trim ( preg_replace ( '/ +/' , ' ' , strip_tags ( $matches [ 1 ])));
if ( preg_match ( '/<div class="struct-erreur">(?:.*)<b>(.*)<\/b>(?:.*)<\/div>/Uis' , $this -> body , $matches ))
$this -> infoIMR [ 'struct-erreur' ] = trim ( preg_replace ( '/ +/' , ' ' , strtr ( strip_tags ( $matches [ 1 ]), " \r \n \t " . chr ( 160 ), ' ' )));
if ( preg_match ( '/Cliquez sur le bouton VALIDER pour confirmer votre demande de/' , $this -> body , $matches ))
$this -> infoIMR [ 'validation' ] = true ;
else {
$this -> infoIMR [ 'validation' ] = false ;
2014-04-03 12:18:00 +00:00
if ( preg_match ( '/Aucune entreprise trouv.e pour ce num.ro SIREN/u' , $this -> body )) {
2013-11-05 11:18:30 +00:00
$tabInsert = $this -> infoIMR ;
$tabInsert [ 'siren' ] = $siren ;
$tabInsert [ 'dateDemande' ] = date ( 'Ymd' );
if ( $origineDemande <> '' )
$tabInsert [ 'origineDemande' ] = $origineDemande ;
2015-04-27 14:25:04 +00:00
$this -> iDb -> insert ( 'jo.rncs_demandes' , $tabInsert , false );
2013-11-05 11:18:30 +00:00
}
}
if ( preg_match ( '/atteint le nombre maximal de(.*)Veuillez renouveler votre demande demain/' ,
$this -> infoIMR [ 'message-erreur' ]))
return false ;
if ( $this -> infoIMR [ 'validation' ] && $this -> infoIMR [ 'message-erreur' ] == '' ) {
/** Doit on forcer la maj si l'entreprise a été transmise récemment ? **/
if ( $this -> infoIMR [ 'struct-erreur' ] <> '' && ! $focerMAJ )
return true ;
sleep ( 1 );
/** Validation du siren à réémettre en IMR **/
$url = 'http://www.infogreffe.fr/ged-extranet/validerDemandeReemission.do' ;
$postData = array ( 'numIdentification' => $siren );
//$page=getUrl($url, $this->cookie, $postData, $this->referer, false, 'www.infogreffe.fr', false, '', '', 5);
while ( 1 ) {
//echo date('YmdHis')." - 6. Deb $url ".$this->codeRetour.EOL;
$page = getUrl ( $url , $this -> cookie , $postData , $this -> referer , false , 'www.infogreffe.fr' , false , '' , $query_proxy , $query_timeout );
$this -> codeRetour = $page [ 'code' ];
//echo date('YmdHis')." - 6. FIN $url ".$this->codeRetour.EOL;
if ( $this -> codeRetour <> '400' ) break ;
sleep ( 1 );
}
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '200' ) {
$this -> libErreur = 'Erreur Infogreffe 200f !' ;
return false ;
}
$this -> referer = $url ;
// Lecture du retour
if ( preg_match ( '/<div class="message-erreur">(.*)<\/div>/Uis' , $this -> body , $matches ))
$this -> infoIMR [ 'validation-erreur' ] = trim ( preg_replace ( '/ +/' , ' ' , strip_tags ( $matches [ 1 ])));
if ( preg_match ( '/<b class="texte-bleu">(.*)<\/b>/Uis' , $this -> body , $matches ))
$this -> infoIMR [ 'validation-ok' ] = trim ( preg_replace ( '/ +/' , ' ' , strip_tags ( $matches [ 1 ])));
$tabInsert = $this -> infoIMR ;
$tabInsert [ 'siren' ] = $siren ;
$tabInsert [ 'dateDemande' ] = date ( 'Ymd' );
if ( $origineDemande <> '' )
$tabInsert [ 'origineDemande' ] = $origineDemande ;
2015-04-27 14:25:04 +00:00
$this -> iDb -> insert ( 'jo.rncs_demandes' , $tabInsert , false );
2013-11-05 11:18:30 +00:00
// Une erreur ?
if ( $this -> infoIMR [ 'validation-erreur' ] <> '' )
return false ;
return true ;
}
} else
$this -> libErreur = 'Infogreffe indisponible !' ;
return false ;
}
2015-01-13 20:53:25 +00:00
function getDirigeantsPrin ( $siren , $nbDirs = 2 ) {
$siren = $siren * 1 ;
$tabRet = array ();
$dirs = $this -> iDb -> select (
'rncs_dirigeants' ,
'siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert' ,
" siren= $siren AND actif%10=1 ORDER BY fonction_code DESC " , true , MYSQL_ASSOC );
$numDir = 0 ;
foreach ( $dirs as $k => $dir ) {
$numDir ++ ;
if ( $dir [ 'naissance_date' ] <> '0000-00-00' )
$dateNaiss = Wdate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'naissance_date' ]);
else
$dateNaiss = '' ;
if ( $dir [ 'flux' ] <> '0000-00-00' )
$dateModif = Wdate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'flux' ]);
else
$dateModif = Wdate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'dateInsert' ]);
$nom = trim ( $dir [ 'nom' ]);
$nomUsage = '' ;
if ( trim ( $dir [ 'naissance_nom' ]) <> '' ) {
$nom = trim ( $dir [ 'naissance_nom' ]);
$nomUsage = trim ( $dir [ 'nom' ]);
}
$tabRet [] = array ( 'Fonction' => $dir [ 'fonction_code' ],
'Titre' => $dir [ 'fonction_lib' ],
'Societe' => $dir [ 'dirRS' ],
'Civilite' => $dir [ 'civilite' ],
'Nom' => $nom ,
'Prenom' => $dir [ 'prenom' ],
'NomUsage' => $nomUsage ,
'NaissDate' => $dateNaiss ,
'NaissVille' => $dir [ 'naissance_lieu' ],
'NaissDepPays' => '' , // 25
'Ancien' => 0 ,
'DateFct' => $dateModif ,
'Cinf' => $dir [ 'cinf' ],
);
if ( $numDir >= $nbDirs ) break ;
}
if ( $numDir == 0 ) {
$dirs = $this -> iDb -> select (
'rncs_entrep' ,
" 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 " ,
" siren= $siren " , true , MYSQL_ASSOC );
$numDir = 0 ;
foreach ( $dirs as $k => $dir ) {
$numDir ++ ;
if ( $dir [ 'naissance_date' ] <> '0000-00-00' )
$dateNaiss = Wdate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'naissance_date' ]);
else
$dateNaiss = '' ;
if ( $dir [ 'flux' ] <> '0000-00-00' )
$dateModif = Wdate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'flux' ]);
else
$dateModif = Wdate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'dateInsert' ]);
$nom = trim ( $dir [ 'nom' ]);
$nomUsage = '' ;
if ( trim ( $dir [ 'naissance_nom' ]) <> '' ) {
$nom = trim ( $dir [ 'naissance_nom' ]);
$nomUsage = trim ( $dir [ 'nom' ]);
}
$tabRet [] = array ( 'Fonction' => $dir [ 'fonction_code' ],
'Titre' => $dir [ 'fonction_lib' ],
'Societe' => $dir [ 'dirRS' ],
'Civilite' => $dir [ 'civilite' ],
'Nom' => $nom ,
'Prenom' => $dir [ 'prenom' ],
'NomUsage' => $nomUsage ,
'NaissDate' => $dateNaiss ,
'NaissVille' => $dir [ 'naissance_lieu' ],
'NaissDepPays' => '' , // 25
'Ancien' => 0 ,
'DateFct' => $dateModif ,
'Cinf' => $dir [ 'cinf' ],
);
}
}
return $tabRet ;
}
2013-11-05 11:18:30 +00:00
}
?>