Issue #0001788: [Dirigeants Opérationnels] simplifié, pas de fiche/lien, recherche...
This commit is contained in:
parent
cada35746e
commit
5fbdcd0d7c
@ -121,46 +121,4 @@ class DirigeantController extends Zend_Controller_Action
|
||||
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
|
||||
$this->view->assign('edition', $user->checkModeEdition());
|
||||
}
|
||||
|
||||
public function diropficheAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$siren = substr($this->siret, 0, 9);
|
||||
|
||||
$this->view->assign('siret', $this->siret);
|
||||
$this->view->assign('id', $this->id);
|
||||
}
|
||||
|
||||
public function diropliensAction()
|
||||
{
|
||||
$siren = substr($this->siret, 0, 9);
|
||||
|
||||
$this->view->headTitle()->prepend('Liste des entreprises');
|
||||
|
||||
$ws = new WsScores();
|
||||
|
||||
$entListe = array();
|
||||
|
||||
$param = array('id'=>$this->id);
|
||||
$infos = $ws->searchDirigeantsOp(json_encode($param));
|
||||
$liste = $infos->item;
|
||||
|
||||
foreach($liste as $key=>$val)
|
||||
{
|
||||
$item = new stdClass();
|
||||
$item->RS = $ws->getIdentiteLight($val->siren);
|
||||
$item->siren = $val->siren;
|
||||
$item->nic = $val->nic;
|
||||
$item->libFct = $val->libFct;
|
||||
$entListe[] = $item;
|
||||
}
|
||||
|
||||
$this->view->assign('liste', $entListe);
|
||||
$this->view->assign('nom', $liste[0]->nom);
|
||||
$this->view->assign('prenom', $liste[0]->prenom);
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
|
||||
}
|
||||
}
|
@ -2567,7 +2567,6 @@ class SaisieController extends Zend_Controller_Action
|
||||
|
||||
$request = $this->getRequest();
|
||||
$mode = $request->getParam('mode');
|
||||
$type = $request->getParam('type', 'lien');
|
||||
$id = $request->getParam('id', null);
|
||||
$siret = $request->getParam('siret');
|
||||
$siren = substr($siret, 0, 9);
|
||||
@ -2592,7 +2591,6 @@ class SaisieController extends Zend_Controller_Action
|
||||
}
|
||||
|
||||
$this->view->assign('mode', $mode);
|
||||
$this->view->assign('type', $type);
|
||||
$this->view->assign('id', $id);
|
||||
$this->view->assign('siren', $siren);
|
||||
$this->view->assign('nic', $nic);
|
||||
@ -2616,7 +2614,6 @@ class SaisieController extends Zend_Controller_Action
|
||||
|
||||
$infos = array(
|
||||
'siren' => $params['siren'],
|
||||
'targetId' => $params['targetId'],
|
||||
'nic' => $params['nic'],
|
||||
'civilite' => $params['civilite'],
|
||||
'nom' => $params['nom'],
|
||||
@ -2638,60 +2635,19 @@ class SaisieController extends Zend_Controller_Action
|
||||
$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);
|
||||
|
||||
$result = $ws->setDirigeantsOp(json_encode($infos), $params['mode'], $params['id']);
|
||||
|
||||
if ($result>0) {
|
||||
$message = $message.' '.$this->view->translate('a été réussi!');
|
||||
} else if ($result===0) {
|
||||
$message = $message.' '.$this->view->translate('n\'a pas été réussi!');
|
||||
} else {
|
||||
$this->view->assign('message', $errMsg);
|
||||
$message = $result;
|
||||
}
|
||||
}
|
||||
|
||||
public function diropsearchAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$query = $this->getRequest()->getParam('query', null);
|
||||
|
||||
$param = array('query'=>$query);
|
||||
$output = array();
|
||||
|
||||
if ( null !== $query) {
|
||||
$ws = new WsScores();
|
||||
$infos = $ws->searchDirigeantsOp(json_encode($param));
|
||||
|
||||
if ( count($infos)>0 ) {
|
||||
foreach ($infos->item as $item) {
|
||||
$output[] = array(
|
||||
'label' => str_pad($item->siren, 9, 0, STR_PAD_LEFT).": ".$item->nom.' '.$item->prenom,
|
||||
'value' => $item->nom.' '.$item->prenom,
|
||||
'id' => $item->id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('output', $output);
|
||||
$this->view->assign('message', $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,8 +41,8 @@
|
||||
<table class="data">
|
||||
<?php foreach ($this->dirigeants as $dir) {?>
|
||||
<tr>
|
||||
<td class="StyleInfoData" width="120"><?=$dir->Titre?></td>
|
||||
<td class="StyleInfoData diropfiche" id="<?=$dir->Id?>" width="200">
|
||||
<td class="StyleInfoData" width="140"><?=$dir->Titre?></td>
|
||||
<td class="StyleInfoData" id="<?=$dir->Id?>" width="200">
|
||||
<?php if ($dir->Societe != '') { ?>
|
||||
<a href="<?=$this->url(array(
|
||||
'controller' => 'recherche',
|
||||
@ -97,8 +97,6 @@
|
||||
<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>
|
||||
@ -141,19 +139,6 @@
|
||||
</div>
|
||||
<?php }?>
|
||||
<script>
|
||||
$('td.diropfiche').each(function(){
|
||||
$(this).qtip({
|
||||
hide: { event: 'unfocus' },
|
||||
show: { solo: true, delay: 1000 },
|
||||
content: {
|
||||
button: true,
|
||||
title: $(this).text(),
|
||||
text: "Chargement...",
|
||||
ajax: { url: '<?=$this->url(array('controller'=>'dirigeant','action'=>'diropfiche'),null,true)?>/siret/'+<?=$this->siret?>+'/id/'+$(this).attr('id') } },
|
||||
position: { my: "bottom left", at: "top left" }
|
||||
});
|
||||
});
|
||||
|
||||
$('img.wcheck').each(function(){
|
||||
$(this).qtip({
|
||||
hide: { event: 'unfocus' },
|
||||
|
@ -7,7 +7,7 @@
|
||||
</style>
|
||||
<div class="fields">
|
||||
<div class="fieldgrp">
|
||||
<label>Civilité</label>
|
||||
<label><?=$this->translate("Civilité") ?></label>
|
||||
<div class="field">
|
||||
<?php
|
||||
$civilites = array('M', 'MME', 'MLE');
|
||||
@ -20,28 +20,41 @@ foreach ($civilites as $civilite) {
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Nom</label>
|
||||
<label><?=$this->translate("Nom") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="nom" value="<?=$this->infos->Nom?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Prenom</label>
|
||||
<label><?=$this->translate("Prenom") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="prenom" value="<?=$this->infos->Prenom?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Nom d'usage</label>
|
||||
<label><?=$this->translate("Nom d'usage") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="nom_usage" value="<?=$this->infos->NomUsage?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Date de naissance</label>
|
||||
<label><?=$this->translate("Fonction") ?></label>
|
||||
<div class="field">
|
||||
<select name="codFct" style="width:380px;">
|
||||
<option value="0000">-</option>
|
||||
<?php foreach ($this->fonction as $val) {
|
||||
$selected=(intval($val->codeFct)==intval($this->infos->Code))?"selected":""; ?>
|
||||
<option value="<?=$val->codeFct ?>" <?=$selected?>><?=$val->libelle?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label><?=$this->translate("Date de naissance") ?></label>
|
||||
<div class="field">
|
||||
<?php
|
||||
if (trim($this->infos->NaissDate) != '' && trim($this->infos->NaissDate)!='0000-00-00') {
|
||||
@ -54,28 +67,28 @@ if (trim($this->infos->NaissDate) != '' && trim($this->infos->NaissDate)!='0000-
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Lieu de naissance</label>
|
||||
<label><?=$this->translate("Lieu de naissance") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="naiss_lieu" value="<?=$this->infos->NaissVille?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Téléphone</label>
|
||||
<label><?=$this->translate("Téléphone") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="tel" value="<?=$this->infos->Tel?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Télécopie</label>
|
||||
<label><?=$this->translate("Télécopie") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="fax" value="<?=$this->infos->Fax?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Email</label>
|
||||
<label><?=$this->translate("Email") ?></label>
|
||||
<div class="field">
|
||||
<input type="text" name="email" value="<?=$this->infos->Email?>"/>
|
||||
</div>
|
||||
|
@ -1,124 +1,29 @@
|
||||
<?php if ($this->mode=='add') { ?>
|
||||
<div class="fieldgrp"><label><?=$this->translate("Rechercher") ?></label>
|
||||
<div class="field"><input type="text" name="recherche"/></div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<form name="dirop" action="<?=$this->url(array('controller'=>'saisie', 'action'=>'diropsave'),null, true)?>" method="post">
|
||||
<input type="hidden" name="type" value="<?=$this->type?>" />
|
||||
<input type="hidden" name="mode" value="<?=$this->mode?>" />
|
||||
<input type="hidden" name="siren" value="<?=$this->siren?>" />
|
||||
<input type="hidden" name="nic" value="<?=$this->nic?>" />
|
||||
<input type="hidden" name="id" value="<?=$this->id?>" />
|
||||
|
||||
<?php if ($this->mode=='add') { ?>
|
||||
<p class="titre"></p>
|
||||
<div class="fieldgrp"><label><?=$this->translate("Fonction") ?></label>
|
||||
<div class="field"><select name="codFct" style="width:380px;">
|
||||
<option value="0000">-</option>
|
||||
<?php foreach ($this->fonction as $val) { ?>
|
||||
<option value="<?=$val->codeFct ?>"><?=$val->libelle?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div></div>
|
||||
<?php echo $this->partial('/saisie/diropcontrol-form.phtml');?>
|
||||
<?php
|
||||
<?php
|
||||
if ($this->mode=='add') {
|
||||
echo $this->translate("Ajouter un dirigeant opérationnel");
|
||||
echo $this->partial('/saisie/diropcontrol-form.phtml', array('fonction'=>$this->fonction));
|
||||
} else if ($this->mode=='edit') {
|
||||
if ($this->type=='fiche') {
|
||||
echo $this->translate("Modifier la fiche du dirigeant");
|
||||
echo $this->render('/saisie/diropcontrol-form.phtml');
|
||||
} else {?>
|
||||
<div class="fieldgrp"><label><?=$this->translate("Fonction") ?></label>
|
||||
<div class="field"><select name="codFct" style="width:380px;>
|
||||
<option value="0000">-</option>
|
||||
<?php foreach ($this->fonction as $val) {
|
||||
$selected=(intval($val->codeFct)==intval($this->infos->Code))?"selected":""; ?>
|
||||
<option value="<?=$key ?>" <?=$selected?>><?=$val->libelle?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div></div>
|
||||
<?php }?>
|
||||
<?php } else if ($this->mode=='del') {
|
||||
if ($this->type=='fiche') {
|
||||
echo $this->translate("Supprimer la fiche du dirigeant");
|
||||
} 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 }?>
|
||||
echo $this->translate("Modifier le dirigeant opérationnel");
|
||||
echo $this->render('/saisie/diropcontrol-form.phtml');
|
||||
} else if ($this->mode=='del')
|
||||
echo $this->translate("Supprimer le dirigeant opérationnel");
|
||||
?>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() {
|
||||
var form = $('form[name=dirop]');
|
||||
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'); });
|
||||
}
|
||||
$.post(form.attr('action'), form.serialize(), function(data){
|
||||
$('#dialog').html(data);
|
||||
}).fail(function(){ alert('Unknown error'); });
|
||||
}},
|
||||
{ text: "Annuler", click: function() { $(this).dialog('close'); } }
|
||||
] });
|
||||
</script>
|
||||
|
||||
<?php if ($this->mode=='add') { ?>
|
||||
<script>
|
||||
$('form').hide();
|
||||
$(".ui-dialog-buttonpane button:contains('Valider')").hide();
|
||||
|
||||
$('input[name=recherche]').on("focus", function(){
|
||||
$(".ui-dialog-buttonpane button:contains('Valider')").hide();
|
||||
$('p.titre').text('');
|
||||
$('form').hide();
|
||||
$('input[name=type]').val('');
|
||||
});
|
||||
|
||||
$('input[name=recherche]').autocomplete({
|
||||
minLength: 3,
|
||||
delay: 750,
|
||||
source: function(request, response) {
|
||||
var recherche = $('input[name=recherche]').val();
|
||||
$.getJSON('<?=$this->url(array('controller'=>'saisie','action'=>'diropsearch'),null,true)?>',
|
||||
{ query: recherche },
|
||||
function(data) {response(data); console.log(data);}
|
||||
);
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
$(".ui-dialog-buttonpane button:contains('Valider')").show();
|
||||
$('p.titre').text('Ajouter le dirigeant à la sociéte');
|
||||
$('form').show();
|
||||
$('input[name=type]').val('lien');
|
||||
$('form .fields').hide();
|
||||
$('input[name=recherche]').attr('value', ui.item.value);
|
||||
$('input[name=id]').attr('value', ui.item.id);
|
||||
},
|
||||
change: function(event, ui) {
|
||||
if (ui.item == null) {
|
||||
$(".ui-dialog-buttonpane button:contains('Valider')").show();
|
||||
$('p.titre').text('Enregistrer un dirigeant et l\'ajouter à la sociéte');
|
||||
$('form').show();
|
||||
$('input[name=type]').val('fiche');
|
||||
$('form .fields').show();
|
||||
}
|
||||
},
|
||||
response: function(event, ui){
|
||||
if (ui.content.length===0) {
|
||||
$(".ui-dialog-buttonpane button:contains('Valider')").show();
|
||||
$('p.titre').text('Enregistrer un dirigeant et l\'ajouter à la sociéte');
|
||||
$('form').show();
|
||||
$('input[name=type]').val('fiche');
|
||||
$('form .fields').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php }?>
|
||||
</script>
|
@ -452,5 +452,60 @@ class Scores_Ws_Saisie extends Scores_Ws_Abstract
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getDirigeantsOp
|
||||
* @param string $siren
|
||||
*/
|
||||
public function getDirigeantsOp($siren, $id = null)
|
||||
{
|
||||
$filename = 'dirigeantsop-'.$siren.'-'.intval($id);
|
||||
|
||||
if ($this->cacheWrite) {
|
||||
$cache = new Cache($filename);
|
||||
if ($cache->exist() && $this->cacheEnable ){
|
||||
return $cache->getBlock();
|
||||
}
|
||||
}
|
||||
|
||||
$params = new StdClass();
|
||||
$params->siren = $siren;
|
||||
$params->id = $id;
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getDirigeantsOp($params);
|
||||
if ($this->cacheWrite) {
|
||||
$cache->deletefile();
|
||||
$cache->setBlock($reponse->getDirigeantsOpResult);
|
||||
}
|
||||
return $reponse->getDirigeantsOpResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setDirigeantsOp
|
||||
* @param array $infos
|
||||
*/
|
||||
public function setDirigeantsOp($infos, $mode, $id)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->infos = $infos;
|
||||
$params->mode = $mode;
|
||||
$params->id = $id;
|
||||
$client = $this->loadClient('saisie');
|
||||
try {
|
||||
$reponse = $client->setDirigeantsOp($params);
|
||||
return $reponse->setDirigeantsOpResult;
|
||||
} catch (SoapFault $fault) {
|
||||
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
|
||||
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
|
||||
return $fault->faultstring;
|
||||
} else {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2624,12 +2624,11 @@ class WsScores
|
||||
* setDirigeantsOp
|
||||
* @param array $infos
|
||||
*/
|
||||
public function setDirigeantsOp($infos, $mode, $type, $id)
|
||||
public function setDirigeantsOp($infos, $mode, $id)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->infos = $infos;
|
||||
$params->mode = $mode;
|
||||
$params->type = $type;
|
||||
$params->mode = $mode;
|
||||
$params->id = $id;
|
||||
$client = $this->loadClient('saisie');
|
||||
try {
|
||||
@ -2646,29 +2645,6 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* searchDirigeantsOp
|
||||
* @param string $query
|
||||
*/
|
||||
public function searchDirigeantsOp($query)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->query = $query;
|
||||
$client = $this->loadClient('saisie');
|
||||
try {
|
||||
$reponse = $client->searchDirigeantsOp($params);
|
||||
return $reponse->searchDirigeantsOpResult;
|
||||
} catch (SoapFault $fault) {
|
||||
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
|
||||
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
|
||||
return $fault->faultstring;
|
||||
} else {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getIdentiteLight
|
||||
* @param string $siret
|
||||
|
Loading…
Reference in New Issue
Block a user