Legal - Dirigeant Controller

This commit is contained in:
Michael RICOIS 2016-05-09 15:48:30 +02:00
parent 54c13411e8
commit e76c02113c
4 changed files with 545 additions and 0 deletions

View File

@ -1 +1,129 @@
<?php
class Legal_DirigeantController extends Zend_Controller_Action
{
protected $theme;
protected $siret;
protected $id;
public function init()
{
// --- Theme
$this->theme = Zend_Registry::get('theme');
$request = $this->getRequest();
$this->siret = $request->getParam('siret');
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
}
/**
* Affichage de la liste des dirigeants
*/
public function listeAction()
{
$request = $this->getRequest();
$autrePage = $this->getRequest()->getParam('apage');
$siren = substr($this->siret, 0, 9);
if (empty($autrePage)) {
$this->view->headTitle()->prepend('Liste des dirigeants');
$this->view->headTitle()->prepend('Siret '.$this->siret);
}
$ws = new WsScores();
$infos = $ws->getDirigeants($siren);
if ($infos === false){
$this->forward('soap', 'error');
}
$dirigeants = $infos->result->item;
$user = new Scores_Utilisateur();
$session = new Scores_Session_Entreprise($this->siret, $this->id);
if ($user->checkPerm('dirigeantsop')){
$href = $this->view->url(array('controller'=>'dirigeant', 'action'=>'op', 'siret'=>$this->siret), 'default', true);
$this->view->assign('dirigeantsop', $href);
}
$this->view->assign('edition', $user->checkModeEdition());
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
$this->view->assign('AutrePage', $this->getRequest()->getParam('apage'));
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
}
/**
* Affichage de l'historiques des dirigeants
*/
public function histoAction()
{
$siren = substr($this->siret, 0, 9);
$this->view->headTitle()->prepend('Historique des dirigeants');
$this->view->headTitle()->prepend('Siret '.$this->siret);
$ws = new WsScores();
$infos = $ws->getDirigeants($siren, true);
if ($infos === false){
$this->_forward('soap', 'error');
}
$dirigeants = $infos->result->item;
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('infos', $infos);
$user = new Scores_Utilisateur();
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
}
public function opAction()
{
$siren = substr($this->siret, 0, 9);
$this->view->headTitle()->prepend('Liste des dirigeants opérationnels');
$this->view->headTitle()->prepend('Siret '.$this->siret);
$ws = new WsScores();
$infos = $ws->getDirigeantsOp($siren);
if ($infos === false){
$this->_forward('soap', 'error');
}
$dirigeants = $infos->item;
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
$this->view->assign('AutrePage', $this->getRequest()->getParam('apage'));
$user = new Scores_Utilisateur();
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
$this->view->assign('edition', $user->checkModeEdition());
}
}

View File

@ -0,0 +1,62 @@
<div id="center">
<h1><?=$this->translate("DIRIGEANTS")?></h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Num&eacute;ro identifiant Siren")?></td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Dénomination Sociale")?></td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
<?php if ($this->surveillance) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?=$this->action('infos','surveillance', null, array(
'source' => 'dirigeants',
'siret' => $this->siret
))?>
</td>
</tr>
<?php }?>
</table>
</div>
<h2><?=$this->translate("Historique des dirigeants")?></h2>
<div class="paragraph">
<?php if (count($this->dirigeants) > 0) {?>
<table class="data">
<?php foreach ($this->dirigeants as $dir) {?>
<tr>
<td class="StyleInfoData" width="270"><?=$dir->Titre?></td>
<td class="StyleInfoData" width="200"><?=$dir->Societe.' '.$dir->Nom.' '.$dir->Prenom?></td>
<td class="StyleInfoData" width="200">
<?php
if ($dir->DateFct != '0000-00-00') {
$date = new Zend_Date($dir->DateFct,'yyyy-MM-dd'); ?>
<?php if ( Zend_Date::isDate($date) ) { ?>
<?=$this->translate("Modification le") . ' ' . $date->toString('dd/MM/yyyy');?>
<?php }?>
<?php }?>
</td>
</tr>
<?php }?>
</table>
<?php } else {?>
<table>
<tr>
<td class="StyleInfoData" width="550">
<?=$this->translate("Aucune donn&eacute;e n'est pr&eacute;sente dans notre base")?>
</td>
</tr>
</table>
<?php }?>
</div>
<?=$this->render('cgu.phtml', $this->cgu)?>
</div>

