From 35f31b4060322947956ae5c3f2b5adf00b2033e1 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Fri, 15 Feb 2019 17:08:14 +0100
Subject: [PATCH] [REFACTORING] Del old print functions

---
 .../documents_list_copies.php                 |   9 -
 .../documents_list_with_attachments.php       |   9 -
 .../documents_list_mlb_search_adv.php         |   9 -
 apps/maarch_entreprise/lang/en.php            |   3 -
 apps/maarch_entreprise/lang/fr.php            |   3 -
 apps/maarch_entreprise/lang/nl.php            |   1 -
 apps/maarch_entreprise/print.php              |  39 -
 apps/maarch_entreprise/xml/print.xml          | 129 ---
 apps/maarch_entreprise/xml/services.xml       |   9 -
 core/class/PrintControler.php                 | 881 ------------------
 modules/avis/documents_list_with_avis.php     |   9 -
 modules/export_seda/export_seda_list.php      |   9 -
 .../visa/documents_list_with_signatory.php    |   9 -
 sql/data_en.sql                               |   5 -
 sql/data_fr.sql                               |   5 -
 sql/develop.sql                               |   1 +
 src/core/lang/lang-en.php                     |   1 -
 src/core/lang/lang-fr.php                     |   1 -
 src/core/lang/lang-nl.php                     |   1 -
 19 files changed, 1 insertion(+), 1132 deletions(-)
 delete mode 100755 apps/maarch_entreprise/print.php
 delete mode 100755 apps/maarch_entreprise/xml/print.xml
 delete mode 100755 core/class/PrintControler.php

diff --git a/apps/maarch_entreprise/documents_list_copies.php b/apps/maarch_entreprise/documents_list_copies.php
index 5d8638caea3..8661f8d31e7 100755
--- a/apps/maarch_entreprise/documents_list_copies.php
+++ b/apps/maarch_entreprise/documents_list_copies.php
@@ -667,15 +667,6 @@ $export2 = array(
 'disabledRules' => count($tab).' == 0',
 );
 array_push($paramsTab['tools'], $export2);
-if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
-    $print = array(
-            'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');",
-            'icon' => 'link',
-            'tooltip' => _PRINT_DOC_FROM_LIST,
-            'disabledRules' => count($tab).' == 0',
-        );
-    array_push($paramsTab['tools'], $print);
-}
 
 //Afficher la liste
 $status = 0;
diff --git a/apps/maarch_entreprise/documents_list_with_attachments.php b/apps/maarch_entreprise/documents_list_with_attachments.php
index 30fcc985a96..7e6a58b661d 100755
--- a/apps/maarch_entreprise/documents_list_with_attachments.php
+++ b/apps/maarch_entreprise/documents_list_with_attachments.php
@@ -668,15 +668,6 @@ $export2 = array(
     'disabledRules' => count($tab).' == 0',
     );
 array_push($paramsTab['tools'], $export2);
-if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
-    $print = array(
-                'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');",
-                'icon' => 'link',
-                'tooltip' => _PRINT_DOC_FROM_LIST,
-                'disabledRules' => count($tab).' == 0',
-            );
-    array_push($paramsTab['tools'], $print);
-}
 
 //Afficher la liste
 $status = 0;
diff --git a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
index 67a73c61b57..2ae97e892b6 100755
--- a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
+++ b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
@@ -935,15 +935,6 @@ if ($nbTab > 0) {
         array_push($paramsTab['tools'], $export2);
     }
 
-    if ($printTool && $core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
-        $print = array(
-                    'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');",
-                    'icon' => 'link',
-                    'tooltip' => _PRINT_DOC_FROM_LIST,
-                    'disabledRules' => $nbTab.' == 0',
-                    );
-        array_push($paramsTab['tools'], $print);
-    }
 
     //Afficher la liste
     $list->showList($tab, $paramsTab, $listKey);
diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php
index 6048a0df9de..d5f3ebbb82b 100755
--- a/apps/maarch_entreprise/lang/en.php
+++ b/apps/maarch_entreprise/lang/en.php
@@ -4310,9 +4310,6 @@ if (!defined('_PRINT_DETAILS_SERVICE')) {
 if (!defined('_PRINT_DETAILS')) {
     define('_PRINT_DETAILS', 'Print liaison sheet');
 }
-if (!defined('_PRINT_DOC_DETAILS_FROM_LIST')) {
-    define('_PRINT_DOC_DETAILS_FROM_LIST', 'Print the liaison sheets from the results lists');
-}
 if (!defined('_PRINT_LIST')) {
     define('_PRINT_LIST', 'Print the list');
 }
diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php
index 081bb83178d..bb609f62aae 100755
--- a/apps/maarch_entreprise/lang/fr.php
+++ b/apps/maarch_entreprise/lang/fr.php
@@ -4378,9 +4378,6 @@ if (!defined('_PRINT_DETAILS_SERVICE')) {
 if (!defined('_PRINT_DETAILS')) {
     define('_PRINT_DETAILS', 'Imprimer fiche de liaison');
 }
-if (!defined('_PRINT_DOC_DETAILS_FROM_LIST')) {
-    define('_PRINT_DOC_DETAILS_FROM_LIST', 'Imprimer les fiches de liaison depuis les listes de résultats');
-}
 if (!defined('_PRINT_DOC_FROM_LIST')) {
     define('_PRINT_DOC_FROM_LIST', 'Imprimer les fiches de liaison des documents');
 }
diff --git a/apps/maarch_entreprise/lang/nl.php b/apps/maarch_entreprise/lang/nl.php
index b79fdb8af54..5c55b4f85a7 100755
--- a/apps/maarch_entreprise/lang/nl.php
+++ b/apps/maarch_entreprise/lang/nl.php
@@ -1411,7 +1411,6 @@ if (!defined('_ITEM_FOLDER')) { define('_ITEM_FOLDER', 'Organisch klassement');}
 if (!defined('_CHOOSE_CURRENT_STATUS')) { define('_CHOOSE_CURRENT_STATUS', 'Huidige status bewaren');}
 if (!defined('_PRINT_DETAILS_SERVICE')) { define('_PRINT_DETAILS_SERVICE', 'De verbindingsfiche vanuit de detailfiche afdrukken');}
 if (!defined('_PRINT_DETAILS')) { define('_PRINT_DETAILS', 'De verbindingsfiche afdrukken');}
-if (!defined('_PRINT_DOC_DETAILS_FROM_LIST')) { define('_PRINT_DOC_DETAILS_FROM_LIST', 'De verbindingsfiche vanuit de resultatenlijsten afdrukken');}
 if (!defined('_PRINT_DOC_FROM_LIST')) { define('_PRINT_DOC_FROM_LIST', 'De verbindingsfiches van de documenten afdrukken');}
 if (!defined('_PRINT_LIST')) { define('_PRINT_LIST', 'De lijst afdrukken');}
 if (!defined('_PRINT_CATEGORY')) { define('_PRINT_CATEGORY', 'Categorie');}
diff --git a/apps/maarch_entreprise/print.php b/apps/maarch_entreprise/print.php
deleted file mode 100755
index 322deb9ec8c..00000000000
--- a/apps/maarch_entreprise/print.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-require_once('core/class/PrintControler.php');
-
-if (isset($_REQUEST['id']) && $_REQUEST['id'] <> '') {
-	$print = new PrintControler($_REQUEST['id']);
-} else {
-	$print = new PrintControler();
-}
-
-if (!empty($_SESSION['error'])) {
-    
-    ?>
-    <script language="javascript" >
-        window.opener.location.reload();
-        window.close();
-    </script>
-    <?php
-    
-} else {
-	if (
-		file_exists($_SESSION['config']['tmppath'] . $_SESSION['print']['filename']) 
-		&& $_SESSION['print']['filename'] <> ''
-	) {
-		header('Pragma: public');
-		header('Expires: 0');
-		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-		//header('Cache-Control: public');
-		//header('Content-Description: File Transfer');
-		header('Content-Type: application/pdf');
-		header('Content-Disposition: inline; filename=print_maarch.pdf;');
-		//header('Content-Transfer-Encoding: binary');
-		readfile($_SESSION['config']['tmppath'] . $_SESSION['print']['filename']);
-		unlink($_SESSION['config']['tmppath'] . $_SESSION['print']['filename']);
-	} else {
-		echo _NO_DOC_OR_NO_RIGHTS;
-	}
-    exit;
-}
diff --git a/apps/maarch_entreprise/xml/print.xml b/apps/maarch_entreprise/xml/print.xml
deleted file mode 100755
index 141441ebf61..00000000000
--- a/apps/maarch_entreprise/xml/print.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ROOT>
-    <!--
-        letterbox_coll
-    -->
-    <letterbox_coll>
-        <FIELD>
-            <LIBELLE>Num GED</LIBELLE>
-            <DATABASE_FIELD>res_view_letterbox.res_id</DATABASE_FIELD>
-        </FIELD>
-        <!-- line 1 -->
-        <FIELD>
-            <LIBELLE>Catégorie du courrier</LIBELLE>
-            <DATABASE_FIELD>category_id</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Priorité</LIBELLE>
-            <DATABASE_FIELD>priority</DATABASE_FIELD>
-        </FIELD>
-        <!-- line 2 -->
-        <FIELD>
-            <LIBELLE>Date d'arrivée</LIBELLE>
-            <DATABASE_FIELD>admission_date</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Date limite de traitement</LIBELLE>
-            <DATABASE_FIELD>process_limit_date</DATABASE_FIELD>
-        </FIELD>
-        <!-- line 3 -->
-        <FIELD>
-            <LIBELLE>Date de création</LIBELLE>
-            <DATABASE_FIELD>creation_date</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Nature du courrier</LIBELLE>
-            <DATABASE_FIELD>nature_id</DATABASE_FIELD>
-        </FIELD>
-        <!-- line 4 -->
-        <FIELD>
-            <LIBELLE>Date du document</LIBELLE>
-            <DATABASE_FIELD>doc_date</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Type de courrier</LIBELLE>
-            <DATABASE_FIELD>type_label</DATABASE_FIELD>
-        </FIELD>
-        <!-- line 5 -->
-        <FIELD>
-            <LIBELLE>Dossier</LIBELLE>
-            <DATABASE_FIELD>folder_name</DATABASE_FIELD>
-        </FIELD>
-        <!-- line 6 -->
-        <FIELD>
-            <LIBELLE>Statut</LIBELLE>
-            <DATABASE_FIELD>status</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Num chrono</LIBELLE>
-            <DATABASE_FIELD>alt_identifier</DATABASE_FIELD>
-        </FIELD>
-        <!-- other infos-->
-        <FIELD>
-            <LIBELLE>Nom de l'entité primaire de l'utilisateur ayant enregistré le courrier</LIBELLE>
-            <DATABASE_FIELD>initiator</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>ID de l'expéditeur</LIBELLE>
-            <DATABASE_FIELD>contact_id</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Prénom de l'expéditeur</LIBELLE>
-            <DATABASE_FIELD>contact_firstname</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Nom de l'expéditeur</LIBELLE>
-            <DATABASE_FIELD>contact_lastname</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Société de l'expéditeur</LIBELLE>
-            <DATABASE_FIELD>contact_society</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Nom du contact interne</LIBELLE>
-            <DATABASE_FIELD>user_lastname</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Prénom du contact interne</LIBELLE>
-            <DATABASE_FIELD>user_firstname</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Service destinataire</LIBELLE>
-            <DATABASE_FIELD>entity_label</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Destinataire principal</LIBELLE>
-            <DATABASE_FIELD>dest_user</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Objet</LIBELLE>
-            <DATABASE_FIELD>subject</DATABASE_FIELD>
-        </FIELD>
-        <FIELD>
-            <LIBELLE>Responsable de versement</LIBELLE>
-            <DATABASE_FIELD>typist</DATABASE_FIELD>
-        </FIELD>
-        <FUNCTIONS>
-            <FUNCTION>
-                <LIBELLE>Contacts multiples</LIBELLE>
-                <CALL>retrieve_multi_contacts</CALL>
-            </FUNCTION>
-            <FUNCTION>
-                <LIBELLE>Services en copie</LIBELLE>
-                <CALL>retrieve_copies</CALL>
-            </FUNCTION>
-            <FUNCTION>
-                <LIBELLE>Notes libres</LIBELLE>
-                <CALL>free_notes</CALL>
-            </FUNCTION>
-            <FUNCTION>
-                <LIBELLE>Notes</LIBELLE>
-                <CALL>retrieve_notes</CALL>
-            </FUNCTION>
-            <FUNCTION>
-                <LIBELLE>Circuit visa</LIBELLE>
-                <CALL>retrieve_VisaWorkflow</CALL>
-            </FUNCTION>
-        </FUNCTIONS>
-    </letterbox_coll>
-</ROOT>
diff --git a/apps/maarch_entreprise/xml/services.xml b/apps/maarch_entreprise/xml/services.xml
index 397af0de6e2..4be51c958f8 100755
--- a/apps/maarch_entreprise/xml/services.xml
+++ b/apps/maarch_entreprise/xml/services.xml
@@ -388,15 +388,6 @@
       <nature>include</nature>
     </WHEREAMIUSED>
   </SERVICE>
-  <SERVICE>
-    <id>print_doc_details_from_list</id>
-    <name>_PRINT_DOC_DETAILS_FROM_LIST</name>
-    <comment>_PRINT_DOC_DETAILS_FROM_LIST</comment>
-    <servicepage>print.php</servicepage>
-    <servicetype>use</servicetype>
-    <system_service>false</system_service>
-    <enabled>true</enabled>
-  </SERVICE>
   <SERVICE>
     <id>admin_update_control</id>
     <name>_UPDATE_CONTROL</name>
diff --git a/core/class/PrintControler.php b/core/class/PrintControler.php
deleted file mode 100755
index e85b2c35733..00000000000
--- a/core/class/PrintControler.php
+++ /dev/null
@@ -1,881 +0,0 @@
-<?php
-/*------------------------------------------------------------------------------
-- Require needed classes
-------------------------------------------------------------------------------*/
-require_once('core/class/class_functions.php');
-require_once('core/class/class_core_tools.php');
-require_once('core/class/class_db.php');
-require_once('core/class/class_history.php');
-require_once('apps/maarch_entreprise/class/class_business_app_tools.php');
-require_once('core/class/class_security.php');
-
-require_once('apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf.php');
-require_once('apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdi.php');
-require_once('apps/maarch_entreprise/tools/phpqrcode/qrlib.php');
-
-class EmptyObject {
-    function __construct()
-    {
-        $test = '';
-    }
-}
-
-/*------------------------------------------------------------------------------
-- PrintControler
-------------------------------------------------------------------------------*/
-class PrintControler extends PrintFunctions
-{
-    /*--------------------------------------------------------------------------
-    - Attributes
-    --------------------------------------------------------------------------*/
-        // Public
-        // Private
-        public $collection    = false;
-        public $configuration = false;
-        
-        public $object_print = false;
-        public $array_print  = false;
-    
-    /*--------------------------------------------------------------------------
-    - Methods
-    --------------------------------------------------------------------------*/
-        // Public
-        function __construct($resId = '')
-        {
-			$core = new core_tools();
-			$core->load_lang();
-            $this->collection = $_SESSION['collection_id_choice'];
-            $this->load_configuration();
-			if ($resId <> '') {
-				$this->retrieve_datas($resId);
-			} else {
-				$this->retrieve_datas($resId);
-			}
-            $this->process_functions();
-            $_SESSION['print']['filename'] = $this->make_pdf($resId);
-        }
-        
-        // Private
-        private function load_configuration()
-        {
-            // Retrieve id to create paths (app & custom)
-            $id_app = $_SESSION['config']['app_id'];
-            $id_custom = false;
-            if (!empty($_SESSION['custom_override_id']))
-                $id_custom = $_SESSION['custom_override_id'];
-            $collection = $this->collection;
-            
-            // Retrieve name for print configuration file
-            $fileName = 'print.xml';
-            
-            // Make paths to xml dir
-            $pathToDir_app = 'apps/' . $id_app . '/xml/';
-            $pathToDir_custom = 'custom/' . $id_custom . '/' . $pathToDir_app;
-            
-            $pathToFile_app = $pathToDir_app . $fileName;
-            $pathToFile_custom = $pathToDir_custom . $fileName;
-            
-            // Load the configuration file
-            if ($id_custom && file_exists($pathToFile_custom))
-                $configuration = simplexml_load_file($pathToFile_custom);
-            else
-                $configuration = simplexml_load_file($pathToFile_app);
-            
-            // Store interesting part of the configuration
-            $this->configuration = $configuration->{$collection};
-        }
-        
-        private function retrieve_datas($resId = '')
-        {
-            // Retrieve the query
-			if ($resId <> '') {
-				$query = $this->make_query($resId);
-			} else {
-				$query = $this->make_query();
-			}
-            // Retrieve datas
-            $db = new Database();
-            if ($resId <> '') {
-            	$stmt = $db->query($query);
-            } else {
-            	$stmt = $db->query($query, $_SESSION['last_select_query_parameters']);
-            }
-
-            $i = 0;
-            $this->object_print = new EmptyObject();
-            while($line = $stmt->fetchObject()) {
-                $this->object_print->{$i} = $line;
-                $i++;
-            }
-			//var_dump($this->object_print);exit;
-        }
-        
-        private function make_query($resId = '')
-        {
-            // Retrieve the end of last select query on the list
-            $endLastQuery = substr(
-                $_SESSION['last_select_query'], 
-                strpos(
-                    $_SESSION['last_select_query'], 
-                    'FROM'
-                )
-            );
-            
-			if ($resId <> '') {
-				$security = new security();
-				// retrieve view name
-				$view = $security->retrieve_view_from_coll_id($this->collection);
-				$endLastQuery = 'FROM ' . $view . ' where res_id = ' . $resId;
-				// TEST SECURITY ACCESS !!!!
-				$right = $security->test_right_doc($this->collection, $resId);
-				if (!$right) {
-					$endLastQuery .= ' and 1=-1';
-				}
-			}
-            // Create template for the new query
-            $query_template = 'SELECT ';
-                $query_template .= '##DATABASE_FIELDS## ';
-            $query_template .= $endLastQuery;
-            
-            // Retrieve ##DATABASE_FIELDS##
-            $fields = $this->configuration->FIELD;
-            $i_max = count($fields);
-            $database_fields = false;
-            for($i=0; $i<$i_max; $i++) {
-                $field = $fields[$i];
-                $database_fields .= $field->DATABASE_FIELD;
-                if ($i != ($i_max-1))
-                    $database_fields .= ', ';
-            }
-            
-            // Return query
-            return str_replace(
-                '##DATABASE_FIELDS##', 
-                $database_fields, 
-                $query_template
-            );
-        }
-        
-        private function retrieve_encoding($string)
-        {
-            return mb_detect_encoding($string, 'UTF-8', true);
-        }
-        
-        private function unprotect_string($string)
-        {
-            return str_replace("\'", "'", $string);
-        }
-        
-        private function process_functions()
-        {
-            $functions = $this->configuration->FUNCTIONS->FUNCTION;
-            $functions_max = count($functions);
-            for($i=0; $i<$functions_max; $i++) {
-                $function = $functions[$i];
-                $call = $function->CALL;
-                if (method_exists($this, $call))
-                    eval('$this->' . $call . '(\'' . $function->LIBELLE . '\');');
-            }
-        }
-        
-		private function make_pdf($resId)
-        {
-            $functions = new functions();
-			$db = new Database();
-			
-            $this->array_print = $functions->object2array($this->object_print);
-			//var_dump($this->array_print);exit;
-			
-			if (count((array)$this->array_print) == 0) {
-				return false;
-			}
-			
-			$pdf= new fpdi();//create a new document PDF
-
-			$cptResToPrint = count($this->array_print);
-			
-			for ($cpt=0;$cpt<$cptResToPrint;$cpt++) {
-				$y = 0;
-				
-				//$pdf->addPage(); //Add a blank page
-
-	            // Retrieve id to create paths (app & custom)
-	            $id_app = $_SESSION['config']['app_id'];
-	            $id_custom = false;
-	            if (!empty($_SESSION['custom_override_id']))
-	                $id_custom = $_SESSION['custom_override_id'];
-
-	            // Retrieve name for template file
-	            $fileName_pdfTemplate = 'TemplatePrint.pdf';
-	            
-	            // Make paths to pdf dir
-	            $pathToDir_pdfTemplate = 'apps/' . $id_app . '/indexing_searching/';
-	            $pathToDir_custom_pdfTemplate = 'custom/' . $id_custom . '/' . $pathToDir_pdfTemplate;
-	            
-	            $pathToFile_pdfTemplate = $pathToDir_pdfTemplate . $fileName_pdfTemplate;
-	            $pathToFile_custom_pdfTemplate = $pathToDir_custom_pdfTemplate . $fileName_pdfTemplate;
-	            
-	            // Load the pdf template file
-	            if ($id_custom && file_exists($pathToFile_custom_pdfTemplate))
-	                $pdfTemplate = $pathToFile_custom_pdfTemplate;
-	            else
-	                $pdfTemplate = $pathToFile_pdfTemplate;
-
-				$pageCount = $pdf->setSourceFile($pdfTemplate);
-				$tplIdx = $pdf->importPage(1);
-
-				$pdf->addPage();
-				$pdf->useTemplate($tplIdx);
-			
-				/**********************************************************************/
-				
-				//THE FONT
-				$pdf->SetFont('Arial','B',11);
-				
-				//APPLICATION NAME
-				$pdf->Cell(140,5, utf8_decode($_SESSION['config']['applicationname']),0,0, 'C', false);
-				
-				$pdf->SetFont('Arial','',10);
-				
-				//PRINT DATE
-				$pdf->Cell(40,5,utf8_decode(_PRINT_DATE . ' : ') . date('d-m-Y'),0,1, 'L', false);
-				
-				$pdf->SetFont('Arial','B',10);
-				
-				//INITIATOR
-                if (!empty($resId)) {
-                    $filename_QR = $_SESSION['config']['tmppath'].DIRECTORY_SEPARATOR.$_SESSION['user']['UserId'] . time() . rand() ."_QRCODE.png";
-                    QRcode::png($resId, $filename_QR);
-
-                    $pdf->Image($filename_QR, 7, 3);
-                }
-                $pdf->Cell(20, 5, "", 0, 0, 'L', false);
-                if ($this->array_print[$cpt]['initiator'] <> '') {
-                    $stmt = $db->query(
-                    	"select entity_label from entities where entity_id = ?", 
-                    	array($this->array_print[$cpt]['initiator'])
-                    );
-                    $resultEntity = $stmt->fetchObject();
-                    $pdf->MultiCell(100, 5, utf8_decode(_INITIATOR . ' : '
-                        . $resultEntity->entity_label . " (" . $this->array_print[$cpt]['initiator'] . ")"), 0, 'C', false);
-				} elseif($this->array_print[$cpt]['typist'] <> '') {
-                    require_once "modules/entities/class/class_manage_entities.php";
-                    $entity = new entity();
-                    $initiator = $entity->get_primary_entity($this->array_print[$cpt]['typist']);
-                    $stmt = $db->query(
-                    	"select entity_label from entities where entity_id = ?", 
-                    	array($initiator['ID'])
-                    );
-                    $resultEntity = $stmt->fetchObject();
-                    $pdf->MultiCell(36,5,utf8_decode(_INITIATOR . ' : ' 
-                        . $resultEntity->entity_label . " (" . $initiator['ID'] . ")"), 0, 1, 'L', false);
-                }
-				$pdf->SetFont('Arial', 'B', 14);
-				
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-                
-				//TITLE
-                if($this->array_print[$cpt]['alt_identifier'] <> '' && _ID_TO_DISPLAY == 'chrono_number'){
-                    $fileNumber = $this->array_print[$cpt]['alt_identifier'];
-                } else {
-                    $fileNumber = $this->array_print[$cpt]['res_id'];
-                }
-				$pdf->Cell(182,5,utf8_decode(_PRINTED_FILE_NUMBER . ' : ') . $fileNumber, 1, 1, 'C', false);
-				
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				
-				$pdf->SetFont('Arial','B',10);
-				
-				/**********************************************************************/
-				
-				//TITLE DOCUMENT
-				$pdf->Cell(36,5,utf8_decode(_INFORMATIONS_OF_THE_DOCUMENT),0,1, 'L', false);
-				
-				$pdf->SetFont('Arial','',9);
-				
-				//LINE 1
-				if ($this->array_print[$cpt]['category_id'] <> '' || $this->array_print[$cpt]['priority'] <> '') {
-                    if (count($_SESSION['coll_categories']) == 0) {
-                        $categoryLabel = $_SESSION['mail_categories'][$this->array_print[$cpt]['category_id']];
-                    } else {
-                        $categoryLabel = $_SESSION['coll_categories']['letterbox_coll'][$this->array_print[$cpt]['category_id']];
-                    }
-					//CATEGORY
-					$pdf->Cell(91,5,utf8_decode(_PRINT_CATEGORY . ' : ' 
-						. html_entity_decode($categoryLabel)),1,0, 'L', false);
-                    //PRIORITY
-                    foreach ($_SESSION['mail_priorities_id'] as $key => $prioValue) {
-                        if ($prioValue == $this->array_print[$cpt]['priority']) {
-                            $fakeId = $key;
-                        }
-                    }
-
-					$pdf->Cell(91,5,utf8_decode(_PRINT_PRIORITY . ' : ' . $_SESSION['mail_priorities'][$fakeId]),1,1, 'L', false);
-				}
-				
-				//LINE 2
-				if ($this->array_print[$cpt]['admission_date'] <> '' || $this->array_print[$cpt]['process_limit_date'] <> '') {
-					//ADMISSION DATE
-					$pdf->Cell(91,5,utf8_decode(_PRINT_ADMISSION_DATE . ' : ') 
-						. $functions->format_date_db($this->array_print[$cpt]['admission_date'], false),1,0, 'L', false);
-					//PROCESS_LIMIT_DATE
-					$pdf->Cell(91,5,utf8_decode(_PRINT_PROCESS_LIMIT_DATE . ' : ') 
-						. $functions->format_date_db($this->array_print[$cpt]['process_limit_date'], false),1,1, 'L', false);
-				}
-				
-				//LINE 3, 4
-				if ($this->array_print[$cpt]['nature_id'] <> '' || $this->array_print[$cpt]['doc_date'] <> '') {
-					//CREATION DATE
-					$pdf->Cell(91,5,utf8_decode(_CREATED_ON . ' : ') 
-						. $functions->format_date_db($this->array_print[$cpt]['creation_date'], false),1,0, 'L', false);
-					
-					//NATURE
-					foreach (array_keys($_SESSION['mail_natures']) as $nature) {
-						if ($this->array_print[$cpt]['nature_id'] == $nature) {
-							$this->array_print[$cpt]['nature_id'] = $_SESSION['mail_natures'][$nature];
-						}
-					}
-					$pdf->Cell(91,5,utf8_decode(_NATURE . ' : ' . $this->array_print[$cpt]['nature_id']),1,1, 'L', false);
-					
-					//DOC DATE
-					$pdf->Cell(91,5,utf8_decode(_PRINT_DOC_DATE . ' : ') 
-						. $functions->format_date_db($this->array_print[$cpt]['doc_date'], false),1,0, 'L', false);
-					
-					//DOCTYPE
-					$pdf->Cell(91,5,utf8_decode(_DOCTYPE . ' : ' . $this->array_print[$cpt]['type_label']),1,1, 'L', false);
-				} else {
-					//CREATION DATE
-					$pdf->Cell(91,5,utf8_decode(_CREATED_ON . ' : ') 
-						. $functions->format_date_db($this->array_print[$cpt]['creation_date'], false),1,0, 'L', false);
-					
-					//DOCTYPE
-					$pdf->Cell(91,5,utf8_decode(_DOCTYPE . ' : ' . $this->array_print[$cpt]['type_label']),1,1, 'L', false);
-				}
-				
-				//LINE 5
-				if ($this->array_print[$cpt]['folder_name'] <> '') {
-					//FOLDER
-					$pdf->Cell(91,5,utf8_decode(_PRINT_FOLDER . ' : ' . $this->array_print[$cpt]['folder_name']),1,0, 'L', false);
-				}
-				
-				//LINE 6
-				if ($this->array_print[$cpt]['status'] <> '' || $this->array_print[$cpt]['alt_identifier'] <> '') {
-                    require_once('core/class/class_manage_status.php');
-                    $status_obj = new manage_status();
-                    $res_status = $status_obj->get_status_data($this->array_print[$cpt]['status'], '');
-					//STATUS
-					$pdf->Cell(91,5,utf8_decode(_PRINT_STATUS . ' : ' . $res_status['LABEL']),1,0, 'L', false);
-					//ALT IDENTIFIER
-					$pdf->Cell(91,5,utf8_decode(_PRINT_ALT_IDENTIFIER . ' : ' . $this->array_print[$cpt]['alt_identifier']),1,1, 'L', false);
-				}
-				
-				/**********************************************************************/
-                //UNIQUE CONTACT
-				if ($this->array_print[$cpt]['contact_id'] <> '') {
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    
-                    $pdf->SetFont('Arial','B',11);
-				    
-				    $stmt = $db->query(
-				    	"SELECT address_id FROM res_view_letterbox WHERE res_id = ?",
-				    	array($this->array_print[$cpt]['res_id'])
-				    );
-                    $resultAddressId = $stmt->fetchObject();
-
-                    $contactInfos = $this->getContactInfos($this->array_print[$cpt]['contact_id'], $resultAddressId->address_id);
-                    //CONTACT
-                    $pdf->Cell(182,5,utf8_decode(_PRINT_CONTACT),0,1, 'C', false);
-                
-                    $pdf->SetFont('Arial','',11);
-                    
-                    $pdf->MultiCell(182,5,utf8_decode($contactInfos),1, 'C', false);
-				}
-
-                //UNIQUE INTERNAL CONTACT
-				if ($this->array_print[$cpt]['user_lastname'] <> '') {
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    
-                    $pdf->SetFont('Arial','B',11);
-				    
-                    //CONTACT
-                    $pdf->Cell(182,5,utf8_decode(_PRINT_CONTACT),0,1, 'C', false);
-                
-                    $pdf->SetFont('Arial','',11);
-                    
-                    $pdf->MultiCell(182,5,utf8_decode($this->array_print[$cpt]['user_firstname'] . " " . $this->array_print[$cpt]['user_lastname']),1, 'C', false);
-				}
-
-				/**********************************************************************/
-				//MULTI CONTACT
-				if ($this->array_print[$cpt]['retrieve_multi_contacts'] <> '') {
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    
-                    $pdf->SetFont('Arial','B',11);
-					$pdf->Cell(182,5,utf8_decode(_MULTI_CONTACTS),0,1, 'C', false);
-					
-					$pdf->SetFont('Arial','',11);
-					
-					$pdf->MultiCell(182,5,utf8_decode($this->array_print[$cpt]['retrieve_multi_contacts']),1, 'L', false);
-				}
-				
-				/**********************************************************************/
-                
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				
-				$pdf->SetFont('Arial','B',11);
-				
-				//SUBJECT
-				$pdf->Cell(182,5,utf8_decode(_PRINT_SUBJECT),0,1, 'C', false);
-				
-				$pdf->SetFont('Arial','',11);
-				
-				$pdf->MultiCell(182,5, iconv('UTF-8', 'windows-1252', $this->unprotect_string($this->array_print[$cpt]['subject'])),1, 'L', false);
-				
-				/**********************************************************************/
-				
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				
-				$pdf->SetFont('Arial','B',11);
-				
-				$userInfos = $this->getUserInfo($this->array_print[$cpt]['dest_user']);
-				
-				//DESTINATION
-				$pdf->Cell(182,5,utf8_decode(_PRINT_PROCESS_ENTITY),0,1, 'C', false);
-				
-				$pdf->SetFont('Arial','B',11);
-				
-				$pdf->MultiCell(182,5,utf8_decode($this->array_print[$cpt]['entity_label']. "\r\n" . $userInfos),1, 'C', false);
-				
-				/**********************************************************************/
-				
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				
-				$pdf->SetFont('Arial','B',11);
-				
-				//COPIES
-				if ($this->array_print[$cpt]['retrieve_copies'] <> '') {
-					$pdf->Cell(182,5,utf8_decode(_PRINT_COPIES),0,1, 'C', false);
-					
-					$pdf->SetFont('Arial','',11);
-					
-					$pdf->MultiCell(182,5,utf8_decode($this->array_print[$cpt]['retrieve_copies']),1, 'L', false);
-				}
-
-                /**********************************************************************/
-                
-                //VISA WORKFLOW
-                if ($this->array_print[$cpt]['retrieve_VisaWorkflow'] <> '') {
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    
-                    $pdf->SetFont('Arial','B',11);
-                
-                    $pdf->Cell(182,5,utf8_decode(strtoupper(_VISA_WORKFLOW)),0,1, 'C', false);
-                    
-                    $pdf->Cell(140,5,_ADMIN_USERS,1,0, 'C', false);
-                    $pdf->Cell(42,5,_PROCESS_DATE,1,1, 'C', false);
-                    $pdf->SetFont('Arial','',11);
-                    foreach ($this->array_print[$cpt]['retrieve_VisaWorkflow'] as $key => $value) {
-                        $signatory = '';
-                        if($value['signatory'] || ($value['requested_signature'] && empty($value['process_date']))){
-                            $signatory = ' ('._SIGNATORY.')';
-                        } else {
-                            $signatory = ' ('._VISA_USER_SEARCH_MIN.')';
-                        }
-                        $pdf->Cell(140,5,utf8_decode($key+1 . '. ' .$value['firstname']. ' ' . $value['lastname'] . $signatory),1,0, 'L', false);
-                        $pdf->Cell(42,5,functions::format_date_db($value['process_date'], true, '', true),1,1, 'C', false);
-                    }
-
-                }
-				
-				/**********************************************************************/
-				
-				//NOTES
-				if ($this->array_print[$cpt]['retrieve_notes'] <> '') {
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    
-                    $pdf->SetFont('Arial','B',11);
-                
-					$pdf->Cell(182,5,utf8_decode(_PRINT_NOTES),0,1, 'C', false);
-					
-					$pdf->SetFont('Arial','',11);
-					
-					$pdf->MultiCell(182,5,utf8_decode($this->array_print[$cpt]['retrieve_notes']),1, 'L', false);
-				}
-				
-				/**********************************************************************/
-                
-				//FREE NOTES
-				if ($this->array_print[$cpt]['free_notes'] <> '') {
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    
-                    $pdf->SetFont('Arial','B',11);
-                
-					$pdf->Cell(182,5,utf8_decode(_PRINT_FREE_NOTES),0,1, 'C', false);
-					
-					$pdf->SetFont('Arial','',11);
-					
-					$pdf->MultiCell(182,5,utf8_decode($this->array_print[$cpt]['free_notes']),1, 'L', false);
-				}
-
-                /**********************************************************************/
-
-                if (!empty($_SESSION['features']['further_informations'])) {
-                    $pdf->SetFont('Arial', 'B', 11);
-
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-                    //BREAK A LINE
-                    $pdf->SetY($pdf->GetY()+4);
-
-                    //FURTHER INFORMATION
-                    $pdf->Cell(182,5,utf8_decode(_PRINT_FURTHER_INFORMATIONS),0,1, 'C', false);
-                    $pdf->SetFont('Arial', '', 11);
-                    foreach ($_SESSION['features']['further_informations'] as $key => $value) {
-                        $pdf->MultiCell(182, 5, utf8_decode($key . ' : ' . $value), 1, 'L', false);
-                    }
-                }
-
-				/**********************************************************************/
-				
-				$pdf->SetFont('Arial','B',11);
-				
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				//BREAK A LINE
-				$pdf->SetY($pdf->GetY()+4);
-				
-				//TYPIST
-				$userInfos = $this->getUserInfo($this->array_print[$cpt]['typist']);
-				$pdf->Cell(150,5,utf8_decode(_PRINT_TYPIST . " : " . $userInfos),0,0, 'L', false);
-                /**********************************************************************/
-			}
-			
-			//$pdf->AutoPrint(true);
-        
-			$printNameInTmp = "print_" 
-				. $_SESSION['user']['UserId'] . '_' . rand() . ".pdf";
-			$_SESSION['printNameInTmp'] = $printNameInTmp;
-			$pdfPath = $_SESSION['config']['tmppath'] . $printNameInTmp;
-			
-			$pdf->Output($pdfPath);
-			
-			return $printNameInTmp;
-		}
-}
-
-class PrintFunctions
-{
-    /* -------------------------------------------------------------------------
-    - Functions
-    -
-    - All the functions must have only one argument
-    - This argument is the name of the column for the header of the print
-    -
-    - Toutes les fonctions doivent avoir un argument et un seul
-    - Cette argument est le libelle de la colonne à afficher dans l'en-tête du
-    - fichier d'print
-    ------------------------------------------------------------------------- */
-	function getContactInfos($contactId, $addressId = "")
-	{
-		$business = new business_app_tools();
-		$tmp = $business->get_titles();
-		$titles = $tmp['titles'];
-		
-		$contactInfos = '';
-	
-		$db = new Database();
-		
-		$query = "select * from view_contacts where contact_id = ? AND ca_id = ?";
-		$stmt = $db->query($query, array($contactId, $addressId));
-        while($result = $stmt->fetchObject()) {
-        	if ($result->society <> '' || $result->society_short <> '') {
-				if ($result->society <> '') {
-					$contactInfos = $result->society . "";
-				}
-				if ($result->society_short <> '') {
-					$contactInfos .= ' ('.$result->society_short . ")";
-				}
-				$contactInfos .= "\r\n";
-        	}
-
-			if ($result->contact_title <> '' && $result->contact_lastname <> '') {
-				foreach(array_keys($titles) as $key) {
-					if($result->contact_title == $key) {
-						$result->contact_title = $titles[$key];
-					}
-				}
-				$contactInfos .= $result->contact_title . ' ';
-			}
-			if ($result->contact_firstname <> '') {
-				$contactInfos .= $result->contact_firstname . ' ';
-			}
-			if ($result->contact_lastname <> '') {
-				$contactInfos .= $result->contact_lastname ."\r\n";
-			}
-			if ($result->contact_purpose_label <> '') {
-				$contactInfos .= $result->contact_purpose_label . ' ';
-			}
-			if ($result->title <> '' && $result->lastname <> '') {
-				foreach(array_keys($titles) as $key) {
-					if($result->title == $key) {
-						$result->title = $titles[$key];
-					}
-				}
-				$contactInfos .= $result->title . ' ';
-			}
-			if ($result->firstname <> '') {
-				$contactInfos .= $result->firstname . ' ';
-			}
-			if ($result->lastname <> '') {
-				$contactInfos .= $result->lastname;
-			}
-			if ($result->departement <> '') {
-				$contactInfos .= ', ' .$result->departement . ' ';
-			}
-			$contactInfos .= "\r\n";
-			if ($result->address_num <> '') {
-				$contactInfos .= $result->address_num . ' ';
-			}
-			if ($result->address_street <> '') {
-				$contactInfos .= $result->address_street . ' ';
-			}
-			if ($result->address_complement <> '') {
-				$contactInfos .= $result->address_complement;
-			}
-			if ($result->address_postal_code <> '') {
-				$contactInfos .= $result->address_postal_code . ' ';
-			}
-			if ($result->address_town <> '') {
-				$contactInfos .= $result->address_town . ' ';
-			}
-			if ($result->address_country <> '') {
-				$contactInfos .= $result->address_country;
-			}
-			$contactInfos .= "\r\n";
-			$contactInfos .= "\r\n";
-		}
-		return $contactInfos;
-	}
-	
-	function getUserInfo($userId)
-    {
-		if ($userId <> '') {
-			$db = new Database();
-			$stmt = $db->query("select firstname, lastname from users where user_id = ?", array($userId));
-			$resultUsers = $stmt->fetchObject();
-			if ($resultUsers->firstname <> '' && $resultUsers->lastname <> '') {
-				return $resultUsers->firstname . ' ' . $resultUsers->lastname;
-			}
-		} else {
-			return false;
-		}
-	}
-	
-    function retrieve_multi_contacts($libelle)
-    {
-        $db = new Database();
-        $queryContacts = "select c.firstname, c.lastname, c.society, c.contact_id, cres.address_id ";
-		$queryContacts .= "from view_contacts c, contacts_res cres  ";
-		$queryContacts .= "where cres.coll_id = 'letterbox_coll' AND cres.res_id = ##res_id## AND cast (c.contact_id as varchar(128)) = cres.contact_id AND ca_id = cres.address_id ";
-		$queryContacts .= "GROUP BY c.firstname, c.lastname, c.society, c.contact_id, cres.address_id";
-			
-        $queryUsers = "select u.firstname, u.lastname, u.user_id ";
-        $queryUsers .= "from users u, contacts_res cres  ";
-        $queryUsers .= "where cres.coll_id = 'letterbox_coll' AND cres.res_id = ##res_id## AND cast (u.user_id as varchar(128)) = cres.contact_id ";
-        $queryUsers .= "GROUP BY u.firstname, u.lastname, u.user_id";
-        
-        $i = 0;
-        foreach($this->object_print as $line_name => $line_value) {
-            $return = false;
-            $res_id = $line_value->res_id;
-            $queryContacts_tmp = str_replace('##res_id##', '?', $queryContacts);
-            $stmt = $db->query($queryContacts_tmp, array($res_id));
-            while($result = $stmt->fetchObject()) {
-                $return .= "Contact : " . $this->getContactInfos($result->contact_id, $result->address_id);
-            }
-            $queryUsers_tmp = str_replace('##res_id##', '?', $queryUsers);
-            $stmt = $db->query($queryUsers_tmp, array($res_id));
-            while($result = $stmt->fetchObject()) {
-                $return .= "Utilisateur : " . $this->getUserInfo($result->user_id) . "\r\n";
-            }
-            if (strlen($return) > 3)
-                $return = substr($return, 0, -2);
-            
-            $line_value->retrieve_multi_contacts = $return;
-            $i++;
-        }
-    }
-    
-    function retrieve_copies($libelle)
-    {
-        $db = new Database();
-        
-        $collection = $this->collection;
-        
-        $query_template = 'SELECT ';
-            $query_template .= 'item_id, ';
-            $query_template .= 'item_type ';
-        $query_template .= 'FROM ';
-            $query_template .= 'listinstance ';
-        $query_template .= 'WHERE ';
-                $query_template .= "res_id = ##res_id## ";
-            $query_template .= "AND ";
-                $query_template .= "coll_id = '" . $collection . "' ";
-            $query_template .= "AND ";
-                $query_template .= "item_mode = 'cc'";
-        
-        $query_template2 = 'SELECT ';
-            $query_template2 .= 'entity_id ';
-        $query_template2 .= 'FROM ';
-            $query_template2 .= 'users_entities ';
-        $query_template2 .= 'WHERE ';
-                $query_template2 .= "user_id = ##item_id## ";
-            $query_template2 .= "AND ";
-                $query_template2 .= "primary_entity = 'Y'";
-        
-        $i = 0;
-        foreach($this->object_print as $line_name => $line_value) {
-            $return = false;
-            $res_id = $line_value->res_id;
-            $query = str_replace('##res_id##', '?', $query_template);
-            $stmt1 = $db->query($query, array($res_id));
-            while($result = $stmt1->fetchObject()) {
-                if ($result->item_type == 'user_id') {
-                    $query = str_replace('##item_id##', '?', $query_template2);
-                    $stmt2 = $db->query($query, array($result->item_id));
-                    while ($result2 = $stmt2->fetchObject()) {
-						$stmt3 = $db->query(
-							"select entity_label from entities where entity_id = ?", 
-							array($result2->entity_id)
-						);
-						$resultEntity = $stmt3->fetchObject();
-						$userInfos = $this->getUserInfo($result->item_id);
-						$usersEntities = "- " . $resultEntity->entity_label . ' : ' . $userInfos;
-                    }
-                } else {
-					$stmt3 = $db->query(
-						"select entity_label from entities where entity_id = ?", 
-						array($result->item_id)
-					);
-					$resultEntity = $stmt3->fetchObject();
-                    $usersEntities = "- " . $resultEntity->entity_label . ' (' . $result->item_id . ") ";
-                }
-                $return .= $usersEntities . "\r\n";
-            }
-            if (strlen($return) > 3)
-                $return = substr($return, 0, -2);
-            
-            $line_value->retrieve_copies = $return;
-            $i++;
-        }
-    }
-	
-	function free_notes($libelle)
-	{
-        foreach($this->object_print as $line_name => $line_value) {
-            $return = "";
-            $line   = "";
-            foreach($_SESSION['features']['notes_in_print_page'] as $value) {
-    			$return .= $line . $value."\r\n\r\n\r\n";
-                $line = "__________________________________"
-                    . "__________________________________"
-                    . "_______________\r\n";
-            }
-    		$line_value->free_notes = $return;
-        }
-	}
-	
-	function retrieve_notes($libelle)
-	{
-		$db = new Database();
-		
-		$collection = $this->collection;
-        
-        $query_template = 'SELECT ';
-            $query_template .= 'id, ';
-            $query_template .= 'user_id, ';
-            $query_template .= 'date_note, ';
-            $query_template .= 'note_text ';
-        $query_template .= 'FROM ';
-            $query_template .= 'notes ';
-        $query_template .= 'WHERE ';
-                $query_template .= "identifier = ##res_id## ";
-            $query_template .= "AND ";
-                $query_template .= "coll_id = '" . $collection . "' ";
-			//EXCLUDE PRIVATE NOTES
-			$query_template .= "AND id not in (select note_id from note_entities) ";
-			$query_template .= "order by id";
-		
-		$i = 0;
-        foreach($this->object_print as $line_name => $line_value) {
-			$return = false;
-            $res_id = $line_value->res_id;
-            $query = str_replace('##res_id##', '?', $query_template);
-            $stmt = $db->query($query, array($res_id));
-			while($result = $stmt->fetchObject()) {
-				$userInfos = $this->getUserInfo($result->user_id);
-				$return .= "- " 
-                    //. $result->id . " " 
-                    . _PRINT_THE . " " 
-                    . functions::format_date_db($result->date_note, false) 
-                    . " " . _BY . " " . $userInfos . " : " . $result->note_text . "\r\n"
-				. "__________________________________"
-				. "__________________________________"
-				. "_______________\r\n";
-			}
-			if (strlen($return) > 3)
-                $return = substr($return, 0, -85);
-			
-			$line_value->retrieve_notes = $return;
-            $i++;
-		}
-	}
-
-    function retrieve_VisaWorkflow()
-    {
-        foreach($this->object_print as $line_value) {
-            $visaWorkflow = \SrcCore\models\DatabaseModel::select([
-                'select'   => ['u.firstname', 'u.lastname', 'l.process_date', 'l.process_comment', 'l.signatory', 'l.requested_signature'],
-                'table'    => ['listinstance l, users u'],
-                'where'    => ['l.res_id = ?', 'l.difflist_type = ?', 'u.user_id = l.item_id'],
-                'data'     => [$line_value->res_id, 'VISA_CIRCUIT'],
-                'order_by' => ['l.listinstance_id asc']
-                ]);
-
-            $line_value->retrieve_VisaWorkflow = $visaWorkflow;
-        }
-    }
-}
diff --git a/modules/avis/documents_list_with_avis.php b/modules/avis/documents_list_with_avis.php
index 48cf086bdf5..ca81494bc50 100755
--- a/modules/avis/documents_list_with_avis.php
+++ b/modules/avis/documents_list_with_avis.php
@@ -659,15 +659,6 @@ $export2 = array(
 'disabledRules' => count($tab).' == 0',
 );
 array_push($paramsTab['tools'], $export2);
-if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
-    $print = array(
-            'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');",
-            'icon' => 'link',
-            'tooltip' => _PRINT_DOC_FROM_LIST,
-            'disabledRules' => count($tab).' == 0',
-        );
-    array_push($paramsTab['tools'], $print);
-}
 
 //Afficher la liste
 $status = 0;
