This commit is contained in:
Michael RICOIS 2017-02-02 13:58:18 +01:00
parent d62a0c6426
commit a12911e0ba

View File

@ -7,9 +7,22 @@ class Metier_Partenaires_MTel
*/
protected $conn;
/**
* Logger
* @var \Monolog\Logger
*/
protected $logger;
/**
* Tel
*/
public function __construct()
{
$this->conn = Zend_Registry::get('doctrine');
if (Zend_Registry::isRegistered('logger')) {
$this->logger = Zend_Registry::get('logger');
}
}
/**
@ -59,22 +72,35 @@ class Metier_Partenaires_MTel
partenaireConf, nbConf, idUpdate, dateUpdate, dateUpdate*1 AS dateUpdateYmd
FROM jo.telephonie WHERE siren=:siren $strNic $strActif AND dateSuppr=0
ORDER BY typeTel ASC, nbConf DESC";
$nb = 0;
try {
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('siren', $siren);
$stmt->execute();
$nb = $stmt->rowCount();
} catch (\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
return $tabRet;
}
if ($stmt->rowCount() > 0) {
if ($nb > 0) {
$this->enCache = true;
while ($tabTel = $stmt->fetch(\PDO::FETCH_ASSOC)) {
if ($tabTel['typeTel'] == 'an8' && $tabTel['infoTel']*1 > 0) {
$an8 = $tabTel['infoTel']*1;
$sql = "SELECT libAn8 FROM jo.tabAn8 WHERE codAn8='$an8'";
$an8Stmt = $this->conn->executeQuery($sql);
$an8Nb = 0;
try {
$an8Stmt = $this->conn->executeQuery($sql);
$an8Nb = $an8Stmt->rowCount();
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
$infoTel = '';
if ($an8Stmt->rowCount() > 0) {
if ($an8Nb > 0) {
$result = $an8Stmt->fetch(\PDO::FETCH_ASSOC);
$label = $result['libAn8'];
$infoTel = ucfirst(strtolower($label));