452 lines
15 KiB
PHP
452 lines
15 KiB
PHP
<?php
|
|
class JuridiqueController extends Zend_Controller_Action
|
|
{
|
|
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/SessionEntreprise.php';
|
|
require_once 'common/dates.php';
|
|
}
|
|
|
|
/**
|
|
* Affichage de la liste des annonces ou d'une annonce
|
|
*/
|
|
public function annoncesAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$vue = $request->getParam('vue', 'bodacc');
|
|
|
|
$p = $request->getParam('p', 1);
|
|
$this->view->assign('p', $p);
|
|
|
|
$idAnn = $request->getParam('idAnn', null);
|
|
$siren = substr($this->siret, 0,9);
|
|
|
|
$source = $request->getParam('source');
|
|
if (!empty($source)) {
|
|
switch ($source){
|
|
case 1: $vue='bodacc'; break;
|
|
case 2: $vue='balo'; break;
|
|
case 3: $vue='asso'; break;
|
|
}
|
|
}
|
|
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
|
$fj = $session->getFormeJuridique();
|
|
if ( $fj>9000 && $fj<9999 && intval($siren)==0 ) {
|
|
$vue = 'asso';
|
|
}
|
|
|
|
$this->view->assign('id', $session->getId());
|
|
$this->view->assign('siren', $siren);
|
|
$this->view->assign('siret', $this->siret);
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
$this->view->assign('AutrePage', $request->getParam('apage'));
|
|
|
|
if ($session->getSource()=='006') {
|
|
|
|
$this->view->assign('AutreSource', true);
|
|
|
|
} else {
|
|
|
|
$this->view->assign('vue', $vue);
|
|
|
|
$nbAnnonces = 20;
|
|
$position = ($p-1)*$nbAnnonces;
|
|
|
|
$ws = new WsScores();
|
|
switch ( $vue ) {
|
|
case 'bodacc':
|
|
case 'abod':
|
|
default:
|
|
if(intval($siren)==0) {
|
|
$idAnn = $session->getSourceId();
|
|
}
|
|
$infos = $ws->getAnnoncesLegales($siren, $idAnn, null, $position, $nbAnnonces);
|
|
break;
|
|
case 'balo':
|
|
$infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAnnonces);
|
|
break;
|
|
case 'asso':
|
|
if ( intval($siren)==0 && substr($session->getAutreId(),0,1)=='W' ) {
|
|
$infos = $ws->getAnnoncesAsso($session->getAutreId(), $idAnn, null, $position, $nbAnnonces);
|
|
} elseif (intval($siren)!=0) {
|
|
$infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAnnonces);
|
|
} else {
|
|
$idAnn = $session->getSourceId();
|
|
$infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAnnonces);
|
|
}
|
|
break;
|
|
case 'bomp':
|
|
$filtre = $request->getParam('filtre', null);
|
|
$this->view->assign('filtre', $filtre);
|
|
$infos = $ws->getAnnoncesBoamp($siren, $idAnn, $filtre, $position, $nbAnnonces);
|
|
break;
|
|
}
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
require_once 'Scores/Annonces.php';
|
|
$objAnnonces = new Annonces($infos->result->item);
|
|
|
|
$typeAnnonces = array(
|
|
'Bodacc',
|
|
'Balo',
|
|
'Bomp',
|
|
'Asso',
|
|
);
|
|
|
|
$user = new Scores_Utilisateur();
|
|
$this->view->assign('hasModeEdition', $user->checkModeEdition());
|
|
|
|
$this->view->assign('exportObjet', $infos);
|
|
$this->view->assign('surveillance', $user->checkPerm('survannonce'));
|
|
|
|
//Affichage pour une annonce
|
|
if (!empty($idAnn) && in_array($vue, array('bodacc', 'abod', 'balo', 'asso', 'bomp')) ) {
|
|
|
|
if ( $user->checkModeEdition() ){
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/saisieannonces.js', 'text/javascript');
|
|
}
|
|
|
|
$classType = 'annonces'.ucfirst($vue);
|
|
foreach($objAnnonces->$classType as $ann) {
|
|
if($ann->id==$idAnn) break;
|
|
}
|
|
Zend_Registry::get('firebug')->info($ann);
|
|
$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),
|
|
'Code' => $objAnnonces->getCode($ann),
|
|
'Annee' => $objAnnonces->getAnnee($ann),
|
|
'Num' => $objAnnonces->getNum($ann),
|
|
'Deleted' => $objAnnonces->isDeleted($ann),
|
|
'Entites' => $objAnnonces->getAnnonceEntite($ann)
|
|
);
|
|
|
|
$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);
|
|
$this->view->assign('annonce', $annonce);
|
|
|
|
if ($request->getParam('q')=='ajax')
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
//$this->_helper->viewRenderer->setNoRender(true);
|
|
$this->renderScript('juridique/annonce-ajax.phtml');
|
|
} else {
|
|
//Définir url pour téléchargement pdf
|
|
if ( in_array($annonce['Code'], array('BODA', 'BODB', 'BODC')) && intval($annonce['Annee'])>=2008) {
|
|
$lienBodacc = $this->view->url(array(
|
|
'controller' => 'juridique',
|
|
'action' => 'bodaccpdf',
|
|
'type' => substr($annonce['Code'],3,1),
|
|
'annee' => $annonce['Annee'],
|
|
'num' => $annonce['Num'],
|
|
), null, true);
|
|
$this->view->assign('lienBodacc', $lienBodacc);
|
|
}
|
|
|
|
$this->renderScript('juridique/annonce.phtml');
|
|
}
|
|
|
|
//Affichage pour la liste des annonces
|
|
} else {
|
|
|
|
$nbReponses = $infos->nbReponses;
|
|
$nbPages = ceil($nbReponses/$nbAnnonces);
|
|
|
|
//Attention ajout des filtres
|
|
if ( $p <= 1 ) {
|
|
$lienPagePrecedente = false;
|
|
} else {
|
|
$lienPagePrecedente = $this->view->url(array(
|
|
'controller' => 'juridique',
|
|
'action' => 'annonces',
|
|
'vue'=> $vue,
|
|
'p' => $p-1
|
|
));
|
|
}
|
|
|
|
if ( $p+1 > $nbPages ) {
|
|
$lienPageSuivante = false;
|
|
} else {
|
|
$lienPageSuivante = $this->view->url(array(
|
|
'controller' => 'juridique',
|
|
'action' => 'annonces',
|
|
'vue' => $vue,
|
|
'p' => $p+1
|
|
));
|
|
}
|
|
|
|
$this->view->assign('nbPages',$nbPages);
|
|
$this->view->assign('lienPagePrecedente',$lienPagePrecedente);
|
|
$this->view->assign('lienPageSuivante',$lienPageSuivante);
|
|
|
|
foreach ($typeAnnonces as $type)
|
|
{
|
|
$classType = 'annonces'.$type;
|
|
$annonces = array();
|
|
if (count($objAnnonces->$classType)>0)
|
|
{
|
|
foreach($objAnnonces->$classType as $ann)
|
|
{
|
|
Zend_Registry::get('firebug')->info('id:'.$ann->id.', deleted:'.$ann->deleted);
|
|
$annonces[] = $objAnnonces->getAnnonceResume($ann);
|
|
}
|
|
$this->view->assign($classType, $annonces);
|
|
}
|
|
}
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/annonces.js', 'text/javascript');
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Affichage infos réglementées
|
|
*/
|
|
public function infosregAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$idAnn = $request->getParam('idann', false);
|
|
$siren = substr($this->siret, 0,9);
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
|
|
|
$ws = new WsScores();
|
|
if ($idAnn!=false) {
|
|
$this->view->assign('idAnn', $idAnn);
|
|
$infos = $ws->getInfosReg($siren,$idAnn);
|
|
} else {
|
|
$infos = $ws->getInfosReg($siren);
|
|
}
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
if (is_string($infos)){
|
|
$this->view->assign('message', $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),
|
|
);
|
|
}
|
|
}
|
|
|
|
$this->view->assign('annonces', $annonces);
|
|
$this->view->assign('siren', $siren);
|
|
$this->view->assign('siret', $this->siret);
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
$this->view->assign('exportObjet', $infos);
|
|
}
|
|
|
|
/**
|
|
* Affichage listes des compétences
|
|
*/
|
|
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());
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
$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('exportObjet', $infos);
|
|
}
|
|
|
|
$this->view->assign('siren', $siren);
|
|
$this->view->assign('siret', $this->siret);
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
}
|
|
|
|
/**
|
|
* Affichage des la listes des conventions collectives
|
|
* Enter description here ...
|
|
*/
|
|
public function conventionsAction()
|
|
{
|
|
$siren = substr($this->siret, 0,9);
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
|
$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);
|
|
$this->view->assign('exportObjet', $infos);
|
|
}
|
|
|
|
/**
|
|
* Affichage des marques déposées
|
|
*/
|
|
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->id);
|
|
$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);
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
|
|
|
$marques = $infos->result->item;
|
|
$this->view->assign('marques', $marques);
|
|
$this->view->assign('idObject', $idObject);
|
|
$this->view->assign('exportObjet', $marques);
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
}
|
|
|
|
/**
|
|
* Affiche le lien pour télécharger le fichier concernant le dépot
|
|
*/
|
|
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;
|
|
}
|
|
$c = Zend_Registry::get('config');
|
|
$directory = realpath($c->profil->path->data).'/marques';
|
|
$file = $numdepot.'.pdf';
|
|
|
|
//Le fichier n'existe pas alors on le télécharger
|
|
if(!file_exists($directory.'/'.$file)
|
|
|| filesize($directory.'/'.$file)==0 ) {
|
|
$cmd = 'php ' . APPLICATION_PATH . '/../scripts/jobs/getMarque.php ' . $numdepot;
|
|
Zend_Registry::get('firebug')->info($cmd);
|
|
$result = exec($cmd);
|
|
Zend_Registry::get('firebug')->info($result);
|
|
}
|
|
//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.';
|
|
}
|
|
|
|
}
|
|
|
|
public function bodaccpdfAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
$request = $this->getRequest();
|
|
|
|
$type = $request->getParam('type');
|
|
$annee = $request->getParam('annee');
|
|
$num = $request->getParam('num');
|
|
|
|
//$num doit être retraité pour être sur 4 position
|
|
$c = strlen($num);
|
|
for($i=0;$i<4-$c;$i++){
|
|
$num = '0'.$num;
|
|
}
|
|
|
|
$c = Zend_Registry::get('config');
|
|
$file = realpath($c->profil->path->data)
|
|
.'/bodacc/'.$type.'/'.$annee.'/'.
|
|
'BODACC_'.$type.'_'.$annee.'_'.$num.'.pdf';
|
|
|
|
if ( !file_exists($file) ) {
|
|
exec('php ' . APPLICATION_PATH . "/../scripts/jobs/getBodaccPdf.php $type $annee $num >> getBodaccPdf.log");
|
|
}
|
|
|
|
if (file_exists($file)) {
|
|
$href = $this->view->url(array(
|
|
'controller' => 'fichier',
|
|
'action' => 'bodacc',
|
|
'fichier' => basename($file),
|
|
), null, true);
|
|
echo "<a target=\"_blank\" href=\"".$href."\">Cliquer ici pour télécharger le fichier.</a>";
|
|
} else {
|
|
echo "Erreur lors du chargement du fichier.";
|
|
}
|
|
}
|
|
|
|
|
|
public function annoncenumAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$request = $this->getRequest();
|
|
$siren = $request->getParam('siren');
|
|
|
|
$ws = new WsScores();
|
|
$result = $ws->getAnnoncesNum($siren);
|
|
Zend_Registry::get('firebug')->info($result);
|
|
$numWS = array();
|
|
if (count($result->item)>0) {
|
|
foreach ($result->item as $item) {
|
|
$numWS[$item->type] = $item->num;
|
|
}
|
|
}
|
|
$types = array('bodacc', 'balo', 'boamp', 'asso');
|
|
|
|
$num = array();
|
|
foreach($types as $type) {
|
|
if ( array_key_exists($type, $numWS) ) {
|
|
$num['Type'.ucfirst($type)] = $numWS[$type];
|
|
}
|
|
}
|
|
|
|
$this->view->assign('num', $num);
|
|
}
|
|
|
|
} |