Entreprise - getPrivilegeList : remove Zend_Db, Application_Model

This commit is contained in:
Michael RICOIS 2017-03-15 15:32:20 +01:00
parent 42bc186318
commit 75b9abeda8

View File

@ -632,10 +632,12 @@ class Entreprise extends Scores_Ws_Server
ORDER BY insDate DESC;";
try {
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$privResult = $db->fetchAll($privSql, null, Zend_Db::FETCH_OBJ);
} catch(Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
$stmt = $this->conn->executeQuery($privSql);
} 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");
@ -649,8 +651,8 @@ class Entreprise extends Scores_Ws_Server
$privileges = array();
$cumul = array();
if (count($privResult) > 0) {
foreach($privResult as $p) {
if ($stmt->rowCount() > 0) {
while ($p = $stmt->fetch(\PDO::FETCH_OBJ)) {
// --- Cumul des privileges par type (Nb, Montant)
$output->NbTotal++;
$output->MtTotal+= $p->insMontant;
@ -733,17 +735,19 @@ class Entreprise extends Scores_Ws_Server
WHERE siren=$companyId AND id=$id";
try {
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$p = $db->fetchRow($privSql, null, Zend_Db::FETCH_OBJ);
} catch(Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
$stmt = $this->conn->executeQuery($privSql);
} 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");
}
}
$iRncs = new Metier_Partenaires_MRncs();
$p = $stmt->fetch(\PDO::FETCH_OBJ);
$privilege = new PrivilegeDetail();
$privilege->Id = $p->id;
@ -768,6 +772,7 @@ class Entreprise extends Scores_Ws_Server
$privilege->Devise = $p->insDev;
$privilege->DebiteurNum = $p->numDebiteur;
$privilege->Greffe = $p->greffe;
$iRncs = new Metier_Partenaires_MRncs();
$privilege->GreffeLabel = $iRncs->getLibTribunal($p->greffe);
$privilege->RadiationDate = $p->radDate;
$privilege->RadiationMention = $p->radMention;