9aca193415
des conso
2348 lines
77 KiB
PHP
2348 lines
77 KiB
PHP
<?php
|
||
class IdentiteController extends Zend_Controller_Action
|
||
{
|
||
protected $theme;
|
||
protected $siret = null;
|
||
protected $id = 0;
|
||
|
||
/**
|
||
* Logger
|
||
* @var \Monolog\Logger
|
||
*/
|
||
protected $logger;
|
||
|
||
public function init()
|
||
{
|
||
if (Zend_Registry::isRegistered('logger')) {
|
||
$this->logger = Zend_Registry::get('logger');
|
||
}
|
||
|
||
// --- Theme
|
||
$this->theme = Zend_Registry::get('theme');
|
||
|
||
// --- Get standard parameters
|
||
$request = $this->getRequest();
|
||
$this->siret = $request->getParam('siret');
|
||
$this->id = $request->getParam('id', 0);
|
||
|
||
require_once 'Scores/WsScores.php';
|
||
require_once 'Scores/IdentiteEntreprise.php';
|
||
}
|
||
|
||
public function preDispatch()
|
||
{
|
||
switch($this->getRequest()->getActionName())
|
||
{
|
||
case 'fiche':
|
||
case 'fichepc':
|
||
if (intval($this->siret)==0 && $this->id==0){
|
||
$this->forward('params', 'error');
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Renvoi vers la fiche
|
||
*/
|
||
public function indexAction()
|
||
{
|
||
$this->forward('index', 'index');
|
||
}
|
||
|
||
/**
|
||
* Proxy temporaire pour rediriger depuis un lien groupe
|
||
*/
|
||
public function fichebygroupAction()
|
||
{
|
||
$this->_helper->viewRenderer->setNoRender(true);
|
||
$this->_helper->layout()->disableLayout();
|
||
|
||
$request = $this->getRequest();
|
||
$id = $request->getParam('id');
|
||
|
||
$ws = new WsScores();
|
||
$response = $ws->getLienRef($id);
|
||
|
||
if ($response !== false) {
|
||
if (intval($response->siren) > 0) {
|
||
$url = $this->view->url(array('controller'=>'identite', 'action'=>'fiche', 'siret'=>$response->siren), 'default', true);
|
||
} else {
|
||
$url = $this->view->url(array('controller'=>'identite', 'action'=>'liens', 'lienref'=>$id), 'default', true);
|
||
}
|
||
$this->redirect($url);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Affichage de la fiche identité
|
||
*/
|
||
public function ficheAction()
|
||
{
|
||
$user = new Scores_Utilisateur();
|
||
|
||
$autrePage = $this->getRequest()->getParam('apage');
|
||
|
||
//Récupération des informations
|
||
if (empty($autrePage)) {
|
||
//Modification du titre
|
||
if( empty($this->siret) ){
|
||
$titre = 'Identifiant '.$this->id;
|
||
} else {
|
||
$titre = 'Siret '.$this->siret;
|
||
}
|
||
$this->view->headTitle()->prepend('Fiche Identité - '.$titre);
|
||
|
||
$ws = new Scores_Ws_Client('entreprise', '0.9');
|
||
$params = new stdClass();
|
||
$params->siret = $this->siret;
|
||
$params->id = $this->id;
|
||
$infos = $ws->getIdentite($params);
|
||
|
||
if ($infos === false) {
|
||
$this->forward('soap', 'error');
|
||
}
|
||
} else {
|
||
$infos = $this->getRequest()->getParam('infos');
|
||
}
|
||
|
||
if (is_string($infos)) {
|
||
$this->view->assign('message', $infos);
|
||
} else {
|
||
|
||
//Mise en session
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id, true);
|
||
$session->setInfoEntrep($infos);
|
||
|
||
//Date de dernière mise à jour
|
||
$tabDate = array(
|
||
'DateMajINSEE' => "Insee : ",
|
||
'DateMajRCS' => "RCS : ",
|
||
'DateMajBILAN' => "Bilans : ",
|
||
'DateMajANN' => "Annonces : ",
|
||
'DateMajID' => 'Scores :'
|
||
);
|
||
$datemajTexte = $dateDerMaj = '';
|
||
$datemajTexte.= '<table>';
|
||
foreach ( $tabDate as $dateId => $dateLib ) {
|
||
if ( isset($infos->{$dateId})
|
||
&& !empty($infos->{$dateId})
|
||
&& $infos->{$dateId}!='0000-00-00') {
|
||
|
||
if ( $dateId == 'DateMajID') {
|
||
$date = new Zend_Date($infos->DateMajID, 'yyyy-MM-dd');
|
||
$dateDerMaj = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
if ( $dateId == 'DateMajID' && !$user->checkModeEdition()) {
|
||
} else {
|
||
$date = new Zend_Date($infos->{$dateId}, 'yyyy-MM-dd');
|
||
$datemajTexte.= '<tr>';
|
||
$datemajTexte.= '<td>'.$dateLib.'</td>';
|
||
$datemajTexte.= '<td>'.$date->toString('dd/MM/yyyy').'</td>';
|
||
$datemajTexte.= '</tr>';
|
||
}
|
||
|
||
}
|
||
}
|
||
$datemajTexte.= '</table>';
|
||
|
||
$identite = new IdentiteEntreprise($infos);
|
||
|
||
//Définition des blocks
|
||
$blocks = array(
|
||
'Siret',
|
||
'SiretSiege',
|
||
'TvaNumero',
|
||
'Isin',
|
||
'Capitalisation',
|
||
'NumRC',
|
||
'NumRM',
|
||
'AutreId',
|
||
'Actif',
|
||
'SituationJuridique',
|
||
'Situation',
|
||
'AutreSiren',
|
||
'RaisonSociale',
|
||
'Nom2',
|
||
'NomCommercial',
|
||
'EnseigneSigle',
|
||
'FormeJuridique',
|
||
'DateImmat',
|
||
'DateCreaEn',
|
||
'DateCreaEt',
|
||
'Adresse',
|
||
'RNVP',
|
||
'Zones',
|
||
'Tel',
|
||
'Fax',
|
||
'Web',
|
||
'Mail',
|
||
'Groupe',
|
||
'ActiviteEn',
|
||
'ActiviteEt',
|
||
'ActiviteArtisanale',
|
||
'Naf4',
|
||
'Nace',
|
||
'NatureActivite',
|
||
'SurfaceMagasin',
|
||
'OrigineFond',
|
||
'TypeExploitation',
|
||
'Saisonnalite',
|
||
'NbEtabActif',
|
||
'Capital',
|
||
'ChiffreAffaire',
|
||
'Dirigeants',
|
||
'Effectif',
|
||
'EffectifEtab'
|
||
);
|
||
|
||
$dBlock = $identite->formatBlock($blocks);
|
||
|
||
require_once 'Scores/Logo.php';
|
||
$logo = new Logo($infos->Siren, $infos->Isin);
|
||
$logoImg = array(
|
||
'label' => 'Logo',
|
||
'texte' => $logo->affiche(),
|
||
);
|
||
|
||
$this->view->assign('exportObjet', $infos);
|
||
$this->view->assign('dBlock', $dBlock);
|
||
$this->view->assign('logo', $logoImg);
|
||
$this->view->assign('dateDerMaj', $dateDerMaj);
|
||
$this->view->assign('datemajTexte', $datemajTexte);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$this->view->assign('infos', $infos);
|
||
$this->view->assign('siret', $infos->Siret);
|
||
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
|
||
|
||
$survDroits = array('survannonce', 'survinsee', 'survbilan', 'survscore', 'survactes', 'survdirigeants', 'survpriv');
|
||
$countSurvDroits = 0;
|
||
foreach ( $survDroits as $item ) {
|
||
if ($user->checkPerm($item)) $countSurvDroits++;
|
||
}
|
||
$this->view->assign('surveillance', $countSurvDroits);
|
||
|
||
}
|
||
|
||
$this->view->assign('AutrePage', $this->getRequest()->getParam('apage'));
|
||
}
|
||
|
||
/**
|
||
* Affichage de la fiche procédure collective
|
||
*/
|
||
public function fichepcAction()
|
||
{
|
||
//Vérification des permissions
|
||
$user = new Scores_Utilisateur();
|
||
if(!$user->checkPerm('idprocol')){
|
||
$this->forward('perms', 'error');
|
||
}
|
||
|
||
$siren = substr($this->siret,0,9);
|
||
//Modification du titre
|
||
if(empty($this->siret)){
|
||
$titre = 'Identifiant '.$this->id;
|
||
} else {
|
||
$titre = 'Siret '.$this->siret;
|
||
}
|
||
$this->view->headTitle()->prepend('Fiche procédure collective - '.$titre);
|
||
|
||
//Récupération des informations
|
||
$ws = new WsScores();
|
||
$infos = $ws->getIdentiteProcol($this->siret, $this->id);
|
||
if ($infos === false) $this->_forward('soap', 'error');
|
||
|
||
//Mise en session
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
$session->setInfoEntrep($infos->Identite);
|
||
|
||
//Element Fiche identite
|
||
$identite = new IdentiteEntreprise($infos->Identite);
|
||
//Définition des blocks
|
||
$blocks = array(
|
||
'Siret',
|
||
'SiretSiege',
|
||
'TvaNumero',
|
||
'Isin',
|
||
'Capitalisation',
|
||
'NumRC',
|
||
'AutreId',
|
||
'Actif',
|
||
'SituationJuridique',
|
||
'AutreSiren',
|
||
'RaisonSociale',
|
||
'EnseigneSigle',
|
||
'FormeJuridique',
|
||
'DateImmat',
|
||
'DateCreaEn',
|
||
'DateCreaEt',
|
||
'Adresse',
|
||
'Zones',
|
||
'Tel',
|
||
'Fax',
|
||
'Web',
|
||
'Mail',
|
||
'ActiviteEt',
|
||
'ActiviteEn',
|
||
'Naf4',
|
||
'Nace',
|
||
'NatureActivite',
|
||
'OrigineFond',
|
||
'TypeExploitation',
|
||
'Saisonnalite',
|
||
'NbEtabActif',
|
||
'Capital',
|
||
'ChiffreAffaire',
|
||
'Dirigeants',
|
||
'Effectif',
|
||
'EffectifEtab'
|
||
);
|
||
|
||
$dBlock = array();
|
||
foreach ($blocks as $item) {
|
||
$display = array(
|
||
'label' => method_exists($identite, 'get'.$item.'Label') ? $identite->{'get'.$item.'Label'}() : '',
|
||
'texte' => method_exists($identite, 'get'.$item.'Texte') ? $identite->{'get'.$item.'Texte'}() : '',
|
||
'titre' => method_exists($identite, 'get'.$item.'Titre') ? $identite->{'get'.$item.'Titre'}() : '',
|
||
);
|
||
$dBlock[$item] = $display;
|
||
}
|
||
|
||
require_once 'Scores/Logo.php';
|
||
$logo = new Logo($infos->Siren, $infos->Isin);
|
||
$logoImg = array(
|
||
'label' => 'Logo',
|
||
'texte' => $logo->affiche(),
|
||
);
|
||
$Identite = new stdClass();
|
||
$Identite->siret = $this->siret;
|
||
$Identite->dBlock = $dBlock;
|
||
$Identite->logo = $logo;
|
||
$Identite->AutrePage = 'fichepc';
|
||
$this->view->assign('Identite', $Identite);
|
||
|
||
//Element Fiche procédure collective
|
||
require_once 'Scores/IdentiteProcol.php';
|
||
$procol = new IdentiteProcol($infos);
|
||
$blocks = array(
|
||
'CessionOffreDate',
|
||
'CessionInvenDate',
|
||
'CessionDesc',
|
||
);
|
||
$dBlock = array();
|
||
foreach ($blocks as $item) {
|
||
$display = array(
|
||
'label' => method_exists($procol, 'get'.$item.'Label') ? $procol->{'get'.$item.'Label'}() : '',
|
||
'texte' => method_exists($procol, 'get'.$item.'Texte') ? $procol->{'get'.$item.'Texte'}() : '',
|
||
'titre' => method_exists($procol, 'get'.$item.'Titre') ? $procol->{'get'.$item.'Titre'}() : '',
|
||
);
|
||
$dBlock[$item] = $display;
|
||
}
|
||
$this->view->assign('dBlock', $dBlock);
|
||
$this->view->assign('infosProcol', $procol);
|
||
|
||
$this->view->assign('exportObjet', $infos);
|
||
$this->view->assign('infos', $infos);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$this->view->assign('fj', $session->getFormeJuridique());
|
||
|
||
}
|
||
|
||
/**
|
||
* Affichage de la liste des établissements
|
||
*/
|
||
public function etablissementsAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
|
||
$siren = substr($this->siret,0,9);
|
||
$actif = $request->getParam('actif', -1);
|
||
$this->view->headTitle()->prepend('Liste des établissements - Siren '.$siren);
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
$user = new Scores_Utilisateur();
|
||
|
||
//Pagination
|
||
$request = $this->getRequest();
|
||
$page = $request->getParam('page', 1);
|
||
if ( $page <= 0 ) $page = 1;
|
||
$nbAffichage = 50;
|
||
$position = ($page - 1 ) * $nbAffichage;
|
||
|
||
$ws = new WsScores();
|
||
$infos = $ws->getListeEtablissements($siren, $actif, $position, $nbAffichage);
|
||
if ($infos === false) $this->_forward('soap', 'error');
|
||
|
||
$etabs = $infos->result->item;
|
||
|
||
$this->view->assign('actif', $actif);
|
||
|
||
$nbEtabActif = 0;
|
||
$nbEtabRadie = 0;
|
||
if (count($etabs)>0) {
|
||
foreach ($etabs as $i => $etab) {
|
||
if ($etab->Actif==1){
|
||
$nbEtabActif++;
|
||
} else {
|
||
$nbEtabRadie++;
|
||
}
|
||
}
|
||
}
|
||
|
||
//Calcul pagination
|
||
$nbReponses = count($infos->result->item);
|
||
$nbReponsesTotal = $infos->nbReponses;
|
||
if ($nbReponses < $nbReponsesTotal) {
|
||
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
|
||
$pageCurrent = $page;
|
||
$pagePrev = $page - 1;
|
||
if ($pagePrev < 1) {
|
||
$pagePrev = 1;
|
||
}
|
||
$pageNext = $page + 1;
|
||
if( $pageNext > $pageTotal ) {
|
||
$pageNext = $pageTotal;
|
||
}
|
||
} else {
|
||
$pageTotal = $pageCurrent = 1;
|
||
}
|
||
$this->view->assign('PageTotal', $pageTotal);
|
||
$this->view->assign('PagePrev', $pagePrev);
|
||
$this->view->assign('PageNext', $pageNext);
|
||
$this->view->assign('PageCurrent', $pageCurrent);
|
||
|
||
$this->view->assign('nbEtabActif', $nbEtabActif);
|
||
$this->view->assign('nbEtabRadie', $nbEtabRadie);
|
||
$this->view->assign('nbEtabTotal', $nbReponsesTotal);
|
||
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('id', $this->id);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$this->view->assign('etabs', $etabs);
|
||
$this->view->assign('exportObjet', $etabs);
|
||
|
||
// Permet de verifier si la personne a la preference d'affichage des cartes.
|
||
$this->view->assign('hasPrefCarte', $user->checkPref('cartes'));
|
||
$this->view->assign('listeEtablissement', $infos);
|
||
}
|
||
|
||
/**
|
||
* Affichage des établissements sur une carte (Google Maps)
|
||
*/
|
||
public function carteAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$userAccessEdition = $user->checkModeEdition();
|
||
$this->view->AuthorizeGeocode = $userAccessEdition;
|
||
|
||
// --- Gestion source
|
||
$mapSource = 'openstreetmap';
|
||
if ($mapSource == 'google') {
|
||
$this->view->headScript()->appendFile('http://maps.google.com/maps/api/js?sensor=false', 'text/javascript');
|
||
}
|
||
if ($mapSource == 'openstreetmap') {
|
||
$this->view->headLink()->appendStylesheet('/libs/openstreetmap/ol.css', 'all');
|
||
$this->view->headScript()->appendFile('/libs/openstreetmap/ol.js', 'text/javascript');
|
||
}
|
||
$this->view->source = $mapSource;
|
||
|
||
// --- Marker
|
||
$siren = substr($this->siret,0,9);
|
||
$actif = $request->getParam('actif', -1);
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
$user = new Scores_Utilisateur();
|
||
|
||
$page = $request->getParam('page', 1);
|
||
if ( $page <= 0 ) $page = 1;
|
||
$nbAffichage = 50;
|
||
$position = ($page - 1 ) * $nbAffichage;
|
||
|
||
$ws = new WsScores();
|
||
$infos = $ws->getEtablissementsGeo($siren, $actif, $position, $nbAffichage);
|
||
$this->logger->info(print_r($infos,1));
|
||
if ($infos === false) $this->forward('soap', 'error');
|
||
|
||
$etabs = $infos->result->item;
|
||
|
||
$marqueurs = array();
|
||
|
||
if ( count($etabs)>0 ) {
|
||
foreach ($etabs as $i => $etab) {
|
||
if ($etab->Siege == 1) {
|
||
$type = 'Siège ';
|
||
} else {
|
||
$type = 'Etablissement ';
|
||
}
|
||
if ($etab->Actif == 1) {
|
||
$type .= 'actif';
|
||
} else {
|
||
$type .= 'inactif';
|
||
}
|
||
$type .= ' - '.$etab->NafEtabLib;
|
||
|
||
$titre = "$siren ".$etab->Nic." : $type<br/>";
|
||
if ($etab->Enseigne <> '') {
|
||
$titre .= 'Enseigne : '.$etab->Enseigne.'<br/>';
|
||
}
|
||
|
||
$texte = '';
|
||
$texte .= 'Etablissement : '.$etab->Nic.'<br/>';
|
||
$texte .= $etab->Adresse.'<br/>';
|
||
$adresse = $etab->Adresse.' ';
|
||
if ($etab->Adresse2 <> '') {
|
||
$texte .= $etab->Adresse2.'<br/>';
|
||
if (strlen(trim($adresse)) < 7) {
|
||
$adresse = $etab->Adresse2.' ';
|
||
}
|
||
}
|
||
$adresse .= $etab->CP.' '.$etab->Ville;
|
||
$texte.='<b>'.$etab->CP.' '.$etab->Ville.'</b><br/>';
|
||
$texte .= '</a>';
|
||
$texte .= '<br/>';
|
||
$texte .= '<i>'.$etab->NafEtab.' : '.$etab->NafEtabLib.'</i>';
|
||
|
||
|
||
$iconeMarqueur = $this->iconeDuMarqueur($etab->NafEtab, $etab->Siege, $etab->Actif);
|
||
$icone = 'etab1.png';
|
||
if ( !empty($iconeMarqueur) ) {
|
||
$icone = $iconeMarqueur;
|
||
}
|
||
$gps = array();
|
||
if ( floatval($etab->GeoLatitude) != 0 && floatval($etab->GeoLongitude) != 0 ) {
|
||
$gps = array(
|
||
'lat' => $etab->GeoLatitude*1,
|
||
'lon' => $etab->GeoLongitude*1,
|
||
);
|
||
}
|
||
|
||
$marks[] = array(
|
||
'siret' => $siren.' '.$etab->Nic,
|
||
'address' => $adresse,
|
||
'title' => $titre,
|
||
'text' => $texte,
|
||
'type' => $type,
|
||
'icon' => $icone,
|
||
'gps' => $gps,
|
||
);
|
||
}
|
||
$this->logger->info(print_r($marks,1));
|
||
}
|
||
$this->view->assign('marks', json_encode($marks));
|
||
}
|
||
|
||
protected function iconeDuMarqueur($naf, $siege, $actif)
|
||
{
|
||
if ($siege == 1) {
|
||
return 'siege'.$actif.'.png';
|
||
}
|
||
switch (substr($naf, 0, 2)) {
|
||
// A Agriculture, sylviculture et pêche
|
||
case '01': // Culture et production animale, chasse et services annexes
|
||
case '02': // Sylviculture et exploitation forestière
|
||
case '03': // Pêche et aquaculture
|
||
return 'tractor'.$actif.'.png';
|
||
// B Industries extractives
|
||
case '05': // Extraction de houille et de lignite
|
||
case '06': // Extraction d'hydrocarbures
|
||
case '07': // Extraction de minerais métalliques
|
||
case '08': // Aures industries extractives
|
||
case '09': // Services de soutien aux industries extractives
|
||
// C Industrie manufacturière
|
||
case '10': // Industries alimentaires
|
||
case '11': // Fabrication de boissons
|
||
case '12': // Fabrication de produits à base de tabac
|
||
case '13': // Fabrication de textiles
|
||
case '14': // Industrie de l'habillement
|
||
case '15': // Industrie du cuir et de la chaussure
|
||
case '16': // Travail du bois et fabrication d'articles en bois...
|
||
case '17': // Industrie du papier et du carton
|
||
case '18': // Imprimerie et reproduction d'enregistrements
|
||
case '19': // Cokéfaction et raffinage
|
||
case '20': // Industrie chimique
|
||
case '21': // Industrie pharmaceutique
|
||
case '22': // Fabrication de produits en caoutchouc et en plastique
|
||
case '23': // Fabrication d'autres produits minéraux non métalliques
|
||
case '24': // Métallurgie
|
||
case '25': // Fabrication de produits métalliques...
|
||
case '26': // Fabrication de produits informatiques...
|
||
case '27': // Fabrication d'équipements électriques
|
||
case '28': // Fabrication de machines et équipements n.c.a.
|
||
case '29': // Industrie automobile
|
||
case '30': // Fabrication d'autres matériels de transport
|
||
case '31': // Fabrication de meubles
|
||
case '32': // Autres industries manufacturières
|
||
case '33': // Réparation et installation de machines et d'équipements
|
||
// D Production et distribution d'électricité, de gaz, de vapeur...
|
||
case '35': // Production et distribution d'électricité, de gaz...
|
||
// E Production et distribution d'eau ; assainissement...
|
||
case '36': // Captage, traitement et distribution d'eau
|
||
case '37': // Collecte et traitement des eaux usées
|
||
case '38': // Collecte, traitement et élimination des déchets...
|
||
case '39': // Dépollution et autres services de gestion des déchets
|
||
// F Construction
|
||
case '41': // Construction de bâtiments
|
||
case '42': // Génie civil
|
||
case '43': // Travaux de construction spécialisés
|
||
return 'usine'.$actif.'.png';
|
||
// G Commerce ; réparation d'automobiles et de motocycles
|
||
case '45': // Commerce et réparation d'automobiles et de motocycles
|
||
case '46': // Commerce de gros, à l'exception des automobiles...
|
||
case '47': // Commerce de détail, à l'exception des automobiles...
|
||
return 'shop'.$actif.'.png';
|
||
// H Transports et entreposage
|
||
case '49': // Transports terrestres et transport par conduites
|
||
case '50': // Transports par eau
|
||
case '51': // Transports aériens
|
||
case '53': // Activités de poste et de courrier
|
||
return 'etab'.$actif.'.png';
|
||
case '52': // Entreposage et services auxiliaires des transports
|
||
return 'entrepot'.$actif.'.png';
|
||
// I Hébergement et restauration
|
||
case '55': // Hébergement
|
||
case '56': // Restauration
|
||
// J Information et communication
|
||
case '58': // Édition
|
||
case '59': // Production de films cinématographiques, de vidéo...
|
||
case '60': // Programmation et diffusion
|
||
case '61': // Télécommunications
|
||
case '62': // Programmation, conseil et autres activités informatiques
|
||
case '63': // Services d'information
|
||
// K Activités financières et d'assurance
|
||
case '64': // Activités des services financiers, hors assurance...
|
||
case '65': // Assurance
|
||
case '66': // Activités auxiliaires de services financiers et d'assurance
|
||
// L Activités immobilières
|
||
case '68': // Activités immobilières
|
||
// M Activités spécialisées, scientifiques et techniques
|
||
case '69': // Activités juridiques et comptables
|
||
case '70': // Activités des sièges sociaux ; conseil de gestion
|
||
case '71': // Activités d'architecture et d'ingénierie...
|
||
case '72': // Recherche-développement scientifique
|
||
case '73': // Publicité et études de marché
|
||
case '74': // Autres activités spécialisées, scientifiques et techniques
|
||
case '75': // Activités vétérinaires
|
||
// N Activités de services administratifs et de soutien
|
||
case '77': // Activités de location et location-bail
|
||
case '78': // Activités liées à l'emploi
|
||
case '79': // Activités des agences de voyage, voyagistes...
|
||
case '80': // Enquêtes et sécurité
|
||
case '81': // Services relatifs aux bâtiments et aménagement paysager
|
||
case '82': // Activités administratives et autres activités de soutien...
|
||
return 'etab'.$actif.'.png';
|
||
// O Administration publique
|
||
case '84': // Administration publique et défense ; sécurité sociale...
|
||
// P Enseignement
|
||
case '85': // Enseignement
|
||
return 'admin'.$actif.'.png';
|
||
// Q Santé humaine et action sociale
|
||
case '86': // Activités pour la santé humaine
|
||
case '87': // Hébergement médico-social et social
|
||
case '88': // Action sociale sans hébergement
|
||
// R Arts, spectacles et activités récréatives
|
||
case '90': // Activités créatives, artistiques et de spectacle
|
||
case '91': // Bibliothèques, archives, musées...
|
||
case '92': // Organisation de jeux de hasard et d'argent
|
||
case '93': // Activités sportives, récréatives et de loisirs
|
||
// S Autres activités de services
|
||
case '94': // Activités des organisations associatives
|
||
case '95': // Réparation d'ordinateurs et de biens personnels...
|
||
case '96': // Autres services personnels
|
||
// T Activités des ménages en tant qu'employeurs...
|
||
case '97': // Activités des ménages en tant qu'employeurs de personnel...
|
||
case '98': // Activités indifférenciées des ménages...
|
||
// U Activités extra-territoriales
|
||
case '99': // Activités des organisations et organismes extraterritoriaux
|
||
return 'etab'.$actif.'.png';
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Affichage des liens inter-entreprise
|
||
*/
|
||
public function liensAction()
|
||
{
|
||
$nbMonthForRecentLien = 3;
|
||
|
||
$this->view->headScript()->appendFile($this->theme->pathScript.'/identite-groupe.js', 'text/javascript');
|
||
$request = $this->getRequest();
|
||
$autrePage = $this->getRequest()->getParam('apage');
|
||
$lienRef = $request->getParam('lienref', null);
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->assign('edition', $user->checkModeEdition());
|
||
|
||
$ws = new WsScores();
|
||
if (!empty($autrePage)) {$ws->freeService=true;}
|
||
|
||
if ($lienRef) {
|
||
|
||
$this->view->assign('lienref', $lienRef);
|
||
|
||
if (empty($autrePage)) {
|
||
$this->view->headTitle()->prepend('Liens inter-entreprises - Id '.$lienRef);
|
||
}else{
|
||
$ws->freeService=true;
|
||
}
|
||
|
||
$identite = $ws->getLienRef($lienRef);
|
||
$this->view->assign('raisonSociale', $identite->raisonSociale);
|
||
$this->view->assign('identification', $identite->identification);
|
||
$this->view->assign('isin', $identite->isin);
|
||
$this->view->assign('actif', $identite->actif);
|
||
|
||
//Define SIREN if exist
|
||
if ( intval($identite->siren)!=0 ) {
|
||
$siren = $identite->siren;
|
||
$session = new Scores_Session_Entreprise($siren, null, true);
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('siret', $session->getSiret());
|
||
$this->view->assign('isin', $session->getIsin());
|
||
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
|
||
}
|
||
|
||
if ($identite->PpPm=='PP') {
|
||
$this->view->assign('PP', true);
|
||
$this->view->assign('nom', $identite->nom);
|
||
$this->view->assign('prenom', $identite->prenom);
|
||
$this->view->assign('civilite', $identite->civilite);
|
||
$this->view->assign('naissanceDate', $identite->naissanceDate);
|
||
}
|
||
|
||
//Get links
|
||
$infos = $ws->getLiensById($lienRef);
|
||
|
||
} else {
|
||
$siren = substr($this->siret,0,9);
|
||
|
||
if (empty($autrePage)) {
|
||
$this->view->headTitle()->prepend('Liens inter-entreprises - Siren '.$siren);
|
||
}
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
|
||
$this->view->assign('isin', $session->getIsin());
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$this->view->assign('surveillance', $user->checkPerm('liens'));
|
||
|
||
//Check access to display group link
|
||
if ( $user->checkPerm('GROUPE') ) {
|
||
$this->view->assign('liengroupe', $this->view->url(array(
|
||
'controller' => 'identite',
|
||
'action' => 'groupesarbo',
|
||
'siret' => $siren
|
||
), 'default', true) );
|
||
}
|
||
|
||
$infos = $ws->getLiens($siren);
|
||
if (is_string($infos) || $infos === false) $this->forward('soap', 'error');
|
||
}
|
||
|
||
if (isset($session)) {
|
||
//Special legal form, go to other display
|
||
if ( ($session->getFormeJuridique()>=1000 && $session->getFormeJuridique()<=1999)
|
||
|| ($session->getFormeJuridique()>=10 && $session->getFormeJuridique()<=19) ) {
|
||
$this->view->assign('PP', true);
|
||
|
||
//@todo : using this function is strange - How to get the id before ?
|
||
$result = $ws->searchLienRef($siren, 'siren');
|
||
if (count($result->item)>0) {
|
||
foreach ($result->item as $item) {
|
||
$id = $item->id;
|
||
break;
|
||
}
|
||
}
|
||
|
||
$result = $ws->getLienRef($id);
|
||
$this->view->assign('nom', $result->nom);
|
||
$this->view->assign('prenom', $result->prenom);
|
||
$this->view->assign('civilite', $result->civilite);
|
||
$this->view->assign('naissanceDate', $result->naissance_Date);
|
||
}
|
||
$ws->freeService=false;
|
||
|
||
if ( in_array($session->getFormeJuridique(), array(5488,5498,5720)) ) {
|
||
$this->view->assign('FJ1', true);
|
||
}
|
||
|
||
//Check access to display links to pdf items
|
||
if ( $user->checkPerm('ACTES') ) {
|
||
if ( $session->getFormeJuridique()>=3100 && $session->getFormeJuridique()<=3199
|
||
|| $session->getFormeJuridique()>=4000 && $session->getFormeJuridique()<=4999
|
||
|| $session->getFormeJuridique()>=5000 && $session->getFormeJuridique()<=5999
|
||
|| $session->getFormeJuridique()>=6000 && $session->getFormeJuridique()<=6999 ) {
|
||
|
||
$this->view->assign('lienStatuts', $this->view->url(array(
|
||
'controller' => 'pieces',
|
||
'action' => 'actes',
|
||
'siret' => $siren ), 'default', true) );
|
||
$this->view->assign('lienBilans', $this->view->url(array(
|
||
'controller' => 'pieces',
|
||
'action' => 'bilans',
|
||
'siret' => $siren ), 'default', true) );
|
||
}
|
||
}
|
||
}
|
||
|
||
$actionnaires = $infos->actionnaires->item;
|
||
$participations = $infos->participations->item;
|
||
$directions = $infos->directions->item;
|
||
|
||
$actionnaires = $participations = $directions = array();
|
||
|
||
if ( $infos->actionnaires->item ) {
|
||
$actionnaires = $infos->actionnaires->item;
|
||
}
|
||
if ( $infos->participations->item ) {
|
||
$participations = $infos->participations->item;
|
||
}
|
||
if ( $infos->directions->item ) {
|
||
$directions = $infos->directions->item;
|
||
}
|
||
|
||
$date = new Zend_Date();
|
||
$date->sub($nbMonthForRecentLien, Zend_Date::MONTH);
|
||
$this->view->assign('DateForRecentLien', $date);
|
||
|
||
$this->view->assign('exportObjet', $infos);
|
||
$this->view->assign('source', $source);
|
||
$this->view->assign('dateLien', $dateLien);
|
||
$this->view->assign('dateMaj', $dateMaj);
|
||
$this->view->assign('actionnaires', $actionnaires);
|
||
$this->view->assign('participations', $participations);
|
||
$this->view->assign('directions', $directions);
|
||
|
||
$this->view->assign('AutrePage', $this->getRequest()->getParam('apage'));
|
||
}
|
||
|
||
/**
|
||
* Fiche identite d'un lien
|
||
*/
|
||
public function lienficheAction()
|
||
{
|
||
$this->_helper->layout()->disableLayout();
|
||
$request = $this->getRequest();
|
||
|
||
//@todo :
|
||
$pays = array(
|
||
'FRA' => "France",
|
||
'AND' => "Andorre",
|
||
'ARE' => "Emirats Arabes Unis",
|
||
'AFG' => "Afghanistan",
|
||
'ATG' => "Antigua",
|
||
'AIA' => "Anguilla",
|
||
'ALB' => "Albanie",
|
||
'ARM' => "Arménie",
|
||
'ANT' => "Antilles Néerlandaises",
|
||
'AGO' => "Angola",
|
||
'ATA' => "Antarctique",
|
||
'ARG' => "Argentine",
|
||
'ASM' => "Samoa Américaines",
|
||
'AUT' => "Autriche",
|
||
'AUS' => "Australie",
|
||
'ABW' => "Aruba",
|
||
'AZE' => "Azerbaïdjan",
|
||
'BIH' => "Bosnie-Herzégovine",
|
||
'BRB' => "Barbade",
|
||
'BGD' => "Bangladesh",
|
||
'BEL' => "Belgique",
|
||
'BFA' => "Burkina Faso",
|
||
'BGR' => "Bulgarie",
|
||
'BHR' => "Bahreïn",
|
||
'BDI' => "Burundi",
|
||
'BEN' => "Bénin",
|
||
'BMU' => "Bermudes",
|
||
'BRN' => "Brunei",
|
||
'BOL' => "Bolivie",
|
||
'BRA' => "Brésil",
|
||
'BHS' => "Bahamas",
|
||
'BTN' => "Bhoutan",
|
||
'BVT' => "Iles Bouvet",
|
||
'BWA' => "Botswana",
|
||
'BLR' => "Biélorussie",
|
||
'BLZ' => "Bélize",
|
||
'CAN' => "Canada",
|
||
'CCK' => "Iles Cocos",
|
||
'CAF' => "République Centrafricaine",
|
||
'COG' => "Congo",
|
||
'CHE' => "Suisse",
|
||
'CIV' => "Côte d\'Ivoire",
|
||
'COK' => "Iles Cook",
|
||
'CHL' => "Chili",
|
||
'CMR' => "Cameroun",
|
||
'CHN' => "Chine",
|
||
'COL' => "Colombie",
|
||
'CRI' => "Costa Rica",
|
||
'CSK' => "Tchécoslovaquie",
|
||
'CUB' => "Cuba",
|
||
'CPV' => "Cap-Vert",
|
||
'CXR' => "Ile Christmas",
|
||
'CYP' => "Chypre",
|
||
'CZE' => "Rébublique Tchèque",
|
||
'DDR' => "République Démocratique Allemande",
|
||
'DEU' => "Allemagne",
|
||
'DJI' => "Djibouti",
|
||
'DNK' => "Danemark",
|
||
'DMA' => "Dominique",
|
||
'DOM' => "République Dominicaine",
|
||
'DZA' => "Algérie",
|
||
'ECU' => "Equateur",
|
||
'EST' => "Estonie",
|
||
'EGY' => "Egypte",
|
||
'ESH' => "Sahara Occidental",
|
||
'ERI' => "Eritrea",
|
||
'ESP' => "Espagne",
|
||
'ETH' => "Ethiopie",
|
||
'FIN' => "Finlande",
|
||
'FJI' => "Iles Fidji",
|
||
'FLK' => "Iles Malouines",
|
||
'FSM' => "Etats Fédérés de Micronésie",
|
||
'FRO' => "Iles Féroé",
|
||
'GAB' => "Gabon",
|
||
'GBR' => "Royaume-Uni",
|
||
'GRD' => "Grenade",
|
||
'GEO' => "Géorgie",
|
||
'GUF' => "Guinée française",
|
||
'GHA' => "Ghana",
|
||
'GIB' => "Gibraltar",
|
||
'GRL' => "Groënland",
|
||
'GMB' => "Gambie",
|
||
'GIN' => "Guinée",
|
||
'GLP' => "Guadeloupe",
|
||
'GNQ' => "Guinée Equatoriale",
|
||
'GRC' => "Grèce",
|
||
'SGS' => "Géorgie du sud & Iles Sandwich",
|
||
'GTM' => "Guatemala",
|
||
'GUM' => "Guam",
|
||
'GNB' => "Guinée-Bissau",
|
||
'GUY' => "Guyane",
|
||
'HKG' => "Hong Kong",
|
||
'HMD' => "Iles Heard et Mc Donald",
|
||
'HND' => "Honduras",
|
||
'HRV' => "Croatie",
|
||
'HTI' => "Haïti",
|
||
'HUN' => "Hongrie",
|
||
'IDN' => "Indonésie",
|
||
'IRL' => "Irlande",
|
||
'ISR' => "Israël",
|
||
'IND' => "Inde",
|
||
'IOT' => "Iles Vierges Britanniques",
|
||
'IRQ' => "Irak",
|
||
'IRN' => "Iran",
|
||
'ISL' => "Islande",
|
||
'ITA' => "Italie",
|
||
'JAM' => "Jamaïque",
|
||
'JOR' => "Jordanie",
|
||
'JPN' => "Japon",
|
||
'KEN' => "Kenya",
|
||
'KGZ' => "Kirghizistan",
|
||
'KHM' => "Cambodge",
|
||
'KIR' => "Kiribati",
|
||
'COM' => "Comores",
|
||
'KNA' => "Saint-Kitts",
|
||
'PRK' => "Corée",
|
||
'KOR' => "République de Corée",
|
||
'KWT' => "Koweït",
|
||
'CYM' => "Iles Caïman",
|
||
'KAZ' => "Kazakhstan",
|
||
'LAO' => "Laos",
|
||
'LBN' => "Liban",
|
||
'LCA' => "Sainte-Lucie",
|
||
'LIE' => "Liechtenstein",
|
||
'LKA' => "Sri Lanka",
|
||
'LBR' => "Libéria",
|
||
'LSO' => "Lesotho",
|
||
'LTU' => "Lithuanie",
|
||
'LUX' => "Luxembourg",
|
||
'LVA' => "Lettonie",
|
||
'LBY' => "Libye",
|
||
'MAR' => "Maroc",
|
||
'MCO' => "Monaco",
|
||
'MDA' => "Moldavie",
|
||
'MDG' => "Madagascar",
|
||
'MHL' => "Iles Marshall",
|
||
'MKD' => "Macédoine",
|
||
'MLI' => "Mali",
|
||
'MMR' => "Myanmar",
|
||
'MNG' => "Mongolie",
|
||
'MAC' => "Macao",
|
||
'MNP' => "Iles Mariannes",
|
||
'MTQ' => "Martinique",
|
||
'MRT' => "Mauritanie",
|
||
'MSR' => "Montserrat",
|
||
'MLT' => "Malte",
|
||
'MUS' => "Ile Maurice",
|
||
'MDV' => "Maldives",
|
||
'MWI' => "Malawi",
|
||
'MEX' => "Mexique",
|
||
'MYS' => "Malaisie",
|
||
'MOZ' => "Mozambique",
|
||
'NAM' => "Namibie",
|
||
'NCL' => "Nouvelle Calédonie",
|
||
'NER' => "Niger",
|
||
'NFK' => "Iles Norfolk",
|
||
'NGA' => "Nigeria",
|
||
'NIC' => "Nicaragua",
|
||
'NLD' => "Pays-Bas",
|
||
'NOR' => "Norvège",
|
||
'NPL' => "Népal",
|
||
'NRU' => "Nauru",
|
||
'NTZ' => "Zone Neutre",
|
||
'NIU' => "Niue",
|
||
'NZL' => "Nouvelle Zélande",
|
||
'OMN' => "Oman",
|
||
'PAN' => "Panama",
|
||
'PER' => "Pérou",
|
||
'PYF' => "Polynésie Francaise",
|
||
'PNG' => "Papouasie Nouvelle-Guinée",
|
||
'PHL' => "Philippines",
|
||
'PAK' => "Pakistan",
|
||
'POL' => "Pologne",
|
||
'SPM' => "Saint Pierre et Miquelon",
|
||
'PCN' => "Pitcairn",
|
||
'PRI' => "Porto Rico",
|
||
'PRT' => "Portugal",
|
||
'PLW' => "Palau",
|
||
'PRY' => "Paraguay",
|
||
'QAT' => "Qatar",
|
||
'REU' => "Ile de la Réunion",
|
||
'ROM' => "Roumanie",
|
||
'RUS' => "Russie",
|
||
'RWA' => "Rwanda",
|
||
'SAU' => "Arabie Saoudite",
|
||
'SLB' => "Iles Salomon",
|
||
'SYC' => "Seychelles",
|
||
'SDN' => "Soudan",
|
||
'SWE' => "Suède",
|
||
'SGP' => "Singapour",
|
||
'SHN' => "Sainte-Hélène",
|
||
'SVN' => "Slovénie",
|
||
'SJM' => "Spitsberg et lle Jan Mayen",
|
||
'SVK' => "Slovaquie",
|
||
'SLE' => "Sierra Leone",
|
||
'SMR' => "Saint-Marin",
|
||
'SEN' => "Sénégal",
|
||
'SOM' => "Somalie",
|
||
'SUR' => "Surinam",
|
||
'STP' => "São Tomé et Principe",
|
||
'SUN' => "URSS",
|
||
'SLV' => "Salvador",
|
||
'SYR' => "Syrie",
|
||
'SWZ' => "Swaziland",
|
||
'TCA' => "Iles Turques et Caïques",
|
||
'TCD' => "Tchad",
|
||
'ATF' => "Terres Australes Francaises",
|
||
'TGO' => "Togo",
|
||
'THA' => "Thaïlande",
|
||
'TJK' => "Tadjikistan",
|
||
'TKL' => "Iles Tokélaou",
|
||
'TKM' => "Turkménistan",
|
||
'TUN' => "Tunisie",
|
||
'TON' => "Tonga",
|
||
'TMP' => "Timor Oriental",
|
||
'TUR' => "Turquie",
|
||
'TTO' => "Trinité-et-Tobago",
|
||
'TUV' => "Tuvalu",
|
||
'TWN' => "Taïwan, République de Chine",
|
||
'TZA' => "Tanzanie",
|
||
'UKR' => "Ukraine",
|
||
'UGA' => "Ouganda",
|
||
'UMI' => "Iles mineures éloignées des E.U",
|
||
'USA' => "Etats Unis",
|
||
'URY' => "Uruguay",
|
||
'UZB' => "Ouzbékistan",
|
||
'VAT' => "Vatican",
|
||
'VCT' => "Saint Vincent et les Grenadines",
|
||
'VEN' => "Vénézuéla",
|
||
'VGB' => "Iles Vierges Britaniques",
|
||
'VIR' => "Iles Vierges U.S",
|
||
'VNM' => "Vietnam",
|
||
'VUT' => "Vanuatu",
|
||
'WLF' => "Wallis et Futuna",
|
||
'WSM' => "Samoa Américaines",
|
||
'XBA' => "Rép. Turque de Chypre",
|
||
'YMD' => "Yémen (République Démocratique)",
|
||
'YEM' => "Yemen",
|
||
'MYT' => "Mayotte",
|
||
'YUG' => "Yougoslavie",
|
||
'ZAF' => "Afrique du sud",
|
||
'ZMB' => "Zambie",
|
||
'ZAR' => "Zaïre",
|
||
'ZWE' => "Zimbabwe");
|
||
$this->view->assign('countries', $pays);
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->assign('edition', $user->checkModeEdition());
|
||
|
||
$id = $request->getParam('idFiche');
|
||
$this->view->assign('idFiche', $id);
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getLienRef($id);
|
||
$this->logger->info(print_r($result,1));
|
||
$this->view->assign('result', $result);
|
||
|
||
$this->view->assign('idFiche', $id);
|
||
}
|
||
|
||
/**
|
||
* Documents liées à une fiche lien
|
||
*/
|
||
public function liendocAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
$type = $request->getParam('type');
|
||
$id = $request->getParam('id');
|
||
|
||
if ( $type == 'Lien' ) {
|
||
$this->_helper->layout()->disableLayout();
|
||
}
|
||
|
||
$ws = new WsScores();
|
||
$docs = $ws->getLienDoc($id, $type);
|
||
|
||
$this->view->assign('docs', $docs->item);
|
||
}
|
||
|
||
/**
|
||
* Affichage des modifications Insee
|
||
*/
|
||
public function evenementsAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
|
||
$siren = substr($this->siret,0,9);
|
||
$nic = $request->getParam('nic', null);
|
||
|
||
$this->view->headTitle()->prepend('Evènements - Siren '.$siren);
|
||
|
||
//Pagination
|
||
$page = $request->getParam('page', 1);
|
||
if ( $page <= 0 ) $page = 1;
|
||
$nbAffichage = 50;
|
||
$position = ($page - 1 ) * $nbAffichage;
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
|
||
/*
|
||
Par défaut, si on est sur un siège actif ou non, afficher tous les évènements de l'entreprise.
|
||
Si on est sur un NIC établissement actif ou radié, afficher juste les évènements de l'établissement.
|
||
*/
|
||
|
||
if ( $nic === null ) {
|
||
$this->view->assign('Entreprise', 1);
|
||
if ( strlen($this->siret) == 9 ) {
|
||
$this->view->assign('Nic', substr($session->getSiretSiege(),9,5));
|
||
} else {
|
||
$this->view->assign('Nic', substr($this->siret,9,5));
|
||
}
|
||
$nic = 0;
|
||
} else {
|
||
$this->view->assign('Entreprise', 0);
|
||
$this->view->assign('Nic', $nic);
|
||
}
|
||
|
||
$ws = new WsScores();
|
||
$infos = $ws->getListeEvenements($siren, $nic, $position, $nbReponses);
|
||
if ($infos === false) {
|
||
$this->forward('soap', 'error');
|
||
}
|
||
$evens = $infos->result->item;
|
||
|
||
$this->view->assign('evens', $evens);
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('id', $this->id);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$this->view->assign('exportObjet', $evens);
|
||
|
||
//Calcul pagination
|
||
$nbReponses = count($evens);
|
||
$nbReponsesTotal = $infos->nbReponses;
|
||
if ($nbReponses < $nbReponsesTotal) {
|
||
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
|
||
$pageCurrent = $page;
|
||
$pagePrev = $page - 1;
|
||
if ($pagePrev < 1) {
|
||
$pagePrev = 1;
|
||
}
|
||
$pageNext = $page + 1;
|
||
if( $pageNext > $pageTotal ) {
|
||
$pageNext = $pageTotal;
|
||
}
|
||
} else {
|
||
$pageTotal = $pageCurrent = 1;
|
||
}
|
||
$this->view->assign('PageTotal', $pageTotal);
|
||
$this->view->assign('PagePrev', $pagePrev);
|
||
$this->view->assign('PageNext', $pageNext);
|
||
$this->view->assign('PageCurrent', $pageCurrent);
|
||
|
||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
|
||
}
|
||
|
||
/**
|
||
* Affichage des news
|
||
*/
|
||
public function newsAction()
|
||
{
|
||
$googleNews = true;
|
||
$nbNews = 15;
|
||
|
||
$user = new Scores_Utilisateur();
|
||
if ($user->checkPref('news'))
|
||
{
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
|
||
$items = array();
|
||
if ($googleNews!==false){
|
||
|
||
$url = 'http://news.google.fr/news?hl=fr&gl=fr&q='.
|
||
urlencode($session->getRaisonSociale()).'&output=rss';
|
||
|
||
$items = array();
|
||
try {
|
||
$canal = new Zend_Feed_Rss($url);
|
||
} catch (Exception $e) {
|
||
//Do nothing
|
||
}
|
||
|
||
if (count($canal)>0)
|
||
{
|
||
$i=0;
|
||
foreach ($canal as $element)
|
||
{
|
||
$items[] = $element;
|
||
$i++;
|
||
if ($i==$nbNews) break;
|
||
}
|
||
}
|
||
}
|
||
$this->view->assign('items', $items);
|
||
} else {
|
||
$this->view->assign('disable', true);
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
* Téléchargement d'un avis de situation
|
||
*/
|
||
public function avisAction()
|
||
{
|
||
$this->_helper->layout()->disableLayout();
|
||
$this->_helper->viewRenderer->setNoRender(true);
|
||
|
||
// --- En environement de preprod, on envoi sur le site
|
||
if (APPLICATION_ENV == 'staging') {
|
||
$this->redirect('http://avis-situation-sirene.insee.fr/');
|
||
}
|
||
// --- Téléchargement du fichier et distribution
|
||
else {
|
||
$avis = new Scores_Insee_AvisSituation($this->siret);
|
||
if ( !$avis->erreur() ) {
|
||
$avis->erreurcpt('raz');
|
||
$file = $avis->get();
|
||
if ($file === false) {
|
||
$avis->erreurcpt('plus');
|
||
echo $avis->erreurmsg();
|
||
} else {
|
||
// --- Envoi du fichier sur la sortie standard
|
||
$content_type = 'application/pdf';
|
||
if ( file_exists($file) ) {
|
||
$ws = new WsScores();
|
||
$ws->setLog('avis_situation', $this->siret, 0, '');
|
||
$modules = array(); //apache_get_modules();
|
||
if (in_array('mod_xsendfile', $modules)) {
|
||
header ('X-Sendfile: ' . $file);
|
||
header ('Content-Type: ' . $content_type);
|
||
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
|
||
exit;
|
||
} else {
|
||
ini_set('zlib.output_compression', '0');
|
||
header('Content-Transfer-Encoding: none');
|
||
header('Content-Type: ' . $content_type.'');
|
||
header('Content-Length: ' . filesize($file));
|
||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
|
||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||
header('Pragma: public');
|
||
readfile($file);
|
||
exit;
|
||
}
|
||
} else {
|
||
echo "Impossible de charger le fichier";
|
||
}
|
||
}
|
||
} else {
|
||
if ($avis->nberreur()==5){
|
||
$avis->mailerreur();
|
||
}
|
||
$avis->erreurcpt('plus');
|
||
echo $avis->erreurmsg();
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Téléchargement des cartes IRIS
|
||
*/
|
||
public function irisAction()
|
||
{
|
||
$this->_helper->layout()->disableLayout();
|
||
$this->_helper->viewRenderer->setNoRender(true);
|
||
|
||
$request = $this->getRequest();
|
||
$codeCommune = $request->getParam('code');
|
||
// ==> Start
|
||
$iris = new Scores_Insee_Iris($codeCommune);
|
||
$body = $iris->get('pdf');
|
||
if($body !== false) {
|
||
header("Pragma: public");
|
||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||
header("Cache-Control: must-revalidate");
|
||
header("Content-type: application/pdf");
|
||
header("Content-Length: ".strlen($body));
|
||
header('Content-disposition: inline; filename="carte_iris_'.$codeCommune.'.pdf"');
|
||
header("Accept-Ranges: ".strlen($body));
|
||
echo $body;
|
||
} else {
|
||
echo $iris->erreur();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Informations géographiques
|
||
*/
|
||
public function geoAction()
|
||
{
|
||
$infos = $this->getRequest()->getParam('infos');
|
||
|
||
// Text
|
||
$google = new Scores_Google_Maps();
|
||
$decLat = $google->dec2dms($infos->GeoLat);
|
||
$decLon = $google->dec2dms($infos->GeoLon);
|
||
$mapsHref = $google->getGoogleMapLink(urlencode(
|
||
$infos->AdresseNum.', '.$infos->AdresseVoie.' '.
|
||
htmlspecialchars_decode($infos->AdresseRue, ENT_QUOTES).
|
||
', '.$infos->CP.' '.$infos->Ville));
|
||
|
||
$this->view->assign('mapsHref', $mapsHref);
|
||
$this->view->assign('decLat', $decLat);
|
||
$this->view->assign('decLon', $decLon);
|
||
$this->view->assign('infos', $infos);
|
||
|
||
// Img
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->assign('facade', $user->checkPref('mappy'));
|
||
require_once 'Scores/Mappy.php';
|
||
|
||
$mappy = new Mappy();
|
||
if ($mappy->villeCouverte($infos->Ville))
|
||
{
|
||
$this->view->assign('source', 'mappy');
|
||
|
||
$adresse = '';
|
||
$adresse.= $infos->AdresseNum;
|
||
|
||
//Corriger la voie pour Mappy
|
||
$adresse.= ' '.strtr($infos->AdresseVoie, array(
|
||
'R' => 'RUE',
|
||
'AV' => 'AVENUE',
|
||
'RLE' => 'RUELLE',
|
||
));
|
||
|
||
$adresse.= ' '.$infos->AdresseRue;
|
||
$adresse.= ' '.$infos->Ville;
|
||
|
||
//Définir le pays
|
||
if ($infos->Pays == '') {
|
||
$adresse.= ' FRANCE';
|
||
} else {
|
||
$adresse.= ' '.$infos->Pays;
|
||
}
|
||
|
||
$this->view->assign('adresse', $adresse);
|
||
$this->view->assign('lienJs', $mappy->getJs());
|
||
}
|
||
else
|
||
{
|
||
$this->view->assign('source', 'google');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Display streetview image
|
||
*/
|
||
public function streetviewAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
$num = $request->getParam('heading', 0);
|
||
|
||
// --- Prepare information
|
||
if ($request->isXmlHttpRequest()) {
|
||
$this->_helper->layout()->disableLayout();
|
||
$siret = $request->getParam('siret');
|
||
$lat = $request->getParam('lat', '');
|
||
$lon = $request->getParam('lon', '');
|
||
$address = $request->getParam('address');
|
||
} else {
|
||
$infos = $request->getParam('infos');
|
||
$siret = $infos->Siret;
|
||
$lat = $infos->GeoLat;
|
||
$lon = $infos->GeoLon;
|
||
|
||
$adresse = '';
|
||
if (intval($infos->AdresseNum)>0) {
|
||
$adresse.= intval($infos->AdresseNum).' ';
|
||
}
|
||
|
||
//Corriger la voie
|
||
$adresse.= strtr($infos->AdresseVoie, array(
|
||
'R' => 'RUE',
|
||
'AV' => 'AVENUE',
|
||
'RLE' => 'RUELLE',
|
||
));
|
||
|
||
$adresse.= ' '.$infos->AdresseRue;
|
||
$adresse.= ', '.$infos->Ville;
|
||
|
||
//Définir le pays
|
||
if ($infos->Pays == '') {
|
||
$adresse.= ', FRANCE';
|
||
} else {
|
||
$adresse.= ', '.$infos->Pays;
|
||
}
|
||
}
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->AuthorizeUpdate = $user->checkModeEdition();
|
||
|
||
$this->view->assign('siret', $siret);
|
||
$this->view->assign('lat', $lat);
|
||
$this->view->assign('lon', $lon);
|
||
|
||
$file = false;
|
||
|
||
if (intval($siret) < 1000) {
|
||
$this->view->assign('url', false);
|
||
} else {
|
||
$streetview = new Scores_Google_Streetview($siret);
|
||
|
||
// --- Affichage GPS
|
||
if ($lat != '' && $lon != '') {
|
||
$this->view->assign('streetviewMode', 'GPS');
|
||
$deg = $streetview->getNumDeg();
|
||
$nbImg = count($deg);
|
||
$pagePrec = $num-1;
|
||
if ($pagePrec<=0) {
|
||
$pagePrec = $nbImg-1;
|
||
}
|
||
$pageSuiv = $num+1;
|
||
if($pageSuiv>=$nbImg) {
|
||
$pageSuiv = 0;
|
||
}
|
||
$this->view->assign('pagePrec', $pagePrec);
|
||
$this->view->assign('pageSuiv', $pageSuiv);
|
||
|
||
$streetview->setLocationGeo($lat, $lon);
|
||
$heading = $deg[$num];
|
||
$streetview->setHeading($heading);
|
||
}
|
||
// --- Fallback adresse
|
||
elseif (!empty($adresse)) {
|
||
$this->view->assign('streetviewMode', 'ADDRESS');
|
||
$streetview->setLocationTxt($adresse);
|
||
}
|
||
|
||
$file = $streetview->pathImg();
|
||
if ($file !== false) {
|
||
$this->view->assign('url', '/file/streetview/img/q/'.$streetview->fileImg());
|
||
$this->view->assign('cache', 1);
|
||
$this->view->assign('saveas', '');
|
||
} else {
|
||
$this->view->assign('url', $streetview->urlImg());
|
||
$this->view->assign('cache', 0);
|
||
$this->view->assign('saveas', $streetview->fileImg());
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Impression capture image arborescence du groupe
|
||
*/
|
||
public function groupesarboimgAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
|
||
$siren = substr($this->siret,0,9);
|
||
$this->view->assign('siret', $siren);
|
||
|
||
$pctMin = $request->getParam('pctMin', 33);
|
||
$this->view->assign('pctMin', $pctMin);
|
||
|
||
$isin = $request->getParam('isin', 1);
|
||
$this->view->assign('isin', $isin);
|
||
if ($isin==0){
|
||
$stopAtIsin = false;
|
||
} else {
|
||
$stopAtIsin = true;
|
||
}
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->assign('edition', $user->checkModeEdition());
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getGroupesArbo($siren, $pctMin, 10, $stopAtIsin);
|
||
if ( $result!==false ) {
|
||
$infos = json_decode($result, true);
|
||
$this->logger->info(print_r($infos,1));
|
||
if (count($infos)>0) {
|
||
|
||
$name = $infos['name'];
|
||
if ( $infos['siren']!='000000000' ) {
|
||
$name.= ' ('.$infos['siren'].')';
|
||
}
|
||
|
||
$structure = array();
|
||
$structure[] = array(
|
||
'text' => $name,
|
||
'state' => array('opened'=>true),
|
||
'children' => $this->groupesArboChildren($infos['children'], $siren),
|
||
);
|
||
$this->view->assign('data', json_encode($structure));
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Arborescence du groupe
|
||
*/
|
||
public function groupesarboAction()
|
||
{
|
||
$this->_helper->layout()->disableLayout();
|
||
$siren = substr($this->siret,0,9);
|
||
$this->view->assign('siret', $siren);
|
||
|
||
$request = $this->getRequest();
|
||
$pctMin = $request->getParam('pctMin', 33);
|
||
$this->view->assign('pctMin', $pctMin);
|
||
|
||
$isin = $request->getParam('isin', 1);
|
||
$this->view->assign('isin', $isin);
|
||
if ($isin==0){
|
||
$stopAtIsin = false;
|
||
} else {
|
||
$stopAtIsin = true;
|
||
}
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->assign('edition', $user->checkModeEdition());
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getGroupesArbo($siren, $pctMin, 10, $stopAtIsin);
|
||
|
||
if ( $result!==false ) {
|
||
$infos = json_decode($result, true);
|
||
$this->logger->info(print_r($infos,1));
|
||
if (count($infos)>0) {
|
||
|
||
$sirenTxt = substr($infos['siren'],0,3).' '.substr($infos['siren'],3,3).' '.substr($infos['siren'],6,3);
|
||
|
||
$name = $infos['name'];
|
||
if ( intval($infos['siren'])!=0 ) {
|
||
$name.= ' ( '.$sirenTxt.' )';
|
||
} else {
|
||
$name.= ' ( '.$infos['pays'].' )';
|
||
}
|
||
|
||
$structure = array();
|
||
$structure[] = array(
|
||
'text' => $name,
|
||
'state' => array('opened'=>true),
|
||
'children' => $this->groupesArboChildren($infos['children'], $siren),
|
||
);
|
||
$this->view->assign('data', json_encode($structure));
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Récursivité pour l'arborescence du groupe
|
||
* @param unknown $items
|
||
* @param string $detectSiren
|
||
* @return multitype:multitype:string multitype: multitype:multitype:string multitype: NULL
|
||
*/
|
||
public function groupesArboChildren($items, $detectSiren = '')
|
||
{
|
||
$output = array();
|
||
if ( count($items)>0 ) {
|
||
foreach ( $items as $item ) {
|
||
|
||
$sirenTxt = substr($item['siren'],0,3).' '.substr($item['siren'],3,3).' '.substr($item['siren'],6,3);
|
||
|
||
$name = $item['name'];
|
||
if ( intval($item['siren'])!=0 ) {
|
||
$name.= ' (<a href="'.$this->view->url(array(
|
||
'controller'=>'identite',
|
||
'action'=>'fiche',
|
||
'siret' => $item['siren']), 'default', true).'">'.$sirenTxt.'</a>)';
|
||
} else {
|
||
$name.= ' ('.$item['pays'].')';
|
||
}
|
||
$name.= ' - '.$item['pmin'].'%';
|
||
|
||
$structure = array(
|
||
'text' => $name,
|
||
'state' => array('opened'=>true),
|
||
);
|
||
|
||
if ($item['siren']==$detectSiren) {
|
||
$structure['class'] = 'jstree-search';
|
||
}
|
||
|
||
if (count($item['children'])>0){
|
||
$structure['children'] = $this->groupesArboChildren($item['children'], $detectSiren);
|
||
} else {
|
||
$structure['children'] = array();
|
||
}
|
||
$output[] = $structure;
|
||
}
|
||
}
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Groupe
|
||
*/
|
||
public function groupeAction()
|
||
{
|
||
$this->view->headScript()->appendFile($this->theme->pathScript.'/identite-groupe.js', 'text/javascript');
|
||
$this->view->headTitle()->prepend("Groupe");
|
||
$this->view->headTitle()->prepend("Siret ".$this->siret);
|
||
|
||
$siren = substr($this->siret,0,9);
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getGroupeInfos($siren);
|
||
if ($result === false) {
|
||
$this->forward('soap', 'error');
|
||
}
|
||
|
||
$this->view->assign('result', $result);
|
||
$this->view->assign('siren', $siren);
|
||
}
|
||
|
||
/**
|
||
* Contact Data
|
||
*/
|
||
public function contactsAction()
|
||
{
|
||
$this->view->headTitle()->prepend("Contacts");
|
||
$this->view->headTitle()->prepend("Siret ".$this->siret);
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->assign('edition', $user->checkModeEdition());
|
||
|
||
$request = $this->getRequest();
|
||
$this->view->assign('siret', $this->siret);
|
||
$siren = substr($this->siret, 0, 9);
|
||
|
||
$all = $request->getParam('get');
|
||
if ($all == 'all') {
|
||
$companyId = substr($this->siret,0,9);
|
||
$this->view->assign('all', true);
|
||
} else {
|
||
$companyId = $this->siret;
|
||
}
|
||
|
||
$filter = $request->getParam('filter');
|
||
$this->view->assign('filter', $filter);
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getContactEt($companyId, $filter);
|
||
|
||
$this->logger->info(print_r($result,1));
|
||
|
||
if ($result->nbReponses>0) {
|
||
$this->view->assign('contacts', $result->result->item);
|
||
}
|
||
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$this->view->assign('siren', $siren);
|
||
}
|
||
|
||
/**
|
||
* Corporama
|
||
* Intégration en ajax du lien corporama
|
||
* Solutions de prospection et de veille entreprise
|
||
*/
|
||
public function corporamaAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
|
||
$this->view->assign('siret', $this->siret);
|
||
$siren = substr($this->siret, 0, 9);
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||
|
||
$corporamaUrl = "http://corporama.com/search?siren=".$siren."&company=".urlencode($session->getRaisonSociale())."&partner=sd268";
|
||
$this->view->assign('corporamaUrl', $corporamaUrl);
|
||
|
||
if ( $request->isXmlHttpRequest() || $request->getParam('include') ) {
|
||
|
||
$this->_helper->layout()->disableLayout();
|
||
$this->_helper->viewRenderer->setNoRender(true);
|
||
|
||
$page = file_get_contents($corporamaUrl, false);
|
||
if ($page === false) {
|
||
echo "Erreur";
|
||
}
|
||
$this->view->assign('page', $page);
|
||
|
||
}
|
||
|
||
$ws = new WsScores();
|
||
$ws->setLog('corporama', $this->siret);
|
||
}
|
||
|
||
/**
|
||
* Avis de situation RNCS
|
||
*/
|
||
public function avisrncsAction()
|
||
{
|
||
//Vérification des permissions
|
||
$user = new Scores_Utilisateur();
|
||
if( !$user->checkPerm('avisrncs') ){
|
||
$this->forward('perms', 'error');
|
||
}
|
||
|
||
$request = $this->getRequest();
|
||
|
||
$this->view->assign('siret', $this->siret);
|
||
$siren = substr($this->siret, 0, 9);
|
||
|
||
$infos = null;
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getEntrepriseAvisRncs($siren);
|
||
$this->logger->info(print_r($result,1));
|
||
|
||
if ( $result === false ) {
|
||
$this->view->assign('error', true);
|
||
}
|
||
elseif ( is_string($result) ) {
|
||
$this->view->assign('message', $result);
|
||
} else {
|
||
|
||
$locale = new Zend_Locale('fr_FR');
|
||
|
||
$date = new Zend_Date();
|
||
$this->view->assign('AvisDateTxt', $date->toString(Zend_Date::DATE_LONG));
|
||
|
||
if ($result->RadiationDate !== null && $result->RadiationDate != '0000-00-00' ) {
|
||
$date = new Zend_Date($result->RadiationDate, 'yyyy-MM-dd');
|
||
$this->view->assign('RadiationDate', $date->toString('dd/MM/yyyy'));
|
||
}
|
||
|
||
$this->view->assign('Nom', $result->Nom);
|
||
$this->view->assign('Sigle', $result->Sigle);
|
||
$this->view->assign('Enseigne', $result->Enseigne);
|
||
$this->view->assign('NomCommercial', $result->NomCommercial);
|
||
$this->view->assign('Siren', $result->Siren);
|
||
$this->view->assign('Tribunal', $result->TribunalLabel);
|
||
|
||
$this->view->assign('NumGest', $result->NumGest); // 4 ou 2 + 1 lettre +
|
||
|
||
if ($result->ImmatDate === null || $result->ImmatDate=='0000-00-00 00:00:00' ) {
|
||
$this->view->assign('ImmatDate', '');
|
||
} else {
|
||
$date = new Zend_Date($result->ImmatDate, 'yyyy-MM-dd');
|
||
$this->view->assign('ImmatDate', $date->toString('dd/MM/yyyy'));
|
||
}
|
||
|
||
$this->view->assign('FormeJuridique', $result->FjLabel);
|
||
$this->view->assign('Capital', number_format($result->Capital, 0, ',', ' ').' '.$result->CapitalDev);
|
||
$this->view->assign('SiegeAdresse', $result->SiegeAdresseNum . ' ' .
|
||
$result->SiegeAdresseVoieType . ' ' .
|
||
$result->SiegeAdresseVoieLabel . ' ' .
|
||
$result->SiegeAdresseCP . ' ' .
|
||
$result->SiegeAdresseVille);
|
||
|
||
|
||
if ( $result->CompteArretMois === null ) {
|
||
$this->view->assign('CompteArretDate', '');
|
||
} else {
|
||
$date = new Zend_Date();
|
||
$date->set($result->CompteArretMois, Zend_Date::MONTH, $locale);
|
||
$this->view->assign('CompteArretDate', $result->CompteArretJour . ' ' . $date->toString(Zend_Date::MONTH_NAME));
|
||
}
|
||
|
||
if ( $result->ConstitutionDepotDate === null || $result->ConstitutionDepotDate == '0000-00-00 00:00:00') {
|
||
$this->view->assign('ConstitutionDepotDate', '-');
|
||
} else {
|
||
$date = new Zend_Date($result->ConstitutionDepotDate, 'yyyy-MM-dd');
|
||
$this->view->assign('ConstitutionDepotDate', $date->toString('dd/MM/yyyy'));
|
||
}
|
||
|
||
if ( $result->ConstitutionActeDate === null || $result->ConstitutionActeDate == '0000-00-00 00:00:00') {
|
||
$this->view->assign('ConstitutionActeDate', '-');
|
||
} else {
|
||
$date = new Zend_Date($result->ConstitutionActeDate, 'yyyy-MM-dd');
|
||
$this->view->assign('ConstitutionActeDate', $date->toString('dd/MM/yyyy'));
|
||
}
|
||
|
||
$administration = array();
|
||
foreach ($result->Administration->item as $item) {
|
||
|
||
$lineP1 = $item->Label;
|
||
|
||
if ( $item->CompanyName != '' ) {
|
||
$lineP2 = $item->CompanyName;
|
||
if ( intval($item->CompanyId) != 0 ) {
|
||
$lineP2.= ' ('.$item->CompanyId.')';
|
||
}
|
||
} else {
|
||
$lineP2 = $item->Civilite . ' ' .
|
||
$item->Nom . ' ' .
|
||
$item->Prenom;
|
||
|
||
if ( $item->NaissanceDate != '' ) {
|
||
$lineP2.= ' né le ' . $item->NaissanceDate;
|
||
}
|
||
if ( $item->NaissanceVille != '' ) {
|
||
$lineP2.= ' à ' . $item->NaissanceVille;
|
||
}
|
||
if ( $item->NaissanceCp!= '' ) {
|
||
$lineP2.= ' (' . $item->NaissanceCp . ')';
|
||
}
|
||
}
|
||
|
||
$administration[] = array(
|
||
'Fct' => $lineP1,
|
||
'Txt' => $lineP2,
|
||
);
|
||
}
|
||
$this->view->assign('Administration', $administration);
|
||
|
||
$tabCreation = array(
|
||
'a1' => 'Création',
|
||
'a2' => 'Création suite à déménagement',
|
||
'a3' => 'Achat',
|
||
'a4' => 'Apport',
|
||
'a6' => 'Prise en location gérance',
|
||
'a7' => 'Partage',
|
||
'a8' => 'Reprise',
|
||
'aA' => 'Reprise globale de l\'exploitation agricole',
|
||
'aB' => 'Poursuite de l\'exploitation agricole par le conjoint',
|
||
'aC' => 'Transfert de propriété de l\'exploitation agricole',
|
||
'aD' => 'Apport d\'exploitation(s) agricole(s) individuelle(s)',
|
||
'aE' => 'Reprise d\'exploitation agricole individuelle',
|
||
);
|
||
|
||
$OrigineCreaction = $result->Origine;
|
||
|
||
if ( ( $OrigineCreaction*1>0 && $OrigineCreaction*1<9 )
|
||
|| in_array($OrigineCreaction, array('A', 'B', 'C', 'D', 'E')) ){
|
||
$this->view->assign('Origine', $tabCreation['a'.$OrigineCreaction]);
|
||
} else {
|
||
$this->view->assign('Origine', '-');
|
||
}
|
||
|
||
$this->view->assign('Activite', $result->NafCode.' : '.$result->NafLabel);
|
||
$this->view->assign('BodaccActivite', $result->Activite);
|
||
|
||
if ( $result->ActiviteDate === null || $result->ActiviteDate == '0000-00-00 00:00:00') {
|
||
$this->view->assign('ActiviteDate', '');
|
||
} else {
|
||
$date = new Zend_Date($result->ActiviteDate, 'yyyy-MM-dd');
|
||
$this->view->assign('ActiviteDate', $date->toString('dd/MM/yyyy'));
|
||
}
|
||
|
||
$tabTypeExploitation = array(
|
||
0 => "-",
|
||
1 => "Locataire du fond de commerce",
|
||
2 => "Loueur du fond de commerce",
|
||
3 => "Prestation de personnel",
|
||
10 => "Exploitation directe"
|
||
);
|
||
$this->view->assign('Exploitation', $tabTypeExploitation[$result->Exploitation]);
|
||
|
||
$this->view->assign('Evenements', $result->Evenements->item);
|
||
|
||
$this->view->assign('Depots', $result->Depots->item);
|
||
|
||
$this->view->assign('Etablissements', $result->Etablissements->item);
|
||
|
||
if ( $result->DateMajRCS === null || $result->DateMajRCS == '0000-00-00 00:00:00') {
|
||
$this->view->assign('DateMajRCS', '');
|
||
} else {
|
||
$date = new Zend_Date($result->DateMajRCS, 'yyyy-MM-dd');
|
||
$this->view->assign('DateMajRCS', $date->toString('dd/MM/yyyy'));
|
||
}
|
||
|
||
$this->view->assign('exportObjet', $result);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Avis de situation RNCS au format PDF
|
||
*/
|
||
public function avisrncspdfAction()
|
||
{
|
||
//Vérification des permissions
|
||
$user = new Scores_Utilisateur();
|
||
if ( !$user->checkPerm('avisrncs') ) {
|
||
$this->forward('perms', 'error');
|
||
}
|
||
|
||
$request = $this->getRequest();
|
||
|
||
$this->view->assign('siret', $this->siret);
|
||
$siren = substr($this->siret, 0, 9);
|
||
|
||
$infos = null;
|
||
|
||
$ws = new WsScores();
|
||
$result = $ws->getEntrepriseAvisRncs($siren);
|
||
$this->logger->info(print_r($result,1));
|
||
|
||
if ( $result === false ) {
|
||
$this->view->assign('error', true);
|
||
}
|
||
elseif ( is_string($result) ) {
|
||
$this->view->assign('message', $result);
|
||
} else {
|
||
|
||
// --- Disable render and layout
|
||
$this->_helper->layout()->disableLayout();
|
||
$this->_helper->viewRenderer->setNoRender(true);
|
||
|
||
// --- Variables
|
||
$locale = new Zend_Locale('fr_FR');
|
||
|
||
$date = new Zend_Date();
|
||
$AvisDateTxt = $date->toString(Zend_Date::DATE_LONG);
|
||
|
||
if ($result->RadiationDate !== null && $result->RadiationDate != '0000-00-00' ) {
|
||
$date = new Zend_Date($result->RadiationDate, 'yyyy-MM-dd');
|
||
$RadiationDate = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
$Nom = $result->Nom;
|
||
$Sigle = $result->Sigle;
|
||
$Enseigne = $result->Enseigne;
|
||
$NomCommercial = $result->NomCommercial;
|
||
$Siren = $result->Siren;
|
||
$Tribunal = $result->TribunalLabel;
|
||
|
||
$NumGest = $result->NumGest; // 4 ou 2 + 1 lettre +
|
||
|
||
if ($result->ImmatDate === null || $result->ImmatDate=='0000-00-00 00:00:00' ) {
|
||
$ImmatDate = '';
|
||
} else {
|
||
$date = new Zend_Date($result->ImmatDate, 'yyyy-MM-dd');
|
||
$ImmatDate = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
$FormeJuridique = $result->FjLabel;
|
||
$Capital = number_format($result->Capital, 0, ',', ' ').' '.$result->CapitalDev;
|
||
$SiegeAdresse = $result->SiegeAdresseNum . ' ' .
|
||
$result->SiegeAdresseVoieType . ' ' .
|
||
$result->SiegeAdresseVoieLabel . ' ' .
|
||
$result->SiegeAdresseCP . ' ' .
|
||
$result->SiegeAdresseVille;
|
||
|
||
|
||
if ( $result->CompteArretMois === null ) {
|
||
$CompteArretDate = '';
|
||
} else {
|
||
$date = new Zend_Date();
|
||
$date->set($result->CompteArretMois, Zend_Date::MONTH, $locale);
|
||
$CompteArretDate = $result->CompteArretJour . ' ' . $date->toString(Zend_Date::MONTH_NAME);
|
||
}
|
||
|
||
if ( $result->ConstitutionDepotDate === null || $result->ConstitutionDepotDate == '0000-00-00 00:00:00') {
|
||
$ConstitutionDepotDate = '-';
|
||
} else {
|
||
$date = new Zend_Date($result->ConstitutionDepotDate, 'yyyy-MM-dd');
|
||
$ConstitutionDepotDate = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
if ( $result->ConstitutionActeDate === null || $result->ConstitutionActeDate == '0000-00-00 00:00:00') {
|
||
$ConstitutionActeDate = '-';
|
||
} else {
|
||
$date = new Zend_Date($result->ConstitutionActeDate, 'yyyy-MM-dd');
|
||
$ConstitutionActeDate = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
$administration = array();
|
||
foreach ($result->Administration->item as $item) {
|
||
|
||
$lineP1 = $item->Label;
|
||
|
||
if ( $item->CompanyName != '' ) {
|
||
$lineP2 = $item->CompanyName;
|
||
if ( intval($item->CompanyId) != 0 ) {
|
||
$lineP2.= ' ('.$item->CompanyId.')';
|
||
}
|
||
} else {
|
||
$lineP2 = $item->Civilite . ' ' . $item->Nom . ' ' . $item->Prenom;
|
||
if ( $item->NaissanceDate != '' ) {
|
||
$lineP2.= ' né le ' . $item->NaissanceDate;
|
||
}
|
||
if ( $item->NaissanceVille != '' ) {
|
||
$lineP2.= ' à ' . $item->NaissanceVille;
|
||
}
|
||
if ( $item->NaissanceCp!= '' ) {
|
||
$lineP2.= ' (' . $item->NaissanceCp . ')';
|
||
}
|
||
}
|
||
|
||
$administration[] = array(
|
||
'Fct' => $lineP1,
|
||
'Txt' => $lineP2,
|
||
);
|
||
}
|
||
$Administration = $administration;
|
||
|
||
$tabCreation = array(
|
||
'a1' => 'Création',
|
||
'a2' => 'Création suite à déménagement',
|
||
'a3' => 'Achat',
|
||
'a4' => 'Apport',
|
||
'a6' => 'Prise en location gérance',
|
||
'a7' => 'Partage',
|
||
'a8' => 'Reprise',
|
||
'aA' => 'Reprise globale de l\'exploitation agricole',
|
||
'aB' => 'Poursuite de l\'exploitation agricole par le conjoint',
|
||
'aC' => 'Transfert de propriété de l\'exploitation agricole',
|
||
'aD' => 'Apport d\'exploitation(s) agricole(s) individuelle(s)',
|
||
'aE' => 'Reprise d\'exploitation agricole individuelle',
|
||
);
|
||
|
||
$OrigineCreaction = $result->Origine;
|
||
|
||
if ( ( $OrigineCreaction*1>0 && $OrigineCreaction*1<9 )
|
||
|| in_array($OrigineCreaction, array('A', 'B', 'C', 'D', 'E')) ){
|
||
$Origine = $tabCreation['a'.$OrigineCreaction];
|
||
} else {
|
||
$Origine = '-';
|
||
}
|
||
|
||
$Activite = $result->NafCode.' : '.$result->NafLabel;
|
||
$BodaccActivite = $result->Activite;
|
||
|
||
if ( $result->ActiviteDate === null || $result->ActiviteDate == '0000-00-00 00:00:00') {
|
||
$ActiviteDate = '';
|
||
} else {
|
||
$date = new Zend_Date($result->ActiviteDate, 'yyyy-MM-dd');
|
||
$ActiviteDate = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
$tabTypeExploitation = array(
|
||
0 => "-",
|
||
1 => "Locataire du fond de commerce",
|
||
2 => "Loueur du fond de commerce",
|
||
3 => "Prestation de personnel",
|
||
10 => "Exploitation directe"
|
||
);
|
||
$Exploitation = $tabTypeExploitation[$result->Exploitation];
|
||
|
||
$Evenements = $result->Evenements->item;
|
||
|
||
$Depots = $result->Depots->item;
|
||
|
||
$Etablissements = $result->Etablissements->item;
|
||
|
||
if ( $result->DateMajRCS === null || $result->DateMajRCS == '0000-00-00 00:00:00') {
|
||
$DateMajRCS = '';
|
||
} else {
|
||
$date = new Zend_Date($result->DateMajRCS, 'yyyy-MM-dd');
|
||
$DateMajRCS = $date->toString('dd/MM/yyyy');
|
||
}
|
||
|
||
// --- Création du PDF
|
||
$c = Zend_Registry::get('config');
|
||
$filepdf = $c->profil->path->shared.'/temp/files/avisrncs-'.$siren.'.pdf';
|
||
try {
|
||
$pdf = new Scores_Pdf_Tcpdf();
|
||
$pdf->SetBackgroundImage('libs/modeles/avisrncs.jpg');
|
||
$pdf->SetProtection(array('modify', 'copy'), '', null, 0, null);
|
||
$pdf->SetCreator("Scores & Décisions");
|
||
$pdf->SetAuthor("Scores & Décisions");
|
||
$pdf->SetTitle('Avis de Situation RNCS');
|
||
$pdf->SetSubject('Avis de Situation RNCS');
|
||
|
||
$pdf->SetAutoPageBreak(true, 0);
|
||
$pdf->AddPage();
|
||
|
||
$pdf->SetFont('times', '', 12);
|
||
$pdf->setColorArray('fill', array(0,0,140));
|
||
$pdf->setColorArray('text', array(255,255,255));
|
||
$pdf->Cell(0, 0, "AVIS DE SITUATION RNCS", 0, 1, 'C', true);
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->setColorArray('text', array(0,0,0));
|
||
$pdf->Cell(0, 0, "REGISTRE NATIONAL DU COMMERCES ET DES SOCIETES", 0, 1, 'C');
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Avis en date du ".$AvisDateTxt, 0, 1, 'C');
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$border = array('B' => array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "IDENTIFICATION", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
if ($RadiationDate) {
|
||
$pdf->setColorArray('text', array(255,0,0));
|
||
$pdf->Cell(0, 0, "Cette entreprise est radiée au RNCS.", 0, 1, 'C');
|
||
}
|
||
$pdf->setColorArray('text', array(0,0,0));
|
||
$pdf->Cell(0, 0, "Dénomination sociale : ".$Nom, 0, 1, 'L');
|
||
if( !empty($Sigle) ) {
|
||
$pdf->Cell(0, 0, "Sigle : ".$Sigle, 0, 1, 'L');
|
||
}
|
||
if( !empty($Enseigne) ) {
|
||
$pdf->Cell(0, 0, "Enseigne : ".$Enseigne, 0, 1, 'L');
|
||
}
|
||
if( !empty($NomCommercial) ) {
|
||
$pdf->Cell(0, 0, "Nom Commercial : ".$NomCommercial, 0, 1, 'L');
|
||
}
|
||
$pdf->Cell(0, 0, "Numéro d'identification : ".$Siren." RCS ".$Tribunal, 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Numéro de gestion : ".$NumGest, 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Date d'immatriculation : ".$ImmatDate, 0, 1, 'L');
|
||
if ($RadiationDate) {
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Date de radiation : $RadiationDate", 0, 1, 'L');
|
||
} else {
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "RENSEIGNEMENT RELATIF A L'IDENTITE", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
$pdf->Cell(0, 0, "Forme Juridique : $FormeJuridique", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Au capital de : $Capital", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Adresse du siège : $SiegeAdresse", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Date d’arrêté des comptes : $CompteArretDate", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Constitution : $ConstitutionActeDate", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Dépôt de l'acte constitutif: $ConstitutionDepotDate", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "ADMINISTRATION", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
foreach ( $Administration as $item ) {
|
||
$pdf->Cell(0, 0, $item['Fct']." : ".$item['Txt'], 0, 1, 'L');
|
||
}
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "RENSEIGNEMENT RELATIF A L'ACTIVITE", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
$pdf->Cell(0, 0, "Origine de la société $Origine", 0, 1, 'L');
|
||
$pdf->MultiCell(0, 0, "Activité : $Activite", 0, 'L', 0, 1);
|
||
$pdf->MultiCell(0, 0, "Activité déclarée au BODACC : $BodaccActivite", 0, 'L', 0, 1);
|
||
$pdf->Cell(0, 0, "Commencement de l'activité : $ActiviteDate", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Mode d'exploitation : $Exploitation", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "JUGEMENTS RNCS", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
$pdf->Cell(0, 0, "Evénements :", 0, 1, 'L');
|
||
//$pdf->SetMargins(50, 0);
|
||
if (count($Evenements)>0) {
|
||
foreach ( $Evenements as $item ) {
|
||
$pdf->Cell(0, 0, $item, 0, 1, 'L');
|
||
}
|
||
} else {
|
||
$pdf->SetX($pdf->GetX() + 20);
|
||
$pdf->Cell(0, 0, "Néant.", 0, 1, 'L');
|
||
}
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
//$pdf->SetMargins(0, 0);
|
||
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "DEPOT LEGAL", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
$pdf->Cell(0, 0, "Décisions :", 0, 1, 'L');
|
||
if ( count($Depots)>0 ) {
|
||
foreach ( $Depots as $item ) {
|
||
$depot = "Acte n°".$item->ActeNum;
|
||
if ( $item->ActeDate != '0000-00-00' ) {
|
||
$depot.= " du ".substr($item->ActeDate,8,2)."/".substr($item->ActeDate,5,2)."/".substr($item->ActeDate,0,4);
|
||
}
|
||
$depot.= " - Depot n°".$item->DepotNum." du ".substr($item->DepotDate,8,2)."/".substr($item->DepotDate,5,2)."/".substr($item->DepotDate,0,4);
|
||
$pdf->SetX($pdf->GetX() + 20);
|
||
$pdf->Cell(0, 0, $depot, 0, 1, 'L');
|
||
$pdf->SetX($pdf->GetX() + 20);
|
||
$pdf->Cell(0, 0, $item->ActeTypeLabel, 0, 1, 'L');
|
||
foreach ($item->infos->item as $detail) {
|
||
$pdf->SetX($pdf->GetX() + 20);
|
||
$pdf->Cell(0, 0, $detail, 0, 1, 'L');
|
||
}
|
||
$pdf->Ln(2);
|
||
}
|
||
$pdf->Ln(1);
|
||
$pdf->SetFont('times', 'I', 10);
|
||
$pdf->Cell(0, 0, "Liste non exhaustive", 0, 1, 'L');
|
||
}
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$pdf->SetFont('times', 'B', 10);
|
||
$pdf->Cell(0, 0, "AUTRES ETABLISSEMENTS", $border, 1, 'L');
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Ln(1);
|
||
$pdf->Cell(0, 0, "Liste des établissements actifs :", 0, 1, 'L');
|
||
$pdf->Ln(1);
|
||
foreach ( $Etablissements as $etab ) {
|
||
$pdf->SetX($pdf->GetX() + 20);
|
||
$pdf->Cell(0, 0, $etab, 0, 1, 'L');
|
||
$pdf->Ln(1);
|
||
}
|
||
}
|
||
|
||
$pdf->SetFont('times', '', 10);
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
$pdf->Cell(0, 0, "Fin de l'avis de situation", 0, 1, 'C');
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
|
||
$avertissement = "Les données figurant dans le présent avis RNCS sont (à l'exception de l'activité ".
|
||
"déclarée au BODACC) exclusivement issues du RNCS. L'avis de situation RNCS n'a pas la vocation ".
|
||
"à ce soustraire à un kbis qui demeure la seule pièce officielle opposable lors d'une procédure ".
|
||
"judiciaire (kbis original de moins de 3 mois sur papier tramée avec sceau du Greffe).";
|
||
|
||
$pdf->SetFont('times', 'I', 8);
|
||
$pdf->MultiCell(0, 0, $avertissement, 0, 'L', 0, 1);
|
||
$pdf->Cell(0, 0, "", 0, 1, 'L');
|
||
$cgu = "Informations légales issues des données du Registre National du Commerce et des Sociétés".
|
||
"issues de licence 2 dite de distribution RNCS IMR pour Scores & Decisions SAS contractée le 20 novembre 2009\n".
|
||
"Scores & Decisions SAS est rediffuseur officiel du RNCS et propose un service privé, distinct du Registre public cité.";
|
||
$pdf->SetFont('times', 'I', 8);
|
||
$pdf->MultiCell(0, 0, $cgu, 0, 'L', 0, 1);
|
||
|
||
|
||
$pdf->Output($filepdf, 'F');
|
||
|
||
} catch(Exception $e) {
|
||
echo "Erreur à la création du PDF";
|
||
}
|
||
// --- Fin création PDF
|
||
$content_type = 'application/pdf';
|
||
if(file_exists($filepdf) && filesize($filepdf)>0) {
|
||
header('Content-Transfer-Encoding: none');
|
||
header('Content-type: ' . $content_type.'');
|
||
header('Content-Length: ' . filesize($filepdf));
|
||
header('Content-MD5: ' . base64_encode(md5_file($filepdf)));
|
||
header('Content-Disposition: filename="' . basename($filepdf) . '"');
|
||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||
header('Pragma: public');
|
||
ini_set('zlib.output_compression', '0');
|
||
echo file_get_contents($filepdf);
|
||
} else {
|
||
echo "Erreur lors de l'affichage du fichier.";
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Evenements RNCS
|
||
*/
|
||
public function evenrncsAction()
|
||
{
|
||
$siren = substr($this->siret,0,9);
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id, true);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
|
||
$ws = new Scores_Ws_Client('interne', '0.6');
|
||
$params = new stdClass();
|
||
$params->companyId = $siren;
|
||
$response = $ws->getRncsEven($params);
|
||
|
||
if ($response === false) {
|
||
$this->view->Error = true;
|
||
} else {
|
||
$this->view->Even = $response->item;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Jugements RNCS
|
||
*/
|
||
public function jugerncsAction()
|
||
{
|
||
$siren = substr($this->siret,0,9);
|
||
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id, true);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
|
||
$ws = new Scores_Ws_Client('interne', '0.6');
|
||
$params = new stdClass();
|
||
$params->companyId = $siren;
|
||
$response = $ws->getRncsJugement($params);
|
||
|
||
if ($response === false) {
|
||
$this->view->Error = true;
|
||
} else {
|
||
$this->view->Even = $response->item;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* RNVP
|
||
*/
|
||
public function rnvpAction()
|
||
{
|
||
$request = $this->getRequest();
|
||
if ( $request->isXmlHttpRequest() ) {
|
||
$this->_helper->layout()->disableLayout();
|
||
$this->view->tooltip = true;
|
||
}
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$this->view->hasRight = $user->checkPerm('rnvp');
|
||
$session = new Scores_Session_Entreprise($this->siret, $this->id, true);
|
||
$this->view->assign('id', $this->id);
|
||
$this->view->assign('siret', $this->siret);
|
||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||
$siren = substr($this->siret,0,9);
|
||
$this->view->assign('siren', $siren);
|
||
$this->view->assign('adresse', $session->getAdresse());
|
||
|
||
if ($this->view->hasRight) {
|
||
$source = str_pad($session->getSource(), 3, '0', STR_PAD_LEFT);
|
||
$sourceId = str_pad($session->getSourceId(), 17, '0', STR_PAD_LEFT);
|
||
$ws = new Scores_Ws_Client('entreprise', '0.9');
|
||
$params = new stdClass();
|
||
$params->companyId = $source . $sourceId;
|
||
$response = $ws->getRNVP($params);
|
||
if ($response === false) {
|
||
$this->view->Error = true;
|
||
} else {
|
||
$this->view->RNVP = $response;
|
||
}
|
||
}
|
||
}
|
||
} |