From da1c3a61340aa5a45a61131c428e343c19713296 Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 23 Jan 2023 15:34:51 +0100 Subject: [PATCH 01/35] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20table=20des=20s?= =?UTF-8?q?tatuts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2.5-47-platau-export-pieces-jointes.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sql/migrations/2.5-47-platau-export-pieces-jointes.sql diff --git a/sql/migrations/2.5-47-platau-export-pieces-jointes.sql b/sql/migrations/2.5-47-platau-export-pieces-jointes.sql new file mode 100644 index 00000000..2add0d7f --- /dev/null +++ b/sql/migrations/2.5-47-platau-export-pieces-jointes.sql @@ -0,0 +1,16 @@ +SET NAMES 'utf8'; + +CREATE TABLE IF NOT EXISTS `piecejointestatut` ( + `ID_PIECEJOINTESTATUT` int(20) NOT NULL AUTO_INCREMENT, + `NOM_STATUT` varchar(50), + PRIMARY KEY (`ID_PIECEJOINTESTATUT`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `piecejointestatut`(`NOM_STATUT`) VALUES +('not_exported'), +('to_be_exported'), +('exported'); + +ALTER TABLE `piecejointe` ADD COLUMN `ID_PIECEJOINTESTATUT` int(20) DEFAULT 1; +ALTER TABLE `piecejointe` + ADD CONSTRAINT `fk_piecejointe_piecejointestatut1` FOREIGN KEY (`ID_PIECEJOINTESTATUT`) REFERENCES `piecejointestatut` (`ID_PIECEJOINTESTATUT`) ON DELETE SET NULL ON UPDATE CASCADE; From 23b96d37f4cc5012288b570cec0f61b70ea72674 Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 23 Jan 2023 16:53:25 +0100 Subject: [PATCH 02/35] =?UTF-8?q?Suppression=20d'un=20fichier=20non=20util?= =?UTF-8?q?is=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/scripts/dossier/piecejointe.phtml | 190 ------------------ 1 file changed, 190 deletions(-) delete mode 100755 application/views/scripts/dossier/piecejointe.phtml diff --git a/application/views/scripts/dossier/piecejointe.phtml b/application/views/scripts/dossier/piecejointe.phtml deleted file mode 100755 index 3585dcf0..00000000 --- a/application/views/scripts/dossier/piecejointe.phtml +++ /dev/null @@ -1,190 +0,0 @@ -"; - foreach($fichier as $value) { - //on retire le / qui précéde le nom des fichiers - $nom = substr($value,1); - if($value != '/Thumbs.db'){ - $type_fic = explode('.', $nom); - switch($type_fic[1]){ - case "pdf": - $classe= "pj_icon pdf"; - break; - case "jpg": - $classe= "pj_icon jpg"; - break; - case "odt": - $classe= "pj_icon doc"; - break; - default: - - break; - } - echo " -
  • - - ".$nom." - - × - -
  • - "; - } - } - echo ""; -} - -//Si on détecte un upload -if( isset($_POST['upload']) ) // si formulaire soumis -{ - $content_dir = './pj/dossier/'.$this->id_dossier.'/'; // dossier où sera déplacé le fichier - if (is_dir($content_dir) == true) - { - //echo "Le dossier existe déjà
    "; - } - else - { - mkdir ($content_dir, 0777); - } - - $tmp_file = $_FILES['fichier']['tmp_name']; - if( !is_uploaded_file($tmp_file) ) - { - //exit("Le fichier est introuvable"); - } - - // on vérifie maintenant l'extension - $type_file = $_FILES['fichier']['type']; - if( !strstr($type_file, 'jpg') && !strstr($type_file, 'jpeg') && !strstr($type_file, 'bmp') && !strstr($type_file, 'gif') && !strstr($type_file, 'png') && !strstr($type_file, 'pdf') && !strstr($type_file, 'odt') && !strstr($type_file, 'doc') && !strstr($type_file, 'sdc') && !strstr($type_file, 'xls')) - { - //exit("Le fichier n'est pas une image"); - } - - // on copie le fichier dans le dossier de destination - $name_file = $_FILES['fichier']['name']; - - if( !move_uploaded_file($tmp_file, $content_dir . $name_file) ) - { - //exit("Impossible de copier le fichier dans $content_dir"); - } - - //echo "Le fichier a bien été uploadé"; -} - -if( !isset($_POST['do'])) -{ - -?> - - - - -

    Liste des pièces jointes

    -
    + Ajouter une pièce jointe
    - -
    -
    Classer par
    - type - ordre alphabétique - date -
    - "; - - //$testHelper = $this->_helper->fctTest('DossierPj'); - //$this->DossierPj('listing'); - - //echo $this->listing(); - echo listing("pj/dossier/".$this->id_dossier,$this->id_dossier); - echo " - - "; - -}else{ - if($_POST['do'] == 'deletePj'){ - echo unlink("pj/dossier/".$this->id_dossier."/".$_POST['name']); - } -} - -?> \ No newline at end of file From 4b63a9e758fec71cd89ceb5a5cf109cec7f08fef Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Wed, 25 Jan 2023 11:04:35 +0100 Subject: [PATCH 03/35] =?UTF-8?q?Ajout=20des=20cases=20=C3=A0=20cocher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/PieceJointeController.php | 2 + application/models/DbTable/PieceJointe.php | 12 +- application/modules/api/configs/routes.xml | 6 +- .../views/scripts/piece-jointe/display.phtml | 79 +++-- .../views/scripts/piece-jointe/form.phtml | 36 +-- .../views/scripts/piece-jointe/index.phtml | 299 ++++++++---------- public/css/pieces-jointes.css | 7 + 7 files changed, 228 insertions(+), 213 deletions(-) create mode 100644 public/css/pieces-jointes.css diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index 7d4d82e8..fc7e923c 100755 --- a/application/controllers/PieceJointeController.php +++ b/application/controllers/PieceJointeController.php @@ -16,6 +16,8 @@ public function init() public function indexAction() { + $this->view->headLink()->appendStylesheet('/css/pieces-jointes.css', 'all'); + // Modèles $DBused = new Model_DbTable_PieceJointe; diff --git a/application/models/DbTable/PieceJointe.php b/application/models/DbTable/PieceJointe.php index 02876593..ec460075 100755 --- a/application/models/DbTable/PieceJointe.php +++ b/application/models/DbTable/PieceJointe.php @@ -3,16 +3,18 @@ class Model_DbTable_PieceJointe extends Zend_Db_Table_Abstract { protected $_name="piecejointe"; // Nom de la base - protected $_primary = "ID_PIECEJOINTE"; // Clé primaire + protected $_primary = "ID_PIECEJOINTE"; // Cl� primaire public function affichagePieceJointe($table, $champ, $identifiant) { $select = $this->select() ->setIntegrityCheck(false) - ->from("piecejointe") - ->join($table, "piecejointe.ID_PIECEJOINTE = $table.ID_PIECEJOINTE") - ->where($champ." = ".$identifiant) - ->order("piecejointe.ID_PIECEJOINTE DESC"); + ->from(['pj' => 'piecejointe']) + ->join($table, "pj.ID_PIECEJOINTE = {$table}.ID_PIECEJOINTE") + ->joinLeft(['pjs' => 'piecejointestatut'], 'pj.ID_PIECEJOINTESTATUT = pjs.ID_PIECEJOINTESTATUT', ['NOM_STATUT']) + ->where($champ.' = '.$identifiant) + ->order('pj.ID_PIECEJOINTE DESC') + ; return ( $this->fetchAll( $select ) != null ) ? $this->fetchAll( $select )->toArray() : null; } diff --git a/application/modules/api/configs/routes.xml b/application/modules/api/configs/routes.xml index b5a97539..e68a9726 100755 --- a/application/modules/api/configs/routes.xml +++ b/application/modules/api/configs/routes.xml @@ -135,7 +135,7 @@ - + user @@ -163,8 +163,8 @@ - + - \ No newline at end of file + diff --git a/application/views/scripts/piece-jointe/display.phtml b/application/views/scripts/piece-jointe/display.phtml index 3dddd20a..45db3d1e 100755 --- a/application/views/scripts/piece-jointe/display.phtml +++ b/application/views/scripts/piece-jointe/display.phtml @@ -1,29 +1,52 @@ listePj as $pj) : ?> - - - - 'piece-jointe', 'action' => 'get', 'id' => $this->id, 'idpj' => $pj['ID_PIECEJOINTE'], 'type' => $this->type)) ?>' title="" target='_blank' > - - - - ", "" ,$pj['DESCRIPTION_PIECEJOINTE'])) ?> - - - - get( Zend_Date::DAY."/".Zend_Date::MONTH."/".Zend_Date::YEAR ); - ?> - - - - verrou != 1): ?> - - - - - - - \ No newline at end of file + + + + 'piece-jointe', 'action' => 'get', 'id' => $this->id, 'idpj' => $pj['ID_PIECEJOINTE'], 'type' => $this->type)) ?>' + title="" + target='_blank' > + + + + + + ", "" ,$pj['DESCRIPTION_PIECEJOINTE'])) ?> + + + + get( Zend_Date::DAY."/".Zend_Date::MONTH."/".Zend_Date::YEAR ); + ?> + + + + + + + +
    En attente d'envoi
    + +
    Envoyé
    + +
    Statut inconnu
    + + + + + + verrou != 1): ?> + + + + + + + diff --git a/application/views/scripts/piece-jointe/form.phtml b/application/views/scripts/piece-jointe/form.phtml index 8197fc08..5672ae9f 100755 --- a/application/views/scripts/piece-jointe/form.phtml +++ b/application/views/scripts/piece-jointe/form.phtml @@ -1,39 +1,39 @@
    - +
    Fichier à envoyer
    type == 'etablissement') : ?> -
    Mise en avant (si c'est une image)
    -
    -
      -
    • Seulement dans la liste principale
    • -
    • Afficher l'image dans le diaporama
    • -
    • Afficher l'image dans les plans
    • -
    -
    +
    Mise en avant (si c'est une image)
    +
    +
      +
    • Seulement dans la liste principale
    • +
    • Afficher l'image dans le diaporama
    • +
    • Afficher l'image dans les plans
    • +
    +
    - +
    Libellé de la pièce jointe (laissez vide pour conserver le nom par défaut)
    - +
    Description
    - + type == 'dossier') : ?>
    Entités avec lesquels vous souhaitez lier la pièce jointe
    - listeEtablissement as $etab) : ?> - ' /> ( )
    - + listeEtablissement as $etab) : ?> + ' /> ( )
    +
    - +
    - -
    \ No newline at end of file + + diff --git a/application/views/scripts/piece-jointe/index.phtml b/application/views/scripts/piece-jointe/index.phtml index 208008da..1909da7f 100755 --- a/application/views/scripts/piece-jointe/index.phtml +++ b/application/views/scripts/piece-jointe/index.phtml @@ -1,136 +1,129 @@ -

    Liste de pièces jointes -Ajouter une piece jointe - - "; -?> + + +

    - - +
    + - + + - - + + - partial("piece-jointe/display.phtml", array("path" => $this->path, "listePj" => $this->listePj, "type" => $this->type, "id" => $this->identifiant, "verrou" => $this->verrou)) - ?> + partial("piece-jointe/display.phtml", array("path" => $this->path, "listePj" => $this->listePj, "type" => $this->type, "id" => $this->identifiant, "verrou" => $this->verrou)) + ?>
    NomNom Description Date d'ajoutEnvoyer vers Plat'AU
    - \ No newline at end of file + + }); + + // Si un fichier est bien uploadé, on l'ajoute à la liste + function callback(id, ext) { + $.ajax({ + url: "/piece-jointe/check", + data: { + "format": "json", + "idpj" : id, + "ext" : ext, + "type" : "type ?>", + "id" : "identifiant ?>" + }, + type: "post", + success: function(result) { + // On détruit la fenetre de load + $("#load").remove(); + + if (result.exists) { + // Ajout d'une ligne + $("#tabPieceJointe tbody").prepend(result.html); + + // Mise à jour + $("#listePieceJointe table").trigger("update"); + $("#listePieceJointe table").trigger("sorton", [[3,1]]); + } + + $("#listePieceJointe").show(); + $("#listePieceJointe-no").hide(); + } + }); + } + + diff --git a/public/css/pieces-jointes.css b/public/css/pieces-jointes.css new file mode 100644 index 00000000..ee63b57f --- /dev/null +++ b/public/css/pieces-jointes.css @@ -0,0 +1,7 @@ +.table td.checkbox { + text-align: center; +} + +.table td.checkbox input { + float: none; +} \ No newline at end of file From 0d55f73bfd69e750358f2d76de2e2dfd00177e6d Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 30 Jan 2023 16:08:04 +0100 Subject: [PATCH 04/35] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20statuts=20"p?= =?UTF-8?q?as=20envoy=C3=A9"=20=3D>=20"en=20attente=20d'envoi"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/PieceJointeController.php | 31 ++++++++-- application/models/DbTable/PieceJointe.php | 52 ++++++++-------- application/navigation.xml | 5 ++ .../views/scripts/piece-jointe/display.phtml | 9 ++- .../views/scripts/piece-jointe/index.phtml | 61 +++++++++++++------ public/css/pieces-jointes.css | 8 +-- 6 files changed, 110 insertions(+), 56 deletions(-) diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index fc7e923c..a418ffae 100755 --- a/application/controllers/PieceJointeController.php +++ b/application/controllers/PieceJointeController.php @@ -10,8 +10,11 @@ public function init() // Actions à effectuées en AJAX $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext->addActionContext('check', 'json') - ->initContext(); + $ajaxContext + ->addActionContext('check', 'json') + ->addActionContext('export-platau', 'json') + ->initContext() + ; } public function indexAction() @@ -360,6 +363,26 @@ public function checkAction() )); } } - - + + public function exportPlatauAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $dbPj = new Model_DbTable_PieceJointe(); + $post = $this->getRequest()->getPost(); + + $formData = $post['formData']; + $toBeExported = []; + + $toBeExported = array_filter($formData, function ($v) { + $checkboxValue = filter_var($v['value'], FILTER_VALIDATE_BOOLEAN); + + return $checkboxValue === true; + }); + + array_map(function ($value) use ($dbPj) { + $dbPj->updatePlatauStatus($value['id'], 2); + }, $toBeExported); + } } diff --git a/application/models/DbTable/PieceJointe.php b/application/models/DbTable/PieceJointe.php index ec460075..3bf90449 100755 --- a/application/models/DbTable/PieceJointe.php +++ b/application/models/DbTable/PieceJointe.php @@ -1,31 +1,35 @@ select() + ->setIntegrityCheck(false) + ->from(['pj' => 'piecejointe']) + ->join($table, "pj.ID_PIECEJOINTE = {$table}.ID_PIECEJOINTE") + ->joinLeft(['pjs' => 'piecejointestatut'], 'pj.ID_PIECEJOINTESTATUT = pjs.ID_PIECEJOINTESTATUT', ['NOM_STATUT']) + ->where($champ.' = '.$identifiant) + ->order('pj.ID_PIECEJOINTE DESC') + ; + + return ( $this->fetchAll( $select ) != null ) ? $this->fetchAll( $select )->toArray() : null; + } - public function affichagePieceJointe($table, $champ, $identifiant) - { - $select = $this->select() - ->setIntegrityCheck(false) - ->from(['pj' => 'piecejointe']) - ->join($table, "pj.ID_PIECEJOINTE = {$table}.ID_PIECEJOINTE") - ->joinLeft(['pjs' => 'piecejointestatut'], 'pj.ID_PIECEJOINTESTATUT = pjs.ID_PIECEJOINTESTATUT', ['NOM_STATUT']) - ->where($champ.' = '.$identifiant) - ->order('pj.ID_PIECEJOINTE DESC') - ; + public function maxPieceJointe() + { + $select = 'SELECT MAX(ID_PIECEJOINTE) + FROM piecejointe + ;'; - return ( $this->fetchAll( $select ) != null ) ? $this->fetchAll( $select )->toArray() : null; - } + return $this->getAdapter()->fetchRow($select); + } - public function maxPieceJointe() - { - //echo "les champs : ".$table.$champ.$identifiant."
    "; - $select = "SELECT MAX(ID_PIECEJOINTE) - FROM piecejointe - ;"; - //echo $select; - return $this->getAdapter()->fetchRow($select); - } + public function updatePlatauStatus(int $id, int $status): void + { + $this->update(["ID_PIECEJOINTESTATUT" => $status], "ID_PIECEJOINTE = $id"); } +} diff --git a/application/navigation.xml b/application/navigation.xml index a98cb62d..d3b73523 100755 --- a/application/navigation.xml +++ b/application/navigation.xml @@ -686,6 +686,11 @@ check modification_odj + + piece-jointe + exportPlatau + modification_odj + diff --git a/application/views/scripts/piece-jointe/display.phtml b/application/views/scripts/piece-jointe/display.phtml index 45db3d1e..15939aa7 100755 --- a/application/views/scripts/piece-jointe/display.phtml +++ b/application/views/scripts/piece-jointe/display.phtml @@ -22,21 +22,20 @@ ?> - - + -
    En attente d'envoi
    +
    En attente d'envoi
    -
    Envoyé
    +
    Envoyé
    -
    Statut inconnu
    +
    Statut inconnu
    diff --git a/application/views/scripts/piece-jointe/index.phtml b/application/views/scripts/piece-jointe/index.phtml index 1909da7f..d29f2209 100755 --- a/application/views/scripts/piece-jointe/index.phtml +++ b/application/views/scripts/piece-jointe/index.phtml @@ -9,24 +9,29 @@
    -
    - - - - - - - - - - - - partial("piece-jointe/display.phtml", array("path" => $this->path, "listePj" => $this->listePj, "type" => $this->type, "id" => $this->identifiant, "verrou" => $this->verrou)) - ?> - -
    NomDescriptionDate d'ajoutEnvoyer vers Plat'AU
    -
    +
    +
    + + + + + + + + + + + + partial("piece-jointe/display.phtml", array("path" => $this->path, "listePj" => $this->listePj, "type" => $this->type, "id" => $this->identifiant, "verrou" => $this->verrou)) + ?> + +
    NomDescriptionDate d'ajoutEnvoyer vers Plat'AU
    +
    + + +
    + - diff --git a/public/css/pieces-jointes.css b/public/css/pieces-jointes.css index ee63b57f..a4eb307c 100644 --- a/public/css/pieces-jointes.css +++ b/public/css/pieces-jointes.css @@ -1,7 +1,7 @@ -.table td.checkbox { - text-align: center; +.table td.checkbox input { + margin-left: 0; } -.table td.checkbox input { - float: none; +.table td.checkbox > .alert { + margin: auto; } \ No newline at end of file From 2571be52a96701c89b3876a343c20393a6b63ca7 Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 30 Jan 2023 16:38:40 +0100 Subject: [PATCH 05/35] =?UTF-8?q?Simplifie=20le=20passage=20des=20donn?= =?UTF-8?q?=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/PieceJointeController.php | 15 +++++---------- .../views/scripts/piece-jointe/index.phtml | 7 +++---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index a418ffae..b4b95fec 100755 --- a/application/controllers/PieceJointeController.php +++ b/application/controllers/PieceJointeController.php @@ -372,17 +372,12 @@ public function exportPlatauAction() $dbPj = new Model_DbTable_PieceJointe(); $post = $this->getRequest()->getPost(); - $formData = $post['formData']; - $toBeExported = []; - - $toBeExported = array_filter($formData, function ($v) { - $checkboxValue = filter_var($v['value'], FILTER_VALIDATE_BOOLEAN); - - return $checkboxValue === true; + $toBeExported = array_filter($post, function ($v) { + return filter_var($v, FILTER_VALIDATE_BOOLEAN) === true; }); - array_map(function ($value) use ($dbPj) { - $dbPj->updatePlatauStatus($value['id'], 2); - }, $toBeExported); + foreach (array_keys($toBeExported) as $idPj) { + $dbPj->updatePlatauStatus($idPj, 2); + } } } diff --git a/application/views/scripts/piece-jointe/index.phtml b/application/views/scripts/piece-jointe/index.phtml index d29f2209..65fd52e5 100755 --- a/application/views/scripts/piece-jointe/index.phtml +++ b/application/views/scripts/piece-jointe/index.phtml @@ -181,19 +181,18 @@ disabledTest(); $('#export-platau').click(function() { - const formData = [] + const formData = {} const inputs = document.querySelectorAll('input[name="export-pj-platau"]') inputs.forEach(input => { const idPj = input['attributes']['data-id'].value - const object = { 'id': idPj, 'value': input.checked } - formData.push(object) + formData[idPj] = input.checked }) $.post( "/piece-jointe/export-platau", - { formData }, + formData, () => { location.reload() } From 81bda3d909ae2f99292e741d8d9140ea876c6e3b Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 30 Jan 2023 16:55:49 +0100 Subject: [PATCH 06/35] Ajout d'un statut d'erreur --- application/views/scripts/piece-jointe/display.phtml | 3 +++ sql/migrations/2.5-47-platau-export-pieces-jointes.sql | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/application/views/scripts/piece-jointe/display.phtml b/application/views/scripts/piece-jointe/display.phtml index 15939aa7..608153af 100755 --- a/application/views/scripts/piece-jointe/display.phtml +++ b/application/views/scripts/piece-jointe/display.phtml @@ -32,6 +32,9 @@
    Envoyé
    + +
    Erreur lors de l'envoi
    diff --git a/sql/migrations/2.5-47-platau-export-pieces-jointes.sql b/sql/migrations/2.5-47-platau-export-pieces-jointes.sql index 2add0d7f..41b7adf4 100644 --- a/sql/migrations/2.5-47-platau-export-pieces-jointes.sql +++ b/sql/migrations/2.5-47-platau-export-pieces-jointes.sql @@ -9,7 +9,8 @@ CREATE TABLE IF NOT EXISTS `piecejointestatut` ( INSERT INTO `piecejointestatut`(`NOM_STATUT`) VALUES ('not_exported'), ('to_be_exported'), -('exported'); +('exported'), +('on_error'); ALTER TABLE `piecejointe` ADD COLUMN `ID_PIECEJOINTESTATUT` int(20) DEFAULT 1; ALTER TABLE `piecejointe` From 46afe12397f55d8ecfa0ec8f41618ef0d9bbc90e Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 6 Feb 2023 15:58:42 +0100 Subject: [PATCH 07/35] =?UTF-8?q?Interdit=20la=20suppression=20d'une=20pj?= =?UTF-8?q?=20en=20attente=20d'envoi=20ou=20envoy=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/scripts/piece-jointe/display.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/scripts/piece-jointe/display.phtml b/application/views/scripts/piece-jointe/display.phtml index 608153af..c2db8640 100755 --- a/application/views/scripts/piece-jointe/display.phtml +++ b/application/views/scripts/piece-jointe/display.phtml @@ -44,7 +44,7 @@ - verrou != 1): ?> + verrou != 1 && !in_array($pj['NOM_STATUT'], ['to_be_exported', 'exported'])): ?> From 3b01b4743ad1147e17dc75630f1bd5077bee2a97 Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 6 Feb 2023 17:04:46 +0100 Subject: [PATCH 08/35] =?UTF-8?q?Permet=20de=20renvoyer=20une=20pj=20dont?= =?UTF-8?q?=20l'envoi=20=C3=A9tait=20en=20erreur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/PieceJointeController.php | 17 +++++++++++++++-- application/models/DbTable/PieceJointe.php | 12 ++++++++++-- .../models/DbTable/PieceJointeStatut.php | 7 +++++++ application/navigation.xml | 5 +++++ .../views/scripts/piece-jointe/display.phtml | 3 +++ public/css/pieces-jointes.css | 4 ++++ public/js/dossier/pieceJointe.js | 13 +++++++++++++ 7 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 application/models/DbTable/PieceJointeStatut.php create mode 100644 public/js/dossier/pieceJointe.js diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index b4b95fec..16f9473b 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() { @@ -15,10 +16,13 @@ public function init() ->addActionContext('export-platau', '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 @@ -369,7 +373,6 @@ public function exportPlatauAction() $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); - $dbPj = new Model_DbTable_PieceJointe(); $post = $this->getRequest()->getPost(); $toBeExported = array_filter($post, function ($v) { @@ -377,7 +380,17 @@ public function exportPlatauAction() }); foreach (array_keys($toBeExported) as $idPj) { - $dbPj->updatePlatauStatus($idPj, 2); + $this->dbPj->updatePlatauStatus($idPj, 'to_be_exported'); } } + + public function retryExportPlatauAction() + { + $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'); + } } diff --git a/application/models/DbTable/PieceJointe.php b/application/models/DbTable/PieceJointe.php index 3bf90449..89adec9d 100755 --- a/application/models/DbTable/PieceJointe.php +++ b/application/models/DbTable/PieceJointe.php @@ -28,8 +28,16 @@ public function maxPieceJointe() return $this->getAdapter()->fetchRow($select); } - public function updatePlatauStatus(int $id, int $status): void + public function updatePlatauStatus(int $id, string $status): void { - $this->update(["ID_PIECEJOINTESTATUT" => $status], "ID_PIECEJOINTE = $id"); + $modelPjStatus = new Model_DbTable_PieceJointeStatut(); + + $idStatus = $modelPjStatus->fetchRow( + $modelPjStatus->select() + ->from('piecejointestatut') + ->where('NOM_STATUT = ?', $status) + )['ID_PIECEJOINTESTATUT']; + + $this->update(["ID_PIECEJOINTESTATUT" => $idStatus], "ID_PIECEJOINTE = $id"); } } diff --git a/application/models/DbTable/PieceJointeStatut.php b/application/models/DbTable/PieceJointeStatut.php new file mode 100644 index 00000000..a8b7cc66 --- /dev/null +++ b/application/models/DbTable/PieceJointeStatut.php @@ -0,0 +1,7 @@ +exportPlatau modification_odj + + piece-jointe + retryExportPlatau + modification_odj + diff --git a/application/views/scripts/piece-jointe/display.phtml b/application/views/scripts/piece-jointe/display.phtml index c2db8640..5f1fb170 100755 --- a/application/views/scripts/piece-jointe/display.phtml +++ b/application/views/scripts/piece-jointe/display.phtml @@ -35,6 +35,9 @@
    Erreur lors de l'envoi
    +
    + Renvoyer +
    diff --git a/public/css/pieces-jointes.css b/public/css/pieces-jointes.css index a4eb307c..44540a2e 100644 --- a/public/css/pieces-jointes.css +++ b/public/css/pieces-jointes.css @@ -4,4 +4,8 @@ .table td.checkbox > .alert { margin: auto; +} + +.label ~ div { + margin-top: 0.5rem; } \ No newline at end of file diff --git a/public/js/dossier/pieceJointe.js b/public/js/dossier/pieceJointe.js new file mode 100644 index 00000000..d4fac9bf --- /dev/null +++ b/public/js/dossier/pieceJointe.js @@ -0,0 +1,13 @@ +document.addEventListener('DOMContentLoaded', function() { + document.querySelectorAll('.retry-export-platau').forEach((link) => { + link.addEventListener('click', function() { + $.post( + "/piece-jointe/retry-export-platau", + { idPj: link['attributes']['data-id'].value }, + () => { + location.reload() + } + ) + }) + }) +}) \ No newline at end of file From 6cac5ceff78dbcd421a196949d3b2432ec3fffaf Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Tue, 7 Feb 2023 08:27:00 +0100 Subject: [PATCH 09/35] =?UTF-8?q?Libell=C3=A9s=20plus=20descriptifs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/scripts/piece-jointe/index.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/scripts/piece-jointe/index.phtml b/application/views/scripts/piece-jointe/index.phtml index 65fd52e5..7ffccd1e 100755 --- a/application/views/scripts/piece-jointe/index.phtml +++ b/application/views/scripts/piece-jointe/index.phtml @@ -17,7 +17,7 @@ Nom Description Date d'ajout - Envoyer vers Plat'AU + Statut Plat'AU @@ -29,7 +29,7 @@ - + + + + N'oubliez pas de sélectionner les documents à envoyer vers Plat'AU + + do; ?> verrouDossier != 1 && 'edit' == $action): ?>
    @@ -1894,7 +1940,7 @@ echo "
      -
    • +
    • "; if (count($this->preventionnistes) > 0) { foreach ($this->preventionnistes as $prev) { diff --git a/application/views/scripts/piece-jointe/display.phtml b/application/views/scripts/piece-jointe/display.phtml index e650ddad..465b1b95 100755 --- a/application/views/scripts/piece-jointe/display.phtml +++ b/application/views/scripts/piece-jointe/display.phtml @@ -26,7 +26,7 @@ - +
      En attente d'envoi
      diff --git a/application/views/scripts/piece-jointe/export.phtml b/application/views/scripts/piece-jointe/export.phtml new file mode 100644 index 00000000..ec8a731e --- /dev/null +++ b/application/views/scripts/piece-jointe/export.phtml @@ -0,0 +1,18 @@ +
    • +
      + + Liste des pièces jointes pouvant être envoyées vers Plat'AU +
      +
      + piecesJointes as $pieceJointe): ?> +
      +
      + +
      +
      + +
      +
      + +
      +
    • diff --git a/application/views/scripts/piece-jointe/index.phtml b/application/views/scripts/piece-jointe/index.phtml index 3786722f..944103ec 100755 --- a/application/views/scripts/piece-jointe/index.phtml +++ b/application/views/scripts/piece-jointe/index.phtml @@ -30,10 +30,6 @@
    - - isPlatau && count($this->listePj) > 0): ?> - - From 309d24f7276dfeaf8959ddb7554fc7b11e9a0359 Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 20 Feb 2023 09:57:54 +0100 Subject: [PATCH 17/35] Renommage du fichier --- ...eces-jointes.sql => 2.x-01 - platau-export-pieces-jointes.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sql/migrations/{2.5-47-platau-export-pieces-jointes.sql => 2.x-01 - platau-export-pieces-jointes.sql} (100%) diff --git a/sql/migrations/2.5-47-platau-export-pieces-jointes.sql b/sql/migrations/2.x-01 - platau-export-pieces-jointes.sql similarity index 100% rename from sql/migrations/2.5-47-platau-export-pieces-jointes.sql rename to sql/migrations/2.x-01 - platau-export-pieces-jointes.sql From a62bcce1a5df0768846623706e4417bddcc6d664 Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Wed, 15 Mar 2023 10:08:21 +0100 Subject: [PATCH 18/35] syntaxe composer 2 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 52931164..78228fea 100755 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "SDIS62/prevarisc", + "name": "sdis62/prevarisc", "description": "Application web open-source gérant l'ensemble de l'activité du service prévention au sein d'un SDIS.", @@ -23,7 +23,7 @@ "cybermonde/odtphp": "^1.0", "michelf/php-markdown": "^1.0", "kdubuc/gd_resize": "^1.0", - "SDIS62/toolbox": "dev-master", + "sdis62/toolbox": "dev-master", "sebastian/git": "^1.0", "sabre/vobject": "^4.0" }, From c0e0a6b28b58ed08548b9c8317877457f8789d7d Mon Sep 17 00:00:00 2001 From: Maxime Merrien Date: Mon, 27 Feb 2023 16:04:45 +0100 Subject: [PATCH 19/35] Ajout de statuts pour la pec et l'avis platau & Affichage en front --- application/controllers/DossierController.php | 17 ++++ application/layouts/dossier.phtml | 75 ++++++++++------ .../models/DbTable/PlatauConsultation.php | 6 ++ application/models/Enum/PlatauStatutAvis.php | 21 +++++ application/models/Enum/PlatauStatutPec.php | 21 +++++ application/models/PlatauConsultation.php | 70 +++++++++++++++ .../models/PlatauConsultationMapper.php | 88 +++++++++++++++++++ .../2.x-02 - platau-renvoi-pec-avis.sql | 10 +++ 8 files changed, 282 insertions(+), 26 deletions(-) create mode 100644 application/models/DbTable/PlatauConsultation.php create mode 100644 application/models/Enum/PlatauStatutAvis.php create mode 100644 application/models/Enum/PlatauStatutPec.php create mode 100644 application/models/PlatauConsultation.php create mode 100644 application/models/PlatauConsultationMapper.php create mode 100644 sql/migrations/2.x-02 - platau-renvoi-pec-avis.sql diff --git a/application/controllers/DossierController.php b/application/controllers/DossierController.php index 2dcea60e..0866718f 100644 --- a/application/controllers/DossierController.php +++ b/application/controllers/DossierController.php @@ -169,6 +169,23 @@ 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(); + + $this->view->statutPec = $this->view->enumStatutsPec::INCONNU; + $this->view->statutAvis = $this->view->enumStatutsAvis::INCONNU; + + $platauConsultation = $platauConsultationMapper->find($dossier['ID_PLATAU'], $platauConsultationModel); + + if (null !== $platauConsultation) { + $this->view->statutPec = $platauConsultation->getStatutPec(); + $this->view->statutAvis = $platauConsultation->getStatutAvis(); + } + } + $DBdossierType = new Model_DbTable_DossierType(); $libelleType = $DBdossierType->find($dossier->TYPE_DOSSIER)->current(); diff --git a/application/layouts/dossier.phtml b/application/layouts/dossier.phtml index 34d770a7..405ea835 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' ?> - +