diff --git a/class/actes/ActesAnalyseFichierRecuController.php b/class/actes/ActesAnalyseFichierRecuController.php
index ebc67e38fe84c90f0ce97baffa9a6a7e08df56c7..651988c099f9a48ea567e17b79e58f65c5178c95 100644
--- a/class/actes/ActesAnalyseFichierRecuController.php
+++ b/class/actes/ActesAnalyseFichierRecuController.php
@@ -2,15 +2,11 @@
 
 namespace S2lowLegacy\Class\actes;
 
-use Libriciel\LibActes\Utils\XSDValidationException;
-use S2lowLegacy\Class\S2lowLogger;
-use S2lowLegacy\Class\TmpFolder;
 use Exception;
 use finfo;
-use S2lowLegacy\Lib\SigTermHandler;
 use Libriciel\LibActes\ArchiveData;
-use Libriciel\LibActes\FichierXML\MessageMetierARActes;
 use Libriciel\LibActes\FichierXML\MessageMetieAnomalieActe;
+use Libriciel\LibActes\FichierXML\MessageMetierARActes;
 use Libriciel\LibActes\FichierXML\MessageMetierARAnnulation;
 use Libriciel\LibActes\FichierXML\MessageMetierARPieceComplementaire;
 use Libriciel\LibActes\FichierXML\MessageMetierARReponseRejetLettreObservations;
@@ -20,6 +16,10 @@ use Libriciel\LibActes\FichierXML\MessageMetierDemandePieceComplementaire;
 use Libriciel\LibActes\FichierXML\MessageMetierLettreObservations;
 use Libriciel\LibActes\FichierXML\MessageMetierReponseClassificationSansChangement;
 use Libriciel\LibActes\FichierXML\MessageMetierRetourClassification;
+use Libriciel\LibActes\Utils\XSDValidationException;
+use S2lowLegacy\Class\S2lowLogger;
+use S2lowLegacy\Class\TmpFolder;
+use S2lowLegacy\Lib\SigTermHandler;
 use UnexpectedValueException;
 
 class ActesAnalyseFichierRecuController
@@ -402,7 +402,7 @@ class ActesAnalyseFichierRecuController
     {
         $this->s2lowLogger->info("AR Actes trouvé pour l'envoi de piece complementaire : " . $fichierXML->id_actes);
 
-        $transaction_id = $this->getBySirenAndNumeroInterne($fichierXML->siren, $fichierXML->numero_interne, 3, true);
+        $transaction_id = $this->getBySirenAndNumeroInterne($fichierXML->siren, $fichierXML->numero_interne, TypeTransaction::DemandePieceComplementaire, true);
 
         $this->s2lowLogger->info("$fichierXML->id_actes -> transaction_id = $transaction_id");
         $message = "Reçu par le {$this->actes_ministere_acronyme} le " . $fichierXML->date_reception;
@@ -425,7 +425,7 @@ class ActesAnalyseFichierRecuController
     {
         $this->s2lowLogger->info("AR Actes trouvé pour l'envoi d'une réponse ou d'un refus à une lettre d'observation : " . $fichierXML->id_actes);
 
-        $transaction_id = $this->getBySirenAndNumeroInterne($fichierXML->siren, $fichierXML->numero_interne, 4, true);
+        $transaction_id = $this->getBySirenAndNumeroInterne($fichierXML->siren, $fichierXML->numero_interne, TypeTransaction::LettreDObservation, true);
 
         $this->s2lowLogger->info("$fichierXML->id_actes -> transaction_id = $transaction_id");
         $message = "Reçu par le {$this->actes_ministere_acronyme} le " . $fichierXML->date_reception;
@@ -531,7 +531,7 @@ class ActesAnalyseFichierRecuController
             $message,
             $xml
         );
-        $transaction_annulation_id = $this->getBySirenAndNumeroInterne($fichierXML->siren, $fichierXML->numero_interne, 6);
+        $transaction_annulation_id = $this->getBySirenAndNumeroInterne($fichierXML->siren, $fichierXML->numero_interne, TypeTransaction::Annulation);
 
         $this->updateStatus(
             $transaction_annulation_id,
@@ -563,7 +563,7 @@ class ActesAnalyseFichierRecuController
      * @return array|bool|mixed
      * @throws Exception
      */
-    private function getBySirenAndNumeroInterne($siren, $numeroInterne, $type = 1, $type_reponse_not_null = false)
+    private function getBySirenAndNumeroInterne($siren, $numeroInterne, TypeTransaction $type = TypeTransaction::TransmissionActe, $type_reponse_not_null = false)
     {
         $transaction_id = $this->actesTransactionsSQL->getBySirenAndNumeroInterne($siren, $numeroInterne, $type, $type_reponse_not_null);
         if (! $transaction_id) {
@@ -571,7 +571,7 @@ class ActesAnalyseFichierRecuController
                 "Aucune transation trouver pour le couple SIREN $siren - numéro interne $numeroInterne"
             );
         }
-        $this->s2lowLogger->info("Transaction de type $type trouvé avec le SIREN $siren et le numéro interne $numeroInterne : $transaction_id ");
+        $this->s2lowLogger->info("Transaction de type $type->value trouvé avec le SIREN $siren et le numéro interne $numeroInterne : $transaction_id ");
         return $transaction_id;
     }
 }
diff --git a/class/actes/ActesClassificationCreation.php b/class/actes/ActesClassificationCreation.php
index 7e9c7e931d8fd3f235733ee7d5d471a04b881576..c2bb55b21dccd2fd26507407d13766c9795ef5b9 100644
--- a/class/actes/ActesClassificationCreation.php
+++ b/class/actes/ActesClassificationCreation.php
@@ -251,7 +251,7 @@ class ActesClassificationCreation
     {
         $last_classification_date = ActesClassification::getLastRevisionDate($this->authority->getId());
         $trans = new ActesTransaction();
-        $trans->set("type", "7");
+        $trans->setType(TypeTransaction::DemandeDeClassification);
         if (! $force) {
             $trans->set("last_classification_date", $last_classification_date);
         }
diff --git a/class/actes/ActesTransactionsSQL.php b/class/actes/ActesTransactionsSQL.php
index 5be47959114f6d187cc17b3d2a9d7b4c3c8a70e0..1bbe193376deda7f42279781734ddd515396c8e0 100644
--- a/class/actes/ActesTransactionsSQL.php
+++ b/class/actes/ActesTransactionsSQL.php
@@ -279,7 +279,7 @@ WHERE
         return $this->query($sql);
     }
 
-    public function getBySirenAndNumeroInterne($siren, $numero_interne, $type = '1', $type_reponse_not_null = false)
+    public function getBySirenAndNumeroInterne($siren, $numero_interne, TypeTransaction $type = TypeTransaction::TransmissionActe, $type_reponse_not_null = false)
     {
         $sql = "SELECT actes_transactions.id from actes_transactions " .
             " JOIN actes_envelopes ON actes_transactions.envelope_id = actes_envelopes.id " .
@@ -292,7 +292,7 @@ WHERE
         $sql .= " ORDER BY submission_date DESC";
 
 
-        return $this->queryOne($sql, $siren, $numero_interne, $type);
+        return $this->queryOne($sql, $siren, $numero_interne, $type->value);
     }
 
     public function getNbByStatus($status_id)
diff --git a/class/actes/TypeTransaction.php b/class/actes/TypeTransaction.php
new file mode 100644
index 0000000000000000000000000000000000000000..63d230ebd343b586971c60deaad32ac0ca4230b9
--- /dev/null
+++ b/class/actes/TypeTransaction.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace S2lowLegacy\Class\actes;
+
+/**
+ * Les différents types de transaction tels que définis par le cahier des charges ACTES
+ */
+enum TypeTransaction: int
+{
+    case TransmissionActe = 1;
+    case CourrierSimple = 2;
+    case DemandePieceComplementaire = 3;
+    case LettreDObservation = 4;
+    case DefereAuTribunalAdministratif = 5;
+    case Annulation = 6;
+    case DemandeDeClassification = 7;
+}
diff --git a/public.ssl/modules/actes/actes_transac_cancel.php b/public.ssl/modules/actes/actes_transac_cancel.php
index 24e976b24d870b51fca399874615ac7253926335..b19959ffcb4406812d717753b62854d6961ee547 100644
--- a/public.ssl/modules/actes/actes_transac_cancel.php
+++ b/public.ssl/modules/actes/actes_transac_cancel.php
@@ -3,6 +3,7 @@
 // Configuration
 use S2lowLegacy\Class\actes\ActesAntivirusWorker;
 use S2lowLegacy\Class\actes\ActesEnvelopeSerialSQL;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Authority;
 use S2lowLegacy\Class\DatabasePool;
 use S2lowLegacy\Class\Helpers;
@@ -52,8 +53,7 @@ if (isset($related_id) && ! empty($related_id)) {
     Helpers::returnAndExit(1, "Pas d'identifiant de transaction à annuler spécifié.", Helpers::getLink("/modules/actes/index.php"));
 }
 
