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

View File

@ -67,7 +67,7 @@
</a> </a>
<?php } ?> <?php } ?>
</td> </td>
<td class="StyleInfoData" width="220"> <td class="StyleInfoData" width="200">
<?php <?php
$message = ''; $message = '';
if (trim($dir->NaissDate) != '' && trim($dir->NaissDate)!='0000-00-00') { if (trim($dir->NaissDate) != '' && trim($dir->NaissDate)!='0000-00-00') {
@ -97,6 +97,8 @@
<img src="/themes/default/images/interfaces/editer.png" /></a> <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)?>"> <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> <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> </td>
<?php if (empty($this->AutrePage) && $this->accessWorldCheck) {?> <?php if (empty($this->AutrePage) && $this->accessWorldCheck) {?>
<td> <td>

View File

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