Skip to content
Snippets Groups Projects
Verified Commit 21685b29 authored by Damien's avatar Damien
Browse files

FEAT #11691 TIME 1:00 Full text migration for versions

parent 4f4f094d
No related branches found
No related tags found
No related merge requests found
......@@ -65,11 +65,6 @@
<script_search_result>list_results_attachments.php</script_search_result>
<script_details>details_attachments.php</script_details>
</COLLECTION>
<COLLECTION>
<id>archive_transfer_coll</id>
<label>_ARCHVIE_TRANSFER_COLL</label>
<table>message_exchange</table>
</COLLECTION>
<HISTORY>
<usersdel>true</usersdel>
<usersban>true</usersban>
......
......@@ -26,9 +26,8 @@ foreach ($customs as $custom) {
$collId = 'letterbox_coll';
} elseif ((string)$collection->table == 'res_attachments') {
$collId = 'attachments_coll';
} elseif ((string)$collection->table == 'res_version_attachments') {
$collId = 'attachments_version_coll';
} else {
unset($xmlfile->COLLECTION[$i]);
continue;
}
......
<?php
use SrcCore\models\CoreConfigModel;
require '../../vendor/autoload.php';
chdir('../..');
......@@ -19,6 +21,14 @@ foreach ($customs as $custom) {
'where' => ['relation > 1']
]);
$superadmin = \User\models\UserModel::getByLogin(['select' => ['id'], 'login' => 'superadmin']);
if (empty($superadmin)) {
$firstMan = \User\models\UserModel::get(['select' => ['id'], 'orderBy' => ['id'], 'limit' => 1]);
$masterOwnerId = $firstMan[0]['id'];
} else {
$masterOwnerId = $superadmin['id'];
}
$migrated = 0;
$attachmentsInfo = \SrcCore\models\DatabaseModel::select([
'select' => ['res_id', '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', 'res_id_master', 'attachment_type', 'dest_contact_id', 'dest_address_id', 'updated_by', 'is_multicontacts', 'in_signature_book', 'signatory_user_serial_id', 'in_send_attach', 'external_id', 'attachment_id_master'],
......@@ -63,6 +73,7 @@ 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]);
$migrated++;
}
......@@ -156,3 +167,9 @@ function migrateShippingVersion($args = [])
'data' => [$args['oldResId'], 'true']
]);
}
function migrateFullText($args = [])
{
$GLOBALS['id'] = $args['userId'];
exec("php src/app/convert/scripts/FullTextScript.php --customId {$args['customId']} --resId {$args['newResId']} --collId attachments_coll --userId {$GLOBALS['id']} > /dev/null");
}
......@@ -249,24 +249,24 @@ class MergeController
}
}
//Datetime
$datetime = [
'date' => date('d-m-Y'),
'time' => date('H:i')
];
// Custom fields
//CustomFields
$customFields = [];
if (!empty($args['customFields'])) {
foreach ($args['customFields'] as $key => $customField) {
if (is_array($customField)) {
$customFields[$key] .= implode("\n", $customField);
$customFields[$key] = implode("\n", $customField);
} else {
$customFields[$key] .= $customField;
$customFields[$key] = $customField;
}
}
}
//Datetime
$datetime = [
'date' => date('d-m-Y'),
'time' => date('H:i')
];
$dataToBeMerge['res_letterbox'] = $resource;
$dataToBeMerge['initiator'] = empty($initiator) ? [] : $initiator;
$dataToBeMerge['parentInitiator'] = empty($parentInitiator) ? [] : $parentInitiator;
......@@ -280,8 +280,8 @@ class MergeController
$dataToBeMerge['copies'] = $copies;
$dataToBeMerge['contact'] = [];
$dataToBeMerge['notes'] = $mergedNote;
$dataToBeMerge['datetime'] = $datetime;
$dataToBeMerge['custom'] = $customFields;
$dataToBeMerge['datetime'] = $datetime;
return $dataToBeMerge;
}
......
......@@ -94,21 +94,13 @@ class FullTextScript
if ($args['collId'] == 'letterbox_coll') {
ResModel::update(['set' => ['fulltext_result' => 'SUCCESS'], 'where' => ['res_id = ?'], 'data' => [$args['resId']]]);
} else {
AttachmentModel::update([
'set' => ['fulltext_result' => 'SUCCESS'],
'where' => ['res_id = ?'],
'data' => [$args['resId']]
]);
AttachmentModel::update(['set' => ['fulltext_result' => 'SUCCESS'], 'where' => ['res_id = ?'], 'data' => [$args['resId']]]);
}
} else {
if ($args['collId'] == 'letterbox_coll') {
ResModel::update(['set' => ['fulltext_result' => 'ERROR'], 'where' => ['res_id = ?'], 'data' => [$args['resId']]]);
} else {
AttachmentModel::update([
'set' => ['fulltext_result' => 'ERROR'],
'where' => ['res_id = ?'],
'data' => [$args['resId']]
]);
AttachmentModel::update(['set' => ['fulltext_result' => 'ERROR'], 'where' => ['res_id = ?'], 'data' => [$args['resId']]]);
}
LogsController::add([
'isTech' => true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment