Entreprise - getLienRef : remove Application_Model
This commit is contained in:
parent
73f5b36ef4
commit
a66fc30119
@ -1277,24 +1277,28 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
$this->authenticate();
|
||||
$this->permission('liens');
|
||||
|
||||
$refM = new Application_Model_JoLiensRef();
|
||||
|
||||
try {
|
||||
$rows = $refM->find($id);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
if ($this->User->idClient!=1) {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
} else {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
$sql = "SELECT * FROM jo.liensRef WHERE id=:id";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $companyId);
|
||||
$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 ($rows->count()==0) {
|
||||
if ($stmt->count() == 0) {
|
||||
throw new SoapFault('MSG', 'Aucun résultat');
|
||||
}
|
||||
|
||||
$result = $rows->current()->toArray();
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
$output = new LienRef();
|
||||
$output->siren = $result['siren'];
|
||||
@ -1335,20 +1339,27 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$nbIdNum = 3;
|
||||
$refs = array();
|
||||
$idM = new Application_Model_Sdv1TabIdLocal();
|
||||
for ($i=0;$i<$nbIdNum;$i++) {
|
||||
if( !empty($result['idLoc'.$i.'Type']) ) {
|
||||
$ref = new LienRefId();
|
||||
$ref->num = $result['idLoc'.$i.'Num'];
|
||||
$sql = $idM->select()->from($idM, array('idLocal', 'idPrincipal'))
|
||||
->where('id=?', $result['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', $result['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());
|
||||
}
|
||||
}
|
||||
|
||||
$refs[] = $ref;
|
||||
|
Loading…
Reference in New Issue
Block a user