MGreffes avec doctrine
This commit is contained in:
parent
25db7c39a3
commit
304ee7214f
@ -1820,7 +1820,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
|||||||
|
|
||||||
// Si aucun résultat et siren est valide, on part chez Infogreffe
|
// Si aucun résultat et siren est valide, on part chez Infogreffe
|
||||||
if ($accesDist && $nbEtab == 0 && $this->valideSiren($siren)) {
|
if ($accesDist && $nbEtab == 0 && $this->valideSiren($siren)) {
|
||||||
$iGeffes = new Metier_Partenaires_MGreffes($this->iDb);
|
$iGeffes = new Metier_Partenaires_MGreffes();
|
||||||
$etabG = $iGeffes->getIdentite($siren);
|
$etabG = $iGeffes->getIdentite($siren);
|
||||||
if ($etabG) {
|
if ($etabG) {
|
||||||
$adr = $this->structureVoie($etabG['Adresse']);
|
$adr = $this->structureVoie($etabG['Adresse']);
|
||||||
@ -3332,7 +3332,7 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
|||||||
$tdeb = microtime(1);
|
$tdeb = microtime(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$iGeffes = new Metier_Partenaires_MGreffes($this->iDb);
|
$iGeffes = new Metier_Partenaires_MGreffes();
|
||||||
$etabG = $iGeffes->getIdentite($siren);
|
$etabG = $iGeffes->getIdentite($siren);
|
||||||
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
$iRncs = new Metier_Partenaires_MRncs($this->iDb);
|
||||||
|
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
class Metier_Partenaires_MGreffes
|
class Metier_Partenaires_MGreffes
|
||||||
{
|
{
|
||||||
public $iDb;
|
/**
|
||||||
|
* PDO Connection with Doctrine
|
||||||
|
* @var \Doctrine\DBAL\Connection
|
||||||
|
*/
|
||||||
|
protected $conn;
|
||||||
|
|
||||||
public function __construct($db = null)
|
/**
|
||||||
|
* Greffes
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
{
|
{
|
||||||
if ($db === null) {
|
$this->conn = Zend_Registry::get('doctrine');
|
||||||
$this->iDb = new Metier_Util_Db();
|
|
||||||
} else {
|
|
||||||
$this->iDb = $db;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,71 +21,55 @@ class Metier_Partenaires_MGreffes
|
|||||||
*/
|
*/
|
||||||
public function getIdentite($siren)
|
public function getIdentite($siren)
|
||||||
{
|
{
|
||||||
$id = false;
|
$sql = "SELECT 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
|
||||||
|
FROM jo.greffes_identite WHERE siren=:siren";
|
||||||
|
|
||||||
$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) {
|
try {
|
||||||
$tabRet = array(
|
$stmt = $this->conn->prepare($sql);
|
||||||
'id' => $id,// A calculer après insert
|
$stmt->bindValue('siren', $siren);
|
||||||
'Pertinence' => 100,
|
$stmt->execute();
|
||||||
'Siret' => $siren.'00000',
|
|
||||||
'Siege' => $siege,
|
if ($stmt->rowCount() > 0) {
|
||||||
'Nom' => $nom,
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
'Nom2' => $nomCom,
|
return array(
|
||||||
'Sigle' => '',
|
'id' => $result['id'],
|
||||||
'Enseigne' => $ens,
|
'Pertinence' => 100,
|
||||||
'Adresse' => $adr,
|
'Siret' => $result['siren'].'00000',
|
||||||
'Adresse2' => $adr2,
|
'Siege' => $result['siege'],
|
||||||
'CP' => $cp,
|
'Nom' => $result['nom'],
|
||||||
'Ville' => $ville,
|
'Nom2' => $result['nomCommercial'],
|
||||||
'Tel' => '',
|
'Sigle' => '',
|
||||||
'Fax' => '',
|
'Enseigne' => $result['ens'],
|
||||||
'FJ' => $cj,
|
'Adresse' => $result['adresse'],
|
||||||
'FJLib' => $cjLib,
|
'Adresse2' => $result['adresse2'],
|
||||||
'Siren' => $siren,
|
'CP' => $result['cp'],
|
||||||
'Nic' => '00000',
|
'Ville' => $result['ville'],
|
||||||
'Actif' => 0,
|
'Tel' => '',
|
||||||
'NafEtab' => $naf,
|
'Fax' => '',
|
||||||
'NafEtabLib' => $nafLib,
|
'FJ' => $result['fj'],
|
||||||
'NafEnt' => $naf,
|
'FJLib' => $result['fjLib'],
|
||||||
'NafEntLib' => $nafLib,
|
'Siren' => $result['siren'],
|
||||||
'NumRC' => $numRC,
|
'Nic' => '00000',
|
||||||
'NumRC2' => $numRC2,
|
'Actif' => 0,
|
||||||
'NumGreffe' => $greffe_num,
|
'NafEtab' => $result['naf'],
|
||||||
'DateCreation' => $dateCre,
|
'NafEtabLib' => $result['nafLib'],
|
||||||
'DateRadiation' => $dateRad,
|
'NafEnt' => $result['naf'],
|
||||||
'DateCloture' => $dateCloture,
|
'NafEntLib' => $result['nafLib'],
|
||||||
'DateUpdate' => substr($dateInsert, 0, 10),
|
'NumRC' => $result['numRC'],
|
||||||
);
|
'NumRC2' => $result['numRC2'],
|
||||||
return $tabRet;
|
'NumGreffe' => $result['numGreffe'],
|
||||||
|
'DateCreation' => $result['dateCreation'],
|
||||||
|
'DateRadiation' => $result['dateRadiation'],
|
||||||
|
'DateCloture' => $result['dateCloture'],
|
||||||
|
'DateUpdate' => substr($result['dateInsert'], 0, 10),
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -94,29 +81,40 @@ class Metier_Partenaires_MGreffes
|
|||||||
*/
|
*/
|
||||||
public function getInfosCessions($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);
|
$sql = "SELECT id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv,
|
||||||
if (count($ret)>0) {
|
dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize,
|
||||||
$tabCes=$ret[0];
|
pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert
|
||||||
if (count($ret)>1) {
|
FROM jo.greffes_cessions WHERE siren=:siren";
|
||||||
$mail = new Metier_Common_Mail();
|
try {
|
||||||
$mail->send('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug getInfosCessions $siren", "Plus de 1 cession pour ce siren");
|
$stmt = $this->conn->prepare($sql);
|
||||||
|
$stmt->bindValue('siren', $siren);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
if ($stmt->rowCount() > 0) {
|
||||||
|
if ($stmt->rowCount() > 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");
|
||||||
|
}
|
||||||
|
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
return array(
|
||||||
|
'cessJuge' => $result['etat'],
|
||||||
|
'cessDateJuge' => $result['dateJuge'],
|
||||||
|
'cessDateConv' => $result['dateConv'],
|
||||||
|
'cessDateLJS' => $result['dateLJS'],
|
||||||
|
'cessDateInv' => $result['dateInventaire'],
|
||||||
|
'cessDateBod' => $result['dateBodacc'],
|
||||||
|
'cessCAdec' => $result['caDeclare'],
|
||||||
|
'cessEffectif' => $result['effectif'],
|
||||||
|
'cessDesc' => $result['descriptif'],
|
||||||
|
'cessDateDesc' => $result['descDateDepot'],
|
||||||
|
'cessDateLim' => $result['dateLimite'],
|
||||||
|
'cessMand' => $result['mandataire'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return array(
|
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||||
'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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user