diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..5ff8889122f6b8c8d2fc37741a290e44ca0ed48f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+node_modules/
+vendor/
+composer.lock
+installed.lck
+apps/maarch_entreprise/xml/config.xml
+apps/maarch_entreprise/xml/log4php.xml
+.vscode/
+.phplint-cache
+.phplint.yml
diff --git a/apps/maarch_entreprise/services/Table.php b/apps/maarch_entreprise/services/Table.php
index d542efca297dfc435c3de46a9032961d2fd8a799..3c3dc39e94314c196df3231ed8bf475f2ad98e85 100644
--- a/apps/maarch_entreprise/services/Table.php
+++ b/apps/maarch_entreprise/services/Table.php
@@ -49,7 +49,7 @@ class Apps_Table_Service extends Core_Abstract_Service {
      *  - string/array where : WHERE [where]
      *  - data : for remplace ? on query
      *  - array conditions : [condition => valeur]
-     * @return [type]       [description]
+     * @return type       [description]
      */
     public static function select(array $args=[]){
         // Table :
@@ -190,7 +190,7 @@ class Apps_Table_Service extends Core_Abstract_Service {
      * @param array $aData donnée a ajouter
      * @param array $table table de l'ajout
      * @param string $getLastId
-     * @return [type]        [description]
+     * @return type        [description]
      */
     public static function insertInto(array $aData, $table, $getLastId = null){
         if ( ! is_string($table) ) {
@@ -219,7 +219,7 @@ class Apps_Table_Service extends Core_Abstract_Service {
      * @param  array  $aData  [description]
      * @param  string $table  [description]
      * @param  array  $aWhere [description]
-     * @return [type]         [description]
+     * @return type         [description]
      */
     public static function updateTable(array $aData, $table, $aWhere = []){
         // Prés-requis :
diff --git a/apps/maarch_entreprise/sso_connect.php b/apps/maarch_entreprise/sso_connect.php
index 5acbee1709eac8965d7eb818c4716c313a5f8a79..9e78b0c1cb91d3fa245d3bf7b8d2a74db284dec5 100755
--- a/apps/maarch_entreprise/sso_connect.php
+++ b/apps/maarch_entreprise/sso_connect.php
@@ -276,9 +276,7 @@ if (isset($_SESSION['error']) && $_SESSION['error'] <> '') {
                 "ADMIN",
                 true);
                 
-    if ($restMode) {
-
-    } else {
+    if (!$restMode) {
         header("location: " . $loginRequestArray['WEB_SSO_URL']
          . "index.php?errorId=" . $errorId 
          . "&errorMsg=" . $_SESSION['error']);  
diff --git a/apps/maarch_entreprise/tools/PEAR/SOAP/Base.php b/apps/maarch_entreprise/tools/PEAR/SOAP/Base.php
index c4b4b48324c550950480a8248d6fba33380bff7e..b6dd3bfaf0e75078fae5b6452e264da7b0dbf40e 100644
--- a/apps/maarch_entreprise/tools/PEAR/SOAP/Base.php
+++ b/apps/maarch_entreprise/tools/PEAR/SOAP/Base.php
@@ -346,7 +346,6 @@ class SOAP_Base extends SOAP_Base_Object
      * Sets the schema version used in the SOAP message.
      *
      * @access private
-     * @see $_XMLSchema
      *
      * @param string $schemaVersion  The schema version.
      */
diff --git a/apps/maarch_entreprise/tools/PEAR/SOAP/Client.php b/apps/maarch_entreprise/tools/PEAR/SOAP/Client.php
index 733a382c558c3e7c77026fbf3e4e963bcd3493a0..5fb354a2c1e55c6db71123e0f05ac21975acb613 100644
--- a/apps/maarch_entreprise/tools/PEAR/SOAP/Client.php
+++ b/apps/maarch_entreprise/tools/PEAR/SOAP/Client.php
@@ -725,7 +725,6 @@ class SOAP_Client extends SOAP_Client_Overload
     /**
      * Parses a SOAP response.
      *
-     * @see SOAP_Parser::
      *
      * @param string $response    XML content of SOAP response.
      * @param string $encoding    Character set encoding, defaults to 'UTF-8'.
diff --git a/apps/maarch_entreprise/tools/PEAR/SOAP/Server.php b/apps/maarch_entreprise/tools/PEAR/SOAP/Server.php
index 18ac3946b4cae241497c87aa2f778284384499b4..62f55089cebdb23a185397a24a5a0c626ee55c63 100644
--- a/apps/maarch_entreprise/tools/PEAR/SOAP/Server.php
+++ b/apps/maarch_entreprise/tools/PEAR/SOAP/Server.php
@@ -120,8 +120,6 @@ class SOAP_Server extends SOAP_Base
      * To always return a valid SOAP response even on errors that don't happen
      * in this code, the errors are catched, transformed to a SOAP fault and
      * immediately sent to the client.
-     *
-     * @see http://www.php.net/set_error_handler
      */
     function _errorHandler($errno, $errmsg, $filename, $linenum)
     {
diff --git a/apps/maarch_entreprise/tools/PEAR/SOAP/Transport/TCP.php b/apps/maarch_entreprise/tools/PEAR/SOAP/Transport/TCP.php
index c1cc663c10f68b5bb0e5c159eb49111fc0485529..8de51b7daa90116ca973afad80bec0b942cc953d 100644
--- a/apps/maarch_entreprise/tools/PEAR/SOAP/Transport/TCP.php
+++ b/apps/maarch_entreprise/tools/PEAR/SOAP/Transport/TCP.php
@@ -13,8 +13,6 @@
  *
  * @category   Web Services
  * @package    SOAP
- * @author     Shane Hanna <iordy_at_iordy_dot_com>
- * @author     Jan Schneider <jan@horde.org>
  * @copyright  2003-2006 The PHP Group
  * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
  * @link       http://pear.php.net/package/SOAP
@@ -29,7 +27,6 @@ require_once 'apps/maarch_entreprise/tools/PEAR/SOAP/Transport.php';
  *          for attachments
  * @access  public
  * @package SOAP
- * @author  Shane Hanna <iordy_at_iordy_dot_com>
  * @author  Jan Schneider <jan@horde.org>
  */
 class SOAP_Transport_TCP extends SOAP_Transport
diff --git a/apps/maarch_entreprise/tools/elasticsearch-php/src/Elasticsearch/Connections/ConnectionInterface.php b/apps/maarch_entreprise/tools/elasticsearch-php/src/Elasticsearch/Connections/ConnectionInterface.php
index 44495dbdcbf04256e2803becf5724b620c2dfd4a..3f8806cf7af3f5dc35fa672a5b372707fd02d968 100644
--- a/apps/maarch_entreprise/tools/elasticsearch-php/src/Elasticsearch/Connections/ConnectionInterface.php
+++ b/apps/maarch_entreprise/tools/elasticsearch-php/src/Elasticsearch/Connections/ConnectionInterface.php
@@ -54,7 +54,7 @@ interface ConnectionInterface
     /**
      * Get the URL path suffix, null if not set
      *
-     * @return null|string;
+     * @return null or string;
      */
     public function getPath();
 
diff --git a/apps/maarch_entreprise/tools/log4php/configurators/LoggerConfiguratorIni.php b/apps/maarch_entreprise/tools/log4php/configurators/LoggerConfiguratorIni.php
index 7d009b89c269b63666a19038ba1ae49236f2c8d6..298a5cd0befaabda10e646da2e490ad40a91c53d 100644
--- a/apps/maarch_entreprise/tools/log4php/configurators/LoggerConfiguratorIni.php
+++ b/apps/maarch_entreprise/tools/log4php/configurators/LoggerConfiguratorIni.php
@@ -297,7 +297,7 @@ class LoggerConfiguratorIni implements LoggerConfigurator {
 	/**
 	 * Read configuration options from <b>properties</b>.
 	 *
-	 * @see doConfigure().
+	 * @see doConfigure
 	 * @param array $properties
 	 * @param LoggerHierarchy $hierarchy
 	 */
diff --git a/apps/maarch_entreprise/tools/log4php/filters/LoggerFilterDenyAll.php b/apps/maarch_entreprise/tools/log4php/filters/LoggerFilterDenyAll.php
index 45154786a3f93871f1db6e05dcebaf1a5e116f12..5450e3263870d464dad2055dbe9b65ad73ceca27 100644
--- a/apps/maarch_entreprise/tools/log4php/filters/LoggerFilterDenyAll.php
+++ b/apps/maarch_entreprise/tools/log4php/filters/LoggerFilterDenyAll.php
@@ -48,7 +48,7 @@ class LoggerFilterDenyAll extends LoggerFilter {
 	 * regardless of the {@link LoggerLoggingEvent} parameter.
 	 * 
 	 * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to filter.
-	 * @return LoggerFilter::DENY Always returns {@link LoggerFilter::DENY}
+	 * @return LoggerFilte DENY Always returns {@link LoggerFilter::DENY}
 	 */
 	public function decide(LoggerLoggingEvent $event) {
 		return LoggerFilter::DENY;
diff --git a/apps/maarch_entreprise/tools/log4php/layouts/LoggerLayoutPattern.php b/apps/maarch_entreprise/tools/log4php/layouts/LoggerLayoutPattern.php
index 9a458d9ae3856f07da067498afb7bdd97a4d85d6..3c38add3ad97837dc62ffd797ee7fe139ba89b69 100644
--- a/apps/maarch_entreprise/tools/log4php/layouts/LoggerLayoutPattern.php
+++ b/apps/maarch_entreprise/tools/log4php/layouts/LoggerLayoutPattern.php
@@ -200,7 +200,7 @@ class LoggerLayoutPattern extends LoggerLayout {
 	 * It requires {@link $this->pattern} to be a comma separated string of patterns like
 	 * e.g. <code>%d,%c,%p,%m,%t,%F,%L</code>.
 	 * 
-	 * @return array(string)   An array of the converted elements i.e. timestamp, message, filename etc.
+	 * @return array string   An array of the converted elements i.e. timestamp, message, filename etc.
 	 */
 	public function formatToArray(LoggerLoggingEvent $event) {
 		$results = array();
diff --git a/apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf_tpl.php b/apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf_tpl.php
index dbaa1f2b18ace611fc6ea6df7c20b1f7ed929b48..d8fd6e99953bee758c3871d3b688468a9402fb3c 100644
--- a/apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf_tpl.php
+++ b/apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf_tpl.php
@@ -302,8 +302,6 @@ class FPDF_TPL extends fpdi_bridge
      *
      * See FPDF/TCPDF documentation.
      *
-     * @see http://fpdf.org/en/doc/setfont.htm
-     * @see http://www.tcpdf.org/doc/code/classTCPDF.html#afd56e360c43553830d543323e81bc045
      */
     public function SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true)
     {
@@ -328,8 +326,6 @@ class FPDF_TPL extends fpdi_bridge
      *
      * See FPDF/TCPDF documentation.
      *
-     * @see http://fpdf.org/en/doc/image.htm
-     * @see http://www.tcpdf.org/doc/code/classTCPDF.html#a714c2bee7d6b39d4d6d304540c761352
      */
     public function Image(
         $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false,
@@ -359,8 +355,6 @@ class FPDF_TPL extends fpdi_bridge
      *
      * This method cannot be used if you'd started a template.
      *
-     * @see http://fpdf.org/en/doc/addpage.htm
-     * @see http://www.tcpdf.org/doc/code/classTCPDF.html#a5171e20b366b74523709d84c349c1ced
      */
     public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)
     {
@@ -381,8 +375,6 @@ class FPDF_TPL extends fpdi_bridge
      *
      * Overwritten because adding links in a template will not work.
      *
-     * @see http://fpdf.org/en/doc/link.htm
-     * @see http://www.tcpdf.org/doc/code/classTCPDF.html#ab87bf1826384fbfe30eb499d42f1d994
      */
     public function Link($x, $y, $w, $h, $link, $spaces = 0)
     {
@@ -403,8 +395,6 @@ class FPDF_TPL extends fpdi_bridge
      *
      * Overwritten because adding links in a template will not work.
      *
-     * @see http://fpdf.org/en/doc/addlink.htm
-     * @see http://www.tcpdf.org/doc/code/classTCPDF.html#a749522038ed7786c3e1701435dcb891e
      */
     public function AddLink()
     {
@@ -425,8 +415,6 @@ class FPDF_TPL extends fpdi_bridge
      *
      * Overwritten because adding links in a template will not work.
      *
-     * @see http://fpdf.org/en/doc/setlink.htm
-     * @see http://www.tcpdf.org/doc/code/classTCPDF.html#ace5be60e7857953ea5e2b89cb90df0ae
      */
     public function SetLink($link, $y = 0, $page = -1)
     {
diff --git a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi.php b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi.php
index 22933a5814394314f68906f006cacab0f9932f66..3645989a470b4b3fd0721f91bfae846b6c2614cb 100644
--- a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi.php
+++ b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi.php
@@ -85,7 +85,8 @@ class FPDI extends FPDF_TPL {
         $fn =& $this->current_filename;
 
         if (!isset($this->parsers[$fn]))
-            $this->parsers[$fn] =& new fpdi_pdf_parser($fn,$this);
+            //$this->parsers[$fn] =& new fpdi_pdf_parser($fn,$this);
+            $this->parsers[$fn] = new fpdi_pdf_parser($fn,$this);
         $this->current_parser =& $this->parsers[$fn];
         
         return $this->parsers[$fn]->getPageCount();
diff --git a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php
index 3269fe702f1b89a8589dc3beab44d96629b07c13..e234143cbbda1ac6ab6b08584738152f27c723cd 100644
--- a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php
+++ b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/fpdi_pdf_parser.php
@@ -242,7 +242,8 @@ class fpdi_pdf_parser extends pdf_parser {
                     if (preg_match("/^\/[a-z85]*$/i", $_filter[1], $filterName) && @include_once('decoders'.$_filter[1].'.php')) {
                         $filterName = substr($_filter[1],1);
                         if (class_exists($filterName)) {
-    	                	$decoder =& new $filterName($this->fpdi);
+    	                	//$decoder = &new $filterName($this->fpdi);
+    	                	$decoder = new $filterName($this->fpdi);
     	                    $stream = $decoder->decode(trim($stream));
                         } else {
                         	$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
diff --git a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/pdf_parser.php b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/pdf_parser.php
index c72c5b43289f74e2b65e22156c4305f6f6e856c3..b8165a9e114d0d19165ce3df7c2d82db6a5e38f0 100644
--- a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/pdf_parser.php
+++ b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/pdf_parser.php
@@ -100,7 +100,8 @@ class pdf_parser {
 
         $this->getPDFVersion();
 
-        $this->c =& new pdf_context($this->f);
+        //$this->c =& new pdf_context($this->f);
+        $this->c = new pdf_context($this->f);
         // Read xref-Data
         $this->pdf_read_xref($this->xref, $this->pdf_find_xref());
 
@@ -281,7 +282,8 @@ class pdf_parser {
         
         fseek($this->f, $o_pos+$trailerPos+7);
         
-        $c =&  new pdf_context($this->f);
+        //$c =&  new pdf_context($this->f);
+        $c = new pdf_context($this->f);
 	    $trailer = $this->pdf_read_value($c);
 	    
 	    $c = null;
@@ -426,7 +428,8 @@ class pdf_parser {
 		        	$e++;
 		        
 		        if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) {
-		        	$tmp_c =& new pdf_context($this->f);
+		        	//$tmp_c =& new pdf_context($this->f);
+		        	$tmp_c = new pdf_context($this->f);
 		        	$tmp_length = $this->pdf_resolve_object($tmp_c,$this->actual_obj[1][1]['/Length']);
 		        	$length = $tmp_length[1][1];
 		        } else {
diff --git a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php
index c7747236bda88f79d5cd8f3ffd6f18664b62102a..5149b1813ca7829916a551baa8bdd392b73c1c58 100644
--- a/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php
+++ b/apps/maarch_entreprise/tools/pdfb/fpdf_fpdi/previous_version/pdf_parser.php
@@ -234,7 +234,8 @@ class pdf_parser {
 				fseek($this->f, $o_pos+strlen($m[1]));
     		}
     		
-			$c =&  new pdf_context($this->f);
+			//$c =&  new pdf_context($this->f);
+			$c = new pdf_context($this->f);
     	    $trailer = $this->pdf_read_value($c);
     	    
     	    if (isset($trailer[1]['/Prev'])) {
diff --git a/apps/maarch_entreprise/tools/phpCAS/source/CAS.php b/apps/maarch_entreprise/tools/phpCAS/source/CAS.php
index 3d84809c7730f9e22c5b95d7ba67ffc9a1141749..e70133985e7889ad9a4553b4a218ff3aa694ffef 100644
--- a/apps/maarch_entreprise/tools/phpCAS/source/CAS.php
+++ b/apps/maarch_entreprise/tools/phpCAS/source/CAS.php
@@ -138,9 +138,9 @@ define("SAML_SOAP_ENV_CLOSE", '</SOAP-ENV:Envelope>');
  */
 define("SAML_ATTRIBUTES", 'SAMLATTRIBS');
 
-/**
- * SAML Attributes
- */
+/**
+ * SAML Attributes
+ */
 define("DEFAULT_ERROR", 'Internal script failure');
 
 /** @} */
@@ -210,7 +210,7 @@ define("PHPCAS_PROXIED_SERVICE_IMAP", 'CAS_ProxiedService_Imap');
 //  LANGUAGES
 // ------------------------------------------------------------------------
 /**
- * @addtogroup publicLang
+ * addtogroup publicLang
  * @{
  */
 
@@ -302,13 +302,13 @@ class phpCAS
      */
     private static $_PHPCAS_DEBUG;
 
-    /**
+    /**
      * This variable is used to enable verbose mode
      * This pevents debug info to be show to the user. Since it's a security
      * feature the default is false
-     *
-     * @hideinitializer
-     */
+     *
+     * @hideinitializer
+     */
     private static $_PHPCAS_VERBOSE = false;
 
 
@@ -470,19 +470,19 @@ class phpCAS
         }
     }
 
-    /**
+    /**
      * Enable verbose errors messages in the website output
      * This is a security relevant since internal status info may leak an may
-     * help an attacker. Default is therefore false
-     *
-     * @param bool $verbose enable verbose output
-     *
-     * @return void
-     */
+     * help an attacker. Default is therefore false
+     *
+     * @param bool $verbose enable verbose output
+     *
+     * @return void
+     */
     public static function setVerbose($verbose)
     {
-        if ($verbose === true) {
-            self::$_PHPCAS_VERBOSE = true;
+        if ($verbose === true) {
+            self::$_PHPCAS_VERBOSE = true;
         } else {
             self::$_PHPCAS_VERBOSE = false;
         }
@@ -490,13 +490,13 @@ class phpCAS
 
 
     /**
-     * Show is verbose mode is on
-     *
-     * @return boot verbose
-     */
-    public static function getVerbose()
-    {
-        return self::$_PHPCAS_VERBOSE;
+     * Show is verbose mode is on
+     *
+     * @return boot verbose
+     */
+    public static function getVerbose()
+    {
+        return self::$_PHPCAS_VERBOSE;
     }
 
     /**
diff --git a/apps/maarch_entreprise/tools/phpCAS/source/CAS/Client.php b/apps/maarch_entreprise/tools/phpCAS/source/CAS/Client.php
index 1c3d35999c77025b32a7882882f8206a2d788ec9..23e6ec690800ed6d2bdddeb85aba01de66a55fdc 100755
--- a/apps/maarch_entreprise/tools/phpCAS/source/CAS/Client.php
+++ b/apps/maarch_entreprise/tools/phpCAS/source/CAS/Client.php
@@ -85,7 +85,6 @@ class CAS_Client
      * CAS_Client::setHTMLHeader(), read by CAS_Client::printHTMLHeader().
      *
      * @hideinitializer
-     * @see CAS_Client::setHTMLHeader, CAS_Client::printHTMLHeader()
      */
     private $_output_header = '';
 
@@ -115,7 +114,6 @@ class CAS_Client
      * CAS_Client::setHTMLFooter(), read by printHTMLFooter().
      *
      * @hideinitializer
-     * @see CAS_Client::setHTMLFooter, CAS_Client::printHTMLFooter()
      */
     private $_output_footer = '';
 
diff --git a/apps/maarch_entreprise/tools/phpids/lib/IDS/Report.php b/apps/maarch_entreprise/tools/phpids/lib/IDS/Report.php
index 675b97641f1259de4f01497eb39f0b990fd0ec23..6b8c282d2be45c5b7e2de91cd6318d4ac589b012 100755
--- a/apps/maarch_entreprise/tools/phpids/lib/IDS/Report.php
+++ b/apps/maarch_entreprise/tools/phpids/lib/IDS/Report.php
@@ -255,7 +255,7 @@ class IDS_Report implements Countable, IteratorAggregate
      * This method returns the centrifuge property or null if not
      * filled with data
      *
-     * @return array/null
+     * @return array or null
      */
     public function getCentrifuge()
     {
diff --git a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/AttrCollections.php b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/AttrCollections.php
index 2a8aaa3d3ecec5450f50c92427b85774674e2cfd..2b3df8fbae50c5024f281c1bd9127860fe99086c 100755
--- a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/AttrCollections.php
+++ b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/AttrCollections.php
@@ -49,7 +49,7 @@ class HTMLPurifier_AttrCollections
     /**
      * Takes a reference to an attribute associative array and performs
      * all inclusions specified by the zero index.
-     * @param &$attr Reference to attribute array
+     * @param $attr Reference to attribute array
      */
     public function performInclusions(&$attr) {
         if (!isset($attr[0])) return;
@@ -76,7 +76,7 @@ class HTMLPurifier_AttrCollections
     /**
      * Expands all string identifiers in an attribute array by replacing
      * them with the appropriate values inside HTMLPurifier_AttrTypes
-     * @param &$attr Reference to attribute array
+     * @param $attr Reference to attribute array
      * @param $attr_types HTMLPurifier_AttrTypes instance
      */
     public function expandIdentifiers(&$attr, $attr_types) {
diff --git a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
index 4230c2c501c84b16af5b6c2dfa4a5922103528a9..ca13e30f7d023b2fe7a97fea005fd5fcaabaa8c3 100755
--- a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
+++ b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
@@ -76,7 +76,7 @@ class HTMLPurifier_DefinitionCacheFactory
 
     /**
      * Registers a decorator to add to all new cache objects
-     * @param
+     * @param decorator
      */
     public function addDecorator($decorator) {
         if (is_string($decorator)) {
diff --git a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLDefinition.php b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLDefinition.php
index 2454c9c0e31d08f278f166df881be519438e5b6c..bddcefb2cded8032883d87e838d1a3e6a20769ad 100755
--- a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLDefinition.php
+++ b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLDefinition.php
@@ -386,7 +386,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
      * @warning Although it's largely drawn from TinyMCE's implementation,
      *      it is different, and you'll probably have to modify your lists
      * @param $list String list to parse
-     * @param array($allowed_elements, $allowed_attributes)
+     * @param array $allowed_elements, $allowed_attributes
      * @todo Give this its own class, probably static interface
      */
     public function parseTinyMCEAllowedList($list) {
diff --git a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
index 22ec582136f1267ac21a45ec92b0a2007ef1965d..51db706b8aee2f6c00d320e167a49729b210c5c6 100755
--- a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
+++ b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
@@ -165,7 +165,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
      * Parses a fix name and determines what kind of fix it is, as well
      * as other information defined by the fix
      * @param $name String name of fix
-     * @return array(string $fix_type, array $fix_parameters)
+     * @return array string $fix_type, array $fix_parameters
      * @note $fix_parameters is type dependant, see populate() for usage
      *       of these parameters
      */
diff --git a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/Injector.php b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/Injector.php
index 52dc8096daecbfe50005c6adf4994c013edda3ed..1e16e68322c5211147e31d1b87bf4196a05c3cd4 100755
--- a/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/Injector.php
+++ b/apps/maarch_entreprise/tools/phpids/lib/IDS/vendors/htmlpurifier/HTMLPurifier/Injector.php
@@ -151,8 +151,8 @@ abstract class HTMLPurifier_Injector
      * you reach the end of the input tokens.
      * @warning Please prevent previous references from interfering with this
      *          functions by setting $i = null beforehand!
-     * @param &$i Current integer index variable for inputTokens
-     * @param &$current Current token variable. Do NOT use $token, as that variable is also a reference
+     * @param $i Current integer index variable for inputTokens
+     * @param $current Current token variable. Do NOT use $token, as that variable is also a reference
      */
     protected function forward(&$i, &$current) {
         if ($i === null) $i = $this->inputIndex + 1;
@@ -184,8 +184,8 @@ abstract class HTMLPurifier_Injector
      * you reach the beginning of input tokens.
      * @warning Please prevent previous references from interfering with this
      *          functions by setting $i = null beforehand!
-     * @param &$i Current integer index variable for inputTokens
-     * @param &$current Current token variable. Do NOT use $token, as that variable is also a reference
+     * @param $i Current integer index variable for inputTokens
+     * @param $current Current token variable. Do NOT use $token, as that variable is also a reference
      */
     protected function backward(&$i, &$current) {
         if ($i === null) $i = $this->inputIndex - 1;
@@ -201,8 +201,8 @@ abstract class HTMLPurifier_Injector
      * current location.
      * @warning Please prevent previous references from interfering with this
      *          functions by setting $i = null beforehand!
-     * @param &$i Current integer index variable for inputTokens
-     * @param &$current Current token variable. Do NOT use $token, as that variable is also a reference
+     * @param $i Current integer index variable for inputTokens
+     * @param $current Current token variable. Do NOT use $token, as that variable is also a reference
      */
     protected function current(&$i, &$current) {
         if ($i === null) $i = $this->inputIndex;
diff --git a/apps/maarch_entreprise/tools/phpqrcode/bindings/tcpdf/qrcode.php b/apps/maarch_entreprise/tools/phpqrcode/bindings/tcpdf/qrcode.php
index 7995460b521583966c0a4811cb1e5b62033d35c3..cbf5e637c0aeaac624c13506a873ced52342b730 100644
--- a/apps/maarch_entreprise/tools/phpqrcode/bindings/tcpdf/qrcode.php
+++ b/apps/maarch_entreprise/tools/phpqrcode/bindings/tcpdf/qrcode.php
@@ -408,7 +408,7 @@ if (!class_exists('QRcode', false)) {
 		protected $blocks;
 
 		/**
-		 * @var Reed-Solomon blocks
+		 * @var ReedSolomon blocks
 		 * @access protected
 		 */
 		protected $rsblocks = array(); //of RSblock
@@ -462,7 +462,7 @@ if (!class_exists('QRcode', false)) {
 		// Reed-Solomon items
 
 		/**
-		 * @var Reed-Solomon items
+		 * @var ReedSolomon items
 		 * @access protected
 		 */
 		protected $rsitems = array();
@@ -474,7 +474,7 @@ if (!class_exists('QRcode', false)) {
 		protected $frames = array();
 
 		/**
-		 * @var alphabet-numeric convesion table
+		 * @var alphabetnumeric convesion table
 		 * @access protected
 		 */
 		protected $anTable = array(
@@ -867,7 +867,7 @@ if (!class_exists('QRcode', false)) {
 		/**
 		 * Initialize code.
 		 * @param array $spec array of ECC specification
-		 * @return 0 in case of success, -1 in case of error
+		 * @return integer 0 in case of success, -1 in case of error
 		 */
 		protected function init($spec) {
 			$dl = $this->rsDataCodes1($spec);
diff --git a/apps/maarch_entreprise/tools/phpqrcode/phpqrcode.php b/apps/maarch_entreprise/tools/phpqrcode/phpqrcode.php
index 995428f601b866430840ecdb73afb75c97ec1f9f..e5237d6e4fe7b9153ea817ef95931faff1ac74c4 100644
--- a/apps/maarch_entreprise/tools/phpqrcode/phpqrcode.php
+++ b/apps/maarch_entreprise/tools/phpqrcode/phpqrcode.php
@@ -587,7 +587,7 @@
          * Put an alignment marker.
          * @param frame
          * @param width
-         * @param ox,oy center coordinate of the pattern
+         * @param ox oy center coordinate of the pattern
          */
         public static function putAlignmentMarker(array &$frame, $ox, $oy)
         {
@@ -699,7 +699,7 @@
          * Put a finder pattern.
          * @param frame
          * @param width
-         * @param ox,oy upper-left coordinate of the pattern
+         * @param ox oy upper-left coordinate of the pattern
          */
         public static function putFinderPattern(&$frame, $ox, $oy)
         {
diff --git a/apps/maarch_entreprise/tools/phpqrcode/qrspec.php b/apps/maarch_entreprise/tools/phpqrcode/qrspec.php
index 92aea0c7894db01eee46e93d7c8dcf6f7d5c132b..ccef8172105af9584d92e86266a0bbfe30f3711c 100644
--- a/apps/maarch_entreprise/tools/phpqrcode/qrspec.php
+++ b/apps/maarch_entreprise/tools/phpqrcode/qrspec.php
@@ -275,7 +275,7 @@
          * Put an alignment marker.
          * @param frame
          * @param width
-         * @param ox,oy center coordinate of the pattern
+         * @param ox oy center coordinate of the pattern
          */
         public static function putAlignmentMarker(array &$frame, $ox, $oy)
         {
@@ -387,7 +387,7 @@
          * Put a finder pattern.
          * @param frame
          * @param width
-         * @param ox,oy upper-left coordinate of the pattern
+         * @param ox oy upper-left coordinate of the pattern
          */
         public static function putFinderPattern(&$frame, $ox, $oy)
         {
diff --git a/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTree.class.php b/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTree.class.php
index 9af7a7af21fe8f84e353092a4dd320d7fcb5ed2e..f1fa128650fd6859d73248925cb359ea7ddcdd8a 100644
--- a/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTree.class.php
+++ b/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTree.class.php
@@ -13,7 +13,7 @@ class TafelTree {
 	
 	/**
 	 *------------------------------------------------------------------------------
-	 *							Propriétés
+	 *							Propri�t�s
 	 *------------------------------------------------------------------------------
 	 */
 	
@@ -58,7 +58,7 @@ class TafelTree {
 	 * Constructeur
 	 *
 	 * @access	public
-	 * @param	string				id					L'id de l'élément HTML conteneur
+	 * @param	string				id					L'id de l'�l�ment HTML conteneur
 	 * @param	string				imgBase				Le path vers les images
 	 * @param	integer				width				La largeur de l'arbre
 	 * @param	integer				height				La hauteur de l'arbre
@@ -80,10 +80,11 @@ class TafelTree {
 	 *
 	 * @access	public
 	 * @param 	string			$json					La string JSON
-	 * @return 	TafelTree								Le TafelTree créé
+	 * @return 	TafelTree								Le TafelTree cr��
 	 */
 	function &loadJSON ($json, $id, $imgs = 'imgs/', $width = '100%', $height = 'auto', $options = array()) {
-		$tree =& new TafelTree($id, $imgs, $width, $height, $options);
+		//$tree =& new TafelTree($id, $imgs, $width, $height, $options);
+		$tree = new TafelTree($id, $imgs, $width, $height, $options);
 		$service = new Services_JSON();
 		$tree->items =& TafelTree::loadServiceJSON($service->decode($json));
 		return $tree;
@@ -94,7 +95,7 @@ class TafelTree {
 	 *
 	 * @access	public
 	 * @param 	Service_JSON	$service				L'objet Service_JSON
-	 * @return 	array									Les TafelTreeBranch créées
+	 * @return 	array									Les TafelTreeBranch cr��es
 	 */
 	function &loadServiceJSON ($service) {
 		$branches = array();
@@ -136,7 +137,7 @@ class TafelTree {
 	 * Ajoute une branche comme enfant
 	 *
 	 * @access 	public
-	 * @param 	TafelTreeBranch		$branch				La branche à ajouter
+	 * @param 	TafelTreeBranch		$branch				La branche � ajouter
 	 * @return 	void
 	 */
 	function &add ($branch) {
@@ -147,16 +148,17 @@ class TafelTree {
 	}
 	
 	/**
-	 * Ajoute une sous-branche à l'arbre
+	 * Ajoute une sous-branche � l'arbre
 	 *
 	 * @access 	public
 	 * @param 	string			$id						L'id de la sous-branche
 	 * @param 	string			$txt					Le texte de la sous-branche
-	 * @param 	array			$options				Les informations complémentaires
+	 * @param 	array			$options				Les informations compl�mentaires
 	 * @return 	TafelTreeBranch							La sous-branche
 	 */
 	function &addBranch ($id, $txt, $options = array()) {
-		$branch =& new TafelTreeBranch ();
+		//$branch =& new TafelTreeBranch ();
+		$branch = new TafelTreeBranch ();
 		$branch->setId($id);
 		$branch->setText($txt);
 		foreach ($options as $property => $value) {
@@ -177,11 +179,11 @@ class TafelTree {
 	}
 	
 	/**
-	 * Affiche la méthode d'initialisation de l'arbre
+	 * Affiche la m�thode d'initialisation de l'arbre
 	 *
 	 * @access 	public
 	 * @param 	integer			$debug					Mettre 1 ou 2 pour avoir un affichage plus lisible
-	 * @return 	string									La string de la méthode JS d'initialisation
+	 * @return 	string									La string de la m�thode JS d'initialisation
 	 */
 	function display ($debug = 0) {
 		if ($debug == 1) {
diff --git a/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTreeBranch.class.php b/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTreeBranch.class.php
index 8ce671977b23e4bdd537b66d975cc6e73140dc02..c59a45f356748c948dcbb3dda54d23b8840db2d3 100644
--- a/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTreeBranch.class.php
+++ b/apps/maarch_entreprise/tools/tafelTree/server/php4/TafelTreeBranch.class.php
@@ -10,7 +10,7 @@ class TafelTreeBranch {
 	
 	/**
 	 *------------------------------------------------------------------------------
-	 *							Propriétés
+	 *							Propri�t�s
 	 *------------------------------------------------------------------------------
 	 */
 	
@@ -46,7 +46,7 @@ class TafelTreeBranch {
 	 *
 	 * @access	public
 	 * @param 	string			$json					La string JSON
-	 * @return 	array									Les TafelTreeBranch créées
+	 * @return 	array									Les TafelTreeBranch cr��es
 	 */
 	function &loadJSON ($json) {
 		$service = new Services_JSON();
@@ -63,11 +63,12 @@ class TafelTreeBranch {
 	 *
 	 * @access	public
 	 * @param 	Service_JSON	$service				L'objet Service_JSON
-	 * @return 	array									Les TafelTreeBranch créées
+	 * @return 	array									Les TafelTreeBranch cr��es
 	 */
 	function &loadServiceJSON ($service) {
-		$branch =& new TafelTreeBranch();
-		// On check toutes les propriétés de branche
+		//$branch =& new TafelTreeBranch();
+		$branch = new TafelTreeBranch();
+		// On check toutes les propri�t�s de branche
 		foreach ($service as $property => $value) {
 			if ($property != 'items') {
 				$branch->setParam($property, $value);
@@ -124,7 +125,7 @@ class TafelTreeBranch {
 	 * Ajoute une branche comme enfant
 	 *
 	 * @access 	public
-	 * @param 	TafelTreeBranch		$branch				La branche à ajouter
+	 * @param 	TafelTreeBranch		$branch				La branche � ajouter
 	 * @return 	void
 	 */
 	function &add ($branch) {
@@ -135,16 +136,17 @@ class TafelTreeBranch {
 	}
 	
 	/**
-	 * Ajoute une sous-branche à la branche courante
+	 * Ajoute une sous-branche � la branche courante
 	 *
 	 * @access 	public
 	 * @param 	string			$id						L'id de la sous-branche
 	 * @param 	string			$txt					Le texte de la sous-branche
-	 * @param 	array			$options				Les informations complémentaires
+	 * @param 	array			$options				Les informations compl�mentaires
 	 * @return 	TafelTreeBranch							La sous-branche
 	 */
 	function &addBranch ($id, $txt, $options = array()) {
-		$branch =& new TafelTreeBranch ();
+		//$branch =& new TafelTreeBranch ();
+		$branch = new TafelTreeBranch ();
 		$branch->setId($id);
 		$branch->setText($txt);
 		foreach ($options as $property => $value) {
@@ -165,7 +167,7 @@ class TafelTreeBranch {
 	}
 	
 	/**
-	 * Retourne la string JSON qui correspond à la structure de la branche et sous-branches
+	 * Retourne la string JSON qui correspond � la structure de la branche et sous-branches
 	 *
 	 * @access 	public
 	 * @return 	string									La string JSON de la branche
diff --git a/apps/maarch_entreprise/tools/tafelTree/server/php4_sample.php b/apps/maarch_entreprise/tools/tafelTree/server/php4_sample.php
index d2aed0d84c03fa407a62553c0eb16bec17b8be01..7e1b5618d27bef7c56a6ea2c2b3dd5aa3b3d4ccc 100644
--- a/apps/maarch_entreprise/tools/tafelTree/server/php4_sample.php
+++ b/apps/maarch_entreprise/tools/tafelTree/server/php4_sample.php
@@ -36,7 +36,8 @@ echo '</ul>';
 
 // Create the tree (same options as javascript). In this sample, the file
 // drop.php doesn't exist. It's just to show how to manage ajax declarations
-$tree =& new TafelTree('divTree', '../imgs/', null, null, array(
+//$tree =& new TafelTree('divTree', '../imgs/', null, null, array(
+$tree = new TafelTree('divTree', '../imgs/', null, null, array(
 	'generate' => true,
 	'onMouseOver'=>'myMouseover',
 	'onMouseOut'=>'myMouseout',
diff --git a/core/Controllers/DocserverToolsController.php b/core/Controllers/DocserverToolsController.php
index 7d883fd3cbccfcccac3e445b7a2907f613e750e8..4a00964605e77c18aae8546ea86416501d55a02d 100644
--- a/core/Controllers/DocserverToolsController.php
+++ b/core/Controllers/DocserverToolsController.php
@@ -26,7 +26,7 @@ class DocserverToolsController
     /**
      * Compute the path in the docserver for a batch
      * @param $docServer docservers path
-     * @return @return array Contains 2 items : subdirectory path and error
+     * @return  array Contains 2 items : subdirectory path and error
      */
     public function createPathOnDocServer($aArgs)
     {
diff --git a/core/Controllers/ResController.php b/core/Controllers/ResController.php
index c09d5d6e593f7c533d7042cf934ed40992751f68..87ed7232c351738542526041128416d49130fbcd 100644
--- a/core/Controllers/ResController.php
+++ b/core/Controllers/ResController.php
@@ -158,7 +158,7 @@ class ResController
      * @param  $docserverId string
      * @param  $status string
      * @param  $fileFormat string
-     * @return $data
+     * @return array $data
      */
     public function prepareStorage($aArgs)
     {
diff --git a/core/class/SecurityControler.php b/core/class/SecurityControler.php
index 381e6d72b642133021142fd31933db1d4cc3c4ef..3239727ac50f85a155842aa30f5e45430805eb87 100644
--- a/core/class/SecurityControler.php
+++ b/core/class/SecurityControler.php
@@ -576,7 +576,7 @@ class SecurityControler
     /**
      * Give action bitmask for given $userId over given
      * object
-     * @param varchar(32) $userId
+     * @param string $userId
      * @param bigint $objectId
      * @return bitmask
      */
@@ -597,7 +597,7 @@ class SecurityControler
      * bitmask, according with given user
      * and aggregation.
      * Return computed bitmask
-     * @param varchar(32) $userId
+     * @param string $userId
      * @param bigint $objectId
      * @return bitmask
      */
diff --git a/core/class/class_functions.php b/core/class/class_functions.php
index 9331bd4bfe3a258f20ae808bfa1d54c67ae6efa1..71a82519e66dbb7bdefa86cd4e5e7d1c0b84d968 100644
--- a/core/class/class_functions.php
+++ b/core/class/class_functions.php
@@ -1039,7 +1039,7 @@ class functions
     *
     * @param  $date1 date First date
     * @param  $date2 date Second date
-    * @return "date1" if the first date is the greater, "date2" if the second date or "equal" otherwise
+    * @return date1 if the first date is the greater, date2 if the second date or "equal" otherwise
     */
     public function compare_date($date1, $date2)
     {
diff --git a/core/class/class_history.php b/core/class/class_history.php
index ff07ee3f07860e0ab1758b48e19e62f44ab9dfea..6c3cc6ec28b1c0fd570ba77aba909ae32aeed927 100644
--- a/core/class/class_history.php
+++ b/core/class/class_history.php
@@ -81,11 +81,11 @@ class history
     * @param $event_id
     * @param $info
     * @param $databasetype
-    * @param [$id_module = 'admin']
-    * @param [$isTech = false]
-    * @param [$result = _OK]
-    * @param [$level = _LEVEL_DEBUG]
-    * @param [$user = '']
+    * @param $id_module = 'admin'
+    * @param $isTech = false
+    * @param $result = _OK
+    * @param $level = _LEVEL_DEBUG
+    * @param $user = ''
     */
     public function add(
         $table_name,
@@ -194,7 +194,7 @@ class history
     *
     * @param  $id
     *
-    * @return  (string) => Label of the key word or empty string
+    * @return  string => Label of the key word or empty string
     */
     public function get_label_history_keyword(
         $id
@@ -216,10 +216,10 @@ class history
     /**
     * Delete accents
     *
-    * @param  $str (string)
-    * @param  [$charset = 'utf-8'] (string)
+    * @param  $str string
+    * @param  $charset = 'utf-8' (string)
     *
-    * @return  $str (string)
+    * @return  string $str
     */
     private function wd_remove_accents(
         $str,
diff --git a/core/docservers_tools.php b/core/docservers_tools.php
index 66b06777639a62d268e08a0c04a89d8beca7fa7f..cd3e3a386e15dc8794d27b5d400d79eb1894c084 100644
--- a/core/docservers_tools.php
+++ b/core/docservers_tools.php
@@ -115,7 +115,7 @@ function Ds_copyOnDocserver(
 /**
  * Compute the path in the docserver for a batch
  * @param $docServer docservers path
- * @return @return array Contains 2 items : subdirectory path and error
+ * @return array Contains 2 items : subdirectory path and error
  */
 function Ds_createPathOnDocServer($docServer)
 {
diff --git a/core/services/CoreConfigAbstract.php b/core/services/CoreConfigAbstract.php
index 977aeef4f3d3e9173d7e91ddc9ffdfc79653a609..2b5f4067c84a351816e1c242bb16e3dec257f012 100644
--- a/core/services/CoreConfigAbstract.php
+++ b/core/services/CoreConfigAbstract.php
@@ -481,7 +481,7 @@ class Core_CoreConfigAbstract_Service extends Core_Abstract_Service {
     /**
      * Loads the modules specific vars into session
      * @param  array $modules  Enabled modules of the application
-     * @param  [type] $userData [description]
+     * @param  array $userData [description]
      */
     public static function loadVarSession($modules, $userData)
     {
@@ -522,7 +522,7 @@ class Core_CoreConfigAbstract_Service extends Core_Abstract_Service {
     /**
     * Loads menu items of each module and the application into session from menu.xml files
     * @param  array $modules Enabled modules of the application
-    * @return [type]          [description]
+    * @return string          [description]
     */
     public static  function loadMenu($modules)
     {
diff --git a/core/services/StringAbstract.php b/core/services/StringAbstract.php
index 816e92e1d4eb649b52a2f3de820d9bcc448155fc..11e19b2c290365fef4015cb003fa091ef8ec085d 100644
--- a/core/services/StringAbstract.php
+++ b/core/services/StringAbstract.php
@@ -27,9 +27,9 @@ class Core_StringAbstract_Service extends Core_Abstract_Service {
     * Delete accents
     *
     * @param  $str (string)
-    * @param  [$charset = 'utf-8'] (string)
+    * @param  $charset = 'utf-8' (string)
     *
-    * @return  $str (string)
+    * @return  string $str
     */
     public static function wd_remove_accents(
         $str,
diff --git a/modules/attachments/Controllers/AttachmentsController.php b/modules/attachments/Controllers/AttachmentsController.php
index cf9235259f8105f8d3937d2eaa306d448fc8b762..51833cb430ccbb540615fee5c35656c61b5e6b58 100644
--- a/modules/attachments/Controllers/AttachmentsController.php
+++ b/modules/attachments/Controllers/AttachmentsController.php
@@ -129,7 +129,7 @@ class AttachmentsController
      * @param  $data array
      * @param  $resId bigint
      * @param  $collIdMaster string
-     * @return $data
+     * @return array $data
      */
     public function prepareStorage($aArgs)
     {
@@ -272,4 +272,151 @@ class AttachmentsController
         return $return;
     }
 
+    /**
+     * Prepares storage for transmission.
+     * @param  $nb integer
+     * @return array $data
+     */
+    public function setTransmissionData($aArgs)
+    {
+        if (empty($aArgs['nb'])) {
+
+            return ['errors' => 'nb ' . _EMPTY];
+        }
+
+        $transmissionData = [];
+
+        $transmissionData[] = [
+            'column' => 'format',
+            'value' => $_SESSION['upfileTransmission'][$nb]['format'],
+            'type' => 'string'
+        ];
+        
+        if (!empty($_REQUEST["transmissionExpectedDate{$nb}"])) {
+            $rturn = $_REQUEST["transmissionExpectedDate{$nb}"];
+        } else {
+            $rturn = 'NO_RTURN';
+        }
+        //TODO
+        $transmissionData[] = [
+            'column' => 'status',
+            'value' => $rturn,
+            'type' => 'string'
+        ];
+        
+        $transmissionData[] = [
+            'column' => 'title',
+            'value' => str_replace("&#039;", "'", $_REQUEST["transmissionTitle{$nb}"]),
+            'type' => 'string'
+        ];
+        $transmissionData[] = [
+            'column' => 'attachment_type',
+            'value' => $_REQUEST["transmissionType{$nb}"],
+            'type' => 'string'
+        ];
+        $transmissionData[] = [
+            'column' => 'coll_id',
+            'value' => $_SESSION['collection_id_choice'],
+            'type' => 'string'
+        ];
+        //TODO
+        $transmissionData[] = [
+            'column' => 'res_id_master',
+            'value' => $_SESSION['doc_id'],
+            'type' => 'integer'
+        ];
+        $transmissionData[] = [
+            'column' => 'identifier',
+            'value' => $_REQUEST["transmissionChrono{$nb}"],
+            'type' => 'string'
+        ];
+
+        if (!empty($_REQUEST["transmissionBackDate{$nb}"])) {
+            $transmissionData[] = [
+                'column' => 'validation_date',
+                'value' => $_REQUEST["transmissionBackDate{$nb}"],
+                'type' => 'date'
+            ];
+        }
+
+        if (
+            !empty($_REQUEST["transmissionContactidAttach{$nb}"]) && 
+            is_numeric($_REQUEST["transmissionContactidAttach{$nb}"])
+        ) {
+            $transmissionData[] = [
+                'column' => 'dest_contact_id',
+                'value' => $_REQUEST["transmissionContactidAttach{$nb}"],
+                'type' => 'integer'
+            ];
+        } else if (
+            !empty($_REQUEST["transmissionContactidAttach{$nb}"]) && 
+            !is_numeric($_REQUEST["transmissionContactidAttach{$nb}"])
+        ) {
+            $transmissionData[] = [
+                'column' => 'dest_user',
+                'value' => $_REQUEST["transmissionContactidAttach{$nb}"],
+                'type' => 'string'
+            ];
+        }
+
+        if (
+            !empty($_REQUEST["transmissionAddressidAttach{$nb}"]) && 
+            is_numeric($_REQUEST["transmissionAddressidAttach{$nb}"])
+        ) {
+            $transmissionData[] = [
+                'column' => 'dest_address_id',
+                'value' => $_REQUEST["transmissionAddressidAttach{$nb}"],
+                'type' => 'integer'
+            ];
+        }
+
+        return $transmissionData;
+    }
+
+    function setTransmissionDataPdf($aArgs, $nb, $storeResult) 
+    {
+        $transmissionDataPdf = [];
+
+        //TODO
+        $file    = $_SESSION['config']['tmppath'] . $_SESSION['upfileTransmission'][$nb]['fileNamePdfOnTmp'];
+        $newfile = $storeResult['path_template'] . str_replace('#',"/",$storeResult['destination_dir']) . substr ($storeResult['file_destination_name'], 0, strrpos  ($storeResult['file_destination_name'], "." )) . '.pdf';
+
+        copy($file, $newfile);
+
+        $transmissionDataPdf[] = [
+            'column' => 'format',
+            'value' => 'pdf',
+            'type' => 'string'
+        ];
+        //TODO
+        $transmissionDataPdf[] = [
+            'column' => 'status',
+            'value' => 'TRA',
+            'type' => 'string'
+        ];
+        $transmissionDataPdf[] = [
+            'column' => 'title',
+            'value' => str_replace("&#039;", "'", $_REQUEST["transmissionTitle{$nb}"]),
+            'type' => 'string'
+        ];
+        $transmissionDataPdf[] = [
+            'column' => 'attachment_type',
+            'value' => 'converted_pdf',
+            'type' => 'string'
+        ];
+        $transmissionDataPdf[] = [
+            'column' => 'coll_id',
+            'value' => $_SESSION['collection_id_choice'],
+            'type' => 'string'
+        ];
+        //TODO
+        $transmissionDataPdf[] = [
+            'column' => 'res_id_master',
+            'value' => $_SESSION['doc_id'],
+            'type' => 'integer'
+        ];
+        
+        return $transmissionDataPdf;
+    }
+
 }
\ No newline at end of file
diff --git a/modules/attachments/Test/AttachmentsControllerTest.php b/modules/attachments/Test/AttachmentsControllerTest.php
index 9e34ffb54c6af98f5437b611933199447c261b60..14ab3fe339744a19a3f851cecdafc9e567e2af96 100644
--- a/modules/attachments/Test/AttachmentsControllerTest.php
+++ b/modules/attachments/Test/AttachmentsControllerTest.php
@@ -56,6 +56,19 @@ class AttachmentsControllerTest extends PHPUnit_Framework_TestCase
         $this->assertArrayHasKey('column', $response['data'][0]);
     }
 
+    public function testSetTransmissionData()
+    {
+        $action = new \Attachments\Controllers\AttachmentsController();
+
+        $aArgs = [
+            'nb' => 2,
+        ];
+
+        $response = $action->setTransmissionData($aArgs);
+        
+        $this->assertArrayHasKey('column', $response[0]);
+    }
+
     public function testStoreAttachmentResource()
     {
         $action = new \Attachments\Controllers\AttachmentsController();
diff --git a/modules/attachments/attachments_content_new.php b/modules/attachments/attachments_content_new.php
new file mode 100644
index 0000000000000000000000000000000000000000..681ccdd5824b36e05b434f6b4aa88b02d81af001
--- /dev/null
+++ b/modules/attachments/attachments_content_new.php
@@ -0,0 +1,1958 @@
+<?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 Attachments main page
+* @author dev@maarch.org
+* @ingroup attachments
+*/
+
+require_once "core/class/class_security.php";
+require_once "core/class/class_request.php";
+require_once "core/class/class_resource.php";
+require_once "apps" . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
+    . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR
+    . "class_indexing_searching_app.php";
+require_once "core/class/docservers_controler.php";
+require_once 'modules/attachments/attachments_tables.php';
+require_once "core/class/class_history.php";
+require_once 'modules/attachments/class/attachments_controler.php';
+
+
+$core               = new core_tools();
+$core->load_lang();
+$sec                = new security();
+$func               = new functions();
+$db                 = new Database();
+$req                = new request();
+$docserverControler = new docservers_controler();
+$ac                 = new attachments_controler();
+
+$_SESSION['error'] = "";
+
+$status = 0;
+$error  = $content = $js = $parameters = '';
+$_SESSION['cm_applet'][$_SESSION['user']['UserId']] = '';
+
+function _parse($text) {
+    $text = str_replace("\r\n", "\n", $text);
+    $text = str_replace("\r", "\n", $text);
+    $text = str_replace("\n", "\\n ", $text);
+    return $text;
+}
+
+function checkTransmissionError($nb) {
+    if (empty($_REQUEST["transmissionType{$nb}"]) && empty($_REQUEST["transmissionChrono{$nb}"]) && empty($_REQUEST["transmissionTitle{$nb}"]))
+        return false;
+    if (empty($_REQUEST["transmissionType{$nb}"]) || empty($_REQUEST["transmissionChrono{$nb}"])) {
+        $_SESSION['error'] .= "Transmission {$nb} : " . _ATTACHMENT_TYPES . ' ' . _MANDATORY . ". ";
+        return false;
+    }
+    if (empty($_REQUEST["transmissionTitle{$nb}"])) {
+        $_SESSION['error'] .= "Transmission {$nb} : " . _OBJECT . ' ' . _MANDATORY . ". ";
+        return false;
+    }
+    return true;
+}
+
+// function setTransmissionData($nb, $storeResult) {
+//     $func = new functions();
+//     $transmissionData = [];
+
+//     $transmissionData[] = [
+//         'column' => 'typist',
+//         'value' => $_SESSION['user']['UserId'],
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'format',
+//         'value' => $_SESSION['upfileTransmission'][$nb]['format'],
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'docserver_id',
+//         'value' => $storeResult['docserver_id'],
+//         'type' => 'string'
+//     ];
+//     if (!empty($_REQUEST["transmissionExpectedDate{$nb}"])) {
+//         $rturn = $_REQUEST["transmissionExpectedDate{$nb}"];
+//     } else {
+//         $rturn = 'NO_RTURN';
+//     }
+//     $transmissionData[] = [
+//         'column' => 'status',
+//         'value' => $func->protect_string_db($rturn),
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'offset_doc',
+//         'value' => ' ',
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'logical_adr',
+//         'value' => ' ',
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'title',
+//         'value' => str_replace("&#039;", "'", $_REQUEST["transmissionTitle{$nb}"]),
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'attachment_type',
+//         'value' => $func->protect_string_db($_REQUEST["transmissionType{$nb}"]),
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'coll_id',
+//         'value' => $_SESSION['collection_id_choice'],
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'res_id_master',
+//         'value' => $_SESSION['doc_id'],
+//         'type' => 'integer'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'identifier',
+//         'value' => $_REQUEST["transmissionChrono{$nb}"],
+//         'type' => 'string'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'type_id',
+//         'value' => 0,
+//         'type' => 'int'
+//     ];
+//     $transmissionData[] = [
+//         'column' => 'relation',
+//         'value' => 1,
+//         'type' => 'int'
+//     ];
+
+//     if (!empty($_REQUEST["transmissionBackDate{$nb}"])) {
+//         $transmissionData[] = [
+//             'column' => 'validation_date',
+//             'value' => $func->format_date_db($_REQUEST["transmissionBackDate{$nb}"]),
+//             'type' => 'date'
+//         ];
+//     }
+
+//     if (!empty($_REQUEST["transmissionContactidAttach{$nb}"]) && is_numeric($_REQUEST["transmissionContactidAttach{$nb}"])) {
+//         $transmissionData[] = [
+//             'column' => 'dest_contact_id',
+//             'value' => $_REQUEST["transmissionContactidAttach{$nb}"],
+//             'type' => 'integer'
+//         ];
+//     } else if (!empty($_REQUEST["transmissionContactidAttach{$nb}"]) && !is_numeric($_REQUEST["transmissionContactidAttach{$nb}"])) {
+//         $transmissionData[] = [
+//             'column' => 'dest_user',
+//             'value' => $_REQUEST["transmissionContactidAttach{$nb}"],
+//             'type' => 'string'
+//         ];
+//     }
+
+//     if (!empty($_REQUEST["transmissionAddressidAttach{$nb}"]) && is_numeric($_REQUEST["transmissionAddressidAttach{$nb}"])) {
+//         $transmissionData[] = [
+//             'column' => 'dest_address_id',
+//             'value' => $_REQUEST["transmissionAddressidAttach{$nb}"],
+//             'type' => 'integer'
+//         ];
+//     }
+
+//     return $transmissionData;
+// }
+
+// function setTransmissionDataPdf($nb, $storeResult) {
+//     $transmissionDataPdf = [];
+
+// //    $_SESSION['new_id'] = $id;
+//     $file    = $_SESSION['config']['tmppath'] . $_SESSION['upfileTransmission'][$nb]['fileNamePdfOnTmp'];
+//     $newfile = $storeResult['path_template'] . str_replace('#',"/",$storeResult['destination_dir']) . substr ($storeResult['file_destination_name'], 0, strrpos  ($storeResult['file_destination_name'], "." )) . '.pdf';
+
+//     copy($file, $newfile);
+
+//     $transmissionDataPdf[] = [
+//         'column' => 'typist',
+//         'value' => $_SESSION['user']['UserId'],
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'format',
+//         'value' => 'pdf',
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'docserver_id',
+//         'value' => $storeResult['docserver_id'],
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'status',
+//         'value' => 'TRA',
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'offset_doc',
+//         'value' => ' ',
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'logical_adr',
+//         'value' => ' ',
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'title',
+//         'value' => str_replace("&#039;", "'", $_REQUEST["transmissionTitle{$nb}"]),
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'attachment_type',
+//         'value' => 'converted_pdf',
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'coll_id',
+//         'value' => $_SESSION['collection_id_choice'],
+//         'type' => 'string'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'res_id_master',
+//         'value' => $_SESSION['doc_id'],
+//         'type' => 'integer'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'type_id',
+//         'value' => 0,
+//         'type' => 'int'
+//     ];
+//     $transmissionDataPdf[] = [
+//         'column' => 'relation',
+//         'value' => 1,
+//         'type' => 'int'
+//     ];
+
+//     return $transmissionDataPdf;
+// }
+
+if (isset($_POST['add']) && $_POST['add']) {
+    if (empty($_SESSION['upfile']['tmp_name'])) {
+        $_SESSION['error'] .= _FILE_MISSING . ". ";
+    } elseif ($_SESSION['upfile']['size'] == 0) {
+        $_SESSION['error'] .= _FILE_EMPTY . ". ";
+    }
+
+    if ($_SESSION['upfile']['error'] == 1) {
+        $filesize = $func->return_bytes(ini_get("upload_max_filesize"));
+        $_SESSION['error'] = _ERROR_FILE_UPLOAD_MAX . "(" . round(
+            $filesize / 1024, 2
+        ) . "Ko Max).<br />";
+    }
+
+    for ($nb = 1; checkTransmissionError($nb); $nb++) {
+        if (empty($_SESSION['upfileTransmission'][$nb]['tmp_name'])) {
+            $_SESSION['error'] .= "Transmission {$nb} : " . _FILE_MISSING . '. ';
+        } elseif ($_SESSION['upfileTransmission'][$nb]['size'] == 0) {
+            $_SESSION['error'] .= "Transmission {$nb} : " . _FILE_EMPTY . '. ';
+        }
+    }
+
+    $attachment_types = '';
+    if (! isset($_REQUEST['attachment_types']) || empty($_REQUEST['attachment_types'])) {
+        $_SESSION['error'] .= _ATTACHMENT_TYPES . ' ' . _MANDATORY . ". ";
+    } else {
+        $attachment_types = $func->protect_string_db($_REQUEST['attachment_types']);
+    }
+
+    $title = '';
+    if (! isset($_REQUEST['title']) || empty($_REQUEST['title'])) {
+        $_SESSION['error'] .= _OBJECT . ' ' . _MANDATORY . ". ";
+    } else {
+        $title = $_REQUEST['title'];
+        $title = str_replace("&#039;", "'", $title);
+    }
+    
+    if (empty($_SESSION['error'])) {
+        require_once 'core/docservers_tools.php';
+        $arrayIsAllowed = array();
+        $arrayIsAllowed = Ds_isFileTypeAllowed(
+            $_SESSION['config']['tmppath'] . $_SESSION['upfile']['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']['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&attach_type_exclude=converted_pdf,print_folder&mode=normal&load';
+                    </script>
+                    <?php
+                    exit();
+                } else {
+                    $fileInfos = array(
+                        "tmpDir"      => $_SESSION['config']['tmppath'],
+                        "size"        => $_SESSION['upfile']['size'],
+                        "format"      => $_SESSION['upfile']['format'],
+                        "tmpFileName" => $_SESSION['upfile']['fileNameOnTmp'],
+                    );
+
+                    $storeResult = array();
+                    $storeResult = $docserverControler->storeResourceOnDocserver(
+                        $_SESSION['collection_id_choice'], $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' => $_SESSION['upfile']['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' => 'A_TRA',
+                                'type' => "string",
+                            )
+                        );
+                        array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "offset_doc",
+                                'value' => ' ',
+                                'type' => "string",
+                            )
+                        );
+                        array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "logical_adr",
+                                'value' => ' ',
+                                'type' => "string",
+                            )
+                        );
+                        array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "title",
+                                'value' => $title,
+                                'type' => "string",
+                            )
+                        );
+                        array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "attachment_type",
+                                'value' => $attachment_types,
+                                '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 ($_SESSION['origin'] == "scan") {
+                            array_push(
+                                $_SESSION['data'],
+                                array(
+                                    'column' => "scan_user",
+                                    'value' => $_SESSION['user']['UserId'],
+                                    'type' => "string",
+                                )
+                            );
+                            array_push(
+                                $_SESSION['data'],
+                                array(
+                                    'column' => "scan_date",
+                                    'value' => $req->current_datetime(),
+                                    'type' => "function",
+                                )
+                            );
+                        }
+                        if (isset($_REQUEST['back_date']) && $_REQUEST['back_date'] <> '') {
+                            array_push(
+                                $_SESSION['data'],
+                                array(
+                                    'column' => "validation_date",
+                                    'value' => $func->format_date_db($_REQUEST['back_date']),
+                                    'type' => "date",
+                                )
+                            );
+                        }
+
+                        if (isset($_REQUEST['contactidAttach']) && $_REQUEST['contactidAttach'] <> '' && is_numeric($_REQUEST['contactidAttach'])) {
+                            array_push(
+                                $_SESSION['data'],
+                                array(
+                                    'column' => "dest_contact_id",
+                                    'value' => $_REQUEST['contactidAttach'],
+                                    'type' => "integer",
+                                )
+                            );
+                        } else if (isset($_REQUEST['contactidAttach']) && $_REQUEST['contactidAttach'] != '' && !is_numeric($_REQUEST['contactidAttach'])) {
+                            $_SESSION['data'][] = [
+                                'column' => 'dest_user',
+                                'value' => $_REQUEST['contactidAttach'],
+                                'type' => 'string',
+                            ];
+                        }
+
+                        if (isset($_REQUEST['addressidAttach']) && $_REQUEST['addressidAttach'] <> '' && is_numeric($_REQUEST['addressidAttach'])) {
+                            array_push(
+                                $_SESSION['data'],
+                                array(
+                                    'column' => "dest_address_id",
+                                    'value' => $_REQUEST['addressidAttach'],
+                                    'type' => "integer",
+                                )
+                            );
+                        }
+                        if(!empty($_REQUEST['chrono'])){
+                            array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "identifier",
+                                'value' => $_REQUEST['chrono'],
+                                'type' => "string",
+                            )
+                            );
+                        }
+                        array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "type_id",
+                                'value' => 0,
+                                'type' => "int",
+                            )
+                        );
+
+                        array_push(
+                            $_SESSION['data'],
+                            array(
+                                'column' => "relation",
+                                'value' => 1,
+                                'type' => "int",
+                            )
+                        );
+						
+						$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']
+						);
+
+                        for ($nb = 1; checkTransmissionError($nb); $nb++) {
+                            $fileInfosTr = [
+                                'tmpDir'      => $_SESSION['config']['tmppath'],
+                                'size'        => $_SESSION['upfileTransmission'][$nb]['size'],
+                                'format'      => $_SESSION['upfileTransmission'][$nb]['format'],
+                                'tmpFileName' => $_SESSION['upfileTransmission'][$nb]['fileNameOnTmp'],
+                            ];
+
+                            $storeResultTr = $docserverControler->storeResourceOnDocserver($_SESSION['collection_id_choice'], $fileInfosTr);
+
+                            $resAttach->load_into_db(
+                                RES_ATTACHMENTS_TABLE,
+                                $storeResultTr['destination_dir'],
+                                $storeResultTr['file_destination_name'] ,
+                                $storeResultTr['path_template'],
+                                $storeResultTr['docserver_id'],
+                                setTransmissionData($nb, $storeResultTr),
+                                $_SESSION['config']['databasetype']
+                            );
+
+                            if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $_SESSION['upfileTransmission'][$nb]['fileNamePdfOnTmp'] != '') {
+                                $resAttach->load_into_db(
+                                    RES_ATTACHMENTS_TABLE,
+                                    $storeResultTr['destination_dir'],
+                                    substr($storeResultTr['file_destination_name'], 0, strrpos($storeResultTr['file_destination_name'], "." )) . '.pdf' ,
+                                    $storeResultTr['path_template'],
+                                    $storeResultTr['docserver_id'],
+                                    setTransmissionDataPdf($nb, $storeResultTr),
+                                    $_SESSION['config']['databasetype']
+                                );
+                            }
+                        }
+                        unset($_SESSION['transmissionContacts']);
+                        
+                        //copie de la version PDF de la pièce si mode de conversion sur le client
+                        if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $_SESSION['upfile']['fileNamePdfOnTmp'] != '' && isset($_REQUEST['templateOffice'])){
+							$_SESSION['new_id'] = $id;
+                            $file    = $_SESSION['config']['tmppath'].$_SESSION['upfile']['fileNamePdfOnTmp'];
+                            $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['data_pdf'] = array();
+							
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "typist",
+									'value' => $_SESSION['user']['UserId'],
+									'type' => "string",
+								)
+							);
+							
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "format",
+									'value' => 'pdf',
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "docserver_id",
+									'value' => $storeResult['docserver_id'],
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "status",
+									'value' => 'TRA',
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "offset_doc",
+									'value' => ' ',
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "logical_adr",
+									'value' => ' ',
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "title",
+									'value' => $title,
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "attachment_type",
+									'value' => 'converted_pdf',
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "coll_id",
+									'value' => $_SESSION['collection_id_choice'],
+									'type' => "string",
+								)
+							);
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "res_id_master",
+									'value' => $_SESSION['doc_id'],
+									'type' => "integer",
+								)
+							);
+						
+							if (isset($_SESSION['upfile']['outgoingMail']) && $_SESSION['upfile']['outgoingMail']){
+								array_push(
+									$_SESSION['data_pdf'],
+									array(
+										'column' => "type_id",
+										'value' => 1,
+										'type' => "int",
+									)
+								);
+							}
+							else {
+								array_push(
+									$_SESSION['data_pdf'],
+									array(
+										'column' => "type_id",
+										'value' => 0,
+										'type' => "int",
+									)
+								);
+
+							}
+
+							array_push(
+								$_SESSION['data_pdf'],
+								array(
+									'column' => "relation",
+									'value' => 1,
+									'type' => "int",
+								)
+							);
+
+							$id_up = $resAttach->load_into_db(
+								RES_ATTACHMENTS_TABLE,
+								$storeResult['destination_dir'],
+								substr ($storeResult['file_destination_name'], 0, strrpos  ($storeResult['file_destination_name'], "." )).".pdf" ,
+								$storeResult['path_template'],
+								$storeResult['docserver_id'], $_SESSION['data_pdf'],
+								$_SESSION['config']['databasetype']
+							);
+							
+                            unset($_SESSION['upfile']['fileNamePdfOnTmp']);
+                        }
+                        
+                        if ($id == false) {
+                            $_SESSION['error'] = $resAttach->get_error();
+                        } else {
+                            // Delete temporary backup
+                            $db->query("DELETE FROM res_attachments WHERE res_id = ? and status = 'TMP' and typist = ?", 
+                                            array($_SESSION['attachmentInfo']['inProgressResId'], $_SESSION['user']['UserId']));
+                            unset($_SESSION['attachmentInfo']);
+                            unset($_SESSION['resIdVersionAttachment']);
+                            unset($_SESSION['targetAttachment']);
+
+                            if ($_SESSION['history']['attachadd'] == "true") {
+                                $hist = new history();
+                                $view = $sec->retrieve_view_from_coll_id(
+                                    $_SESSION['collection_id_choice']
+                                );
+                                $hist->add(
+                                    $view, $_SESSION['doc_id'], "ADD", 'attachadd',
+                                    ucfirst(_DOC_NUM) . $id . ' '
+                                    . _NEW_ATTACH_ADDED . ' ' . _TO_MASTER_DOCUMENT
+                                    . $_SESSION['doc_id'],
+                                    $_SESSION['config']['databasetype'],
+                                    'apps'
+                                );
+                                $_SESSION['info'] = _NEW_ATTACH_ADDED;
+                                $hist->add(
+                                    RES_ATTACHMENTS_TABLE, $id, "ADD",'attachadd',
+                                    $_SESSION['info'] . " (" . $title
+                                    . ") ",
+                                    $_SESSION['config']['databasetype'],
+                                    'attachments'
+                                );
+                            }
+                        }
+                    }
+                }
+            }
+            
+            if ( empty($_SESSION['error']) || $_SESSION['error'] == _NEW_ATTACH_ADDED ) {
+                $new_nb_attach = 0;
+                $stmt = $db->query("select res_id from "
+                    . $_SESSION['tablename']['attach_res_attachments']
+                    . " where status <> 'DEL' and attachment_type <> 'converted_pdf' and attachment_type <> 'print_folder' and res_id_master = ?", array($_SESSION['doc_id']));
+                if ($stmt->rowCount() > 0) {
+                    $new_nb_attach = $stmt->rowCount();
+                }
+                if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == 'create') {
+                    //Redirection vers bannette MyBasket s'il s'agit d'un courrier spontané et que l'utilisateur connecté est le destinataire du courrier
+                    if (isset($_SESSION['upfile']['outgoingMail']) && $_SESSION['upfile']['outgoingMail'] && $_SESSION['user']['UserId'] == $_SESSION['details']['diff_list']['dest']['users'][0]['user_id']){
+                            $js .= "window.parent.top.location.href = 'index.php?page=view_baskets&module=basket&baskets=MyBasket&resid=".$_SESSION['doc_id']."&directLinkToAction';";
+                    }
+                    else {
+                        if($attachment_types == 'response_project' || $attachment_types == 'signed_response'){
+                            $js .= 'loadSpecificTab(\'responses_iframe\',\''.$_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&view_only=true&load&fromDetail=response&attach_type=response_project,outgoing_mail_signed,signed_response,outgoing_mail\');';
+                        }else{
+                            $js .= 'loadSpecificTab(\'attachments_iframe\',\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=show_attachments_details_tab&module=attachments&resId=100&collId=letterbox_coll&fromDetail=attachments&attach_type_exclude=response_project,signed_response,outgoing_mail_signed,converted_pdf,outgoing_mail,print_folder\');';
+                        }
+                        
+                    }
+                } else {
+                    $js .= 'var eleframe1 =  window.parent.top.document.getElementById(\'list_attach\');';
+                    $js .= 'eleframe1.src = \''.$_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&attach_type_exclude=converted_pdf,print_folder&load\';';
+                }
+            } else {
+                $error = $_SESSION['error'];
+                $status = 1;
+            }
+        }
+    } else {
+        $error = $_SESSION['error'];
+        $status = 1;
+    }
+    if (!isset($_SESSION['new_id'])) $_SESSION['new_id'] = 0;
+
+    echo "{status : " . $status . ", content : '" . addslashes(_parse($content)) . "', error : '" . addslashes($error) . "', majFrameId : ".functions::xssafe($_SESSION['new_id']).", exec_js : '".addslashes($js)."'}";
+    unset($_SESSION['new_id']);
+    exit();
+} else if (isset($_POST['edit']) && $_POST['edit']) {
+    $title = '';
+
+    if (!isset($_REQUEST['title']) || empty($_REQUEST['title'])) {
+        $_SESSION['error'] .= _OBJECT . ' ' . _MANDATORY . ". ";
+        $status = 1;
+    } else {
+        $title = $_REQUEST['title'];
+        $title = str_replace("&#039;", "'", $title);
+    }
+
+    if ($status <> 1) {
+        if ($_REQUEST['new_version'] == "yes") {
+            $isVersion = 1;
+            if ((int)$_REQUEST['relation'] > 1) {
+                $column_res = 'res_id_version';
+            } else {
+                $column_res = 'res_id';
+            }
+            $stmt = $db->query("SELECT attachment_type, identifier, relation, attachment_id_master 
+                                FROM res_view_attachments
+                                WHERE ".$column_res." = ? and res_id_master = ?
+                                ORDER BY relation desc", array($_REQUEST['res_id'],$_SESSION['doc_id']));
+            $previous_attachment = $stmt->fetchObject();
+
+            $fileInfos = array(
+                "tmpDir"      => $_SESSION['config']['tmppath'],
+                "size"        => $_SESSION['upfile']['size'],
+                "format"      => $_SESSION['upfile']['format'],
+                "tmpFileName" => $_SESSION['upfile']['fileNameOnTmp'],
+            );
+
+            $storeResult = array();
+            
+            $storeResult = $docserverControler->storeResourceOnDocserver(
+                $_SESSION['collection_id_choice'], $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' => $_SESSION['upfile']['format'],
+                        'type' => "string",
+                    )
+                );
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "docserver_id",
+                        'value' => $storeResult['docserver_id'],
+                        'type' => "string",
+                    )
+                );
+                if (!empty($_REQUEST['effectiveDateStatus'])) {
+                    $_SESSION['data'][] = [
+                        'column' => 'status',
+                        'value'  => $_REQUEST['effectiveDateStatus'],
+                        'type'   => 'string'
+                    ];
+                } else {
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "status",
+                            'value' => 'A_TRA',
+                            'type' => "string",
+                        )
+                    );
+                }
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "offset_doc",
+                        'value' => ' ',
+                        'type' => "string",
+                    )
+                );
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "logical_adr",
+                        'value' => ' ',
+                        'type' => "string",
+                    )
+                );
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "title",
+                        'value' => $title,
+                        'type' => "string",
+                    )
+                );
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "attachment_type",
+                        'value' => $previous_attachment->attachment_type,
+                        '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 ((int)$previous_attachment->attachment_id_master == 0) {
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "attachment_id_master",
+                            'value' => $_REQUEST['res_id'],
+                            'type' => "integer",
+                        )
+                    );
+                } else {
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "attachment_id_master",
+                            'value' => (int)$previous_attachment->attachment_id_master,
+                            'type' => "integer",
+                        )
+                    );                    
+                }
+
+                if ($_SESSION['origin'] == "scan") {
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "scan_user",
+                            'value' => $_SESSION['user']['UserId'],
+                            'type' => "string",
+                        )
+                    );
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "scan_date",
+                            'value' => $req->current_datetime(),
+                            'type' => "function",
+                        )
+                    );
+                }
+                if (isset($_REQUEST['back_date']) && $_REQUEST['back_date'] <> '') {
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "validation_date",
+                            'value' => $func->format_date_db($_REQUEST['back_date']),
+                            'type' => "date",
+                        )
+                    );
+                }
+
+                if (!empty($_REQUEST['effectiveDate'])) {
+                    $_SESSION['data'][] = [
+                        'column' => 'effective_date',
+                        'value'  => $func->format_date_db($_REQUEST['effectiveDate']),
+                        'type'   => 'date'
+                    ];
+                }
+
+                if (isset($_REQUEST['contactidAttach']) && $_REQUEST['contactidAttach'] != '' && is_numeric($_REQUEST['contactidAttach'])) {
+                        $_SESSION['data'][] = [
+                            'column' => 'dest_contact_id',
+                            'value' => $_REQUEST['contactidAttach'],
+                            'type' => 'integer'
+                        ];
+                } else if (isset($_REQUEST['contactidAttach']) && $_REQUEST['contactidAttach'] != '' && !is_numeric($_REQUEST['contactidAttach'])) {
+                        $_SESSION['data'][] = [
+                            'column' => 'dest_user',
+                            'value' => $_REQUEST['contactidAttach'],
+                            'type' => 'string'
+                        ];
+                }
+
+                if (isset($_REQUEST['addressidAttach']) && $_REQUEST['addressidAttach'] <> '') {
+                    array_push(
+                        $_SESSION['data'],
+                        array(
+                            'column' => "dest_address_id",
+                            'value' => $_REQUEST['addressidAttach'],
+                            'type' => "integer",
+                        )
+                    );
+                }
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "identifier",
+                        'value' => $previous_attachment->identifier,
+                        'type' => "string",
+                    )
+                );
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "type_id",
+                        'value' => 0,
+                        'type' => "int",
+                    )
+                );
+
+                $relation = (int)$previous_attachment->relation;
+                $relation++;
+
+                array_push(
+                    $_SESSION['data'],
+                    array(
+                        'column' => "relation",
+                        'value' => $relation,
+                        'type' => "int",
+                    )
+                );
+
+                $id = $resAttach->load_into_db(
+                    'res_version_attachments',
+                    $storeResult['destination_dir'],
+                    $storeResult['file_destination_name'] ,
+                    $storeResult['path_template'],
+                    $storeResult['docserver_id'], $_SESSION['data'],
+                    $_SESSION['config']['databasetype']
+                );
+                
+                //copie de la version PDF de la pièce si mode de conversion sur le client
+                if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $_SESSION['upfile']['fileNamePdfOnTmp'] != ''){
+					$_SESSION['new_id'] = $id;
+                    $file = $_SESSION['config']['tmppath'].$_SESSION['upfile']['fileNamePdfOnTmp'];
+                    $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['data_pdf'] = array();
+							
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "typist",
+							'value' => $_SESSION['user']['UserId'],
+							'type' => "string",
+						)
+					);
+					
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "format",
+							'value' => 'pdf',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "docserver_id",
+							'value' => $storeResult['docserver_id'],
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "status",
+							'value' => 'TRA',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "offset_doc",
+							'value' => ' ',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "logical_adr",
+							'value' => ' ',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "title",
+							'value' => $title,
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "attachment_type",
+							'value' => 'converted_pdf',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "coll_id",
+							'value' => $_SESSION['collection_id_choice'],
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "res_id_master",
+							'value' => $_SESSION['doc_id'],
+							'type' => "integer",
+						)
+					);
+					$old_pdf_id = $ac->getCorrespondingPdf($_REQUEST['res_id']);
+					if (isset($old_pdf_id) && $old_pdf_id != 0) $infos_old_pdf = $ac->getAttachmentInfos($old_pdf_id);
+					if ((isset($_SESSION['upfile']['outgoingMail']) && $_SESSION['upfile']['outgoingMail']) || ($infos_old_pdf['type_id']==1)){
+						array_push(
+							$_SESSION['data_pdf'],
+							array(
+								'column' => "type_id",
+								'value' => 1,
+								'type' => "int",
+							)
+						);
+					}
+					else {
+						array_push(
+							$_SESSION['data_pdf'],
+							array(
+								'column' => "type_id",
+								'value' => 0,
+								'type' => "int",
+							)
+						);
+
+					}
+
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "relation",
+							'value' => 1,
+							'type' => "int",
+						)
+					);
+
+					$id_up = $resAttach->load_into_db(
+						RES_ATTACHMENTS_TABLE,
+						$storeResult['destination_dir'],
+						substr ($storeResult['file_destination_name'], 0, strrpos  ($storeResult['file_destination_name'], "." )).".pdf" ,
+						$storeResult['path_template'],
+						$storeResult['docserver_id'], $_SESSION['data_pdf'],
+						$_SESSION['config']['databasetype']
+					);
+                    unset($_SESSION['upfile']['fileNamePdfOnTmp']);
+                }
+                
+                if ($previous_attachment->relation == 1) {
+					$pdf_id = $ac->getCorrespondingPdf($_REQUEST['res_id']);
+					if (isset($pdf_id) && $pdf_id != 0) $stmt = $db->query("UPDATE res_attachments SET status = 'OBS' WHERE res_id = ?", array($pdf_id) );
+                    $stmt = $db->query("UPDATE res_attachments SET status = 'OBS' WHERE res_id = ?",array($_REQUEST['res_id']));
+                } else {
+					$pdf_id = $ac->getCorrespondingPdf($_REQUEST['res_id']);
+					if (isset($pdf_id) && $pdf_id != 0) $stmt = $db->query("UPDATE res_attachments SET status = 'OBS' WHERE res_id = ?", array($pdf_id) );
+                    $stmt = $db->query("UPDATE res_version_attachments SET status = 'OBS' WHERE res_id = ?",array($_REQUEST['res_id']));
+                }
+
+            }
+        } else {
+            //UPDATE VERSION
+            $isVersion = 0;
+            $set_update = "";
+            $arrayPDO = array();
+
+            $set_update = " title = :title";
+            $arrayPDO = array_merge($arrayPDO, array(":title" => $title));
+
+            if (isset($_REQUEST['back_date']) && $_REQUEST['back_date'] <> "") {
+                $set_update .= ", validation_date = '".$req->format_date_db($_REQUEST['back_date'])."'";
+            } else {
+                $set_update .= ", validation_date = null";
+            }
+
+            if (!empty($_REQUEST['effectiveDate'])) {
+                $set_update .= ", effective_date = '".$req->format_date_db($_REQUEST['effectiveDate'])."'";
+            }
+
+            if (isset($_REQUEST['contactidAttach']) && $_REQUEST['contactidAttach'] != '' && is_numeric($_REQUEST['contactidAttach'])) {
+                $set_update .= ", dest_user = null, dest_contact_id = ".$_REQUEST['contactidAttach'].", dest_address_id = ".$_REQUEST['addressidAttach'];
+            } else if (isset($_REQUEST['contactidAttach']) && $_REQUEST['contactidAttach'] != '' && !is_numeric($_REQUEST['contactidAttach'])) {
+                $set_update .= ", dest_user = '".$_REQUEST['contactidAttach']."', dest_contact_id = null, dest_address_id = null";
+            } else {
+                $set_update .= ", dest_user = null, dest_contact_id = null, dest_address_id = null";
+            }
+
+            if ((int)$_REQUEST['relation'] > 1) {
+                $column_res = 'res_id_version';
+            } else {
+                $column_res = 'res_id';
+            }
+
+            $stmt = $db->query("SELECT fingerprint FROM res_view_attachments WHERE ".$column_res." = ? and res_id_master = ? and status <> 'OBS'"
+                                , array($_REQUEST['res_id'], $_SESSION['doc_id']));
+            $res = $stmt->fetchObject();
+
+            require_once 'core/class/docserver_types_controler.php';
+            require_once 'core/docservers_tools.php';
+            $docserverTypeControler = new docserver_types_controler();
+            $docserverInfo = $docserverControler->getDocserverToInsert($collId);
+            $docserver = $docserverControler->get($docserverInfo->docserver_id);
+            $docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
+            $NewHash = Ds_doFingerprint($_SESSION['upfile']['tmp_name'], $docserverTypeObject->fingerprint_mode);
+            $OriginalHash = $res->fingerprint;
+
+            if ($_SESSION['upfile']['upAttachment'] && $OriginalHash <> $NewHash) {
+                $fileInfos = array(
+                    "tmpDir"      => $_SESSION['config']['tmppath'],
+                    "size"        => $_SESSION['upfile']['size'],
+                    "format"      => $_SESSION['upfile']['format'],
+                    "tmpFileName" => $_SESSION['upfile']['fileNameOnTmp'],
+                );
+
+                $storeResult = array();
+                $storeResult = $docserverControler->storeResourceOnDocserver(
+                    $_SESSION['collection_id_choice'], $fileInfos
+                );
+
+                $filetmp = $storeResult['path_template'];
+                $tmp = $storeResult['destination_dir'];
+                $tmp = str_replace('#',DIRECTORY_SEPARATOR,$tmp);
+                $filetmp .= $tmp;
+                $filetmp .= $storeResult['file_destination_name'];
+                require_once 'core/class/docserver_types_controler.php';
+                require_once 'core/docservers_tools.php';
+                $docserverTypeControler = new docserver_types_controler();
+                $docserver = $docserverControler->get($storeResult['docserver_id']);
+                $docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
+                $fingerprint = Ds_doFingerprint($filetmp, $docserverTypeObject->fingerprint_mode);
+                $filesize = filesize($filetmp);
+                $set_update .= ", fingerprint = :fingerprint";
+                $set_update .= ", filesize = :filesize";
+                $set_update .= ", path = :path";
+                $set_update .= ", filename = :filename";
+                $arrayPDO = array_merge($arrayPDO, 
+                        array(  ":fingerprint" => $fingerprint, 
+                                ":filesize" => $filesize, 
+                                ":path" => $storeResult['destination_dir'],
+                                ":filename" => $storeResult['file_destination_name'])
+                        );
+                // $set_update .= ", docserver_id = ".$storeResult['docserver_id'];
+                
+                //copie de la version PDF de la pièce si mode de conversion sur le client
+                if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $_SESSION['upfile']['fileNamePdfOnTmp'] != ''){
+					 $_SESSION['new_id'] = $id;
+                    $file = $_SESSION['config']['tmppath'].$_SESSION['upfile']['fileNamePdfOnTmp'];
+                    $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['data_pdf'] = array();
+							
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "typist",
+							'value' => $_SESSION['user']['UserId'],
+							'type' => "string",
+						)
+					);
+					
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "format",
+							'value' => 'pdf',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "docserver_id",
+							'value' => $storeResult['docserver_id'],
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "status",
+							'value' => 'TRA',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "offset_doc",
+							'value' => ' ',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "logical_adr",
+							'value' => ' ',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "title",
+							'value' => $title,
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "attachment_type",
+							'value' => 'converted_pdf',
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "coll_id",
+							'value' => $_SESSION['collection_id_choice'],
+							'type' => "string",
+						)
+					);
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "res_id_master",
+							'value' => $_SESSION['doc_id'],
+							'type' => "integer",
+						)
+					);
+					
+					$old_pdf_id = $ac->getCorrespondingPdf($_REQUEST['res_id']);
+					if (isset($old_pdf_id) && $old_pdf_id != 0) $infos_old_pdf = $ac->getAttachmentInfos($old_pdf_id);
+					if ((isset($_SESSION['upfile']['outgoingMail']) && $_SESSION['upfile']['outgoingMail']) || ($infos_old_pdf['type_id']==1)){
+						array_push(
+							$_SESSION['data_pdf'],
+							array(
+								'column' => "type_id",
+								'value' => 1,
+								'type' => "int",
+							)
+						);
+					}
+					else {
+						array_push(
+							$_SESSION['data_pdf'],
+							array(
+								'column' => "type_id",
+								'value' => 0,
+								'type' => "int",
+							)
+						);
+
+					}
+
+					array_push(
+						$_SESSION['data_pdf'],
+						array(
+							'column' => "relation",
+							'value' => 1,
+							'type' => "int",
+						)
+					);
+					$resAttach = new resource();
+					$id_up = $resAttach->load_into_db(
+						RES_ATTACHMENTS_TABLE,
+						$storeResult['destination_dir'],
+						substr ($storeResult['file_destination_name'], 0, strrpos  ($storeResult['file_destination_name'], "." )).".pdf" ,
+						$storeResult['path_template'],
+						$storeResult['docserver_id'], $_SESSION['data_pdf'],
+						$_SESSION['config']['databasetype']
+					);
+                }
+            }
+
+            $set_update .= ", doc_date = ".$req->current_datetime().", updated_by = :updated_by";
+            if (!empty($_REQUEST['effectiveDateStatus'])) {
+                $set_update .= ", status = :effectiveStatus";
+                $arrayPDO = array_merge($arrayPDO, array(":effectiveStatus" => $_REQUEST['effectiveDateStatus']));
+            } else {
+                $set_update .= ", status = 'A_TRA'";
+            }
+            $arrayPDO = array_merge($arrayPDO, array(":updated_by" => $_SESSION['user']['UserId']));
+
+            if (isset($storeResult['error']) && $storeResult['error'] <> '') {
+                $_SESSION['error'] = $storeResult['error'];
+            } else {
+                $arrayPDO = array_merge($arrayPDO, array(":res_id" => $_REQUEST['res_id']));
+                if ((int)$_REQUEST['relation'] == 1) {
+					$pdf_id = $ac->getCorrespondingPdf($_REQUEST['res_id']);
+					if (isset($pdf_id) && $pdf_id != 0 && (!empty($_SESSION['upfile']['fileNamePdfOnTmp']))){
+                        $stmt = $db->query("UPDATE res_attachments SET status = 'DEL' WHERE res_id = ?", array($pdf_id) );
+                    }
+                    $stmt = $db->query("UPDATE res_attachments SET " . $set_update . " WHERE res_id = :res_id", $arrayPDO);
+                } else {
+					$pdf_id = $ac->getCorrespondingPdf($_REQUEST['res_id']);
+					if (isset($pdf_id) && $pdf_id != 0 && (!empty($_SESSION['upfile']['fileNamePdfOnTmp']))){
+                        $stmt = $db->query("UPDATE res_attachments SET status = 'OBS' WHERE res_id = ?", array($pdf_id) );
+                    }
+                    $stmt = $db->query("UPDATE res_version_attachments SET " . $set_update . " WHERE res_id = :res_id", $arrayPDO);
+                }
+            }
+            unset($_SESSION['upfile']['fileNamePdfOnTmp']);
+        }
+
+        // Delete temporary backup
+        $stmt = $db->query("SELECT attachment_id_master 
+                            FROM res_version_attachments
+                            WHERE res_id = ? and status = 'TMP' and res_id_master = ?" 
+                            , array($_SESSION['attachmentInfo']['inProgressResId'], $_SESSION['doc_id']));
+        $previous_attachment = $stmt->fetchObject();
+
+        $db->query("DELETE FROM res_version_attachments WHERE attachment_id_master = ? and status = 'TMP'", array($previous_attachment->attachment_id_master));
+        unset($_SESSION['attachmentInfo']);
+        unset($_SESSION['resIdVersionAttachment']);
+        unset($_SESSION['targetAttachment']);
+
+        // Add in history
+        if ($_SESSION['history']['attachup'] == "true") {
+            $hist = new history();
+            $view = $sec->retrieve_view_from_coll_id(
+                $_SESSION['collection_id_choice']
+            );
+            $hist->add(
+                $view, $_SESSION['doc_id'], "UP", 'attachup',
+                ucfirst(_DOC_NUM) . $id . ' '
+                . _ATTACH_UPDATED,
+                $_SESSION['config']['databasetype'],
+                'apps'
+            );
+            $_SESSION['info'] = _ATTACH_UPDATED;
+            $hist->add(
+                RES_ATTACHMENTS_TABLE, $id, "UP",'attachup',
+                $_SESSION['info'] . " (" . $title
+                . ") ",
+                $_SESSION['config']['databasetype'],
+                'attachments'
+            );
+        }
+
+        if (empty($_SESSION['error'])) {
+            $js .= 'var eleframe1 =  window.top.document.getElementsByName(\'list_attach\');';
+            if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == 'attachments') {
+                $js .= 'eleframe1[0].src = \''.$_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&load';
+                $js .= '&attach_type_exclude=response_project,signed_response,outgoing_mail_signed,converted_pdf,outgoing_mail,print_folder,aihp&fromDetail=attachments';
+            } else if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == 'response'){
+                $js .= 'eleframe1[1].src = \''.$_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&load';
+                $js .= '&attach_type=response_project,outgoing_mail_signed,signed_response,outgoing_mail,aihp&fromDetail=response';
+            } else {
+                $js .= 'eleframe1[0].src = \''.$_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&attach_type_exclude=converted_pdf,print_folder&load';
+            }
+            $js .='\';';
+        } else {
+            $error = $_SESSION['error'];
+            $status = 1;
+        }
+
+    } else {
+        $error = $_SESSION['error'];
+        $status = 1;
+    }
+
+    if (!isset($_SESSION['new_id'])) $_SESSION['new_id'] = 0;
+    echo "{status : " . $status . ", content : '" . addslashes(_parse($content)) . "', title : '" . addslashes($title) . "', isVersion : " . $isVersion . ", error : '" . addslashes($error) . "', majFrameId : ".$_SESSION['new_id'].", exec_js : '".addslashes($js)."', cur_id : ".$_REQUEST['res_id']."}";
+    unset($_SESSION['new_id']);
+    exit();
+}
+
+if (isset($_REQUEST['id'])) {
+
+    $_SESSION['targetAttachment'] = 'edit';
+
+    if ((int)$_REQUEST['relation'] > 1) {
+        $column_res = 'res_id_version';
+    } else {
+        $column_res = 'res_id';
+    }
+    
+    $stmt = $db->query("SELECT validation_date, effective_date, attachment_type, title, dest_user, dest_contact_id, dest_address_id, dest_address_id as address_id, relation, format, identifier, status
+                        FROM res_view_attachments 
+                        WHERE ".$column_res." = ? and res_id_master = ?
+                        ORDER BY relation desc", array($_REQUEST['id'], $_SESSION['doc_id']));
+    $data_attachment = $stmt->fetchObject();
+    $attachmentFormat = $data_attachment->format;
+    $statusEditAttachment = $data_attachment->status;
+    //var_dump($data_attachment);
+    if ($data_attachment->relation == 1) {
+        $res_table = 'res_attachments';
+    } else {
+        $res_table = 'res_version_attachments';  
+    }
+
+    $viewResourceArr = $docserverControler->viewResource(
+        $_REQUEST['id'], 
+        $res_table, 
+        'adr_x', 
+        false
+    );
+
+    $_SESSION['upfile']['size']          = filesize($viewResourceArr['file_path']);
+    $_SESSION['upfile']['format']        = $viewResourceArr['ext'];
+    $fileNameOnTmp                       = str_replace($viewResourceArr['tmp_path'].DIRECTORY_SEPARATOR, '', $viewResourceArr['file_path']);
+    $_SESSION['upfile']['fileNameOnTmp'] = $fileNameOnTmp;
+
+} else {
+    $_SESSION['targetAttachment'] = 'add';
+
+    $stmt = $db->query("SELECT subject, exp_contact_id, dest_contact_id, exp_user_id, address_id, dest_user_id, alt_identifier FROM res_view_letterbox WHERE res_id = ?",array($_SESSION['doc_id']));
+    $data_attachment = $stmt->fetchObject();
+
+    unset($_SESSION['upfile']);
+    unset($_SESSION['upfileTransmission']);
+
+}
+
+$stmt = $db->query('SELECT creation_date FROM res_letterbox WHERE res_id = ?', [$_SESSION['doc_id']]);
+$dataForDate = $stmt->fetchObject();
+
+if ($data_attachment->dest_contact_id <> "") {
+    $stmt = $db->query('SELECT is_corporate_person, is_private, contact_lastname, contact_firstname, society, society_short, address_num, address_street, address_town, lastname, firstname 
+                        FROM view_contacts 
+                        WHERE contact_id = ? and ca_id = ?', array($data_attachment->dest_contact_id,$data_attachment->address_id));
+} else if ($data_attachment->exp_contact_id <> "") {
+    $stmt = $db->query('SELECT is_corporate_person, is_private, contact_lastname, contact_firstname, society, society_short, address_num, address_street, address_town, lastname, firstname 
+                        FROM view_contacts 
+                        WHERE contact_id = ? and ca_id = ?', array($data_attachment->exp_contact_id,$data_attachment->address_id));       
+} else if ($data_attachment->dest_user != '') {
+    $stmt = $db->query('SELECT lastname, firstname FROM users WHERE user_id = ?', [$data_attachment->dest_user]);
+} else if ($data_attachment->exp_user_id != '') {
+    $stmt = $db->query('SELECT lastname, firstname FROM users WHERE user_id = ?', [$data_attachment->exp_user_id]);
+} else if ($data_attachment->dest_user_id != '') {
+    $stmt = $db->query('SELECT lastname, firstname FROM users WHERE user_id = ?', [$data_attachment->dest_user_id]);
+}
+
+if ($data_attachment->exp_contact_id <> '' || $data_attachment->dest_contact_id <> '') {
+    $res = $stmt->fetchObject();
+    if ($res->is_corporate_person == 'Y') {
+        $data_contact = $res->society;
+        if (!empty ($res->society_short)) {
+            $data_contact .= ' ('.$res->society_short.')';
+        }
+        if (!empty($res->lastname) || !empty($res->firstname)) {
+            $data_contact .= ' - ' . $res->lastname . ' ' . $res->firstname;
+        }
+        $data_contact .= ', ';
+    } else {
+        $data_contact .= $res->contact_lastname . ' ' . $res->contact_firstname;
+        if (!empty ($res->society)) {
+            $data_contact .= ' (' .$res->society . ')';
+        }
+        $data_contact .= ', ';
+    }
+    if ($res->is_private == 'Y') {
+        $data_contact .= '(' . _CONFIDENTIAL_ADDRESS . ')';
+    } else {
+        $data_contact .= $res->address_num . ' ' . $res->address_street . ' ' . strtoupper($res->address_town);
+    }
+} else if ($data_attachment->exp_user_id != '' || $data_attachment->dest_user != '' || $data_attachment->dest_user_id != '') {
+    $res = $stmt->fetchObject();
+    if (!empty($res->lastname) || !empty($res->firstname)) {
+        $data_contact .= $res->lastname . ' ' . $res->firstname;
+    }
+//si multicontact
+} else {
+    $stmt = $db->query("SELECT cr.address_id, c.contact_id, c.is_corporate_person, c.society, c.society_short, c.firstname, c.lastname,ca.is_private,ca.address_street, ca.address_num, ca.address_town 
+                        FROM contacts_res cr, contacts_v2 c, contact_addresses ca 
+                        WHERE cr.res_id = ? and cast(c.contact_id as char) = cast(cr.contact_id as char) and ca.contact_id=c.contact_id and ca.id=cr.address_id",array($_SESSION['doc_id']));
+    $i=0;
+    while($multi_contacts_attachment = $stmt->fetchObject()){
+        if(is_integer($multi_contacts_attachment->contact_id)){
+            $format_contact='';
+            $stmt2 = $db->query('SELECT is_corporate_person, is_private, contact_lastname, contact_firstname, society, society_short, address_num, address_street, address_town, lastname, firstname 
+                            FROM view_contacts 
+                            WHERE contact_id = ? and ca_id = ?',array($multi_contacts_attachment->contact_id,$multi_contacts_attachment->address_id));
+
+            $res = $stmt2->fetchObject();
+            if ($res->is_corporate_person == 'Y') {
+                $format_contact = $res->society;
+                if (!empty ($res->society_short)) {
+                    $format_contact .= ' ('.$res->society_short.')';
+                }
+                if (!empty($res->lastname) || !empty($res->firstname)) {
+                    $format_contact .= ' - ' . $res->lastname . ' ' . $res->firstname;
+                }
+                $format_contact .= ', ';
+            } else {
+                $format_contact .= $res->contact_lastname . ' ' . $res->contact_firstname;
+                if (!empty ($res->society)) {
+                    $format_contact .= ' (' .$res->society . ')';
+                }
+                $format_contact .= ', ';
+            }
+            if ($res->is_private == 'Y') {
+                $format_contact .= '('._CONFIDENTIAL_ADDRESS.')';
+            } else {
+                $format_contact .= $res->address_num .' ' . $res->address_street .' ' . strtoupper($res->address_town);                         
+            }
+            $contacts[] = array(
+                'contact_id'     => $multi_contacts_attachment->contact_id,
+                'firstname'      => $multi_contacts_attachment->firstname,
+                'lastname'       => $multi_contacts_attachment->lastname,
+                'society'        => $multi_contacts_attachment->society,
+                'address_id'     => $multi_contacts_attachment->address_id,
+                'format_contact' => $format_contact
+            );
+
+            if($i==0){
+                $data_contact                    = $format_contact; 
+                $data_attachment->exp_contact_id = $multi_contacts_attachment->contact_id;
+            }
+            $i++;
+        } 
+    }
+}
+
+unset($_SESSION['transmissionContacts']);
+$content .= '<div class="error" style="left:10px;" id="divErrorAttachment" onClick="this.style.display=\'none\'">' . $_SESSION['error'];
+
+$_SESSION['error'] = "";
+
+$objectTable = $sec->retrieve_table_from_coll($_SESSION['collection_id_choice']);
+$content .= '</div>';
+$content .= '<div class="info" style="left:10px;" id="divInfoAttachment" onClick="this.style.display=\'none\'">' . $_SESSION['info'].'</div>';
+if (isset($_REQUEST['id'])) {
+    $title = _MODIFY_ANSWER;
+} else {
+    $title = _ATTACH_ANSWER;
+}
+
+$content .= '<h2>&nbsp;' . $title;
+
+//multicontact
+if (!empty($contacts)) {
+    $content .= ' pour le contact : <select style="background-color: #FFF;border: 1px solid #999;color: #666;text-align: left;" id="selectContactIdRes" onchange="loadSelectedContact()">';
+
+    foreach ($contacts as $key => $value) {
+        $content .= '<option value="'.$value['contact_id'].'#'.$value['address_id'].'#'.$value['format_contact'].'">'.$value['format_contact'].'</option>';
+        //$content .= '<input type="hidden" id="format_list_contact_'.$value['contact_id'].'_res" value="'.$value['format_contact'].'"/>';
+    }
+    $content .= '</select>';
+    $content .= '<script>parent.$("contactidAttach").value='.$contacts[0]['contact_id'].';parent.$("addressidAttach").value='.$contacts[0]['address_id'].';launch_autocompleter2_contacts_v2("'. $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=autocomplete_contacts", "contact_attach", "show_contacts_attach", "", "contactidAttach", "addressidAttach")</script>';
+}
+
+$content .= '</h2>';
+
+$content .= '<form enctype="multipart/form-data" method="post" name="formAttachment" id="formAttachment" action="#" class="forms" style="width:500px;float:left;margin-left:-5px;background-color:#deedf3">';
+$content .= '<div class="transmissionDiv">';
+$content .= '<hr style="width:85%;margin-left:0px">';
+$content .= '<input type="hidden" id="category_id" value="outgoing"/>';
+if (isset($_REQUEST['id'])) {
+    $content .= '<input type="hidden" name="res_id" id="res_id" value="'.$_REQUEST['id'].'"/>';
+    $content .= '<input type="hidden" name="relation" id="relation" value="'.$_REQUEST['relation'].'"/>';
+    $_SESSION['relationAttachment'] = $_REQUEST['relation'];
+    $_SESSION['resIdVersionAttachment'] = $_REQUEST['id'];
+}
+$content .= '<input type="hidden" name="fromDetail" id="fromDetail" value="'.$_REQUEST['fromDetail'].'"/>';
+
+if (!isset($_REQUEST['id'])) {
+    if(isset($_SESSION['attachment_types']['transmission'])){
+        $function_transmssion = 'disableTransmissionButton(this.options[this.selectedIndex].value);';
+        $function_transmssion2 = 'showOrButtonForAttachment();';
+    }else{
+        $function_transmssion = '';
+        $function_transmssion2 = '';
+    }
+    //On recherche le type de document attaché à ce courrier
+    //var_dump($_SESSION['doc_id']);
+    $stmt = $db->query("SELECT type_id FROM res_letterbox WHERE res_id = ?",array($_SESSION['doc_id']));
+    $type_id = $stmt->fetchObject();
+    //var_dump ($type_id->type_id);
+    $type_id = $type_id->type_id;
+    //On recherche le sve_type
+    $stmt = $db->query("SELECT * FROM mlb_doctype_ext WHERE type_id = ?",array($type_id));
+    $sve = $stmt->fetchObject();
+    $sve_type = $sve->process_mode;
+    //On met tous les attachments ayant le type_sve attaché au courrier dans un tableau
+    $attachments_types_for_process = array();
+    foreach($_SESSION['attachment_types_with_process'] as $key => $value){
+        // var_dump($key);
+        // var_dump($value);
+        if($sve_type == $value or $value == ''){
+            //var_dump($_SESSION['attachment_types'][$key]);
+            //$attachments_types_for_process[] = $key;
+            //$attachments_types_for_process = array($key => $attachments_types_for_process);
+            $attachments_types_for_process[$key] = $_SESSION['attachment_types'][$key];
+
+        }
+
+    }
+    //var_dump($attachments_types_for_process);
+    //var_dump($_SESSION['attachment_types']);
+
+    $content .= '<p>';
+    $content .= '<label>' . _ATTACHMENT_TYPES . '</label>';
+    $content .= '<select name="attachment_types" id="attachment_types" onchange="affiche_chrono();'.$function_transmssion.'select_template(\'' . $_SESSION['config']['businessappurl']
+        . 'index.php?display=true&module=templates&page='
+        . 'select_templates\', this.options[this.selectedIndex].value);"/>';
+    $content .= '<option value="">' . _CHOOSE_ATTACHMENT_TYPE . '</option>';
+    
+
+    foreach(array_keys($attachments_types_for_process) as $attachmentType) {
+        if(empty($_SESSION['attachment_types_get_chrono'][$attachmentType][0])){
+            $_SESSION['attachment_types_get_chrono'][$attachmentType] = '';
+        }
+        if($_SESSION['attachment_types_show'][$attachmentType] == "true"){
+            $content .= '<option value="' . $attachmentType . '" with_chrono = "'. $_SESSION['attachment_types_with_chrono'][$attachmentType].'" get_chrono = "'. $_SESSION['attachment_types_get_chrono'][$attachmentType].'"';
+
+            if(isset($_GET['cat']) && $_GET['cat'] == 'outgoing' && $attachmentType == 'outgoing_mail'){
+                $content .= ' selected = "selected"';
+                $content .= '<script>$("attachment_types").onchange();</script>';
+            }
+            $content .= '>';
+            $content .= $_SESSION['attachment_types'][$attachmentType];
+            $content .= '</option>';
+        }
+    }
+
+    $content .= '</select>&nbsp;<span class="red_asterisk" id="attachment_types_mandatory"><i class="fa fa-star"></i></span>';
+    $content .= '</p>';
+    $content .= '<p>';
+    $content .= '<label id="chrono_label" style="display:none">'. _CHRONO_NUMBER.'</label>';
+    $content .= '<input type="text" name="chrono_display" id="chrono_display" style="display:none" disabled class="readonly"/>';
+    $content .= '<select name="get_chrono_display" id="get_chrono_display" style="display:none" onchange="$(\'chrono\').value=this.options[this.selectedIndex].value"/>';
+    $content .= '<input type="hidden" name="chrono" id="chrono" value="' . $data_attachment->alt_identifier . '"/>';
+    $content .= '</p>';
+    $content .= '<p style="text-align:left;margin-left:74.5%;"></p>';
+    $content .= '<p>';
+    $content .= '<label>'. _FILE.' <span><i class="fa fa-paperclip fa-lg" title="'._LOADED_FILE.'" style="cursor:pointer;" id="attachment_type_icon" onclick="$(\'attachment_type_icon\').setStyle({color: \'#009DC5\'});$(\'attachment_type_icon2\').setStyle({color: \'#666\'});$(\'templateOffice\').setStyle({display: \'none\'});$(\'templateOffice\').disabled=true;$(\'edit\').setStyle({display: \'none\'});$(\'choose_file\').setStyle({display: \'inline-block\'});document.getElementById(\'choose_file\').contentDocument.getElementById(\'file\').click();"></i> <i class="fa fa-file-text-o fa-lg" title="'._GENERATED_FILE.'" style="cursor:pointer;color:#009DC5;" id="attachment_type_icon2" onclick="$(\'attachment_type_icon2\').setStyle({color: \'#009DC5\'});$(\'attachment_type_icon\').setStyle({color: \'#666\'});$(\'templateOffice\').setStyle({display: \'inline-block\'});$(\'templateOffice\').disabled=false;$(\'choose_file\').setStyle({display: \'none\'});"></i></span></label>';
+    $content .= '<select name="templateOffice" id="templateOffice" style="display:inline-block;" onchange="showEditButton();'.$function_transmssion2.'">';
+    $content .= '<option value="">'. _CHOOSE_MODEL.'</option>';
+
+    $content .= '</select>';
+    $content .= '<iframe style="display:none; width:210px" name="choose_file" id="choose_file" frameborder="0" scrolling="no" height="25" src="' . $_SESSION['config']['businessappurl']
+        . 'index.php?display=true&module=attachments&page=choose_attachment"></iframe>';
+
+    $content .='&nbsp;<span class="red_asterisk" id="templateOffice_mandatory"><i class="fa fa-star"></i></span>';
+    
+    $content .= '</p>';
+}
+
+if (isset($statusEditAttachment) && $statusEditAttachment == 'TMP') {
+    $content .= '<p align="middle"><span style="color:green">'._RETRIEVE_BACK_UP.'</span></p>';
+}
+if (isset($_REQUEST['id'])) {
+    $content .= '<p>';
+    $content .= '<label id="chrono_label" >'. _ATTACHMENT_TYPES.'</label>';
+    $content .= '<input type="text" name="attachment_type" id="attachment_type" value="' . $_SESSION['attachment_types'][$data_attachment->attachment_type] . '" disabled class="readonly"/>';
+    $content .= '</p>';
+    $content .= '<p>';
+    $content .= '<label id="chrono_label" >'. _CHRONO_NUMBER.'</label>';
+    $content .= '<input type="text" name="chrono_display" id="chrono_display" value="' . $data_attachment->identifier . '" disabled class="readonly"/>';
+    $content .= '</p>';
+}
+$content .= '<p>';
+$content .= '<label>'. _OBJECT .'</label>';
+$content .= '<input type="text" name="title" id="title" maxlength="250" value="';
+if (isset($_REQUEST['id'])) {
+    $content .= str_replace('"', '&quot;', $data_attachment->title);
+} else {
+    $content .= $req->show_string(substr($data_attachment->subject, 0, 250));
+}
+$content .= '"/>&nbsp;<span class="red_asterisk" id="templateOffice_mandatory"><i class="fa fa-star"></i></span>';
+$content .= '</p>';
+$content .= '<p>';
+$content .= '<label>'. _BACK_DATE.'</label>';
+if (isset($_REQUEST['id'])) {
+    $content .= '<input type="text" name="back_date" id="back_date" onClick="showCalender(this);" onfocus="checkBackDate(this)" value="';
+    $content .= $req->format_date_db($data_attachment->validation_date);
+    $content .= '"/>';
+    $content .= '</p>';
+    if ($data_attachment->attachment_type == 'transmission' && ($data_attachment->status == "RTURN" || $data_attachment->status == "EXP_RTURN")) {
+        $content .= '<p>';
+        $content .= '<label>'. "Date de retour effective".'</label>';
+        $content .= '<input type="text" name="effectiveDate" id="effectiveDate" onblur="setRturnForEffectiveDate()" onClick="showCalender(this);" onfocus="checkBackDate(this)" style="width: 75px" value="';
+        $content .= $req->format_date_db($data_attachment->effective_date);
+        $content .= '" />';
+        $content .= '<select name="effectiveDateStatus" id="effectiveDateStatus" style="margin-left: 20px;width: 105px" />';
+        $content .= '<option value="EXP_RTURN">Attente retour</option>';
+        if ($data_attachment->status == "RTURN")
+            $content .= '<option selected="selected" value="RTURN">Retourné</option>';
+        else
+            $content .= '<option value="RTURN">Retourné</option>';
+        $content .= '</select>';
+    }
+} else {
+    $content .= '<input type="text" name="back_date" id="back_date" onClick="showCalender(this);" onfocus="checkBackDate(this)" value="" />';
+}
+$content .= "<input type='hidden' name='dataCreationDate' id='dataCreationDate' value='{$dataForDate->creation_date}' />";
+$content .= '</p>';
+$content .= '<div>';
+$content .= '<label>'. _DEST_USER_PJ;
+if ($core->test_admin('my_contacts', 'apps', false)) {
+    $content .= ' <a href="#" id="create_multi_contact" title="' . _CREATE_CONTACT
+            . '" onclick="new Effect.toggle(\'create_contact_div_attach\', '
+            . '\'blind\', {delay:0.2});return false;" '
+            . 'style="display:inline;" ><i class="fa fa-pencil fa-lg" title="' . _CREATE_CONTACT . '"></i></a>';
+}
+$content .= '</label>';
+$content .= '<span style="position:relative;"><input type="text" name="contact_attach" onblur="display_contact_card(\'visible\', \'contact_card_attach\');" onkeyup="erase_contact_external_id(\'contact_attach\', \'contactidAttach\');erase_contact_external_id(\'contact_attach\', \'addressidAttach\');" id="contact_attach" value="';
+$content .= $data_contact;
+$content .= '"/><div id="show_contacts_attach" class="autocomplete autocompleteIndex" style="width: 100%;left: 0px;"></div><div class="autocomplete autocompleteIndex" id="searching_autocomplete" style="display: none;text-align:left;padding:5px;width: 100%;left: 0px;"><i class="fa fa-spinner fa-spin" aria-hidden="true"></i> chargement ...</div></span>';
+$content .='<a href="#" id="contact_card_attach" title="'._CONTACT_CARD.'" onclick="document.getElementById(\'info_contact_iframe_attach\').src=\'' . $_SESSION['config']['businessappurl']
+    . 'index.php?display=false&dir=my_contacts&page=info_contact_iframe&seeAllAddresses&contactid=\'+document.getElementById(\'contactidAttach\').value+\'&addressid=\'+document.getElementById(\'addressidAttach\').value+\'\';new Effect.toggle(\'info_contact_div_attach\', '
+    . '\'blind\', {delay:0.2});return false;"'
+    . ' style="visibility:hidden;"> <i class="fa fa-book fa-lg"></i></a>';
+$content .= '</div>';
+$content .= '<input type="hidden" id="contactidAttach" name="contactidAttach" value="';
+if (isset($_REQUEST['id']) && !empty($data_attachment->dest_contact_id)) {
+    $content .= $data_attachment->dest_contact_id;
+} else if (isset($_REQUEST['id']) && !empty($data_attachment->dest_user)){
+    $content .= $data_attachment->dest_user;
+} else if ($data_attachment->exp_contact_id){
+    $content .= $data_attachment->exp_contact_id;
+} else if ($data_attachment->dest_contact_id) {
+    $content .= $data_attachment->dest_contact_id;
+} else if ($data_attachment->exp_user_id) {
+    $content .= $data_attachment->exp_user_id;
+} else if ($data_attachment->dest_user_id) {
+    $content .= $data_attachment->dest_user_id;
+}
+
+$content .= '"/>';
+$content .= '<input type="hidden" id="addressidAttach" name="addressidAttach" value="';
+
+if (isset($_REQUEST['id'])) {
+    $content .= $data_attachment->dest_address_id;
+} else if ($data_attachment->address_id <> ''){
+    $content .= $data_attachment->address_id;
+}
+
+$content .= '"/>';
+
+$langArrayForTransmission = [
+    _ATTACHMENT_TYPES,
+    _CHRONO_NUMBER,
+    _FILE,
+    _OBJECT,
+    _BACK_DATE,
+    _DEST_USER_PJ,
+    _EDIT_MODEL,
+    _CREATE_CONTACT
+];
+$canCreateContact = $core->test_admin('my_contacts', 'apps', false);
+if (!$canCreateContact)
+    $canCreateContact = 0;
+
+if(!isset($_REQUEST['id'])) {
+    $content .= '<p><div style="float: left;margin-bottom: 5px">';
+    $content .= '<input type="button" value="';
+    $content .= _EDIT_MODEL;
+    /*$content .= '" name="edit" id="edit" style="display:none;margin-top: 0" class="button" '
+        . 'onclick="window.open(\'' . $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_popup_launcher&objectType=attachmentVersion&objectId=\'+$(\'templateOffice\').value+\'&attachType=\'+$(\'attachment_types\').value+\'&objectTable=' . $objectTable . '&contactId=\'+$(\'contactidAttach\').value+\'&addressId=\'+$(\'addressidAttach\').value+\'&chronoAttachment=\'+$(\'chrono\').value+\'&titleAttachment=\'+cleanTitle($(\'title\').value)+\'&back_date=\'+$(\'back_date\').value+\'&resMaster=' . $_SESSION['doc_id']
+        . '\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'add\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'add\').disabled=\'disabled\';$(\'add\').style.opacity=\'0.5\';this.hide();"/>';*/
+    $content .= '" name="edit" id="edit" style="display:none;margin-top: 0" class="button" '
+        . 'onclick="showAppletLauncher(\'' . $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_modal_launcher&objectType=attachmentVersion&objectId=\'+$(\'templateOffice\').value+\'&attachType=\'+$(\'attachment_types\').value+\'&objectTable=' . $objectTable . '&contactId=\'+$(\'contactidAttach\').value+\'&addressId=\'+$(\'addressidAttach\').value+\'&chronoAttachment=\'+$(\'chrono\').value+\'&titleAttachment=\'+cleanTitle($(\'title\').value)+\'&back_date=\'+$(\'back_date\').value+\'&resMaster=' . $_SESSION['doc_id']
+        . '\', \'100px\', \'500px\');$(\'add\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'add\').disabled=\'disabled\';$(\'add\').style.opacity=\'0.5\';this.hide();"/>';
+    $content .= '<span style="display: none" id="divOr0">&nbsp;ou&nbsp;</span>';
+    $content .= '</div>';
+
+    $content .= '<div style="float: left">';
+    if(isset($_SESSION['attachment_types']['transmission'])){
+        $content .= '<i id="newTransmissionButton0" title="Nouvelle transmission" style="opacity: 0.5;cursor: pointer" class="fa fa-plus-circle fa-2x"
+                         onclick="addNewTransmission(\'' . $_SESSION['config']['businessappurl'] . '\', \'' . $_SESSION['doc_id'] . '\', ' . $canCreateContact . ', \'' . addslashes(implode('#', $langArrayForTransmission)) . '\', \'' . $_SESSION['user']['UserId'] . '\')"></i>';
+    }
+    $content .= '</div></p>';
+}
+
+if (isset($_REQUEST['id']) && ($data_attachment->status <> 'TMP' || ($data_attachment->status == 'TMP' && $data_attachment->relation > 1))) {
+    $content .= '<p>';
+    $content .= '<label>'. _CREATE_NEW_ATTACHMENT_VERSION.'</label>';
+    $content .= '<input type="radio" name="new_version" id="new_version_yes" value="yes" onclick="setButtonStyle(\'yes\', \''.$attachmentFormat.'\', $(\'hiddenValidateStatus\').value)"/>'._YES;
+    $content .= '&nbsp;&nbsp;';
+    $content .= '<input type="radio" name="new_version" id="new_version_no" checked value="no" onclick="setButtonStyle(\'no\', \''.$attachmentFormat.'\', $(\'hiddenValidateStatus\').value)"/>'._NO;
+    $content .= '</p>';
+}
+
+$content .= '</div>';
+
+    $content .= '<div id="transmission"></div>';
+    $content .= '<input type="hidden" id="hiddenValidateStatus" value="1"/>';
+        $content .= '<p class="buttons">';
+            if (isset($_REQUEST['id']) && $attachmentFormat != "pdf") {
+                $content .= '<input type="button" value="';
+                $content .= _EDIT_MODEL;
+                /*$content .= '" name="editModel" id="editModel" class="button" onclick="$(\'hiddenValidateStatus\').value=\'2\';$(\'edit\').style.visibility=\'visible\';window.open(\''
+                    . $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_popup_launcher&objectType=attachmentUpVersion&objectId='.$_REQUEST['id'].'&contactId=\'+$(\'contactidAttach\').value+\'&addressId=\'+$(\'addressidAttach\').value+\'&titleAttachment=\'+cleanTitle($(\'title\').value)+\'&back_date=\'+$(\'back_date\').value+\'&objectTable=res_view_attachments&resMaster='.$_SESSION['doc_id']
+                    .'\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'edit\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'edit\').disabled=\'disabled\';$(\'edit\').style.opacity=\'0.5\';this.hide();"/>';*/
+                $content .= '" name="editModel" id="editModel" class="button" onclick="$(\'hiddenValidateStatus\').value=\'2\';$(\'edit\').style.visibility=\'visible\';showAppletLauncher(\''
+                    . $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_modal_launcher&objectType=attachmentUpVersion&objectId='.$_REQUEST['id'].'&contactId=\'+$(\'contactidAttach\').value+\'&addressId=\'+$(\'addressidAttach\').value+\'&titleAttachment=\'+cleanTitle($(\'title\').value)+\'&back_date=\'+$(\'back_date\').value+\'&objectTable=res_view_attachments&resMaster='.$_SESSION['doc_id']
+                    .'\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'edit\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'edit\').disabled=\'disabled\';$(\'edit\').style.opacity=\'0.5\';this.hide();"/>';
+            } /*else {
+                                    $content .= '" name="edit" id="edit" style="display:none" class="button" '
+                                                .'onclick="window.open(\''. $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_popup_launcher&objectType=attachmentVersion&objectId=\'+$(\'templateOffice\').value+\'&objectTable='. $objectTable .'&contactId=\'+$(\'contactidAttach\').value+\'&chronoAttachment=\'+$(\'chrono\').value+\'&resMaster='.$_SESSION['doc_id']
+                                                .'\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');"/>';
+                                }*/
+
+            $content .= '&nbsp;';
+            $content .= '&nbsp;';
+            $content .= '<input type="button" value="';
+            $content .=  _VALIDATE;
+            if (isset($_REQUEST['id'])) {
+                $content .= '" name="edit" id="edit" class="button" onclick="ValidAttachmentsForm(\'' . $_SESSION['config']['businessappurl'] ;
+            } else {
+                $content .= '" name="add" id="add" class="button" onclick="simpleAjax(\'' . $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=unsetReservedChronoNumber\');ValidAttachmentsForm(\'' . $_SESSION['config']['businessappurl'] ;
+            }
+            $content .= 'index.php?display=true&module=attachments&page=attachments_content\', \'formAttachment\',\''._ID_TO_DISPLAY.'\')"/>';
+
+            $content .= '&nbsp;';
+            $content .= '&nbsp;';
+            $content .= '<label>&nbsp;</label>';
+
+            $content .= '<input type="button" value="';
+            $content .=  _CANCEL;
+            $content .= '" name="cancel" class="button"  onclick="simpleAjax(\'' . $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=unsetReservedChronoNumber\');';
+            if (isset($_REQUEST['id'])) {
+                $content .= 'simpleAjax(\'' . $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=unsetTemporarySaved&mode=edit\');destroyModal(\'form_attachments\');"/>';
+            } else {
+                $content .= 'simpleAjax(\'' . $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=unsetTemporarySaved&mode=add\');destroyModal(\'form_attachments\');"/>';
+            }
+
+        $content .= '</p>';
+        $content .= '&nbsp;';
+        $content .= '&nbsp;';
+        $content .= '</p>';
+    $content .= '</form>';
+
+    if (!isset($_REQUEST['id'])) {
+        $content .= '<script>launch_autocompleter2_contacts_v2("'. $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=autocomplete_contacts", "contact_attach", "show_contacts_attach", "", "contactidAttach", "addressidAttach")</script>';
+    } else {
+        $content .= '<script>launch_autocompleter2_contacts_v2("'. $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=autocomplete_contacts", "contact_attach", "show_contacts_attach", "", "contactidAttach", "addressidAttach")</script>';
+    }
+
+    $content .= '<script>display_contact_card(\'visible\', \'contact_card_attach\');</script>';
+
+    if ($core->test_admin('my_contacts', 'apps', false)) {
+        $content .= '<div id="create_contact_div_attach" style="display:none;float:right;width:65%;background-color:#deedf3">';
+            $content .= '<iframe width="100%" height="550" src="' . $_SESSION['config']['businessappurl']
+                    . 'index.php?display=false&dir=my_contacts&page=create_contact_iframe&fromAttachmentContact=Y&transmissionInput=0" name="contact_iframe_attach" id="contact_iframe_attach"'
+                    . ' scrolling="auto" frameborder="0" style="display:block;">'
+                    . '</iframe>';
+        $content .= '</div>';
+    }
+    $content .= '<div id="info_contact_div_attach" style="display:none;float:right;width:70%;background-color:#deedf3">';
+        $content .= '<iframe width="100%" height="800" name="info_contact_iframe_attach" id="info_contact_iframe_attach"'
+                . ' scrolling="auto" frameborder="0" style="display:block;">'
+                . '</iframe>';
+    $content .= '</div>';
+$content .= '<div style="float: right; width: 65%">';
+$content .= '<iframe src="'.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='
+    . functions::xssafe($_SESSION['doc_id']) . '&coll_id=' . $coll_id .
+    '" name="viewframevalid_attachment" id="viewframevalid_attachment"  scrolling="auto" frameborder="0" style="width:100% !important;height:90vh;" onmouseover="this.focus()"></iframe>';
+$content .= '</div>';
+/*if(!isset($_REQUEST['id'])){
+    $content .= '<script>var height = (parseInt($(\'form_attachments\').style.height.replace(/px/,""))-40)+"px";$(\'formAttachment\').style.height = height;$(\'viewframevalid_attachment\').style.height = height;$(\'formAttachment\').style.overflow = "auto";</script>';
+}else{
+    $content .= '<script>var height = (parseInt(window.top.window.$(\'form_attachments\').style.height.replace(/px/,""))-40)+"px";window.top.window.$(\'formAttachment\').style.height = height;window.top.window.$(\'viewframevalid_attachment\').style.height = height;window.top.window.$(\'formAttachment\').style.overflow = "auto";</script>';
+}*/
+
+echo "{status : " . $status . ", content : '" . addslashes(_parse($content)) . "', error : '" . addslashes($error) . "', exec_js : '".addslashes($js)."'}";
+exit ();
diff --git a/modules/entities/Controllers/EntitiesController.php b/modules/entities/Controllers/EntitiesController.php
index 0ce69ae9936fbbb523d3a56f097389ff6cce9c0c..297316cd9fd45a7516d04caede8550eff58325cf 100644
--- a/modules/entities/Controllers/EntitiesController.php
+++ b/modules/entities/Controllers/EntitiesController.php
@@ -81,7 +81,7 @@ class ResController
      * @param  $docserverId string
      * @param  $status string
      * @param  $fileFormat string
-     * @return $data
+     * @return array $data
      */
     public function prepareStorage($aArgs)
     {
diff --git a/modules/full_text/batch_tools.php b/modules/full_text/batch_tools.php
index 3b6c0c683747845fca0635aff2741347b187d6d3..beeb021c259cb5f0bf23a9d6b13fdfa74d857222 100755
--- a/modules/full_text/batch_tools.php
+++ b/modules/full_text/batch_tools.php
@@ -64,7 +64,7 @@ function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false)
  * 
  * @param int $returnCode code to exit (if > O error)
  * @param string $message message to the log and the DB
- * @return nothing, exit the program
+ * @return nothing exit the program
  */
 function Bt_exitBatch($returnCode, $message='')
 {
diff --git a/modules/life_cycle/batch/batch_tools.php b/modules/life_cycle/batch/batch_tools.php
index 49db290bd0098caf43b433405646c8c8e3989e0e..e9b0120dd9dcec0de71903f17ef3d34ef6e967d6 100644
--- a/modules/life_cycle/batch/batch_tools.php
+++ b/modules/life_cycle/batch/batch_tools.php
@@ -61,7 +61,7 @@ function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false)
  *
  * @param int $returnCode code to exit (if > O error)
  * @param string $message message to the log and the DB
- * @return nothing, exit the program
+ * @return nothing exit the program
  */
 function Bt_exitBatch($returnCode, $message='')
 {
diff --git a/modules/notifications/batch/batch_tools.php b/modules/notifications/batch/batch_tools.php
index 3e4916dbbf45687393c57453ba88ae628aae4e77..b19885273e919d38275db564627b8d5f31882cc6 100755
--- a/modules/notifications/batch/batch_tools.php
+++ b/modules/notifications/batch/batch_tools.php
@@ -64,7 +64,7 @@ function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false)
  * 
  * @param int $returnCode code to exit (if > O error)
  * @param string $message message to the log and the DB
- * @return nothing, exit the program
+ * @return nothing exit the program
  */
 function Bt_exitBatch($returnCode, $message='')
 {
diff --git a/modules/sendmail/batch/batch_tools.php b/modules/sendmail/batch/batch_tools.php
index f91372d974b35c4b9f84a059197b6a4e7be9c9b0..a01160f7ac1d674768e44dc386fb8807a26e044a 100644
--- a/modules/sendmail/batch/batch_tools.php
+++ b/modules/sendmail/batch/batch_tools.php
@@ -64,7 +64,7 @@ function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false)
  * 
  * @param int $returnCode code to exit (if > O error)
  * @param string $message message to the log and the DB
- * @return nothing, exit the program
+ * @return nothing exit the program
  */
 function Bt_exitBatch($returnCode, $message='')
 {
diff --git a/modules/thumbnails/batch_tools.php b/modules/thumbnails/batch_tools.php
index 3e4916dbbf45687393c57453ba88ae628aae4e77..b19885273e919d38275db564627b8d5f31882cc6 100755
--- a/modules/thumbnails/batch_tools.php
+++ b/modules/thumbnails/batch_tools.php
@@ -64,7 +64,7 @@ function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false)
  * 
  * @param int $returnCode code to exit (if > O error)
  * @param string $message message to the log and the DB
- * @return nothing, exit the program
+ * @return nothing exit the program
  */
 function Bt_exitBatch($returnCode, $message='')
 {