This commit is contained in:
Michael RICOIS 2017-02-02 10:46:07 +01:00
parent 306086e55c
commit 179d144a14

View File

@ -63,9 +63,22 @@ class Metier_Partenaires_MBanques
*/ */
protected $conn; protected $conn;
/**
* Logger
* @var \Monolog\Logger
*/
protected $logger;
/**
* Banque
*/
public function __construct() public function __construct()
{ {
$this->conn = Zend_Registry::get('doctrine'); $this->conn = Zend_Registry::get('doctrine');
if (Zend_Registry::isRegistered('logger')) {
$this->logger = Zend_Registry::get('logger');
}
} }
/** /**
@ -76,15 +89,25 @@ class Metier_Partenaires_MBanques
public function getInfoBanque($codeBanque) public function getInfoBanque($codeBanque)
{ {
$result = array(); $result = array();
$sql = "SELECT bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40,
bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, * $stmtNb = 0;
bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2, try {
bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar, $sql = "SELECT bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40,
bdfFibDateOptIdInvar FROM insee.BDF_Etabs WHERE bdfFibCodeEtab=:code LIMIT 0,1"; bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, *
$stmt = $this->conn->prepare($sql); bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2,
$stmt->bindValue('code', $codeBanque); bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar,
$stmt->execute(); bdfFibDateOptIdInvar FROM insee.BDF_Etabs WHERE bdfFibCodeEtab=:code LIMIT 0,1";
if ($stmt->rowCount() > 0) { $stmt = $this->conn->prepare($sql);
$stmt->bindValue('code', $codeBanque);
$stmt->execute();
$stmtNb = $stmt->rowCount();
} catch (\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
if ($stmtNb > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC); $result = $stmt->fetch(\PDO::FETCH_ASSOC);
} }
@ -103,19 +126,28 @@ class Metier_Partenaires_MBanques
$tabBanque = $this->getInfoBanque($codeBanque); $tabBanque = $this->getInfoBanque($codeBanque);
$tabTel = $this->getTelGuichet($codeBanque, $codeGuichet); $tabTel = $this->getTelGuichet($codeBanque, $codeGuichet);
$sql = "SELECT bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation, $stmtNb = 0;
bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible, try {
bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2, $sql = "SELECT bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation,
bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2, bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible,
bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille, bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2,
bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus, bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2,
bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF, bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille,
bdfFibNomComptoirBDF FROM WHERE bdfFibCodeEtab=:banque AND bdfFibCodeGuichet=:guichet LIMIT 0,1"; bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus,
$stmt = $this->conn->prepare($sql); bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF,
$stmt->bindValue('banque', $codeBanque); bdfFibNomComptoirBDF FROM WHERE bdfFibCodeEtab=:banque AND bdfFibCodeGuichet=:guichet LIMIT 0,1";
$stmt->bindValue('guichet', $codeGuichet); $stmt = $this->conn->prepare($sql);
$stmt->execute(); $stmt->bindValue('banque', $codeBanque);
if ($stmt->rowCount() > 0) { $stmt->bindValue('guichet', $codeGuichet);
$stmt->execute();
$stmtNb = $stmt->rowCount();
} catch (\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
if ($stmtNb > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC); $result = $stmt->fetch(\PDO::FETCH_ASSOC);
} }
@ -130,12 +162,21 @@ class Metier_Partenaires_MBanques
public function getTelGuichet($codeBanque, $codeGuichet) public function getTelGuichet($codeBanque, $codeGuichet)
{ {
$result = array(); $result = array();
$sql = "SELECT Tel, Fax FROM insee.Mandel_banques WHERE CodeB=:banque AND CodeG=:guichet LIMIT 0,1"; $stmtNb = 0;
$stmt = $this->conn->prepare($sql); try {
$stmt->bindValue('banque', $codeBanque); $sql = "SELECT Tel, Fax FROM insee.Mandel_banques WHERE CodeB=:banque AND CodeG=:guichet LIMIT 0,1";
$stmt->bindValue('guichet', $codeGuichet); $stmt = $this->conn->prepare($sql);
$stmt->execute(); $stmt->bindValue('banque', $codeBanque);
if ($stmt->rowCount() > 0) { $stmt->bindValue('guichet', $codeGuichet);
$stmt->execute();
$stmtNb = $stmt->rowCount();
} catch (\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
if ($stmtNb > 0) {
$result = $stmt->fetch(\PDO::FETCH_ASSOC); $result = $stmt->fetch(\PDO::FETCH_ASSOC);
} }