Issue #0001788: [Dirigeants Opérationnels] Option de déplacement du dirigeant

This commit is contained in:
Aram HARUTYUNYAN 2014-04-03 06:21:57 +00:00
parent 00fe11c6fa
commit 6265389f79
3 changed files with 44 additions and 21 deletions

View File

@ -2589,10 +2589,6 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('fonction', json_decode($fonction));
$this->view->assign('infos', $infos->item[0]);
break;
case 'del':
$infos = $ws->getDirigeantsOp($siren, $id);
break;
}
$this->view->assign('mode', $mode);
@ -2620,6 +2616,7 @@ class SaisieController extends Zend_Controller_Action
$infos = array(
'siren' => $params['siren'],
'targetId' => $params['targetId'],
'nic' => $params['nic'],
'civilite' => $params['civilite'],
'nom' => $params['nom'],
@ -2634,28 +2631,40 @@ class SaisieController extends Zend_Controller_Action
);
$ws = new WsScores();
$result = $ws->setDirigeantsOp(json_encode($infos), $params['mode'], $params['type'], $params['id']);
if(is_int(intval($result)))
{
if($params['mode'] == 'add'){
$message = $this->view->translate('Ajout');
} else if ($params['mode'] == 'edit') {
$message = $this->view->translate('Edition');
} else if ($params['mode'] == 'del') {
$message = $this->view->translate('Suppression');
if($params['mode'] == 'add'){
$message = $this->view->translate('Ajout');
} else if ($params['mode'] == 'edit') {
$message = $this->view->translate('Edition');
} else if ($params['mode'] == 'del') {
$message = $this->view->translate('Suppression');
} else if ($params['mode'] == 'mov') {
$checkSiren = $ws->getIdentiteLight($params['targetId']);
if ($checkSiren->siren=='')
{
$errMsg = $this->view->translate('Erreur du Siren.');
} else {
$message = $this->view->translate('Déplacement');
}
}
if(!$errMsg) {
$result = $ws->setDirigeantsOp(json_encode($infos), $params['mode'], $params['type'], $params['id']);
if (intval($result)!=0) {
$message = $message.' '.$this->view->translate('a été réussi!');
} else {
$message = $message.' '.$this->view->translate('n\'a pas été réussi!');
}
if(!is_int(intval($result)))
{
$message = $result;
}
$this->view->assign('message', $message);
} else {
$message = $result;
$this->view->assign('message', $errMsg);
}
$this->view->assign('message', $message);
}
public function diropsearchAction()

View File

@ -67,7 +67,7 @@
</a>
<?php } ?>
</td>
<td class="StyleInfoData" width="220">
<td class="StyleInfoData" width="200">
<?php
$message = '';
if (trim($dir->NaissDate) != '' && trim($dir->NaissDate)!='0000-00-00') {
@ -97,6 +97,8 @@
<img src="/themes/default/images/interfaces/editer.png" /></a>
<a class="dialog" title="Supprimer le dirigeant" href="<?=$this->url(array('controller'=>'saisie','action'=>'diropcontrol','mode'=>'del','siret'=>$this->siret,'id'=>$dir->Id), null, true)?>">
<img src="/themes/default/images/interfaces/supprimer.png" /></a>
<a class="dialog" title="Déplacer le dirigeant" href="<?=$this->url(array('controller'=>'saisie','action'=>'diropcontrol','mode'=>'mov','siret'=>$this->siret,'id'=>$dir->Id), null, true)?>">
<img src="/themes/default/images/interfaces/page_swap.png" /></a>
</td>
<?php if (empty($this->AutrePage) && $this->accessWorldCheck) {?>
<td>

View File

@ -43,6 +43,9 @@
} else {
echo $this->translate("Supprimer le lien du dirigeant");
}?>
<?php } else if ($this->mode=='mov') {?>
<?=$this->translate("Déplacer le dirigeant à société");?>
<input type="text" name="targetId" />
<?php }?>
</form>
@ -50,9 +53,18 @@
$('#dialog').dialog({ buttons: [
{ text: "Valider", click: function() {
var form = $('form[name=dirop]');
$.post(form.attr('action'), form.serialize(), function(data){
$('#dialog').html(data);
}).fail(function(){ alert('Unknown error'); });
if ($('input[name=mode]').val()=='mov') {
var siren = $('input[name=targetId]').val();
if (siren.length==9 || siren.length==14){
$.post(form.attr('action'), form.serialize(), function(data){
$('#dialog').html(data);
}).fail(function(){ alert('Unknown error'); });
}
} else {
$.post(form.attr('action'), form.serialize(), function(data){
$('#dialog').html(data);
}).fail(function(){ alert('Unknown error'); });
}
}},
{ text: "Annuler", click: function() { $(this).dialog('close'); } }
] });