View File

@ -0,0 +1,177 @@
<?php if (empty($this->AutrePage)) {?>
<div id="center">
<?php }?>
<?php if (empty($this->AutrePage)){?>
<h1><?=$this->translate("DIRIGEANTS")?></h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Num&eacute;ro identifiant Siren")?></td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Dénomination Sociale")?></td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
<?php if ($this->surveillance) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?=$this->action('infos','surveillance', null, array(
'source' => 'dirigeants',
'siret' => $this->siret
))?>
</td>
</tr>
<?php }?>
<?php if( $this->dirigeantsop ){ ?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<a href="<?=$this->dirigeantsop?>"><?=$this->translate("Consulter la liste des dirigeants opérationnels")?></a>
</td>
</tr>
<?php } ?>
</table>
</div>
<?php }?>
<h2><?=$this->translate("Liste des dirigeants actifs")?></h2>
<div class="paragraph">
<?php if ( count($this->dirigeants)>0 ) { ?>
<table class="data">
<?php foreach ($this->dirigeants as $dir) {?>
<tr>
<td class="StyleInfoData" width="200"><?=$dir->Titre?></td>
<td class="StyleInfoData" width="320">
<?php if ($dir->Societe != '') { ?>
<a href="<?=$this->url(array('controller' => 'recherche', 'action' => 'liste', 'type' => 'ent','raisonSociale' => $dir->Societe), 'default', true)?>"
title="<?=$this->translate("Recherche à partir de la dénomination sociale")?>">
<?=$dir->Societe?>
</a>
<br/>
<?php }?>
<?php if ($dir->Nom != '') { ?>
<a href="<?=$this->url(array(
'controller' => 'recherche',
'action' => 'liste',
'type' => 'dir',
'dirNom' => $dir->Nom,
'dirPrenom' => $dir->Prenom,
'dirDateNaissJJ' => substr($dir->NaissDate,0,2),
'dirDateNaissMM' => substr($dir->NaissDate,3,2),
'dirDateNaissAAAA' => substr($dir->NaissDate,6,4),
'dirCpVille' => $dir->NaissVille,
), 'default', true)?>" title="<?=$this->translate("Recherche à partir du nom du dirigeant")?>">
<?=$dir->Nom.' '.$dir->Prenom?>
</a>
<?php
if (trim($dir->NaissDate) != '' && trim($dir->NaissVille.' '.$dir->NaissDepPays) != '') { ?>
<br/>né(e) le <?=$dir->NaissDate?> à <?=$dir->NaissVille?>
<?php if (trim($dir->NaissDepPays) != '') { ?>&nbsp;(<?=$dir->NaissDepPays?>)<?php }?>
<?php } else if (trim($dir->NaissDate) != '') { ?>
né(e) le <?=$dir->NaissDate?>
<?php } else if (trim($dir->NaissVille.' '.$dir->NaissDepPays) != '') { ?>
né(e) à <?=$dir->NaissVille?> &nbsp;(<?=$dir->NaissDepPays?>)
<?php } ?>
<?php } ?>
</td>
<td class="StyleInfoData" width="100" valign="top">
<?php if ($dir->Siren!='') {?>
<a title="<?=$this->translate("Consulter la fiche identité")?>" href="<?=$this->url(array('controller'=>'identite', 'action'=>'fiche', 'siret'=>$dir->Siren), 'default', true)?>">
<?=$this->SirenTexte($dir->Siren)?></a>
<?php if (empty($this->AutrePage) && $this->edition) {?>
<div style="line-height:16px;">
<a class="dialog" title="<?=$this->translate("Ajouter un actionnaire")?>" href="<?=$this->url(array('controller'=>'saisie','action'=>'lien','type'=>'actionnaire','mode'=>'add','siren'=>$this->siren,'createfiche'=>$dir->Siren),null,true)?>">
<img style="vertical-align:middle;" src="/themes/default/images/interfaces/ajouter.png" /></a>
</div>
<?php }?>
<?php }?>
</td>
<?php if (empty($this->AutrePage) && $this->accessWorldCheck) {?>
<td>
<?php if ($dir->Societe != '') { ?>
<img style="cursor:pointer;" class="wcheck" data-url="<?=$this->url(array(
'controller'=>'worldcheck','action'=>'occurence','siren'=>substr($this->siret,0,9),
'dirType'=>'ORGANISATION','dirSociete'=>$dir->Societe),'default',true);?>" src="/themes/default/images/worldcheck/wc.png"/>
<?php }?>
<?php if ($dir->Nom != '') { ?>
<img style="cursor:pointer;" class="wcheck" data-url="<?=$this->url(array(
'controller'=>'worldcheck','action'=>'occurence','siren'=>substr($this->siret,0,9),
'dirType'=>'INDIVIDUAL','dirNom'=>$dir->Nom,'dirPrenom'=>$dir->Prenom),'default',true);?>" src="/themes/default/images/worldcheck/wc.png"/>
<?php } ?>
</td>
<?php }?>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<table>
<tr>
<td class="StyleInfoData" width="550">
<?=$this->translate("Aucune donn&eacute;e n'est pr&eacute;sente dans notre base")?>
</td>
</tr>
</table>
<?php } ?>
</div>
<?php if (empty($this->AutrePage)) {?>
<?=$this->render('cgu.phtml', $this->cgu)?>
<?php }?>
<?php if (empty($this->AutrePage)) {?>
</div>
<?php }?>
<?php if (empty($this->AutrePage) && $this->edition) {?>
<script>
$('a.dialog').on('click', function(){
var href = $(this).attr('href');
if (href!='#') {
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 650,
height: 600,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Quitter: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
}
});
</script>
<?php }?>
<?php if (empty($this->AutrePage) && $this->accessWorldCheck) {?>
<script>
$('img.wcheck').each(function(){
$(this).qtip({
hide: { event: 'unfocus' },
show: { solo: true, delay: 500 },
content: {
button: true,
title: 'WorlCheck',
text: "Chargement...",
ajax: { url: $(this).data('url') } },
position: { my: 'right center', at: 'left center' }
});
});
</script>
<?php }?>