diff --git a/modules/export_seda/export_seda_list.php b/modules/export_seda/export_seda_list.php
index 4c6be66e7a9..4251605f7e6 100755
--- a/modules/export_seda/export_seda_list.php
+++ b/modules/export_seda/export_seda_list.php
@@ -550,15 +550,6 @@ $export = array(
         'disabledRules' => count($tab).' == 0',
         );
 array_push($paramsTab['tools'], $export);
-if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
-    $print = array(
-                'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');",
-                'icon' => 'print',
-                'tooltip' => _PRINT_LIST,
-                'disabledRules' => count($tab).' == 0',
-             );
-    array_push($paramsTab['tools'], $print);
-}
 
 //Afficher la liste
 $status = 0;
diff --git a/modules/visa/documents_list_with_signatory.php b/modules/visa/documents_list_with_signatory.php
index 10a7c147e09..2bc0a856214 100755
--- a/modules/visa/documents_list_with_signatory.php
+++ b/modules/visa/documents_list_with_signatory.php
@@ -626,15 +626,6 @@ $export2 = array(
 'disabledRules' => count($tab).' == 0',
 );
 array_push($paramsTab['tools'], $export2);
-if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
-    $print = array(
-            'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');",
-            'icon' => 'link',
-            'tooltip' => _PRINT_DOC_FROM_LIST,
-            'disabledRules' => count($tab).' == 0',
-        );
-    array_push($paramsTab['tools'], $print);
-}
 
 //Afficher la liste
 $status = 0;
