diff --git a/application/models/Sdv1TabCities.php b/application/models/Sdv1TabCities.php new file mode 100644 index 00000000..161bc067 --- /dev/null +++ b/application/models/Sdv1TabCities.php @@ -0,0 +1,6 @@ +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