From 414d65c37e7b6bad66070a61447f798b09632c94 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 5 Mar 2013 16:25:47 +0000 Subject: [PATCH] =?UTF-8?q?issue=20#0001564=20:=20Correction=20cons=C3=A9q?= =?UTF-8?q?uence=20etablissement=20=C3=A9tranger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/JuridiqueController.php | 297 +++++++++--------- .../default/scripts/juridique/annonces.phtml | 8 +- 2 files changed, 156 insertions(+), 149 deletions(-) diff --git a/application/controllers/JuridiqueController.php b/application/controllers/JuridiqueController.php index 4932caba0..75fc2deb5 100644 --- a/application/controllers/JuridiqueController.php +++ b/application/controllers/JuridiqueController.php @@ -27,7 +27,7 @@ class JuridiqueController extends Zend_Controller_Action $p = $request->getParam('p', 1); $this->view->assign('p', $p); - $idAnn = $request->getParam('idAnn', 0); + $idAnn = $request->getParam('idAnn', null); $siren = substr($this->siret, 0,9); $source = $request->getParam('source'); @@ -45,170 +45,173 @@ class JuridiqueController extends Zend_Controller_Action $vue = 'asso'; } - $this->view->assign('vue', $vue); + if ($session->getSource()!='006') { - $nbAnnonces = 20; - $position = ($p-1)*$nbAnnonces; + $this->view->assign('vue', $vue); - $ws = new WsScores(); - switch ( $vue ) { - case 'bodacc': - case 'abod': - default: - if(intval($siren)==0) { - $idAnn = $session->getSourceId(); - Zend_Registry::get('firebug')->info('Source:'.$idAnn); - } + $nbAnnonces = 20; + $position = ($p-1)*$nbAnnonces; - $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); + $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', - ); + $typeAnnonces = array( + 'Bodacc', + 'Balo', + 'Bomp', + 'Asso', + ); - $user = new Scores_Utilisateur(); - $this->view->assign('hasModeEdition', $user->checkModeEdition()); + $user = new Scores_Utilisateur(); + $this->view->assign('hasModeEdition', $user->checkModeEdition()); - $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')); - $this->view->assign('exportObjet', $infos); - $this->view->assign('surveillance', $user->checkPerm('survannonce')); + $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')); + $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')) ) { + //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'); - } + 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) - ); + $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); + $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); - } + 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'); - } + $this->renderScript('juridique/annonce.phtml'); + } - //Affichage pour la liste des annonces - } else { + //Affichage pour la liste des annonces + } else { - $nbReponses = $infos->nbReponses; - $nbPages = ceil($nbReponses/$nbAnnonces); + $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 - )); - } + //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 - )); - } + 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); + $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'); - } + 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'); + } + } else { + $this->view->assign('idAnn', $idAnn); + } } /** diff --git a/application/views/default/scripts/juridique/annonces.phtml b/application/views/default/scripts/juridique/annonces.phtml index 35a148c4c..29e82b977 100644 --- a/application/views/default/scripts/juridique/annonces.phtml +++ b/application/views/default/scripts/juridique/annonces.phtml @@ -50,7 +50,7 @@
Aucune annonces disponible pour cette entitées.
- + AutrePage)) {?>