From 9745ae896ac502b5626d64ec63617ab970440f32 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Tue, 3 Nov 2020 23:34:24 +0100
Subject: [PATCH] FEAT #15350 TIME 0:15 clean useless code (attachments +
 content_management)

---
 modules/attachments/attachments_tables.php    |  33 --
 .../class/attachments_controler.php           |  38 --
 .../class/attachments_controler_Abstract.php  |  84 ----
 .../attachments/class/class_modules_tools.php |  40 --
 .../class/class_modules_tools_Abstract.php    |  89 ----
 .../attachments/frame_list_attachments.php    | 438 ------------------
 modules/attachments/lang/en.php               | 133 ------
 modules/attachments/lang/fr.php               | 133 ------
 modules/attachments/lang/nl.php               | 116 -----
 .../attachments/load_toolbar_attachments.php  |  77 ---
 modules/attachments/previous_attachments.php  | 141 ------
 modules/attachments/view_attachment.php       | 237 ----------
 modules/attachments/xml/IVS/data_types.xml    |   3 -
 .../xml/IVS/requests_definitions.xml          |  32 --
 .../attachments/xml/IVS/validation_rules.xml  |  31 --
 modules/attachments/xml/menu.xml              |   3 -
 modules/content_management/DOC2PDF_VBS.vbs    | 153 ------
 .../class/class_content_manager_tools.php     |  37 --
 .../class_content_manager_tools_Abstract.php  | 223 ---------
 .../class/class_modules_tools.php             |  55 ---
 .../class/class_modules_tools_Abstract.php    | 106 -----
 modules/content_management/js/functions.js    |   8 -
 modules/content_management/lang/en.php        |  39 --
 modules/content_management/lang/fr.php        |  39 --
 modules/content_management/lang/nl.php        |  33 --
 .../retrieve_attachment_from_cm.php           |  38 --
 .../retrieve_new_attachment_from_cm.php       |  19 -
 .../retrieve_res_from_cm.php                  |  36 --
 .../save_attach_from_cm.php                   | 114 -----
 .../save_attach_res_from_cm.php               | 181 --------
 .../save_attachment_from_cm.php               | 224 ---------
 .../save_editRes_from_cm.php                  | 120 -----
 .../save_new_version_from_cm.php              | 202 --------
 .../save_outmail_from_cm.php                  |  49 --
 .../save_template_from_cm.php                 |   8 -
 .../save_transmission_from_cm.php             |  44 --
 .../content_management/xml/IVS/data_types.xml |  12 -
 .../xml/IVS/requests_definitions.xml          |   6 -
 .../xml/IVS/validation_rules.xml              |  13 -
 .../content_management_features.xml.default   |   8 -
 .../class/class_modules_tools_Abstract.php    |   1 -
 modules/visa/retrieve_attachment_from_cm.php  |  17 +-
 modules/visa/save_attach_res_from_cm.php      | 273 -----------
 43 files changed, 9 insertions(+), 3677 deletions(-)
 delete mode 100755 modules/attachments/attachments_tables.php
 delete mode 100755 modules/attachments/class/attachments_controler.php
 delete mode 100755 modules/attachments/class/attachments_controler_Abstract.php
 delete mode 100755 modules/attachments/class/class_modules_tools.php
 delete mode 100755 modules/attachments/class/class_modules_tools_Abstract.php
 delete mode 100755 modules/attachments/frame_list_attachments.php
 delete mode 100755 modules/attachments/lang/en.php
 delete mode 100755 modules/attachments/lang/fr.php
 delete mode 100755 modules/attachments/lang/nl.php
 delete mode 100755 modules/attachments/load_toolbar_attachments.php
 delete mode 100755 modules/attachments/previous_attachments.php
 delete mode 100755 modules/attachments/view_attachment.php
 delete mode 100755 modules/attachments/xml/IVS/data_types.xml
 delete mode 100755 modules/attachments/xml/IVS/requests_definitions.xml
 delete mode 100755 modules/attachments/xml/IVS/validation_rules.xml
 delete mode 100755 modules/attachments/xml/menu.xml
 delete mode 100755 modules/content_management/DOC2PDF_VBS.vbs
 delete mode 100755 modules/content_management/class/class_content_manager_tools.php
 delete mode 100755 modules/content_management/class/class_content_manager_tools_Abstract.php
 delete mode 100755 modules/content_management/class/class_modules_tools.php
 delete mode 100755 modules/content_management/class/class_modules_tools_Abstract.php
 delete mode 100755 modules/content_management/js/functions.js
 delete mode 100755 modules/content_management/lang/en.php
 delete mode 100755 modules/content_management/lang/fr.php
 delete mode 100755 modules/content_management/lang/nl.php
 delete mode 100755 modules/content_management/retrieve_attachment_from_cm.php
 delete mode 100755 modules/content_management/retrieve_new_attachment_from_cm.php
 delete mode 100755 modules/content_management/retrieve_res_from_cm.php
 delete mode 100755 modules/content_management/save_attach_from_cm.php
 delete mode 100755 modules/content_management/save_attach_res_from_cm.php
 delete mode 100755 modules/content_management/save_attachment_from_cm.php
 delete mode 100755 modules/content_management/save_editRes_from_cm.php
 delete mode 100755 modules/content_management/save_new_version_from_cm.php
 delete mode 100755 modules/content_management/save_outmail_from_cm.php
 delete mode 100755 modules/content_management/save_template_from_cm.php
 delete mode 100755 modules/content_management/save_transmission_from_cm.php
 delete mode 100755 modules/content_management/xml/IVS/data_types.xml
 delete mode 100755 modules/content_management/xml/IVS/requests_definitions.xml
 delete mode 100755 modules/content_management/xml/IVS/validation_rules.xml
 delete mode 100755 modules/content_management/xml/content_management_features.xml.default
 delete mode 100755 modules/visa/save_attach_res_from_cm.php

