diff --git a/application/controllers/DossierController.php b/application/controllers/DossierController.php index 8f4c5b3c..c70f2bdc 100644 --- a/application/controllers/DossierController.php +++ b/application/controllers/DossierController.php @@ -142,7 +142,8 @@ class DossierController extends Zend_Controller_Action public function init() { $this->_helper->layout->setLayout('dossier'); - $this->view->inlineScript()->appendFile('/js/dossier/dossierGeneral.js','text/javascript'); + $this->view->inlineScript()->appendFile('/js/dossier/dossierGeneral.js', 'text/javascript'); + $this->view->inlineScript()->appendFile('/js/dossier/platau.js', 'text/javascript'); // Actions à effectuées en AJAX $ajaxContext = $this->_helper->getHelper('AjaxContext'); @@ -169,6 +170,22 @@ public function init() $dossier = $DBdossier->find($id_dossier)->current(); $this->view->id_platau = null !== $dossier['ID_PLATAU'] ? $dossier['ID_PLATAU'] : null; + if (null !== $dossier['ID_PLATAU']) { + $platauConsultationMapper = new Model_PlatauConsultationMapper(); + $platauConsultationModel = new Model_PlatauConsultation(); + $this->view->enumStatutsPec = new Model_Enum_PlatauStatutPec(); + $this->view->enumStatutsAvis = new Model_Enum_PlatauStatutAvis(); + + $platauConsultation = $platauConsultationMapper->find($dossier['ID_PLATAU'], $platauConsultationModel); + + if (null !== $platauConsultation) { + $this->view->statutPec = $platauConsultation->getStatutPec(); + $this->view->datePec = $platauConsultation->getDatePec(); + $this->view->statutAvis = $platauConsultation->getStatutAvis(); + $this->view->dateAvis = $platauConsultation->getDateAvis(); + } + } + $DBdossierType = new Model_DbTable_DossierType(); $libelleType = $DBdossierType->find($dossier->TYPE_DOSSIER)->current(); @@ -783,7 +800,7 @@ public function saveAction() foreach ($_POST as $libelle => $value) { //On exclu la lecture de selectNature => select avec les natures; //NUM_DOCURB => input text pour la saisie des doc urba; docUrba & natureId => interpreté après; - if ($libelle != "DATEVISITE_PERIODIQUE" && $libelle != "selectNature" && $libelle != "NUM_DOCURBA" && $libelle != "natureId" && $libelle != "docUrba" && $libelle != 'do' && $libelle != 'idDossier' && $libelle != 'HEUREINTERV_DOSSIER' && $libelle != 'idEtablissement' && $libelle != 'ID_AFFECTATION_DOSSIER_VISITE' && $libelle != 'ID_AFFECTATION_DOSSIER_COMMISSION' && $libelle != "preventionniste" && $libelle != "commissionSelect" && $libelle != "ID_CREATEUR" && $libelle != "HORSDELAI_DOSSIER" && $libelle != "genreInfo" && $libelle != "docManquant" && $libelle != "dateReceptionDocManquant" && $libelle != "dateDocManquant" && $libelle != "ABSQUORUM_DOSSIER" && $libelle != "servInst" && $libelle != "servInstVille" && $libelle != "servInstGrp" && $libelle != "repercuterAvis" && $libelle != "INCOMPLET_DOSSIER") { + if ($libelle != "DATEVISITE_PERIODIQUE" && $libelle != "selectNature" && $libelle != "NUM_DOCURBA" && $libelle != "natureId" && $libelle != "docUrba" && $libelle != 'do' && $libelle != 'idDossier' && $libelle != 'HEUREINTERV_DOSSIER' && $libelle != 'idEtablissement' && $libelle != 'ID_AFFECTATION_DOSSIER_VISITE' && $libelle != 'ID_AFFECTATION_DOSSIER_COMMISSION' && $libelle != "preventionniste" && $libelle != "commissionSelect" && $libelle != "ID_CREATEUR" && $libelle != "HORSDELAI_DOSSIER" && $libelle != "genreInfo" && $libelle != "docManquant" && $libelle != "dateReceptionDocManquant" && $libelle != "dateDocManquant" && $libelle != "ABSQUORUM_DOSSIER" && $libelle != "servInst" && $libelle != "servInstVille" && $libelle != "servInstGrp" && $libelle != "repercuterAvis" && $libelle != "INCOMPLET_DOSSIER" && $libelle != "export-pj-platau") { //Test pour voir s'il sagit d'une date pour la convertir au format ENG et l'inserer dans la base de données if ("DATEMAIRIE_DOSSIER" == $libelle || "DATESECRETARIAT_DOSSIER" == $libelle || "DATEVISITE_DOSSIER" == $libelle || "DATECOMM_DOSSIER" == $libelle || "DATESDIS_DOSSIER" == $libelle || "DATEPREF_DOSSIER" == $libelle || "DATEREP_DOSSIER" == $libelle || "DATEREUN_DOSSIER" == $libelle || "DATEINTERV_DOSSIER" == $libelle || "DATESIGN_DOSSIER" == $libelle || "DATEINSERT_DOSSIER" == $libelle || "DATEENVTRANSIT_DOSSIER" == $libelle || "ECHEANCIERTRAV_DOSSIER" == $libelle || "DATETRANSFERTCOMM_DOSSIER" == $libelle || "DATERECEPTIONCOMM_DOSSIER" == $libelle || "DATERVRAT_DOSSIER" == $libelle || "DELAIPRESC_DOSSIER" == $libelle) { if ($value) { @@ -813,6 +830,12 @@ public function saveAction() } } + if ($pjs = $this->_getParam('export-pj-platau')) { + $servicePj = new Service_PieceJointe(); + + $servicePj->exportPlatau($pjs); + } + if (!$this->_getParam('HORSDELAI_DOSSIER')) { $nouveauDossier->HORSDELAI_DOSSIER = 0; } else { diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index 7d4d82e8..a775ccb2 100755 --- a/application/controllers/PieceJointeController.php +++ b/application/controllers/PieceJointeController.php @@ -3,6 +3,7 @@ class PieceJointeController extends Zend_Controller_Action { public $store; + private $dbPj; public function init() { @@ -10,27 +11,33 @@ public function init() // Actions à effectuées en AJAX $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext->addActionContext('check', 'json') - ->initContext(); + $ajaxContext + ->addActionContext('check', 'json') + ->initContext() + ; + + $this->dbPj = new Model_DbTable_PieceJointe(); } public function indexAction() { + $this->view->headScript()->appendFile('/js/dossier/pieceJointe.js', 'text/javascript'); + $this->view->headLink()->appendStylesheet('/css/pieces-jointes.css', 'all'); + // Modèles - $DBused = new Model_DbTable_PieceJointe; + $DBused = new Model_DbTable_PieceJointe(); + $modelDossier = new Model_DbTable_Dossier(); // Cas dossier if ($this->_request->type == "dossier") { $this->view->type = "dossier"; $this->view->identifiant = $this->_request->id; $this->view->pjcomm = $this->_request->pjcomm; - $listePj = $DBused->affichagePieceJointe("dossierpj", "dossierpj.ID_DOSSIER", $this->_request->id); - $this->view->verrou = $this->_request->verrou; - } - - // Cas établissement - else if ($this->_request->type == "etablissement") { - $this->view->type = "etablissement"; + $listePj = $DBused->affichagePieceJointe('dossierpj', 'dossierpj.ID_DOSSIER', $this->_request->id); + $this->view->verrou = $this->_request->verrou; + $this->view->isPlatau = $modelDossier->isPlatau($this->getRequest()->getParam('id')); + } elseif ('etablissement' == $this->_request->type) { // Cas établissement + $this->view->type = 'etablissement'; $this->view->identifiant = $this->_request->id; $listePj = $DBused->affichagePieceJointe("etablissementpj", "etablissementpj.ID_ETABLISSEMENT", $this->_request->id); } @@ -317,6 +324,7 @@ public function checkAction() { // Modèle $DBused = new Model_DbTable_PieceJointe; + $modelDossier = new Model_DbTable_Dossier(); // Cas dossier if ($this->_request->type == "dossier") { @@ -349,15 +357,44 @@ public function checkAction() if ($this->view->exists) { // Données de la pj - $this->view->html = $this->view->partial("piece-jointe/display.phtml", array ( - "path" => $this->getHelper('url')->url(array('controller' => 'piece-jointe', 'id' => $this->_request->id, 'action' => 'get', 'idpj' => $this->_request->idpj, 'type' => $this->_request->type)), - "listePj" => $listePj, - "droit_ecriture" => true, - "type" => $this->_request->type, - "id" => $this->_request->id, - )); - } + $this->view->html = $this->view->partial('piece-jointe/display.phtml', [ + 'path' => $this->getHelper('url')->url(['controller' => 'piece-jointe', 'id' => $this->_request->id, 'action' => 'get', 'idpj' => $this->_request->idpj, 'type' => $this->_request->type]), + 'listePj' => $listePj, + 'droit_ecriture' => true, + 'type' => $this->_request->type, + 'id' => $this->_request->id, + 'isPlatau' => $modelDossier->isPlatau($this->_request->id), + ]); + } + } + + public function retryExportPlatauAction(): void + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $idPj = filter_var($this->getRequest()->getPost()['idPj'], FILTER_VALIDATE_INT); + + $this->dbPj->updatePlatauStatus($idPj, 'to_be_exported'); + } + + /** + * @return null|void + */ + public function displayPjPlatauAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $idDossier = $this->getRequest()->getParam('idDossier'); + $canBeExported = $this->dbPj->getWithStatus($idDossier, 'not_exported'); + + if (0 === count($canBeExported)) { + return null; + } + + $html = Zend_Layout::getMvcInstance()->getView()->partial('piece-jointe/export.phtml', ['piecesJointes' => $canBeExported]); + + echo $html; } - - } diff --git a/application/controllers/PlatauController.php b/application/controllers/PlatauController.php new file mode 100644 index 00000000..3e27c75d --- /dev/null +++ b/application/controllers/PlatauController.php @@ -0,0 +1,43 @@ +_helper->getHelper('AjaxContext'); + $ajaxContext->addActionContext('selectionabreviation', 'json') + ->addActionContext('retryExportPec', 'json') + ->addActionContext('retryExportAvis', 'json') + ->initContext() + ; + + $this->platauConsultationMapper = new Model_PlatauConsultationMapper(); + } + + public function retryExportPecAction(): void + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $platauConsultation = $this->platauConsultationMapper->find($this->getParam('id'), new Model_PlatauConsultation()); + $platauConsultation->setStatutPec('to_export'); + + $this->platauConsultationMapper->save($platauConsultation); + } + + public function retryExportAvisAction(): void + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $platauConsultation = $this->platauConsultationMapper->find($this->getParam('id'), new Model_PlatauConsultation()); + $platauConsultation->setStatutAvis('to_export'); + + $this->platauConsultationMapper->save($platauConsultation); + } +} diff --git a/application/layouts/dossier.phtml b/application/layouts/dossier.phtml index 34d770a7..843bcc31 100755 --- a/application/layouts/dossier.phtml +++ b/application/layouts/dossier.phtml @@ -1,15 +1,13 @@ action != "add" && $this->do != "new" ) : ?> placeholder('lateral_navigation')->captureStart(); // Capture du 'lateral_navigation' ?> - +