diff --git a/sql/data_en.sql b/sql/data_en.sql
index 72690e46443..63bb3461301 100644
--- a/sql/data_en.sql
+++ b/sql/data_en.sql
@@ -51,7 +51,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'view
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'view_full_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'delete_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'edit_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'update_case');
@@ -98,7 +97,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'update_
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'view_doc_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'update_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'join_res_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'join_res_case_in_process');
@@ -139,7 +137,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER',
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'view_full_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'delete_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'edit_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'update_case');
@@ -176,7 +173,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'u
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'view_doc_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'update_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'join_res_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'join_res_case_in_process');
@@ -236,7 +232,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'admin_parameters');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'admin_priorities');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'delete_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'edit_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'update_case');
diff --git a/sql/data_fr.sql b/sql/data_fr.sql
index 1566f1c7276..c255eda6c3c 100755
--- a/sql/data_fr.sql
+++ b/sql/data_fr.sql
@@ -51,7 +51,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'view
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'view_full_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'delete_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'edit_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('COURRIER', 'update_case');
@@ -98,7 +97,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'update_
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'view_doc_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'update_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'join_res_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('AGENT', 'join_res_case_in_process');
@@ -139,7 +137,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER',
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'view_full_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'delete_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'edit_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESP_COURRIER', 'update_case');
@@ -176,7 +173,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'u
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'view_doc_history');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'add_links');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'update_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'join_res_case');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('RESPONSABLE', 'join_res_case_in_process');
@@ -236,7 +232,6 @@ INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'admin_parameters');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'admin_priorities');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'print_details');
-INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'print_doc_details_from_list');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'delete_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'edit_document_in_detail');
 INSERT INTO usergroups_services (group_id, service_id) VALUES ('ADMINISTRATEUR_N1', 'update_case');