diff --git a/modules/attachments/attachments_tables.php b/modules/attachments/attachments_tables.php
deleted file mode 100755
index 67742d43fb9..00000000000
--- a/modules/attachments/attachments_tables.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/*
-*    Copyright 2008 - 2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief Attachments tables declarations
-*
-*
-* @file
-* @author  Claire Figueras  <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup attachments
-*/
-if (! defined('RES_ATTACHMENTS_TABLE')) {
-    define('RES_ATTACHMENTS_TABLE', 'res_attachments');
-}
\ No newline at end of file
diff --git a/modules/attachments/class/attachments_controler.php b/modules/attachments/class/attachments_controler.php
deleted file mode 100755
index d826763edad..00000000000
--- a/modules/attachments/class/attachments_controler.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/*
-*   Copyright 2008-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of the attachment Object
-*
-*
-* @file
-* @author Laurent Giovannoni <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup attachments
-*/
-
-
-require_once 'modules/attachments/class/attachments_controler_Abstract.php';
-
-class attachments_controler extends attachments_controler_Abstract
-{
-    // custom
-}
diff --git a/modules/attachments/class/attachments_controler_Abstract.php b/modules/attachments/class/attachments_controler_Abstract.php
deleted file mode 100755
index 9516620d007..00000000000
--- a/modules/attachments/class/attachments_controler_Abstract.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/*
-*   Copyright 2008-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of the attachment Object
-*
-*
-* @file
-* @author Laurent Giovannoni <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup attachments
-*/
-
-
-abstract class attachments_controler_Abstract
-{
-    /**
-     * Remove temporary attachment file on docserver
-     * @param   bigint $resIdAttachment id of the attachment resource
-     * @param   bigint $resIdMaster id of the master document
-     * @param   string $userId user id who created the temporary attachment
-     * @return  boolean if ok, return true.
-     */
-    public function removeTemporaryAttachmentOnDocserver($resIdAttachment, $resIdMaster, $userId)
-    {
-        $db = new Database();
-        $stmt = $db->query(
-            "SELECT docserver_id, path, filename, fingerprint
-                FROM res_attachments
-                WHERE res_id = ? AND res_id_master = ? AND status = 'TMP' AND typist = ? ORDER BY relation desc",
-            array($resIdAttachment, $resIdAttachment, $resIdMaster, $userId)
-        );
-
-        if ($stmt->rowCount() == 0) {
-            $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS;
-            return false;
-        } else {
-            $line           = $stmt->fetchObject();
-            $docserverOld   = $line->docserver_id;
-            $pathOld        = $line->path;
-            $filenameOld    = $line->filename;
-            $fingerprintOld = $line->fingerprint;
-
-            $stmt = $db->query("SELECT path_template FROM " . _DOCSERVERS_TABLE_NAME . " WHERE docserver_id = ?", array($docserverOld));
-            $lineDoc   = $stmt->fetchObject();
-            $docserver = $lineDoc->path_template;
-            $file      = $docserver . $pathOld . $filenameOld;
-            $file      = str_replace("#", DIRECTORY_SEPARATOR, $file);
-
-            require_once 'core/class/docservers_controler.php';
-            require_once 'core/class/docserver_types_controler.php';
-            $docserverControler = new docservers_controler();
-            $docserverTypeControler = new docserver_types_controler();
-
-            require_once 'core/docservers_tools.php';
-
-            $docserver           = $docserverControler->get($docserverOld);
-            $docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
-            $fingerprintOldFile  = Ds_doFingerprint($file, $docserverTypeObject->fingerprint_mode);
-            if ($fingerprintOld == $fingerprintOldFile) {
-                unlink($file);
-            }
-            return true;
-        }
-    }
-}
diff --git a/modules/attachments/class/class_modules_tools.php b/modules/attachments/class/class_modules_tools.php
deleted file mode 100755
index c1312fea3a2..00000000000
--- a/modules/attachments/class/class_modules_tools.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* modules tools Class for attachments
-*
-*  Contains all the functions to load modules tables for attachments
-*
-* @package  maarch
-* @version 3.0
-* @since 10/2005
-* @license GPL v3
-* @author  <dev@maarch.org>
-*
-*/
-
-require_once 'modules/attachments/class/class_modules_tools_Abstract.php';
-
-class attachments extends attachments_Abstract
-{
-    // custom
-}
diff --git a/modules/attachments/class/class_modules_tools_Abstract.php b/modules/attachments/class/class_modules_tools_Abstract.php
deleted file mode 100755
index b4d2eda985f..00000000000
--- a/modules/attachments/class/class_modules_tools_Abstract.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* modules tools Class for attachments
-*
-*  Contains all the functions to load modules tables for attachments
-*
-* @package  maarch
-* @version 3.0
-* @since 10/2005
-* @license GPL v3
-* @author  <dev@maarch.org>
-*
-*/
-
-abstract class attachments_Abstract
-{
-
-    /**
-    * Build Maarch module tables into sessions vars with a xml configuration
-    * file
-    */
-    public function build_modules_tables()
-    {
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . "modules"
-            . DIRECTORY_SEPARATOR . "attachments" . DIRECTORY_SEPARATOR . "xml"
-            . DIRECTORY_SEPARATOR . "config.xml"
-        )
-        ) {
-            $configPath = $_SESSION['config']['corepath'] . 'custom'
-                        . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                        . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR
-                        . "attachments" . DIRECTORY_SEPARATOR . "xml"
-                        . DIRECTORY_SEPARATOR . "config.xml";
-        } else {
-            $configPath = "modules" . DIRECTORY_SEPARATOR . "attachments"
-                        . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR
-                        . "config.xml";
-        }
-        $xmlconfig = simplexml_load_file($configPath);
-        foreach ($xmlconfig->TABLENAME as $tableName) {
-            $_SESSION['tablename']['attach_res_attachments'] = (string) $tableName->attach_res_attachments;
-        }
-		$conf = $xmlconfig->CONFIG;
-		$_SESSION['modules_loaded']['attachments']['convertPdf'] = (string) $conf->convertPdf;
-		$_SESSION['modules_loaded']['attachments']['vbs_convert_path'] = (string) $conf->vbs_convert_path;
-		$_SESSION['modules_loaded']['attachments']['useExeConvert'] = (string) $conf->useExeConvert;
-        $watermark = $conf->watermark;
-        $_SESSION['modules_loaded']['attachments']['watermark']['enabled'] = (string) $watermark->enabled;
-        $_SESSION['modules_loaded']['attachments']['watermark']['text'] = (string) $watermark->text;
-        $_SESSION['modules_loaded']['attachments']['watermark']['position'] = (string) $watermark->position;
-        $_SESSION['modules_loaded']['attachments']['watermark']['font'] = (string) $watermark->font;
-        $_SESSION['modules_loaded']['attachments']['watermark']['text_color'] = (string) $watermark->text_color;
-		 
-        $hist = $xmlconfig->HISTORY;
-        $_SESSION['history']['attachadd'] = (string) $hist->attachadd;
-        $_SESSION['history']['attachup'] = (string) $hist->attachup;
-        $_SESSION['history']['attachdel'] = (string) $hist->attachdel;
-        $_SESSION['history']['attachview'] = (string) $hist->attachview;
-
-        // RECONCILIATION
-        $reconciliation = $xmlconfig->RECONCILIATION->CONFIG;
-        $_SESSION['modules_loaded']['attachments']['reconciliation']['multiple_res_id'] = (string)$reconciliation->multiple_res_id;
-        $_SESSION['modules_loaded']['attachments']['reconciliation']['attach_to_empty'] = (string)$reconciliation->attach_to_empty;
-        $_SESSION['modules_loaded']['attachments']['reconciliation']['delete_response_project'] = (string)$reconciliation->delete_response_project;
-        $_SESSION['modules_loaded']['attachments']['reconciliation']['close_incoming'] = (string)$reconciliation->close_incoming;
-    }
-}
diff --git a/modules/attachments/frame_list_attachments.php b/modules/attachments/frame_list_attachments.php
deleted file mode 100755
index c24b3dd7369..00000000000
--- a/modules/attachments/frame_list_attachments.php
+++ /dev/null
@@ -1,438 +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   frame_list_attachments
-* @author  dev <dev@maarch.org>
-* @ingroup attachments
-*/
-
-$core = new core_tools();
-//here we loading the lang vars
-$core->load_lang();
-$core->test_service('manage_attachments', 'attachments');
-
-require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR
-            ."class".DIRECTORY_SEPARATOR."class_lists.php";
-$list       = new lists();
-
-if (empty($_SESSION['collection_id_choice'])) {
-    $_SESSION['collection_id_choice'] = $_SESSION['user']['collections'][0];
-}
-
-if (isset($_REQUEST['resId']) && $_REQUEST['resId'] <> '') {
-    $resId = $_REQUEST['resId'];
-    $_SESSION['doc_id'] = $resId;
-} else {
-    $resId = $_SESSION['doc_id'];
-}
-
-//test si le paramètre attach_type existe. Possible de mettre plusieurs types separes par une virgule
-if (isset($_REQUEST['attach_type']) && $_REQUEST['attach_type'] <> '') {
-    $table_type = explode(",", $_REQUEST['attach_type']);
-    $whereAttach = " and (";
-    foreach ($table_type as $value) {
-        $whereAttach .= "attachment_type = '".$value."' or ";
-    }
-    $whereAttach = substr($whereAttach, 0, -4) . ") ";
-}
-if (isset($_REQUEST['attach_type_exclude']) && $_REQUEST['attach_type_exclude'] <> '') {
-    $table_type = explode(",", $_REQUEST['attach_type_exclude']);
-    $whereAttach = " and (";
-    foreach ($table_type as $value) {
-        $whereAttach .= "attachment_type <> '".$value."' and ";
-    }
-    $whereAttach = substr($whereAttach, 0, -4) . ") ";
-}
-
-$viewOnly = false;
-if (isset($_REQUEST['view_only'])) {
-    $viewOnly = true;
-}
-require_once 'core/class/class_request.php';
-require_once 'apps/' . $_SESSION['config']['app_id']
-    . '/class/class_list_show.php';
-require_once 'modules/attachments/attachments_tables.php';
-$func = new functions();
-
-$db = new Database();
-
-//Templates
-if (isset($_REQUEST['template_selected'])) {
-    $template_select = $_REQUEST['template_selected'];
-} else {
-    $template_select = 'documents_list_attachments';
-}
-$defaultTemplate = $template_select;
-$selectedTemplate = $list->getTemplate();
-if (empty($selectedTemplate)) {
-    if (!empty($defaultTemplate)) {
-        $list->setTemplate($defaultTemplate);
-        $selectedTemplate = $list->getTemplate();
-    }
-}
-$template_list = array();
-
-array_push($template_list, $template_select);
-
-$select['res_attachments'] = array();
-
-// Important de laisser cet ordre : 'res_id', 'relation', 'status'
-array_push(
-    $select['res_attachments'],
-    'res_id',
-    'relation',
-    'status',
-    'identifier',
-    'attachment_type',
-    'title',
-    'dest_user',
-    'dest_contact_id',
-    'creation_date',
-    'typist',
-    'doc_date',
-    'updated_by',
-    'validation_date',
-    'format',
-    'in_signature_book',
-    'in_send_attach'
-);
-
-$where = " (res_id_master = ? and status <> 'DEL' and status <> 'OBS' and (status <> 'TMP' or (typist = ? and status = 'TMP')))";
-
-$arrayPDO = array($resId, $_SESSION['user']['UserId']);
-//Filtre sur le type
-if (isset($whereAttach) && $whereAttach <> '') {
-    $where .= $whereAttach;
-}
-
-//Order
-$order = $order_field = '';
-$order = $list->getOrder();
-$order_field = $list->getOrderField();
-if (!empty($order_field) && !empty($order)) {
-    if ($_REQUEST['order_field'] == 'identifier') {
-        $orderstr = "order by order_alphanum(identifier)"." ".$order;
-    } elseif ($_REQUEST['order_field'] == 'priority') {
-        $where .= ' and res_attachments.priority = priorities.id';
-        $select['priorities'] = ['order', 'id'];
-        $orderstr = 'order by priorities.order '.$order;
-    } else {
-        $orderstr = "order by ".$order_field." ".$order;
-    }
-} else {
-    $list->setOrder();
-    $list->setOrderField('identifier');
-    $orderstr = "order by attachment_type asc, order_alphanum(identifier) DESC";
-}
-
-$parameters = '';
-//Extra parameters
-if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) {
-    $parameters .= '&size='.$_REQUEST['size'];
-}
-if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) {
-    $parameters .= '&order='.$_REQUEST['order'];
-}
-if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) {
-    $parameters .= '&order_field='.$_REQUEST['order_field'];
-}
-if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) {
-    $parameters .= '&what='.$_REQUEST['what'];
-}
-if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-    $parameters .= '&start='.$_REQUEST['start'];
-} else {
-    $_REQUEST['start'] = 0;
-}
-if (isset($_REQUEST['template_selected']) && !empty($_REQUEST['template_selected'])) {
-    $parameters .= '&template_selected='.$_REQUEST['template_selected'];
-}
-if (!empty($_REQUEST['noModification'])) {
-    $parameters .= '&noModification=true';
-}
-
-
-//test si le paramètre attach_type existe
-if (isset($_REQUEST['attach_type']) && $_REQUEST['attach_type'] <> '') {
-    $parameters .= "&attach_type=".$_REQUEST['attach_type'];
-}
-if (isset($_REQUEST['attach_type_exclude']) && $_REQUEST['attach_type_exclude'] <> '') {
-    $parameters .= "&attach_type_exclude=".$_REQUEST['attach_type_exclude'];
-}
-if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] <> '') {
-    $parameters .= "&fromDetail=".$_REQUEST['fromDetail'];
-}
-
-if (isset($_REQUEST['load'])) {
-    $core->load_lang();
-    $core->load_html();
-    $core->load_header('', true, false); ?>
-
-<body>
-    <?php
-    $core->load_js();
-
-    echo '<script>loadToolbarBadge(\'responses_tab\',\'index.php?display=true&module=attachments&page=load_toolbar_attachments&responses&origin=parent&resId='.$resId.'&collId=letterbox_coll\');</script>';
-    echo '<script>loadToolbarBadge(\'attachments_tab\',\'index.php?display=true&module=attachments&page=load_toolbar_attachments&origin=parent&resId='.$resId.'&collId=letterbox_coll\');</script>';
-
-    //Load list
-    $target = $_SESSION['config']['businessappurl']
-        .'index.php?module=attachments&page=frame_list_attachments'.$parameters;
-    
-    $listContent = $list->loadList($target);
-    echo $listContent; ?>
-    <div id="container" style="width:100%;min-height:0px;height:0px;"></div>
-</body>
-
-</html>
-<?php
-} else {
-        $request = new request;
-        $attachArr = $request->PDOselect(
-        $select,
-        $where,
-        $arrayPDO,
-        $orderstr,
-        $_SESSION['config']['databasetype'],
-        'default',
-        false,
-        '',
-        '',
-        '',
-        false,
-        false,
-        false,
-        $_REQUEST['start']
-    );
-
-        for ($i = 0; $i < count($attachArr); $i ++) {
-            //$modifyValue = false;
-            if ($attachArr[$i][2]['value'] == 'TMP') {
-                $is_tmp=true;
-            } else {
-                $is_tmp=false;
-            }
-            for ($j = 0; $j < count($attachArr[$i]); $j ++) {
-                foreach (array_keys($attachArr[$i][$j]) as $value) {
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'res_id') {
-                        $attachArr[$i][$j]['res_id'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _ID;
-                        $attachArr[$i][$j]['size'] = '18';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = false;
-                        $attachArr[$i][$j]['order'] = 'res_id';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'relation') {
-                        $attachArr[$i][$j]['relation'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _VERSION;
-                        $attachArr[$i][$j]['size'] = '18';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                        $attachArr[$i][$j]['order'] = 'relation';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'identifier') {
-                        $attachArr[$i][$j]['identifier'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _CHRONO_NUMBER;
-                        $attachArr[$i][$j]['size'] = '18';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = false;
-                        $attachArr[$i][$j]['order'] = 'identifier';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'attachment_type') {
-                        $attachArr[$i][$j]['value'] = $_SESSION['attachment_types'][$attachArr[$i][$j]['value']];
-                        $attachArr[$i][$j]['attachment_type'] = $_SESSION['attachment_types'][$attachArr[$i][$j]['value']];
-                        $attachArr[$i][$j]['label'] = _ATTACHMENT_TYPES;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'dest_contact_id') {
-                        if ($attachArr[$i][$j]['value'] <> 0 && $attachArr[$i][$j]['value'] <> '') {
-                            $stmt = $db->query("SELECT firstname, lastname, society FROM contacts_v2 WHERE contact_id = ? ", array($attachArr[$i][$j]['value']));
-                            $res = $stmt->fetchObject();
-                            $attachArr[$i][$j]['value'] = functions::protect_string_db($res->firstname) .' '. functions::protect_string_db($res->lastname) . ' '. functions::protect_string_db($res->society);
-                        }
-                        $attachArr[$i][$j]['dest_contact_id'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _DEST;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'dest_user') {
-                        if ($attachArr[$i][$j]['value'] != '') {
-                            $stmt = $db->query("SELECT firstname, lastname FROM users WHERE user_id = ? ", [$attachArr[$i][$j]['value']]);
-                            $res = $stmt->fetchObject();
-                            $attachArr[$i][$j]['value'] = functions::protect_string_db($res->firstname) .' '. functions::protect_string_db($res->lastname);
-                        }
-                        $attachArr[$i][$j]['dest_user'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _DEST;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'updated_by') {
-                        $stmt = $db->query("SELECT lastname FROM users WHERE user_id = ?", array($attachArr[$i][$j]['value']));
-                        $res = $stmt->fetchObject();
-                        $attachArr[$i][$j]['value'] = functions::protect_string_db($res->lastname);
-                        $attachArr[$i][$j]['updated_by'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _BBY;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                        $attachArr[$i][$j]['order'] = 'updated_by';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'typist') {
-                        $stmt = $db->query("SELECT lastname FROM users WHERE user_id = ?", array($attachArr[$i][$j]['value']));
-                        $res = $stmt->fetchObject();
-                        $attachArr[$i][$j]['typist_id'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['value'] = functions::protect_string_db($res->lastname);
-                        $attachArr[$i][$j]['typist'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _BBY;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                        $attachArr[$i][$j]['order'] = 'typist';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'title') {
-                        $attachArr[$i][$j]['title'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _OBJECT;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                        $attachArr[$i][$j]['order'] = 'title';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'creation_date') {
-                        $attachArr[$i][$j]['value'] = $request->format_date_db(
-                        $attachArr[$i][$j]['value'],
-                        true
-                    );
-                        $attachArr[$i][$j]['creation_date'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _CREATED;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'doc_date') {
-                        $attachArr[$i][$j]['value'] = $request->format_date_db(
-                        $attachArr[$i][$j]['value'],
-                        true
-                    );
-                        $attachArr[$i][$j]['doc_date'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _UPDATED_DATE;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'validation_date') {
-                        $attachArr[$i][$j]['value'] = $request->format_date_db(
-                        $attachArr[$i][$j]['value'],
-                        true
-                    );
-                        $attachArr[$i][$j]['validation_date'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _BACK_DATE;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'status') {
-                        $stmt = $db->query("SELECT id, label_status, img_filename FROM status WHERE id = ?", array($attachArr[$i][$j]['value']));
-                        $res = $stmt->fetchObject();
-                        $img_class = substr($res->img_filename, 0, 2);
-
-                        $attachArr[$i][$j]['value_bis'] = $attachArr[$i][$j]['value'];
-                        if ($is_tmp == true) {
-                            $attachArr[$i][$j]['value'] = '<span style="color:#135F7F;">'.functions::protect_string_db($res->label_status).'</span>';
-                        } elseif ($res->id == 'TRA' || $res->id == 'SIGN') {
-                            $attachArr[$i][$j]['value'] = '<span style="color:green;"><i title="'.$res->label_status.'" style="font-size:20px;" class="'.$img_class.' '.$img_class.'-2x '.functions::protect_string_db($res->img_filename).'"></i><br/>'.$res->label_status.'</span>';
-                        } else {
-                            $attachArr[$i][$j]['value'] = '<i title="'.$res->label_status.'" style="font-size:20px;" class="'.$img_class.' '.$img_class.'-2x '.functions::protect_string_db($res->img_filename).'"></i><br/>'.$res->label_status;
-                        }
-                        $attachArr[$i][$j]['status'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _STATUS;
-                        $attachArr[$i][$j]['size'] = '30';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                        $attachArr[$i][$j]['order'] = 'status';
-                    }
-                    if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j][$value] == 'format') {
-                        $attachArr[$i][$j]['value'] = $request->show_string(
-                        $attachArr[$i][$j]['value']
-                    );
-                        $attachArr[$i][$j]['format'] = $attachArr[$i][$j]['value'];
-                        $attachArr[$i][$j]['label'] = _FORMAT;
-                        $attachArr[$i][$j]['size'] = '5';
-                        $attachArr[$i][$j]['label_align'] = 'left';
-                        $attachArr[$i][$j]['align'] = 'left';
-                        $attachArr[$i][$j]['valign'] = 'bottom';
-                        $attachArr[$i][$j]['show'] = true;
-                        $attachArr[$i][$j]['order'] = true;
-                        $attachArr[$i][$j]['order'] = 'format';
-
-                        if (isset($attachArr[$i][$j][$value]) && $attachArr[$i][$j]['value'] == 'maarch') {
-                            //$modifyValue = true;
-                        }
-                    }
-                }
-            }
-            if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] <> '') {
-                array_push($attachArr[$i], array("fromDetail" => $_REQUEST['fromDetail'], "show" => false));
-            }
-        }
-
-        //List
-    $listKey = 'res_id';                                                                    //Clé de la liste
-    $paramsTab = array();                                                               //Initialiser le tableau de paramètres
-    $paramsTab['bool_sortColumn'] = true;                                               //Affichage Tri
-    $paramsTab['pageTitle'] ='';                                                        //Titre de la page
-    $paramsTab['bool_bigPageTitle'] = false;                                            //Affichage du titre en grand
-    $paramsTab['bool_showIconDocument'] =  true;                                        //Affichage de l'icone du document
-    $paramsTab['listHeight'] = '100%';                                                 //Hauteur de la liste
-    $paramsTab['listCss'] = 'listing largerList spec';                                                       //CSS
-    $paramsTab['urlParameters'] =  'display=true'.$parameters;            //Parametres supplémentaires
-    $paramsTab['defaultTemplate'] = $defaultTemplate;                                   //Default template
-    $paramsTab['start'] = $_REQUEST['start'];
-        if (!empty($_REQUEST['noModification'])) {
-            $paramsTab['noModification'] = true;
-        }
-        if ($useTemplate && count($template_list) >0) {                                    //Templates
-            $paramsTab['templates'] = array();
-            $paramsTab['templates'] = $template_list;
-        }
-        $paramsTab['bool_showTemplateDefaultList'] = true;                                  //Default list (no template)
-        $paramsTab['downloadDocumentLink'] = $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=view_attachment&res_id_master='.$_SESSION['doc_id'];
-        $paramsTab['visualizeDocumentLink'] = $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=view_attachment&res_id_master='.$_SESSION['doc_id'].'&viewpdf=true';
-
-        $content = $list->showList($attachArr, $paramsTab, $listKey);
-        $status = 0;
-
-        echo "{status : " . $status . ", content : '" . addslashes($debug.$content) . "', error : '" . addslashes($error) . "'}";
-    }
diff --git a/modules/attachments/lang/en.php b/modules/attachments/lang/en.php
deleted file mode 100755
index b1c2de394c0..00000000000
--- a/modules/attachments/lang/en.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/*
- *
- *   Copyright 2008-2012 Maarch
- *
- *   This file is part of Maarch Framework.
- *
- *   Maarch Framework is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Maarch Framework is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-if (!defined("_TITLE")) {
-    define("_TITLE", "Title");
-}
-if (!defined("_ATTACHMENTS")) {
-    define("_ATTACHMENTS", "Attachments");
-}
-if (!defined("_ATTACHMENTS_COMMENT")) {
-    define("_ATTACHMENTS_COMMENT", "Attachments management");
-}
-if (!defined("_ATTACH_ANSWER")) {
-    define("_ATTACH_ANSWER", "Attach an attachment");
-}
-if (!defined("_ATTACH")) {
-    define("_ATTACH", "Attach an attachment");
-}
-if (!defined("_NEW_ATTACH_ADDED")) {
-    define("_NEW_ATTACH_ADDED", "New attachment");
-}
-if (!defined("_CREATED")) {
-    define("_CREATED", "Created on");
-}
-if (!defined("_BBY")) {
-    define("_BBY", "By");
-}
-if (!defined("_EXP_DATE")) {
-    define("_EXP_DATE", "Start date");
-}
-if (!defined("_CREATE_PJ")) {
-    define("_CREATE_PJ", "Create an attachment");
-}
-if (!defined("_ATTACH_FILE")) {
-    define("_ATTACH_FILE", "Attach a file");
-}
-if (!defined("_MODEL")) {
-    define("_MODEL", "Model");
-}
-if (!defined("_CHOOSE_MODEL")) {
-    define("_CHOOSE_MODEL", "Select the model");
-}
-if (!defined("_BACK_DATE")) {
-    define("_BACK_DATE", "Return date");
-}
-if (!defined("_EFFECTIVE_DATE")) {
-    define("_EFFECTIVE_DATE", "Effective date");
-}
-if (!defined("_ATTACHMENT_TYPES")) {
-    define("_ATTACHMENT_TYPES", "Attachment type");
-}
-if (!defined("_RESPONSE_PROJECT")) {
-    define("_RESPONSE_PROJECT", "Response project");
-}
-if (!defined("_SIGNED_RESPONSE")) {
-    define("_SIGNED_RESPONSE", "Signed response");
-}
-if (!defined("_ROUTING")) {
-    define("_ROUTING", "Flow slip");
-}
-if (!defined("_OUTGOING_MAIL_SIGNED")) {
-    define("_OUTGOING_MAIL_SIGNED", "Signed start date");
-}
-if (!defined("_CONVERTED_PDF")) {
-    define("_CONVERTED_PDF", "Converted PDF by the solution");
-}
-if (!defined("_PRINT_FOLDER")) {
-    define("_PRINT_FOLDER", "Printed folder");
-}
-if (!defined("_OUTGOING_MAIL")) {
-    define("_OUTGOING_MAIL", "Spontaneous start mail");
-}
-if (!defined("_A_PJ")) {
-    define("_A_PJ", "Attachment");
-}
-if (!defined("_INCOMING_PJ")) {
-    define("_INCOMING_PJ", "Incoming attachment");
-}
-if (!defined("_ENVELOPE")) {
-    define("_ENVELOPE", "Envelope");
-}
-if (!defined("_CHOOSE_ATTACHMENT_TYPE")) {
-    define("_CHOOSE_ATTACHMENT_TYPE", "Choose an attachment type");
-}
-if (!defined("_UPDATED_DATE")) {
-    define("_UPDATED_DATE", "Updated on");
-}
-if (!defined("_FILE_MISSING")) {
-    define("_FILE_MISSING", "The file is missing");
-}
-if (!defined("_FILE_EMPTY")) {
-    define("_FILE_EMPTY", "THe file is empty");
-}
-if (!defined("_SHOW_PREVIOUS_VERSION")) {
-    define("_SHOW_PREVIOUS_VERSION", "See previous versions");
-}
-if (!defined("_ATTACHEMENTS")) {
-    define("_ATTACHEMENTS", "Attachments");
-}
-if (!defined("_WAYBILL")) {
-    define("_WAYBILL", "Mailing slip");
-}
-
-if (!defined("_NO_PREVIEW_AVAILABLE")) {
-    define("_NO_PREVIEW_AVAILABLE", "No preview available");
-}
-
-if (!defined("_FILE_HAS_NO_PDF")) {
-    define("_FILE_HAS_NO_PDF", "PDF version does not exist for this file.");
-}
-
-/************** Error message **************/
-
-if (!defined('_NO_RESPONSE_PROJECT')) {
-    define('_NO_RESPONSE_PROJECT', 'The selected document doesn\'t have any project response. Please enter the informations manually');
-}
diff --git a/modules/attachments/lang/fr.php b/modules/attachments/lang/fr.php
deleted file mode 100755
index de6c80bd967..00000000000
--- a/modules/attachments/lang/fr.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/*
- *
- *   Copyright 2008-2012 Maarch
- *
- *   This file is part of Maarch Framework.
- *
- *   Maarch Framework is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Maarch Framework is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-if (!defined("_TITLE")) {
-    define("_TITLE", "Titre");
-}
-if (!defined("_ATTACHMENTS")) {
-    define("_ATTACHMENTS", "Pièces jointes");
-}
-if (!defined("_ATTACHMENTS_COMMENT")) {
-    define("_ATTACHMENTS_COMMENT", "Gestion des pièces jointes");
-}
-if (!defined("_ATTACH_ANSWER")) {
-    define("_ATTACH_ANSWER", "Attacher une pièce jointe");
-}
-if (!defined("_ATTACH")) {
-    define("_ATTACH", "Attacher PJ");
-}
-if (!defined("_NEW_ATTACH_ADDED")) {
-    define("_NEW_ATTACH_ADDED", "Nouvelle pièce jointe");
-}
-if (!defined("_CREATED")) {
-    define("_CREATED", "Créé le");
-}
-if (!defined("_BBY")) {
-    define("_BBY", "Par");
-}
-if (!defined("_EXP_DATE")) {
-    define("_EXP_DATE", "Date de départ");
-}
-if (!defined("_CREATE_PJ")) {
-    define("_CREATE_PJ", "Créer une pièce jointe");
-}
-if (!defined("_ATTACH_FILE")) {
-    define("_ATTACH_FILE", "Attacher une pièce");
-}
-if (!defined("_MODEL")) {
-    define("_MODEL", "Modèle");
-}
-if (!defined("_CHOOSE_MODEL")) {
-    define("_CHOOSE_MODEL", "Sélectionnez le modèle");
-}
-if (!defined("_BACK_DATE")) {
-    define("_BACK_DATE", "Date de retour");
-}
-if (!defined("_EFFECTIVE_DATE")) {
-    define("_EFFECTIVE_DATE", "Date de retour effective");
-}
-if (!defined("_ATTACHMENT_TYPES")) {
-    define("_ATTACHMENT_TYPES", "Type d'attachement");
-}
-if (!defined("_RESPONSE_PROJECT")) {
-    define("_RESPONSE_PROJECT", "Projet de réponse");
-}
-if (!defined("_SIGNED_RESPONSE")) {
-    define("_SIGNED_RESPONSE", "Réponse signée");
-}
-if (!defined("_ROUTING")) {
-    define("_ROUTING", "Fiche de circulation");
-}
-if (!defined("_OUTGOING_MAIL_SIGNED")) {
-    define("_OUTGOING_MAIL_SIGNED", "Courrier départ signé");
-}
-if (!defined("_CONVERTED_PDF")) {
-    define("_CONVERTED_PDF", "PDF converti par la solution");
-}
-if (!defined("_PRINT_FOLDER")) {
-    define("_PRINT_FOLDER", "Dossier imprimé");
-}
-if (!defined("_OUTGOING_MAIL")) {
-    define("_OUTGOING_MAIL", "Courrier départ spontané");
-}
-if (!defined("_A_PJ")) {
-    define("_A_PJ", "Pièce jointe");
-}
-if (!defined("_INCOMING_PJ")) {
-    define("_INCOMING_PJ", "Pièce jointe capturée");
-}
-if (!defined("_ENVELOPE")) {
-    define("_ENVELOPE", "Enveloppe");
-}
-if (!defined("_CHOOSE_ATTACHMENT_TYPE")) {
-    define("_CHOOSE_ATTACHMENT_TYPE", "Choisissez un type d'attachement");
-}
-if (!defined("_UPDATED_DATE")) {
-    define("_UPDATED_DATE", "Mis à jour le");
-}
-if (!defined("_FILE_MISSING")) {
-    define("_FILE_MISSING", "Le fichier est manquant");
-}
-if (!defined("_FILE_EMPTY")) {
-    define("_FILE_EMPTY", "Le fichier est vide");
-}
-if (!defined("_SHOW_PREVIOUS_VERSION")) {
-    define("_SHOW_PREVIOUS_VERSION", "Voir les versions précédentes");
-}
-if (!defined("_ATTACHEMENTS")) {
-    define("_ATTACHEMENTS", "Attachements");
-}
-if (!defined("_WAYBILL")) {
-    define("_WAYBILL", "Bordereau d'envoi");
-}
-
-if (!defined("_NO_PREVIEW_AVAILABLE")) {
-    define("_NO_PREVIEW_AVAILABLE", "Aucun aperçu disponible");
-}
-
-if (!defined("_FILE_HAS_NO_PDF")) {
-    define("_FILE_HAS_NO_PDF", "La version PDF du fichier n'existe pas.");
-}
-
-/************** Message d'erreur **************/
-
-if (!defined('_NO_RESPONSE_PROJECT')) {
-    define('_NO_RESPONSE_PROJECT', 'Le courrier selectionné ne contient aucun projet de réponse. Veuillez entrer les informations manuellement');
-}
diff --git a/modules/attachments/lang/nl.php b/modules/attachments/lang/nl.php
deleted file mode 100755
index 1e3040e14ad..00000000000
--- a/modules/attachments/lang/nl.php
+++ /dev/null
@@ -1,116 +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.
- */
-
-if (!defined('_TITLE')) {
-    define('_TITLE', 'Titel');
-}
-if (!defined('_ATTACHMENTS')) {
-    define('_ATTACHMENTS', 'Bijlagen');
-}
-if (!defined('_ATTACHMENTS_COMMENT')) {
-    define('_ATTACHMENTS_COMMENT', 'Beheer van de bijlagen');
-}
-if (!defined('_ATTACH_ANSWER')) {
-    define('_ATTACH_ANSWER', 'Een bijlage bijvoegen');
-}
-if (!defined('_ATTACH')) {
-    define('_ATTACH', 'Bijlage bijvoegen');
-}
-if (!defined('_NEW_ATTACH_ADDED')) {
-    define('_NEW_ATTACH_ADDED', 'Nieuwe bijlage');
-}
-
-if (!defined('_CREATED')) {
-    define('_CREATED', 'Aangemaakt op');
-}
-if (!defined('_BBY')) {
-    define('_BBY', 'Door');
-}
-if (!defined('_EXP_DATE')) {
-    define('_EXP_DATE', 'Vertrekdatum');
-}
-if (!defined('_CREATE_PJ')) {
-    define('_CREATE_PJ', 'Een bijlage aanmaken');
-}
-if (!defined('_ATTACH_FILE')) {
-    define('_ATTACH_FILE', 'Een stuk bijvoegen');
-}
-if (!defined('_MODEL')) {
-    define('_MODEL', 'Model');
-}
-if (!defined('_CHOOSE_MODEL')) {
-    define('_CHOOSE_MODEL', 'Selecteer het model');
-}
-if (!defined('_BACK_DATE')) {
-    define('_BACK_DATE', 'Datum van terugkeer');
-}
-if (!defined('_EFFECTIVE_DATE')) {
-    define('_EFFECTIVE_DATE', 'Effectieve datum van terugkeer');
-}
-if (!defined('_ATTACHMENT_TYPES')) {
-    define('_ATTACHMENT_TYPES', 'Type bijlage');
-}
-if (!defined('_RESPONSE_PROJECT')) {
-    define('_RESPONSE_PROJECT', 'Antwoordontwerp');
-}
-if (!defined('_SIGNED_RESPONSE')) {
-    define('_SIGNED_RESPONSE', 'Ondertekend antwoord');
-}
-if (!defined('_ROUTING')) {
-    define('_ROUTING', 'Circulatiefiche');
-}
-if (!defined('_OUTGOING_MAIL_SIGNED')) {
-    define('_OUTGOING_MAIL_SIGNED', 'Brief vertrek ondertekend');
-}
-if (!defined('_CONVERTED_PDF')) {
-    define('_CONVERTED_PDF', 'PDF geconverteerd door de oplossing');
-}
-if (!defined('_PRINT_FOLDER')) {
-    define('_PRINT_FOLDER', 'Afgedrukte map');
-}
-if (!defined('_OUTGOING_MAIL')) {
-    define('_OUTGOING_MAIL', 'Brief spontaan vertrek');
-}
-if (!defined('_A_PJ')) {
-    define('_A_PJ', 'Bijlage');
-}
-if (!defined('_INCOMING_PJ')) {
-    define('_INCOMING_PJ', 'Bijlage vastgelegd');
-}
-if (!defined('_ENVELOPE')) {
-    define('_ENVELOPE', 'Envelop');
-}
-if (!defined('_CHOOSE_ATTACHMENT_TYPE')) {
-    define('_CHOOSE_ATTACHMENT_TYPE', 'Kies een type bijlage');
-}
-if (!defined('_UPDATED_DATE')) {
-    define('_UPDATED_DATE', 'Bijgewerkt op');
-}
-if (!defined('_FILE_MISSING')) {
-    define('_FILE_MISSING', 'Het bestand ontbreekt');
-}
-if (!defined('_FILE_EMPTY')) {
-    define('_FILE_EMPTY', 'Het bestand is leeg');
-}
-if (!defined('_SHOW_PREVIOUS_VERSION')) {
-    define('_SHOW_PREVIOUS_VERSION', 'De vorige versies bekijken');
-}
-if (!defined('_ATTACHEMENTS')) {
-    define('_ATTACHEMENTS', 'Bijlagen');
-}
-if (!defined('_WAYBILL')) {
-    define('_WAYBILL', 'Verzendingsborderel');
-}
-if (!defined('_NO_PREVIEW_AVAILABLE')) {
-    define('_NO_PREVIEW_AVAILABLE', 'Geen overzicht beschikbaar');
-}
-if (!defined('_FILE_HAS_NO_PDF')) {
-    define('_FILE_HAS_NO_PDF', 'Er bestaat geen PDF-versie van het bestand.');
-}
-if (!defined('_NO_RESPONSE_PROJECT')) {
-    define('_NO_RESPONSE_PROJECT', 'De geselecteerde brief bevat geen enkel antwoordontwerp. Geef de informatie manueel in');
-}
\ No newline at end of file
diff --git a/modules/attachments/load_toolbar_attachments.php b/modules/attachments/load_toolbar_attachments.php
deleted file mode 100755
index bf212bce037..00000000000
--- a/modules/attachments/load_toolbar_attachments.php
+++ /dev/null
@@ -1,77 +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   load_toolbar_attachments
-* @author  dev <dev@maarch.org>
-* @ingroup attachments
-*/
-
-$targetTab = $_REQUEST['targetTab'];
-$res_id    = $_REQUEST['resId'];
-$coll_id   = $_REQUEST['collId'];
-
-require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_request.php';
-
-$db = new Database;
-$core = new core_tools();
-
-if ($_SESSION['req'] == 'details') {
-    if (isset($_REQUEST['responses'])) {
-        $stmt = $db->query("SELECT res_id, creation_date, title, format FROM "
-            . $_SESSION['tablename']['attach_res_attachments']
-            . " WHERE res_id_master = ? and coll_id = ? and status <> 'DEL' and (attachment_type IN ('response_project', 'outgoing_mail_signed', 'outgoing_mail', 'signed_response', 'aihp')) and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
-    } else {
-        $stmt = $db->query("SELECT res_id, creation_date, title, format FROM "
-            . $_SESSION['tablename']['attach_res_attachments']
-            . " WHERE res_id_master = ? and coll_id = ? and status <> 'DEL' and attachment_type NOT IN ('response_project','signed_response','outgoing_mail_signed','outgoing_mail','aihp'". $exclude . ") and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
-    }
-} else {
-    $stmt = $db->query("SELECT res_id FROM "
-        . $_SESSION['tablename']['attach_res_attachments']
-        . " WHERE status <> 'DEL' and res_id_master = ? and coll_id = ? and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
-}
-$nbAttach = $stmt->rowCount();
-
-if ($nbAttach == 0) {
-    $class = 'nbResZero';
-    $style2 = 'display:none;';
-    $style = '0.5';
-    $styleDetail = '#9AA7AB';
-} else {
-    $class = 'nbRes';
-    $style = '';
-    $style2 = 'display:inherit;';
-    $styleDetail = '#666';
-}
-if ($_SESSION['save_list']['fromDetail'] == 'true') {
-    if ($nbAttach == 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')) {
-        $nav = 'attachments_tab';
-        if (isset($_REQUEST['responses'])) {
-            $nav = 'responses_tab';
-        }
-        $style2 = 'visibility:hidden;';
-    }
-
-    if ($_REQUEST['origin'] == 'parent') {
-        $js .= 'window.parent.top.$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';window.parent.top.$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbAttach.'</span>\'';
-    } elseif ($_REQUEST['origin'] == 'document') {
-        $js .= '$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbAttach.'</span>\'';
-    } else {
-        $js .= 'parent.$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbAttach.'</span>\'';
-    }
-} else {
-    if ($_REQUEST['origin'] == 'parent') {
-        $js .= 'window.parent.top.$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';window.parent.top.$(\''.$targetTab.'_badge\').innerHTML = \'&nbsp;<sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbAttach.'</span></sup>\'';
-    } elseif ($_REQUEST['origin'] == 'document') {
-        $js .= '$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';$(\''.$targetTab.'_badge\').innerHTML = \'&nbsp;<sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbAttach.'</span></sup>\'';
-    } else {
-        $js .= 'parent.$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \'&nbsp;<sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbAttach.'</span></sup>\'';
-    }
-}
-      
-echo "{status : 0, nav : '".$nav."',content : '', error : '', exec_js : '".addslashes($js)."'}";
-exit();
diff --git a/modules/attachments/previous_attachments.php b/modules/attachments/previous_attachments.php
deleted file mode 100755
index 6c08a2c9546..00000000000
--- a/modules/attachments/previous_attachments.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-require_once('core/class/class_core_tools.php');
-require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR
-            ."class".DIRECTORY_SEPARATOR."class_users.php";
-$Core_Tools = new core_tools;
-$Core_Tools->load_lang();
-
-$users = new class_users();
-
-$return = '';
-
-if (isset($_REQUEST['res_id'])) {
-
-    $status = 0;
-    $return .= '<td colspan="6" style="background-color: #FFF;">';
-        $return .= '<div align="center">';
-            $return .= '<table width="100%" style="background-color: rgba(100, 200, 213, 0.2);">';
-                $return .= '<tr style="font-weight: bold;">';
-                    $return .= '<th style="font-weight: bold; color: black;">';
-                        $return .= _STATUS;
-                    $return .= '</th>';
-                    $return .= '<th style="font-weight: bold; color: black;">';
-                        $return .= _VERSION;
-                    $return .= '</th>';
-                    $return .= '<th style="font-weight: bold; color: black;">';
-                        $return .= _CREATION_DATE;
-                    $return .= '</th>';
-                    $return .= '<th style="font-weight: bold; color: black;">';
-                        $return .= _SUBJECT;
-                    $return .= '</th>';
-                    $return .= '<th style="font-weight: bold; color: black;">';
-                        $return .= _AUTHOR;
-                    $return .= '</th>';
-                    $return .= '<th style="font-weight: bold; color: black;">';
-                        $return .= _CONSULT;
-                    $return .= '</th>';
-                $return .= '</tr>';
-
-                $db = new Database();
-
-                $query = "SELECT origin_id FROM res_attachments WHERE res_id = ? ";
-                $stmt = $db->query($query, array($_REQUEST['res_id']));
-				$attach = $stmt->fetchObject();
-
-                $query = "SELECT status, relation, creation_date, title, typist, res_id FROM res_attachments WHERE (res_id = ? or origin_id = ?) AND status = 'OBS' ORDER BY relation desc";
-                $stmt = $db->query($query, array($attach->origin_id));
-
-                while ($return_db = $stmt->fetchObject()) {
-                    $return .= '<tr style="border: 1px solid;" style="background-color: #FFF;">';
-                        $return .= '<td>';
-                            $return .= '&nbsp;&nbsp;';
-                            $query = "SELECT label_status FROM status WHERE id = ?";
-                            $stmt2 = $db->query($query,array($return_db->status));
-                            while ($status_db = $stmt2->fetchObject()) {
-                                $return .= functions::xssafe($status_db->label_status);
-                            }
-                        $return .= '</td>';
-                        $return .= '<td>';
-                            $return .= '&nbsp;&nbsp;';
-                            $return .= $return_db->relation;
-                        $return .= '</td>';
-                        $return .= '<td>';
-                            $return .= '&nbsp;&nbsp;';
-                            sscanf(substr($return_db->creation_date, 0, 10), "%4s-%2s-%2s", $date_Y, $date_m, $date_d);
-                            switch ($date_m)
-                            {
-                                case '01': $date_m_txt = _JANUARY; break;
-                                case '02': $date_m_txt = _FEBRUARY; break;
-                                case '03': $date_m_txt = _MARCH; break;
-                                case '04': $date_m_txt = _APRIL; break;
-                                case '05': $date_m_txt = _MAY; break;
-                                case '06': $date_m_txt = _JUNE; break;
-                                case '07': $date_m_txt = _JULY; break;
-                                case '08': $date_m_txt = _AUGUST; break;
-                                case '09': $date_m_txt = _SEPTEMBER; break;
-                                case '10': $date_m_txt = _OCTOBER; break;
-                                case '11': $date_m_txt = _NOVEMBER; break;
-                                case '12': $date_m_txt = _DECEMBER; break;
-                                default: $date_m_txt = $date_m;
-                            }
-                            $return .= $date_d.' '.$date_m_txt.' '.$date_Y;
-                        $return .= '</td>';
-                        $return .= '<td>';
-                            $return .= '&nbsp;&nbsp;';
-                            $return .= functions::xssafe($return_db->title);
-                        $return .= '</td>';
-                        $return .= '<td>';
-                            $return .= '&nbsp;&nbsp;';
-                            $current_user = $users->get_user($return_db->typist);
-                            $return .= functions::xssafe($current_user['firstname']) . ' ' . functions::xssafe($current_user['lastname']);
-                        $return .= '</td>';
-                        $return .= '<td>';
-                            $return .= '&nbsp;&nbsp;';
-                            $return .= '<a ';
-                            $return .= 'href="';
-                              $return .= 'index.php?display=true&module=attachments&page=view_attachment&id='.$return_db->res_id
-                              				.'&res_id_master='.$attach->res_id_master;
-                            $return .= '" ';
-                            $return .= 'target="_blank" ';
-                            $return .= '>';
-                                $return .= '<i class="fa fa-download fa-2x"></i>';
-                            $return .= '</a>';
-                        $return .= '</td>';
-                    $return .= '</tr>';
-                }
-
-            $return .= '</table>';
-            $return .= '<br />';
-        $return .= '</div>';
-    $return .= '</td>';
-} else {
-    $status = 1;
-    $return .= '<td colspan="6" style="background-color: red;">';
-        $return .= '<p style="padding: 10px; color: black;">';
-            $return .= 'Error loading attachments';
-        $return .= '</p>';
-    $return .= '</td>';
-}
-
-echo "{status : " . $status . ", toShow : '" . addslashes($return) . "'}";
-exit ();
diff --git a/modules/attachments/view_attachment.php b/modules/attachments/view_attachment.php
deleted file mode 100755
index 3455ff76c81..00000000000
--- a/modules/attachments/view_attachment.php
+++ /dev/null
@@ -1,237 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* File : view_attachement.php
-*
-* View a document
-*
-* @license GPL
-* @author  Claire Figueras  <dev@maarch.org>
-*/
-require_once "core/class/class_security.php";
-require_once 'modules/attachments/attachments_tables.php';
-require_once 'core/core_tables.php';
-require_once 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-    . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR
-    . 'class_indexing_searching_app.php';
-require_once "core/class/class_history.php";
-
-$core = new core_tools();
-$core->test_user();
-$core->load_lang();
-$db = new Database();
-$function = new functions();
-$sec = new security();
-$_SESSION['error'] = "";
-if (isset($_GET['id'])) {
-    $sId = $_GET['id'];
-} else {
-    $sId = "";
-}
-$sId = $function->wash($_GET['id'], "num", _THE_DOC);
-if (! empty($_SESSION['error'])) {
-    header("location: " . $_SESSION['config']['businessappurl'] . "index.php");
-    exit();
-} else {
-    $stmt = $db->query("SELECT res_id_master FROM res_attachments WHERE res_id = ? AND res_id_master = ?", [$sId, $_REQUEST['res_id_master']]);
-    $res = $stmt->fetchObject();
-    $collId = "res_attachments";
-    $resIdMaster = $res->res_id_master;
-
-    if ($stmt->rowCount() == 0) {
-        $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS;
-        header(
-            "location: " . $_SESSION['config']['businessappurl']
-            . "index.php"
-        );
-        exit();
-    }
-
-    $where2 = "";
-    foreach (array_keys($_SESSION['user']['security']) as $key) {
-        if ($collId == $key) {
-            $where2 = " and ( " . $_SESSION['user']['security'][$key]['DOC']['where']
-                    . " ) ";
-        }
-    }
-    //fonction qui va permettre de récupérer les infos auxquels l'utilisateur à la possibilité de voir
-    $security = new security();
-    $right = $security->test_right_doc(
-        $_SESSION['collection_id_choice'],
-        $resIdMaster
-    );
-    $table = 'res_attachments';
-    $stmt = $db->query(
-        "SELECT res_id FROM " . $table . " WHERE res_id = ? ".$where2,
-        array($resIdMaster)
-    );
-
-    if ($stmt->rowCount() == 0 and !$right) {
-        $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS;
-        header(
-            "location: " . $_SESSION['config']['businessappurl'] . "index.php"
-        );
-        exit();
-    } else {
-        $stmt = $db->query("SELECT docserver_id, path, filename, format, title FROM res_attachments WHERE res_id = ? AND res_id_master = ?", [$sId, $_REQUEST['res_id_master']]); 
-        if ($stmt->rowCount() == 0) {
-            $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS;
-            header(
-                "location: " . $_SESSION['config']['businessappurl']
-                . "index.php"
-            );
-            exit();
-        } else {
-            $line = $stmt->fetchObject();
-
-            if ((!empty($_GET['editingMode']) || !empty($_GET['viewpdf'])) && strpos($line->format, 'xl') === false && strpos($line->format, 'ppt') === false) {
-                header(
-                    "location: ../../rest/attachments/".$_GET['id']."/content"
-                );
-                $stmtPdf = $db->query(
-                    "SELECT docserver_id, path, filename, format, title
-                     FROM res_attachments
-                     WHERE filename=? AND (status = 'TRA' or status = 'A_TRA')",
-                    array(substr($line->filename, 0, strrpos($line->filename, ".")).'.pdf')
-                );
-                $linePdf = $stmtPdf->fetchObject();
-                if (!empty($linePdf)) {
-                    $line = $linePdf;
-                }
-            }
-
-            $docserver = $line->docserver_id;
-            $path      = $line->path;
-            $filename  = $line->filename;
-            $nameShow  = $function->normalize($line->title);
-            $nameShow  = preg_replace('/([^.a-z0-9]+)/i', '_', $nameShow);
-            $nameShow  .= '_'. date("j_m_Y__G_i");
-            $format    = $line->format;
-            $stmt = $db->query(
-                "select path_template from " . _DOCSERVERS_TABLE_NAME
-                . " where docserver_id = ?",
-                array($docserver)
-            );
-            //$db->show();
-            $lineDoc   = $stmt->fetchObject();
-            $docserver = $lineDoc->path_template;
-            $file      = $docserver . $path . $filename;
-            $file      = str_replace("#", DIRECTORY_SEPARATOR, $file);
-            if (!file_exists($file)) {
-                echo _FILE_NOT_EXISTS_ON_THE_SERVER;
-                exit;
-            }
-
-            if (!copy($file, $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR  . $filename)) {
-                echo 'error';
-                exit();
-            } else {
-                $file = $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR  . $filename;
-            }
-
-            if (strtoupper($format) == "MAARCH") {
-                if (file_exists($file)) {
-                    $myfile = fopen($file, "r");
-
-                    $data = fread($myfile, filesize($file));
-                    fclose($myfile);
-                    $content = stripslashes($data);
-                    $core->load_html();
-                    $core->load_header();
-                    ?>
-                    <body id="validation_page" onload="javascript:moveTo(0,0);resizeTo(screen.width, screen.height);">
-                    <div id="model_content" style="width:100%;"  >
-
-                    <?php functions::xecho($content);?>
-
-                    </div>
-                    </body>
-                    </html> <?php
-                } else {
-                    $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS . "...";
-                    ?><script type="text/javascript">window.opener.top.location.href='index.php';self.close();</script><?php
-                }
-            } elseif (!empty($_GET['editingMode']) && !in_array($format, ['pdf', 'jpg', 'jpeg', 'png'])) {
-                ?>
-                <div style="border: dashed;font-weight: bold;opacity: 0.5;font-size: 30px;height: 96%;text-align: center">
-                    <div style="padding-top: 25%;"><?php echo _NO_PREVIEW_AVAILABLE;?><br><sub><?php echo _FILE_HAS_NO_PDF;?></sub></div>
-                </div>
-                <?php
-            } else {
-                require_once 'core/docservers_tools.php';
-                $arrayIsAllowed = array();
-                $arrayIsAllowed = Ds_isFileTypeAllowed($file);
-                if ($arrayIsAllowed['status']) {
-                    if ($_SESSION['history']['attachview'] == "true") {
-                        $hist = new history();
-                        $hist->add(
-                            'res_attachments',
-                            $sId,
-                            "VIEW",
-                            'attachview',
-                            _VIEW_DOC_NUM . "" . $sId,
-                            $_SESSION['config']['databasetype'],
-                            'apps'
-                        );
-                    }
-                    //WATERMARK
-                    if (strtoupper($format) == 'PDF') {
-                        if ($_REQUEST['watermark_outgoing'] == 'true') {
-                            $_SESSION['modules_loaded']['attachments']['watermark']['enabled'] = 'true';
-                        }
-                        
-                        if ($_SESSION['modules_loaded']['attachments']['watermark']['enabled'] == 'true') {
-                            $table = 'res_attachments';
-                            $watermarkForAttachments = true;
-                            try {
-                                include 'apps/maarch_entreprise/indexing_searching/watermark.php';
-                            } catch (Exception $e) {
-                                $logger = Logger::getLogger('loggerTechnique');
-                                $logger->warn(
-                                "[{$_SESSION['user']['UserId']}][View_attachment] Watermark has failed"
-                                );
-                            }
-                        }
-                    }
-                    header("Pragma: public");
-                    header("Expires: 0");
-                    header(
-                        "Cache-Control: must-revalidate, post-check=0, pre-check=0"
-                    );
-                    header("Cache-Control: public");
-                    header("Content-Description: File Transfer");
-                    header("Content-Type: " . $arrayIsAllowed['mime_type']);
-                    header(
-                        "Content-Disposition: inline; filename="
-                        . basename($nameShow . '.' . $format) . ";"
-                    );
-                    header("Content-Transfer-Encoding: binary");
-                    readfile($file);
-                    exit();
-                } else {
-                    echo _FORMAT . ' ' . _UNKNOWN;
-                    exit();
-                }
-            }
-        }
-    }
-}
diff --git a/modules/attachments/xml/IVS/data_types.xml b/modules/attachments/xml/IVS/data_types.xml
deleted file mode 100755
index 710b3b56651..00000000000
--- a/modules/attachments/xml/IVS/data_types.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataTypes>
-
-</dataTypes>
\ No newline at end of file
diff --git a/modules/attachments/xml/IVS/requests_definitions.xml b/modules/attachments/xml/IVS/requests_definitions.xml
deleted file mode 100755
index c6d8d9692aa..00000000000
--- a/modules/attachments/xml/IVS/requests_definitions.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<requestDefinitions>
-
-    <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="frame_list_attachments" >
-	  <parameter name="module" type="identifier" />
-	  <parameter name="display" value="true"/>
-      <parameter name="page" value="frame_list_attachments"/>
-    </requestDefinition>
-
-    <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="frame_list_attachments" >
-	  <parameter name="module" type="identifier" />
-	  <parameter name="display" value="true"/>
-      <parameter name="page" value="frame_list_attachments"/>
-    </requestDefinition>
-
-    <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="previous_attachments" >
-	  <parameter name="module" type="identifier" />
-	  <parameter name="display" value="true"/>
-      <parameter name="page" value="previous_attachments"/>
-    </requestDefinition>
-    <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="view_attachment" >
-	  <parameter name="module" type="identifier" />
-	  <parameter name="display" value="true"/>
-      <parameter name="page" value="view_attachment"/>
-    </requestDefinition>
-
-    <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="view_attachment" >
-	  <parameter name="module" type="identifier" />
-	  <parameter name="display" value="true"/>
-      <parameter name="page" value="view_attachment"/>
-    </requestDefinition>
-
-</requestDefinitions>
diff --git a/modules/attachments/xml/IVS/validation_rules.xml b/modules/attachments/xml/IVS/validation_rules.xml
deleted file mode 100755
index 70d04e5895d..00000000000
--- a/modules/attachments/xml/IVS/validation_rules.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<inputValidation xmlns:xi="http://www.w3.org/2001/XInclude">
-<validationRules>
-	<validationRule name="frame_list_attachments" extends="standardForm" mode="error">
-		<parameter name="module" type="identifier" />
-		<parameter name="fromDetail" type="identifier" />
-		<parameter name="attach_type" type="string" />
-		<parameter name="template_selected" type="string" />
-		<parameter name="url" type="url" />
-		<parameter name="attach_type_exclude" type="string" />
-		<parameter name="load" type="string" />
-		<parameter name="resId" type="identifier" />
-		<parameter name="noModification" type="boolean" />
-		<parameter name="view_only" type="string" />
-	</validationRule>
-
-	<validationRule name="previous_attachments" extends="standardForm" mode="error">
-		<parameter name="module" type="identifier" />
-		<parameter name="res_id" type="integer" />
-	</validationRule>
-
-	<validationRule name="view_attachment" extends="standardForm" mode="error">
-		<parameter name="module" type="identifier" />
-		<parameter name="res_id_master" type="integer" />
-		<parameter name="id" type="identifier" />
-		<parameter name="editingMode" type="string" />
-		<parameter name="watermark_outgoing" type="string" />
-	</validationRule>
-
-</validationRules>
-</inputValidation>
diff --git a/modules/attachments/xml/menu.xml b/modules/attachments/xml/menu.xml
deleted file mode 100755
index fa75d84946a..00000000000
--- a/modules/attachments/xml/menu.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-</root>
\ No newline at end of file
diff --git a/modules/content_management/DOC2PDF_VBS.vbs b/modules/content_management/DOC2PDF_VBS.vbs
deleted file mode 100755
index 122e4a5b8c2..00000000000
--- a/modules/content_management/DOC2PDF_VBS.vbs
+++ /dev/null
@@ -1,153 +0,0 @@
-'************************************************
-'
-' DOC2PDF.VBS Microsoft Scripting Host Script (Requires Version 5.6 or newer)
-' --------------------------------------------------------------------------------
-'
-' Author: Michael Suodenjoki
-' Created: 2007.07.07
-'
-' This script can create a PDF file from a Word document provided you're using
-' Word 2007 and have the 'Office Add-in: Save As PDF' installed.
-'
-
-' Constants
-Const WdDoNotSaveChanges = 0
-
-' see WdSaveFormat enumeration constants: 
-' http://msdn2.microsoft.com/en-us/library/bb238158.aspx
-Const wdFormatPDF = 17  ' PDF format. 
-Const wdFormatXPS = 18  ' XPS format. 
-
-
-' Global variables
-Dim arguments
-Set arguments = WScript.Arguments
-
-' ***********************************************
-' ECHOLOGO
-'
-' Outputs the logo information.
-'
-Function EchoLogo()
-  If Not (arguments.Named.Exists("nologo") Or arguments.Named.Exists("n")) Then
-    WScript.Echo "doc2pdf Version 2.0, Michael Suodenjoki 2007"
-    WScript.Echo "=================================================="
-    WScript.Echo ""
-  End If
-End Function
-
-' ***********************************************
-' ECHOUSAGE
-'
-' Outputs the usage information.
-'
-Function EchoUsage()
-  If arguments.Count=0 Or arguments.Named.Exists("help") Or _
-    arguments.Named.Exists("h") _
-  Then
-    WScript.Echo "Generates a PDF from a Word document file using Word 2007."
-    WScript.Echo ""
-    WScript.Echo "Usage: doc2pdf.vbs <options> <doc-file> [/o:<pdf-file>]"
-    WScript.Echo ""
-    WScript.Echo "Available Options:"
-    WScript.Echo ""
-    WScript.Echo " /nologo - Specifies that the logo shouldn't be displayed"
-    WScript.Echo " /help   - Specifies that this usage/help information " + _
-                 "should be displayed."
-    WScript.Echo " /debug  - Specifies that debug output should be displayed."
-    WScript.Echo ""
-    WScript.Echo "Parameters:"
-    WScript.Echo ""
-    WScript.Echo " /o:<pdf-file> Optionally specification of output file (PDF)."
-    WScript.Echo ""
-  End If 
-End Function
-
-' ***********************************************
-' CHECKARGS
-'
-' Makes some preliminary checks of the arguments.
-' Quits the application is any problem is found.
-'
-Function CheckArgs()
-  ' Check that <doc-file> is specified
-  If arguments.Unnamed.Count <> 1 Then
-    WScript.Echo "Error: Obligatory <doc-file> parameter missing!"
-    WScript.Quit 1
-  End If
-
-  bShowDebug = arguments.Named.Exists("debug") Or arguments.Named.Exists("d")
-
-End Function
-
-
-' ***********************************************
-' DOC2PDF
-'
-' Converts a Word document to PDF using Word 2007.
-'
-' Input:
-' sDocFile - Full path to Word document.
-' sPDFFile - Optional full path to output file.
-'
-' If not specified the output PDF file
-' will be the same as the sDocFile except
-' file extension will be .pdf.
-'
-Function DOC2PDF( sDocFile, sPDFFile )
-
-  Dim fso ' As FileSystemObject
-  Dim wdo ' As Word.Application
-  Dim wdoc ' As Word.Document
-  Dim wdocs ' As Word.Documents
-  Dim sPrevPrinter ' As String
-
-  Set fso = CreateObject("Scripting.FileSystemObject")
-  Set wdo = CreateObject("Word.Application")
-  Set wdocs = wdo.Documents
-
-  sDocFile = fso.GetAbsolutePathName(sDocFile)
-
-  ' Debug outputs...
-  If bShowDebug Then
-    WScript.Echo "Doc file = '" + sDocFile + "'"
-    WScript.Echo "PDF file = '" + sPDFFile + "'"
-  End If
-
-  sFolder = fso.GetParentFolderName(sDocFile)
-
-  If Len(sPDFFile)=0 Then
-    sPDFFile = fso.GetBaseName(sDocFile) + ".pdf"
-  End If
-
-  If Len(fso.GetParentFolderName(sPDFFile))=0 Then
-    sPDFFile = sFolder + "\" + sPDFFile
-  End If
-
-  ' Enable this line if you want to disable autoexecute macros
-  ' wdo.WordBasic.DisableAutoMacros
-
-  ' Open the Word document
-  Set wdoc = wdocs.Open(sDocFile)
-
-  ' Let Word document save as PDF
-  ' - for documentation of SaveAs() method,
-  '   see http://msdn2.microsoft.com/en-us/library/bb221597.aspx 
-  wdoc.SaveAs sPDFFile, wdFormatPDF
-
-  wdoc.Close WdDoNotSaveChanges
-  wdo.Quit WdDoNotSaveChanges
-  Set wdo = Nothing
-
-  Set fso = Nothing
-
-End Function
-
-' *** MAIN **************************************
-
-Call EchoLogo()
-Call EchoUsage()
-Call CheckArgs()
-Call DOC2PDF( arguments.Unnamed.Item(0), arguments.Named.Item("o") )
-
-Set arguments = Nothing
\ No newline at end of file
diff --git a/modules/content_management/class/class_content_manager_tools.php b/modules/content_management/class/class_content_manager_tools.php
deleted file mode 100755
index 00560e4b4e8..00000000000
--- a/modules/content_management/class/class_content_manager_tools.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief Contains the functions to manage content_management directory and expiration
-*
-* @file
-* @author Laurent Giovannoni
-* @date $date$
-* @version $Revision$
-* @ingroup content_management
-*/
-
-require_once 'modules/content_management/class/class_content_manager_tools_Abstract.php';
-
-class content_management_tools extends content_management_tools_Abstract
-{
-    // custom
-}
diff --git a/modules/content_management/class/class_content_manager_tools_Abstract.php b/modules/content_management/class/class_content_manager_tools_Abstract.php
deleted file mode 100755
index 436c27e5360..00000000000
--- a/modules/content_management/class/class_content_manager_tools_Abstract.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2017 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief Contains the functions to manage content_management directory and expiration
-*
-* @file
-* @author Laurent Giovannoni
-* @date $date$
-* @version $Revision$
-* @ingroup content_management
-*/
-
-require_once 'core/class/class_functions.php';
-require_once 'core/class/class_db_pdo.php';
-require_once 'core/class/docservers_controler.php';
-require_once 'core/class/class_security.php';
-require_once 'core/core_tables.php';
-
-abstract class content_management_tools_Abstract
-{
-    //Parameters
-    protected $extensions_xml_path = 'xml/extensions.xml';
-    protected $programs_xml_path = 'xml/programs.xml';
-    protected $parameter_id  = 'content_management_reservation';
-    protected $templateMasterPath = 'modules/templates/templates_src/';
-    //Variables
-    protected $db;
-
-    public function __construct()
-    {
-        if (!isset($_SESSION) or count($_SESSION) == 0) {
-            return null;
-        }
-
-        $this->db = new Database();
-        //TODO: PUT IT AN CONFIG FILE WITH 30
-        $_SESSION['config']['content_management_reserved_time'] = 30;
-        if (!is_dir('modules/content_management/tmp/')) {
-            mkdir('modules/content_management/tmp/');
-        }
-    }
-    
-    public function getCmParameters()
-    {
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom/'
-            . $_SESSION['custom_override_id']
-            . '/modules/content_management/xml/content_management_features.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom/'
-                . $_SESSION['custom_override_id']
-                . '/modules/content_management/xml/content_management_features.xml';
-        } else {
-            $path = $_SESSION['config']['corepath']
-                . 'modules/content_management/xml/content_management_features.xml';
-        }
-        $cMFeatures = array();
-        if (file_exists($path)) {
-            $func = new functions();
-            $cMFeatures = $func->object2array(
-                simplexml_load_file($path)
-            );
-        } else {
-            $cMFeatures['CONFIG']['psExecMode'] = 'KO';
-            $cMFeatures['CONFIG']['userMaarchOnClient'] = '';
-            $cMFeatures['CONFIG']['userPwdMaarchOnClient'] = '';
-        }
-        return $cMFeatures;
-    }
-
-    /**
-    * Returns who reserved the resource
-    *
-    * @param  string $objectTable res table, attachment table, model table, ...
-    * @param  bigint $objectId id of the object res_id, model_id, ...
-    * @return array the user who reserved the resource, else false
-    */
-    public function isReservedBy($objectTable, $objectId)
-    {
-        $timeLimit = $this->computeTimeLimit();
-        $charTofind = $this->parameter_id . '#%#' . $objectTable . '#' . $objectId;
-
-        $query = "select id from " . PARAM_TABLE . " where id like (?) and param_value_int > ?";
-
-        $stmt = $this->db->query($query, array($charTofind, $timeLimit));
-        
-        if ($res = $stmt->fetchObject()) {
-            $arrayUser = array();
-            $arrayUser = explode("#", $res->id);
-            if ($arrayUser[1] <> '') {
-                $query = "select user_id, lastname, firstname "
-                    . "from " . USERS_TABLE . " where user_id = ? and enabled = 'Y'";
-                
-                $stmt = $this->db->query($query, array($arrayUser[1]));
-                
-                $arrayReturn = array();
-                if ($resUser = $stmt->fetchObject()) {
-                    $arrayReturn['fullname'] = $resUser->firstname . ' '
-                        . $resUser->lastname;
-                    $arrayReturn['user_id'] = $resUser->user_id;
-                } else {
-                    $arrayReturn['fullname'] = 'empty';
-                }
-                $arrayReturn['status'] = 'ok';
-                return $arrayReturn;
-            } else {
-                $arrayReturn['status'] = 'ko';
-            }
-        } else {
-            $arrayReturn['status'] = 'ko';
-        }
-        return $arrayReturn;
-    }
-
-    /**
-    * Close the content_management reservation
-    *
-    * @param string $CMId content_management id
-    * @return nothing
-    */
-    public function closeReservation($CMId)
-    {
-        $query = "delete from " . PARAM_TABLE
-            . " where id = ?";
-        $stmt = $this->db->query($query, array($CMId));
-    }
-
-    /**
-    * Reserved the object for content_management
-    * Add an expiration date of the content_management reservation for the connected user
-    *
-    * @param  string $objectTable the res table
-    * @param  string $objectId the res_id
-    * @param  string $CMId the content_management id
-    * @param  string $userId the content_management id
-    * @return string the reservation id
-    */
-    public function reserveObject($objectTable, $objectId, $userId)
-    {
-        $timeLimit = $this->computeTimeLimit() + (
-            $_SESSION['config']['content_management_reserved_time'] * 60
-        );
-        //If exists Delete
-        $charTofind = $this->parameter_id . '#' . $userId . '#' . $objectTable
-                    . '#' . $objectId;
-        $query = "delete from " . PARAM_TABLE
-               . " where id = ?";
-        $stmt = $this->db->query($query, array($charTofind));
-        $query = "insert into " . PARAM_TABLE
-               . " (id, param_value_int)"
-               . " values(?, ?)";
-        $stmt = $this->db->query($query, array($charTofind, $timeLimit));
-        return $charTofind;
-    }
-
-    /**
-    * Delete the resource in the tmp content_management dir if necessary
-    *
-    * @return nothing
-    */
-    public function deleteExpiredCM()
-    {
-        $timeLimit = $this->computeTimeLimit();
-        $query = "delete from " . PARAM_TABLE
-            . " where param_value_int < ? "
-            . " and id like ? ";
-        $stmt = $this->db->query($query, array($timeLimit, $this->parameter_id . '%'));
-    }
-    
-    /**
-    * Delete the resource for the disconnected user
-    *
-    * @return nothing
-    */
-    public function deleteUserCM()
-    {
-        $query = "delete from " . PARAM_TABLE
-            . " where id like ?";
-        $stmt = $this->db->query(
-            $query,
-            array('content_management_reservation#'
-            . $_SESSION['user']['UserId'] . '%')
-        );
-    }
-
-    /**
-    * Compute the time limit for a content_management session
-    *
-    * @return string the time limit in timestamp
-    */
-    public function computeTimeLimit()
-    {
-        $timeLimit = mktime(
-            date('H'),
-            date('i'),
-            date('s'),
-            date('m'),
-            date('d'),
-            date('Y')
-        );
-        return $timeLimit;
-    }
-}
diff --git a/modules/content_management/class/class_modules_tools.php b/modules/content_management/class/class_modules_tools.php
deleted file mode 100755
index 67501b9013b..00000000000
--- a/modules/content_management/class/class_modules_tools.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/*
-*   Copyright 2012-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @defgroup content_management content_management Module
-*/
-
-/**
-* @brief   Module content_management :  Module Tools Class
-*
-* <ul>
-*   <li>Set the session variables needed to run the content_management module</li>
-*</ul>
-*
-* @file
-* @author Laurent Giovannoni <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup content_management
-*/
-
-require_once 'modules/content_management/class/class_modules_tools_Abstract.php';
-
-/**
-* @brief Module content_management : Module Tools Class
-*
-* <ul>
-* <li>Loads the tables used by the content_management</li>
-* <li>Set the session variables needed to run the content_management module</li>
-*</ul>
-*
-* @ingroup content_management
-*/
-class content_management extends content_management_Abstract
-{
-    // custom
-}
diff --git a/modules/content_management/class/class_modules_tools_Abstract.php b/modules/content_management/class/class_modules_tools_Abstract.php
deleted file mode 100755
index 83b7b185a46..00000000000
--- a/modules/content_management/class/class_modules_tools_Abstract.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/*
-*   Copyright 2012-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @defgroup content_management content_management Module
-*/
-
-/**
-* @brief   Module content_management :  Module Tools Class
-*
-* <ul>
-*   <li>Set the session variables needed to run the content_management module</li>
-*</ul>
-*
-* @file
-* @author Laurent Giovannoni <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup content_management
-*/
-
-/**
-* @brief Module content_management : Module Tools Class
-*
-* <ul>
-* <li>Loads the tables used by the content_management</li>
-* <li>Set the session variables needed to run the content_management module</li>
-*</ul>
-*
-* @ingroup content_management
-*/
-abstract class content_management_Abstract
-{
-    function __construct()
-    {
-        // parent::__construct();
-        $this->index = array();
-    }
-
-    /**
-    * Loads content_management  tables into sessions vars from the
-    * content_management/xml/config.xml
-    * Loads content_management log setting into sessions vars from the
-    * content_management/xml/config.xml
-    */
-    public function build_modules_tables()
-    {
-        if (file_exists($_SESSION['config']['corepath'] . 'custom/'
-                        . $_SESSION['custom_override_id']
-                        . '/modules/content_management/xml/config.xml')
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom/'
-                . $_SESSION['custom_override_id']
-                . '/modules/content_management/xml/config.xml';
-        } else {
-            $path = 'modules/content_management/xml/config.xml';
-        }
-        $xmlconfig = simplexml_load_file($path);
-        // Loads the log setting of the module content_management
-        $HISTORY = $xmlconfig->HISTORY;
-        $_SESSION['history']['cmadd'] = (string) $HISTORY->cmadd;
-        $_SESSION['history']['cmup'] = (string) $HISTORY->cmup;
-        $_SESSION['history']['cmdel'] = (string) $HISTORY->cmdel;
-    }
-
-    /**
-    * Load into session vars all the content_management specific vars :
-    * calls private methods
-    */
-    public function load_module_var_session($userData)
-    {
-        if (file_exists($_SESSION['config']['corepath'] . 'custom/'
-            . $_SESSION['custom_override_id']
-            . '/modules/content_management/xml/content_management_features.xml')
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom/'
-                . $_SESSION['custom_override_id']
-                . '/modules/content_management/xml/content_management_features.xml';
-        } else {
-            $path = 'modules/content_management/xml/content_management_features.xml';
-        }
-        $_SESSION['CMFeatures'] = array();
-        /*$_SESSION['CMFeatures'] = functions::object2array(
-            simplexml_load_file($path)
-        );*/
-        //functions::show_array($_SESSION['CMFeatures']);
-    }
-}
diff --git a/modules/content_management/js/functions.js b/modules/content_management/js/functions.js
deleted file mode 100755
index ed41252757c..00000000000
--- a/modules/content_management/js/functions.js
+++ /dev/null
@@ -1,8 +0,0 @@
-//load applet in a modal
-function loadApplet(url, value)
-{
-    if (value != '') {
-        //console.log('value : '+value);
-        displayModal(url, 'CMApplet', 300, 300);
-    }
-}
diff --git a/modules/content_management/lang/en.php b/modules/content_management/lang/en.php
deleted file mode 100755
index e4824cbb10d..00000000000
--- a/modules/content_management/lang/en.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/*
- *
- *   Copyright 2008-2012 Maarch
- *
- *   This file is part of Maarch Framework.
- *
- *   Maarch Framework is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Maarch Framework is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
- /******************** Content management  ************/
-
-if (!defined('_MAARCH_CM_APPLET'))
-    define('_MAARCH_CM_APPLET','Launch content edition');
-if (!defined('_NO_UPDATE'))
-    define('_NO_UPDATE','No content update');
-if (!defined('_UPDATE_OK'))
-    define('_UPDATE_OK','Update OK');
-if (!defined('_NEW_ATTACHMENT_VERSION'))
-    define('_NEW_ATTACHMENT_VERSION','Attachment');
-if (!defined('_VERSION'))
-    define('_VERSION','Version');
-if (!defined('_NEW_VERSION_ADDED'))
-    define('_NEW_VERSION_ADDED','New version added');
-if (!defined('_DONT_CLOSE'))
-    define('_DONT_CLOSE','Do not close this popup !');
-if (!defined("_LOADING"))
-    define("_LOADING","Loading");
diff --git a/modules/content_management/lang/fr.php b/modules/content_management/lang/fr.php
deleted file mode 100755
index 4c3d0fc92b6..00000000000
--- a/modules/content_management/lang/fr.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/*
- *
- *   Copyright 2008-2012 Maarch
- *
- *   This file is part of Maarch Framework.
- *
- *   Maarch Framework is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Maarch Framework is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
- /******************** Content management  ************/
-
-if (!defined("_MAARCH_CM_APPLET"))
-    define("_MAARCH_CM_APPLET","Lancement édition du contenu");
-if (!defined("_NO_UPDATE"))
-    define("_NO_UPDATE","Aucune mise à jour de contenu détectée");
-if (!defined("_UPDATE_OK"))
-    define("_UPDATE_OK","Mise à jour de contenu réalisée");
-if (!defined("_NEW_ATTACHMENT_VERSION"))
-    define("_NEW_ATTACHMENT_VERSION","Réponse au courrier");
-if (!defined("_VERSION"))
-    define("_VERSION","Version");
-if (!defined("_NEW_VERSION_ADDED"))
-    define("_NEW_VERSION_ADDED","Nouvelle version ajoutée");
-if (!defined("_DONT_CLOSE"))
-    define("_DONT_CLOSE","Ne pas fermer cette fenêtre !");
-if (!defined("_LOADING"))
-    define("_LOADING","Chargement");
diff --git a/modules/content_management/lang/nl.php b/modules/content_management/lang/nl.php
deleted file mode 100755
index 656add7e059..00000000000
--- a/modules/content_management/lang/nl.php
+++ /dev/null
@@ -1,33 +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.
- */
-
- /******************** Content management  ************/
-
- if (!defined('_MAARCH_CM_APPLET')) {
-     define('_MAARCH_CM_APPLET', 'Lancering bewerking van inhoud');
- }
- if (!defined('_NO_UPDATE')) {
-     define('_NO_UPDATE', 'Geen update van de inhoud gevonden');
- }
- if (!defined('_UPDATE_OK')) {
-     define('_UPDATE_OK', 'Update van inhoud uitgevoerd');
- }
- if (!defined('_NEW_ATTACHMENT_VERSION')) {
-     define('_NEW_ATTACHMENT_VERSION', 'Antwoord op brief');
- }
- if (!defined('_VERSION')) {
-     define('_VERSION', 'Versie');
- }
- if (!defined('_NEW_VERSION_ADDED')) {
-     define('_NEW_VERSION_ADDED', 'Nieuwe versie toegevoegd');
- }
- if (!defined('_DONT_CLOSE')) {
-     define('_DONT_CLOSE', 'Dit venster niet sluiten!');
- }
- if (!defined('_LOADING')) {
-     define('_LOADING', 'Aan het laden ...');
- }
diff --git a/modules/content_management/retrieve_attachment_from_cm.php b/modules/content_management/retrieve_attachment_from_cm.php
deleted file mode 100755
index 3ddd4922991..00000000000
--- a/modules/content_management/retrieve_attachment_from_cm.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-//case of res -> update attachment
-require_once 'modules/attachments/attachments_tables.php';
-$dbAttachment = new Database();
-$query = "SELECT relation, docserver_id, path, filename, format 
-        FROM res_attachments 
-        WHERE res_id = ? AND res_id_master = ? ORDER BY relation desc";
-
-$stmt = $dbAttachment->query($query, array($objectId, $objectId, $_SESSION['doc_id']));
-
-if ($stmt->rowCount() == 0) {
-    $result = array('ERROR' => _THE_DOC . ' ' . _EXISTS_OR_RIGHT);
-    createXML('ERROR', $result);
-} else {
-    $line = $stmt->fetchObject();
-    $docserver = $line->docserver_id;
-    $path = $line->path;
-    $filename = $line->filename;
-    $format = $line->format;
-    $query = "select path_template from " . _DOCSERVERS_TABLE_NAME
-        . " where docserver_id = ?";
-    $stmt = $dbAttachment->query($query, array($docserver));
-    $func = new functions();
-    $lineDoc = $stmt->fetchObject();
-    $docserver = $lineDoc->path_template;
-    $fileOnDs = $docserver . $path . $filename;
-    $fileOnDs = str_replace('#', DIRECTORY_SEPARATOR, $fileOnDs);
-    $fileExtension = $func->extractFileExt($fileOnDs);
-    $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId']
-        . '_' . rand() . '.' . $fileExtension;
-    $filePathOnTmp = $_SESSION['config']['tmppath'] . $fileNameOnTmp;
-    if (!copy($fileOnDs, $filePathOnTmp)) {
-        $result = array('ERROR' => _FAILED_TO_COPY_ON_TMP 
-            . ':' . $fileOnDs . ' ' . $filePathOnTmp
-        );
-        createXML('ERROR', $result);
-    }
-}
diff --git a/modules/content_management/retrieve_new_attachment_from_cm.php b/modules/content_management/retrieve_new_attachment_from_cm.php
deleted file mode 100755
index 13e6cfc1d4a..00000000000
--- a/modules/content_management/retrieve_new_attachment_from_cm.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-//case of res -> new attachment with only conversion
-
-
-if (!file_exists($_SESSION['config']['tmppath'] . $_SESSION['upfile'][0]['name'])) {
-    $result = array('ERROR' => _THE_DOC . ' ' . $_SESSION['config']['tmppath'] . $_SESSION['upfile'][0]['name'] . ' ' . _EXISTS_OR_RIGHT);
-    createXML('ERROR', $result);
-} else {
-    $func = new functions();
-    $fileExtension = $func->extractFileExt($_SESSION['config']['tmppath'] . $_SESSION['upfile'][0]['name']);
-    $filePathOnTmp = $_SESSION['config']['tmppath'] . $_SESSION['upfile'][0]['name'];
-    // $file = fopen('file.log', a);
-    // fwrite($file, '[' . date('Y-m-d H:i:s') . '] ------BEGIN------- ' . PHP_EOL);
-    // fwrite($file, '[' . date('Y-m-d H:i:s') . '] EXT ' . $fileExtension . PHP_EOL);
-    // fwrite($file, '[' . date('Y-m-d H:i:s') . '] PATH ' . $filePathOnTmp . PHP_EOL);
-    // fclose($file);
-    // $result = array('ERROR' => _THE_DOC . ' ' . $_SESSION['config']['tmppath'] . $_SESSION['upfile']['name'] . ' ' . _EXISTS_OR_RIGHT);
-    // createXML('ERROR', $result);
-}
diff --git a/modules/content_management/retrieve_res_from_cm.php b/modules/content_management/retrieve_res_from_cm.php
deleted file mode 100755
index 858be3fdf5e..00000000000
--- a/modules/content_management/retrieve_res_from_cm.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-//FOR ADD RES VERSIONS, ATTACHMENT
-//case of res -> master or version
-$sec = new security();
-$resId = $_REQUEST['objectId'];
-$collId = $sec->retrieve_coll_id_from_table($objectTable);
-$_SESSION['cm']['collId'] = $collId;
-for (
-    $cptColl = 0;
-    $cptColl < count($_SESSION['collections']);
-    $cptColl++
-) {
-    if ($objectTable == $_SESSION['collections'][$cptColl]['table']
-        || $objectTable == $_SESSION['collections'][$cptColl]['view']
-    ) {
-        $adrTable = $_SESSION['collections'][$cptColl]['adr'];
-    } else {
-        $adrTable = '';
-    }
-}
-$docserverControler = new docservers_controler();
-
-$viewResourceArr = $docserverControler->viewResource(
-    $resId,
-    $objectTable,
-    $adrTable,
-    false
-);
-if ($viewResourceArr['error'] <> '') {
-    $result = array('ERROR' => $viewResourceArr['error']);
-    createXML('ERROR', $result);
-} else {
-    $filePathOnTmp = $viewResourceArr['file_path'];
-    $fileExtension = $viewResourceArr['ext'];
-}
diff --git a/modules/content_management/save_attach_from_cm.php b/modules/content_management/save_attach_from_cm.php
deleted file mode 100755
index 00139ec6b4e..00000000000
--- a/modules/content_management/save_attach_from_cm.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-
-//case of res -> update attachment
-require_once 'modules/attachments/attachments_tables.php';
-$docserverControler = new docservers_controler();
-$docserver = $docserverControler->getDocserverToInsert(
-    $_SESSION['cm']['collId']
-);
-$collId = $_SESSION['cm']['collId'];
-$_SESSION['cm']['collId'] = '';
-
-if (empty($docserver)) {
-    $location = '';
-    $result = array('ERROR' => _DOCSERVER_ERROR . ' : '
-        . _NO_AVAILABLE_DOCSERVER . '. ' . _MORE_INFOS
-    );
-    createXML('ERROR', $result);
-} else {
-    // some checking on docserver size limit
-    $newSize = $docserverControler->checkSize(
-        $docserver, filesize($_SESSION['config']['tmppath'] . $tmpFileName)
-    );
-    if ($newSize == 0) {
-        $result = array('ERROR' => _DOCSERVER_ERROR . ' : '
-            . _NOT_ENOUGH_DISK_SPACE . '. ' . _MORE_INFOS
-        );
-        createXML('ERROR', $result);
-    } else {
-        $fileInfos = array(
-            'tmpDir'      => $_SESSION['config']['tmppath'],
-            'size'        => filesize($_SESSION['config']['tmppath'] . $tmpFileName),
-            'format'      => strtoupper($fileExtension),
-            'tmpFileName' => $tmpFileName,
-        );
-
-        $storeResult = array();
-        $storeResult = $docserverControler->storeResourceOnDocserver(
-            $collId, $fileInfos
-        );
-        if (isset($storeResult['error']) && $storeResult['error'] <> '') {
-            $result = array('ERROR' => $storeResult['error']);
-            createXML('ERROR', $result);
-        } else {
-            require_once 'core/docservers_tools.php';
-            require_once 'core/class/docserver_types_controler.php';
-            $docserver = $docserverControler->get($storeResult['docserver_id']);
-            $docserverTypeControler = new docserver_types_controler();
-            $docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
-            $query = "update " . RES_ATTACHMENTS_TABLE 
-                . " set docserver_id = ? "
-                . ", path = ? "
-                . ", filename = ? "
-                . ", filesize = ? "
-                . ", fingerprint = ? "
-                . "where res_id = ?";
-				
-			//copie de la version PDF de la pièce si mode de conversion sur le client
-			if (
-                $_SESSION['modules_loaded']['attachments']['convertPdf'] == true 
-                && $tmpFilePdfName != ''
-            ) {
-				$file = $_SESSION['config']['tmppath'].$tmpFilePdfName;
-				$newfile = $storeResult['path_template']
-                    . str_replace('#',"/",$storeResult['destination_dir'])
-                    . substr (
-                        $storeResult['file_destination_name'], 
-                        0, 
-                        strrpos($storeResult['file_destination_name'], "." )
-                    ).".pdf";
-				
-				copy($file, $newfile);
-				$_SESSION['new_id'] = $objectId;
-			}
-            $dbAttachment = new Database();
-            $stmt = $dbAttachment->query(
-                $query, 
-                array(
-                    $storeResult['docserver_id'],
-                    $storeResult['destination_dir'],
-                    $storeResult['file_destination_name'],
-                    filesize($_SESSION['config']['tmppath'] . $tmpFileName),
-                    Ds_doFingerprint($_SESSION['config']['tmppath'] 
-                        . $tmpFileName, $docserverTypeObject->fingerprint_mode,
-                    $objectId
-                )
-            ));
-            if ($_SESSION['history']['attachup'] == 'true') {
-                $hist = new history();
-                $sec = new security();
-                $view = $sec->retrieve_view_from_coll_id(
-                    $collId
-                );
-                $query = "select res_id_master from " . RES_ATTACHMENTS_TABLE
-                    . " where res_id = ?";
-                $stmt = $dbAttachment->query($query, array($objectId));
-                $lineDoc = $stmt->fetchObject();
-                $hist->add(
-                    $view, $lineDoc->res_id_master, 'UP', 'attachup',
-                    ucfirst(_DOC_NUM) . $objectId . ' '
-                    . _ATTACH_UP . ' ' . _TO_MASTER_DOCUMENT
-                    . $lineDoc->res_id_master,
-                    $_SESSION['config']['databasetype'],
-                    'apps'
-                );
-                $hist->add(
-                    RES_ATTACHMENTS_TABLE, $objectId, 'UP','attachup',
-                    ATTACHMENT_UP,
-                    $_SESSION['config']['databasetype'],
-                    'attachments'
-                );
-            }
-        }
-    }
-}
diff --git a/modules/content_management/save_attach_res_from_cm.php b/modules/content_management/save_attach_res_from_cm.php
deleted file mode 100755
index 7cbde8c9a2f..00000000000
--- a/modules/content_management/save_attach_res_from_cm.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-//FOR ADD NEW ATTACHMENTS
-$sec = new security();
-// case onlyConvert
-if (
-    $_SESSION['modules_loaded']['attachments']['convertPdf'] == true &&
-    $objectType == 'newAttachment'
-){
-    $_SESSION['upfile']['fileNamePdfOnTmp'] = $tmpFilePdfName;
-}
-
-require_once 'modules/attachments/attachments_tables.php';
-
-//new attachment from a template
-if (isset($_SESSION['cm']['resMaster']) && $_SESSION['cm']['resMaster'] <> '') {
-   $objectId = $_SESSION['cm']['resMaster'];
-}
-
-$_SESSION['cm']['resMaster'] = '';
-
-if (empty($_SESSION['cm']['collId'])) {
-    $_SESSION['cm']['collId'] = $sec->retrieve_coll_id_from_table($objectTable);
-}
-$docserverControler = new docservers_controler();
-$docserver = $docserverControler->getDocserverToInsert(
-    $_SESSION['cm']['collId']
-);
-
-$collId = $_SESSION['cm']['collId'];
-$_SESSION['cm']['collId'] = '';
-
-if (empty($docserver)) {
-    $_SESSION['error'] = _DOCSERVER_ERROR . ' : '
-        . _NO_AVAILABLE_DOCSERVER . '. ' . _MORE_INFOS;
-} else {
-    // some checking on docserver size limit
-    $newSize = $docserverControler->checkSize(
-        $docserver, filesize($_SESSION['config']['tmppath'] . $tmpFileName)
-    );
-    if ($newSize == 0) {
-        $_SESSION['error'] = _DOCSERVER_ERROR . ' : '
-            . _NOT_ENOUGH_DISK_SPACE . '. ' . _MORE_INFOS . '.';
-    } else {
-        $fileInfos = array(
-            'tmpDir'      => $_SESSION['config']['tmppath'],
-            'size'        => filesize($_SESSION['config']['tmppath'] . $tmpFileName),
-            'format'      => strtoupper($fileExtension),
-            'tmpFileName' => $tmpFileName,
-        );
-
-        $storeResult = array();
-        $storeResult = $docserverControler->storeResourceOnDocserver(
-            $collId, $fileInfos
-        );
-        if (isset($storeResult['error']) && $storeResult['error'] <> '') {
-            $_SESSION['error'] = $storeResult['error'];
-        } else {
-            $resAttach = new resource();
-            $_SESSION['data'] = array();
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'typist',
-                    'value' => $_SESSION['user']['UserId'],
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'format',
-                    'value' => $fileExtension,
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'docserver_id',
-                    'value' => $storeResult['docserver_id'],
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'status',
-                    'value' => 'NEW',
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'offset_doc',
-                    'value' => ' ',
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'title',
-                    'value' => $_SESSION['cm']['templateStyle'],
-                    'type' => 'string',
-                )
-            );
-            $_SESSION['cm']['templateStyle'] = '';
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'coll_id',
-                    'value' => $collId,
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'res_id_master',
-                    'value' => $objectId,
-                    'type' => 'integer',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'type_id',
-                    'value' => 0,
-                    'type' => 'int',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'identifier',
-                    'value' => '1',
-                    'type' => 'string',
-                )
-            );
-            //$_SESSION['error'] = 'test';
-            $id = $resAttach->load_into_db(
-                RES_ATTACHMENTS_TABLE,
-                $storeResult['destination_dir'],
-                $storeResult['file_destination_name'] ,
-                $storeResult['path_template'],
-                $storeResult['docserver_id'], 
-                $_SESSION['data'],
-                $_SESSION['config']['databasetype']
-            );
-            if ($id == false) {
-                $_SESSION['error'] = $resAttach->get_error();
-                //$resource->show();
-                //exit();
-            } else {
-                if ($_SESSION['history']['attachadd'] == "true") {
-                    $hist = new history();
-                    $view = $sec->retrieve_view_from_coll_id(
-                        $collId
-                    );
-                    $hist->add(
-                        $view, $objectId, 'ADD', 'attachadd',
-                        ucfirst(_DOC_NUM) . $id . ' '
-                        . _NEW_ATTACH_ADDED . ' ' . _TO_MASTER_DOCUMENT
-                        . $objectId,
-                        $_SESSION['config']['databasetype'],
-                        'apps'
-                    );
-                    $hist->add(
-                        RES_ATTACHMENTS_TABLE, $id, 'ADD','attachadd',
-                        $_SESSION['error'] 
-                        . _NEW_ATTACHMENT,
-                        $_SESSION['config']['databasetype'],
-                        'attachments'
-                    );
-                }
-            }
-        }
-    }
-}
diff --git a/modules/content_management/save_attachment_from_cm.php b/modules/content_management/save_attachment_from_cm.php
deleted file mode 100755
index 676a194ecec..00000000000
--- a/modules/content_management/save_attachment_from_cm.php
+++ /dev/null
@@ -1,224 +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   save_attachment_from_cm
-* @author  dev <dev@maarch.org>
-* @ingroup content_management
-*/
-
-// FOR ADD, UP TEMPLATES and temporary backup
-if (empty($_REQUEST['uniqueId']) || $_REQUEST['uniqueId'] == null) {
-    $i = 0;
-} else {
-    $i = $_REQUEST['uniqueId'];
-}
-
-if (!isset($_SESSION['upfile'])) {
-    $_SESSION['upfile'] = [];
-}
-
-$_SESSION['upfile'][$i]['tmp_name']             = $_SESSION['config']['tmppath'] . $tmpFileName;
-$_SESSION['upfile'][$i]['size']                 = filesize($_SESSION['config']['tmppath'] . $tmpFileName);
-$_SESSION['upfile'][$i]['error']                = "";
-$_SESSION['upfile'][$i]['fileNameOnTmp']        = $tmpFileName;
-$_SESSION['upfile'][$i]['format']               = $fileExtension;
-$_SESSION['upfile'][$i]['upAttachment']         = true;
-
-$_SESSION['m_admin']['templates']['applet']     = true;
-
-if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true) {
-	$_SESSION['upfile'][$i]['fileNamePdfOnTmp'] = $tmpFilePdfName;
-}
-
-// Temporary backup
-
-require_once "core/class/class_security.php";
-require_once "core/class/class_request.php";
-require_once "core/class/class_resource.php";
-require_once "core/class/docservers_controler.php";
-require_once 'modules/attachments/attachments_tables.php';
-require_once 'modules/attachments/class/attachments_controler.php';
-
-$docserverControler = new docservers_controler();
-$func               = new functions();
-$req                = new request();
-$db              	= new Database();
-$ac 				= new attachments_controler();
-
-require_once 'core/docservers_tools.php';
-
-//CHECK AUTHORIZED EXTENSION
-$arrayIsAllowed = array();
-$arrayIsAllowed = Ds_isFileTypeAllowed(
-    $_SESSION['config']['tmppath'] . $_SESSION['upfile'][$i]['fileNameOnTmp']
-);
-
-if ($arrayIsAllowed['status'] == false) {
-	$_SESSION['error']  = _WRONG_FILE_TYPE . ' ' . $arrayIsAllowed['mime_type'];
-	$_SESSION['upfile'] = array();
-} else {
-    if (! isset($_SESSION['collection_id_choice']) || empty($_SESSION['collection_id_choice'])) {
-        $_SESSION['collection_id_choice'] = $_SESSION['user']['collections'][0];
-    }
-
-    $docserver = $docserverControler->getDocserverToInsert($_SESSION['collection_id_choice']);
-
-    if (empty($docserver)) {
-        $_SESSION['error'] = _DOCSERVER_ERROR . ' : ' . _NO_AVAILABLE_DOCSERVER . ". " . _MORE_INFOS . ".";
-        $location = "";
-    } else {
-
-        // some checking on docserver size limit
-        $newSize = $docserverControler->checkSize(
-            $docserver, $_SESSION['upfile'][$i]['size']
-        );
-        if ($newSize == 0) {
-            $_SESSION['error'] = _DOCSERVER_ERROR . ' : ' . _NOT_ENOUGH_DISK_SPACE . ". " . _MORE_INFOS . ".";
-            ?>
-            <script type="text/javascript">
-                var eleframe1 = window.parent.top.document.getElementById('list_attach');
-                eleframe1.location.href = '<?php
-		            echo $_SESSION['config']['businessappurl'];
-		            ?>index.php?display=true&module=attachments&page=frame_list_attachments&mode=normal&load';
-            </script>
-            <?php
-            exit();
-        } else {
-            $fileInfos = array(
-                "tmpDir"      => $_SESSION['config']['tmppath'],
-                "size"        => $_SESSION['upfile'][$i]['size'],
-                "format"      => $_SESSION['upfile'][$i]['format'],
-                "tmpFileName" => $_SESSION['upfile'][$i]['fileNameOnTmp'],
-            );
-
-            //SAVE FILE ON DOCSERVER ATTACHMENT
-            $storeResult = array();
-            $storeResult = $docserverControler->storeResourceOnDocserver(
-                $_SESSION['collection_id_choice'], $fileInfos
-            );
-
-            if (isset($storeResult['error']) && $storeResult['error'] <> '') {
-                $_SESSION['error'] = $storeResult['error'];
-            } else if(isset($_SESSION['attachmentInfo']['inProgressResId'])){
-
-            //MODE SECOND BACKUP AND MORE
-            } else if(isset($_SESSION['attachmentInfo'][$i]['inProgressResId'])){
-
-                //DELETE OLD BACKUP
-				$ac->removeTemporaryAttachmentOnDocserver($_SESSION['attachmentInfo'][$i]['inProgressResId'], $_SESSION['doc_id'], $_SESSION['user']['UserId']);
-
-		        require_once 'core/class/docserver_types_controler.php';
-				$docserverTypeControler = new docserver_types_controler();
-
-                //RETRIEVE FILE PATH
-				$filetmp = $storeResult['path_template'];
-				$filetmp .= str_replace('#',DIRECTORY_SEPARATOR, $storeResult['destination_dir']);
-				$filetmp .= $storeResult['file_destination_name'];
-
-				$docserver           = $docserverControler->get($storeResult['docserver_id']);
-				$docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
-				$fingerprint         = Ds_doFingerprint($filetmp, $docserverTypeObject->fingerprint_mode);
-
-				$tableName = 'res_attachments';
-                
-                //UPDATE NEW FILE PATH
-	        	$db->query('UPDATE '.$tableName.' SET fingerprint = ?, filesize = ?, path = ?, filename = ? WHERE res_id = ?', 
-	        		array($fingerprint, filesize($filetmp), $storeResult['destination_dir'], $storeResult['file_destination_name'], $_SESSION['attachmentInfo'][$i]['inProgressResId']));
-            
-            //MODE FIRST BACKUP
-            } else {
-                $_SESSION['data'] = array();
-
-                array_push($_SESSION['data'], array( 'column' => "typist", 			'value' => $_SESSION['user']['UserId'], 			'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "format", 			'value' => $fileInfos['format'], 					'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "docserver_id", 	'value' => $storeResult['docserver_id'], 			'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "status", 			'value' => 'TMP', 									'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "title", 			'value' => $_SESSION['attachmentInfo'][$i]['title'], 	'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "coll_id", 		'value' => $_SESSION['collection_id_choice'], 		'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "res_id_master", 	'value' => $_SESSION['doc_id'], 					'type' => "integer") );
-                
-                if ($objectType == 'outgoingMail') {
-                    $_SESSION['upfile'][$i]['outgoingMail'] = true;
-                    array_push($_SESSION['data'], array( 'column' => "type_id", 		'value' => 1, 										'type' => "integer" ) );
-                } else {
-                    array_push($_SESSION['data'], array( 'column' => "type_id", 		'value' => 0, 										'type' => "integer" ) );
-                }
-                
-
-                if (isset($_SESSION['attachmentInfo'][$i]['back_date']) && $_SESSION['attachmentInfo'][$i]['back_date'] <> '') {
-                    array_push($_SESSION['data'], array( 'column' => "validation_date", 'value' => $func->format_date_db($_SESSION['attachmentInfo'][$i]['back_date']), 'type' => "date", ) );
-                }
-
-                if (isset($_SESSION['attachmentInfo'][$i]['contactId']) && $_SESSION['attachmentInfo'][$i]['contactId'] <> '' && is_numeric($_SESSION['attachmentInfo'][$i]['contactId'])) {
-                    array_push($_SESSION['data'], array( 'column' => 'dest_contact_id', 'value' => $_SESSION['attachmentInfo'][$i]['contactId'], 'type' => 'integer' ) );
-                } else if (isset($_SESSION['attachmentInfo'][$i]['contactId']) && $_SESSION['attachmentInfo'][$i]['contactId'] != '' && !is_numeric($_SESSION['attachmentInfo'][$i]['contactId'])) {
-                    $_SESSION['data'][] = [
-                            'column' => 'dest_user',
-                            'value' => $_SESSION['attachmentInfo'][$i]['contactId'],
-                            'type' => 'string',
-                        ];
-                }
-
-                if (isset($_SESSION['attachmentInfo'][$i]['addressId']) && $_SESSION['attachmentInfo'][$i]['addressId'] <> '' && is_numeric($_SESSION['attachmentInfo']['addressId'])) {
-                    array_push($_SESSION['data'], array( 'column' => "dest_address_id", 'value' => $_SESSION['attachmentInfo'][$i]['addressId'], 'type' => "integer" ) );
-                }
-
-                if ($_SESSION['targetAttachment'] == 'add'){
-					$relation       = 1;
-                    if(!empty($_SESSION['attachmentInfo'][$i]['chrono'])){
-                        $identifier     = $_SESSION['attachmentInfo'][$i]['chrono'];
-                    }else{
-                        $identifier     = null;    
-                    }
-					
-					$attachmentType = $_SESSION['attachmentInfo'][$i]['type'];
-					$TableName      = RES_ATTACHMENTS_TABLE;
-
-                } else if ($_SESSION['targetAttachment'] == 'edit') {
-		            $stmt = $db->query("SELECT attachment_type, identifier, relation, attachment_id_master 
-		                            FROM res_attachments
-		                            WHERE res_id = ? and res_id_master = ?
-		                            ORDER BY relation desc", array($_SESSION['resIdVersionAttachment'], $_SESSION['doc_id']));
-
-					$previous_attachment = $stmt->fetchObject();
-					$relation            = (int)$previous_attachment->relation;
-					$relation++;
-                    if(!empty($previous_attachment->identifier)){
-                        $identifier      = $previous_attachment->identifier;
-                    }else{
-                        $identifier      = null;    
-                    }
-					$attachmentType      = $previous_attachment->attachment_type;
-					$TableName           = 'res_attachments';
-
-					if ((int)$previous_attachment->attachment_id_master == 0) {
-						$attachmentIdMaster = $_SESSION['resIdVersionAttachment'];
-					} else {
-						$attachmentIdMaster = $previous_attachment->attachment_id_master;
-					}
-					array_push($_SESSION['data'], array( 'column' => "attachment_id_master", 'value' => $attachmentIdMaster, 'type' => "integer" ) );
-                }
-                
-                array_push($_SESSION['data'], array( 'column' => "relation", 		'value' => $relation,								'type' => "integer" ) );
-                array_push($_SESSION['data'], array( 'column' => "identifier", 		'value' => $identifier, 							'type' => "string" ) );
-                array_push($_SESSION['data'], array( 'column' => "attachment_type", 'value' => $attachmentType, 						'type' => "string" ) );
-
-                $resAttach = new resource();
-
-				$id = $resAttach->load_into_db(
-					$TableName,
-					$storeResult['destination_dir'],
-					$storeResult['file_destination_name'] ,
-					$storeResult['path_template'],
-					$storeResult['docserver_id'], $_SESSION['data'],
-					$_SESSION['config']['databasetype']
-				);
-
-				$_SESSION['attachmentInfo'][$i]['inProgressResId'] = $id;
-	        }
-        }
-    }
-}
diff --git a/modules/content_management/save_editRes_from_cm.php b/modules/content_management/save_editRes_from_cm.php
deleted file mode 100755
index 88e2e87e159..00000000000
--- a/modules/content_management/save_editRes_from_cm.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-//case of res -> update attachment
-require_once 'modules/attachments/attachments_tables.php';
-$docserverControler = new docservers_controler();
-$docserver = $docserverControler->getDocserverToInsert(
-    $_SESSION['cm']['collId']
-);
-$collId = $_SESSION['cm']['collId'];
-$_SESSION['cm']['collId'] = '';
-
-if (empty($docserver)) {
-    $location = '';
-    $result = array('ERROR' => _DOCSERVER_ERROR . ' : '
-        . _NO_AVAILABLE_DOCSERVER . '. ' . _MORE_INFOS
-    );
-    createXML('ERROR', $result);
-}else {
-	// some checking on docserver size limit
-	$newSize = $docserverControler->checkSize(
-		$docserver, filesize($_SESSION['config']['tmppath'] . $tmpFileName)
-	);
-	if ($newSize == 0) {
-		$result = array('ERROR' => _DOCSERVER_ERROR . ' : '
-			. _NOT_ENOUGH_DISK_SPACE . '. ' . _MORE_INFOS
-		);
-		createXML('ERROR', $result);
-	} else {
-		$fileInfos = array(
-			'tmpDir'      => $_SESSION['config']['tmppath'],
-			'size'        => filesize($_SESSION['config']['tmppath'] . $tmpFileName),
-			'format'      => strtoupper($fileExtension),
-			'tmpFileName' => $tmpFileName,
-		);
-
-		$storeResult = array();
-		$storeResult = $docserverControler->storeResourceOnDocserver(
-			$collId, $fileInfos
-		);
-		if (isset($storeResult['error']) && $storeResult['error'] <> '') {
-			$result = array('ERROR' => $storeResult['error']);
-			createXML('ERROR', $result);
-		} else {
-			require_once 'core/docservers_tools.php';
-			require_once 'core/class/docserver_types_controler.php';
-			require_once "core/class/class_security.php";
-			$sec = new security();
-			
-			$docserver = $docserverControler->get($storeResult['docserver_id']);
-			$docserverTypeControler = new docserver_types_controler();
-			$docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
-			$table_up = $sec->retrieve_table_from_coll($_SESSION['collection_id_choice']);
-			$query = "update " . $table_up 
-				. " set docserver_id = '" . $storeResult['docserver_id'] . "'"
-				. ", path = '" . $storeResult['destination_dir'] . "'"
-				. ", filename = '" . $storeResult['file_destination_name'] . "'"
-				. ", filesize = " . filesize($_SESSION['config']['tmppath'] . $tmpFileName)
-				. ", fingerprint = '" . Ds_doFingerprint(
-						$_SESSION['config']['tmppath'] . $tmpFileName, 
-						$docserverTypeObject->fingerprint_mode
-				) . "' "
-				. "where res_id = " . $objectId;
-				
-			
-			$dbAttachment = new Database();
-			
-			$dbAttachment->query($query);
-			
-			//copie de la version PDF de la pièce si mode de conversion sur le client
-			if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $tmpFilePdfName != ''){
-				$file = $_SESSION['config']['tmppath'].$tmpFilePdfName;
-				$newfile = $storeResult['path_template'].str_replace('#',"/",$storeResult['destination_dir']).substr ($storeResult['file_destination_name'], 0, strrpos  ($storeResult['file_destination_name'], "." )).".pdf";
-				
-				copy($file, $newfile);
-				$_SESSION['new_id'] = $objectId;
-				
-				
-				 $query = "update " . RES_ATTACHMENTS_TABLE 
-				. " set docserver_id = '" . $storeResult['docserver_id'] . "'"
-				. ", path = '" . $storeResult['destination_dir'] . "'"
-				. ", filename = '" . $storeResult['file_destination_name'] . "'"
-				. ", filesize = " . filesize($_SESSION['config']['tmppath'] . $tmpFilePdfName)
-				. ", fingerprint = '" . Ds_doFingerprint(
-						$_SESSION['config']['tmppath'] . $tmpFilePdfName, 
-						$docserverTypeObject->fingerprint_mode
-				) . "' "
-				. "where type_id = 1 and attachment_type='converted_pdf' and res_id_master = " . $objectId;
-				
-				$dbAttachment->query($query);
-				unset($tmpFilePdfName);
-			}
-			
-			if ($_SESSION['history']['attachup'] == 'true') {
-				$hist = new history();
-				$sec = new security();
-				$view = $sec->retrieve_view_from_coll_id(
-					$collId
-				);
-				$query = "select res_id_master from " . RES_ATTACHMENTS_TABLE
-					. " where res_id = " . $objectId;
-				$dbAttachment->query($query);
-				$lineDoc = $dbAttachment->fetch_object();
-				$hist->add(
-					$view, $lineDoc->res_id_master, 'UP', 'attachup',
-					ucfirst(_DOC_NUM) . $objectId . ' '
-					. _ATTACH_UP . ' ' . _TO_MASTER_DOCUMENT
-					. $lineDoc->res_id_master,
-					$_SESSION['config']['databasetype'],
-					'apps'
-				);
-				$hist->add(
-					RES_ATTACHMENTS_TABLE, $objectId, 'UP','attachup',
-					ATTACHMENT_UP,
-					$_SESSION['config']['databasetype'],
-					'attachments'
-				);
-            }
-        }
-    }
-}
diff --git a/modules/content_management/save_new_version_from_cm.php b/modules/content_management/save_new_version_from_cm.php
deleted file mode 100755
index 7b47282fff6..00000000000
--- a/modules/content_management/save_new_version_from_cm.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-//FOR ADD RES VERSIONS
-
-if ($_SESSION['cm']['resMaster'] <> '') {
-    $resMaster = $_SESSION['cm']['resMaster'];
-} else {
-    $resMaster = $_SESSION['doc_id'];
-}
-
-$_SESSION['cm']['resMaster'] = '';
-
-$security = new security();
-$versionTable = $security->retrieve_version_table_from_coll_id(
-    $_SESSION['cm']['collId']
-);
-
-$docserverControler = new docservers_controler();
-$docserver = $docserverControler->getDocserverToInsert(
-    $_SESSION['cm']['collId']
-);
-if (empty($docserver)) {
-    $location = '';
-    $result = array('ERROR' => _DOCSERVER_ERROR . ' : '
-        . _NO_AVAILABLE_DOCSERVER . '. ' . _MORE_INFOS
-    );
-    createXML('ERROR', $result);
-} else {
-    // some checking on docserver size limit
-    $newSize = $docserverControler->checkSize(
-        $docserver, filesize($_SESSION['config']['tmppath'] . $tmpFileName)
-    );
-    if ($newSize == 0) {
-        $result = array('ERROR' => _DOCSERVER_ERROR . ' : '
-            . _NOT_ENOUGH_DISK_SPACE . '. ' . _MORE_INFOS
-        );
-        createXML('ERROR', $result);
-    } else {
-        $dbVersion = new Database();
-
-        $query = "select relation, fingerprint, docserver_id from " 
-            . $versionTable
-            . " where res_id_master = ?"
-            . " and status <> 'DEL' order by res_id desc";
-        $stmt = $dbVersion->query($query, array($resMaster));
-        $resVer = $stmt->fetchObject();
-        $lastVersion = $resVer->relation;
-        $lastFingerprint = $resVer->fingerprint;
-        $docserverId = $resVer->docserver_id;
-        $newVersion = (integer) $lastVersion + 1;
-        require_once 'core/class/docserver_types_controler.php';
-        require_once 'core/docservers_tools.php';
-        $docserverTypeControler = new docserver_types_controler();
-        $docserverTypeObject = $docserverTypeControler->get(
-            $docserver->docserver_type_id
-        );
-         $fingerprintFromTmp = Ds_doFingerprint(
-            $_SESSION['config']['tmppath'] . $tmpFileName, 
-            $docserverTypeObject->fingerprint_mode
-        );
-        //$result = array('ERROR' => $fingerprintFromTmp . '<>' . $lastFingerprint);
-        //createXML('ERROR', $result);
-        if ($fingerprintFromTmp <> $lastFingerprint) {
-            $fileInfos = array(
-                'tmpDir'      => $_SESSION['config']['tmppath'],
-                'size'        => filesize($_SESSION['config']['tmppath'] . $tmpFileName),
-                'format'      => strtoupper($fileExtension),
-                'tmpFileName' => $tmpFileName,
-            );
-            $storeResult = array();
-            $storeResult = $docserverControler->storeResourceOnDocserver(
-                $_SESSION['cm']['collId'], $fileInfos
-            );
-            if (isset($storeResult['error']) && $storeResult['error'] <> '') {
-                $result = array('ERROR' => $storeResult['error']);
-                createXML('ERROR', $result);
-            } else {
-                $resVersion = new resource();
-                $_SESSION['data'] = array();
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'typist',
-                        'value' => $_SESSION['user']['UserId'],
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'format',
-                        'value' => $fileExtension,
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'docserver_id',
-                        'value' => $storeResult['docserver_id'],
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'status',
-                        'value' => 'NEW',
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'relation',
-                        'value' => $newVersion,
-                        'type' => 'int',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'offset_doc',
-                        'value' => ' ',
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'title',
-                        'value' => 'new version of original resource',
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'coll_id',
-                        'value' => $_SESSION['cm']['collId'],
-                        'type' => 'string',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'res_id_master',
-                        'value' => $resMaster,
-                        'type' => 'integer',
-                    )
-                );
-                array_push(
-                    $_SESSION['data'],
-                    array(
-                        'column' => 'type_id',
-                        'value' => 0,
-                        'type' => 'int',
-                    )
-                );
-                //$_SESSION['error'] = 'test';
-                $id = $resVersion->load_into_db(
-                    $versionTable,
-                    $storeResult['destination_dir'],
-                    $storeResult['file_destination_name'] ,
-                    $storeResult['path_template'],
-                    $storeResult['docserver_id'], 
-                    $_SESSION['data'],
-                    $_SESSION['config']['databasetype']
-                );
-				
-                if ($id == false) {
-                    $result = array('ERROR' => $resVersion->get_error());
-                    createXML('ERROR', $result);
-                } else {
-                    if ($_SESSION['history']['cmadd'] == "true") {
-                        $hist = new history();
-                        $sec = new security();
-                        $view = $sec->retrieve_view_from_coll_id(
-                            $_SESSION['cm']['collId']
-                        );
-                        $hist->add(
-                            $view, $resMaster, 'ADD', 'cmadd',
-                            ucfirst(_DOC_NUM) . $id . ' '
-                            . _NEW_VERSION_ADDED . ' ' . _TO_MASTER_DOCUMENT
-                            . $resMaster,
-                            $_SESSION['config']['databasetype'],
-                            'apps'
-                        );
-                        $hist->add(
-                            $versionTable, $id, 'ADD','cmadd',
-                            ' new version of original resource',
-                            $_SESSION['config']['databasetype'],
-                            'content_management'
-                        );
-                    }
-                }
-            }
-        } else {
-            $result = array('END_MESSAGE' => _NO_UPDATE);
-            createXML('SUCCESS', $result);
-        }
-    }
-}
diff --git a/modules/content_management/save_outmail_from_cm.php b/modules/content_management/save_outmail_from_cm.php
deleted file mode 100755
index 23c48ff2e76..00000000000
--- a/modules/content_management/save_outmail_from_cm.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/*
-*
-*    Copyright 2008,2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*
-*   @author <dev@maarch.org>
-*/
-
-// FOR ADD, UP TEMPLATES
-
-/*$_SESSION['m_admin']['templates']['current_style'] 
-        = $_SESSION['config']['tmppath'] . $tmpFileName;
-$_SESSION['m_admin']['templates']['applet'] = true;*/
-
-$_SESSION['upfile']['tmp_name'] = $_SESSION['config']['tmppath'] . $tmpFileName;
-
-$_SESSION['upfile']['size'] = filesize($_SESSION['config']['tmppath'] . $tmpFileName);
-
-$_SESSION['upfile']['error'] = "";
-
-$_SESSION['upfile']['fileNameOnTmp'] = $tmpFileName;
-
-$_SESSION['upfile']['format'] = $fileExtension;
-
-$_SESSION['m_admin']['templates']['applet'] = true;
-
-$_SESSION['upfile']['upAttachment'] = true;
-
-$_SESSION['upfile']['outgoingMail'] = true;
-
-if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true){
-	$_SESSION['upfile']['fileNamePdfOnTmp'] = $tmpFilePdfName;
-}
\ No newline at end of file
diff --git a/modules/content_management/save_template_from_cm.php b/modules/content_management/save_template_from_cm.php
deleted file mode 100755
index a9da4dead39..00000000000
--- a/modules/content_management/save_template_from_cm.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-// FOR ADD, UP TEMPLATES
-
-$_SESSION['m_admin']['templates']['current_style'] 
-        = $_SESSION['config']['tmppath'] . $tmpFileName;
-$_SESSION['m_admin']['templates']['applet'] = true;
-
diff --git a/modules/content_management/save_transmission_from_cm.php b/modules/content_management/save_transmission_from_cm.php
deleted file mode 100755
index 6ab3887d722..00000000000
--- a/modules/content_management/save_transmission_from_cm.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/*
-*
-*    Copyright 2008,2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*
-*   @author <dev@maarch.org>
-*/
-
-if (empty($_REQUEST['uniqueId']))
-    $i = 1;
-else
-    $i = $_REQUEST['uniqueId'];
-
-if (!isset($_SESSION['upfileTransmission']))
-    $_SESSION['upfileTransmission'] = [];
-
-$_SESSION['upfileTransmission'][$i]['tmp_name']             = $_SESSION['config']['tmppath'] . $tmpFileName;
-$_SESSION['upfileTransmission'][$i]['size']                 = filesize($_SESSION['config']['tmppath'] . $tmpFileName);
-$_SESSION['upfileTransmission'][$i]['error']                = "";
-$_SESSION['upfileTransmission'][$i]['fileNameOnTmp']        = $tmpFileName;
-$_SESSION['upfileTransmission'][$i]['format']               = $fileExtension;
-$_SESSION['upfileTransmission'][$i]['upAttachment']         = true;
-$_SESSION['m_admin']['templates']['applet']                 = true;
-
-
-if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true) {
-    $_SESSION['upfileTransmission'][$i]['fileNamePdfOnTmp'] = $tmpFilePdfName;
-}
diff --git a/modules/content_management/xml/IVS/data_types.xml b/modules/content_management/xml/IVS/data_types.xml
deleted file mode 100755
index 92523040e9b..00000000000
--- a/modules/content_management/xml/IVS/data_types.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<dataTypes>
-	<dataType name="cm_table_list" base="string">
-      <enumeration value="res_letterbox" />
-      <enumeration value="res_business" />
-      <enumeration value="res_attachments" />
-      <enumeration value="business_coll_ext" />
-      <enumeration value="res_view_attachments" />
-      <enumeration value="res_view_letterbox" />
-      <enumeration value="res_view_business" />
-      <enumeration value="templates" />
-    </dataType>
-</dataTypes>
\ No newline at end of file
diff --git a/modules/content_management/xml/IVS/requests_definitions.xml b/modules/content_management/xml/IVS/requests_definitions.xml
deleted file mode 100755
index c57c320cfee..00000000000
--- a/modules/content_management/xml/IVS/requests_definitions.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<requestDefinitions>
-    <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="cm_applet_controller" >
-        <parameter name="page" value="applet_controller"/>
-        <parameter name="module" value="content_management"/>
-    </requestDefinition>
-</requestDefinitions>
\ No newline at end of file
diff --git a/modules/content_management/xml/IVS/validation_rules.xml b/modules/content_management/xml/IVS/validation_rules.xml
deleted file mode 100755
index 1856ce775e1..00000000000
--- a/modules/content_management/xml/IVS/validation_rules.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<validationRules>
-	<validationRule name="cm_applet_controller" extends="standardForm" mode="error">
-    	<parameter name="action" type="identifier" />
-    	<parameter name="objectType" type="identifier" />
-		<parameter name="objectTable" type="cm_table_list" />
-		<parameter name="objectId" type="identifier" />
-		<parameter name="transmissionNumber" type="identifier" />
-		<parameter name="fileContent" type="string" />
-		<parameter name="fileExtension" type="filename_extension" />
-        <parameter name="pdfContent" type="string" />
-		<parameter name="onlyConvert" type="string" />
-    </validationRule>
-</validationRules>
\ No newline at end of file
diff --git a/modules/content_management/xml/content_management_features.xml.default b/modules/content_management/xml/content_management_features.xml.default
deleted file mode 100755
index 11335c67489..00000000000
--- a/modules/content_management/xml/content_management_features.xml.default
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-    <CONFIG>
-        <psExecMode>KO</psExecMode>
-        <userMaarchOnClient></userMaarchOnClient> <!-- format: user or DOMAIN\user -->
-        <userPwdMaarchOnClient></userPwdMaarchOnClient>
-    </CONFIG>
-</root>
diff --git a/modules/sendmail/class/class_modules_tools_Abstract.php b/modules/sendmail/class/class_modules_tools_Abstract.php
index 6a32f5c1bf3..9961aaf04f4 100755
--- a/modules/sendmail/class/class_modules_tools_Abstract.php
+++ b/modules/sendmail/class/class_modules_tools_Abstract.php
@@ -126,7 +126,6 @@ abstract class SendmailAbstract extends Database
 
     public function getAttachment($coll_id, $res_id_master, $res_attachment, $isVersion = false)
     {
-        include_once 'modules/attachments/attachments_tables.php';
         include_once 'core/core_tables.php';
         include_once 'core/docservers_tools.php';
 
diff --git a/modules/visa/retrieve_attachment_from_cm.php b/modules/visa/retrieve_attachment_from_cm.php
index 0701e2b2059..a72a7284a67 100755
--- a/modules/visa/retrieve_attachment_from_cm.php
+++ b/modules/visa/retrieve_attachment_from_cm.php
@@ -1,6 +1,5 @@
 <?php
 //case of res -> update attachment
-require_once 'modules/attachments/attachments_tables.php';
 $db = new Database();
 if (!empty($objectResIdMaster)) {
     $data = [$objectId, $objectId, $objectResIdMaster];
@@ -19,25 +18,27 @@ if ($stmt->rowCount() == 0) {
     $path      = $line->path;
     $filename  = $line->filename;
     $format    = $line->format;
-	$_SESSION['visa']['repSignRel'] = $line->relation;
-	$_SESSION['visa']['repSignId'] = $objectId;
-	
+    $_SESSION['visa']['repSignRel'] = $line->relation;
+    $_SESSION['visa']['repSignId'] = $objectId;
+    
     $stmt2 = $db->query(
         "select path_template from " . _DOCSERVERS_TABLE_NAME
-        . " where docserver_id = ?"
-    , array($docserver));
+        . " where docserver_id = ?",
+        array($docserver)
+    );
     $func = new functions();
     $lineDoc = $stmt2->fetchObject();
 
     $docserver     = $lineDoc->path_template;
-    $fileOnDs      = $docserver . $path . str_replace(pathinfo($filename, PATHINFO_EXTENSION), "pdf",$filename);;
+    $fileOnDs      = $docserver . $path . str_replace(pathinfo($filename, PATHINFO_EXTENSION), "pdf", $filename);
+    ;
     $fileOnDs      = str_replace('#', DIRECTORY_SEPARATOR, $fileOnDs);
     $fileExtension = $func->extractFileExt($fileOnDs);
     $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId']
         . '_' . rand() . '.' . $fileExtension;
     $filePathOnTmp = $_SESSION['config']['tmppath'] . $fileNameOnTmp;
     if (!copy($fileOnDs, $filePathOnTmp)) {
-        $result = array('ERROR' => _FAILED_TO_COPY_ON_TMP 
+        $result = array('ERROR' => _FAILED_TO_COPY_ON_TMP
             . ':' . $fileOnDs . ' ' . $filePathOnTmp
         );
         createXML('ERROR', $result);
diff --git a/modules/visa/save_attach_res_from_cm.php b/modules/visa/save_attach_res_from_cm.php
deleted file mode 100755
index 292ec74f867..00000000000
--- a/modules/visa/save_attach_res_from_cm.php
+++ /dev/null
@@ -1,273 +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   save_attach_res_from_cm
-* @author  dev <dev@maarch.org>
-* @ingroup visa
-*/
-require_once 'modules/attachments/attachments_tables.php';
-
-//new attachment from a template
-if (isset($_SESSION['cm']['resMaster']) && $_SESSION['cm']['resMaster'] <> '') {
-    $objectId = $_SESSION['cm']['resMaster'];
-}
-
-$_SESSION['cm']['resMaster'] = '';
-
-$collId =  $_SESSION['current_basket']['coll_id'];
-
-$docserverControler = new docservers_controler();
-$docserver = $docserverControler->getDocserverToInsert($collId);
-
-if (empty($docserver)) {
-    $_SESSION['error'] = _DOCSERVER_ERROR . ' : '
-        . _IMG_SIGN_MISSING . '. ' . _MORE_INFOS;
-} else {
-    // some checking on docserver size limit
-    if (!is_file($_SESSION['config']['tmppath'] . $tmpFileName)) {
-        echo "{\"status\":1, \"error\" : \"". _TMP_SIGNED_FILE_FAILED . ': ' ._FILE . ' ' . _ENCRYPTED .' ' . _OR .' ' . _MISSING . ' ' . _OR .' ' . strtolower(NO_PLACE_SIGNATURE) ."\"}";
-        exit;
-    }
-    
-    $newSize = $docserverControler->checkSize(
-        $docserver,
-        filesize($_SESSION['config']['tmppath'] . $tmpFileName)
-    );
-    if ($newSize == 0) {
-        $_SESSION['error'] = _DOCSERVER_ERROR . ' : '
-            . _NOT_ENOUGH_DISK_SPACE . '. ' . _MORE_INFOS . '.';
-    } else {
-        $fileInfos = array(
-            'tmpDir'      => $_SESSION['config']['tmppath'],
-            'size'        => filesize($_SESSION['config']['tmppath'] . $tmpFileName),
-            'format'      => strtoupper($fileExtension),
-            'tmpFileName' => $tmpFileName,
-        );
-        $storeResult = array();
-        $storeResult = $docserverControler->storeResourceOnDocserver(
-            $collId,
-            $fileInfos
-        );
-        if (isset($storeResult['error']) && $storeResult['error'] <> '') {
-            $_SESSION['error'] = $storeResult['error'];
-        } else {
-            require_once "core/class/class_request.php";
-            $db = new Database();
-            $signatoryUser = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]);
-            
-            $target_table = 'res_attachments';
-            $db->query("UPDATE res_attachments set status = 'SIGN', signatory_user_serial_id = ? WHERE res_id = ?", [$signatoryUser['id'], $_SESSION['visa']['repSignId']]);
-            
-            unset($_SESSION['visa']['repSignRel']);
-            if (isset($_SESSION['visa']['repSignId'])) {
-                unset($_SESSION['visa']['repSignId']);
-            }
-            
-            $resAttach = new resource();
-            $_SESSION['data'] = array();
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'typist',
-                    'value' => $_SESSION['user']['UserId'],
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'format',
-                    'value' => $fileExtension,
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'docserver_id',
-                    'value' => $storeResult['docserver_id'],
-                    'type' => 'string',
-                )
-            );
-            
-            if (!isset($statusSign) || empty($statusSign)) {
-                $statusSign = 'TRA';
-            }
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'status',
-                    'value' => $statusSign,
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'offset_doc',
-                    'value' => ' ',
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'title',
-                    'value' => $_SESSION['visa']['last_resId_signed']['title'],
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'relation',
-                    'value' => 1,
-                    'type' => 'integer',
-                )
-            );
-            $_SESSION['cm']['templateStyle'] = '';
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'coll_id',
-                    'value' => $collId,
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'res_id_master',
-                    'value' => $_SESSION['visa']['last_resId_signed']['res_id'],
-                    'type' => 'integer',
-                )
-            );
-            
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'type_id',
-                    'value' => $_SESSION['visa']['last_resId_signed']['type_id'],
-                    'type' => 'int',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'identifier',
-                    'value' => $_SESSION['visa']['last_resId_signed']['identifier'],
-                    'type' => 'string',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'attachment_type',
-                    'value' => 'signed_response',
-                    'type' => 'string',
-                )
-            );
-
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'dest_contact_id',
-                    'value' => $_SESSION['visa']['last_resId_signed']['dest_contact'],
-                    'type' => 'int',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'dest_address_id',
-                    'value' => $_SESSION['visa']['last_resId_signed']['dest_address'],
-                    'type' => 'int',
-                )
-            );
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'in_signature_book',
-                    'value' => 1,
-                    'type' => 'bool',
-                )
-            );
-            $_SESSION['data'][] = [
-                'column' => 'dest_user',
-                'value' => $_SESSION['visa']['last_resId_signed']['dest_user'],
-                'type' => 'string'
-            ];
-
-            if (empty($_REQUEST['id'])) {
-                $id_origin = $objectId;
-            } else {
-                $id_origin = $_REQUEST['id'];
-            }
-            if (empty($target_table)) {
-                $target_table = "res_attachments";
-            }
-            array_push(
-                $_SESSION['data'],
-                array(
-                    'column' => 'origin',
-                    'value' => $id_origin.','.$target_table,
-                    'type' => 'string',
-                )
-            );
-            
-            unset($_SESSION['visa']['last_resId_signed']);
-            
-            $id = $resAttach->load_into_db(
-                RES_ATTACHMENTS_TABLE,
-                $storeResult['destination_dir'],
-                $storeResult['file_destination_name'],
-                $storeResult['path_template'],
-                $storeResult['docserver_id'],
-                $_SESSION['data'],
-                $_SESSION['config']['databasetype']
-            );
-            
-            $_SESSION['visa']['last_ans_signed'] = $id;
-            if ($id == false) {
-                $_SESSION['error'] = $resAttach->get_error();
-            } else {
-                //PDF convert display
-                \Convert\controllers\ConvertPdfController::convert([
-                    'resId'     => $id,
-                    'collId'    => 'attachments_coll'
-                ]);
-                if ($_SESSION['history']['attachadd'] == "true") {
-                    $hist = new history();
-                    $sec = new security();
-                    $view = $sec->retrieve_view_from_coll_id(
-                        $collId
-                    );
-                    $hist->add(
-                        $view,
-                        $objectId,
-                        'ADD',
-                        'attachadd',
-                        ucfirst(_DOC_NUM) . $id . ' '
-                        . _NEW_ATTACH_ADDED . ' ' . _TO_MASTER_DOCUMENT
-                        . $objectId,
-                        $_SESSION['config']['databasetype'],
-                        'apps'
-                    );
-                    $hist->add(
-                        RES_ATTACHMENTS_TABLE,
-                        $id,
-                        'ADD',
-                        'attachadd',
-                        $_SESSION['error']
-                        . _NEW_ATTACHMENT,
-                        $_SESSION['config']['databasetype'],
-                        'attachments'
-                    );
-                }
-            }
-        }
-    }
-}
-- 
GitLab