Issue #0001886: getCatalogDepartements() a la place de getDepartements(). Nouvelle instruction 'dep' dans le getCatalog.php pour charger les départements

This commit is contained in:
Aram HARUTYUNYAN 2014-07-17 12:57:27 +00:00
parent b15599b5a0
commit 0664fa10d1
6 changed files with 58 additions and 21 deletions

View File

@ -1759,10 +1759,18 @@ class SaisieController extends Zend_Controller_Action
public function lienppAction()
{
$this->_helper->layout()->disableLayout();
$ws = new WsScores();
$depListe = $ws->getDepartements();
Zend_Registry::get('firebug')->info($depListe);
$this->view->assign('depListe', $depListe->item);
$dep = new Application_Model_TabDepartements();
$sql = $dep->select();
$rows = $dep->fetchAll($sql);
if ( count($rows)>0 ) {
foreach ($rows as $item) {
$depListe[] = array(
'num' => $item->numdep,
'lib' => $item->libdep,
);
}
}
$this->view->assign('depListe', $depListe);
$this->view->assign('countries', $this->countries);
}
@ -2330,15 +2338,20 @@ class SaisieController extends Zend_Controller_Action
if ($items['PpPm']=='PM') {
$this->view->assign('nom', $items['RS']);
} else {
$result = $ws->getDepartements();
$depListe = $result->item;
foreach ($depListe as $dep)
{
if ($dep->id==$items['naissance_dept_pays']) {
$this->view->assign('naissance_dept_pays', 'FRA');
$this->view->assign('naissance_dept', $dep->id);
break;
}
$dep = new Application_Model_TabDepartements();
$sql = $dep->select();
$rows = $dep->fetchAll($sql);
if ( count($rows)>0 ) {
foreach ($rows as $item) {
$depListe[] = array(
'num' => $item->numdep,
'lib' => $item->libdep,
);
if ($item->numdep == $items['naissance_dept_pays']) {
$this->view->assign('naissance_dept_pays', 'FRA');
$this->view->assign('naissance_dept', $item->numdep);
}
}
}
$this->view->assign('depListe', $depListe);
$this->view->assign('nom', $items['nom']);

View File

@ -51,8 +51,8 @@ $('input[name=naissance_date]').datepicker({ changeMonth: true, changeYear: true
<select name="naissance_dept">
<option value="">-</option>
<?php foreach($this->depListe as $dep) {?>
<?php $select = ''; if ($this->naissance_dept==$dep->id) $select = 'selected';?>
<option value="<?=$dep->id?>"<?=$select?>><?=$dep->id.': '.$dep->lib?></option>
<?php $select = ''; if ($this->naissance_dept==$dep['num']) $select = 'selected';?>
<option value="<?=$dep['num']?>"<?=$select?>><?=$dep['num'].': '.$dep['lib']?></option>
<?php }?>
</select>
</div>

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_TabDepartements extends Zend_Db_Table_Abstract
{
protected $_name = 'tabdepartements';
}

View File

@ -1942,17 +1942,24 @@ class WsScores
/**
* getListeDepartements
* Liste des départements
*/
public function getDepartements()
*/
public function getCatalogDepartements($id, $columns)
{
$params = new stdClass();
$client = $this->loadClient('interne');
$params->id = $id;
$params->columns = $columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getDepartements();
$reponse = $client->getDepartements($params);
return $reponse->getDepartementsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}

View File

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS `tabDepartements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`numdep` char(3) NOT NULL,
`libdep` char(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM COMMENT='Departements';

View File

@ -69,6 +69,11 @@ $catalogs = array(
'table' => 'tabVilles',
'method' => array('name'=>'getCatalogCity', 'params'=> array( null , array('codePostal', 'LIBGEO') ))
),
'dep' => array(
'sql' => 'tabDepartements.sql',
'table' => 'tabDepartements',
'method' => array('name'=>'getCatalogDepartements', 'params'=> array( null , array('numdep', 'libdep') ))
),
);
try {