-// Vérification du type de transaction
-if ($rel_trans->get("type") != 1) {
+if (!$rel_trans->isType(TypeTransaction::TransmissionActe)) {
     Helpers::returnAndExit(1, "Ce type de transaction ne peut pas être annulé.", Helpers::getLink("/modules/actes/actes_transac_show.php?id=") . $rel_trans->getId());
 }
 
@@ -110,7 +110,7 @@ $env->set("telephone", $telephone);
 $env->set("email", $me->get("email"));
 
 // Initialisation de la transaction
-$trans->set("type", "6");
+$trans->setType(TypeTransaction::Annulation);
 $trans->set("related_transaction", $rel_trans);
 $trans->set("related_transaction_id", $related_id);
 $trans->set("number", $rel_trans->get("number"));
diff --git a/public.ssl/modules/actes/actes_transac_close.php b/public.ssl/modules/actes/actes_transac_close.php
index c7ec0cfe0a3dad2b1e3ca58afdba42c6ffd372b7..af213405ccfce3c5a41c65a9d6fc6e61623244f7 100644
--- a/public.ssl/modules/actes/actes_transac_close.php
+++ b/public.ssl/modules/actes/actes_transac_close.php
@@ -1,6 +1,7 @@
 <?php
 
 use S2lowLegacy\Class\actes\ActesPrepareEnvoiSAE;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Authority;
 use S2lowLegacy\Class\Helpers;
 use S2lowLegacy\Class\Initialisation;
@@ -70,7 +71,7 @@ foreach ($liste_id as $id) {
         Helpers::returnAndExit(1, "Erreur d'initialisation de la transaction.", Helpers::getLink('/modules/actes/index.php'));
     }
 
-    if ($trans->get('type') != 1) {
+    if (!$trans->isType(TypeTransaction::TransmissionActe)) {
         Helpers::returnAndExit(1, 'Ce type de transaction ne peut pas être cloturé.', Helpers::getLink('/modules/actes/actes_transac_show.php?id=') . $rel_trans->getId());
     }
 
diff --git a/public.ssl/modules/actes/actes_transac_create.php b/public.ssl/modules/actes/actes_transac_create.php
index 5c285766fb155a525a9f73a66b63d2e4f6177d27..3bf3b1d2030c1a051113db99c5a98fd59b1b8ff0 100644
--- a/public.ssl/modules/actes/actes_transac_create.php
+++ b/public.ssl/modules/actes/actes_transac_create.php
@@ -6,6 +6,7 @@ use S2lowLegacy\Class\actes\ActesEnvelopeSerialSQL;
 use S2lowLegacy\Class\actes\ActesStatusSQL;
 use S2lowLegacy\Class\actes\ActesStoreEnveloppeWorker;
 use S2lowLegacy\Class\actes\ActesTransactionsSQL;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Authority;
 use S2lowLegacy\Class\DatabasePool;
 use S2lowLegacy\Class\FileUploader;
@@ -214,7 +215,7 @@ $env->set("email", $me->get("email"));
 $env->set("file_path", "");
 
 // Initialisation de la transaction
-$trans->set("type", "1");
+$trans->setType(TypeTransaction::TransmissionActe);
 $trans->set("nature_code", $nature_code);
 $trans->set("nature_descr", $transNatures[$nature_code]);
 $trans->set("subject", $subject);
diff --git a/public.ssl/modules/actes/actes_transac_get_document.php b/public.ssl/modules/actes/actes_transac_get_document.php
index 31311a551c6d3f53fb32292d6efa0cf6392cccf3..5072030449b37521416b5b56eff5fb506993f3bb 100644
--- a/public.ssl/modules/actes/actes_transac_get_document.php
+++ b/public.ssl/modules/actes/actes_transac_get_document.php
@@ -1,5 +1,6 @@
 <?php
 
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Helpers;
 use S2lowLegacy\Class\Module;
 use S2lowLegacy\Class\User;
@@ -45,7 +46,7 @@ if ($zeTrans->init()) {
     exit_wrapper();
 }
 
-if ($zeTrans->get("type") == 1) {
+if ($zeTrans->isType(TypeTransaction::TransmissionActe)) {
     $lesTransaction = $zeTrans->getCourrierInfo();
     foreach ($lesTransaction as $id => $value) {
         $t = new ActesTransaction();
diff --git a/public.ssl/modules/actes/actes_transac_notify.old b/public.ssl/modules/actes/actes_transac_notify.old
deleted file mode 100644
index f98f23d7cbab9b8081bd54664d6456b6ccf3c8e6..0000000000000000000000000000000000000000
--- a/public.ssl/modules/actes/actes_transac_notify.old
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-
-/**
- * Ce script lance la notification manuelle de l'acquittement d'un acte
- *
- * NOTE : Ce script a l'air de faire partie de l'API (il prend en charge une liste d'id à notifier....) (EP) */
-
-$actesNotification = \S2lowLegacy\Class\LegacyObjectsManager::getLegacyObjectInstancier()->get(ActesNotification::class);
-// Instanciation du module courant
-$module = new Module();
-if (!$module->initByName("actes")) {
-    Helpers :: returnAndExit(1, "Erreur d'initialisation du module", WEBSITE_SSL);
-}
-
-$me = new User();
-
-$sortie = "";
-
-if (!$me->authenticate()) {
-    Helpers :: returnAndExit(1, "Échec de l'authentification", Helpers::getLink("connexion-status"));
-}
-
-// Un super admin ne peut pas accéder à cette page
-if (!$module->isActive() || $me->isGroupAdminOrSuper() || !$me->canEdit($module->get("name"))) {
-    Helpers :: returnAndExit(1, "Accès refusé", WEBSITE_SSL);
-}
-
-$liste_id = array ();
-
-if (Helpers :: getVarFromPost("id")) {
-    $liste_id[] = Helpers :: getVarFromPost("id");
-} else {
-    $liste_id = Helpers :: getVarFromPost("liste_id");
-}
-
-if (! $liste_id) {
-    Helpers :: returnAndExit(1, "Pas d'identifiant de transaction spécifié.", Helpers::getLink("/modules/actes/index.php"));
-}
-
-$msg = "";
-
-foreach ($liste_id as $id) {
-    $severity = 1;
-    $trans = new ActesTransaction();
-    $trans->setId($id);
-
-    if (! $trans->init()) {
-        Helpers :: returnAndExit(1, "Erreur d'initialisation de la transaction.", Helpers::getLink("/modules/actes/index.php"));
-    }
-
-    $owner = new User($trans->get("user_id"));
-    $owner->init();
-
-    //Vérification du type de transaction
-    if ($trans->get("type") != 1) {
-        Helpers :: returnAndExit(1, "Ce type de transaction ne peut pas être notifié.", Helpers::getLink("/modules/actes/actes_transac_show.php?id=") . $rel_trans->getId());
-    }
-
-    // Vérification des permissions
-    if (!($me->isAdmin() && $me->get("authority_id") == $owner->get("authority_id")) && !($me->canEdit($module->get("name")))) {
-        Helpers :: returnAndExit(1, "Accès refusé.", Helpers::getLink("/modules/actes/index.php"));
-    }
-
-    $broadcastEmail = Helpers :: getVarFromPost("broadcast_email");
-    if ($broadcastEmail) {
-        if ($trans->setNotification(implode(',', Helpers :: getVarFromPost("broadcast_email")), (Helpers :: getVarFromPost("send_sources") == 'on') ? 1 : 0)) {
-            $severity = 1;
-            $msg = "Notification manuelle de la transaction " . $id;
-            $sortie .= $msg;
-        } else {
-            $severity = 3;
-            $msg = "Erreur lors de la notification de la transaction " . $id;
-            $sortie .= $msg;
-        }
-    }
-    try {
-        $actesNotification->sendNotificationManuel($id);
-    } catch (Exception $e) {
-        $severity = 3;
-        $msg = "Erreur lors de la notification : " . $e->getMessage();
-        $sortie .= $msg;
-    }
-}
-
-
-if (count($liste_id) == 1) {
-    $retour = Helpers::getLink("/modules/actes/actes_transac_show.php?id=") . $liste_id[0];
-} else {
-    $retour = Helpers::getLink("/modules/actes/index.php");
-}
-$status = 0;
-Helpers :: returnAndExit($status, $sortie, $retour);
diff --git a/public.ssl/modules/actes/actes_transac_post_confirm.php b/public.ssl/modules/actes/actes_transac_post_confirm.php
index d128f236b2cf33977e559d1d19d7b7c9be985cd0..7ddad2242056ec019b96e7a8b0b7d5e168d85dc7 100644
--- a/public.ssl/modules/actes/actes_transac_post_confirm.php
+++ b/public.ssl/modules/actes/actes_transac_post_confirm.php
@@ -104,7 +104,7 @@ $msg = "La transaction a été postée par l'agent télétransmetteur {$me->getP
 
 
 $info = $actesTransactionsSQL->getInfo($id);
-if ($info['last_status_id'] != 17) {
+if ($info['last_status_id'] != ActesStatusSQL::STATUS_EN_ATTENTE_D_ETRE_POSTE) {
     $_SESSION['error'] = "La transaction n'est pas dans le statut « En attente d'être posté»";
     header('Location: ' . Helpers::getLink('/modules/actes/index.php'));
     exit();
diff --git a/public.ssl/modules/actes/actes_transac_post_confirm_api.php b/public.ssl/modules/actes/actes_transac_post_confirm_api.php
index a850fbd986d9a57ac2d640c835ce649395120597..a6cd9fbdf8a75b992add02144c1f87b74213b8a6 100644
--- a/public.ssl/modules/actes/actes_transac_post_confirm_api.php
+++ b/public.ssl/modules/actes/actes_transac_post_confirm_api.php
@@ -89,7 +89,7 @@ if (! $permission->canView($me, $owner)) {
 $msg = "La transaction a été postée par l'agent télétransmetteur {$me->getPrettyName()}";
 
 $info = $actesTransactionsSQL->getInfo($id);
-if ($info['last_status_id'] != 17) {
+if ($info['last_status_id'] != ActesStatusSQL::STATUS_EN_ATTENTE_D_ETRE_POSTE) {
     return_error_api("La transaction n'est pas dans le statut « En attente d'être posté»");
 }
 
diff --git a/public.ssl/modules/actes/actes_transac_repondre.php b/public.ssl/modules/actes/actes_transac_repondre.php
index a7c9610a92051d3ebca677baf6713a9181bfd918..057984d58ef999f625a3216b548a111c605dec87 100644
--- a/public.ssl/modules/actes/actes_transac_repondre.php
+++ b/public.ssl/modules/actes/actes_transac_repondre.php
@@ -1,6 +1,7 @@
 <?php
 
 use S2lowLegacy\Class\actes\ActesTypePJSQL;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Helpers;
 use S2lowLegacy\Class\HTMLLayout;
 use S2lowLegacy\Class\Module;
@@ -220,7 +221,7 @@ $html .= ")) { toggle_upload('form_progress', progress_bar); return true; } els
 
 $html .= "<input type='hidden' name='id' value='" . $related_id . "'/>";
 
-if ($trans->get("type") == 3 || $trans->get("type") == 4) {
+if ($trans->isType(TypeTransaction::DemandePieceComplementaire) || $trans->isType(TypeTransaction::LettreDObservation)) {
     $html .= "  <div class=\"form-group\">\n";
     $html .= "  <label for=\"type_envoie\" class=\"control-label\"> Nature de l'envoi: </label>\n";
     $html .=  $doc->getHTMLSelect(
@@ -255,7 +256,7 @@ $html .= "       </div>\n";
 $html .= "   </fieldset>\n";
 $html .= " </div>\n";
 
-if ($trans->get("type") == 3) {
+if ($trans->isType(TypeTransaction::DemandePieceComplementaire)) {
     $html .= "<div class=\"form-group\">\n";
     $html .= "  <fieldset>\n";
     $html .= "   <div class=\"row-legend\">\n";
diff --git a/public.ssl/modules/actes/actes_transac_show.php b/public.ssl/modules/actes/actes_transac_show.php
index dee60e455bb97a15fa0766af4e18a047a6fc49ea..43a7e43f613165d79a532d23a0c1b0c339715a68 100644
--- a/public.ssl/modules/actes/actes_transac_show.php
+++ b/public.ssl/modules/actes/actes_transac_show.php
@@ -4,6 +4,7 @@ use S2lowLegacy\Class\actes\ActesIncludedFileSQL;
 use S2lowLegacy\Class\actes\ActesStatusSQL;
 use S2lowLegacy\Class\actes\ActesTransactionsSQL;
 use S2lowLegacy\Class\actes\ActesTypePJSQL;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Authority;
 use S2lowLegacy\Class\DatabasePool;
 use S2lowLegacy\Class\Helpers;
@@ -146,8 +147,8 @@ $html .= $doc->getHTMLArrayline("Dossier suivi par", $user_td);
 
 
 // Contenu différent en fonction du type de transaction
-switch ($trans->get("type")) {
-    case 1:
+switch ($trans->getType()) {
+    case TypeTransaction::TransmissionActe:
         $html .= $doc->getHTMLArrayline("Nature de l'acte", $transNatures[$trans->get("nature_code")]);
         $html .= $doc->getHTMLArrayline("Numéro de l'acte", get_hecho($trans->get("number")));
         $html .= $doc->getHTMLArrayline("Date de la décision", Helpers :: getDateFromBDDDate($trans->get("decision_date")));
@@ -184,10 +185,10 @@ switch ($trans->get("type")) {
         $html .= $doc->getHTMLArrayline("Notification", $notification);
         break;
 
-    case 2:
-    case 3:
-    case 4:
-    case 5:
+    case TypeTransaction::CourrierSimple:
+    case TypeTransaction::DemandePieceComplementaire:
+    case TypeTransaction::LettreDObservation:
+    case TypeTransaction::DefereAuTribunalAdministratif:
         $related_trans = new ActesTransaction($trans->get("related_transaction_id"));
         $related_trans->init();
 
@@ -214,14 +215,14 @@ switch ($trans->get("type")) {
 
         break;
 
-    case 6:
+    case TypeTransaction::Annulation:
         $related_trans = new ActesTransaction($trans->get("related_transaction_id"));
         $related_trans->init();
 
         $html .= $doc->getHTMLArrayline("Acte à annuler", "<a href=\"" . Helpers::getLink("/modules/actes/actes_transac_show.php?id=" . $related_trans->getId() . "\">" . $related_trans->get("unique_id") . "</a>"));
         break;
 
-    case 7:
+    case TypeTransaction::DemandeDeClassification:
         break;
 }
 
@@ -236,7 +237,7 @@ $archiveDeleted = false;
   $archiveDeleted = true;
 }*/
 if (
-    $trans->get("type") == 6 ||
+    $trans->isType(TypeTransaction::Annulation) ||
 
      $status == 5 ||
      $status == 6 ||
@@ -433,7 +434,7 @@ if (!$me->isSuper() && $me->checkDroit($module->get("name"), 'CS') &&  $permissi
 
   // Formulaire de notification a posteriori
   // Affichés quand la transaction a été acquittée par le MIAT et non notifiée
-    if ($trans->get("type") == 1 && $transStatus == 4 && ! $trans->get("broadcasted")) {
+    if ($trans->isType(TypeTransaction::TransmissionActe) && $transStatus == 4 && ! $trans->get("broadcasted")) {
       // adresses emails de diffusion
 
 
@@ -478,7 +479,7 @@ if (!$me->isSuper() && $me->checkDroit($module->get("name"), 'CS') &&  $permissi
 if (!$trans->hasPendingCancelTrans()) {
     // Boutons de cloture de la transaction
     // Affichés quand la transaction a été acquittée par le MIAT
-    if ($trans->get("type") == 1 && $transStatus == 4 && !  $me->isGroupAdminOrSuper()) {
+    if ($trans->isType(TypeTransaction::TransmissionActe) && $transStatus == 4 && !  $me->isGroupAdminOrSuper()) {
         if ($trans->canValidate()) {
             $actionHtml .= "<div class=\"action\">\n";
             $actionHtml .= "<form action=\"" . Helpers::getLink("/modules/actes/actes_transac_close.php\" onsubmit=\"return confirm('" . 'Voulez-vous vraiment fermer cette transaction ? Cette action est non réversible et est sous votre entière responsabilité.' . "');\" method=\"post\">\n");
@@ -505,7 +506,7 @@ if (!$trans->hasPendingCancelTrans()) {
     $authoritySQL = new AuthoritySQL($sqlQuery);
     $authorityInfo = $authoritySQL->getInfo($transactionsInfo['authority_id']);
 
-    if ($trans->get("type") == 1 && in_array($transStatus, array(4,5,14,20)) && $trans->canValidate()) {
+    if ($trans->isType(TypeTransaction::TransmissionActe) && in_array($transStatus, [4,5,14,20]) && $trans->canValidate()) {
          $actionHtml .= "<div class=\"action\">\n";
           $actionHtml .= "<form action=\"" . Helpers::getLink("/modules/actes/actes_transac_archiver.php\"  method=\"post\" id='form_send_sae'>\n");
           $actionHtml .= "<div class=\"form-group\">\n<label class=\"col-md-4 control-label\">Archivage SEDA : </label>\n";
@@ -575,7 +576,7 @@ if ($me->isSuper()) {
 // Bouton d'annulation en fonction du type et de l'état
 // Doit être une transaction de transmission d'acte
 // et être dans l'état Acquittement reçu
-if ($trans->get("type") == 1 && $transStatus == 4  && $me->checkDroit("actes", "TT") && !  $me->isGroupAdminOrSuper()) {
+if ($trans->isType(TypeTransaction::TransmissionActe) && $transStatus == 4  && $me->checkDroit("actes", "TT") && !  $me->isGroupAdminOrSuper()) {
     $actionHtml .= "<div class=\"action\">\n";
     if (!$trans->hasPendingCancelTrans()) {
         if ($module->getParam("paper") == "on") {
@@ -595,7 +596,7 @@ if ($trans->get("type") == 1 && $transStatus == 4  && $me->checkDroit("actes", "
 
 // Boutons de réponse à un courrier
 
-if (in_array($transStatus, array(7,8,21)) && $trans->get("type") != 5  && $me->checkDroit("actes", "CS")) {
+if (in_array($transStatus, [7,8,21]) && !$trans->isType(TypeTransaction::DefereAuTribunalAdministratif)  && $me->checkDroit('actes', 'CS')) {
       $actionHtml .= "<form action=\"" . Helpers::getLink("/modules/actes/actes_transac_repondre.php\" method=\"post\">\n");
       $actionHtml .= "<div class=\"form-group\">\n<label class=\"col-md-4 control-label\">Répondre : </label>\n";
       $actionHtml .= "<input type=\"hidden\" name=\"id\" value=\"" . $trans->getId() . "\" />\n";
@@ -633,7 +634,7 @@ if ($me->isSuper()) {
 
 
 
-    if (in_array($transStatus, array(3,-1))  && $trans->get("type") == 1) {
+    if (in_array($transStatus, [3,-1])  && $trans->isType(TypeTransaction::TransmissionActe)  && $me->checkDroit("actes", "CS")) {
         $actionHtml .= "<form action=\"" . Helpers::getLink("/modules/actes/actes_transac_rolback_attente.php\" onsubmit=\"return confirm('Êtes-vous certain de vouloir faire cela ? ')\" method=\"post\">\n");
         $actionHtml .= "<div class=\"form-group\">\n<label class=\"col-md-4 control-label\">Passer à En attente de transmission </label>\n";
         $actionHtml .= "<input type=\"hidden\" name=\"id\" value=\"" . $trans->getId() . "\" />\n";
diff --git a/public.ssl/modules/actes/actes_transac_submit.php b/public.ssl/modules/actes/actes_transac_submit.php
index 607333db87657aec0137549893e9569164f05c41..b53dbb4d4e0998b98180b38618c32bd43a32b447 100644
--- a/public.ssl/modules/actes/actes_transac_submit.php
+++ b/public.ssl/modules/actes/actes_transac_submit.php
@@ -3,6 +3,7 @@
 use S2lowLegacy\Class\actes\ActesAntivirusWorker;
 use S2lowLegacy\Class\actes\ActesNameArchive;
 use S2lowLegacy\Class\actes\ActesStoreEnveloppeWorker;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Authority;
 use S2lowLegacy\Class\Helpers;
 use S2lowLegacy\Class\Log;
@@ -126,7 +127,7 @@ foreach ($xmlTransFiles as $xmlFile) {
 
     $env->addTransaction($trans);
 
-    if ($trans->get("type") == 1) {
+    if ($trans->isType(TypeTransaction::TransmissionActe)) {
         // Vérification qu'une transaction ayant le même numéro interne n'existe pas déjà
         if (!$trans->isUnique($myAuthority->getId())) {
             $env->purgeFiles();
@@ -140,7 +141,7 @@ foreach ($xmlTransFiles as $xmlFile) {
     }
 
     // En cas de demande de classification, création de la requête dans la table idoine
-    if ($trans->get("type") == 7) {
+    if ($trans->isType(TypeTransaction::DemandeDeClassification)) {
         $classifRequest = new ActesClassification();
 
         $classifRequest->set("requested_by", $me->getId());
diff --git a/public.ssl/modules/actes/class/ActesEnvelope.class.php b/public.ssl/modules/actes/class/ActesEnvelope.class.php
index 2c1f692a0d231152de8848649c73b25c5eca0b07..3895307787adf9ebd563ad23a25302cddebbcb57 100644
--- a/public.ssl/modules/actes/class/ActesEnvelope.class.php
+++ b/public.ssl/modules/actes/class/ActesEnvelope.class.php
@@ -766,6 +766,7 @@ class ActesEnvelope extends DataObject
 
       // Suppression des fichiers de chaque transaction
         foreach ($this->transactions as $trans) {
+            /** @var ActesTransaction $trans */
             if (! $trans->purgeFiles()) {
                 $this->errorMsg .= $trans->getErrorMsg();
                 return false;
diff --git a/public.ssl/modules/actes/class/ActesTransaction.class.php b/public.ssl/modules/actes/class/ActesTransaction.class.php
index a3735223ec0121c1009bab694f95b0e1f757ba7c..224db2980c2f11022aa5ce6c891d9446df96886d 100644
--- a/public.ssl/modules/actes/class/ActesTransaction.class.php
+++ b/public.ssl/modules/actes/class/ActesTransaction.class.php
@@ -3,10 +3,11 @@
 use S2low\Services\ProcessCommand\CommandLauncher;
 use S2low\Services\ProcessCommand\OpenSSLWrapper;
 use S2lowLegacy\Class\actes\ActesClassificationCodesSQL;
+use S2lowLegacy\Class\actes\ActesStatusSQL;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\DatabasePool;
 use S2lowLegacy\Class\DataObject;
 use S2lowLegacy\Class\Helpers;
-use S2lowLegacy\Class\User;
 use S2lowLegacy\Class\VerifyPemCertificateFactory;
 use S2lowLegacy\Class\VerifyPKCS7Signature;
 use S2lowLegacy\Class\XMLHelper;
@@ -14,7 +15,8 @@ use S2lowLegacy\Lib\PemCertificateFactory;
 
 class ActesTransaction extends DataObject
 {
-    //Constante pour les messages 3 et 4
+    //Constante pour les messages
+    // DemandePieceComplementaire et LettreDObservation
     public const TYPE_REFUS = 3;
     public const TYPE_ENVOIE = 4;
     public const NUMBER_REGEXP = '/^([A-Z0-9][A-Z0-9_]{0,13})?[A-Z0-9]$/';
@@ -193,7 +195,7 @@ class ActesTransaction extends DataObject
     "5" => "Déféré au Tribunal Administratif",
     "6" => "Annulation",
     "7" => "Demande de classification"
-    );
+    );  // Utilisé !
     protected $en_attente;
     protected $is_en_attente_de_signature;
     private $fileNameSerial;
@@ -226,27 +228,6 @@ class ActesTransaction extends DataObject
         return $typeReponse[$transactionType][$reponseType];
     }
 
-  /**
-   * \brief Méthode de récupération des différentes natures de transaction
-   * \return Un tableau de natures de transaction
-   */
-    public static function getTransactionNatures()
-    {
-        $sql = "SELECT id, short_descr, descr FROM actes_natures ORDER BY descr ASC";
-
-        $db = DatabasePool :: getInstance();
-
-        $result = $db->select($sql);
-
-        $types = array ();
-
-        if (!$result->isError()) {
-            return $result->get_all_row();
-        }
-
-        return false;
-    }
-
   /**
    * \brief Méthode de récupération des natures de transaction
    * \return Un tableau de natures de transaction
@@ -274,44 +255,6 @@ class ActesTransaction extends DataObject
         return $types;
     }
 
-  /**
-   * \brief Méthode d'obtention de la liste des transactions et tous leurs attributs
-   * \param $cond (optionnel) chaîne : Chaîne contenant les conditions (SQL) à appliquer à la fin de la requête BDD
-   * \return tableau des transactions
-   * @deprecated 5.0.42, dead code
-  */
-    public static function getTransactionsList($cond = "")
-    {
-      // TODO: utiliser le pager pour multipages
-        $sql = <<<SQL
-SELECT actes_transactions.id,
-       actes_transactions.envelope_id,
-       actes_transactions.type,
-       actes_transactions.related_transaction_id,
-       actes_transactions.nature_code,
-       actes_transactions.nature_descr,
-       actes_transactions.subject,
-       actes_transactions.number,
-       actes_transactions.classification,
-       actes_transactions.classification_date,
-       actes_transactions.decision_date,
-       actes_transactions.unique_id,
-       actes_transactions.archive_url
-FROM actes_transactions 
-SQL;
-        $sql .= ' ' . $cond;
-
-        $db = DatabasePool :: getInstance();
-
-        $result = $db->select($sql);
-
-        if (!$result->isError()) {
-            return $result->get_all_rows();
-        }
-
-        return array ();
-    }
-
   /**
    * \brief Méthode d'obtention de la liste des statuts des transactions
    * \return Tableau des statuts de transactions
@@ -406,20 +349,6 @@ SQL;
         return $flux_retour_contents;
     }
 
-  /**
-   * \brief Méthode qui détermine si une transaction est considérée comme étant fermée
-   * \return L'identifiant de l'état courant de la transaction
-   */
-    public function isClose()
-    {
-        $currentStatus = $this->getCurrentStatus();
-        if ($currentStatus <= 0 || ($this->type == 7 && $currentStatus > 2) || ($this->type != 7 && $currentStatus > 4)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
   /**
    * \brief Méthode d'obtention de l'état courant d'un transaction
    * \return L'identifiant de l'état courant de la transaction
@@ -456,25 +385,6 @@ SQL;
         return $row["message"];
     }
 
-  /**
-   * \brief Méthode pour déterminer si la transaction est déjà passée par un état donné
-   * \return True si la transaction est passé par cet état, false sinon
-   */
-    public function hasStatus($status_id)
-    {
-        if (isset($this->id) && !empty($this->id)) {
-            $sql = "SELECT id FROM actes_transactions_workflow atw WHERE atw.status_id=" . $status_id . " AND atw.transaction_id=" . $this->id;
-
-            $result = $this->db->select($sql);
-
-            if (!$result->isError() && $result->num_row() == 1) {
-                return true;
-            }
-
-            return false;
-        }
-    }
-
   /**
   * \brief Méthode qui positionne les éléments relatifs à une notification manuelle
   * \param $emails chaîne : emails des destinataires
@@ -499,9 +409,9 @@ SQL;
    * \param $use_serial boolean (optionnel) : Ajouter le numéro de série à la fin du nom de fichier puis l'incrémenter (true par défaut)
    * \return Le nom du fichier sans extension
    */
-    public function getStdFileName($env, $use_serial = true, $code_pj = '')
+    public function getStdFileName(ActesEnvelope $env, $use_serial = true, $code_pj = '')
     {
-        if ($this->type == 6) {
+        if ($this->isType(TypeTransaction::Annulation)) {
             $trans = $this->related_transaction;
         } else {
             $trans = $this;
@@ -525,41 +435,40 @@ SQL;
 
       // Date de l'acte YYYYMMDD
         $name .= "-";
-        if ($this->type != 7) {
+        if (!$this->isType(TypeTransaction::DemandeDeClassification)) {
             $name .= date("Ymd", Helpers :: ansiDateToTimestamp($trans->decision_date));
         }
 
       // Numéro de l'acte interne à la collectivité
         $name .= "-";
-        if ($this->type != 7) {
+        if (!$this->isType(TypeTransaction::DemandeDeClassification)) {
             $name .= $trans->number;
         }
 
       // Code de la nature de l'acte
         $name .= "-";
-        if ($this->type != 7) {
+        if (!$this->isType(TypeTransaction::DemandeDeClassification)) {
             $name .= $nature_descr["short_descr"];
         }
 
       // Type de message
-        switch ($this->type) {
-            case "1":
+        switch ($this->getType()) {
+            case TypeTransaction::TransmissionActe:
                 $name .= "-1-1";
                 break;
-            case "2":
+            case TypeTransaction::CourrierSimple:
                 $name .= "-2-2";
                 break;
-            case "3":
+            case TypeTransaction::DemandePieceComplementaire:
                 $name .= "-3-" . $this->type_reponse;
                 break;
-            case "4":
+            case TypeTransaction::LettreDObservation:
                 $name .= "-4-" . $this->type_reponse;
                 break;
-            case "6":
+            case TypeTransaction::Annulation:
                 $name .= "-6-1";
                 break;
-            break;
-            case "7":
+            case TypeTransaction::DemandeDeClassification:
                 $name .= "-7-1";
                 break;
         }
@@ -679,25 +588,25 @@ SQL;
    */
     public function generateMessageXMLFile($xml_name)
     {
-        switch ($this->type) {
-            case "1":
+        switch ($this->getType()) {
+            case TypeTransaction::TransmissionActe:
                 $xml = $this->generateActeXMLFile($xml_name);
                 break;
 
-            case "2":
-            case "3":
-            case "4":
+            case TypeTransaction::CourrierSimple:
+            case TypeTransaction::DemandePieceComplementaire:
+            case TypeTransaction::LettreDObservation:
                 $xml = $this->generateReponseCourrierXMLFile($xml_name);
                 break;
 
-            case "6":
+            case TypeTransaction::Annulation:
                 $xml = $this->generateCancelXMLFile($xml_name);
                 break;
-            case "7":
+            case TypeTransaction::DemandeDeClassification:
                 $xml = $this->generateClassifRequestXMLFile($xml_name);
                 break;
             default:
-                $this->errorMsg = "Mauvais type de transaction.";
+                $this->errorMsg = 'Mauvais type de transaction.';
                 return false;
         }
 
@@ -705,6 +614,9 @@ SQL;
             return false;
         }
 
+        $xml_name .= "_0.xml";
+        $this->xmlFileName = $xml_name;
+
         if (!Helpers :: createDirTree(dirname($this->rootDir . "/" . $this->xmlFileName))) {
             $this->errorMsg = "Erreur système de fichiers (createDirTree).";
             return false;
@@ -728,12 +640,8 @@ SQL;
    * \param $xml_name chaîne : Nom du fichier à créer
    * \return Le XML généré ou false en cas d'échec
    */
-    public function generateActeXMLFile($xml_name)
+    public function generateActeXMLFile(string $xml_name): false|string
     {
-        $xml_name .= "_0.xml";
-
-        $this->xmlFileName = $xml_name;
-
         $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
         $xml .= "<actes:Acte\n";
         $xml .= "xmlns:actes=\"http://www.interieur.gouv.fr/ACTES#v1.1-20040216\"\n";
@@ -788,14 +696,11 @@ SQL;
 
     public function generateReponseCourrierXMLFile($xml_name)
     {
-        $xml_name .= "_0.xml";
-        $this->xmlFileName = $xml_name;
-
-        switch ($this->type) {
-            case 2:
+        switch ($this->getType()) {
+            case TypeTransaction::CourrierSimple:
                 $root =  "ReponseCourrierSimple";
                 break;
-            case 3:
+            case TypeTransaction::DemandePieceComplementaire:
                 if ($this->type_reponse == ActesTransaction::TYPE_REFUS) {
                     $root = "RefusPieceComplementaire";
                 } elseif ($this->type_reponse == ActesTransaction::TYPE_ENVOIE) {
@@ -805,7 +710,7 @@ SQL;
                     return false;
                 }
                 break;
-            case 4:
+            case TypeTransaction::LettreDObservation:
                 if ($this->type_reponse == ActesTransaction::TYPE_REFUS) {
                     $root = "RejetLettreObservations";
                 } elseif ($this->type_reponse == ActesTransaction::TYPE_ENVOIE) {
@@ -827,7 +732,7 @@ SQL;
         $xml .= "actes:DateCourrierPref=\"" . $this->decision_date . "\" \n";
         $xml .= "actes:IDActe=\"" . Helpers :: escapeForXML($this->related_transaction->unique_id) . "\" > \n";
 
-        if ($this->type == 3 && $this->type_reponse == ActesTransaction::TYPE_ENVOIE) {
+        if ($this->isType(TypeTransaction::DemandePieceComplementaire) && $this->type_reponse == ActesTransaction::TYPE_ENVOIE) {
             $xml .= "<actes:Documents>";
         }
 
@@ -837,7 +742,7 @@ SQL;
         $xml .= "</actes:NomFichier>\n";
         $xml .= "</actes:Document>\n";
 
-        if ($this->type == 3 && $this->type_reponse == ActesTransaction::TYPE_ENVOIE) {
+        if ($this->isType(TypeTransaction::DemandePieceComplementaire) && $this->type_reponse == ActesTransaction::TYPE_ENVOIE) {
             if (isset($this->files["attachment"])) {
                 foreach ($this->files["attachment"] as $key => $file) {
                     $xml .= "  <actes:Document>\n";
@@ -860,10 +765,6 @@ SQL;
    */
     public function generateCancelXMLFile($xml_name)
     {
-        $xml_name .= "_0.xml";
-
-        $this->xmlFileName = $xml_name;
-
         $xml = null;
 
         if (!empty($this->related_transaction->unique_id)) {
@@ -888,11 +789,6 @@ SQL;
    */
     public function generateClassifRequestXMLFile($xml_name)
     {
-        $xml_name .= "_0.xml";
-
-        $this->xmlFileName = $xml_name;
-
-
         $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
         $xml .= "<actes:DemandeClassification \n";
         $xml .= "xmlns:actes=\"http://www.interieur.gouv.fr/ACTES#v1.1-20040216\"\n";
@@ -948,7 +844,7 @@ SQL;
       // Détermination du type de transaction
         switch (@ dom_import_simplexml($this->xmlObj)->nodeName) {
             case "actes:Acte":
-                $this->type = 1;
+                $this->setType(TypeTransaction::TransmissionActe);
                 $acte_attr = $this->xmlObj->attributes($namespaces["actes"]);
             // Date de la décision
                 $this->decision_date = Helpers :: getFromXMLElt($acte_attr["Date"]);
@@ -1040,27 +936,27 @@ SQL;
                 break;
 
             case "actes:ReponseCourrierSimple":
-                $rep = $this->setDataFromCourrier(2, $xmlFile);
+                $rep = $this->setDataFromCourrier(TypeTransaction::CourrierSimple, $xmlFile);
                 break;
 
             case "actes:RefusPieceComplementaire":
-                $rep = $this->setDataFromCourrier(3, $xmlFile, true);
+                $rep = $this->setDataFromCourrier(TypeTransaction::DemandePieceComplementaire, $xmlFile, true);
                 break;
 
             case "actes:PieceComplementaire":
-                $rep = $this->setDataFromCourrier(3, $xmlFile, false);
+                $rep = $this->setDataFromCourrier(TypeTransaction::DemandePieceComplementaire, $xmlFile, false);
                 break;
 
             case "actes:RejetLettreObservations":
-                $rep = $this->setDataFromCourrier(4, $xmlFile, true);
+                $rep = $this->setDataFromCourrier(TypeTransaction::LettreDObservation, $xmlFile, true);
                 break;
 
             case "actes:ReponseLettreObservations":
-                $rep = $this->setDataFromCourrier(4, $xmlFile, false);
+                $rep = $this->setDataFromCourrier(TypeTransaction::LettreDObservation, $xmlFile, false);
                 break;
 
             case "actes:Annulation":
-                $this->type = 6;
+                $this->setType(TypeTransaction::Annulation);
                 $acte_attr = $this->xmlObj->attributes($namespaces["actes"]);
 
                 $this->unique_id = Helpers :: getFromXMLElt($acte_attr["IDActe"]);
@@ -1081,13 +977,12 @@ SQL;
                 break;
 
             case "actes:DemandeClassification":
-                $this->type = 7;
+                $this->setType(TypeTransaction::DemandeDeClassification);
                 break;
 
             default:
                 $this->errorMsg = "Mauvais type de transaction.";
                 return false;
-            break;
         }
         if ($rep == false) {
             return false;
@@ -1159,7 +1054,7 @@ SQL;
             }
 
 
-            if ($type == 'acte' && $this->type == 1) {
+            if ($type == 'acte' && $this->isType(TypeTransaction::TransmissionActe)) {
                 if (! in_array($ext, array('pdf','xml'))) {
                     $this->errorMsg = "Le fichier de l'acte \" " . basename($name) . " \" est de type \" " . $mimeType . " \". Fichier PDF ou XML requis.";
                     return false;
@@ -1274,10 +1169,10 @@ SQL;
         return true;
     }
 
-    private function setDataFromCourrier($type, $xmlFile, $isRefus = false)
+    private function setDataFromCourrier(TypeTransaction $type, $xmlFile, $isRefus = false)
     {
 
-        $this->type = $type;
+        $this->setType($type);
 
         $namespaces = $this->xmlObj->getDocNamespaces();
 
@@ -1302,7 +1197,7 @@ SQL;
 
         $this->number = $related_trans->get("number");
 
-        if ($type == 3 && $isRefus == false) {
+        if ($type == TypeTransaction::DemandePieceComplementaire && !$isRefus) {
             foreach ($actesItems->Documents->Document as $fichiers) {
                 $actePath = dirname($xmlFile) . "/" . Helpers :: getFromXMLElt($fichiers->NomFichier);
                 if (!$this->addActeFile($actePath, $actePath)) {
@@ -1514,7 +1409,7 @@ SQL;
             $new = true;
         }
 
-        if ($this->type == 1) {
+        if ($this->isType(TypeTransaction::TransmissionActe)) {
             $done = false;
             $this->classification = "";
             $i = 1;
@@ -1538,7 +1433,7 @@ SQL;
 
       // Si la transaction n'est pas une transmission d'acte on désactive
       // le contrôle des champs car tous les champs ne sont plus obligatoire
-        if ($this->type != 1) {
+        if (!$this->isType(TypeTransaction::TransmissionActe)) {
             $validate = false;
         }
 
@@ -1557,7 +1452,11 @@ SQL;
             $sql_verif = "SELECT actes_transactions.id FROM actes_transactions " .
                 " WHERE actes_transactions.number=? AND authority_id=?";
 
-            if ($this->type == 1 && $this->db->getOneValue($sql_verif, [$this->get('number'),$this->get('authority_id')])) {
+            if (
+                $this->isType(TypeTransaction::TransmissionActe)
+                &&
+                $this->db->getOneValue($sql_verif, [$this->get('number'),$this->get('authority_id')])
+            ) {
                 $this->errorMsg = "Une transaction avec le même numéro existe déjà dans la base.";
                 $this->db->rollback();
                 return false;
@@ -1573,11 +1472,11 @@ SQL;
         if ($new) {
           // Ajout de l'état initial
             if ($this->en_attente) {
-                $result_set_status = $this->setNewStatus(17, "Dépôt dans un état d'attente");
+                $result_set_status = $this->setNewStatus(ActesStatusSQL::STATUS_EN_ATTENTE_D_ETRE_POSTE, "Dépôt dans un état d'attente");
             } elseif ($this->is_en_attente_de_signature) {
-                $result_set_status = $this->setNewStatus(18, "En attente d'être signé");
+                $result_set_status = $this->setNewStatus(ActesStatusSQL::STATUS_EN_ATTENTE_D_ETRE_SIGNEE, "En attente d'être signé");
             } else {
-                $result_set_status = $this->setNewStatus(1, "Dépôt initial");
+                $result_set_status = $this->setNewStatus(ActesStatusSQL::STATUS_POSTE, "Dépôt initial");
             }
             if (!$result_set_status) {
                 $this->errorMsg = "Erreur lors de la définition de l'état initial de la transaction.";
@@ -1713,53 +1612,6 @@ SQL;
         return true;
     }
 
-  /**
-   * \brief Méthode avertissant le moteur transactionnel qu'une nouvelle transaction est a traiter
-   * \return True en cas de succès, false sinon
-   *
-   * Non utilisée
-   */
-    public function warnTransactionalEngine()
-    {
-        if (isset($this->id) && !empty($this->id)) {
-            $cHandle = curl_init(ACTES_NEW_TRANS_URL . "?id=" . $this->id);
-
-            curl_setopt($cHandle, CURLOPT_RETURNTRANSFER, true);
-
-            $ret = curl_exec($cHandle);
-
-            curl_close($cHandle);
-
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-  /**
-   * \brief Méthode déterminant si un utilisateur peut modifier la transaction courante
-   * \param $user objet User : utilisateur considéré
-   * \return True en cas d'authorisation, false sinon
-   */
-    public function userCanEdit($user)
-    {
-        if ($user->isSuper()) {
-            return true;
-        }
-
-        $owner = new User($this->user_id);
-        $owner->init();
-
-        $envelope = new ActesEnvelope($this->envelope_id);
-        $envelope->init();
-
-        if (!($user->isAuthorityAdmin() && $user->get("authority_id") == $owner->get("authority_id")) && !($user->getId() == $envelope->get("user_id") && $user->canEdit('actes'))) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
     public function getCourrierInfo()
     {
         $renvoie = array();
@@ -1786,22 +1638,6 @@ SQL;
         return $renvoie;
     }
 
-  /**
-   * @param:
-   * @return:
-   *
-   */
-    public function removeTransmisStatus()
-    {
-        $sql = "DELETE FROM actes_transactions_workflow where transaction_id=" . $this->id . "and status_id=3";
-
-        $db = DatabasePool :: getInstance();
-
-        $result = $db->exec($sql);
-
-        return $result;
-    }
-
     /**
      * @return bool
      * @throws Exception
@@ -1833,4 +1669,22 @@ SQL;
     {
         $this->is_en_attente_de_signature = $is_en_attente_de_signature;
     }
+
+    public function isType(TypeTransaction $type): bool
+    {
+        return $this->getType() === $type;
+    }
+
+    public function setType(TypeTransaction $type)
+    {
+        $this->type = $type->value;
+    }
+
+    public function getType(): ?TypeTransaction
+    {
+        if (is_null($this->type)) {
+            return null;
+        }
+        return TypeTransaction::tryFrom($this->type);
+    }
 }
diff --git a/src/Controller/ActesNotificationController.php b/src/Controller/ActesNotificationController.php
index 4627a81a1e5e2c2d9cbce41b49babe6bcaa93178..c30b935f653de8957ad3b3710916d111243aba3c 100644
--- a/src/Controller/ActesNotificationController.php
+++ b/src/Controller/ActesNotificationController.php
@@ -2,13 +2,14 @@
 
 namespace S2low\Controller;
 
-use S2lowLegacy\Class\actes\ActesNotification;
 use ActesTransaction;
+use Exception;
+use S2lowLegacy\Class\actes\ActesNotification;
+use S2lowLegacy\Class\actes\TypeTransaction;
 use S2lowLegacy\Class\Helpers;
 use S2lowLegacy\Class\Module;
-use Exception;
-use Symfony\Component\Routing\Annotation\Route;
 use S2lowLegacy\Class\User;
+use Symfony\Component\Routing\Annotation\Route;
 
 class ActesNotificationController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
 {
@@ -71,7 +72,7 @@ class ActesNotificationController extends \Symfony\Bundle\FrameworkBundle\Contro
             $owner->init();
 
             //Vérification du type de transaction
-            if ($trans->get('type') != 1) {
+            if (!$trans->isType(TypeTransaction::TransmissionActe)) {
                 Helpers::returnAndExit(
                     1,
                     'Ce type de transaction ne peut pas être notifié.',
diff --git a/test/PHPUnit/public.ssl/module/actes/ActesTransactionTest.php b/test/PHPUnit/public.ssl/module/actes/ActesTransactionTest.php
index c956760e4a384a2c33c0142330ea913186bf9271..b4857fbfa385773e3a454592eb8bc2e8c5e15c17 100644
--- a/test/PHPUnit/public.ssl/module/actes/ActesTransactionTest.php
+++ b/test/PHPUnit/public.ssl/module/actes/ActesTransactionTest.php
@@ -1,17 +1,21 @@
 <?php
 
+declare(strict_types=1);
+
+use S2lowLegacy\Class\actes\ActesClassificationCodesSQL;
 use S2lowLegacy\Class\actes\ActesEnvelopeSQL;
 use S2lowLegacy\Class\actes\ActesIncludedFileSQL;
+use S2lowLegacy\Class\actes\TypeTransaction;
 
 class ActesTransactionTest extends S2lowTestCase
 {
     /** @var  ActesTransaction */
-    private $actesTransaction;
+    private ActesTransaction $actesTransaction;
 
-    private $pdf_filepath;
-    private $xml_filepath;
-    private $txt_filepath;
-    private $jpg_filepath;
+    private string $pdf_filepath;
+    private string $xml_filepath;
+    private string $txt_filepath;
+    private string $jpg_filepath;
 
     /**
      * @throws Exception
@@ -20,12 +24,12 @@ class ActesTransactionTest extends S2lowTestCase
     {
         parent::setUp();
         $this->actesTransaction = new ActesTransaction();
-        $this->actesTransaction->set("destDir", "toto");
+        $this->actesTransaction->set('destDir', 'toto');
 
-        $this->pdf_filepath = __DIR__ . "/../../../fixtures/vide.pdf";
-        $this->xml_filepath = __DIR__ . "/../../../fixtures/toto.xml";
-        $this->txt_filepath = __DIR__ . "/../../../fixtures/toto.txt";
-        $this->jpg_filepath = __DIR__ . "/../../../fixtures/test.jpg";
+        $this->pdf_filepath = __DIR__ . '/../../../fixtures/vide.pdf';
+        $this->xml_filepath = __DIR__ . '/../../../fixtures/toto.xml';
+        $this->txt_filepath = __DIR__ . '/../../../fixtures/toto.txt';
+        $this->jpg_filepath = __DIR__ . '/../../../fixtures/test.jpg';
     }
 
     private function numberTest($number, $valide)
@@ -35,9 +39,9 @@ class ActesTransactionTest extends S2lowTestCase
         $error_msg = $this->actesTransaction->getErrorMsg();
         $number_error = "Le champ Numéro de l'acte ne peut contenir que des chiffres, des lettres en majuscules et _";
         if ($valide) {
-            $this->assertStringNotContainsString($number_error, $error_msg);
+            static::assertStringNotContainsString($number_error, $error_msg);
         } else {
-            $this->assertStringContainsString($number_error, $error_msg);
+            static::assertStringContainsString($number_error, $error_msg);
         }
     }
 
@@ -59,15 +63,15 @@ class ActesTransactionTest extends S2lowTestCase
     private function validateAndRemoveFile($filename)
     {
         $actes_destination = ACTES_FILES_UPLOAD_ROOT . "/$filename";
-        $this->assertTrue(file_exists($actes_destination));
-        $this->assertTrue(unlink($actes_destination));
+        static::assertTrue(file_exists($actes_destination));
+        static::assertTrue(unlink($actes_destination));
     }
 
     private function addActePDF()
     {
         $dest_filename = mt_rand(0, mt_getrandmax());
         $r = $this->actesTransaction->addActeFile("vide.pdf", "toto/$dest_filename", $this->pdf_filepath);
-        $this->assertTrue($r);
+        static::assertTrue($r);
         $this->validateAndRemoveFile("toto/{$dest_filename}.pdf");
     }
 
@@ -75,21 +79,21 @@ class ActesTransactionTest extends S2lowTestCase
     {
         $dest_filename = mt_rand(0, mt_getrandmax());
         $r = $this->actesTransaction->addActeFile("test.jpg", "toto/$dest_filename", $this->jpg_filepath);
-        $this->assertTrue($r);
+        static::assertTrue($r);
         $this->validateAndRemoveFile("toto/{$dest_filename}.jpg");
     }
 
     public function addActeXML()
     {
         $dest_filename = mt_rand(0, mt_getrandmax());
-        $this->assertTrue($this->actesTransaction->addActeFile("toto.xml", "toto/$dest_filename", $this->xml_filepath));
+        static::assertTrue($this->actesTransaction->addActeFile("toto.xml", "toto/$dest_filename", $this->xml_filepath));
         $this->validateAndRemoveFile("toto/{$dest_filename}.xml");
     }
 
     private function addAnnexePDF()
     {
         $dest_filename2 = mt_rand(0, mt_getrandmax());
-        $this->assertTrue($this->actesTransaction->addAttachmentFile("vide.pdf", "toto/$dest_filename2", $this->pdf_filepath));
+        static::assertTrue($this->actesTransaction->addAttachmentFile("vide.pdf", "toto/$dest_filename2", $this->pdf_filepath));
         $this->validateAndRemoveFile("toto/{$dest_filename2}.pdf");
     }
 
@@ -104,20 +108,20 @@ class ActesTransactionTest extends S2lowTestCase
         $this->addAnnexePDF();
         $this->addAnnexePDF();
         $file_list = $this->actesTransaction->fetchFilesList();
-        $this->assertEquals(2, count($file_list['attachment']));
+        static::assertSame(2, count($file_list['attachment']));
     }
 
     public function testAddJPGCourrierSimple()
     {
-        $this->actesTransaction->set('type', 3);
+        $this->actesTransaction->setType(TypeTransaction::DemandePieceComplementaire);
         $this->addActeJPG();
     }
 
     public function testAddTextCourrierSimple()
     {
-        $this->actesTransaction->set('type', 3);
-        $this->assertFalse($this->actesTransaction->addActeFile("toto.txt", "toto", $this->txt_filepath));
-        $this->assertEquals(
+        $this->actesTransaction->setType(TypeTransaction::DemandePieceComplementaire);
+        self::assertFalse($this->actesTransaction->addActeFile("toto.txt", "toto", $this->txt_filepath));
+        self::assertSame(
             "Le fichier de réponse \" toto.txt \" est de type \" application/x-empty \". Fichier PDF, XML, PNG ou JPEG requis.",
             $this->actesTransaction->getErrorMsg()
         );
@@ -125,9 +129,9 @@ class ActesTransactionTest extends S2lowTestCase
 
     public function testAddActeTxt()
     {
-        $this->actesTransaction->set('type', 1);
-        $this->assertFalse($this->actesTransaction->addActeFile("toto.txt", "toto", $this->txt_filepath));
-        $this->assertEquals(
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
+        self::AssertFalse($this->actesTransaction->addActeFile("toto.txt", "toto", $this->txt_filepath));
+        self::assertSame(
             "Le fichier de l'acte \" toto.txt \" est de type \" application/x-empty \". Fichier PDF ou XML requis.",
             $this->actesTransaction->getErrorMsg()
         );
@@ -148,25 +152,25 @@ class ActesTransactionTest extends S2lowTestCase
 
     public function testAddActesXMLBadNature()
     {
-        $this->actesTransaction->set('type', 1);
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
         $dest_filename = mt_rand(0, mt_getrandmax());
-        $this->assertFalse($this->actesTransaction->addActeFile("toto.xml", "toto/$dest_filename", $this->xml_filepath));
-        $this->assertEquals("Seuls les documents budgétaires et financiers peuvent être au format XML.", $this->actesTransaction->getErrorMsg());
+        static::assertFalse($this->actesTransaction->addActeFile("toto.xml", "toto/$dest_filename", $this->xml_filepath));
+        static::assertSame("Seuls les documents budgétaires et financiers peuvent être au format XML.", $this->actesTransaction->getErrorMsg());
     }
 
     public function testAddActesXMLBadClassif()
     {
-        $this->actesTransaction->set('type', 1);
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
         $this->actesTransaction->set('nature_code', 5);
         $dest_filename = mt_rand(0, mt_getrandmax());
-        $this->assertFalse($this->actesTransaction->addActeFile("toto.xml", "toto/$dest_filename", $this->xml_filepath));
-        $this->assertEquals("Seule la classification 7.1 est autorisée pour la transmission au format XML", $this->actesTransaction->getErrorMsg());
+        static::assertFalse($this->actesTransaction->addActeFile("toto.xml", "toto/$dest_filename", $this->xml_filepath));
+        static::assertSame("Seule la classification 7.1 est autorisée pour la transmission au format XML", $this->actesTransaction->getErrorMsg());
     }
 
     public function testBadAttachment()
     {
-        $this->assertFalse($this->actesTransaction->addAttachmentFile("toto.txt", "toto", $this->txt_filepath));
-        $this->assertEquals(
+        self::assertFalse($this->actesTransaction->addAttachmentFile("toto.txt", "toto", $this->txt_filepath));
+        self::assertSame(
             "Le fichier attaché \" toto.txt \" est de type \" application/x-empty \". Fichier PDF, XML, PNG ou JPEG requis.",
             $this->actesTransaction->getErrorMsg()
         );
@@ -177,7 +181,7 @@ class ActesTransactionTest extends S2lowTestCase
         $this->setActesBudgetaire();
         $this->addActePDF();
         $dest_filename2 = mt_rand(0, mt_getrandmax());
-        $this->assertTrue($this->actesTransaction->addAttachmentFile("vide.xml", "toto/" . $dest_filename2, $this->xml_filepath));
+        static::assertTrue($this->actesTransaction->addAttachmentFile("vide.xml", "toto/" . $dest_filename2, $this->xml_filepath));
         $this->validateAndRemoveFile("toto/{$dest_filename2}.xml");
     }
 
@@ -185,14 +189,14 @@ class ActesTransactionTest extends S2lowTestCase
     {
         $this->addActePDF();
         $dest_filename2 = mt_rand(0, mt_getrandmax());
-        $this->assertTrue($this->actesTransaction->addAttachmentFile("vide.xml", "toto/" . $dest_filename2, $this->xml_filepath));
+        static::assertTrue($this->actesTransaction->addAttachmentFile("vide.xml", "toto/" . $dest_filename2, $this->xml_filepath));
     }
 
     public function testAddManyXMLAttachment()
     {
         $this->testAttachmentXML();
         $dest_filename2 = mt_rand(0, mt_getrandmax());
-        $this->assertTrue($this->actesTransaction->addAttachmentFile("vide.xml", "toto/" . $dest_filename2, $this->xml_filepath));
+        static::assertTrue($this->actesTransaction->addAttachmentFile("vide.xml", "toto/" . $dest_filename2, $this->xml_filepath));
     }
 
     /**
@@ -234,7 +238,7 @@ class ActesTransactionTest extends S2lowTestCase
         $this->actesTransaction->set('classif1', '1');
         $this->actesTransaction->set('classif2', '1');
 
-        $this->actesTransaction->set('type', '1');
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
         $this->actesTransaction->set('nature_code', '1');
         $this->actesTransaction->set('nature_descr', 'toto');
         $this->actesTransaction->set('subject', 'TEST');
@@ -260,24 +264,27 @@ class ActesTransactionTest extends S2lowTestCase
         $xml_name =  $this->actesTransaction->getStdFileName($env, false);
 
         $this->actesTransaction->generateMessageXMLFile($xml_name);
-
         $this->actesTransaction->save();
 
         $transaction_id = $this->actesTransaction->getId();
 
         $actesIncludedFileSQL = $this->getObjectInstancier()->get(ActesIncludedFileSQL::class);
         $file_list = $actesIncludedFileSQL->getAll($transaction_id);
-        $this->assertEquals("99_AU", $file_list[2]['code_pj']);
-        $this->assertEquals("99_AU-001-000000000-20170829-TEST-DE-1-1_2.pdf", $file_list[2]['filename']);
+        self::assertSame(
+            $xml_name . '_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        static::assertSame('99_AU', $file_list[2]['code_pj']);
+        static::assertSame('99_AU-001-000000000-20170829-TEST-DE-1-1_2.pdf', $file_list[2]['filename']);
     }
 
     public function testGetTransactionNatureDescr()
     {
-        $this->assertEquals(['short_descr' => 'DE','descr' => 'Deliberations'], ActesTransaction::getTransactionNatureDescr(1));
+        self::assertSame(['short_descr' => 'DE','descr' => 'Deliberations'], ActesTransaction::getTransactionNatureDescr(1));
     }
     public function testGetTransactionNatureDescrFailed()
     {
-        $this->assertFalse(ActesTransaction::getTransactionNatureDescr('Délibération'));
+        static::assertFalse(ActesTransaction::getTransactionNatureDescr('Délibération'));
     }
 
 
@@ -293,7 +300,7 @@ class ActesTransactionTest extends S2lowTestCase
         $this->actesTransaction->set('classif1', '1');
         $this->actesTransaction->set('classif2', '1');
 
-        $this->actesTransaction->set('type', '1');
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
         $this->actesTransaction->set('nature_code', '1');
         $this->actesTransaction->set('nature_descr', 'toto');
         $this->actesTransaction->set('subject', 'TEST');
@@ -316,10 +323,481 @@ class ActesTransactionTest extends S2lowTestCase
             true,
             'code_pj_trop_grand'
         );
-        $this->assertFalse($result);
-        $this->assertEquals(
+        self::assertFalse($result);
+        self::assertSame(
             'Le code de la PJ doit faire 5 caractères',
             $this->actesTransaction->getErrorMsg()
         );
     }
+
+    /**
+     * @dataProvider typeProvider
+     */
+    public function testFileNameAccordingToType(TypeTransaction $type, string $expectedName): void
+    {
+        $this->actesTransaction->setType($type);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+        static::assertSame($expectedName, $this->actesTransaction->getStdFileName($env));
+    }
+
+    public function typeProvider(): iterable
+    {
+        return [
+            [TypeTransaction::TransmissionActe, 'toto/001-000000000-20130405--DE-1-1_1'],
+            [TypeTransaction::CourrierSimple, 'toto/001-000000000-20130405--DE-2-2_1'],
+            [TypeTransaction::DemandeDeClassification, 'toto/001-000000000----7-1_1']
+        ];
+    }
+
+    public function testFileNameAnnulation(): void
+    {
+        $this->actesTransaction->setType(TypeTransaction::Annulation);
+
+        $relatedTransaction = new ActesTransaction();
+        $relatedTransaction->set('decision_date', '2013-04-05');
+        $relatedTransaction->set('nature_code', '1');
+
+        $this->actesTransaction->set('related_transaction', $relatedTransaction);
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        $this->actesTransaction->setType(TypeTransaction::Annulation);
+        static::assertSame('toto/001-000000000-20130405--DE-6-1_1', $this->actesTransaction->getStdFileName($env));
+    }
+
+    /**
+     * Les lettres d'observation et les demandes complémentaires utilisent un type de réponse
+     * Il faut donc un test séparé.
+     * @dataProvider typeProviderWithResponseType
+     */
+    public function testFileNameAccordingToTypeWithResponseType(TypeTransaction $type, int $type_response, string $expectedName)
+    {
+
+        $this->actesTransaction->setType($type);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+        $this->actesTransaction->set('type_reponse', $type_response);
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+        self::assertSame($expectedName, $this->actesTransaction->getStdFileName($env));
+    }
+
+    public function typeProviderWithResponseType()
+    {
+        return [
+            [TypeTransaction::LettreDObservation,1, 'toto/001-000000000-20130405--DE-4-1_1'],
+            [TypeTransaction::LettreDObservation,2, 'toto/001-000000000-20130405--DE-4-2_1'],
+            [TypeTransaction::DemandePieceComplementaire,1, 'toto/001-000000000-20130405--DE-3-1_1'],
+            [TypeTransaction::DemandePieceComplementaire,2, 'toto/001-000000000-20130405--DE-3-2_1']
+        ];
+    }
+
+    public function testGenerateMessageXMLActe()
+    {
+
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('classification_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+
+        $this->addActePDF();
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        static::assertTrue($this->actesTransaction->generateMessageXMLFile('test'));
+        $file_path = ACTES_FILES_UPLOAD_ROOT . '/' . $this->actesTransaction->get('xmlFileName');
+        static::assertSame(
+            'test_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        static::assertFileExists($file_path);
+
+        $rootname_for_a_TransmissionActe_Message = '<actes:Acte';
+        static::assertStringContainsString($rootname_for_a_TransmissionActe_Message, file_get_contents($file_path));
+    }
+
+    /**
+     * @dataProvider typeReponseCourrier
+     */
+    public function testGenerateMessageXMLReponseCourrier(TypeTransaction $type, ?int $type_response, string $expectedRoot): void
+    {
+        $this->actesTransaction->setType($type);
+        $this->actesTransaction->set('type_reponse', $type_response);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('classification_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+
+        $this->addActePDF();
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        $relatedTransaction = new ActesTransaction();
+        $relatedTransaction->set('decision_date', '2013-04-05');
+        $relatedTransaction->set('nature_code', '1');
+
+        $this->actesTransaction->set('related_transaction', $relatedTransaction);
+
+
+        static::assertTrue($this->actesTransaction->generateMessageXMLFile('test'));
+        $file_path = ACTES_FILES_UPLOAD_ROOT . '/' . $this->actesTransaction->get('xmlFileName');
+        static::assertSame(
+            'test_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        static::assertFileExists($file_path);
+        // On vérifie que le type de message généré est correct
+        static::assertStringContainsString('<actes:' . $expectedRoot, file_get_contents($file_path));
+    }
+
+    public function typeReponseCourrier(): iterable
+    {
+        return [
+            [TypeTransaction::CourrierSimple, null, 'ReponseCourrierSimple'],
+            [TypeTransaction::DemandePieceComplementaire, ActesTransaction::TYPE_REFUS, 'RefusPieceComplementaire'],
+            [TypeTransaction::LettreDObservation, ActesTransaction::TYPE_REFUS, 'RejetLettreObservations'],
+            [TypeTransaction::LettreDObservation, ActesTransaction::TYPE_ENVOIE, 'ReponseLettreObservations'],
+        ];
+    }
+
+    public function testGenerateMessageXMLAnnulation(): void
+    {
+
+        $this->actesTransaction->setType(TypeTransaction::Annulation);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('classification_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        $relatedTransaction = new ActesTransaction();
+        $relatedTransaction->set('decision_date', '2013-04-05');
+        $relatedTransaction->set('nature_code', '1');
+        $relatedTransaction->set('unique_id', 'ACTE_A_ANNULER');
+
+        $this->actesTransaction->set('related_transaction', $relatedTransaction);
+
+        static::assertTrue($this->actesTransaction->generateMessageXMLFile('test'));
+        $file_path = ACTES_FILES_UPLOAD_ROOT . '/' . $this->actesTransaction->get('xmlFileName');
+        static::assertSame(
+            'test_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        static::assertFileExists($file_path);
+        $file_content = file_get_contents($file_path);
+        // On vérifie que le type de message généré est correct
+        static::assertStringContainsString('<actes:Annulation', $file_content);
+        // On vérifie que l'unique id de l'acte à annuler est correct
+        static::assertStringContainsString('actes:IDActe="ACTE_A_ANNULER"', $file_content);
+    }
+
+    public function testGenerateMessageXMLDemandeClassification(): void
+    {
+
+        $this->actesTransaction->setType(TypeTransaction::DemandeDeClassification);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('last_classification_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        static::assertTrue($this->actesTransaction->generateMessageXMLFile('test'));
+        $file_path = ACTES_FILES_UPLOAD_ROOT . '/' . $this->actesTransaction->get('xmlFileName');
+        static::assertSame(
+            'test_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        static::assertFileExists($file_path);
+        $file_content = file_get_contents($file_path);
+        // On vérifie que le type de message généré est correct
+        static::assertStringContainsString('<actes:DemandeClassification', $file_content);
+        // On vérifie que la date de dernière classification est présente et correcte
+        static::assertStringContainsString(
+            '<actes:DateClassification>2013-04-05</actes:DateClassification>',
+            $file_content
+        );
+    }
+    public function testGenerateMessageXMLReponseCourrierEnvoi(): void
+    {
+        $this->actesTransaction->setType(TypeTransaction::DemandePieceComplementaire);
+        $this->actesTransaction->set('type_reponse', ActesTransaction::TYPE_ENVOIE);
+        $this->actesTransaction->set('decision_date', '2013-04-05');
+        $this->actesTransaction->set('classification_date', '2013-04-05');
+        $this->actesTransaction->set('nature_code', '1');
+
+        $this->addActePDF();
+        $this->addAnnexePDF();
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        $relatedTransaction = new ActesTransaction();
+        $relatedTransaction->set('decision_date', '2013-04-05');
+        $relatedTransaction->set('nature_code', '1');
+
+        $this->actesTransaction->set('related_transaction', $relatedTransaction);
+
+        static::assertTrue($this->actesTransaction->generateMessageXMLFile('test'));
+        $file_path = ACTES_FILES_UPLOAD_ROOT . '/' . $this->actesTransaction->get('xmlFileName');
+        static::assertSame(
+            'test_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        static::assertFileExists($file_path);
+        $file_content = file_get_contents($file_path);
+        // On vérifie que le type de message généré est correct
+        static::assertStringContainsString('<actes:PieceComplementaire', $file_content);
+        static::assertStringContainsString('<actes:Documents>', $file_content);
+        // On vérifie que le document principal est présent et correct
+        static::assertStringContainsString(
+            basename($this->actesTransaction->files['acte']['name']),
+            $file_content
+        );
+        // On vérifie que le document annexe est présent et correct
+        static::assertStringContainsString(
+            basename($this->actesTransaction->files['attachment'][0]['name']),
+            $file_content
+        );
+        unlink('/data/tdt-workspace/actes/uploads/test_0.xml');
+    }
+
+    /**
+     * @dataProvider XMLfiles
+     */
+    public function testCreateFromXML(string $filename, int $type): void
+    {
+        $test_file_path = __DIR__ . "/../../../../../vendor/libriciel/tdt-lib-actes/tests/FichierXML/fixtures/$filename";
+        copy($test_file_path, ACTES_FILES_UPLOAD_ROOT . '/' . $filename);
+
+        $transaction = new ActesTransaction();
+        $transaction->createFromXML(
+            $filename,
+            $this->getObjectInstancier()->get(ActesClassificationCodesSQL::class)
+        );
+
+        unlink(ACTES_FILES_UPLOAD_ROOT . '/' . $filename);
+
+        self::assertSame(
+            $type,
+            $transaction->get('type')
+        );
+    }
+
+    public function XMLfiles(): iterable
+    {
+        return [
+            //actes:Acte
+          ['001-000000000-20170130-TEST42-DE-1-1_0.xml', TypeTransaction::TransmissionActe->value],
+            //actes:ReponseCourrierSimple
+            ['001-000000000-20170130-TEST42-DE-2-2_0.xml', TypeTransaction::CourrierSimple->value],
+            //actes:RefusPieceComplementaire
+            ['001-000000000-20170130-TEST42-DE-3-3_0.xml',TypeTransaction::DemandePieceComplementaire->value],
+            //actes:PieceComplementaire
+            ['001-000000000-20170130-TEST42-DE-3-4_0.xml',TypeTransaction::DemandePieceComplementaire->value],
+            //actes:RejetLettreObservations
+            ['001-000000000-20170130-TEST42-DE-4-3_0.xml',TypeTransaction::LettreDObservation->value],
+            //actes:ReponseLettreObservations
+            ['001-000000000-20170130-TEST42-DE-4-4_0.xml',TypeTransaction::LettreDObservation->value],
+            //actes:Annulation
+            ['001-000000000-20170130-TEST42-DE-6-1_0.xml',TypeTransaction::Annulation->value],
+            //actes:DemandeClassification
+            ['001-000000000----7-1_0.xml',TypeTransaction::DemandeDeClassification->value],
+        ];
+    }
+
+    public function testsetDataFromCourrierWithExistingRelatedTransaction(): void
+    {
+        $filename = __DIR__ . '/fixtures/001-000000000-20170130-TEST42-DE-3-3_0.xml';
+
+        $actesEnvelopeSQL = $this->getObjectInstancier()->get(ActesEnvelopeSQL::class);
+
+        $envelope_id = $actesEnvelopeSQL->create(1, '000000000/20170721D/abc-EACT--210703385--20170612-2.tar.gz');
+
+        $this->actesTransaction->set('envelope_id', $envelope_id);
+        $this->actesTransaction->set('decision_date', '2017-08-29');
+        $this->actesTransaction->set('classification_date', '2017-08-29');
+        $this->actesTransaction->set('classif1', '1');
+        $this->actesTransaction->set('classif2', '1');
+
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
+        $this->actesTransaction->set('nature_code', '1');
+        $this->actesTransaction->set('nature_descr', 'toto');
+        $this->actesTransaction->set('subject', 'TEST');
+        $this->actesTransaction->set('number', 'TEST');
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        $dest_name = $this->actesTransaction->getStdFileName($env);
+
+        $this->actesTransaction->addActeFile('vide.pdf', $dest_name, $this->pdf_filepath);
+        $this->actesTransaction->getStdFileName($env, true, "99_AU");
+
+        $xml_name =  $this->actesTransaction->getStdFileName($env, false);
+
+        $this->actesTransaction->generateMessageXMLFile($xml_name);
+
+        $this->actesTransaction->set('unique_id', '032-213201601-20170616-ARP201706407-AI');
+        $this->actesTransaction->save();
+
+        mkdir(ACTES_FILES_UPLOAD_ROOT . '/testFiles/');
+        copy($filename, ACTES_FILES_UPLOAD_ROOT . '/testFiles/' . basename($filename));
+        copy(__DIR__ . '/fixtures/test_pdf.pdf', ACTES_FILES_UPLOAD_ROOT . '/testFiles/' . '001-000000000-20170130-TEST42-DE-3-3_1.pdf');
+
+
+        $transaction = new ActesTransaction();
+        $transaction->set('destDir', 'testFiles');
+        $transaction->createFromXML(
+            '/testFiles/' . basename($filename),
+            $this->getObjectInstancier()->get(ActesClassificationCodesSQL::class)
+        );
+
+
+        unlink(ACTES_FILES_UPLOAD_ROOT . '/testFiles/' . basename($filename));
+        unlink(ACTES_FILES_UPLOAD_ROOT . '/testFiles/' . '001-000000000-20170130-TEST42-DE-3-3_1.pdf');
+        rmdir(ACTES_FILES_UPLOAD_ROOT . '/testFiles/');
+
+        static::assertSame(
+            $xml_name . '_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+        self::assertSame(
+            TypeTransaction::DemandePieceComplementaire->value,
+            $transaction->get('type')
+        );
+        self::assertSame(
+            $xml_name . '_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+
+        self::assertSame(null, $transaction->getErrorMsg());
+        self::assertSame(
+            '/testFiles/001-000000000-20170130-TEST42-DE-3-3_1.pdf',
+            $transaction->get('files')['acte']['name']
+        );
+    }
+
+    public function testsetDataFromCourrierWithExistingRelatedTransaction2(): void
+    {
+        $filename = __DIR__ . '/fixtures/001-000000000-20170130-TEST42-DE-3-4_0.xml';
+        $actesEnvelopeSQL = $this->getObjectInstancier()->get(ActesEnvelopeSQL::class);
+
+        $envelope_id = $actesEnvelopeSQL->create(1, '000000000/20170721D/abc-EACT--210703385--20170612-2.tar.gz');
+
+        $this->actesTransaction->set('envelope_id', $envelope_id);
+        $this->actesTransaction->set('decision_date', '2017-08-29');
+        $this->actesTransaction->set('classification_date', '2017-08-29');
+        $this->actesTransaction->set('classif1', '1');
+        $this->actesTransaction->set('classif2', '1');
+
+        $this->actesTransaction->setType(TypeTransaction::TransmissionActe);
+        $this->actesTransaction->set('nature_code', '1');
+        $this->actesTransaction->set('nature_descr', 'toto');
+        $this->actesTransaction->set('subject', 'TEST');
+        $this->actesTransaction->set('number', 'TEST');
+
+
+        $env = new ActesEnvelope();
+        $env->set('department', '001');
+        $env->set('siren', '000000000');
+
+        $dest_name = $this->actesTransaction->getStdFileName($env);
+
+        $this->actesTransaction->addActeFile('vide.pdf', $dest_name, $this->pdf_filepath);
+
+        $this->actesTransaction->getStdFileName($env, true, '99_AU');
+        $xml_name =  $this->actesTransaction->getStdFileName($env, false);
+
+        $this->actesTransaction->generateMessageXMLFile($xml_name);
+
+        $this->actesTransaction->set('unique_id', '032-213201601-20170616-ARP201706407-AI');
+        $this->actesTransaction->save();
+
+        mkdir(ACTES_FILES_UPLOAD_ROOT . '/siren');
+        mkdir(ACTES_FILES_UPLOAD_ROOT . '/siren/import/');
+        copy($filename, ACTES_FILES_UPLOAD_ROOT . '/siren/import/' . basename($filename));
+        copy(__DIR__ . '/fixtures/test_pdf.pdf', ACTES_FILES_UPLOAD_ROOT . '/siren/import/001-000000000-20170130-TEST42-DE-3-4_1.pdf');
+        copy(__DIR__ . '/fixtures/test_pdf.pdf', ACTES_FILES_UPLOAD_ROOT .  '/siren/import/001-000000000-20170130-TEST42-DE-3-4_2.pdf');
+
+
+        $transaction = new ActesTransaction();
+        $transaction->set('destDir', '/siren/import/');
+        $transaction->createFromXML(
+            '/siren/import/' . basename($filename),
+            $this->getObjectInstancier()->get(ActesClassificationCodesSQL::class)
+        );
+
+
+        unlink(ACTES_FILES_UPLOAD_ROOT . '/siren/import/' . basename($filename));
+        unlink(ACTES_FILES_UPLOAD_ROOT . '/siren/import/001-000000000-20170130-TEST42-DE-3-4_1.pdf');
+        unlink(ACTES_FILES_UPLOAD_ROOT . '/siren/import/001-000000000-20170130-TEST42-DE-3-4_2.pdf');
+        rmdir(ACTES_FILES_UPLOAD_ROOT . '/siren/import');
+        rmdir(ACTES_FILES_UPLOAD_ROOT . '/siren');
+
+        self::assertSame(
+            TypeTransaction::DemandePieceComplementaire->value,
+            $transaction->get('type')
+        );
+        self::assertSame(
+            $xml_name . '_0.xml',
+            $this->actesTransaction->get('xmlFileName')
+        );
+
+        //TODO : il y a un bug
+        // 001-000000000-20170130-TEST42-DE-3-4_2.pdf devrait être dans les annexes
+        // et 001-000000000-20170130-TEST42-DE-3-4_1.pdf devrait figurer en fichier principal
+        self::assertSame(
+            '/siren/import/001-000000000-20170130-TEST42-DE-3-4_2.pdf',
+            $transaction->get('files')['acte']['name']
+        );
+    }
+
+    public function testGenerateMessageXMLFileMauvaisType(): void
+    {
+        $this->actesTransaction->set('type', 666);
+        self::assertFalse($this->actesTransaction->generateMessageXMLFile('test'));
+        self::assertSame(
+            'Mauvais type de transaction.',
+            $this->actesTransaction->getErrorMsg()
+        );
+    }
+
+    /**
+     * @dataProvider typeProvider2
+     */
+    public function testIsType(int $type_as_int, bool $isSame)
+    {
+        $this->actesTransaction->set('type', $type_as_int);
+        self::assertSame(
+            $isSame,
+            $this->actesTransaction->isType(TypeTransaction::TransmissionActe)
+        );
+    }
+
+    public function typeProvider2(): iterable
+    {
+        return [
+            [29620,false],
+            [TypeTransaction::TransmissionActe->value, true],
+            [TypeTransaction::DemandeDeClassification->value, false],
+        ];
+    }
 }
diff --git a/test/PHPUnit/public.ssl/module/actes/fixtures/001-000000000-20170130-TEST42-DE-3-3_0.xml b/test/PHPUnit/public.ssl/module/actes/fixtures/001-000000000-20170130-TEST42-DE-3-3_0.xml
new file mode 100755
index 0000000000000000000000000000000000000000..29fb3139c9a4713036324b9dc7af564d0aa4e9d2
--- /dev/null
+++ b/test/PHPUnit/public.ssl/module/actes/fixtures/001-000000000-20170130-TEST42-DE-3-3_0.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<actes:RefusPieceComplementaire xmlns:actes="http://www.interieur.gouv.fr/ACTES#v1.1-20040216" actes:IDActe="032-213201601-20170616-ARP201706407-AI" actes:DateCourrierPref="2017-06-17">
+  <actes:Document>
+    <actes:NomFichier>001-000000000-20170130-TEST42-DE-3-3_1.pdf</actes:NomFichier>
+  </actes:Document>
+</actes:RefusPieceComplementaire>
diff --git a/test/PHPUnit/public.ssl/module/actes/fixtures/001-000000000-20170130-TEST42-DE-3-4_0.xml b/test/PHPUnit/public.ssl/module/actes/fixtures/001-000000000-20170130-TEST42-DE-3-4_0.xml
new file mode 100755
index 0000000000000000000000000000000000000000..3006f171966640ca1d0286f0d4dc05f18264d766
--- /dev/null
+++ b/test/PHPUnit/public.ssl/module/actes/fixtures/001-000000000-20170130-TEST42-DE-3-4_0.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<actes:PieceComplementaire xmlns:actes="http://www.interieur.gouv.fr/ACTES#v1.1-20040216" actes:IDActe="032-213201601-20170616-ARP201706407-AI" actes:DateCourrierPref="2017-06-17">
+  <actes:Documents>
+    <actes:Document>
+      <actes:NomFichier>001-000000000-20170130-TEST42-DE-3-4_1.pdf</actes:NomFichier>
+    </actes:Document>
+    <actes:Document>
+      <actes:NomFichier>001-000000000-20170130-TEST42-DE-3-4_2.pdf</actes:NomFichier>
+    </actes:Document>
+  </actes:Documents>
+</actes:PieceComplementaire>
diff --git a/test/PHPUnit/public.ssl/module/actes/fixtures/test_pdf.pdf b/test/PHPUnit/public.ssl/module/actes/fixtures/test_pdf.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..0c3a03b8492f57753eebf12cacfc4c4ab02dee98
--- /dev/null
+++ b/test/PHPUnit/public.ssl/module/actes/fixtures/test_pdf.pdf
@@ -0,0 +1,90 @@
+%PDF-1.4
+%Ç쏢
+5 0 obj
+<</Length 6 0 R/Filter /FlateDecode>>
+stream
+xœMޱNÄ0†÷<…Çd¨ÏNœ¸^OÀÀ§l'¦Šc*¨âx’RªÚƒ­ÿóo{BŽ@=ÿ›ivnq#¦«xì§Î՝.
+ÍQoŽÐÌ„WÆ „#h!¨³»ú‡À˜5Sò_a Œ&¦â§°•Ÿƒ4‡!¢ÊÅ¿ÿÑϽwÊ%çÑC—Y4[ò/aö³n‡D¢
+‹æhû¨Z<nØö‡1F3Ýaj–·úì«{mùµi:uendstream
+endobj
+6 0 obj
+180
+endobj
+4 0 obj
+<</Type/Page/MediaBox [0 0 595 842]
+/Rotate 0/Parent 3 0 R
+/Resources<</ProcSet[/PDF /Text]
+/Font 8 0 R
+>>
+/Contents 5 0 R
+>>
+endobj
+3 0 obj
+<< /Type /Pages /Kids [
+4 0 R
+] /Count 1
+>>
+endobj
+1 0 obj
+<</Type /Catalog /Pages 3 0 R
+/Metadata 9 0 R
+>>
+endobj
+8 0 obj
+<</R7
+7 0 R>>
+endobj
+7 0 obj
+<</BaseFont/Times-Roman/Type/Font
+/Subtype/Type1>>
+endobj
+9 0 obj
+<</Type/Metadata
+/Subtype/XML/Length 1549>>stream
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
+<?adobe-xap-filters esc="CRLF"?>
+<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+<rdf:Description rdf:about='uuid:81d69fb9-8bc7-11e4-0000-66b1dd18110c' xmlns:pdf='http://ns.adobe.com/pdf/1.3/'><pdf:Producer>GPL Ghostscript 9.06</pdf:Producer>
+<pdf:Keywords>()</pdf:Keywords>
+</rdf:Description>
+<rdf:Description rdf:about='uuid:81d69fb9-8bc7-11e4-0000-66b1dd18110c' xmlns:xmp='http://ns.adobe.com/xap/1.0/'><xmp:ModifyDate>2014-12-22T00:49:20+01:00</xmp:ModifyDate>
+<xmp:CreateDate>2014-12-22T00:49:20+01:00</xmp:CreateDate>
+<xmp:CreatorTool>PDFCreator Version 1.6.0</xmp:CreatorTool></rdf:Description>
+<rdf:Description rdf:about='uuid:81d69fb9-8bc7-11e4-0000-66b1dd18110c' xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:81d69fb9-8bc7-11e4-0000-66b1dd18110c'/>
+<rdf:Description rdf:about='uuid:81d69fb9-8bc7-11e4-0000-66b1dd18110c' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>test_word</rdf:li></rdf:Alt></dc:title><dc:creator><rdf:Seq><rdf:li>Seb</rdf:li></rdf:Seq></dc:creator><dc:description><rdf:Seq><rdf:li>()</rdf:li></rdf:Seq></dc:description></rdf:Description>
+</rdf:RDF>
+</x:xmpmeta>
+                                                                        
+                                                                        
+<?xpacket end='w'?>
+endstream
+endobj
+2 0 obj
+<</Producer(GPL Ghostscript 9.06)
+/CreationDate(D:20141222004920+01'00')
+/ModDate(D:20141222004920+01'00')
+/Title(\376\377\000t\000e\000s\000t\000_\000w\000o\000r\000d)
+/Creator(\376\377\000P\000D\000F\000C\000r\000e\000a\000t\000o\000r\000 \000V\000e\000r\000s\000i\000o\000n\000 \0001\000.\0006\000.\0000)
+/Author(\376\377\000S\000e\000b)
+/Keywords()
+/Subject()>>endobj
+xref
+0 10
+0000000000 65535 f 
+0000000484 00000 n 
+0000002268 00000 n 
+0000000425 00000 n 
+0000000284 00000 n 
+0000000015 00000 n 
+0000000265 00000 n 
+0000000577 00000 n 
+0000000548 00000 n 
+0000000643 00000 n 
+trailer
+<< /Size 10 /Root 1 0 R /Info 2 0 R
+/ID [<0CB231047435B33BCE0B1C6881DCF011><0CB231047435B33BCE0B1C6881DCF011>]
+>>
+startxref
+2648
+%%EOF