From 9a5d83c7c830b8e156c291b6675c090c856ce2aa Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Mon, 23 Mar 2020 11:35:26 +0100
Subject: [PATCH] FEAT #11902 TIME 1:00 Remove print_folder and converted_pdf

---
 .../documents_list_mlb_search_adv.php          |  5 ++---
 .../indexing_searching/search_adv_result.php   |  2 +-
 apps/maarch_entreprise/loadRepList.php         |  5 ++---
 apps/maarch_entreprise/xml/entreprise.xml      | 12 ------------
 migration/20.03/2003-postScript.sql            |  2 ++
 .../attachments/load_toolbar_attachments.php   |  4 ++--
 .../save_attachment_from_cm.php                |  2 +-
 modules/export_seda/export_seda_list.php       |  2 +-
 modules/visa/sign_file.php                     |  2 +-
 .../controllers/ExternalSignatoryBookTrait.php |  2 +-
 .../controllers/PreProcessActionController.php |  8 ++++----
 src/app/action/controllers/ShippingTrait.php   |  2 +-
 .../controllers/AttachmentController.php       |  7 +------
 .../convert/controllers/FullTextController.php |  4 ++--
 .../controllers/FastParapheurController.php    |  2 +-
 .../controllers/IParapheurController.php       |  2 +-
 .../controllers/IxbusController.php            |  2 +-
 .../controllers/MaarchParapheurController.php  |  2 +-
 .../controllers/XParaphController.php          |  2 +-
 .../folder/controllers/FolderController.php    |  5 ++---
 .../controllers/ResourceListController.php     |  2 +-
 .../UserFollowedResourceController.php         |  5 ++---
 .../controllers/SignatureBookController.php    | 18 +++++++-----------
 23 files changed, 38 insertions(+), 61 deletions(-)

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 f3e06acb608..c0a84defdaa 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
@@ -675,11 +675,10 @@ if ($mode == 'normal') {
                 }
 
                 if ($tab[$i][$j][$value] == 'count_attachment') {
-                    $excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
                     $query = "SELECT count(res_id) as total FROM res_attachments 
                             WHERE res_id_master = ? 
-                            AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN (?) AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
-                    $arrayPDO = array($tab[$i][0]['res_id'], $excludeAttachmentTypes, $_SESSION['user']['UserId']);
+                            AND status NOT IN ('DEL', 'OBS') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
+                    $arrayPDO = array($tab[$i][0]['res_id'], $_SESSION['user']['UserId']);
                     $stmt2 = $db->query($query, $arrayPDO);
                     $return_count = $stmt2->fetchObject();
 
diff --git a/apps/maarch_entreprise/indexing_searching/search_adv_result.php b/apps/maarch_entreprise/indexing_searching/search_adv_result.php
index 8d04d03122e..2578dd495e2 100755
--- a/apps/maarch_entreprise/indexing_searching/search_adv_result.php
+++ b/apps/maarch_entreprise/indexing_searching/search_adv_result.php
@@ -355,7 +355,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
                                     array_splice($tmpArray, 0, 1);
                                     $_SESSION['fullTextAttachments']['attachments'] = array_filter($tmpArray);
                                     $db = new Database();
-                                    $stmt = $db->query("SELECT DISTINCT res_id_master FROM res_attachments WHERE res_id IN ($Liste_Ids) AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN ('print_folder')");
+                                    $stmt = $db->query("SELECT DISTINCT res_id_master FROM res_attachments WHERE res_id IN ($Liste_Ids) AND status NOT IN ('DEL','OBS','TMP')");
                                     $idMasterDatas = [];
                                     while ($tmp = $stmt->fetchObject()) {
                                         $idMasterDatas[] = $tmp;
diff --git a/apps/maarch_entreprise/loadRepList.php b/apps/maarch_entreprise/loadRepList.php
index 2d1bd635649..f28dfbfd847 100755
--- a/apps/maarch_entreprise/loadRepList.php
+++ b/apps/maarch_entreprise/loadRepList.php
@@ -54,12 +54,11 @@ if (isset($_REQUEST['res_id_master'])) {
 
     $db = new Database();
 
-    $excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
     $query = "SELECT * FROM res_attachments 
                             WHERE res_id_master = ? 
-                            AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN (?)  AND (status <> 'TMP' or (typist = ? and status = 'TMP')) 
+                            AND status NOT IN ('DEL', 'OBS') AND (status <> 'TMP' or (typist = ? and status = 'TMP')) 
                             ORDER BY creation_date desc";
-    $arrayPDO = array($_REQUEST['res_id_master'], $excludeAttachmentTypes, $_SESSION['user']['UserId']);
+    $arrayPDO = array($_REQUEST['res_id_master'], $_SESSION['user']['UserId']);
     $stmt = $db->query($query, $arrayPDO);
 
     while ($return_db = $stmt->fetchObject()) {
diff --git a/apps/maarch_entreprise/xml/entreprise.xml b/apps/maarch_entreprise/xml/entreprise.xml
index 73152e25341..15fb0cb2dca 100755
--- a/apps/maarch_entreprise/xml/entreprise.xml
+++ b/apps/maarch_entreprise/xml/entreprise.xml
@@ -29,22 +29,10 @@
             <id>waybill</id>
             <label>_WAYBILL</label>
         </type> -->
-	    <type show="false" with_chrono="true" icon="FC" sign="false">
-            <id>routing</id>
-            <label>_ROUTING</label>
-        </type>
         <type show="true" with_chrono="true" icon="DS" sign="true">
             <id>outgoing_mail</id>
             <label>_OUTGOING_MAIL</label>
         </type>
-	    <type show="false" with_chrono="false" icon="" sign="false">
-            <id>converted_pdf</id>
-            <label>_CONVERTED_PDF</label>
-        </type>
-	    <type show="false" with_chrono="false" icon="" sign="false">
-            <id>print_folder</id>
-            <label>_PRINT_FOLDER</label>
-        </type>
     </attachment_types>
     <contact_check>
         <check_days_before>5</check_days_before>  <!-- 0 if you want to disabled -->
diff --git a/migration/20.03/2003-postScript.sql b/migration/20.03/2003-postScript.sql
index f49aba9227b..06a9998e6e9 100644
--- a/migration/20.03/2003-postScript.sql
+++ b/migration/20.03/2003-postScript.sql
@@ -16,6 +16,8 @@ DELETE FROM contacts_groups_lists WHERE contact_id IS NULL;
 
 DELETE FROM resources_folders WHERE res_id NOT IN (SELECT res_id FROM res_letterbox);
 
+DELETE FROM res_attachments WHERE attachment_type in ('converted_pdf', 'print_folder', 'routing');
+
 DROP TABLE IF EXISTS contacts_res;
 DROP TABLE IF EXISTS contact_addresses;
 DROP TABLE IF EXISTS contact_communication;
diff --git a/modules/attachments/load_toolbar_attachments.php b/modules/attachments/load_toolbar_attachments.php
index a0f965dcb03..bf212bce037 100755
--- a/modules/attachments/load_toolbar_attachments.php
+++ b/modules/attachments/load_toolbar_attachments.php
@@ -27,12 +27,12 @@ if ($_SESSION['req'] == 'details') {
     } else {
         $stmt = $db->query("SELECT res_id, creation_date, title, format FROM "
             . $_SESSION['tablename']['attach_res_attachments']
-            . " WHERE res_id_master = ? and coll_id = ? and status <> 'DEL' and attachment_type NOT IN ('response_project','signed_response','outgoing_mail_signed','converted_pdf','outgoing_mail','print_folder','aihp'". $exclude . ") and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
+            . " WHERE res_id_master = ? and coll_id = ? and status <> 'DEL' and attachment_type NOT IN ('response_project','signed_response','outgoing_mail_signed','outgoing_mail','aihp'". $exclude . ") and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
     }
 } else {
     $stmt = $db->query("SELECT res_id FROM "
         . $_SESSION['tablename']['attach_res_attachments']
-        . " WHERE status <> 'DEL'  and attachment_type NOT IN ('converted_pdf', 'print_folder'". $exclude . ") and res_id_master = ? and coll_id = ? and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
+        . " WHERE status <> 'DEL' and res_id_master = ? and coll_id = ? and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
 }
 $nbAttach = $stmt->rowCount();
 
diff --git a/modules/content_management/save_attachment_from_cm.php b/modules/content_management/save_attachment_from_cm.php
index fe2832c7f08..676a194ecec 100755
--- a/modules/content_management/save_attachment_from_cm.php
+++ b/modules/content_management/save_attachment_from_cm.php
@@ -82,7 +82,7 @@ if ($arrayIsAllowed['status'] == false) {
                 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';
+		            ?>index.php?display=true&module=attachments&page=frame_list_attachments&mode=normal&load';
             </script>
             <?php
             exit();
diff --git a/modules/export_seda/export_seda_list.php b/modules/export_seda/export_seda_list.php
index 48e46714286..e7421c3022e 100755
--- a/modules/export_seda/export_seda_list.php
+++ b/modules/export_seda/export_seda_list.php
@@ -465,7 +465,7 @@ for ($i = 0; $i < $tabI; ++$i) {
             if ($tab[$i][$j][$value] == 'count_attachment') {
                 $query = "SELECT count(1) as total FROM res_attachments
                             WHERE res_id_master = ?
-                            AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN ('converted_pdf', 'print_folder') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
+                            AND status NOT IN ('DEL', 'OBS') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
                 $arrayPDO = array($tab[$i][0]['res_id'], $_SESSION['user']['UserId']);
                 $stmt2 = $db->query($query, $arrayPDO);
                 $return_count = $stmt2->fetchObject();
diff --git a/modules/visa/sign_file.php b/modules/visa/sign_file.php
index b3e1c1bbbe5..72094de9580 100755
--- a/modules/visa/sign_file.php
+++ b/modules/visa/sign_file.php
@@ -61,7 +61,7 @@ if (!empty($_REQUEST['id']) && !empty($_REQUEST['collId'])) {
 
     $stmt = $db->query("select relation, res_id, format, res_id_master, title, identifier, attachment_type from "
         . $tableName
-        . " where (attachment_type NOT IN ('converted_pdf','print_folder')) and res_id = ?", array($objectId));
+        . " where res_id = ?", array($objectId));
 
     if ($stmt->rowCount() < 1) {
         echo '{"status":1, "error" : "'._FILE.' '._UNKNOWN.'"}';
diff --git a/src/app/action/controllers/ExternalSignatoryBookTrait.php b/src/app/action/controllers/ExternalSignatoryBookTrait.php
index 41551c229b1..1257c95414d 100755
--- a/src/app/action/controllers/ExternalSignatoryBookTrait.php
+++ b/src/app/action/controllers/ExternalSignatoryBookTrait.php
@@ -49,7 +49,7 @@ trait ExternalSignatoryBookTrait
                         'res_id', 'status'
                     ],
                     'where'     => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
-                    'data'      => [$args['resId'], ['converted_pdf', 'print_folder', 'signed_response']]
+                    'data'      => [$args['resId'], ['signed_response']]
                 ]);
 
                 foreach ($attachments as $attachment) {
diff --git a/src/app/action/controllers/PreProcessActionController.php b/src/app/action/controllers/PreProcessActionController.php
index 7031a9aae2e..02630637d3c 100755
--- a/src/app/action/controllers/PreProcessActionController.php
+++ b/src/app/action/controllers/PreProcessActionController.php
@@ -445,7 +445,7 @@ class PreProcessActionController
                             'validation_date', 'relation', 'origin_id'
                         ],
                         'where'     => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
-                        'data'      => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
+                        'data'      => [$resId, ['signed_response']]
                     ]);
 
                     $integratedResource = ResModel::get([
@@ -532,7 +532,7 @@ class PreProcessActionController
                             'validation_date', 'relation', 'origin_id'
                         ],
                         'where'     => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
-                        'data'      => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
+                        'data'      => [$resId, ['signed_response']]
                     ]);
                     
                     if (empty($attachments)) {
@@ -714,8 +714,8 @@ class PreProcessActionController
         if (!empty($aTemplates)) {
             $aAttachments = AttachmentModel::get([
                 'select'    => ['max(relation) as relation', 'res_id_master', 'title', 'res_id', 'identifier as chrono', 'recipient_id', 'recipient_type'],
-                'where'     => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', 'in_send_attach = ?'],
-                'data'      => [$data['resources'], ['OBS', 'DEL', 'TMP', 'FRZ'], ['print_folder'], true],
+                'where'     => ['res_id_master in (?)', 'status not in (?)', 'in_send_attach = ?'],
+                'data'      => [$data['resources'], ['OBS', 'DEL', 'TMP', 'FRZ'], true],
                 'groupBy'   => ['res_id_master', 'title', 'res_id', 'chrono', 'recipient_id', 'recipient_type']
             ]);
 
diff --git a/src/app/action/controllers/ShippingTrait.php b/src/app/action/controllers/ShippingTrait.php
index 4de6d9e7cc9..2d2f47a5c8b 100644
--- a/src/app/action/controllers/ShippingTrait.php
+++ b/src/app/action/controllers/ShippingTrait.php
@@ -63,7 +63,7 @@ trait ShippingTrait
         $attachments = AttachmentModel::get([
             'select'    => ['res_id', 'title', 'recipient_id', 'recipient_type', 'external_id', 'status'],
             'where'     => ['res_id_master = ?', 'in_send_attach = ?', 'status not in (?)', 'attachment_type not in (?)'],
-            'data'      => [$args['resId'], true, ['OBS', 'DEL', 'TMP', 'FRZ'], ['print_folder', 'signed_response']]
+            'data'      => [$args['resId'], true, ['OBS', 'DEL', 'TMP', 'FRZ'], ['signed_response']]
         ]);
 
         if (empty($attachments) && empty($integrations['inShipping'])) {
diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php
index a9e6784f647..486dd516404 100755
--- a/src/app/attachment/controllers/AttachmentController.php
+++ b/src/app/attachment/controllers/AttachmentController.php
@@ -101,11 +101,6 @@ class AttachmentController
             return $response->withStatus(400)->withJson(['errors' => 'Attachment out of perimeter']);
         }
 
-        $excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
-        if (in_array($attachment['type'], $excludeAttachmentTypes)) {
-            return $response->withStatus(400)->withJson(['errors' => 'Attachment type out of perimeter']);
-        }
-
         if ($attachment['modificationDate'] == $attachment['creationDate']) {
             $attachment['modificationDate'] = null;
         }
@@ -272,7 +267,7 @@ class AttachmentController
             return $response->withStatus(403)->withJson(['errors' => 'Query limit is not an integer']);
         }
 
-        $excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
+        $excludeAttachmentTypes = ['signed_response'];
 
         $attachments = AttachmentModel::get([
             'select'    => [
diff --git a/src/app/convert/controllers/FullTextController.php b/src/app/convert/controllers/FullTextController.php
index 9c5616d9ec1..21a2f41113a 100644
--- a/src/app/convert/controllers/FullTextController.php
+++ b/src/app/convert/controllers/FullTextController.php
@@ -169,8 +169,8 @@ class FullTextController
         } else {
             $resIds = AttachmentModel::get([
                 'select'    => ['res_id'],
-                'where'     => ['attachment_type <> ?', 'status NOT IN (?)', 'fulltext_result = ?'],
-                'data'      => ['print_folder', ['DEL','OBS','TMP'], 'ERROR'],
+                'where'     => ['status NOT IN (?)', 'fulltext_result = ?'],
+                'data'      => [['DEL','OBS','TMP'], 'ERROR'],
                 'orderBy'   => ['res_id DESC'],
             ]);
         }
diff --git a/src/app/external/externalSignatoryBook/controllers/FastParapheurController.php b/src/app/external/externalSignatoryBook/controllers/FastParapheurController.php
index c6aefa2a770..331459fdf65 100755
--- a/src/app/external/externalSignatoryBook/controllers/FastParapheurController.php
+++ b/src/app/external/externalSignatoryBook/controllers/FastParapheurController.php
@@ -118,7 +118,7 @@ class FastParapheurController
                 'res_id', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'
             ],
             'where'     => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
-            'data'      => [$aArgs['resIdMaster'], ['converted_pdf', 'print_folder', 'signed_response']]
+            'data'      => [$aArgs['resIdMaster'], ['signed_response']]
         ]);
 
         $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
diff --git a/src/app/external/externalSignatoryBook/controllers/IParapheurController.php b/src/app/external/externalSignatoryBook/controllers/IParapheurController.php
index 804bd4c3349..af164480e70 100755
--- a/src/app/external/externalSignatoryBook/controllers/IParapheurController.php
+++ b/src/app/external/externalSignatoryBook/controllers/IParapheurController.php
@@ -89,7 +89,7 @@ class IParapheurController
         $attachments = AttachmentModel::get([
             'select' => ['res_id', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'],
             'where'  => ['res_id_master = ?', 'attachment_type not in (?)', "status NOT IN ('DEL','OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
-            'data'   => [$aArgs['resIdMaster'], ['converted_pdf', 'print_folder', 'signed_response']]
+            'data'   => [$aArgs['resIdMaster'], ['signed_response']]
         ]);
 
         $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
diff --git a/src/app/external/externalSignatoryBook/controllers/IxbusController.php b/src/app/external/externalSignatoryBook/controllers/IxbusController.php
index 4f70826719a..526d5842e71 100644
--- a/src/app/external/externalSignatoryBook/controllers/IxbusController.php
+++ b/src/app/external/externalSignatoryBook/controllers/IxbusController.php
@@ -189,7 +189,7 @@ class IxbusController
                 'validation_date', 'relation', 'origin_id'
             ],
             'where'     => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
-            'data'      => [$aArgs['resIdMaster'], ['converted_pdf', 'incoming_mail_attachment', 'print_folder', 'signed_response']]
+            'data'      => [$aArgs['resIdMaster'], ['incoming_mail_attachment', 'signed_response']]
         ]);
 
         $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
diff --git a/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php b/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php
index ad7637a4531..c21a71629c1 100755
--- a/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php
+++ b/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php
@@ -199,7 +199,7 @@ class MaarchParapheurController
                 return ['error' => 'steps is empty'];
             }
 
-            $excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
+            $excludeAttachmentTypes = ['signed_response'];
 
             $attachments = AttachmentModel::get([
                 'select'    => [
diff --git a/src/app/external/externalSignatoryBook/controllers/XParaphController.php b/src/app/external/externalSignatoryBook/controllers/XParaphController.php
index bbd9a496ffd..1dbf3445f67 100755
--- a/src/app/external/externalSignatoryBook/controllers/XParaphController.php
+++ b/src/app/external/externalSignatoryBook/controllers/XParaphController.php
@@ -36,7 +36,7 @@ class XParaphController
             'select'    => [
                 'res_id', 'title', 'docserver_id', 'path', 'filename'],
             'where'     => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
-            'data'      => [$aArgs['resIdMaster'], ['converted_pdf', 'print_folder', 'signed_response']]
+            'data'      => [$aArgs['resIdMaster'], ['signed_response']]
         ]);
 
         $attachmentToFreeze = [];
diff --git a/src/app/folder/controllers/FolderController.php b/src/app/folder/controllers/FolderController.php
index c2d71f300cd..640c3e25c8a 100755
--- a/src/app/folder/controllers/FolderController.php
+++ b/src/app/folder/controllers/FolderController.php
@@ -680,11 +680,10 @@ class FolderController
 
             $formattedResources = [];
             if (!empty($resIds)) {
-                $excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
                 $attachments = AttachmentModel::get([
                     'select'    => ['COUNT(res_id)', 'res_id_master'],
-                    'where'     => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
-                    'data'      => [$resIds, ['DEL', 'OBS'], $excludeAttachmentTypes, 'TMP', $GLOBALS['id'], 'TMP'],
+                    'where'     => ['res_id_master in (?)', 'status not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
+                    'data'      => [$resIds, ['DEL', 'OBS'], 'TMP', $GLOBALS['id'], 'TMP'],
                     'groupBy'   => ['res_id_master']
                 ]);
 
diff --git a/src/app/resource/controllers/ResourceListController.php b/src/app/resource/controllers/ResourceListController.php
index bc96d6e24aa..17e640af488 100644
--- a/src/app/resource/controllers/ResourceListController.php
+++ b/src/app/resource/controllers/ResourceListController.php
@@ -88,7 +88,7 @@ class ResourceListController
         $defaultAction = [];
         $displayFolderTags = false;
         if (!empty($resIds)) {
-            $excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
+            $excludeAttachmentTypes = ['signed_response'];
             $attachments = AttachmentModel::get([
                 'select'    => ['COUNT(res_id)', 'res_id_master'],
                 'where'     => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
diff --git a/src/app/resource/controllers/UserFollowedResourceController.php b/src/app/resource/controllers/UserFollowedResourceController.php
index 696fa1f498d..c0ba07a3431 100644
--- a/src/app/resource/controllers/UserFollowedResourceController.php
+++ b/src/app/resource/controllers/UserFollowedResourceController.php
@@ -115,11 +115,10 @@ class UserFollowedResourceController
 
             $formattedResources = [];
             if (!empty($resIds)) {
-                $excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
                 $attachments = AttachmentModel::get([
                     'select'    => ['COUNT(res_id)', 'res_id_master'],
-                    'where'     => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
-                    'data'      => [$resIds, ['DEL', 'OBS'], $excludeAttachmentTypes, 'TMP', $GLOBALS['id'], 'TMP'],
+                    'where'     => ['res_id_master in (?)', 'status not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
+                    'data'      => [$resIds, ['DEL', 'OBS'], 'TMP', $GLOBALS['id'], 'TMP'],
                     'groupBy'   => ['res_id_master']
                 ]);
 
diff --git a/src/app/signatureBook/controllers/SignatureBookController.php b/src/app/signatureBook/controllers/SignatureBookController.php
index ff128bd43e3..c3f56854f7a 100755
--- a/src/app/signatureBook/controllers/SignatureBookController.php
+++ b/src/app/signatureBook/controllers/SignatureBookController.php
@@ -144,13 +144,9 @@ class SignatureBookController
         $incomingMailAttachments = AttachmentModel::get([
             'select'    => ['res_id', 'title', 'format', 'attachment_type', 'path', 'filename'],
             'where'     => ['res_id_master = ?', 'attachment_type in (?)', "status not in ('DEL', 'TMP', 'OBS')"],
-            'data'      => [$resId, ['incoming_mail_attachment', 'converted_pdf']]
+            'data'      => [$resId, ['incoming_mail_attachment']]
         ]);
         foreach ($incomingMailAttachments as $value) {
-            if ($value['attachment_type'] == 'converted_pdf') {
-                continue;
-            }
-
             $realId = $value['res_id'];
 
             $convertedAttachment = ConvertPdfController::getConvertedPdfById(['resId' => $realId, 'collId' => 'attachments_coll']);
@@ -199,14 +195,14 @@ class SignatureBookController
                 'origin', 'validation_date', 'origin_id'
             ],
             'where'     => ['res_id_master = ?', 'attachment_type not in (?)', "status not in ('DEL', 'OBS')", 'in_signature_book = TRUE'],
-            'data'      => [$args['resId'], ['incoming_mail_attachment', 'print_folder']],
+            'data'      => [$args['resId'], ['incoming_mail_attachment']],
             'orderBy'   => [$orderBy]
         ]);
 
         $canManageAttachment = PrivilegeController::hasPrivilege(['privilegeId' => 'manage_attachments', 'userId' => $args['userId']]);
 
         foreach ($attachments as $key => $value) {
-            if ($value['attachment_type'] == 'converted_pdf' || ($value['attachment_type'] == 'signed_response' && !empty($value['origin']))) {
+            if (($value['attachment_type'] == 'signed_response' && !empty($value['origin']))) {
                 continue;
             }
 
@@ -224,7 +220,7 @@ class SignatureBookController
             }
 
             foreach ($attachments as $tmpKey => $tmpValue) {
-                if (strpos($value['format'], 'xl') !== 0 && $value['format'] != 'pptx' && $tmpValue['attachment_type'] == 'converted_pdf' && ($tmpValue['path'] . $tmpValue['filename'] == $pathToFind)) {
+                if (strpos($value['format'], 'xl') !== 0 && $value['format'] != 'pptx' && ($tmpValue['path'] . $tmpValue['filename'] == $pathToFind)) {
                     if ($value['status'] != 'SIGN') {
                         $viewerId = $tmpValue['res_id'];
                     }
@@ -289,7 +285,7 @@ class SignatureBookController
         $obsAttachments = AttachmentModel::get([
             'select'    => ['res_id', 'origin_id', 'relation', 'creation_date', 'title'],
             'where'     => ['res_id_master = ?', 'attachment_type not in (?)', 'status = ?'],
-            'data'      => [$args['resId'], ['incoming_mail_attachment', 'print_folder', 'converted_pdf', 'signed_response'], 'OBS'],
+            'data'      => [$args['resId'], ['incoming_mail_attachment', 'signed_response'], 'OBS'],
             'orderBy'  => ['relation ASC']
         ]);
 
@@ -303,7 +299,7 @@ class SignatureBookController
         }
 
         foreach ($attachments as $key => $value) {
-            if ($value['attachment_type'] == 'converted_pdf' || $value['attachment_type'] == 'signed_response') {
+            if ($value['attachment_type'] == 'signed_response') {
                 unset($attachments[$key]);
                 continue;
             }
@@ -375,7 +371,7 @@ class SignatureBookController
 
         $attachmentsInResList = AttachmentModel::get([
             'select'    => ['res_id_master', 'status', 'attachment_type'],
-            'where'     => ['res_id_master in (?)', "attachment_type not in ('incoming_mail_attachment', 'print_folder', 'converted_pdf', 'signed_response')", "status not in ('DEL', 'TMP', 'OBS')"],
+            'where'     => ['res_id_master in (?)', "attachment_type not in ('incoming_mail_attachment', 'signed_response')", "status not in ('DEL', 'TMP', 'OBS')"],
             'data'      => [$resIds]
         ]);
 
-- 
GitLab