From feda4012f6cf41daf60163e9e27dc151b6e00bef Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Tue, 5 Nov 2019 15:40:17 +0100
Subject: [PATCH] FEAT #11691 TIME 0:20 Remove is version from v2 + shipping is
 version

---
 sql/structure.sql                             |  1 -
 .../models/AttachmentModelAbstract.php        | 19 -------------------
 .../controllers/ConvertPdfController.php      |  1 -
 src/app/email/controllers/EmailController.php |  7 +------
 src/app/shipping/models/ShippingModel.php     |  2 --
 5 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/sql/structure.sql b/sql/structure.sql
index 59a4bb57184..00ab2c48566 100755
--- a/sql/structure.sql
+++ b/sql/structure.sql
@@ -1295,7 +1295,6 @@ CREATE TABLE shippings
 id serial NOT NULL,
 user_id INTEGER NOT NULL,
 attachment_id INTEGER NOT NULL,
-is_version boolean NOT NULL,
 options json DEFAULT '{}',
 fee FLOAT NOT NULL,
 recipient_entity_id INTEGER NOT NULL,
diff --git a/src/app/attachment/models/AttachmentModelAbstract.php b/src/app/attachment/models/AttachmentModelAbstract.php
index fc1e47b0e08..b3790d7da55 100755
--- a/src/app/attachment/models/AttachmentModelAbstract.php
+++ b/src/app/attachment/models/AttachmentModelAbstract.php
@@ -39,25 +39,6 @@ abstract class AttachmentModelAbstract
         return $attachments;
     }
 
-    public static function getOnView(array $aArgs)
-    {
-        ValidatorModel::notEmpty($aArgs, ['select']);
-        ValidatorModel::arrayType($aArgs, ['select', 'where', 'data', 'orderBy', 'groupBy']);
-        ValidatorModel::intType($aArgs, ['limit']);
-
-        $aAttachments = DatabaseModel::select([
-            'select'    => $aArgs['select'],
-            'table'     => ['res_view_attachments'],
-            'where'     => empty($aArgs['where']) ? [] : $aArgs['where'],
-            'data'      => empty($aArgs['data']) ? [] : $aArgs['data'],
-            'groupBy'   => empty($aArgs['groupBy']) ? [] : $aArgs['groupBy'],
-            'order_by'  => empty($aArgs['orderBy']) ? [] : $aArgs['orderBy'],
-            'limit'     => empty($aArgs['limit']) ? 0 : $aArgs['limit']
-        ]);
-
-        return $aAttachments;
-    }
-
     public static function getById(array $aArgs)
     {
         ValidatorModel::notEmpty($aArgs, ['id']);
diff --git a/src/app/convert/controllers/ConvertPdfController.php b/src/app/convert/controllers/ConvertPdfController.php
index 6e6fa4c69bc..7bdbd9a08c1 100755
--- a/src/app/convert/controllers/ConvertPdfController.php
+++ b/src/app/convert/controllers/ConvertPdfController.php
@@ -128,7 +128,6 @@ class ConvertPdfController
         } else {
             AdrModel::createAttachAdr([
                 'resId'         => $aArgs['resId'],
-                'isVersion'     => $aArgs['isVersion'],
                 'type'          => 'PDF',
                 'docserverId'   => $storeResult['docserver_id'],
                 'path'          => $storeResult['destination_dir'],
diff --git a/src/app/email/controllers/EmailController.php b/src/app/email/controllers/EmailController.php
index bf1fc6f5f1d..588e50dc200 100644
--- a/src/app/email/controllers/EmailController.php
+++ b/src/app/email/controllers/EmailController.php
@@ -143,11 +143,7 @@ class EmailController
             $document['attachments'] = (array)$document['attachments'];
             foreach ($document['attachments'] as $attachment) {
                 $attachment = (array)$attachment;
-                if ($attachment['isVersion']) {
-                    $email['attachments_version'][] = $attachment['id'];
-                } else {
-                    $email['attachments'][] = $attachment['id'];
-                }
+                $email['attachments'][] = $attachment['id'];
             }
         }
 
@@ -477,7 +473,6 @@ class EmailController
                 }
                 foreach ($args['data']['document']['attachments'] as $attachment) {
                     $check = Validator::intVal()->notEmpty()->validate($attachment['id']);
-                    $check = $check && Validator::boolType()->validate($attachment['isVersion']);
                     $check = $check && Validator::boolType()->validate($attachment['original']);
                     if (!$check) {
                         return ['errors' => 'Data document[attachments] errors', 'code' => 400];
diff --git a/src/app/shipping/models/ShippingModel.php b/src/app/shipping/models/ShippingModel.php
index 26a8ec2ceee..38bf95224c1 100644
--- a/src/app/shipping/models/ShippingModel.php
+++ b/src/app/shipping/models/ShippingModel.php
@@ -24,14 +24,12 @@ class ShippingModel
         ValidatorModel::notEmpty($args, ['userId', 'attachmentId', 'accountId']);
         ValidatorModel::intVal($args, ['userId', 'attachmentId', 'recipientEntityId']);
         ValidatorModel::stringType($args, ['accountId']);
-        ValidatorModel::boolType($args, ['isVersion']);
 
         DatabaseModel::insert([
             'table'         => 'shippings',
             'columnsValues' => [
                 'user_id'               => $args['userId'],
                 'attachment_id'         => $args['attachmentId'],
-                'is_version'            => empty($args['isVersion']) ? 'false' : 'true',
                 'options'               => $args['options'],
                 'fee'                   => $args['fee'],
                 'recipient_entity_id'   => $args['recipientEntityId'],
-- 
GitLab