From 63b6fd8e131480ef0ffab7a21e0983f05433a7e9 Mon Sep 17 00:00:00 2001 From: Jean Vladimir TWAHIRWA Date: Thu, 15 Dec 2016 11:04:01 +0100 Subject: [PATCH] utiliser la methode Scores_Ws_Client --- .../controllers/IdentiteController.php | 2627 +++++++++-------- 1 file changed, 1318 insertions(+), 1309 deletions(-) diff --git a/application/modules/default/controllers/IdentiteController.php b/application/modules/default/controllers/IdentiteController.php index 06fe9e9eb..6ccb1ac80 100644 --- a/application/modules/default/controllers/IdentiteController.php +++ b/application/modules/default/controllers/IdentiteController.php @@ -1,40 +1,40 @@ theme = Zend_Registry::get('theme'); + { + // --- Theme + $this->theme = Zend_Registry::get('theme'); - // --- Get standard parameters - $request = $this->getRequest(); - $this->siret = $request->getParam('siret'); + // --- 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': + public function preDispatch() + { + switch($this->getRequest()->getActionName()) + { + case 'fiche': + case 'fichepc': if (intval($this->siret)==0 && $this->id==0){ $this->forward('params', 'error'); } - break; - } - } + break; + } + } - /** - * Renvoi vers la fiche - */ + /** + * Renvoi vers la fiche + */ public function indexAction() { $this->forward('index', 'index'); @@ -45,23 +45,23 @@ class IdentiteController extends Zend_Controller_Action */ public function fichebygroupAction() { - $this->_helper->viewRenderer->setNoRender(true); - $this->_helper->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + $this->_helper->layout()->disableLayout(); - $request = $this->getRequest(); - $id = $request->getParam('id'); + $request = $this->getRequest(); + $id = $request->getParam('id'); - $ws = new WsScores(); - $response = $ws->getLienRef($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); - } + 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); + } } /** @@ -90,128 +90,128 @@ class IdentiteController extends Zend_Controller_Action $infos = $ws->getIdentite($params); if ($infos === false) { - $this->forward('soap', 'error'); + $this->forward('soap', 'error'); } } else { $infos = $this->getRequest()->getParam('infos'); } if (is_string($infos)) { - $this->view->assign('message', $infos); + $this->view->assign('message', $infos); } else { - //Mise en session - $session = new Scores_Session_Entreprise($this->siret, $this->id, true); - $session->setInfoEntrep($infos); + //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.= ''; - foreach ( $tabDate as $dateId => $dateLib ) { - if ( isset($infos->{$dateId}) - && !empty($infos->{$dateId}) - && $infos->{$dateId}!='0000-00-00') { + //Date de dernière mise à jour + $tabDate = array( + 'DateMajINSEE' => "Insee : ", + 'DateMajRCS' => "RCS : ", + 'DateMajBILAN' => "Bilans : ", + 'DateMajANN' => "Annonces : ", + 'DateMajID' => 'Scores :' + ); + $datemajTexte = $dateDerMaj = ''; + $datemajTexte.= '
'; + 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') { + $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.= ''; - $datemajTexte.= ''; - $datemajTexte.= ''; - $datemajTexte.= ''; - } + if ( $dateId == 'DateMajID' && !$user->checkModeEdition()) { + } else { + $date = new Zend_Date($infos->{$dateId}, 'yyyy-MM-dd'); + $datemajTexte.= ''; + $datemajTexte.= ''; + $datemajTexte.= ''; + $datemajTexte.= ''; + } - } - } - $datemajTexte.= '
'.$dateLib.''.$date->toString('dd/MM/yyyy').'
'.$dateLib.''.$date->toString('dd/MM/yyyy').'
'; + } + } + $datemajTexte.= ''; - $identite = new IdentiteEntreprise($infos); + $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' - ); + //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); + $dBlock = $identite->formatBlock($blocks); - require_once 'Scores/Logo.php'; - $logo = new Logo($infos->Siren, $infos->Isin); - $logoImg = array( - 'label' => 'Logo', - 'texte' => $logo->affiche(), - ); + 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')); + $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); + $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); } @@ -251,50 +251,50 @@ class IdentiteController extends Zend_Controller_Action $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' + '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'}() : '', + '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; } @@ -302,8 +302,8 @@ class IdentiteController extends Zend_Controller_Action require_once 'Scores/Logo.php'; $logo = new Logo($infos->Siren, $infos->Isin); $logoImg = array( - 'label' => 'Logo', - 'texte' => $logo->affiche(), + 'label' => 'Logo', + 'texte' => $logo->affiche(), ); $Identite = new stdClass(); $Identite->siret = $this->siret; @@ -316,16 +316,16 @@ class IdentiteController extends Zend_Controller_Action require_once 'Scores/IdentiteProcol.php'; $procol = new IdentiteProcol($infos); $blocks = array( - 'CessionOffreDate', - 'CessionInvenDate', - 'CessionDesc', + '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'}() : '', + '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; } @@ -345,26 +345,34 @@ class IdentiteController extends Zend_Controller_Action */ public function etablissementsAction() { - $request = $this->getRequest(); + $request = $this->getRequest(); - $siren = substr($this->siret,0,9); + $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; + $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'); + $params = new stdClass(); + $params->siren = $siren; + $params->actif = $actif; + $params->position = $position; + $params->nbAffichage = $nbAffichage; + + $ws = new Scores_Ws_Client('entreprise', '0.8'); + $infos = $ws->getListeEtablissements($params); + if ($infos === false) { + $this->view->msg = "Erreur"; + } else { $etabs = $infos->result->item; $this->view->assign('actif', $actif); @@ -381,26 +389,26 @@ class IdentiteController extends Zend_Controller_Action } } - //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); + //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); @@ -415,8 +423,9 @@ class IdentiteController extends Zend_Controller_Action $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); + $this->view->assign('hasPrefCarte', $user->checkPref('cartes')); + $this->view->assign('listeEtablissement', $infos); + } } /** @@ -427,22 +436,22 @@ class IdentiteController extends Zend_Controller_Action $request = $this->getRequest(); $user = new Scores_Utilisateur(); - $userAccessEdition = $user->checkModeEdition(); - $this->view->AuthorizeGeocode = $userAccessEdition; + $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'); - } + 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); + // --- Marker + $siren = substr($this->siret,0,9); $actif = $request->getParam('actif', -1); $session = new Scores_Session_Entreprise($this->siret, $this->id); @@ -499,26 +508,26 @@ class IdentiteController extends Zend_Controller_Action $iconeMarqueur = $this->iconeDuMarqueur($etab->NafEtab, $etab->Siege, $etab->Actif); - $icone = 'etab1.png'; - if ( !empty($iconeMarqueur) ) { - $icone = $iconeMarqueur; - } + $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, - ); + $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, + 'siret' => $siren.' '.$etab->Nic, + 'address' => $adresse, + 'title' => $titre, + 'text' => $texte, + 'type' => $type, + 'icon' => $icone, + 'gps' => $gps, ); } Zend_Registry::get('firebug')->info($marks); @@ -580,7 +589,7 @@ class IdentiteController extends Zend_Controller_Action 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 + // 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... @@ -625,7 +634,7 @@ class IdentiteController extends Zend_Controller_Action 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 + // O Administration publique case '84': // Administration publique et défense ; sécurité sociale... // P Enseignement case '85': // Enseignement @@ -657,11 +666,11 @@ class IdentiteController extends Zend_Controller_Action */ public function liensAction() { - $nbMonthForRecentLien = 3; + $nbMonthForRecentLien = 3; - $this->view->headScript()->appendFile($this->theme->pathScript.'/identite-groupe.js', 'text/javascript'); - $request = $this->getRequest(); - $autrePage = $this->getRequest()->getParam('apage'); + $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(); @@ -669,112 +678,112 @@ class IdentiteController extends Zend_Controller_Action $ws = new WsScores(); - if ($lienRef) { + if ($lienRef) { - $this->view->assign('lienref', $lienRef); + $this->view->assign('lienref', $lienRef); - if (empty($autrePage)) { - $this->view->headTitle()->prepend('Liens inter-entreprises - Id '.$lienRef); - } + if (empty($autrePage)) { + $this->view->headTitle()->prepend('Liens inter-entreprises - Id '.$lienRef); + } - $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); + $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')); - } + //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); - } + 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); + //Get links + $infos = $ws->getLiensById($lienRef); - } else { - $siren = substr($this->siret,0,9); + } 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); + 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')); + $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) ); - } + //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'); - } + $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); + 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; - } - } + //@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); - } + $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); + } - if ( in_array($session->getFormeJuridique(), array(5488,5498,5720)) ) { - $this->view->assign('FJ1', true); - } + 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 ) { + //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) ); - } - } - } + $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; @@ -783,13 +792,13 @@ class IdentiteController extends Zend_Controller_Action $actionnaires = $participations = $directions = array(); if ( $infos->actionnaires->item ) { - $actionnaires = $infos->actionnaires->item; + $actionnaires = $infos->actionnaires->item; } if ( $infos->participations->item ) { - $participations = $infos->participations->item; + $participations = $infos->participations->item; } if ( $infos->directions->item ) { - $directions = $infos->directions->item; + $directions = $infos->directions->item; } $date = new Zend_Date(); @@ -812,269 +821,269 @@ class IdentiteController extends Zend_Controller_Action */ public function lienficheAction() { - $this->_helper->layout()->disableLayout(); - $request = $this->getRequest(); + $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); + //@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()); + $user = new Scores_Utilisateur(); + $this->view->assign('edition', $user->checkModeEdition()); - $id = $request->getParam('idFiche'); - $this->view->assign('idFiche', $id); + $id = $request->getParam('idFiche'); + $this->view->assign('idFiche', $id); - $ws = new WsScores(); - $result = $ws->getLienRef($id); - Zend_Registry::get('firebug')->info($result); - $this->view->assign('result', $result); + $ws = new WsScores(); + $result = $ws->getLienRef($id); + Zend_Registry::get('firebug')->info($result); + $this->view->assign('result', $result); - $this->view->assign('idFiche', $id); + $this->view->assign('idFiche', $id); } /** @@ -1082,18 +1091,18 @@ class IdentiteController extends Zend_Controller_Action */ public function liendocAction() { - $request = $this->getRequest(); - $type = $request->getParam('type'); - $id = $request->getParam('id'); + $request = $this->getRequest(); + $type = $request->getParam('type'); + $id = $request->getParam('id'); - if ( $type == 'Lien' ) { - $this->_helper->layout()->disableLayout(); - } + if ( $type == 'Lien' ) { + $this->_helper->layout()->disableLayout(); + } - $ws = new WsScores(); - $docs = $ws->getLienDoc($id, $type); + $ws = new WsScores(); + $docs = $ws->getLienDoc($id, $type); - $this->view->assign('docs', $docs->item); + $this->view->assign('docs', $docs->item); } /** @@ -1101,10 +1110,10 @@ class IdentiteController extends Zend_Controller_Action */ public function evenementsAction() { - $request = $this->getRequest(); + $request = $this->getRequest(); - $siren = substr($this->siret,0,9); - $nic = $request->getParam('nic', null); + $siren = substr($this->siret,0,9); + $nic = $request->getParam('nic', null); $this->view->headTitle()->prepend('Evènements - Siren '.$siren); @@ -1116,23 +1125,23 @@ class IdentiteController extends Zend_Controller_Action $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. - */ + /* + 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); - } + 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); @@ -1149,18 +1158,18 @@ class IdentiteController extends Zend_Controller_Action $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; - } + $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; + $pageTotal = $pageCurrent = 1; } $this->view->assign('PageTotal', $pageTotal); $this->view->assign('PagePrev', $pagePrev); @@ -1188,27 +1197,27 @@ class IdentiteController extends Zend_Controller_Action if ($googleNews!==false){ $url = 'http://news.google.fr/news?hl=fr&gl=fr&q='. - urlencode($session->getRaisonSociale()).'&output=rss'; + urlencode($session->getRaisonSociale()).'&output=rss'; - $items = array(); - try { - $canal = new Zend_Feed_Rss($url); - } catch (Exception $e) { - //Do nothing - } + $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; - } - } + if (count($canal)>0) + { + $i=0; + foreach ($canal as $element) + { + $items[] = $element; + $i++; + if ($i==$nbNews) break; + } + } } - $this->view->assign('items', $items); + $this->view->assign('items', $items); } else { $this->view->assign('disable', true); } @@ -1225,52 +1234,52 @@ class IdentiteController extends Zend_Controller_Action // --- En environement de preprod, on envoi sur le site if (APPLICATION_ENV == 'staging') { - $this->redirect('http://avis-situation-sirene.insee.fr/'); + $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(); - } + $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(); + } } } @@ -1314,52 +1323,52 @@ class IdentiteController extends Zend_Controller_Action $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)); + $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); + $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'; + // 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'); + $mappy = new Mappy(); + if ($mappy->villeCouverte($infos->Ville)) + { + $this->view->assign('source', 'mappy'); - $adresse = ''; - $adresse.= $infos->AdresseNum; + $adresse = ''; + $adresse.= $infos->AdresseNum; - //Corriger la voie pour Mappy - $adresse.= ' '.strtr($infos->AdresseVoie, array( - 'R' => 'RUE', - 'AV' => 'AVENUE', - 'RLE' => 'RUELLE', - )); + //Corriger la voie pour Mappy + $adresse.= ' '.strtr($infos->AdresseVoie, array( + 'R' => 'RUE', + 'AV' => 'AVENUE', + 'RLE' => 'RUELLE', + )); - $adresse.= ' '.$infos->AdresseRue; - $adresse.= ' '.$infos->Ville; + $adresse.= ' '.$infos->AdresseRue; + $adresse.= ' '.$infos->Ville; - //Définir le pays - if ($infos->Pays == '') { - $adresse.= ' FRANCE'; - } else { - $adresse.= ' '.$infos->Pays; - } + //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'); - } + $this->view->assign('adresse', $adresse); + $this->view->assign('lienJs', $mappy->getJs()); + } + else + { + $this->view->assign('source', 'google'); + } } /** @@ -1390,9 +1399,9 @@ class IdentiteController extends Zend_Controller_Action //Corriger la voie $adresse.= strtr($infos->AdresseVoie, array( - 'R' => 'RUE', - 'AV' => 'AVENUE', - 'RLE' => 'RUELLE', + 'R' => 'RUE', + 'AV' => 'AVENUE', + 'RLE' => 'RUELLE', )); $adresse.= ' '.$infos->AdresseRue; @@ -1413,50 +1422,50 @@ class IdentiteController extends Zend_Controller_Action $this->view->assign('lat', $lat); $this->view->assign('lon', $lon); - $file = false; + $file = false; - if (intval($siret) < 1000) { - $this->view->assign('url', false); - } else { - $streetview = new Scores_Google_Streetview($siret); + 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); + // --- 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); - } + $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()); - } - } + $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()); + } + } } /** @@ -1543,16 +1552,16 @@ class IdentiteController extends Zend_Controller_Action $name = $infos['name']; if ( intval($infos['siren'])!=0 ) { - $name.= ' ( '.$sirenTxt.' )'; + $name.= ' ( '.$sirenTxt.' )'; } else { $name.= ' ( '.$infos['pays'].' )'; } $structure = array(); $structure[] = array( - 'data' => $name, - 'state' => 'open', - 'children' => $this->groupesArboChildren($infos['children'], $siren), + 'data' => $name, + 'state' => 'open', + 'children' => $this->groupesArboChildren($infos['children'], $siren), ); $this->view->assign('data', json_encode($structure)); } @@ -1576,17 +1585,17 @@ class IdentiteController extends Zend_Controller_Action $name = $item['name']; if ( intval($item['siren'])!=0 ) { $name.= ' ('.$sirenTxt.')'; + 'controller'=>'identite', + 'action'=>'fiche', + 'siret' => $item['siren']), 'default', true).'">'.$sirenTxt.')'; } else { $name.= ' ('.$item['pays'].')'; } $name.= ' - '.$item['pmin'].'%'; $structure = array( - 'data' => $name, - 'state' => 'open', + 'data' => $name, + 'state' => 'open', ); if ($item['siren']==$detectSiren) { @@ -1609,8 +1618,8 @@ class IdentiteController extends Zend_Controller_Action */ public function groupeAction() { - $this->view->headScript()->appendFile($this->theme->pathScript.'/identite-groupe.js', 'text/javascript'); - $this->view->headTitle()->prepend("Groupe"); + $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); @@ -1670,31 +1679,31 @@ class IdentiteController extends Zend_Controller_Action */ public function corporamaAction() { - $request = $this->getRequest(); + $request = $this->getRequest(); - $this->view->assign('siret', $this->siret); - $siren = substr($this->siret, 0, 9); + $this->view->assign('siret', $this->siret); + $siren = substr($this->siret, 0, 9); - $session = new Scores_Session_Entreprise($this->siret, $this->id); + $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); + $corporamaUrl = "http://corporama.com/search?siren=".$siren."&company=".urlencode($session->getRaisonSociale())."&partner=sd268"; + $this->view->assign('corporamaUrl', $corporamaUrl); - if ( $request->isXmlHttpRequest() || $request->getParam('include') ) { + if ( $request->isXmlHttpRequest() || $request->getParam('include') ) { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); + $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); + $page = file_get_contents($corporamaUrl, false); + if ($page === false) { + echo "Erreur"; + } + $this->view->assign('page', $page); - } + } - $ws = new WsScores(); - $ws->setLog('corporama', $this->siret); + $ws = new WsScores(); + $ws->setLog('corporama', $this->siret); } /** @@ -1702,178 +1711,178 @@ class IdentiteController extends Zend_Controller_Action */ public function avisrncsAction() { - //Vérification des permissions - $user = new Scores_Utilisateur(); - if( !$user->checkPerm('avisrncs') ){ - $this->forward('perms', 'error'); - } + //Vérification des permissions + $user = new Scores_Utilisateur(); + if( !$user->checkPerm('avisrncs') ){ + $this->forward('perms', 'error'); + } - $request = $this->getRequest(); + $request = $this->getRequest(); - $this->view->assign('siret', $this->siret); - $siren = substr($this->siret, 0, 9); + $this->view->assign('siret', $this->siret); + $siren = substr($this->siret, 0, 9); - $infos = null; + $infos = null; - $ws = new WsScores(); - $result = $ws->getEntrepriseAvisRncs($siren); - Zend_Registry::get('firebug')->info($result); + $ws = new WsScores(); + $result = $ws->getEntrepriseAvisRncs($siren); + Zend_Registry::get('firebug')->info($result); - if ( $result === false ) { - $this->view->assign('error', true); - } - elseif ( is_string($result) ) { - $this->view->assign('message', $result); - } else { + if ( $result === false ) { + $this->view->assign('error', true); + } + elseif ( is_string($result) ) { + $this->view->assign('message', $result); + } else { - $locale = new Zend_Locale('fr_FR'); + $locale = new Zend_Locale('fr_FR'); - $date = new Zend_Date(); - $this->view->assign('AvisDateTxt', $date->toString(Zend_Date::DATE_LONG)); + $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')); - } + 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('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 + + $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')); - } + 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); + $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->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->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')); - } + 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) { + $administration = array(); + foreach ($result->Administration->item as $item) { - $lineP1 = $item->Label; + $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->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 . ')'; - } - } + 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); + $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', - ); + $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; + $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', '-'); - } + 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); + $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 { + 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]); + $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('Evenements', $result->Evenements->item); - $this->view->assign('Depots', $result->Depots->item); + $this->view->assign('Depots', $result->Depots->item); - $this->view->assign('Etablissements', $result->Etablissements->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')); - } + 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); - } + $this->view->assign('exportObjet', $result); + } } /** @@ -1912,334 +1921,334 @@ class IdentiteController extends Zend_Controller_Action // --- Variables $locale = new Zend_Locale('fr_FR'); - $date = new Zend_Date(); - $AvisDateTxt = $date->toString(Zend_Date::DATE_LONG); + $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'); - } + 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; + $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 + + $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'); - } + 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; + $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'); - } + if ( $result->CompteArretMois === null ) { + $CompteArretDate = ''; } else { - $pdf->SetX($pdf->GetX() + 20); - $pdf->Cell(0, 0, "Néant.", 0, 1, 'L'); + $date = new Zend_Date(); + $date->set($result->CompteArretMois, Zend_Date::MONTH, $locale); + $CompteArretDate = $result->CompteArretJour . ' ' . $date->toString(Zend_Date::MONTH_NAME); } - $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); + 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.')'; } - $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'); + } 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 . ')'; } - $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); + $administration[] = array( + 'Fct' => $lineP1, + 'Txt' => $lineP2, + ); } - } + $Administration = $administration; - $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'); + $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', + ); - $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)."; + $OrigineCreaction = $result->Origine; - $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); + 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'); + $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."; - } + } 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."; + } } } @@ -2248,23 +2257,23 @@ class IdentiteController extends Zend_Controller_Action */ public function evenrncsAction() { - $siren = substr($this->siret,0,9); + $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()); + $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); + $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; - } + if ($response === false) { + $this->view->Error = true; + } else { + $this->view->Even = $response->item; + } } /** @@ -2272,23 +2281,23 @@ class IdentiteController extends Zend_Controller_Action */ public function jugerncsAction() { - $siren = substr($this->siret,0,9); + $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()); + $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); + $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; - } + if ($response === false) { + $this->view->Error = true; + } else { + $this->view->Even = $response->item; + } } /** @@ -2296,34 +2305,34 @@ class IdentiteController extends Zend_Controller_Action */ public function rnvpAction() { - $request = $this->getRequest(); - if ( $request->isXmlHttpRequest() ) { - $this->_helper->layout()->disableLayout(); - $this->view->tooltip = true; - } + $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()); + $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; - } - } + 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; + } + } } } \ No newline at end of file