diff --git a/composer.json b/composer.json
index 695651fb9f1b7acca3ae9b0d139eb489a475470e..c7f928398cf8675eb93700b21ae1efbf7bacaf18 100755
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,6 @@
             "User\\"          : "src/app/user/",
 
             "Core\\"          : "core/",
-            "Attachments\\"   : "modules/attachments/",
             "Convert\\"       : "modules/convert/",
             "Visa\\"          : "modules/visa/"
     	}
diff --git a/modules/attachments/Controllers/ReconciliationController.php b/modules/attachments/Controllers/ReconciliationController.php
index 8623ea5c5433296cdca4a09bd9ec9f955a8073e8..03fea024251a5ebac4df5a956793162bad9cd4bf 100755
--- a/modules/attachments/Controllers/ReconciliationController.php
+++ b/modules/attachments/Controllers/ReconciliationController.php
@@ -1,16 +1,5 @@
 <?php
 
-namespace Attachments\Controllers;
-
-use Attachment\Models\AttachmentModel;
-use Psr\Http\Message\RequestInterface;
-use Psr\Http\Message\ResponseInterface;
-use Respect\Validation\Validator;
-use Resource\controllers\ResController;
-use Docserver\models\DocserverModel;
-use Docserver\models\DocserverTypeModel;
-use Docserver\controllers\DocserverToolsController;
-use Core\Models\ResModel;
 
 class ReconciliationController{
     public function storeAttachmentResource($aArgs)
@@ -275,26 +264,25 @@ class ReconciliationController{
         $filetmp .= $tmp;
         $filetmp .= $filename;
 
-        $docserver = DocserverModel::getById([
+        $docserver = \Docserver\models\DocserverModel::getById([
             'id' => $docserverId
         ]);
-        $docserverType = DocserverTypeModel::getById([
+        $docserverType = \Docserver\models\DocserverTypeModel::getById([
             'id' => $docserver['docserver_type_id']
         ]);
 
-        $fingerprint = DocserverToolsController::doFingerprint(
-            [
-                'path'            => $filetmp,
-                'fingerprintMode' => $docserverType['fingerprint_mode'],
-            ]
-        );
+        if (empty($docserverType['fingerprint_mode']) || $docserverType['fingerprint_mode'] == 'NONE') {
+            $fingerprint =  '0';
+        } else {
+            $fingerprint = hash_file(strtolower($docserverType['fingerprint_mode']), $filetmp);
+        }
 
         $filesize = filesize($filetmp);
         array_push(
             $data,
             array(
                 'column' => "fingerprint",
-                'value' => $fingerprint['fingerprint'],
+                'value' => $fingerprint,
                 'type' => "string"
             )
         );
@@ -346,7 +334,7 @@ class ReconciliationController{
             }
 
             unset($prepareData['res_id']); // NCH01
-            AttachmentModel::create($prepareData);
+            \Attachment\Models\AttachmentModel::create($prepareData);
 
             return true;
         }
diff --git a/modules/attachments/Models/ReconciliationModel.php b/modules/attachments/Models/ReconciliationModel.php
deleted file mode 100755
index d46123792cbd02684b1a44d35bda461ee1cb705d..0000000000000000000000000000000000000000
--- a/modules/attachments/Models/ReconciliationModel.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- *​ ​Copyright​ ​Maarch​ since ​2008​ under licence ​GPLv3.
- *​ ​See​ LICENCE​.​txt file at the root folder ​for​ more details.
- *​ ​This​ file ​is​ part of ​Maarch​ software.
- *
- */
-
-
-namespace Attachments\Models;
-
-
-class ReconciliationModel extends ReconciliationModelAbstract {
-
-}
\ No newline at end of file
diff --git a/modules/attachments/Models/ReconciliationModelAbstract.php b/modules/attachments/Models/ReconciliationModelAbstract.php
deleted file mode 100755
index f7bfefc1aab72dea271efbfe6f4a852b510c8f33..0000000000000000000000000000000000000000
--- a/modules/attachments/Models/ReconciliationModelAbstract.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- *​ ​Copyright​ ​Maarch​ since ​2008​ under licence ​GPLv3.
- *​ ​See​ LICENCE​.​txt file at the root folder ​for​ more details.
- *​ ​This​ file ​is​ part of ​Maarch​ software.
- *
- */
-
-
-namespace Attachments\Models;
-use Core\Models\ValidatorModel;
-use SrcCore\models\DatabaseModel;
-
-class ReconciliationModelAbstract{
-    public static function selectReconciliation (array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['where', 'data', 'table']);
-
-        $select = [
-            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
-            'table'     => gettype($aArgs['table']) == 'string' ? array($aArgs['table']) : $aArgs['table'],
-            'where'     => $aArgs['where'],
-            'data'      => $aArgs['data'],
-        ];
-
-        if (!empty($aArgs['orderBy'])) {
-            $select['order_by'] = $aArgs['orderBy'];
-        }
-
-        $aReturn = DatabaseModel::select($select);
-
-        return $aReturn;
-    }
-
-    public static function updateReconciliation (array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['where', 'data', 'set']);
-
-        $aReturn = DatabaseModel::update([
-            'set'       => $aArgs['set'],
-            'table'     => gettype($aArgs['table']) == 'array' ? (string) $aArgs['table'] : $aArgs['table'],
-            'where'     => $aArgs['where'],
-            'data'      => $aArgs['data'],
-        ]);
-
-        return $aReturn;
-    }
-}
\ No newline at end of file
diff --git a/modules/attachments/Test/ReconciliationControllerTest.php b/modules/attachments/Test/ReconciliationControllerTest.php
deleted file mode 100755
index bb5e9cf096d4a85450dff2185e6b2d8f119e3323..0000000000000000000000000000000000000000
--- a/modules/attachments/Test/ReconciliationControllerTest.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-/**
- * Copyright Maarch since 2008 under licence GPLv3.
- * See LICENCE.txt file at the root folder for more details.
- * This file is part of Maarch software.
- *
- */
-
-namespace MaarchTest;
-use PHPUnit\Framework\TestCase;
-use MaarchTest\DocserverControllerTest;
-
-class ReconciliationControllerTest extends TestCase
-{
-    public function testPrepareStorage()
-    {
-        $action = new \Attachments\Controllers\ReconciliationController();
-
-        $data = [];
-
-        array_push(
-            $data,
-            array(
-                'column' => 'title',
-                'value' => 'test pj',
-                'type' => 'string',
-            )
-        );
-
-        array_push(
-            $data,
-            array(
-                'column' => 'attachment_type',
-                'value' => 'response_project',
-                'type' => 'string',
-            )
-        );
-
-        array_push(
-            $data,
-            array(
-                'column' => 'status',
-                'value' => 'A_TRA',
-                'type' => 'string',
-            )
-        );
-
-        $aArgs = [
-            'data'         => $data,
-            'resIdMaster'  => 100,
-            'collIdMaster' => 'letterbox_coll',
-        ];
-
-        $response = $action->prepareStorage($aArgs);
-
-        $this->assertArrayHasKey('column', $response['data'][0]);
-    }
-
-    public function testStoreAttachmentResources(){
-        $docserverControllerTest = new DocserverControllerTest();
-        $action = new \Attachments\Controllers\ReconciliationController();
-
-        $docserverControllerTest -> testStoreResourceOnDocserver();
-
-        $path = $_SESSION['config']['tmppath'] . '/test/';
-
-        if (!is_dir($path)) {
-            mkdir($path);
-        }
-
-        $fileSource = 'test_source.txt';
-
-        $fp = fopen($path . $fileSource, 'w');
-        fwrite($fp, 'a unit test');
-        fclose($fp);
-
-        $data = [];
-
-        array_push(
-            $data,
-            array(
-                'column' => 'title',
-                'value' => 'test pj',
-                'type' => 'string',
-            )
-        );
-
-        array_push(
-            $data,
-            array(
-                'column' => 'attachment_type',
-                'value' => 'response_project',
-                'type' => 'string',
-            )
-        );
-
-        array_push(
-            $data,
-            array(
-                'column' => 'status',
-                'value' => 'A_TRA',
-                'type' => 'string',
-            )
-        );
-
-        $aArgs = [
-            'resId'         => 101,
-            'resIdMaster'   => 100,
-            'data'          => $data,
-            'collId'        => 'attachments_coll',
-            'collIdMaster'  => 'letterbox_coll',
-            'table'         => 'res_attachments',
-            'fileFormat'    => 'txt',
-            'filename'      => $fileSource,
-            'path'          => $path,
-            'docserverPath' => $path,
-            'docserverId'   => 'FASTHD_MAN'
-        ];
-
-        $response = $action->storeAttachmentResource($aArgs);
-
-        $this->assertTrue($response);
-    }
-}
\ No newline at end of file
diff --git a/modules/attachments/add_attachments.php b/modules/attachments/add_attachments.php
index 8e3f3c02d1e85ddc0342e7224103e63ee1841c61..6f095b781689974d9cbd65d5389817fe7328871e 100755
--- a/modules/attachments/add_attachments.php
+++ b/modules/attachments/add_attachments.php
@@ -6,12 +6,10 @@
  *
  */
 
-use \Attachments\Models\ReconciliationModel;
-
 $core = new core_tools();
 $core->test_user();
 $db = new Database();
-$reconciliationControler = new \Attachments\Controllers\ReconciliationController();
+$reconciliationControler = new ReconciliationController();
 
 $letterboxTable = $_SESSION['tablename']['reconciliation']['letterbox'];
 
@@ -35,14 +33,10 @@ foreach($formValues as $tmpTab){
 $_SESSION['modules_loaded']['attachments']['reconciliation']['tabFormValues'] = $tabFormValues;    // declare SESSION var, used in remove_letterbox
 
 // Retrieve the informations of the newly scanned document (the one to attach as an attachment)
-$queryChildInfos = ReconciliationModel::selectReconciliation([
-        'table'     => [$letterboxTable],
-        'where'     => ['res_id = (?)'],
-        'data'      => [$childResId]
-]);
+$queryChildInfos = \Resource\models\ResModel::getById(['resId' => $childResId]);
 
 $aArgs['data'] = array();
-foreach ($queryChildInfos[0] as $key => $value){
+foreach ($queryChildInfos as $key => $value){
     if($value != ''
         && $key != 'modification_date'
         && $key != 'is_frozen'
@@ -168,14 +162,12 @@ for($i = 0; $i <= count($aArgs['data']); $i++){
     }
     if($aArgs['data'][$i]['column'] == 'docserver_id'){
         // Retrieve the PATH TEMPLATE
-        $docserverPath = ReconciliationModel::selectReconciliation([
+        $docserverPath = \Docserver\models\DocserverModel::getById([
             'select'    => ['path_template'],
-            'table'     => ['docservers'],
-            'where'     => ['docserver_id = (?)'],
-            'data'      => [$aArgs['data'][$i]['value']]
+            'id'        => $aArgs['data'][$i]['value']
         ]);
 
-        $aArgs['docserverPath'] = $docserverPath[0]['path_template'];
+        $aArgs['docserverPath'] = $docserverPath['path_template'];
         $aArgs['docserverId'] = $aArgs['data'][$i]['value'];
     }
 }
diff --git a/modules/attachments/fill_input.php b/modules/attachments/fill_input.php
index eff2426ae40d77943658f0383047802e0f63b3a7..ed19e7776db70b28d0282e42389c156c26fb2fa1 100755
--- a/modules/attachments/fill_input.php
+++ b/modules/attachments/fill_input.php
@@ -6,8 +6,6 @@
  *
  */
 
-use Attachments\Models\ReconciliationModel;
-
 
 $core = new core_tools();
 $core->test_user();
@@ -54,29 +52,22 @@ for ($i = 0; $i < count($_GET['field']); $i++){
 }
 
 // Get the informations of the current document in case there is more than one response project
-$defaultInfos = ReconciliationModel::selectReconciliation([
-        'select'    =>  ['subject'],
-        'where'     =>  ['res_id = (?)'],
-        'table'     =>  $letterboxTable,
-        'data'      =>  [$_SESSION['doc_id']]
-]);
+$defaultInfos = \Resource\models\ResModel::getById(['resId' => $_SESSION['doc_id'], 'select' => ['subject']]);
 
 //If there is one res_id, we get the recipient information, the chrono number and the title
 if(count($_GET['field']) == 1){
 
     // Check if there is a response project and retrieve the infos about it
-    $queryProjectResponse = ReconciliationModel::selectReconciliation([
+    $queryProjectResponse = \Attachment\Models\AttachmentModel::getOnView([
         'select'    =>  ['identifier, title, dest_contact_id, dest_address_id'],
         'where'     =>  ["res_id_master = (?) AND attachment_type = 'response_project' AND status <> 'DEL'"],
-        'table'     =>  $attachmentTable,
         'data'      =>  [$_GET['field']]
     ]);
 
     // Get the informations from res_view_letterbox, in order to get the contact infos if there is no project response
-    $queryResViewLetterbox = ReconciliationModel::selectReconciliation([
+    $queryResViewLetterbox = \Resource\models\ResModel::getOnView([
         'select'    =>  ['contact_id, address_id'],
-        'where'     =>  ["res_id = (?)"],
-        'table'     =>  'res_view_letterbox',
+        'where'     =>  ['res_id = (?)'],
         'data'      =>  [$_GET['field']]
     ]);
 
@@ -148,14 +139,14 @@ if(count($_GET['field']) == 1){
 	$str = '<select id="listProjectResponse" name="chrono_number_list" onchange="fillHiddenInput(this.options[this.selectedIndex].value)">';
 	$str .= "<option value=''>" . _CHOOSE_CHRONO_NUMBER . "</option>";
     for($i = 0; $i< count($_GET['field']); $i++){
-        $queryAllProjectReponse = ReconciliationModel::selectReconciliation([
+        $queryAllProjectReponse = \Attachment\Models\AttachmentModel::getOnView([
             'select'    =>  ['title,identifier, dest_contact_id, dest_address_id'],
             'where'     =>  ["res_id_master = (?) AND attachment_type = 'response_project'"],
-            'table'     =>  $attachmentTable,
             'data'      =>  [$_GET['field'][$i]]
         ]);
 
-	    // Check if one of the selected document own a response projet, if attach_to_empty parameter is false
+
+        // Check if one of the selected document own a response projet, if attach_to_empty parameter is false
 	    if($attach_to_empty == 'false' && !$queryAllProjectReponse){
             ?>
             <script type="text/javascript">
diff --git a/modules/attachments/remove_letterbox.php b/modules/attachments/remove_letterbox.php
index 3303e84118d3eddae32c571689b683560ad4fcba..bb2d98d4ea3b34ccf6b27717ae6ab7e649f3b670 100755
--- a/modules/attachments/remove_letterbox.php
+++ b/modules/attachments/remove_letterbox.php
@@ -7,11 +7,8 @@
  */
 
 
-use \Attachments\Models\ReconciliationModel;
-
 $core = new core_tools();
 $core->test_user();
-$db = new Database();
 
 // Variable declaration
 $res_id = $_SESSION['doc_id'];
@@ -22,33 +19,32 @@ $delete_response_project = $_SESSION['modules_loaded']['attachments']['reconcili
 $close_incoming = $_SESSION['modules_loaded']['attachments']['reconciliation']['close_incoming'];
 
 // Modification of the incoming document, as deleted
-$delMail = ReconciliationModel::updateReconciliation([
+\Resource\models\ResModel::update([
     'set'       => ['status' => 'DEL'],
     'where'     => ['res_id = (?)'],
-    'data'      => [$res_id],
-    'table'     => $letterboxTable
+    'data'      => [$res_id]
 ]);
 
 $tabFormValues = $_SESSION['modules_loaded']['attachments']['reconciliation']['tabFormValues'];
 
 // Deletion of the response project, with his chrono number and the res_id_master
 if($delete_response_project == 'true'){
-    $delProject = ReconciliationModel::updateReconciliation([
+    \SrcCore\models\DatabaseModel::update([
         'set'       => ['status' => 'DEL'],
+        'table'     => $attachmentTable,
         'where'     => ["res_id_master = (?) AND identifier = (?) AND status NOT IN ('DEL','TMP') AND attachment_type = 'response_project'"],
         'data'      => [$res_id_master[0], $tabFormValues['chrono_number']],
-        'table'     => $attachmentTable
     ]);
+
 }
 
 // End the incoming mail after the reconciliation of the attachment
 if($close_incoming == 'true' && $tabFormValues['close_incoming_mail'] == 'true'){
 	for($i = 0; $i < count($res_id_master); $i++){
-	    $queryClose = ReconciliationModel::updateReconciliation([
+        \Resource\models\ResModel::update([
             'set'       => ['status' => 'END'],
-            'where'     => ['res_id = (?)'],
-            'data'      => [$res_id_master[$i]],
-            'table'     => $letterboxTable
+            'where'     => ['res_id = ?'],
+            'data'      => [$res_id_master[$i]]
         ]);
-	}
+    }
 }
\ No newline at end of file
diff --git a/modules/convert/Controllers/ProcessFulltextController.php b/modules/convert/Controllers/ProcessFulltextController.php
index 2931ad7031cec91b3e8823433098e9d89b91ea54..2c5fc15fde925b1ecfb95331d654ad3dc7835ea4 100644
--- a/modules/convert/Controllers/ProcessFulltextController.php
+++ b/modules/convert/Controllers/ProcessFulltextController.php
@@ -559,7 +559,7 @@ class ProcessFulltextController
     {
         //echo 'launchIndexFullTextWithZendIndex' . PHP_EOL;
         // $IndexFileDirectory is replace by tempIndexFileDirectory
-        $fileContent = \Core\Models\TextFormatModel::normalize(['string' => $fileContent]);
+        $fileContent = TextFormatModel::normalize(['string' => $fileContent]);
         $fileContent = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $fileContent);
 
         // with version 1.12, we need a string, not an XML element
diff --git a/phpunit.xml b/phpunit.xml
index 63a8525bbb8d69c0c05bc6c9590081e0f227603e..aee9cda8f0b1c6ada532af25fdab857a585e9266 100755
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -30,8 +30,6 @@
           <directory suffix=".php">core/Models</directory>
           <directory suffix=".php">modules/visa/Controllers</directory>
           <directory suffix=".php">modules/visa/Models</directory>          
-          <directory suffix=".php">modules/attachments/Controllers</directory>
-          <directory suffix=".php">modules/attachments/Models</directory>          
           <directory suffix=".php">modules/convert/Controllers</directory>
           <directory suffix=".php">modules/convert/Models</directory>
       </whitelist>
diff --git a/src/app/docserver/controllers/DocserverToolsController.php b/src/app/docserver/controllers/DocserverToolsController.php
deleted file mode 100644
index 44baafbb04ad7baeb989482d9473746731978286..0000000000000000000000000000000000000000
--- a/src/app/docserver/controllers/DocserverToolsController.php
+++ /dev/null
@@ -1,449 +0,0 @@
-<?php
-
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-*
-*/
-
-/**
-* @brief Docserver tools Controller
-* @author dev@maarch.org
-* @ingroup core
-*/
-
-namespace Docserver\controllers;
-
-use Psr\Http\Message\RequestInterface;
-use Psr\Http\Message\ResponseInterface;
-use Respect\Validation\Validator;
-use Docserver\models\DocserverModel;
-
-class DocserverToolsController
-{
-
-    /**
-     * Compute the path in the docserver for a batch
-     * @param $docServer docservers path
-     * @return  array Contains 2 items : subdirectory path and error
-     */
-    public function createPathOnDocServer($aArgs)
-    {
-        if (empty($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!is_dir($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        $pathOnDocserver = $aArgs['path'];
-
-        error_reporting(0);
-
-        umask(0022);
-
-        if (!is_dir($pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR)) {
-            mkdir($pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR, 0770);
-            $this->setRights(['path' => $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR]);
-        }
-        if (!is_dir(
-            $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR.date('m')
-            . DIRECTORY_SEPARATOR
-        )
-        ) {
-            mkdir(
-                $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR.date('m')
-                . DIRECTORY_SEPARATOR,
-                0770
-            );
-            $this->setRights(
-                ['path' => $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR.date('m') . DIRECTORY_SEPARATOR]
-            );
-        }
-        if (isset($GLOBALS['wb']) && $GLOBALS['wb'] <> '') {
-            $path = $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR.date('m')
-                  . DIRECTORY_SEPARATOR . 'BATCH' . DIRECTORY_SEPARATOR
-                  . $GLOBALS['wb'] . DIRECTORY_SEPARATOR;
-            if (!is_dir($path)) {
-                mkdir($path, 0770, true);
-                $this->setRights(['path' => $path]);
-            } else {
-                $datas = [
-                    'errors' => 'Folder alreay exists, workbatch already exist:' . $path,
-                ];
-
-                return $datas;
-            }
-        } else {
-            $path = $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR.date('m')
-                  . DIRECTORY_SEPARATOR;
-        }
-
-        $datas =
-            [
-                'createPathOnDocServer' =>
-                    [
-                        'destinationDir' => $path
-                    ]
-            ];
-        
-        return $datas;
-    }
-
-     /**
-     * Set Rights on resources
-     * @param   string $dest path of the resource
-     * @return  nothing
-     */
-    public function setRights($aArgs)
-    {
-        if (empty($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!is_dir($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        if (DIRECTORY_SEPARATOR == '/'
-            && (isset($GLOBALS['apacheUserAndGroup'])
-            && $GLOBALS['apacheUserAndGroup'] <> '')
-        ) {
-            exec('chown '
-                . escapeshellarg($GLOBALS['apacheUserAndGroup']) . ' '
-                . escapeshellarg($aArgs['path']));
-        }
-
-        umask(0022);
-        chmod($aArgs['path'], 0770);
-
-        $datas = [
-            'setRights' => true,
-        ];
-
-        return $datas;
-    }
-
-    /**
-     * copy doc in a docserver.
-     * @param   string $sourceFilePath collection resource
-     * @param   array $infoFileNameInTargetDocserver infos of the doc to store,
-     *          contains : subdirectory path and new filename
-     * @param   string $docserverSourceFingerprint
-     * @return  array of docserver data for res_x else return error
-     */
-    public function copyOnDocserver($aArgs)
-    {
-        if (empty($aArgs['destinationDir'])) {
-            $datas = [
-                'errors' => 'destinationDir ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (empty($aArgs['fileDestinationName'])) {
-            $datas = [
-                'errors' => 'fileDestinationName ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (file_exists(($aArgs['destinationDir'] . $aArgs['fileDestinationName']))) {
-            $datas = [
-                'errors' => '' . $aArgs['destinationDir']
-                    . $aArgs['fileDestinationName'] . ' ' . _FILE_ALREADY_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        if (empty($aArgs['sourceFilePath'])) {
-            $datas = [
-                'errors' => 'sourceFilePath ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!file_exists($aArgs['sourceFilePath'])) {
-            $datas = [
-                'errors' => 'sourceFilePath '  . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        $destinationDir = $aArgs['destinationDir'];
-        $fileDestinationName = $aArgs['fileDestinationName'];
-        $sourceFilePath = str_replace('\\\\', '\\', $aArgs['sourceFilePath']);
-        $docserverSourceFingerprint = $aArgs['docserverSourceFingerprint'];
-
-        error_reporting(0);
-
-        if (!is_dir($destinationDir)) {
-            mkdir($destinationDir, 0770, true);
-            $aArgs = [
-                'path'=> $destinationDir
-            ];
-
-            $this->setRights($aArgs);
-        }
-
-        if (!copy($sourceFilePath, $destinationDir . $fileDestinationName)) {
-            $datas = [
-                'errors' => _DOCSERVER_COPY_ERROR . ' source : ' . $sourceFilePath
-                    . ' dest : ' . $destinationDir . $fileDestinationName
-            ];
-
-            return $datas;
-        }
-        
-        $aArgs = [
-            'path'=> $destinationDir . $fileDestinationName
-        ];
-
-        $this->setRights($aArgs);
-
-        $fingerprintControl = array();
-
-        $aArgs = [
-            'pathInit'          => $sourceFilePath,
-            'pathTarget'        => $destinationDir . $fileDestinationName,
-            'fingerprintMode'   => $docserverSourceFingerprint,
-        ];
-
-        $fingerprintControl = $this->controlFingerprint($aArgs);
-
-        if (!empty($fingerprintControl['errors'])) {
-            $datas = [
-                'errors' => $fingerprintControl['errors'],
-            ];
-
-            return $datas;
-        }
-
-        //for batch like life cycle
-        if (isset($GLOBALS['currentStep'])) {
-            $destinationDir = str_replace(
-                $GLOBALS['docservers'][$GLOBALS['currentStep']]['docserver']
-                ['path_template'],
-                '',
-                $destinationDir
-            );
-        }
-
-        $destinationDir = str_replace(
-            DIRECTORY_SEPARATOR,
-            '#',
-            $destinationDir
-        );
-
-        $datas = [
-            'copyOnDocserver' =>
-                [
-                    'destinationDir'        => $destinationDir,
-                    'fileDestinationName'   => $fileDestinationName,
-                    'fileSize'              => filesize($sourceFilePath),
-                ]
-        ];
-
-        if (isset($GLOBALS['TmpDirectory']) && $GLOBALS['TmpDirectory'] <> '') {
-            $aArgs = [
-                'path'        => $GLOBALS['TmpDirectory'],
-                'contentOnly' => true,
-            ];
-            $this->washTmp($aArgs);
-        }
-
-        return $datas;
-    }
-
-    /**
-     * Compute the fingerprint of a resource
-     * @param   string $path path of the resource
-     * @param   string $fingerprintMode (md5, sha512, ...)
-     * @return  string the fingerprint
-     */
-    public function doFingerprint($aArgs)
-    {
-        if (empty($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!file_exists($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        if ($aArgs['fingerprintMode'] == 'NONE' ||
-            $aArgs['fingerprintMode'] == ''
-        ) {
-            $datas = [
-                'fingerprint' => '0',
-            ];
-
-            return $datas;
-        } else {
-            $fingerprint = hash_file(
-                strtolower($aArgs['fingerprintMode']),
-                $aArgs['path']
-            );
-
-            $datas = [
-                'fingerprint' => $fingerprint,
-            ];
-            
-            return $datas;
-        }
-    }
-
-    /**
-     * Control fingerprint between two resources
-     * @param   string $pathInit path of the resource 1
-     * @param   string $pathTarget path of the resource 2
-     * @param   string $fingerprintMode (md5, sha512, ...)
-     * @return  array ok or ko with error
-     */
-    public function controlFingerprint($aArgs)
-    {
-        if (empty($aArgs['pathInit'])) {
-            $datas = [
-                    'errors' => 'pathInit ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!file_exists($aArgs['pathInit'])) {
-            $datas = [
-                    'errors' => 'pathInit ' . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        if (empty($aArgs['pathTarget'])) {
-            $datas = [
-                    'errors' => 'pathTarget ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!file_exists($aArgs['pathTarget'])) {
-            $datas = [
-                    'errors' => 'pathTarget ' . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        $aArgsSrc = [
-            'path'            => $aArgs['pathInit'],
-            'fingerprintMode' => $aArgs['fingerprintMode'],
-        ];
-
-        $aArgsTarget = [
-            'path'            => $aArgs['pathTarget'],
-            'fingerprintMode' => $aArgs['fingerprintMode'],
-        ];
-
-        if ($this->doFingerprint($aArgsSrc) <> $this->doFingerprint($aArgsTarget)) {
-            $datas = [
-                    'errors' => PB_WITH_FINGERPRINT_OF_DOCUMENT . ' ' . $aArgs['pathInit']
-                        . ' '. _AND . ' ' . $aArgs['pathTarget'],
-            ];
-        } else {
-            $datas = [
-                'controlFingerprint' => true,
-            ];
-        }
-
-        return $datas;
-    }
-
-    /**
-     * del tmp files
-     * @param   $path dir to wash
-     * @param   $contentOnly boolean true if only the content
-     * @return  boolean
-     */
-    public function washTmp($aArgs)
-    {
-        if (empty($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _EMPTY,
-            ];
-
-            return $datas;
-        }
-
-        if (!is_dir($aArgs['path'])) {
-            $datas = [
-                    'errors' => 'path ' . _NOT_EXISTS,
-            ];
-
-            return $datas;
-        }
-
-        if (!is_bool($aArgs['contentOnly'])) {
-            $datas = [
-                    'errors' => 'contentOnly ' . _NOT . ' ' . _VALID,
-            ];
-
-            return $datas;
-        }
-
-        $objects = scandir($aArgs['path']);
-        foreach ($objects as $object) {
-            if ($object != '.' && $object != '..') {
-                if (filetype($aArgs['path'] . DIRECTORY_SEPARATOR . $object) == 'dir') {
-                    $this->washTmp(
-                        ['path' => $aArgs['path'] . DIRECTORY_SEPARATOR . $object]
-                    );
-                } else {
-                    unlink($aArgs['path'] . DIRECTORY_SEPARATOR . $object);
-                }
-            }
-        }
-
-        reset($objects);
-        
-        if (!$aArgs['contentOnly']) {
-            rmdir($aArgs['path']);
-        }
-
-        $datas = [
-            'washTmp' => true,
-        ];
-
-        return $datas;
-    }
-}