Entreprise - getLiensById : remove Application_Model

This commit is contained in:
Michael RICOIS 2017-03-15 15:07:14 +01:00
parent a66fc30119
commit 22e907ceaf

View File

@ -846,7 +846,6 @@ class Entreprise extends Scores_Ws_Server
}
}
$tabPays = array();
if ($stmt->count() > 0) {
while ($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
@ -1061,35 +1060,36 @@ class Entreprise extends Scores_Ws_Server
$this->authenticate();
$this->permission('liens');
//Load country table
try {
$countryM = new Application_Model_JoTabPays();
$sql = $countryM->select()->from($countryM, array('codPays3', 'libPays'));
$result = $countryM->fetchAll($sql);
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error");
$sql = "SELECT codPays3, libPays FROM jo.tabPays";
$stmt = $this->conn->prepare($sql);
$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");
}
}
$tabPays = array();
if ( $result->count()>0 ) {
foreach ( $result as $item ) {
$tabPays[$item->codPays3] = $item->libPays;
}
}
$tabPays = array();
if ($stmt->count() > 0) {
while ($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
$tabPays[$item->codPays3] = $item->libPays;
}
}
$tabAct = $tabPar = $tabDir = array();
try
{
try {
$liensM = new Metier_Liens_Base();
$liensM->setId($id);
//Actionnaires
// Actionnaires
$liens = $liensM->getActionnaires(null, true);
if (count($liens)>0) {
foreach ( $liens as $item ) {
@ -1124,23 +1124,29 @@ class Entreprise extends Scores_Ws_Server
$nbIdNum = 3;
$refs = array();
$idM = new Application_Model_Sdv1TabIdLocal();
for ($i=0;$i<$nbIdNum;$i++) {
if( !empty($item->{'idLoc'.$i.'Num'}) ) {
$ref = new LienRefId();
$ref->num = $item->{'idLoc'.$i.'Num'};
if ( !empty($item->{'idLoc'.$i.'Type'}) ) {
$sql = $idM->select()->from($idM, array('idLocal', 'idPrincipal'))
->where('id=?', $item->{'idLoc'.$i.'Type'});
$result = $idM->fetchRow($sql);
if (null!==$result) {
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
if (!empty($item->{'idLoc'.$i.'Type'})) {
try {
$sql = "SELECT idLocal, idPrincipal FROM sdv1.tabIdLocal WHERE id=:id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $item->{'idLoc'.$i.'Type'});
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
} else {
$ref->label = 'Identifiant local';
$ref->type = 1;
@ -1155,7 +1161,7 @@ class Entreprise extends Scores_Ws_Server
}
}
//Participations
// Participations
$liens = $liensM->getParticipations(null, true);
if (count($liens)>0) {
foreach ( $liens as $item ) {
@ -1190,23 +1196,29 @@ class Entreprise extends Scores_Ws_Server
$nbIdNum = 3;
$refs = array();
$idM = new Application_Model_Sdv1TabIdLocal();
for ($i=0;$i<$nbIdNum;$i++) {
if( !empty($item->{'idLoc'.$i.'Num'}) ) {
if (!empty($item->{'idLoc'.$i.'Num'})) {
$ref = new LienRefId();
$ref->num = $item->{'idLoc'.$i.'Num'};
if ( !empty($item->{'idLoc'.$i.'Type'}) ) {
$sql = $idM->select()->from($idM, array('idLocal', 'idPrincipal'))
->where('id=?', $item->{'idLoc'.$i.'Type'});
$result = $idM->fetchRow($sql);
if (null!==$result) {
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
try {
$sql = "SELECT idLocal, idPrincipal FROM sdv1.tabIdLocal WHERE id=:id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $item->{'idLoc'.$i.'Type'});
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
} else {
$ref->label = 'Identifiant local';
$ref->type = 1;