diff --git a/apps/maarch_entreprise/js/indexing.js b/apps/maarch_entreprise/js/indexing.js
index 50d20f6788fbf2f9b42bb607d8c66023058e62fa..07168b4a3aaa6cf73de1d290378297e0121a0d94 100755
--- a/apps/maarch_entreprise/js/indexing.js
+++ b/apps/maarch_entreprise/js/indexing.js
@@ -1284,7 +1284,10 @@ function change_contact_type(path_autocomplete, empty_contact_div, id_internal,
 				Element.setStyle(valid_multi_contact, {display : 'inline'});
 				Element.setStyle(to_multi_contact, {display : 'table-cell'});
 				Element.setStyle(to, {display : 'inline'});
-                if(cat_id != 'attachment') Element.setStyle(show_multi_contact, {display : 'table-row'}); // NCH01
+                // NCH01
+				if(cat_id !== 'attachment'){
+                    Element.setStyle(show_multi_contact, {display : 'table-row'});
+                }
 				Element.setStyle(add_multi_contact, {display : 'table-row'});
 				Element.setStyle(contact_id_tr, {display : 'none'});
 			}else if ($(external_type ).checked == true){
@@ -1295,7 +1298,9 @@ function change_contact_type(path_autocomplete, empty_contact_div, id_internal,
 				Element.setStyle(show_multi_contact, {display : 'none'});
 				Element.setStyle(add_multi_contact, {display : 'none'});
 				// NCH01
-                if(cat_id != 'attachment') Element.setStyle(contact_id_tr, {display : 'table-row'});
+                if(cat_id !== 'attachment') {
+                    Element.setStyle(contact_id_tr, {display : 'table-row'});
+                }
 			}
         }
     }
diff --git a/modules/attachments/add_attachments.php b/modules/attachments/add_attachments.php
index 6078dae28d1d47e566f507c3a66e5f64fdf1c3b3..b0786906dc78138a10f71af4de78e3b8290c39e8 100755
--- a/modules/attachments/add_attachments.php
+++ b/modules/attachments/add_attachments.php
@@ -9,7 +9,6 @@
 $core = new core_tools();
 $core->test_user();
 $db = new Database();
-$reconciliationControler = new \Attachment\controllers\ReconciliationController();
 
 $letterboxTable = $_SESSION['tablename']['reconciliation']['letterbox'];
 
@@ -18,7 +17,7 @@ $parentResId = $_SESSION['stockCheckbox'];
 $childResId = $_SESSION['doc_id'];
 
 // Retrieve the data of the form (title, chrono number, recipient etc...)
-$formValues = $reconciliationControler -> get_values_in_array($_REQUEST['form_values']);
+$formValues = get_values_in_array($_REQUEST['form_values']);
 $tabFormValues = array();
 
 // NCH01 new modifs
diff --git a/src/app/attachment/controllers/ReconciliationController.php b/src/app/attachment/controllers/ReconciliationController.php
index a5aaf1c9e836cd3d67d615a76c293622fcdfa654..a84846b2e50393eef21855f1b21d43fa967f591f 100755
--- a/src/app/attachment/controllers/ReconciliationController.php
+++ b/src/app/attachment/controllers/ReconciliationController.php
@@ -5,48 +5,66 @@ namespace Attachment\controllers;
 use Slim\Http\Request;
 use Slim\Http\Response;
 use Attachment\models\ReconciliationModel;
