diff --git a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
index bf13abedaf5a29ff365cbac28650e9ae8b4e98cf..84cc291baadd88e21052eb568d5b9c1c028742fe 100755
--- a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
+++ b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
@@ -162,28 +162,18 @@ function check_form($form_id, $values)
                 return false;
             } else {
                 foreach ($aResources as $resId) {
-                    $attachments = \Attachment\models\AttachmentModel::getOnView([
+                    $attachments = \Attachment\models\AttachmentModel::get([
                         'select'    => [
-                            'res_id', 'res_id_version', 'title', 'identifier', 'attachment_type',
+                            'res_id', 'title', 'identifier', 'attachment_type',
                             'status', 'typist', 'docserver_id', 'path', 'filename', 'creation_date',
-                            'validation_date', 'relation', 'attachment_id_master'
+                            'validation_date', 'relation'
                         ],
                         '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']]
                     ]);
 
                     foreach ($attachments as $value) {
-                        if (!empty($value['res_id'])) {
-                            $resIdAttachment  = $value['res_id'];
-                            $collId = 'attachments_coll';
-                            $is_version = false;
-                        } else {
-                            $resIdAttachment  = $value['res_id_version'];
-                            $collId = 'attachments_version_coll';
-                            $is_version = true;
-                        }
-                    
-                        $adrInfo       = \Convert\controllers\ConvertPdfController::getConvertedPdfById(['resId' => $resIdAttachment, 'collId' => $collId, 'isVersion' => $is_version]);
+                        $adrInfo       = \Convert\controllers\ConvertPdfController::getConvertedPdfById(['resId' => $value['res_id'], 'collId' => 'attachments_coll']);
                         $docserverInfo = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id']]);
                         $filePath      = $docserverInfo['path_template'] . str_replace('#', '/', $adrInfo['path']) . $adrInfo['filename'];
                         if (!is_file($filePath)) {
@@ -337,7 +327,7 @@ function hasAttachmentError()
 
     $noAttachment = [];
     foreach ($resIds as $resId) {
-        $attachments = \Attachment\models\AttachmentModel::getOnView([
+        $attachments = \Attachment\models\AttachmentModel::get([
             'select'    => [
                 'count(1) as nb'
             ],
diff --git a/migration/19.12/1912-postScript.sql b/migration/19.12/1912-postScript.sql
index ee5fd95ae35801995c273fbc6c1c07fb79131081..ce9a92689f1ac70ed0627aacb142210bf4bee540 100644
--- a/migration/19.12/1912-postScript.sql
+++ b/migration/19.12/1912-postScript.sql
@@ -22,6 +22,8 @@ DROP TABLE IF EXISTS groupbasket_status;
 DROP TABLE IF EXISTS indexingmodels;
 
 DROP TABLE IF EXISTS mlb_coll_ext;
+DROP TABLE IF EXISTS res_version_attachments;
+DROP TABLE IF EXISTS adr_attachments_version;
 
 ALTER TABLE priorities DROP COLUMN IF EXISTS default_priority;
 
diff --git a/migration/19.12/1912.sql b/migration/19.12/1912.sql
index 20b5be4d954b34d748837608a7ef9496df62be60..582070d88a61948c1951c0b02822b81c8c3f3e64 100644
--- a/migration/19.12/1912.sql
+++ b/migration/19.12/1912.sql
@@ -27,8 +27,6 @@ UPDATE res_letterbox SET fulltext_result = 'SUCCESS' WHERE fulltext_result = '1'
 UPDATE res_letterbox SET fulltext_result = 'ERROR' WHERE fulltext_result = '-1' OR fulltext_result = '-2';
 UPDATE res_attachments SET fulltext_result = 'SUCCESS' WHERE fulltext_result = '1' OR fulltext_result = '2';
 UPDATE res_attachments SET fulltext_result = 'ERROR' WHERE fulltext_result = '-1' OR fulltext_result = '-2';
-UPDATE res_version_attachments SET fulltext_result = 'SUCCESS' WHERE fulltext_result = '1' OR fulltext_result = '2';
-UPDATE res_version_attachments SET fulltext_result = 'ERROR' WHERE fulltext_result = '-1' OR fulltext_result = '-2';
 
 
 /* GROUPS INDEXING */
@@ -434,22 +432,16 @@ DO $$ BEGIN
   END IF;
 END$$;
 ALTER TABLE res_letterbox DROP COLUMN IF EXISTS converter_result;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS converter_result;
 ALTER TABLE res_letterbox DROP COLUMN IF EXISTS convert_result;
 ALTER TABLE res_attachments DROP COLUMN IF EXISTS convert_result;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS convert_result;
 ALTER TABLE res_letterbox DROP COLUMN IF EXISTS convert_attempts;
 ALTER TABLE res_attachments DROP COLUMN IF EXISTS convert_attempts;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS convert_attempts;
 ALTER TABLE res_letterbox DROP COLUMN IF EXISTS fulltext_attempts;
 ALTER TABLE res_attachments DROP COLUMN IF EXISTS fulltext_attempts;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS fulltext_attempts;
 ALTER TABLE res_letterbox DROP COLUMN IF EXISTS tnl_attempts;
 ALTER TABLE res_attachments DROP COLUMN IF EXISTS tnl_attempts;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS tnl_attempts;
 ALTER TABLE res_letterbox DROP COLUMN IF EXISTS tnl_result;
 ALTER TABLE res_attachments DROP COLUMN IF EXISTS tnl_result;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS tnl_result;
 ALTER TABLE usergroups DROP COLUMN IF EXISTS enabled;
 ALTER TABLE actions DROP COLUMN IF EXISTS enabled;
 ALTER TABLE actions DROP COLUMN IF EXISTS origin;
@@ -457,7 +449,6 @@ ALTER TABLE actions DROP COLUMN IF EXISTS create_id;
 ALTER TABLE actions DROP COLUMN IF EXISTS category_id;
 DROP VIEW IF EXISTS fp_view_fileplan;
 ALTER TABLE res_attachments DROP COLUMN IF EXISTS folders_system_id;
-ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS folders_system_id;
 DROP TABLE IF EXISTS foldertypes;
 DROP TABLE IF EXISTS foldertypes_doctypes;
 DROP TABLE IF EXISTS foldertypes_doctypes_level1;
@@ -491,22 +482,6 @@ DO $$ BEGIN
   END IF;
 END$$;
 
-
-/* RE CREATE VIEWS */
-CREATE VIEW res_view_attachments AS
-  SELECT '0' as res_id, res_id as res_id_version, title, subject, description, type_id, format, typist,
-  creation_date, fulltext_result, author, identifier, source, relation, doc_date, docserver_id, path,
-  filename, offset_doc, fingerprint, filesize, status, destination, validation_date, effective_date, origin, priority, initiator, dest_user, external_id,
-  coll_id, dest_contact_id, dest_address_id, updated_by, is_multicontacts, is_multi_docservers, res_id_master, attachment_type, attachment_id_master, in_signature_book, in_send_attach, signatory_user_serial_id
-  FROM res_version_attachments
-  UNION ALL
-  SELECT res_id, '0' as res_id_version, title, subject, description, type_id, format, typist,
-  creation_date, fulltext_result, author, identifier, source, relation, doc_date, docserver_id, path,
-  filename, offset_doc, fingerprint, filesize, status, destination, validation_date, effective_date, origin, priority, initiator, dest_user, external_id,
-  coll_id, dest_contact_id, dest_address_id, updated_by, is_multicontacts, is_multi_docservers, res_id_master, attachment_type, '0', in_signature_book, in_send_attach, signatory_user_serial_id
-  FROM res_attachments;
-
-
 /* DATA */
 TRUNCATE TABLE custom_fields;
 INSERT INTO custom_fields (id, label, type, values) VALUES (1, 'Nature', 'select', '["Courrier simple", "Courriel", "Courrier suivi", "Courrier avec AR", "Autre"]');
diff --git a/modules/attachments/attachments_content.php b/modules/attachments/attachments_content.php
index e53e069f08b8ce67cd9c222906a0cfaca0f2b887..9230e021a1f93baa4a90e5ce23df39a9ae334871 100755
--- a/modules/attachments/attachments_content.php
+++ b/modules/attachments/attachments_content.php
@@ -465,7 +465,7 @@ if (isset($_POST['add']) && $_POST['add']) {
                                                     }
 
                                                     if (!empty($select)) {
-                                                        $document = \Attachment\models\AttachmentModel::getOnView(['select' => $select, 'where' => ['res_id = ?'], 'data' => [$id]]);
+                                                        $document = \Attachment\models\AttachmentModel::get(['select' => $select, 'where' => ['res_id = ?'], 'data' => [$id]]);
                                                     }
                                                     if ($object['name'] == 'citoyen') {
                                                         $contact = \Contact\models\ContactModel::getOnView(['select' => ['external_id', 'ca_id'], 'where' => ['ca_id = ?'], 'data' => [$resource[0]['address_id']]]);
diff --git a/modules/attachments/class/attachments_controler_Abstract.php b/modules/attachments/class/attachments_controler_Abstract.php
index 8e79aecc7cc04ecf8deeac1f2160705687b358d6..e36e7af8973d6cc94b6aa7cc9c2c2b033dfa39df 100755
--- a/modules/attachments/class/attachments_controler_Abstract.php
+++ b/modules/attachments/class/attachments_controler_Abstract.php
@@ -210,7 +210,6 @@ abstract class attachments_controler_Abstract
             $infos['res_id_master'] = $line->res_id_master;
             $infos['identifier'] = $line->identifier;
             
-            $infos['is_version'] =  false;
             if (empty($infos['target_table_origin'])) {
                 $infos['target_table_origin'] = 'res_attachments';
             }
diff --git a/modules/attachments/del_attachment.php b/modules/attachments/del_attachment.php
index 0fba67cab633b4e2dcdf1610300139de78c91de7..5e15ec28efa87f78d9308b319e510107569ce85c 100755
--- a/modules/attachments/del_attachment.php
+++ b/modules/attachments/del_attachment.php
@@ -43,14 +43,7 @@ if ($pdf_id != 0) {
     $stmt = $db->query('UPDATE '.RES_ATTACHMENTS_TABLE." SET status = 'DEL' WHERE res_id = ?", array($pdf_id));
 }
 
-// IS VERSION ATTACHMENT ?
-if ($info_doc['is_version'] == true && $info_doc['status'] != 'TMP') {
-    //DEL PREVIOUS ATTACHMENT VERSION
-    $stmt = $db->query('SELECT attachment_id_master FROM res_attachments WHERE res_id = ?', array($_REQUEST['id']));
-    $res = $stmt->fetchObject();
-    $stmt = $db->query("UPDATE res_attachments SET status = 'DEL' WHERE attachment_id_master = ?", array($res->attachment_id_master));
-    $stmt = $db->query("UPDATE res_attachments SET status = 'DEL' WHERE res_id = ?", array($res->attachment_id_master));
-}
+$stmt = $db->query("UPDATE res_attachments SET status = 'DEL' WHERE origin_id = ? or res_id = ?", array($res->origin_id, $res->origin_id));
 
 //LOG DELETE ACTION IN HISTORY
 if ($_SESSION['history']['attachdel'] == 'true') {
@@ -97,27 +90,26 @@ if (empty($_REQUEST['rest'])) {
         $query .= " and attachment_type NOT IN ('converted_pdf','print_folder')";
     }
     $stmt = $db->query($query, array($info_doc['res_id_master']));
-    $new_nb_attach = $stmt->total;
-    ?>
-    <script type="text/javascript">
-        var eleframe1 =  parent.document.getElementsByName('list_attach');
-        if(eleframe1[0] === undefined){
-            eleframe1 =  parent.document.getElementsByName('uniqueDetailsIframe');
-        }
-        var nb_attach = '<?php functions::xecho($new_nb_attach); ?>';
-        <?php if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == 'attachments') {
+    $new_nb_attach = $stmt->total; ?>
+<script type="text/javascript">
+    var eleframe1 = parent.document.getElementsByName('list_attach');
+    if (eleframe1[0] === undefined) {
+        eleframe1 = parent.document.getElementsByName('uniqueDetailsIframe');
+    }
+    var nb_attach = '<?php functions::xecho($new_nb_attach); ?>';
+    <?php if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == 'attachments') {
         ?>
-            eleframe1[0].src = "<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&load&attach_type_exclude=response_project,signed_response,outgoing_mail_signed,converted_pdf,outgoing_mail,print_folder,aihp&fromDetail=attachments'; ?>";
-        <?php
+    eleframe1[0].src = "<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&load&attach_type_exclude=response_project,signed_response,outgoing_mail_signed,converted_pdf,outgoing_mail,print_folder,aihp&fromDetail=attachments'; ?>";
+    <?php
     } elseif (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == 'response') {
-            ?>
-            eleframe1[0].src = "<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&load&attach_type=response_project,outgoing_mail_signed,signed_response,outgoing_mail,aihp&fromDetail=response'; ?>";
-        <?php
-        } else {
-            ?>
-            parent.document.getElementById('list_attach').src = "<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&template_selected=documents_list_attachments_simple&page=frame_list_attachments&load&attach_type_exclude=converted_pdf,print_folder'; ?>";
-        <?php
-        } ?>
-    </script>
+        ?>
+    eleframe1[0].src = "<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=frame_list_attachments&load&attach_type=response_project,outgoing_mail_signed,signed_response,outgoing_mail,aihp&fromDetail=response'; ?>";
+    <?php
+    } else {
+        ?>
+    parent.document.getElementById('list_attach').src = "<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&template_selected=documents_list_attachments_simple&page=frame_list_attachments&load&attach_type_exclude=converted_pdf,print_folder'; ?>";
+    <?php
+    } ?>
+</script>
 <?php
 }
diff --git a/modules/attachments/fill_input.php b/modules/attachments/fill_input.php
index 1c531507bd27eb0a945de6c846b89eb7405722c6..a6aaf8557339745b3218b663d1bbaefcbd9796b3 100755
--- a/modules/attachments/fill_input.php
+++ b/modules/attachments/fill_input.php
@@ -53,7 +53,7 @@ $defaultInfos = \Resource\models\ResModel::getById(['resId' => $_SESSION['doc_id
 if(count($_GET['field']) == 1){
 
     // Check if there is a response project and retrieve the infos about it
-    $queryProjectResponse = \Attachment\models\AttachmentModel::getOnView([
+    $queryProjectResponse = \Attachment\models\AttachmentModel::get([
         'select'    =>  ['identifier, title, dest_contact_id, dest_address_id'],
         'where'     =>  ["res_id_master = (?) AND attachment_type = 'response_project' AND status <> 'DEL'"],
         'data'      =>  [$_GET['field']]
@@ -134,7 +134,7 @@ if(count($_GET['field']) == 1){
 	$str = '<select id="listProjectResponse" name="chrono_number_list" onchange="fillHiddenInput(this.options[this.selectedIndex].value)">';
 	$str .= "<option value=''>" . _CHOOSE_CHRONO_NUMBER . "</option>";
     for($i = 0; $i< count($_GET['field']); $i++){
-        $queryAllProjectReponse = \Attachment\models\AttachmentModel::getOnView([
+        $queryAllProjectReponse = \Attachment\models\AttachmentModel::get([
             'select'    =>  ['title,identifier, dest_contact_id, dest_address_id'],
             'where'     =>  ["res_id_master = (?) AND attachment_type = 'response_project'"],
             'data'      =>  [$_GET['field'][$i]]
diff --git a/modules/sendmail/Controllers/SendMessageExchangeController.php b/modules/sendmail/Controllers/SendMessageExchangeController.php
index 8fa71d9d4f0c39bca424addeae5282d1ea78e062..9d34815ffb31f8d2b7cd7d77d21cd1e41778b4aa 100755
--- a/modules/sendmail/Controllers/SendMessageExchangeController.php
+++ b/modules/sendmail/Controllers/SendMessageExchangeController.php
@@ -69,7 +69,7 @@ class SendMessageExchangeController
         /**************** GET ATTACHMENTS INFOS ***************/
         $AttachmentsInfo = [];
         if (!empty($aArgs['join_attachment'])) {
-            $AttachmentsInfo = \Attachment\models\AttachmentModel::getOnView(['select' => ['*'], 'where' => ['res_id in (?)'], 'data' => [$aArgs['join_attachment']]]);
+            $AttachmentsInfo = \Attachment\models\AttachmentModel::get(['select' => ['*'], 'where' => ['res_id in (?)'], 'data' => [$aArgs['join_attachment']]]);
             foreach ($AttachmentsInfo as $key => $value) {
                 $AttachmentsInfo[$key]['Title']                                  = $value['title'];
                 $AttachmentsInfo[$key]['OriginatingAgencyArchiveUnitIdentifier'] = $value['identifier'];
diff --git a/modules/visa/batch/batch_tools.php b/modules/visa/batch/batch_tools.php
index 73f0203182273ff432e2546af90706338622401f..d3ec70618ae93b995a12023165d685f1a9cc5864 100755
--- a/modules/visa/batch/batch_tools.php
+++ b/modules/visa/batch/batch_tools.php
@@ -214,8 +214,8 @@ function Bt_createAttachment($aArgs = [])
     array_push($dataValue, ['column' => 'relation',         'value' => $relation,                 'type' => 'integer']);
     array_push($dataValue, ['column' => 'in_signature_book','value' => $inSignatureBook,          'type' => 'bool']);
 
-    if (!empty($aArgs['attachment_id_master'])) {
-        array_push($dataValue, ['column' => 'attachment_id_master','value' => $aArgs['attachment_id_master'], 'type' => 'integer']);
+    if (!empty($aArgs['origin_id'])) {
+        array_push($dataValue, ['column' => 'origin_id','value' => $aArgs['origin_id'], 'type' => 'integer']);
     }
 
     $allDatas = [
diff --git a/modules/visa/batch/process_mailsFromSignatoryBook.php b/modules/visa/batch/process_mailsFromSignatoryBook.php
index 0271a4636763701cf8dd7072e13e15165e16272d..4aa1410247baf2a093e8e4a9f04e1c78223be264 100755
--- a/modules/visa/batch/process_mailsFromSignatoryBook.php
+++ b/modules/visa/batch/process_mailsFromSignatoryBook.php
@@ -234,7 +234,7 @@ if (file_exists($GLOBALS['errorLckFile'])) {
 Bt_getWorkBatch();
 
 $GLOBALS['logger']->write('Retrieve attachments sent to remote signatory book', 'INFO');
-$query = "SELECT res_id, external_id->>'signatureBookId' as external_id, external_id->>'xparaphDepot' as xparaphdepot, format, res_id_master, title, identifier, type_id, attachment_type, dest_contact_id, dest_address_id, dest_user, typist, attachment_id_master, relation 
+$query = "SELECT res_id, external_id->>'signatureBookId' as external_id, external_id->>'xparaphDepot' as xparaphdepot, format, res_id_master, title, identifier, type_id, attachment_type, dest_contact_id, dest_address_id, dest_user, typist, origin_id, relation 
         FROM res_attachments WHERE status = 'FRZ' AND external_id->>'signatureBookId' IS NOT NULL AND external_id->>'signatureBookId' <> ''";
 $stmt = $GLOBALS['db']->query($query, []);
     
@@ -320,7 +320,7 @@ foreach ($retrievedMails['noVersion'] as $resId => $value) {
                 'format'          => $value->format,
                 'attachment_type' => $value->attachment_type,
                 'relation'        => $value->relation + 1,
-                'attachment_id_master' => $resId,
+                'origin_id'       => $resId,
                 'status'          => 'TRA',
                 'encodedFile'     => $value->encodedFile,
                 'table'           => 'res_attachments',
diff --git a/modules/visa/class/FastParapheurController.php b/modules/visa/class/FastParapheurController.php
index e337c2f4554df81e67dd806f90a78fde867d1657..781ba8f02a4bc7cdbdf849237c8eb2aff36bf27d 100755
--- a/modules/visa/class/FastParapheurController.php
+++ b/modules/visa/class/FastParapheurController.php
@@ -92,7 +92,7 @@ class FastParapheurController
             $annexes['letterbox'][0]['filePath'] = $letterboxPath['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $annexes['letterbox'][0]['path']) . $annexes['letterbox'][0]['filename'];
         }
 
-        $annexes['attachments']     = \Attachment\models\AttachmentModel::getOnView([
+        $annexes['attachments']     = \Attachment\models\AttachmentModel::get([
             'select'                => ['res_id', 'path', 'filename', 'format'],
             'where'                 => ['res_id_master = ?', 'attachment_type not in (?)', "status NOT IN ('DEL','OBS')", 'in_signature_book = FALSE'],
             'data'                  => [$aArgs['resIdMaster'], 'print_folder']
@@ -107,7 +107,7 @@ class FastParapheurController
         }
         // END annexes
 
-        $attachments         = \Attachment\models\AttachmentModel::getOnView([
+        $attachments         = \Attachment\models\AttachmentModel::get([
             'select'         => ['res_id', 'title', 'attachment_type','path', 'res_id_master', 'format'],
             'where'          => ['res_id_master = ?', 'attachment_type not in (?)', "status not in ('DEL', 'OBS')", 'in_signature_book = TRUE'],
             'data'           => [$aArgs['resIdMaster'], ['converted_pdf', 'incoming_mail_attachment', 'print_folder', 'signed_response']]
diff --git a/modules/visa/class/IParapheurController.php b/modules/visa/class/IParapheurController.php
index 660b1a38be751d7b192a884bbb78421b803bb9ed..3b338fa1284d741333052d16a9322919a59aebdc 100755
--- a/modules/visa/class/IParapheurController.php
+++ b/modules/visa/class/IParapheurController.php
@@ -72,7 +72,7 @@ class IParapheurController
         $letterboxPath                      = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $annexes['letterbox']['docserver_id'], 'select' => ['path_template']]);
         $annexes['letterbox']['filePath']   = $letterboxPath['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $annexes['letterbox']['path']) . $annexes['letterbox']['filename'];
 
-        $annexes['attachments']     = \Attachment\models\AttachmentModel::getOnView([
+        $annexes['attachments']     = \Attachment\models\AttachmentModel::get([
             'select'        => ['res_id', 'path', 'filename' ],
             'where'         => ['res_id_master = ?', 'attachment_type not in (?)', "status NOT IN ('DEL','OBS')", 'in_signature_book = FALSE', "format = 'pdf'"],
             'data'          => [$aArgs['resIdMaster'], 'print_folder']
@@ -87,7 +87,7 @@ class IParapheurController
         }
         // END annexes
 
-        $attachments         = \Attachment\models\AttachmentModel::getOnView([
+        $attachments         = \Attachment\models\AttachmentModel::get([
             'select'         => ['res_id', 'title', 'attachment_type','path'],
             'where'          => ['res_id_master = ?', 'attachment_type not in (?)', "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", 'in_signature_book = TRUE'],
             'data'           => [$aArgs['resIdMaster'], ['converted_pdf', 'incoming_mail_attachment', 'print_folder', 'signed_response']]
diff --git a/modules/visa/class/IxbusController.php b/modules/visa/class/IxbusController.php
index 8a0979b931db850f8c37b0644acdb6319efb9d61..9062cbe948f3355c281e53d7f28b86764e06ba0c 100755
--- a/modules/visa/class/IxbusController.php
+++ b/modules/visa/class/IxbusController.php
@@ -272,11 +272,11 @@ class IxbusController
         }
         $userInfo  = IxbusController::getInfoUtilisateur(['config' => $aArgs['config'], 'login' => $aArgs['loginIxbus'], 'password' => $aArgs['passwordIxbus']]);
 
-        $attachments = \Attachment\models\AttachmentModel::getOnView([
+        $attachments = \Attachment\models\AttachmentModel::get([
             'select'    => [
                 'res_id', 'title', 'identifier', 'attachment_type',
                 'status', 'typist', 'docserver_id', 'path', 'filename', 'creation_date',
-                'validation_date', 'relation', 'attachment_id_master'
+                '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'      => [$aArgs['resIdMaster'], ['converted_pdf', 'incoming_mail_attachment', 'print_folder', 'signed_response']]
@@ -287,7 +287,6 @@ class IxbusController
         foreach ($attachments as $value) {
             $resId  = $value['res_id'];
             $collId = 'attachments_coll';
-            $is_version = false;
 
             $adrInfo       = \Convert\controllers\ConvertPdfController::getConvertedPdfById(['resId' => $resId, 'collId' => $collId]);
             $docserverInfo = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id']]);
diff --git a/modules/visa/generatePdf.php b/modules/visa/generatePdf.php
index 482ca99f3e8d746b29c1ce0be6af7c0b4fac53e2..72a8fc4dfb29132cbf55784bb20cec81fd4eacd7 100755
--- a/modules/visa/generatePdf.php
+++ b/modules/visa/generatePdf.php
@@ -10,12 +10,10 @@
 */
 
 if (isset($_REQUEST["res_id"]) && isset($_REQUEST["coll_id"]) && isset($_REQUEST["is_version"])) {
-    $isVersion = ($_REQUEST["is_version"] == 'true') ? true : false;
     $convertedDocument =  \Convert\controllers\ConvertPdfController::getConvertedPdfById([
         'select' => ['docserver_id', 'path', 'filename'],
         'resId' => $_REQUEST["res_id"],
         'collId' => $_REQUEST["coll_id"],
-        'isVersion' => $isVersion
     ]);
 
     if (!empty($convertedDocument['errors'])) {
diff --git a/src/app/action/controllers/ExternalSignatoryBookTrait.php b/src/app/action/controllers/ExternalSignatoryBookTrait.php
index b1503be72d0180bf11f34ffc50871d1fec3334de..2406adc0bcb6682888d8390d0d8886eca2e38971 100644
--- a/src/app/action/controllers/ExternalSignatoryBookTrait.php
+++ b/src/app/action/controllers/ExternalSignatoryBookTrait.php
@@ -45,7 +45,7 @@ trait ExternalSignatoryBookTrait
             } elseif ($config['id'] == 'fastParapheur') {
                 // TODO
             } elseif ($config['id'] == 'maarchParapheur') {
-                $attachments = AttachmentModel::getOnView([
+                $attachments = AttachmentModel::get([
                     'select'    => [
                         'count(1) as nb'
                     ],
@@ -72,7 +72,7 @@ trait ExternalSignatoryBookTrait
 
                 $historyInfo = $sendedInfo['historyInfos'];
             } elseif ($config['id'] == 'xParaph') {
-                $attachments = AttachmentModel::getOnView([
+                $attachments = AttachmentModel::get([
                     'select'    => [
                         'count(1) as nb'
                     ],
diff --git a/src/app/action/controllers/PreProcessActionController.php b/src/app/action/controllers/PreProcessActionController.php
index 5f08f9ea6ec515f5ff0d0e2ec3ef1a9345fa50d4..5f119b76b44077d889ec62861f0ccdc56329d1a5 100755
--- a/src/app/action/controllers/PreProcessActionController.php
+++ b/src/app/action/controllers/PreProcessActionController.php
@@ -443,11 +443,11 @@ class PreProcessActionController
                     }
 
                     // Check attachments
-                    $attachments = AttachmentModel::getOnView([
+                    $attachments = AttachmentModel::get([
                         'select'    => [
-                            'res_id', 'res_id_version', 'title', 'identifier', 'attachment_type',
+                            'res_id', 'title', 'identifier', 'attachment_type',
                             'status', 'typist', 'docserver_id', 'path', 'filename', 'creation_date',
-                            'validation_date', 'relation', 'attachment_id_master'
+                            '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'      => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
@@ -457,17 +457,10 @@ class PreProcessActionController
                         $additionalsInfos['noAttachment'][] = ['alt_identifier' => $noAttachmentsResource['alt_identifier'], 'res_id' => $resId, 'reason' => 'noAttachmentInSignatoryBook'];
                     } else {
                         foreach ($attachments as $value) {
-                            if (!empty($value['res_id'])) {
-                                $resIdAttachment  = $value['res_id'];
-                                $collId = 'attachments_coll';
-                                $is_version = false;
-                            } else {
-                                $resIdAttachment  = $value['res_id_version'];
-                                $collId = 'attachments_version_coll';
-                                $is_version = true;
-                            }
+                            $resIdAttachment  = $value['res_id'];
+                            $collId = 'attachments_coll';
                             
-                            $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $resIdAttachment, 'collId' => $collId, 'isVersion' => $is_version]);
+                            $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $resIdAttachment, 'collId' => $collId]);
                             if (empty($adrInfo['docserver_id'])) {
                                 $additionalsInfos['noAttachment'][] = ['alt_identifier' => $noAttachmentsResource['alt_identifier'], 'res_id' => $resIdAttachment, 'reason' => 'noAttachmentConversion'];
                                 break;
@@ -501,11 +494,11 @@ class PreProcessActionController
                     }
 
                     // Check attachments
-                    $attachments = AttachmentModel::getOnView([
+                    $attachments = AttachmentModel::get([
                         'select'    => [
-                            'res_id', 'res_id_version', 'title', 'identifier', 'attachment_type',
+                            'res_id', 'title', 'identifier', 'attachment_type',
                             'status', 'typist', 'docserver_id', 'path', 'filename', 'creation_date',
-                            'validation_date', 'relation', 'attachment_id_master'
+                            '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'      => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
@@ -515,17 +508,10 @@ class PreProcessActionController
                         $additionalsInfos['noAttachment'][] = ['alt_identifier' => $noAttachmentsResource['alt_identifier'], 'res_id' => $resId, 'reason' => 'noAttachmentInSignatoryBook'];
                     } else {
                         foreach ($attachments as $value) {
-                            if (!empty($value['res_id'])) {
-                                $resIdAttachment = $value['res_id'];
-                                $collId          = 'attachments_coll';
-                                $is_version      = false;
-                            } else {
-                                $resIdAttachment = $value['res_id_version'];
-                                $collId          = 'attachments_version_coll';
-                                $is_version      = true;
-                            }
+                            $resIdAttachment = $value['res_id'];
+                            $collId          = 'attachments_coll';
                             
-                            $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $resIdAttachment, 'collId' => $collId, 'isVersion' => $is_version]);
+                            $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $resIdAttachment, 'collId' => $collId]);
                             if (empty($adrInfo['docserver_id'])) {
                                 $additionalsInfos['noAttachment'][] = ['alt_identifier' => $noAttachmentsResource['alt_identifier'], 'res_id' => $resIdAttachment, 'reason' => 'noAttachmentConversion'];
                                 break;
@@ -729,21 +715,13 @@ class PreProcessActionController
                 foreach ($aAttachments as $key => $attachment) {
                     if ($attachment['res_id_master'] == $valueResId) {
                         $resIdFound = true;
-                        if (!empty($attachment['res_id'])) {
-                            $isVersion    = false;
-                            $attachmentId = $attachment['res_id'];
-                            $collId       = 'attachments_coll';
-                        } else {
-                            $isVersion    = true;
-                            $attachmentId = $attachment['res_id_version'];
-                            $collId       = 'attachments_version_coll';
-                        }
+                        $attachmentId = $attachment['res_id'];
+                        $collId       = 'attachments_coll';
                         $convertedDocument = ConvertPdfController::getConvertedPdfById([
                             'select'    => ['docserver_id','path', 'filename', 'fingerprint'],
                             'resId'     => $attachmentId,
                             'collId'    => $collId,
-                            'type'      => 'PDF',
-                            'isVersion' => $isVersion
+                            'type'      => 'PDF'
                         ]);
                         if (empty($convertedDocument['docserver_id'])) {
                             $resInfo = ResModel::getById(['select' => ['alt_identifier'], 'resId' => $valueResId]);
diff --git a/src/app/action/controllers/ShippingTrait.php b/src/app/action/controllers/ShippingTrait.php
index 6f15d9b950ab57c9107027a126f21ee94a2ab218..9a00946a2bf77ccad22183e753b1981af50f77f2 100644
--- a/src/app/action/controllers/ShippingTrait.php
+++ b/src/app/action/controllers/ShippingTrait.php
@@ -54,8 +54,8 @@ trait ShippingTrait
         $shippingTemplate['account'] = json_decode($shippingTemplate['account'], true);
         $shippingTemplate['fee'] = json_decode($shippingTemplate['fee'], true);
 
-        $attachments = AttachmentModel::getOnView([
-            'select'    => ['res_id', 'res_id_version', 'title', 'dest_address_id', 'external_id'],
+        $attachments = AttachmentModel::get([
+            'select'    => ['res_id', 'title', 'dest_address_id', 'external_id'],
             'where'     => ['res_id_master = ?', 'in_send_attach = ?', 'status not in (?)', 'attachment_type not in (?)'],
             'data'      => [$args['resId'], true, ['OBS', 'DEL', 'TMP', 'FRZ'], ['print_folder']]
         ]);
@@ -65,13 +65,7 @@ trait ShippingTrait
 
         $contacts = [];
         foreach ($attachments as $attachment) {
-            if (!empty($attachment['res_id'])) {
-                $isVersion = false;
-                $attachmentId = $attachment['res_id'];
-            } else {
-                $isVersion = true;
-                $attachmentId = $attachment['res_id_version'];
-            }
+            $attachmentId = $attachment['res_id'];
 
             $convertedDocument = AdrModel::getConvertedDocumentById([
                 'select'    => ['docserver_id','path', 'filename', 'fingerprint'],
@@ -150,7 +144,7 @@ trait ShippingTrait
                 continue;
             }
 
-            $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $attachmentId, 'collId' => 'attachments_coll', 'isVersion' => $isVersion]);
+            $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $attachmentId, 'collId' => 'attachments_coll']);
             $docserver = DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]);
             if (empty($docserver['path_template']) || !file_exists($docserver['path_template'])) {
                 $errors[] = "Docserver does not exist for attachment {$attachmentId}";
diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php
index c42bb8eafc3903ad38bdd6e15c94a49da9cbb0fb..07cd3145178b58c862f457cc3424bc7e99e16763 100755
--- a/src/app/attachment/controllers/AttachmentController.php
+++ b/src/app/attachment/controllers/AttachmentController.php
@@ -217,9 +217,9 @@ class AttachmentController
             return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']);
         }
 
-        $attachment = AttachmentModel::getOnView([
-            'select'    => ['res_id', 'res_id_version', 'docserver_id', 'path', 'filename', 'res_id_master'],
-            'where'     => ['res_id = ? or res_id_version = ?', 'status not in (?)'],
+        $attachment = AttachmentModel::get([
+            'select'    => ['res_id', 'docserver_id', 'path', 'filename', 'res_id_master'],
+            'where'     => ['res_id = ?', 'status not in (?)'],
             'data'      => [$args['id'], $args['id'], ['DEL', 'OBS']],
             'limit'     => 1
         ]);
@@ -233,12 +233,7 @@ class AttachmentController
 
         $pathToThumbnail = 'apps/maarch_entreprise/img/noThumbnail.png';
         $attachmentTodisplay = $attachment[0];
-        $isVersion = empty($attachmentTodisplay['res_id']);
-        if ($isVersion) {
-            $collId = "attachments_version_coll";
-        } else {
-            $collId = "attachments_coll";
-        }
+        $collId = "attachments_coll";
 
         $tnlAdr = AdrModel::getTypedAttachAdrByResId([
             'select'    => ['docserver_id', 'path', 'filename'],
@@ -288,9 +283,9 @@ class AttachmentController
             return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']);
         }
 
-        $attachment = AttachmentModel::getOnView([
-            'select'    => ['res_id', 'res_id_version', 'docserver_id', 'path', 'filename'],
-            'where'     => ['res_id = ? or res_id_version = ?', 'status not in (?)'],
+        $attachment = AttachmentModel::get([
+            'select'    => ['res_id', 'docserver_id', 'path', 'filename'],
+            'where'     => ['res_id = ?', 'status not in (?)'],
             'data'      => [$args['id'], $args['id'], ['DEL']],
             'limit'     => 1
         ]);
@@ -303,10 +298,9 @@ class AttachmentController
         }
 
         $attachmentTodisplay = $attachment[0];
-        $id = (empty($attachmentTodisplay['res_id']) ? $attachmentTodisplay['res_id_version'] : $attachmentTodisplay['res_id']);
-        $isVersion = empty($attachmentTodisplay['res_id']);
+        $id = $attachmentTodisplay['res_id'];
 
-        $convertedAttachment = ConvertPdfController::getConvertedPdfById(['resId' => $id, 'collId' => 'attachments_coll', 'isVersion' => $isVersion]);
+        $convertedAttachment = ConvertPdfController::getConvertedPdfById(['resId' => $id, 'collId' => 'attachments_coll']);
         if (empty($convertedAttachment['errors'])) {
             $attachmentTodisplay = $convertedAttachment;
         }
@@ -348,7 +342,7 @@ class AttachmentController
                         } elseif ($value == 'hour_now') {
                             $tmp = date('H:i');
                         } else {
-                            $backFromView = AttachmentModel::getOnView(['select' => [$value], 'where' => ['res_id = ?'], 'data' => [$args['id']]]);
+                            $backFromView = AttachmentModel::get(['select' => [$value], 'where' => ['res_id = ?'], 'data' => [$args['id']]]);
                             if (!empty($backFromView[0][$value])) {
                                 $tmp = $backFromView[0][$value];
                             }
@@ -429,9 +423,9 @@ class AttachmentController
             return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']);
         }
 
-        $attachment = AttachmentModel::getOnView([
-            'select'    => ['res_id', 'res_id_version', 'docserver_id', 'path', 'filename', 'res_id_master'],
-            'where'     => ['res_id = ? or res_id_version = ?', 'status not in (?)'],
+        $attachment = AttachmentModel::get([
+            'select'    => ['res_id', 'docserver_id', 'path', 'filename', 'res_id_master'],
+            'where'     => ['res_id = ?', 'status not in (?)'],
             'data'      => [$args['id'], $args['id'], ['DEL']],
             'limit'     => 1
         ]);
@@ -444,7 +438,7 @@ class AttachmentController
         }
 
         $attachmentTodisplay = $attachment[0];
-        $id = (empty($attachmentTodisplay['res_id']) ? $attachmentTodisplay['res_id_version'] : $attachmentTodisplay['res_id']);
+        $id = $attachmentTodisplay['res_id'];
 
         $document['docserver_id'] = $attachmentTodisplay['docserver_id'];
         $document['path'] = $attachmentTodisplay['path'];
@@ -511,7 +505,7 @@ class AttachmentController
         $document = AttachmentModel::getById(['select' => ['docserver_id', 'path', 'filename', 'title'], 'id' => $aArgs['id']]);
 
         if (empty($aArgs['original'])) {
-            $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['id'], 'collId' => 'attachments_coll', 'isVersion' => $aArgs['isVersion']]);
+            $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['id'], 'collId' => 'attachments_coll']);
 
             if (empty($convertedDocument['errors'])) {
                 $document['docserver_id'] = $convertedDocument['docserver_id'];
@@ -557,7 +551,7 @@ class AttachmentController
 
     public static function generateAttachForMailing(array $aArgs)
     {
-        $attachments = AttachmentModel::getOnView([
+        $attachments = AttachmentModel::get([
             'select'    => ['*'],
             'where'     => ['res_id_master = ?', 'status = ?', 'in_signature_book = ?'],
             'data'      => [$aArgs['resIdMaster'], 'SEND_MASS', true]
@@ -645,7 +639,7 @@ class AttachmentController
                         'userId'           => $aArgs['userId'],
                         'res_id'           => $aArgs['resIdMaster'],
                         'coll_id'          => 'letterbox_coll',
-                        'res_view'         => 'res_view_attachments',
+                        'res_view'         => 'res_attachments',
                         'res_table'        => 'res_attachments',
                         'res_contact_id'   => $contactForMailing['contact_id'],
                         'res_address_id'   => $contactForMailing['address_id'],
@@ -688,7 +682,7 @@ class AttachmentController
             return ['errors' => 'Document out of perimeter'];
         }
 
-        $attachments = AttachmentModel::getOnView([
+        $attachments = AttachmentModel::get([
             'select' => ['res_id'],
             'where' => ['res_id_master = ?', 'status = ?'],
             'data' => [$aArgs['resIdMaster'],'SEND_MASS']
diff --git a/src/app/convert/controllers/ConvertPdfController.php b/src/app/convert/controllers/ConvertPdfController.php
index c5502ab5305fc8707302b07f6a5da5b1f0e6c21a..6e6fa4c69bc1d7508340d4d15040e8cecb29775a 100755
--- a/src/app/convert/controllers/ConvertPdfController.php
+++ b/src/app/convert/controllers/ConvertPdfController.php
@@ -177,21 +177,18 @@ class ConvertPdfController
     {
         ValidatorModel::notEmpty($aArgs, ['resId', 'collId']);
         ValidatorModel::intVal($aArgs, ['resId']);
-        ValidatorModel::boolType($aArgs, ['isVersion']);
 
         $convertedDocument = AdrModel::getConvertedDocumentById([
             'select'    => ['docserver_id','path', 'filename', 'fingerprint'],
             'resId'     => $aArgs['resId'],
             'collId'    => $aArgs['collId'],
-            'type'      => 'PDF',
-            'isVersion' => $aArgs['isVersion']
+            'type'      => 'PDF'
         ]);
         
         if (empty($convertedDocument)) {
             $convertedDocument = ConvertPdfController::convert([
                 'resId'     => $aArgs['resId'],
-                'collId'    => $aArgs['collId'],
-                'isVersion' => $aArgs['isVersion'],
+                'collId'    => $aArgs['collId']
             ]);
         }
 
diff --git a/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php b/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php
index 0575a49a7426874f23ed80c6d3f60672d4661918..b5e2d26bcc6f06f63b76f1f74d189e30a6b0dd6f 100755
--- a/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php
+++ b/src/app/external/externalSignatoryBook/controllers/MaarchParapheurController.php
@@ -195,11 +195,11 @@ class MaarchParapheurController
 
             $excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
 
-            $attachments = AttachmentModel::getOnView([
+            $attachments = AttachmentModel::get([
                 'select'    => [
                     'res_id', 'title', 'identifier', 'attachment_type',
                     'status', 'typist', 'docserver_id', 'path', 'filename', 'creation_date',
-                    'validation_date', 'relation', 'attachment_id_master'
+                    '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'], $excludeAttachmentTypes]
@@ -211,7 +211,6 @@ class MaarchParapheurController
                 foreach ($attachments as $value) {
                     $resId  = $value['res_id'];
                     $collId = 'attachments_coll';
-                    $is_version = false;
                     
                     $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $resId, 'collId' => $collId]);
                     if (empty($adrInfo['docserver_id'])) {
diff --git a/src/app/external/externalSignatoryBook/controllers/XParaphController.php b/src/app/external/externalSignatoryBook/controllers/XParaphController.php
index fb74be482bbc1d3c29ad0e48429d3d87acb8e0cb..5079d5315ea638262eb5e8f52e092eaa9d6ee171 100755
--- a/src/app/external/externalSignatoryBook/controllers/XParaphController.php
+++ b/src/app/external/externalSignatoryBook/controllers/XParaphController.php
@@ -32,7 +32,7 @@ class XParaphController
 {
     public static function sendDatas($aArgs)
     {
-        $attachments = AttachmentModel::getOnView([
+        $attachments = AttachmentModel::get([
             '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'"],
@@ -62,7 +62,6 @@ class XParaphController
         foreach ($attachments as $value) {
             $resId      = $value['res_id'];
             $collId     = 'attachments_coll';
-            $is_version = false;
             
             $adrInfo       = ConvertPdfController::getConvertedPdfById(['resId' => $resId, 'collId' => $collId]);
             $docserverInfo = DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id']]);
diff --git a/src/app/folder/controllers/FolderController.php b/src/app/folder/controllers/FolderController.php
index 4f7b0716099704a296f04b5f30e7ae5bd75f28dc..36312ea488062ebf35c063d02070e6a53095b63f 100755
--- a/src/app/folder/controllers/FolderController.php
+++ b/src/app/folder/controllers/FolderController.php
@@ -527,7 +527,7 @@ class FolderController
                     $excludeAttachmentTypes[] = 'document_with_notes';
                 }
 
-                $attachments = AttachmentModel::getOnView([
+                $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'],
diff --git a/src/app/resource/controllers/ExportController.php b/src/app/resource/controllers/ExportController.php
index 1c2043c68d488e150b168af708334f475eb64980..247c3705c97a7beb60ca13f51017e8b6873ac30e 100644
--- a/src/app/resource/controllers/ExportController.php
+++ b/src/app/resource/controllers/ExportController.php
@@ -549,7 +549,7 @@ class ExportController
         }
 
         foreach ($args['chunkedResIds'] as $resIds) {
-            $attachments = AttachmentModel::getOnView([
+            $attachments = AttachmentModel::get([
                 'select'    => ['creation_date', 'res_id'],
                 'where'     => ['res_id in (?)', 'attachment_type = ?', 'status = ?'],
                 'data'      => [$resIds, 'signed_response', 'TRA'],
diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php
index 73803b77e7bf4b53e3dcffc39a25185a80a5b6f8..bf6b5484e2137a8dda9f051cc04c89943263a450 100755
--- a/src/app/resource/controllers/ResController.php
+++ b/src/app/resource/controllers/ResController.php
@@ -233,22 +233,18 @@ class ResController
         }
 
         if ($document['category_id'] == 'outgoing') {
-            $attachment = AttachmentModel::getOnView([
-                'select'    => ['res_id', 'res_id_version', 'docserver_id', 'path', 'filename'],
+            $attachment = AttachmentModel::get([
+                'select'    => ['res_id', 'docserver_id', 'path', 'filename'],
                 'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
                 'data'      => [$aArgs['resId'], 'outgoing_mail', ['DEL', 'OBS']],
                 'limit'     => 1
             ]);
             if (!empty($attachment[0])) {
                 $attachmentTodisplay = $attachment[0];
-                $id = (empty($attachmentTodisplay['res_id']) ? $attachmentTodisplay['res_id_version'] : $attachmentTodisplay['res_id']);
-                $isVersion = empty($attachmentTodisplay['res_id']);
-                if ($isVersion) {
-                    $collId = "attachments_version_coll";
-                } else {
-                    $collId = "attachments_coll";
-                }
-                $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $id, 'collId' => $collId, 'isVersion' => $isVersion]);
+                $id = $attachmentTodisplay['res_id'];
+                $collId = "attachments_coll";
+                
+                $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $id, 'collId' => $collId]);
                 if (empty($convertedDocument['errors'])) {
                     $attachmentTodisplay = $convertedDocument;
                 }
@@ -258,7 +254,7 @@ class ResController
                 $document['fingerprint'] = $attachmentTodisplay['fingerprint'];
             }
         } else {
-            $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resId'], 'collId' => 'letterbox_coll', 'isVersion' => false]);
+            $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resId'], 'collId' => 'letterbox_coll']);
 
             if (empty($convertedDocument['errors'])) {
                 $documentTodisplay = $convertedDocument;
@@ -404,8 +400,8 @@ class ResController
         }
 
         if ($document['category_id'] == 'outgoing') {
-            $attachment = AttachmentModel::getOnView([
-                'select'    => ['res_id', 'res_id_version', 'docserver_id', 'path', 'filename', 'fingerprint'],
+            $attachment = AttachmentModel::get([
+                'select'    => ['res_id', 'docserver_id', 'path', 'filename', 'fingerprint'],
                 'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
                 'data'      => [$aArgs['resId'], 'outgoing_mail', ['DEL', 'OBS']],
                 'limit'     => 1
@@ -487,8 +483,8 @@ class ResController
             if (empty($tnlAdr)) {
                 $document = ResModel::getById(['select' => ['category_id'], 'resId' => $aArgs['resId']]);
                 if ($document['category_id'] == 'outgoing') {
-                    $attachment = AttachmentModel::getOnView([
-                        'select'    => ['res_id', 'res_id_version'],
+                    $attachment = AttachmentModel::get([
+                        'select'    => ['res_id'],
                         'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
                         'data'      => [$aArgs['resId'], 'outgoing_mail', ['DEL', 'OBS']],
                         'limit'     => 1
@@ -605,22 +601,17 @@ class ResController
 
         if (empty($aArgs['original'])) {
             if ($document['category_id'] == 'outgoing') {
-                $attachment = AttachmentModel::getOnView([
-                    'select'    => ['res_id', 'res_id_version', 'docserver_id', 'path', 'filename'],
+                $attachment = AttachmentModel::get([
+                    'select'    => ['res_id', 'docserver_id', 'path', 'filename'],
                     'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
                     'data'      => [$aArgs['resId'], 'outgoing_mail', ['DEL', 'OBS']],
                     'limit'     => 1
                 ]);
                 if (!empty($attachment[0])) {
                     $attachmentTodisplay = $attachment[0];
-                    $id = (empty($attachmentTodisplay['res_id']) ? $attachmentTodisplay['res_id_version'] : $attachmentTodisplay['res_id']);
-                    $isVersion = empty($attachmentTodisplay['res_id']);
-                    if ($isVersion) {
-                        $collId = "attachments_version_coll";
-                    } else {
-                        $collId = "attachments_coll";
-                    }
-                    $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $id, 'collId' => $collId, 'isVersion' => $isVersion]);
+                    $id = $attachmentTodisplay['res_id'];
+                    $collId = "attachments_version_coll";
+                    $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $id, 'collId' => $collId]);
                     if (empty($convertedDocument['errors'])) {
                         $attachmentTodisplay = $convertedDocument;
                     }
@@ -630,7 +621,7 @@ class ResController
                     $document['fingerprint'] = $attachmentTodisplay['fingerprint'];
                 }
             } else {
-                $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resId'], 'collId' => 'letterbox_coll', 'isVersion' => false]);
+                $convertedDocument = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resId'], 'collId' => 'letterbox_coll']);
 
                 if (empty($convertedDocument['errors'])) {
                     $document['docserver_id'] = $convertedDocument['docserver_id'];
diff --git a/src/app/resource/controllers/ResourceListController.php b/src/app/resource/controllers/ResourceListController.php
index 238a8b7941a4ea431b527c1de464369ea49c91d1..d61e8a7fec8e07e12f3db74b61facc499c4af32e 100644
--- a/src/app/resource/controllers/ResourceListController.php
+++ b/src/app/resource/controllers/ResourceListController.php
@@ -92,7 +92,7 @@ class ResourceListController
                 $excludeAttachmentTypes[] = 'document_with_notes';
             }
 
-            $attachments = AttachmentModel::getOnView([
+            $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'],
diff --git a/src/app/shipping/controllers/ShippingTemplateController.php b/src/app/shipping/controllers/ShippingTemplateController.php
index 560506042d918f89ef3b1dc3472923d6c13c1dee..686f219c50fcb8696c62cfa2cbb65831aa4c91d6 100755
--- a/src/app/shipping/controllers/ShippingTemplateController.php
+++ b/src/app/shipping/controllers/ShippingTemplateController.php
@@ -290,14 +290,8 @@ class ShippingTemplateController
     {
         $fee = 0;
         foreach ($aArgs['resources'] as $value) {
-            if (!empty($value['res_id'])) {
-                $isVersion = false;
-                $attachmentId = $value['res_id'];
-            } else {
-                $isVersion = true;
-                $attachmentId = $value['res_id_version'];
-            }
-            $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $attachmentId, 'collId' => 'attachments_coll', 'isVersion' => $isVersion]);
+            $attachmentId = $value['res_id'];
+            $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $attachmentId, 'collId' => 'attachments_coll']);
             $docserver           = DocserverModel::getByDocserverId(['docserverId' => $convertedAttachment['docserver_id'], 'select' => ['path_template']]);
             $pathToDocument      = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedAttachment['path']) . $convertedAttachment['filename'];
 
diff --git a/src/app/signatureBook/controllers/SignatureBookController.php b/src/app/signatureBook/controllers/SignatureBookController.php
index 4eba2939fb86d25514bf53bf0bd9e6150c00b69c..cab97709bcd72421a7675cd31e77a0653e216894 100755
--- a/src/app/signatureBook/controllers/SignatureBookController.php
+++ b/src/app/signatureBook/controllers/SignatureBookController.php
@@ -167,8 +167,8 @@ class SignatureBookController
             return ['error' => 'No Document Found'];
         }
 
-        $incomingMailAttachments = AttachmentModel::getOnView([
-            'select'      => ['res_id', 'res_id_version', 'title', 'format', 'attachment_type', 'path', 'filename'],
+        $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']]
         ]);
@@ -190,15 +190,9 @@ class SignatureBookController
             }
 
             $realId = 0;
-            if ($value['res_id'] == 0) {
-                $realId = $value['res_id_version'];
-                $isVersion = true;
-            } elseif ($value['res_id_version'] == 0) {
-                $realId = $value['res_id'];
-                $isVersion = false;
-            }
+            $realId = $value['res_id_version'];
 
-            $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $realId, 'collId' => 'attachments_coll', 'isVersion' => $isVersion]);
+            $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $realId, 'collId' => 'attachments_coll']);
 
             if (empty($convertedAttachment['errors'])) {
                 $isConverted = true;
@@ -236,12 +230,12 @@ class SignatureBookController
         }
         $orderBy .= " ELSE {$c} END, doc_date DESC NULLS LAST, creation_date DESC";
 
-        $attachments = AttachmentModel::getOnView([
+        $attachments = AttachmentModel::get([
             'select'    => [
-                'res_id', 'res_id_version', 'title', 'identifier', 'attachment_type',
+                'res_id', 'title', 'identifier', 'attachment_type',
                 'status', 'typist', 'path', 'filename', 'updated_by', 'creation_date',
                 'validation_date', 'format', 'relation', 'dest_user', 'dest_contact_id',
-                'dest_address_id', 'origin', 'doc_date', 'attachment_id_master'
+                'dest_address_id', 'origin', 'doc_date', 'origin_id'
             ],
             'where'     => ['res_id_master = ?', 'attachment_type not in (?)', "status not in ('DEL', 'OBS')", 'in_signature_book = TRUE'],
             'data'      => [$aArgs['resId'], ['incoming_mail_attachment', 'print_folder']],
@@ -256,21 +250,14 @@ class SignatureBookController
                 continue;
             }
 
-            $realId = 0;
-            if ($value['res_id'] == 0) {
-                $realId = $value['res_id_version'];
-                $isVersion = true;
-            } elseif ($value['res_id_version'] == 0) {
-                $realId = $value['res_id'];
-                $isVersion = false;
-            }
+            $realId = $value['res_id'];
 
             $viewerId       = $realId;
             $viewerNoSignId = $realId;
             $pathToFind     = $value['path'] . str_replace(strrchr($value['filename'], '.'), '.pdf', $value['filename']);
             $isConverted    = false;
 
-            $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => [1], 'resId' => $realId, 'collId' => 'attachments_coll', 'isVersion' => $isVersion]);
+            $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => [1], 'resId' => $realId, 'collId' => 'attachments_coll']);
 
             if (empty($convertedAttachment['errors'])) {
                 $isConverted = true;
@@ -337,8 +324,8 @@ class SignatureBookController
             }
         }
 
-        $obsAttachments = AttachmentModel::getOnView([
-            'select'    => ['res_id', 'res_id_version', 'attachment_id_master', 'relation', 'creation_date', 'title'],
+        $obsAttachments = AttachmentModel::get([
+            'select'    => ['res_id', 'origin_id', 'relation', 'creation_date', 'title'],
             'where'     => ['res_id_master = ?', 'attachment_type not in (?)', 'status = ?'],
             'data'      => [$aArgs['resId'], ['incoming_mail_attachment', 'print_folder', 'converted_pdf', 'signed_response'], 'OBS'],
             'orderBy'  => ['relation ASC']
@@ -349,7 +336,7 @@ class SignatureBookController
             if ($value['relation'] == 1) {
                 $obsData[$value['res_id']][] = ['resId' => $value['res_id'], 'title' => $value['title'], 'relation' => $value['relation'], 'creation_date' => $value['creation_date']];
             } else {
-                $obsData[$value['attachment_id_master']][] = ['resId' => $value['res_id_version'], 'title' => $value['title'], 'relation' => $value['relation'], 'creation_date' => $value['creation_date']];
+                $obsData[$value['origin_id']][] = ['resId' => $value['res_id_version'], 'title' => $value['title'], 'relation' => $value['relation'], 'creation_date' => $value['creation_date']];
             }
         }
 
@@ -360,12 +347,12 @@ class SignatureBookController
             }
 
             $attachments[$key]['obsAttachments'] = [];
-            if ($value['relation'] > 1 && !empty($obsData[$value['attachment_id_master']])) {
-                $attachments[$key]['obsAttachments'] = $obsData[$value['attachment_id_master']];
+            if ($value['relation'] > 1 && !empty($obsData[$value['origin_id']])) {
+                $attachments[$key]['obsAttachments'] = $obsData[$value['origin_id']];
             }
 
             unset($attachments[$key]['path'], $attachments[$key]['filename'], $attachments[$key]['dest_user'],
-                $attachments[$key]['dest_contact_id'], $attachments[$key]['dest_address_id'], $attachments[$key]['attachment_id_master']
+                $attachments[$key]['dest_contact_id'], $attachments[$key]['dest_address_id'], $attachments[$key]['origin_id']
             );
         }
 
@@ -397,7 +384,7 @@ class SignatureBookController
             $resIds[] = $value['res_id'];
         }
 
-        $attachmentsInResList = AttachmentModel::getOnView([
+        $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')"],
             'data'      => [$resIds]