View File

@ -0,0 +1,178 @@
<?php if (empty($this->AutrePage)){?>
<div id="center">
<?php }?>
<?php if (empty($this->AutrePage)){?>
<h1><?=$this->translate("DIRIGEANTS OP&Eacute;RATIONNELS")?></h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Num&eacute;ro identifiant Siren")?></td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?=$this->translate("Dénomination Sociale")?></td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
<?php if ($this->surveillance) {?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?=$this->action('infos','surveillance', null, array(
'source' => 'dirigeants',
'siret' => $this->siret
))?>
</td>
</tr>
<?php }?>
</table>
</div>
<?php }?>
<h2><?=$this->translate("Liste des dirigeants actifs")?></h2>
<div class="paragraph">
<?php if ($this->edition) {?>
<a class="dialog" title="Ajouter un dirigeant" href="<?=$this->url(array('controller'=>'saisie','action'=>'diropcontrol','mode'=>'add','siret'=>$this->siret), 'default', true)?>">
<img style="vertical-align:middle;" src="/themes/default/images/interfaces/ajouter.png" /><?=$this->translate("Ajouter un dirigeant")?></a>
<?php }?>
<?php if ( count($this->dirigeants)>0 ) {?>
<table class="data">
<?php foreach ($this->dirigeants as $dir) {?>
<tr>
<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',
'action' => 'liste',
'type' => 'ent',
'raisonSociale' => $dir->Societe
), 'default', true)?>"
title="<?=$this->translate("Recherche à partir de la Dénomination sociale")?>">
<?=$dir->Societe?>
</a>
&nbsp;
<?php }?>
<?php if ($dir->Nom != '') { ?>
<a href="<?=$this->url(array(
'controller' => 'recherche',
'action' => 'liste',
'type' => 'dir',
'dirNom' => $dir->Nom,
'dirPrenom' => $dir->Prenom,
), 'default', true)?>" title="<?=$this->translate("Recherche à partir du nom du dirigeant")?>">
<?=$dir->Civilite.' '.$dir->Nom.' '.$dir->Prenom?>
</a>
<?php } ?>
</td>
<td class="StyleInfoData" width="200">
<?php
$message = '';
if (trim($dir->NaissDate) != '' && trim($dir->NaissDate)!='0000-00-00') {
$date = new Zend_Date($dir->NaissDate, 'yyyy-MM-dd');
$message = $message.' '.$this->translate("le").' '.$date->toString('dd/MM/yyyy');
}
if (trim($dir->NaissVille.' '.$dir->NaissDepPays) != '') {
$message = $message.' '.$this->translate("à").' '.$dir->NaissVille;
}
if ($message!='') {
if ($dir->Civilite=='' || $dir->Civilite==null) {
$message = $this->translate("né(e)").' '.$message;
} else if ($dir->Civilite=='M') {
$message = $this->translate("né").' '.$message;
} else {
$message = $this->translate("née").' '.$message;
}
echo $message;
}
?>
</td>
<?php if ($this->edition) {?>
<td>
<a class="dialog" title="Modifier le dirigeant" href="<?=$this->url(array('controller'=>'saisie','action'=>'diropcontrol','mode'=>'edit','siret'=>$this->siret,'id'=>$dir->Id), 'default', true)?>">
<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), 'default', true)?>">
<img src="/themes/default/images/interfaces/supprimer.png" /></a>
</td>
<?php if (empty($this->AutrePage) && $this->accessWorldCheck) {?>
<td>
<?php if ($dir->Societe != '') { ?>
<img style="cursor:pointer;" class="wcheck" data-url="<?=$this->url(array(
'controller'=>'worldcheck','action'=>'occurence','siren'=>$this->siren,
'dirType'=>'ORGANISATION','dirSociete'=>$dir->Societe),'default',true);?>" src="/themes/default/images/worldcheck/wc.png"/>
<?php }?>
<?php if ($dir->Nom != '') {
$param = array(
'controller'=>'worldcheck',
'action'=>'occurence',
'siren'=>$this->siren,
'dirType'=>'INDIVIDUAL',
'dirNom'=>$dir->Nom,
'dirPrenom'=>$dir->Prenom,
);
?>
<img style="cursor:pointer;" class="wcheck" data-url="<?=$this->url($param,'default',true);?>" src="/themes/default/images/worldcheck/wc.png"/>
<?php } ?>
</td>
<?php }?>
<?php }?>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<table>
<tr>
<td class="StyleInfoData" width="550">
<?=$this->translate("Aucune donn&eacute;e n'est pr&eacute;sente dans notre base")?>
</td>
</tr>
</table>
<?php } ?>
</div>
<?php if (empty($this->AutrePage)){?>
<?=$this->render('cgu.phtml', $this->cgu)?>
</div>
<?php }?>
<script>
$('img.wcheck').each(function(){
$(this).qtip({
hide: { event: 'unfocus' },
show: { solo: true, delay: 1000 },
content: {
button: true,
title: 'WorlCheck',
text: "Chargement...",
ajax: { url: $(this).data('url') } },
position: { my: 'right center', at: 'left center' }
});
});
$('a.dialog').on('click', function(){
var href = $(this).attr('href');
if (href!='#') {
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 600,
height: 550,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Quitter: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
}
});
</script>