diff --git a/sql/develop.sql b/sql/develop.sql
index fd9df985dc2..684ff710f1d 100755
--- a/sql/develop.sql
+++ b/sql/develop.sql
@@ -137,6 +137,7 @@ UPDATE baskets SET basket_res_order = regexp_replace(basket_res_order,'recommend
 
 /* REFACTORING */
 ALTER TABLE mlb_coll_ext DROP COLUMN IF EXISTS flag_notif;
+DELETE FROM usergroups_services WHERE service_id = 'print_doc_details_from_list';
 
 
 /* PARAM LIST DISPLAY */
diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php
index 2afc27a87c6..7689d31f23a 100755
--- a/src/core/lang/lang-en.php
+++ b/src/core/lang/lang-en.php
@@ -222,7 +222,6 @@ define('_LOAD_STATUSES_SESSION', 'Load Status session');
 define('_PARAM_AVAILABLE_STATUS_ON_GROUP_BASKETS', 'Indexation status configuration');
 define('_ADD_LINKS', 'Add connection');
 define('_PRINT_DETAILS_SERVICE', 'Print the liaison sheet from the detail sheet');
-define('_PRINT_DOC_DETAILS_FROM_LIST', 'Print the liaison sheets from the results lists');
 define('_ATTACHMENTS_COMMENT', 'Attachments management');
 define('_BASKETS_COMMENT', 'Baskets');
 define('_CASES_COMMENT', 'Cases');
diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php
index 1cea9bab018..23a158d0734 100755
--- a/src/core/lang/lang-fr.php
+++ b/src/core/lang/lang-fr.php
@@ -222,7 +222,6 @@ define('_LOAD_STATUSES_SESSION', 'Chargement des status en session');
 define('_PARAM_AVAILABLE_STATUS_ON_GROUP_BASKETS', "Paramétrage des status d'indexation");
 define('_ADD_LINKS', 'Ajouter des liaisons');
 define('_PRINT_DETAILS_SERVICE', 'Imprimer la fiche de liaison depuis la fiche détail');
-define('_PRINT_DOC_DETAILS_FROM_LIST', 'Imprimer les fiches de liaison depuis les listes de résultats');
 define('_ATTACHMENTS_COMMENT', 'Gestion des pièces jointes');
 define('_BASKETS_COMMENT', 'Bannettes');
 define('_CASES_COMMENT', 'Affaires');
diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php
index 53513cf6d78..3edf1b3030c 100644
--- a/src/core/lang/lang-nl.php
+++ b/src/core/lang/lang-nl.php
@@ -222,7 +222,6 @@ define('_LOAD_STATUSES_SESSION', 'Laden van statussen in sessie');
 define('_PARAM_AVAILABLE_STATUS_ON_GROUP_BASKETS', 'Instelling van de indexeringsstatussen');
 define('_ADD_LINKS', 'Verbindingen toevoegen');
 define('_PRINT_DETAILS_SERVICE', 'De verbindingsfiche vanuit de detailfiche afdrukken');
-define('_PRINT_DOC_DETAILS_FROM_LIST', 'De verbindingsfiche vanuit de resultatenlijsten afdrukken');
 define('_ATTACHMENTS_COMMENT', 'Beheer van de bijlagen');
 define('_BASKETS_COMMENT', 'Bakjes');
 define('_CASES_COMMENT', 'Zaken');
-- 
GitLab