Entreprise - getAnnoncesLegales : remove Zend_Db

This commit is contained in:
Michael RICOIS 2017-03-15 16:08:27 +01:00
parent 9f04226286
commit 4e3714c3f9

View File

@ -1863,9 +1863,14 @@ class Entreprise extends Scores_Ws_Server
if ( is_array($anns) && $nbReponses > 0 ) {
foreach ($anns as $nb => $ann) {
if ($isList===true && $nb<$position) { continue; }
if ($isList === true && $nb < $position) {
continue;
}
$cpt++;
if ($isList===true && $cpt>$nbRep) { break; }
if ($isList === true && $cpt > $nbRep) {
break;
}
/**
* Si l'annonce est une annonce BODACC alors
@ -1873,15 +1878,25 @@ class Entreprise extends Scores_Ws_Server
*/
$entites = array();
if (in_array($ann['BodaccCode'], array('BODA', 'BODB', 'BODC'))) {
$detailM = new Application_Model_JoBodaccDetail();
$sql = $detailM->select()->from($detailM, array(
'LPAD(siren, 9, 0) AS siren',
'LPAD(nic, 5, 0) AS nic',
'raisonSociale','adresse', 'codePostal', 'ville', 'typeEven')
)->where('id=?', $ann['id']);
$result = $detailM->fetchAll($sql);
if (count($result)>1) {
foreach ($result as $entity) {
try {
$sql = "SELECT LPAD(siren, 9, 0) AS siren, LPAD(nic, 5, 0) AS nic, raisonSociale,
adresse, codePostal, ville, typeEven FROM jo.bodacc_detail WHERE id=:id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $ann['id']);
$stmt->execute();
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
if ($this->User->idClient == 1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
if ($stmt->rowCount() > 1) {
while ($entity = $stmt->fetch(\PDO::FETCH_OBJ)) {
$entite = new AnnonceEntite();
$entite->siret = $entity->siren . $entity->nic;
$entite->raisonSociale = $entity->raisonSociale;
@ -1897,7 +1912,7 @@ class Entreprise extends Scores_Ws_Server
}
}
//List events
// List events
$evens = array();
foreach ($ann['evenements'] as $tabEven) {
$even = new AnnonceEvenement();
@ -3921,12 +3936,20 @@ class Entreprise extends Scores_Ws_Server
* Calcul d'initialisation du score lors d'un ajout
*/
if ( $source == 'score' ) {
$survM = new Application_Model_JoScoresSurveillance();
$item = $survM->find($siren);
if ( $item === null ) {
try {
$sql = "SELECT * FROM jo.scores_surveillance WHERE siren=:siren";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', $siren);
$stmt->execute();
if ($stmt->rowCount() == 0) {
require_once 'Metier/Scores/MScores.php';
calculIndiScore($siren, 0, false, 0);
}
} catch (\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
}
$where = "source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'";