-use SrcCore\controllers\StoreController;
+use Respect\Validation\Validator;
+use History\controllers\HistoryController;
+use Resource\controllers\StoreController;
+use SrcCore\models\CoreConfigModel;
 
 
-class ReconciliationController{
 
-    public function create(Request $request, Response $response, $aArgs)
+class ReconciliationController
+{
+
+    public function create(Request $request, Response $response)
     {
-        if (empty($aArgs)) {
-            $aArgs = $request->getParsedBody();
+        $data = $request->getParams();
+        $check = Validator::notEmpty()->validate($data['encodedFile']);
+        $check = $check && Validator::numeric()->notEmpty()->validate($data['resId']);
+        $check = $check && Validator::stringType()->notEmpty()->validate($data['chrono']);
+        if (!$check) {
+            return $response->withStatus(400)->withJson(['errors' => 'Bad Request']);
         }
-        $aArgs['data'] = $this->object2array($aArgs['data']);
 
-        $return = $this->getWs($aArgs);
+        $resId = $this->getWs($data);
 
-        if ($return['errors']) {
-            return $response
-                ->withStatus(500)
-                ->withJson(
-                    ['errors' => _NOT_CREATE . ' ' . $return['errors']]
-                );
+        if (empty($resId) || !empty($resId['errors'])) {
+            return $response->withStatus(500)->withJson(['errors' => '[ReconciliationController create] ' . $resId['errors']]);
         }
 
-        $wsReturn['resId'] = $return[0];
+        HistoryController::add([
+            'tableName' => 'res_attachments',
+            'recordId' => $resId,
+            'eventType' => 'ADD',
+            'info' => _DOC_ADDED,
+            'moduleId' => 'reconciliation',
+            'eventId' => 'attachmentadd',
+        ]);
 
-        return $response->withJson($wsReturn);
+        return $response->withJson(['resId' => $resId]);
     }
 
     public function getWs($aArgs)
     {
-
         $identifier = $aArgs['chrono'];
-        $res_id = (int) $aArgs['res_id'];
-        $encodedContent = $aArgs['encoded_content'];
-
-        $info = $this->get_attachment_info_from_chrono($identifier, 'status IN (\'A_TRA\', \'NEW\', \'TMP\')');
-        if(! $info)
-            return False;
+        $res_id = (int)$aArgs['resId'];
+        $encodedContent = $aArgs['encodedFile'];
+
+        $info = ReconciliationModel::getReconciliation([
+            'select' => ['*'],
+            'table' => ['res_attachments'],
+            'where' => ['identifier = (?)', "status IN ('A_TRA', 'NEW','TMP')"],
+            'data' => [$identifier],
+            'orderBy' => ['res_id DESC']
+        ])[0];
+
+        if (!$info) {
+            return false;
+        }
 
         $title = $info['title'];
         $fileFormat = 'pdf';
         $attachment_type = 'outgoing_mail_signed';
-        $collIdMaster = 'letterbox_coll';
+        $collId = 'letterbox_coll';
 
         $data = [];
 
@@ -90,122 +108,80 @@ class ReconciliationController{
                 'type' => 'integer',
             )
         );
+        array_push(
+            $data,
+            array(
+                'column' => 'coll_id',
+                'value' => $collId,
+                'type' => 'integer',
+            )
+        );
+
+        array_push(
+            $data,
+            array(
+                'column' => 'res_id_master',
+                'value' => $res_id,
+                'type' => 'integer',
+            )
+        );
 
-        $ac = new AttachmentController();
         $aArgs = [
-            'resId'             => $res_id,
-            'collId'            => $collIdMaster,
-            'collIdMaster'      => $collIdMaster,
-            'table'             => 'res_attachments',
-            'encodedFile'       => $encodedContent,
-            'fileFormat'        => $fileFormat,
-            'data'              => $data
+            'collId' => $collId,
+            'table' => 'res_attachments',
+            'encodedFile' => $encodedContent,
+            'fileFormat' => $fileFormat,
+            'data' => $data,
+            'status' => 'TRA'
         ];
 
-        $new_attachment = $ac->storeAttachmentResource($aArgs);
+        $resId = StoreController::storeResourceRes($aArgs);
 
         // Suppression du projet de reponse
-        $delete_response_project = $_SESSION['modules_loaded']['attachments']['reconciliation']['delete_response_project'] == 'true';
-
-        if($delete_response_project){
-            ReconciliationModel::updateReconciliation([
-                'set'       => ['status' => 'DEL'],
-                'where'     => ['res_id = (?)'],
-                'data'      => [$info['res_id']],
-                'table'     => 'res_attachments'
-            ]);
-        }
+        $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/attachments/xml/config.xml']);
+        if ($loadedXml) {
+            $reconciliationConfig = $loadedXml->RECONCILIATION->CONFIG;
+            $delete_response_project = $reconciliationConfig->delete_response_project;
+            $close_incoming = $reconciliationConfig->close_incoming;
+
+            if ($delete_response_project == 'true') {
+                ReconciliationModel::updateReconciliation([
+                    'set' => ['status' => 'DEL'],
+                    'where' => ['res_id = (?)'],
+                    'data' => [$info['res_id']],
+                    'table' => 'res_attachments'
+                ]);
+            }
 
-        // Cloture du courrier entrant
-        $close_incoming = $_SESSION['modules_loaded']['attachments']['reconciliation']['close_incoming'] == 'true';
-        if ($close_incoming){
-            ReconciliationModel::updateReconciliation([
-                'set'       => ['status' => 'END'],
-                'where'     => ['res_id = (?)'],
-                'data'      => [$res_id],
-                'table'     => 'res_letterbox'
-            ]);
+            // Cloture du courrier entrant
+            if ($close_incoming == 'true') {
+                ReconciliationModel::updateReconciliation([
+                    'set' => ['status' => 'END'],
+                    'where' => ['res_id = (?)'],
+                    'data' => [$res_id],
+                    'table' => 'res_letterbox'
+                ]);
+            }
         }
 
-        $result = [$new_attachment[0]];
-
-        return $result;
-    }
-
-    /*
-     *  Recupere toutes les infos d'une PJ avec son num chrono
-     *  Retourne la PJ la plus recente
-     */
-    private function get_attachment_info_from_chrono($identifier, $filter=NULL)
-    {
-        $collId = 'attachments_coll';
-        $sec = new \security();
-        $table = $sec->retrieve_table_from_coll($collId);
-
-        $result = ReconciliationModel::selectReconciliation([
-            'select'    => ['*'],
-            'table'     => [$table],
-            'where'     => [isset($filter) ? 'identifier = (?) AND ' . $filter : 'identifier = (?)'],
-            'data'      => [$identifier],
-            'orderBy'   => ['res_id DESC']
-        ]);
-        return $result[0];
+        return $resId;
     }
 
     public function checkAttachment(Request $request, Response $response, $aArgs)
     {
-        if (!empty($aArgs)) {
-            $aArgs = $aArgs;
-        } else {
-            $aArgs = $request->getParsedBody();
-        }
-	   $attachment = $this->get_attachment_info_from_chrono($aArgs['chrono'], "status IN ('TMP', 'A_TRA','NEW')");
-        $result = ($attachment != False)? 'OK': 'KO';
-	return $response->withJson(array('result' => $result));
-    }
-
-
-    private function object2array($object)
-    {
-        $return = null;
-        if (is_array($object)) {
-            foreach ($object as $key => $value) {
-                $return[$key] = $this->object2array($value);
-            }
-        } else {
-            if (is_object($object)) {
-                $var = get_object_vars($object);
-                if ($var) {
-                    foreach ($var as $key => $value) {
-                        $return[$key] = ($key && !$value) ? null : $this->object2array($value);
-                    }
-                } else {
-                    return $object;
-                }
-            } else {
-                return $object;
-            }
+        if (empty($aArgs)) {
+            $aArgs = $request->getParams();
         }
-        return $return;
-    }
 
-    function get_values_in_array($val){
-        $tab = explode('$$',$val);
-        $values = array();
-        for($i=0; $i<count($tab);$i++)
-        {
-            $tmp = explode('#', $tab[$i]);
+        $attachment = ReconciliationModel::getReconciliation([
+            'select' => ['*'],
+            'table' => ['res_attachments'],
+            'where' => ['identifier = (?)', "status IN ('A_TRA', 'NEW','TMP')"],
+            'data' => [$aArgs['chrono']],
+            'orderBy' => ['res_id DESC']
+        ])[0];
 
-            $val_tmp=array();
-            for($idiese=1;$idiese<count($tmp);$idiese++){
-                $val_tmp[]=$tmp[$idiese];
-            }
-            $valeurDiese = implode("#",$val_tmp);
-            if(isset($tmp[1]))
-            {
-                array_push($values, array('ID' => $tmp[0], 'VALUE' => $valeurDiese));
-            }
-        }
-        return $values;
+        $result = ($attachment != false) ? 'OK' : 'KO';
+        return $response->withJson(array('result' => $result));
     }
 }
diff --git a/src/app/attachment/models/ReconciliationModelAbstract.php b/src/app/attachment/models/ReconciliationModelAbstract.php
index af5f56b33b3e3a8c6be102e0c697a0b0a9d62d25..ad771903c9848ddd419259cb5be9d1ff5a902db8 100755
--- a/src/app/attachment/models/ReconciliationModelAbstract.php
+++ b/src/app/attachment/models/ReconciliationModelAbstract.php
@@ -12,7 +12,7 @@ use SrcCore\models\DatabaseModel;
 use SrcCore\models\ValidatorModel;
 
 class ReconciliationModelAbstract {
-    public static function selectReconciliation (array $aArgs = [])
+    public static function getReconciliation (array $aArgs = [])
     {
         ValidatorModel::notEmpty($aArgs, ['select']);
         ValidatorModel::arrayType($aArgs, ['select', 'where', 'data', 'orderBy']);