diff --git a/application/modules/default/controllers/JuridiqueController.php b/application/modules/default/controllers/JuridiqueController.php index 248112b6f..8321e20f8 100644 --- a/application/modules/default/controllers/JuridiqueController.php +++ b/application/modules/default/controllers/JuridiqueController.php @@ -25,20 +25,19 @@ class JuridiqueController extends Zend_Controller_Action $request = $this->getRequest(); $autrePage = $request->getParam('apage'); - $vue = $request->getParam('vue', 'bodacc'); $idAnn = $request->getParam('idAnn', null); $siren = substr($this->siret, 0,9); + $vue = $request->getParam('vue', 'bodacc'); $source = $request->getParam('source'); if (!empty($source)) { switch ($source){ - case 1: $vue='bodacc'; break; - case 2: $vue='balo'; break; - case 3: $vue='asso'; break; + case 1: $vue = 'bodacc'; break; + case 2: $vue = 'balo'; break; + case 3: $vue = 'asso'; break; } } - $session = new Scores_Session_Entreprise($this->siret, $this->id); $fj = $session->getFormeJuridique(); if ($fj > 9000 && $fj < 9999 && intval($siren) == 0) { @@ -56,27 +55,29 @@ class JuridiqueController extends Zend_Controller_Action } else { $this->view->assign('vue', $vue); - //Pagination + // Pagination $page = $request->getParam('page', 1); - if ( $page <= 0 ) { + if ($page <= 0) { $page = 1; } $nbAffichage = 20; - $position = ($page - 1 ) * $nbAffichage; + $position = ($page - 1) * $nbAffichage; $ws = new WsScores(); - switch ( $vue ) { + switch ($vue) { case 'balo': $infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAffichage); break; case 'asso': - if ( intval($siren)==0 && substr($session->getAutreId(),0,1)=='W' ) { + if (intval($siren) == 0 && substr($session->getAutreId(),0,1) == 'W') { $infos = $ws->getAnnoncesAsso($session->getAutreId(), $idAnn, null, $position, $nbAffichage); - } elseif (intval($siren)!=0) { + } elseif (intval($siren) != 0) { $infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage); } else { $idAnn = $session->getSourceId(); - $infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage); + $this->redirect($this->view->url(array('controller'=>'juridique', + 'action'=>'annonce', 'siret'=>$this->siret, 'id'=>$this->id, + 'idAnn'=>$idAnn, 'vue'=>$vue), 'default', true)); } break; case 'bomp': @@ -88,8 +89,11 @@ class JuridiqueController extends Zend_Controller_Action case 'bodacc': case 'abod': default: - if(intval($siren)==0) { + if(intval($siren) == 0) { $idAnn = $session->getSourceId(); + $this->redirect($this->view->url(array('controller'=>'juridique', + 'action'=>'annonce', 'siret'=>$this->siret, 'id'=>$this->id, + 'idAnn'=>$idAnn, 'vue'=>$vue), 'default', true)); } $infos = $ws->getAnnoncesLegales($siren, $idAnn, null, $position, $nbAffichage); break; @@ -114,132 +118,215 @@ class JuridiqueController extends Zend_Controller_Action $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($this->theme->pathScript.'/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()); + // --- Titre de la page + if ( empty($autrePage) ) { + if( empty($siren) ){ + $titre = 'Identifiant '.$this->id; } else { - $this->view->assign('sourceId', null); + $titre = 'Siret '.$siren; } - $this->view->assign('idAnn', $idAnn); - $this->view->assign('annonce', $annonce); + $this->view->headTitle()->prepend('Annonces Légales - '.$titre); + } - if ($request->getParam('q') == 'ajax') { - $this->_helper->layout()->disableLayout(); - $this->renderScript('juridique/annonce-ajax.phtml'); - } else { - $this->view->assign('PageCurrent', $page); - //Définir url pour téléchargement pdf - if (in_array($annonce['Code'], array('BODA', 'BODB', 'BODC'))) { - $datePublication = DateTime::createFromFormat('Y-m-d', $ann->DateParution); - $dateBodacc = DateTime::createFromFormat('Ymd', '20080101'); - $dateTemoinA = DateTime::createFromFormat('Ymd', '20161115'); - $dateTemoinB = DateTime::createFromFormat('Ymd', '20161011'); - $dateTemoinC = DateTime::createFromFormat('Ymd', '20160223'); - - $params = null; - if ($annonce['Code'] == 'BODA' && $datePublication >= $dateTemoinA) { - $params = array('unit'=>1); - $this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication'); - } elseif ($annonce['Code'] == 'BODB' && $datePublication >= $dateTemoinB) { - $params = array('unit'=>1); - $this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication'); - } elseif ($annonce['Code'] == 'BODC' && $datePublication >= $dateTemoinC) { - $params = array('unit'=>1); - $this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication'); - } elseif ($datePublication >= $dateBodacc) { - $params = array(); - $this->view->assign('bodaccLinkLabel', 'Télécharger le bulletin officiel'); - } - - if ($params !== null) { - $params = array_merge($params, array('controller'=>'juridique', - 'action'=>'bodaccpdf', 'siren'=>$siren, 'type'=>substr($annonce['Code'],3,1), - 'parution'=>$annonce['Annee'].str_pad($ann->BodaccNum, 4, '0', STR_PAD_LEFT), - 'annonce'=>$ann->NumAnnonce - )); - $lienBodacc = $this->view->url($params, 'default', true); - $this->view->assign('bodaccLink', $lienBodacc); - } - } - - $this->renderScript('juridique/annonce.phtml'); - } - - // --- Affichage pour la liste des annonces - } else { - // --- Titre de la page - if ( empty($autrePage) ) { - if( empty($siren) ){ - $titre = 'Identifiant '.$this->id; - } else { - $titre = 'Siret '.$siren; - } - $this->view->headTitle()->prepend('Annonces Légales - '.$titre); - } - - // ---- 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('nbReponses', empty($nbReponses) ? 0 : $nbReponses); - $this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal); - - $classType = 'annonces'.ucfirst($vue);; - $annonces = array(); - if (count($objAnnonces->$classType) > 0) { - foreach($objAnnonces->$classType as $ann) { - $annonces[] = $objAnnonces->getAnnonceResume($ann); - } - Zend_Registry::get('firebug')->info($annonces); - $this->view->assign($classType, $annonces); + // ---- 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; } - $this->view->headScript()->appendFile($this->theme->pathScript.'/annonces.js', 'text/javascript'); - } - } + $pageNext = $page + 1; + if( $pageNext > $pageTotal ) { + $pageNext = $pageTotal; + } + } else { + $pageTotal = $pageCurrent = 1; + } + $this->view->assign('PageTotal', $pageTotal); + $this->view->assign('PagePrev', $pagePrev); + $this->view->assign('PageNext', $pageNext); + $this->view->assign('PageCurrent', $pageCurrent); + + $this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses); + $this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal); + + $classType = 'annonces'.ucfirst($vue);; + $annonces = array(); + if (count($objAnnonces->$classType) > 0) { + foreach($objAnnonces->$classType as $ann) { + $annonces[] = $objAnnonces->getAnnonceResume($ann); + } + Zend_Registry::get('firebug')->info($annonces); + $this->view->assign('annonces', $annonces); + } + $this->view->headScript()->appendFile($this->theme->pathScript.'/annonces.js', 'text/javascript'); + } + } + + /** + * Affichage d'une annonce + */ + public function annonceAction() + { + $request = $this->getRequest(); + + $autrePage = $request->getParam('apage'); + + $idAnn = $request->getParam('idAnn', null); + $siren = substr($this->siret, 0,9); + + $vue = $request->getParam('vue', 'bodacc'); + $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 Scores_Session_Entreprise($this->siret, $this->id); + $fj = $session->getFormeJuridique(); + if ($fj > 9000 && $fj < 9999 && intval($siren) == 0) { + $vue = 'asso'; + } + + $page = $request->getParam('page'); + $this->view->assign('page', $page); + + $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', $autrePage); + + if ($session->getSource() == '006' || $session->getSourceId() == '007') { + $this->view->assign('AutreSource', true); + } else { + $this->view->assign('vue', $vue); + $ws = new WsScores(); + switch ($vue) { + case 'balo': + $infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAffichage); + break; + case 'asso': + if ( intval($siren)==0 && substr($session->getAutreId(),0,1)=='W' ) { + $infos = $ws->getAnnoncesAsso($session->getAutreId(), $idAnn, null, $position, $nbAffichage); + } elseif (intval($siren)!=0) { + $infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage); + } else { + $idAnn = $session->getSourceId(); + $infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage); + } + break; + case 'bomp': + $filtre = $request->getParam('filtre', 'A'); + $this->view->assign('filtre', $filtre); + $infos = $ws->getAnnoncesBoamp($siren, $idAnn, $filtre, $position, $nbAffichage); + break; + case 'bodacc': + case 'abod': + default: + if(intval($siren)==0) { + $idAnn = $session->getSourceId(); + } + $infos = $ws->getAnnoncesLegales($siren, $idAnn, null, $position, $nbAffichage); + break; + } + Zend_Registry::get('firebug')->info($infos); + if ($infos === false) { + $this->forward('soap', 'error'); + } + + 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')); + + if ( $user->checkModeEdition() ){ + $this->view->headScript() + ->appendFile($this->theme->pathScript.'/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->view->assign('ajax', 1); + } else { + // Définir url pour téléchargement pdf + if (in_array($annonce['Code'], array('BODA', 'BODB', 'BODC'))) { + $datePublication = DateTime::createFromFormat('Y-m-d', $ann->DateParution); + $dateBodacc = DateTime::createFromFormat('Ymd', '20080101'); + $dateTemoinA = DateTime::createFromFormat('Ymd', '20161115'); + $dateTemoinB = DateTime::createFromFormat('Ymd', '20161011'); + $dateTemoinC = DateTime::createFromFormat('Ymd', '20160223'); + + $params = null; + if ($annonce['Code'] == 'BODA' && $datePublication >= $dateTemoinA) { + $params = array('unit'=>1); + $this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication'); + } elseif ($annonce['Code'] == 'BODB' && $datePublication >= $dateTemoinB) { + $params = array('unit'=>1); + $this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication'); + } elseif ($annonce['Code'] == 'BODC' && $datePublication >= $dateTemoinC) { + $params = array('unit'=>1); + $this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication'); + } elseif ($datePublication >= $dateBodacc) { + $params = array(); + $this->view->assign('bodaccLinkLabel', 'Télécharger le bulletin officiel'); + } + + if ($params !== null) { + $params = array_merge($params, array('controller'=>'juridique', + 'action'=>'bodaccpdf', 'siren'=>$siren, 'type'=>substr($annonce['Code'],3,1), + 'parution'=>$annonce['Annee'].str_pad($ann->BodaccNum, 4, '0', STR_PAD_LEFT), + 'annonce'=>$ann->NumAnnonce + )); + $lienBodacc = $this->view->url($params, 'default', true); + $this->view->assign('bodaccLink', $lienBodacc); + } + } + } + } } /** diff --git a/application/modules/default/views/default/scripts/juridique/annonce-ajax.phtml b/application/modules/default/views/default/scripts/juridique/annonce-ajax.phtml deleted file mode 100644 index 430a3fef3..000000000 --- a/application/modules/default/views/default/scripts/juridique/annonce-ajax.phtml +++ /dev/null @@ -1 +0,0 @@ -RemplaceSiren(substr($this->annonce['Texte'],0,1000))?> \ No newline at end of file diff --git a/application/modules/default/views/default/scripts/juridique/annonce.phtml b/application/modules/default/views/default/scripts/juridique/annonce.phtml index 2348c7cda..cc004c74f 100644 --- a/application/modules/default/views/default/scripts/juridique/annonce.phtml +++ b/application/modules/default/views/default/scripts/juridique/annonce.phtml @@ -1,3 +1,6 @@ +ajax) {?> +RemplaceSiren(substr($this->annonce['Texte'],0,1000))?> +

ANNONCES LÉGALES

@@ -89,12 +92,9 @@ if ($this->hasModeEdition){ foreach ( $liensEdit as $lienId => $lienItem ){ ?> + 'controller'=>'saisie', 'action'=>'annoncedialog', 'siret'=>$this->siret, 'op'=>$lienId, + 'code'=>$this->annonce['Code'], 'idAnn'=>$this->idAnn,), 'default', true)?>"> + hasModeEdition){
siret)!=0) {?> -url(array('controller' => 'juridique', 'action' => 'annonces', - 'siret' => $this->siret, 'id' => $this->id, 'vue' => $this->vue, 'page' => $this->PageCurrent, -), 'default', true); -?> -Revenir à la liste des annonces + + Revenir à la liste des annonces
render('cgu.phtml', $this->cgu)?> -
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/application/modules/default/views/default/scripts/juridique/annonces-resume.phtml b/application/modules/default/views/default/scripts/juridique/annonces-resume.phtml deleted file mode 100644 index aaae30b52..000000000 --- a/application/modules/default/views/default/scripts/juridique/annonces-resume.phtml +++ /dev/null @@ -1,31 +0,0 @@ -deleted!='') { - $class = ' class="deleted"'; -} -?> -> - - Le date?> - - - - logo)) {?> - - - - - - - lib?> - - RemplaceSiren($this->texte)?> - - diff --git a/application/modules/default/views/default/scripts/juridique/annonces.phtml b/application/modules/default/views/default/scripts/juridique/annonces.phtml index 7d03a5894..f2a9f6304 100644 --- a/application/modules/default/views/default/scripts/juridique/annonces.phtml +++ b/application/modules/default/views/default/scripts/juridique/annonces.phtml @@ -35,10 +35,10 @@ AutreSource){ ?> -

EVÉNEMENTS LÉGAUX

-
- Aucune annonces disponible pour cette entité. -
+

EVÉNEMENTS LÉGAUX

+
+Aucune annonces disponible pour cette entité. +
AutrePage)) {?> @@ -131,36 +131,10 @@ a.lienType { -vue=='bodacc') {?> -

EVÉNEMENTS LÉGAUX

-
- annoncesBodacc) == 0) { ?> - Néant - - - partialLoop('juridique/annonces-resume.phtml', $this->annoncesBodacc)?> -
- -
- - -vue=='balo') {?> -

BALO

-
- annoncesBalo) == 0){ ?> - Néant - - - partialLoop('juridique/annonces-resume.phtml', $this->annoncesBalo)?> -
- -
- - vue == 'bomp') {?>
-
+