issue #0001456 : Forme juridique, Naf5

This commit is contained in:
Michael RICOIS 2012-12-14 12:31:15 +00:00
parent 57f7d02c5e
commit f535161d62
3 changed files with 91 additions and 2 deletions

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_JoTabFJur extends Zend_Db_Table_Abstract
{
protected $_name = 'tabFJur';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_JoTabNaf5 extends Zend_Db_Table_Abstract
{
protected $_name = 'tabNaf5';
}

View File

@ -5,16 +5,95 @@ require_once realpath(dirname(__FILE__)).'/Types.php';
class Catalog extends WsScore
{
protected function getNaf5()
protected function getNaf5($id)
{
$this->authenticate();
try {
$db = Zend_Db::factory($this->dbConfig->db->jo);
$db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['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");
}
$columnsDisplay = array('codNaf5', 'libNaf5', 'codNaf4', 'codNaf3', 'codNaf2', 'codNaf1');
try {
$model = new Application_Model_JoTabNaf5($db);
$sql = $model->select()->from($model, $columnsDisplay);
if ( $id!==null ) {
$sql->where('codNaf5=?', $id);
}
$result = $model->fetchAll($sql);
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['idClient']==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', $e->getMessage());
}
$tab = array();
if ( $result->count()>0 ) {
foreach ( $result as $item ) {
$tab[$item->codEven] = $item->toArray();
}
}
return json_encode($tab);
}
protected function getLegalForm()
protected function getLegalForm($id)
{
$this->authenticate();
try {
$db = Zend_Db::factory($this->dbConfig->db->jo);
$db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['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");
}
$columnsDisplay = array('code', 'libelle');
try {
$model = new Application_Model_JoTabNaf5($db);
$sql = $model->select()->from($model, $columnsDisplay);
if ( $id!==null ) {
$sql->where('code=?', $id);
}
$result = $model->fetchAll($sql);
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['idClient']==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', $e->getMessage());
}
$tab = array();
if ( $result->count()>0 ) {
foreach ( $result as $item ) {
$tab[$item->code] = $item->toArray();
}
}
return json_encode($tab);
}
protected function getEvent($id=null)