2016-07-18 15:21:48 +02:00

123 lines
3.7 KiB
PHP

<?php
class Metier_Partenaires_MGreffes
{
public $iDb;
public function __construct($db = null)
{
if ( $db === null ) {
$this->iDb = new Metier_Util_Db();
} else {
$this->iDb = $db;
}
}
/**
* Retourne Identite Greffe
* @param string $siren
*/
public function getIdentite($siren)
{
$id = false;
$res = $this->iDb->select('jo.greffes_identite',
'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert',
"siren=$siren");
if (count($res) > 0) {
$ent=$res[0];
$id=$ent['id'];
$siren=$ent['siren'];
$siege=$ent['siege'];
$nom=$ent['nom'];
$nomCom=$ent['nomCommercial'];
$ens=$ent['ens'];
$adr=$ent['adresse'];
$adr2=$ent['adresse2'];
$cp=$ent['cp'];
$ville=$ent['ville'];
$cj=$ent['fj'];
$cjLib=$ent['fjLib'];
$naf=$ent['naf'];
$nafLib=$ent['nafLib'];
$numRC=$ent['numRC'];
$numRC2=$ent['numRC2'];
$greffe_num=$ent['numGreffe'];
$typeRCS=$ent['typeRCS'];
$dateCre=$ent['dateCreation'];
$dateRad=$ent['dateRadiation'];
$dateCloture=$ent['dateCloture'];
$dateInsert=$ent['dateInsert'];
}
if ($id) {
$tabRet = array(
'id' => $id,// A calculer après insert
'Pertinence' => 100,
'Siret' => $siren.'00000',
'Siege' => $siege,
'Nom' => $nom,
'Nom2' => $nomCom,
'Sigle' => '',
'Enseigne' => $ens,
'Adresse' => $adr,
'Adresse2' => $adr2,
'CP' => $cp,
'Ville' => $ville,
'Tel' => '',
'Fax' => '',
'FJ' => $cj,
'FJLib' => $cjLib,
'Siren' => $siren,
'Nic' => '00000',
'Actif' => 0,
'NafEtab' => $naf,
'NafEtabLib' => $nafLib,
'NafEnt' => $naf,
'NafEntLib' => $nafLib,
'NumRC' => $numRC,
'NumRC2' => $numRC2,
'NumGreffe' => $greffe_num,
'DateCreation' => $dateCre,
'DateRadiation' => $dateRad,
'DateCloture' => $dateCloture,
'DateUpdate' => substr($dateInsert,0,10),
);
return $tabRet;
}
return false;
}
/**
* Cession
* @param string $siren
*/
public function getInfosCessions($siren)
{
$ret=$this->iDb->select('jo.greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
if (count($ret)>0) {
$tabCes=$ret[0];
if (count($ret)>1) {
$mail = new Metier_Common_Mail();
$mail->send('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug getInfosCessions $siren", "Plus de 1 cession pour ce siren");
}
return array(
'cessJuge'=> $tabCes['etat'],
'cessDateJuge'=>$tabCes['dateJuge'],
'cessDateConv'=>$tabCes['dateConv'],
'cessDateLJS'=> $tabCes['dateLJS'],
'cessDateInv'=> $tabCes['dateInventaire'],
'cessDateBod'=> $tabCes['dateBodacc'],
'cessCAdec'=> $tabCes['caDeclare'],
'cessEffectif'=>$tabCes['effectif'],
'cessDesc'=> $tabCes['descriptif'],
'cessDateDesc'=>$tabCes['descDateDepot'],
'cessDateLim'=> $tabCes['dateLimite'],
'cessMand'=> $tabCes['mandataire'],
);
}
else {
return false;
}
}
}