2011-02-21 08:45:13 +00:00
|
|
|
<?php
|
|
|
|
class JuridiqueController extends Zend_Controller_Action
|
|
|
|
{
|
2011-05-02 06:30:32 +00:00
|
|
|
protected $siret = null;
|
|
|
|
protected $id = 0;
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$this->siret = $request->getParam('siret');
|
|
|
|
$this->id = $request->getParam('id', 0);
|
|
|
|
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
require_once 'Scores/Utilisateur.php';
|
|
|
|
require_once 'Scores/SessionEntreprise.php';
|
|
|
|
require_once 'common/dates.php';
|
|
|
|
|
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/juridique.css', 'all');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function annoncesAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$source = $request->getParam('source');
|
|
|
|
$vue = $request->getParam('vue');
|
2011-05-02 09:04:46 +00:00
|
|
|
$idAnn = $request->getParam('idAnn', '');
|
2011-05-02 06:30:32 +00:00
|
|
|
$siren = substr($this->siret, 0,9);
|
|
|
|
|
|
|
|
$filtre = 0;
|
|
|
|
if (!empty($vue)) {
|
|
|
|
switch ($vue){
|
|
|
|
case 'bodacc': $filtre=1; break;
|
|
|
|
case 'balo': $filtre=2; break;
|
|
|
|
case 'asso': $filtre=3; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!empty($source)) {
|
2011-05-02 09:04:46 +00:00
|
|
|
switch ($source){
|
2011-05-02 06:30:32 +00:00
|
|
|
case 1: $filtre=1; break;
|
|
|
|
case 2: $filtre=2; break;
|
|
|
|
case 3: $filtre=3; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$session = new SessionEntreprise($this->siret);
|
|
|
|
$fj = $session->getFormeJuridique();
|
2011-05-02 09:04:46 +00:00
|
|
|
if ($fj>9000 && $fj<9999 && intval($siren)==0) {
|
2011-05-02 06:30:32 +00:00
|
|
|
$filtre=3;
|
|
|
|
}
|
2011-05-02 09:04:46 +00:00
|
|
|
|
|
|
|
Zend_Registry::get('firebug')->info('Filtre : '.$filtre);
|
2011-05-02 06:30:32 +00:00
|
|
|
$ws = new WsScores();
|
2011-05-02 09:04:46 +00:00
|
|
|
$infos = $ws->getAnnonces($siren, $filtre, $idAnn);
|
2011-08-19 13:00:53 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
|
2011-05-02 06:30:32 +00:00
|
|
|
require_once 'Scores/Annonces.php';
|
|
|
|
$objAnnonces = new Annonces($infos->result->item);
|
|
|
|
|
|
|
|
$typeAnnonces = array(
|
|
|
|
'Bodacc',
|
|
|
|
'Balo',
|
|
|
|
'Bomp',
|
|
|
|
'Asso',
|
|
|
|
);
|
|
|
|
|
2011-06-15 14:14:56 +00:00
|
|
|
$user = new Utilisateur();
|
|
|
|
$this->view->assign('hasModeEdition', $user->checkModeEdition());
|
|
|
|
|
|
|
|
$this->view->assign('id', $session->getId());
|
2011-05-02 06:30:32 +00:00
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
2011-06-22 15:09:06 +00:00
|
|
|
$this->view->assign('AutrePage', $request->getParam('apage'));
|
2011-05-02 06:30:32 +00:00
|
|
|
|
2011-05-02 09:04:46 +00:00
|
|
|
if (!empty($idAnn)) {
|
2011-06-15 14:26:00 +00:00
|
|
|
|
|
|
|
if ( $user->checkModeEdition() ){
|
2011-07-01 08:28:29 +00:00
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/annonces.js', 'text/javascript');
|
2011-06-15 14:26:00 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 09:04:46 +00:00
|
|
|
$type = ucfirst($vue);
|
|
|
|
$classType = 'annonces'.$type;
|
|
|
|
foreach($objAnnonces->$classType as $ann) {
|
|
|
|
if($ann->id==$idAnn) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$annonce = array(
|
|
|
|
'Desc' => $objAnnonces->getAnnonceDesc($ann),
|
|
|
|
'Entree' => $objAnnonces->getAnnonceEntree($ann),
|
|
|
|
'EntreeSD' => $objAnnonces->getAnnonceEntreeSD($ann),
|
|
|
|
'Even' => $objAnnonces->getAnnonceEven($ann),
|
|
|
|
'Texte' => $objAnnonces->getAnnonceTexte($ann),
|
|
|
|
'Type' => $objAnnonces->getType($ann),
|
2011-07-01 12:44:12 +00:00
|
|
|
'Code' => $objAnnonces->getCode($ann),
|
2011-05-02 09:04:46 +00:00
|
|
|
);
|
|
|
|
Zend_Registry::get('firebug')->info($infos->result->item);
|
|
|
|
Zend_Registry::get('firebug')->info($annonce);
|
2011-06-15 14:14:56 +00:00
|
|
|
|
|
|
|
$this->view->assign('source', $session->getSource());
|
|
|
|
if (intval($this->siret)==0){
|
|
|
|
$this->view->assign('sourceId', $session->getSourceId());
|
|
|
|
} else {
|
|
|
|
$this->view->assign('sourceId', null);
|
|
|
|
}
|
|
|
|
$this->view->assign('idAnn', $idAnn);
|
2011-05-02 09:04:46 +00:00
|
|
|
$this->view->assign('annonce', $annonce);
|
|
|
|
$this->renderScript('juridique/annonce.phtml');
|
|
|
|
} else {
|
|
|
|
foreach ($typeAnnonces as $type)
|
|
|
|
{
|
|
|
|
$classType = 'annonces'.$type;
|
|
|
|
$annonces = array();
|
|
|
|
if (count($objAnnonces->$classType)>0)
|
|
|
|
{
|
|
|
|
foreach($objAnnonces->$classType as $ann)
|
|
|
|
{
|
|
|
|
$annonces[] = $objAnnonces->getAnnonceResume($ann);
|
|
|
|
}
|
|
|
|
$this->view->assign($classType, $annonces);
|
|
|
|
Zend_Registry::get('firebug')->info($annonces);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-02 06:30:32 +00:00
|
|
|
}
|
2011-05-02 09:04:46 +00:00
|
|
|
|
2011-05-02 06:30:32 +00:00
|
|
|
public function infosregAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idCom = $request->getParam('idCom', false);
|
|
|
|
$siren = substr($this->siret, 0,9);
|
|
|
|
$session = new SessionEntreprise($this->siret);
|
|
|
|
|
|
|
|
$ws = new WsScores();
|
|
|
|
$infos = $ws->getInfosReg($siren);
|
2011-08-19 13:00:53 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
|
2011-05-02 06:30:32 +00:00
|
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
|
|
$objAnnonces = $infos->result->item;
|
|
|
|
$annonces = array();
|
|
|
|
if (count($objAnnonces)>0) {
|
|
|
|
foreach ( $objAnnonces as $item ) {
|
|
|
|
$annonces[] = array(
|
|
|
|
'id' => $item->id,
|
|
|
|
'titre' => $item->titre,
|
|
|
|
'communique' => $item->communique,
|
|
|
|
'source' => $item->source,
|
|
|
|
'DateParution' => WDate::dateT('Y-m-d','d/m/Y',$item->DateParution),
|
|
|
|
'dateInsertionSD' => WDate::dateT('Y-m-d','d/m/Y',$item->dateInsertionSD),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($idCom!=false) {
|
|
|
|
$this->view->assign('liste', false);
|
|
|
|
$this->view->assign('idCom', $idCom);
|
|
|
|
} else {
|
|
|
|
$this->view->assign('liste', true);
|
|
|
|
}
|
|
|
|
$this->view->assign('annonces', $annonces);
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function competencesAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$type = $request->getParam('type', '');
|
|
|
|
$siren = substr($this->siret,0,9);
|
|
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
|
|
|
|
|
|
|
$abbrev = array(
|
|
|
|
' TGI ' => 'TRIBUNAL DE GRANDE INSTANCE DE ',
|
|
|
|
' TI ' => 'TRIBUNAL D\'INSTANCE DE ',
|
|
|
|
' TC ' => 'TRIBUNAL DE COMMERCE DE ',
|
|
|
|
' TGICC ' => 'TRIBUNAL DE GRANDE INSTANCE A COMPETENCE COMMERCIALE ',
|
|
|
|
' TICC ' => 'TRIBUNAL D\'INSTANCE A COMPETENCE COMMERCIALE '
|
|
|
|
);
|
|
|
|
|
|
|
|
if (!empty($type)){
|
|
|
|
$ws = new WsScores();
|
|
|
|
$infos = $ws->getListeCompetences($siret, $type, $session->getCodeCommune());
|
2011-08-19 13:00:53 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
|
2011-05-02 06:30:32 +00:00
|
|
|
$competences = $infos->result->item;
|
|
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
|
|
if( $type=='tri' || $type=='cfe' ) {
|
|
|
|
$i=0;
|
|
|
|
foreach($competences as $comp){
|
|
|
|
$competences[$i]->Nom = strtr(' '.strtoupper($comp->Nom), $abbrev);
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->view->assign('competences', $competences);
|
|
|
|
$this->view->assign('type', $type);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
}
|
2011-02-21 08:45:13 +00:00
|
|
|
|
2011-05-02 12:14:05 +00:00
|
|
|
public function conventionsAction()
|
|
|
|
{
|
|
|
|
$siren = substr($this->siret, 0,9);
|
|
|
|
$session = new SessionEntreprise($this->siret);
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
$ws = new WsScores();
|
|
|
|
$infos = $ws->getListeConventions($siren);
|
|
|
|
$conventions = $infos->result->item;
|
|
|
|
Zend_Registry::get('firebug')->info($conventions);
|
|
|
|
$this->view->assign('conventions', $conventions);
|
|
|
|
}
|
|
|
|
|
2011-05-02 13:38:52 +00:00
|
|
|
public function marquesAction()
|
|
|
|
{
|
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/marques.js', 'text/javascript');
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idObject = $request->getParam('idObject', 0);
|
|
|
|
$siren = substr($this->siret, 0,9);
|
|
|
|
$session = new SessionEntreprise($this->siret);
|
|
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
$ws = new WsScores();
|
|
|
|
$infos = $ws->getMarques($siren, $idObject);
|
2011-08-19 13:00:53 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
|
2011-05-02 13:38:52 +00:00
|
|
|
$marques = $infos->result->item;
|
|
|
|
$this->view->assign('marques', $marques);
|
|
|
|
$this->view->assign('idObject', $idObject);
|
|
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getMarques($idObject, $directory)
|
|
|
|
{
|
|
|
|
require_once 'common/curl.php';
|
|
|
|
$url = 'http://bases-marques.inpi.fr/Typo3_INPI_Marques/getPdf?idObjet='.$idObject.'_FMARK-1,FMARK-2';
|
|
|
|
$page = getUrl($url, '', '', '', false, '', '', 7);
|
|
|
|
$body = $page['body'];
|
|
|
|
//On test si il y a eu une erreur
|
|
|
|
if($page['code']==200){
|
|
|
|
$fp=@fopen($directory.'/'.$idObject.'.pdf', 'w');
|
|
|
|
@fwrite($fp, $body);
|
|
|
|
@fclose($fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getmarqueAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$numdepot = $request->getParam('numdepot', '');
|
|
|
|
if (empty($numdepot)){
|
|
|
|
echo 'Paramètres incorrects';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
|
|
|
$directory = realpath($config->data).'/'.$config->marques;
|
|
|
|
$file = $numdepot.'.pdf';
|
|
|
|
|
|
|
|
//Le fichier n'existe pas alors on le télécharger
|
|
|
|
if(!file_exists($directory.'/'.$file)
|
|
|
|
|| filesize($directory.'/'.$file)==0
|
|
|
|
|| date('Ymd', filemtime($directory.'/'.$file))!=date('Ymd') ) {
|
|
|
|
$this->getMarques($numdepot, $directory);
|
|
|
|
}
|
|
|
|
usleep(500);
|
|
|
|
//On vérfie que le fichier existe après le téléchargement
|
|
|
|
if(file_exists($directory.'/'.$file) && filesize($directory.'/'.$file)>0) {
|
|
|
|
$href = $this->view->baseUrl().'/fichier/marque/'.$file;
|
|
|
|
echo '<a href="'.$href.'" target="_blank">Télécharger le PDF de l\'insciption au BOPI.</a>';
|
|
|
|
} else {
|
|
|
|
echo 'Document introuvable.';
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-04-11 14:19:14 +00:00
|
|
|
|
2011-02-21 08:45:13 +00:00
|
|
|
}
|