Suppression Zend_Db
This commit is contained in:
parent
c5186ab16d
commit
264fb038ec
@ -1798,33 +1798,37 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
|||||||
$date = $this->companyEvenDateStop;
|
$date = $this->companyEvenDateStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
$sql = "SELECT CONCAT(LPAD(e.insSIREN,9,0), LPAD(e.insNIC,5,0)) AS Siret,
|
||||||
$sql = $db->select()
|
LPAD(e.insSIREN,9,0) AS Siren,
|
||||||
->from(array('e'=>'insee_even'), array(
|
LPAD(e.insNIC,5,0) AS Nic,
|
||||||
'CONCAT(LPAD(e.insSIREN,9,0), LPAD(e.insNIC,5,0)) AS Siret',
|
e.insSIEGE AS Siege,
|
||||||
'LPAD(e.insSIREN,9,0) AS Siren',
|
e.insNOMEN AS Nom,
|
||||||
'LPAD(e.insNIC,5,0) AS Nic',
|
e.insCODPOS AS CP,
|
||||||
'insSIEGE AS Siege',
|
e.insCJ AS FJ,
|
||||||
'insNOMEN AS Nom',
|
e.insAPEN700 AS NafEnt,
|
||||||
'insCODPOS AS CP',
|
e.insAPEN700 AS NafEtab,
|
||||||
'insCJ AS FJ',
|
e.insTEFEN AS EffEnTr,
|
||||||
'insAPEN700 AS NafEnt',
|
e.insEFENCENT AS Effectif,
|
||||||
'insAPEN700 AS NafEtab',
|
e.insDCRET AS DateCreaEt,
|
||||||
'insTEFEN AS EffEnTr',
|
e.insDCREN AS DateCreaEn,
|
||||||
'insEFENCENT AS Effectif',
|
e.insEVE,
|
||||||
'insDCRET AS DateCreaEt',
|
i.insRECME AS RECME
|
||||||
'insDCREN AS DateCreaEn',
|
FROM insee.insee_even e
|
||||||
'insEVE',
|
LEFT OUTER JOIN insee.insee_notices i ON (i.insSIREN=e.insSIREN AND i.insNIC=e.insNIC)
|
||||||
), 'insee')
|
WHERE e.insSIREN=:siren AND idFlux<:date ORDER BY idFlux DESC, insSIEGE DESC LIMIT 0,1";
|
||||||
->joinLeft(array('i'=>'insee_notices'), 'i.insSIREN=e.insSIREN AND i.insNIC=e.insNIC', array(
|
try {
|
||||||
'insRECME AS RECME',
|
$stmt = $this->conn->prepare($sql);
|
||||||
), 'insee')
|
$stmt->bindValue('siren', $siren);
|
||||||
->where('e.insSIREN = ?', $siren)
|
$stmt->bindValue('date', $date);
|
||||||
->where('idFlux < ?', $date)
|
$stmt->execute();
|
||||||
->order('idFlux DESC')->order('insSIEGE DESC')->limit(1);
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC);
|
if ($this->logger !== null) {
|
||||||
if ($result !== null) {
|
$this->logger->error($e->getMessage());
|
||||||
$identite = $result;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stmt->rowCount() > 0) {
|
||||||
|
$identite = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
// --- Recherche dans le stock
|
// --- Recherche dans le stock
|
||||||
else {
|
else {
|
||||||
@ -1834,31 +1838,37 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql = $db->select()
|
|
||||||
->from(array('e'=>$notice), array(
|
$sql = "SELECT CONCAT(LPAD(e.SIREN,9,0), LPAD(e.NIC,5,0)) AS Siret,
|
||||||
'CONCAT(LPAD(SIREN,9,0), LPAD(NIC,5,0)) AS Siret',
|
LPAD(e.SIREN,9,0) AS Siren,
|
||||||
'LPAD(SIREN,9,0) AS Siren',
|
LPAD(e.NIC,5,0) AS Nic,
|
||||||
'LPAD(NIC,5,0) AS Nic',
|
e.SIEGE AS Siege,
|
||||||
'SIEGE AS Siege',
|
e.NOMEN_LONG AS Nom,
|
||||||
'NOMEN_LONG AS Nom',
|
e.CODPOS AS CP,
|
||||||
'CODPOS AS CP',
|
e.CJ AS FJ,
|
||||||
'CJ AS FJ',
|
e.APEN700 AS NafEnt,
|
||||||
'APEN700 AS NafEnt',
|
e.APEN700 AS NafEtab,
|
||||||
'APEN700 AS NafEtab',
|
e.TEFEN AS EffEnTr,
|
||||||
'TEFEN AS EffEnTr',
|
e.EFENCENT AS Effectif,
|
||||||
'EFENCENT AS Effectif',
|
e.DCRET AS DateCreaEt,
|
||||||
'DCRET AS DateCreaEt',
|
insDCREN AS DateCreaEn
|
||||||
'insDCREN AS DateCreaEn',
|
i.insRECME AS RECME
|
||||||
), 'historiques')
|
FROM insee.$notice e
|
||||||
->joinLeft(array('i'=>'insee_notices'), 'i.insSIREN=e.SIREN AND i.insNIC=e.NIC', array(
|
LEFT OUTER JOIN insee.insee_notices i ON (i.insSIREN=e.SIREN AND i.insNIC=e.NIC)
|
||||||
'insRECME AS RECME',
|
WHERE e.insSIREN=:siren AND idFlux<:date ORDER BY idFlux DESC, insSIEGE DESC LIMIT 0,1";
|
||||||
), 'insee')
|
try {
|
||||||
->where('e.insSIREN = ?', $siren)
|
$stmt = $this->conn->prepare($sql);
|
||||||
->where('idFlux < ?', $date)
|
$stmt->bindValue('siren', $siren);
|
||||||
->order('idFlux DESC')->order('insSIEGE DESC')->limit(1);
|
$stmt->bindValue('date', $date);
|
||||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC);
|
$stmt->execute();
|
||||||
if ($result !== null) {
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||||
$identite = $result;
|
if ($this->logger !== null) {
|
||||||
|
$this->logger->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stmt->rowCount() > 0) {
|
||||||
|
$identite = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($identite) > 0) {
|
if (count($identite) > 0) {
|
||||||
@ -1881,15 +1891,22 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Capital
|
// --- Capital
|
||||||
$sql = $db->select()
|
$sql = "SELECT valeur FROM jo.rncs_modifs
|
||||||
->from('rncs_modifs', array('valeur'), 'jo')
|
WHERE champs='capitalMontant' AND siren=:siren AND flux<:date
|
||||||
->where('champs = ?', 'capitalMontant')
|
ORDER BY flux DESC LIMIT 0,1";
|
||||||
->where('siren = ? ', $siren)
|
try {
|
||||||
->where('flux < ?', $date)
|
$stmt = $this->conn->prepare($sql);
|
||||||
->order('flux DESC')->limit(1);
|
$stmt->bindValue('siren', $siren);
|
||||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_OBJ);
|
$stmt->bindValue('date', $date);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||||
|
if ($this->logger !== null) {
|
||||||
|
$this->logger->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
$identite['Capital'] = '';
|
$identite['Capital'] = '';
|
||||||
if ($result !== null) {
|
if ($stmt->rowCount() > 0) {
|
||||||
|
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||||
$identite['Capital'] = $result->valeur;
|
$identite['Capital'] = $result->valeur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user