Issue #0001789:
This commit is contained in:
parent
8b952b1033
commit
073de975fa
6
application/models/Sdv1TabCities.php
Normal file
6
application/models/Sdv1TabCities.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_Sdv1TabCities extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'zonesVilles';
|
||||
protected $_schema = 'sdv1';
|
||||
}
|
@ -64,6 +64,63 @@ class Catalog extends WsScore
|
||||
return json_encode($tab);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Cities
|
||||
* @param string $id
|
||||
* @param array $columns
|
||||
* @throws SoapFault
|
||||
* @return string
|
||||
*/
|
||||
public function getCity($id=null, $columns = array())
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
$columnsList = array(
|
||||
'cp',
|
||||
'commune',
|
||||
);
|
||||
|
||||
if (empty($columns) || count($columns)==0) {
|
||||
$columnsDisplay = array('cp', 'commune');
|
||||
}
|
||||
// Check authorize column
|
||||
else {
|
||||
foreach ( $columns as $column ) {
|
||||
if ( in_array($column, $columnsList) ) {
|
||||
$columnsDisplay[] = $column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$model = new Application_Model_sdv1TabCities();
|
||||
$sql = $model->select()->from($model, $columnsDisplay);
|
||||
if ( $id!==null ) {
|
||||
$sql->where('cp=?', $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->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($tab);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Legal Form
|
||||
|
Loading…
Reference in New Issue
Block a user