Issue #0002012: [liens inter-entreprises] - Gestion des départements de naissance (PP)

This commit is contained in:
Aram HARUTYUNYAN 2014-07-08 13:16:56 +00:00
parent 6be6aae252
commit 3df8cd9160
4 changed files with 72 additions and 3 deletions

View File

@ -1754,11 +1754,15 @@ class SaisieController extends Zend_Controller_Action
}
/**
* Gestion des liens étrangers
* Gestion des liens personnes physiques
*/
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);
$this->view->assign('countries', $this->countries);
}
@ -1833,6 +1837,10 @@ class SaisieController extends Zend_Controller_Action
$date = new Zend_Date($params['dateNbActions'], 'dd/MM/yyyy');
$dateNbActions = $date->toString('yyyyMMdd');
}
if ($params['naissance_dept_pays']=='FRA' && $params['naissance_dept']!='') {
$params['naissance_dept_pays'] = $params['naissance_dept'];
}
$infos = array(
'siren' => preg_replace('/\s+/', '', $params['siren']),
@ -2352,6 +2360,17 @@ 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;
}
}
$this->view->assign('depListe', $depListe);
$this->view->assign('nom', $items['nom']);
}
}

View File

@ -10,8 +10,8 @@
</div>
<?php if ( intval($this->siren)==0 && $this->PpPm=='PM' ) {?>
<?=$this->render('saisie/lienetranger.phtml')?>
<?php } elseif ( $this->PpPm=='PP' ) {?>
<?=$this->render('saisie/lienpp.phtml')?>
<?php } elseif ( $this->PpPm=='PP' ) { ?>
<?=$this->render('saisie/lienpp.phtml', $this->depListe)?>
<?php } else {?>
<?=$this->render('saisie/lienidentite.phtml')?>
<?php }?>

View File

@ -46,6 +46,16 @@ $('input[name=naissance_date]').datepicker({ changeMonth: true, changeYear: true
<option value="<?=$code?>"<?=$select?>><?=$item['libPays']?></option>
<?php }?>
</select>
<div id="departament">
<label>Département</label>
<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>
</div>
</div>
</div>
@ -113,6 +123,11 @@ function cpville(inputFld, outputFld, countrySel, countryVal) {
$('input[name='+outputFld+']').attr('value', text);
if (countrySel!=null && countryVal!=null){
$('select[name='+countrySel+']').val(countryVal);
if (countrySel == 'naissance_dept_pays')
{
$("#departament").show();
$("select[name=naissance_dept]").val(ui.item.label.substr(0, 2));
}
}
}
});
@ -133,6 +148,24 @@ $('input[name=adresse_codvoie]').autocomplete({
$('input[name=adresse_codvoie]').attr('value', ui.item.value);
}
});
function departaments()
{
var selected = $('select[name=naissance_dept_pays] option:selected').val();
if( selected == 'FRA' ) {
$("#departament").show();
} else {
$("#departament").hide();
}
}
$(document).ready(function(){
departaments();
});
$('select[name=naissance_dept_pays]').on("click", function(){
departaments();
});
</script>
<div class="fieldgrp">

View File

@ -1938,6 +1938,23 @@ class WsScores
return false;
}
}
/**
* getListeDepartements
* Liste des départements
*/
public function getDepartements()
{
$params = new stdClass();
$client = $this->loadClient('interne');
try {
$reponse = $client->getDepartements();
return $reponse->getDepartementsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDevises