From 585e03fd1dd2f9429b10f2e8fce6b083fab427b9 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Tue, 19 Nov 2019 16:30:14 +0100
Subject: [PATCH] FEAT #11691 TIME 0:45 migrateVersionAttachment fulltext

---
 .../indexing_searching/search_adv_result.php                | 6 +++---
 migration/19.12/migrateVersionAttachments.php               | 6 +++---
 src/app/convert/scripts/FullTextScript.php                  | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/apps/maarch_entreprise/indexing_searching/search_adv_result.php b/apps/maarch_entreprise/indexing_searching/search_adv_result.php
index 610b859be4d..682a4c8bfb4 100755
--- a/apps/maarch_entreprise/indexing_searching/search_adv_result.php
+++ b/apps/maarch_entreprise/indexing_searching/search_adv_result.php
@@ -378,7 +378,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
 
                                 $where_request .= " res_id IN ($Liste_Ids) ";
 
-                                if ($key == 2) {
+                                if ($key == 1) {
                                     $where_request .= ') and ';
                                 } else {
                                     $where_request .= ' or ';
@@ -390,7 +390,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
 
                                 $where_request .= " 1=-1 ";
 
-                                if ($key == 2) {
+                                if ($key == 1) {
                                     $where_request .= ') and ';
                                 } else {
                                     $where_request .= ' or ';
@@ -403,7 +403,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
 
                             $where_request .= " 1=-1 ";
 
-                            if ($key == 2) {
+                            if ($key == 1) {
                                 $where_request .= ') and ';
                             } else {
                                 $where_request .= ' or ';
diff --git a/migration/19.12/migrateVersionAttachments.php b/migration/19.12/migrateVersionAttachments.php
index da06af001b3..68417dba38b 100644
--- a/migration/19.12/migrateVersionAttachments.php
+++ b/migration/19.12/migrateVersionAttachments.php
@@ -1,7 +1,5 @@
 <?php
 
-use SrcCore\models\CoreConfigModel;
-
 require '../../vendor/autoload.php';
 
 chdir('../..');
@@ -79,7 +77,9 @@ foreach ($customs as $custom) {
         migrateEmailsVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
         migrateMessageExchangeVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
         migrateShippingVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
-        migrateFullText(['newResId' => $newResId, 'customId' => $custom, 'userId' => $masterOwnerId]);
+        if (in_array($attachmentInfo['status'], ['A_TRA', 'TRA'])) {
+            migrateFullText(['newResId' => $newResId, 'customId' => $custom, 'userId' => $masterOwnerId]);
+        }
 
         $migrated++;
     }
diff --git a/src/app/convert/scripts/FullTextScript.php b/src/app/convert/scripts/FullTextScript.php
index b1cceeb8456..97b11454110 100644
--- a/src/app/convert/scripts/FullTextScript.php
+++ b/src/app/convert/scripts/FullTextScript.php
@@ -47,7 +47,7 @@ class FullTextScript
         $mode     = '';
 
         if (array_search('--customId', $args) > 0) {
-            $cmd = array_search('--limit', $args);
+            $cmd = array_search('--customId', $args);
             $customId = $args[$cmd+1];
         }
         
-- 
GitLab