Skip to content
Snippets Groups Projects
Verified Commit 2dd04ad5 authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #12510 TIME 0:30 send to maarch parapheur with new contact

parent 2d0cd483
No related branches found
No related tags found
No related merge requests found
......@@ -59,45 +59,6 @@ abstract class AttachmentModelAbstract
return $attachment[0];
}
public static function getAttachmentToSend(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['ids']);
ValidatorModel::arrayType($aArgs, ['select', 'orderBy', 'ids']);
$aAttachments = DatabaseModel::select([
'select' => empty($aArgs['select']) ? ['max(relation) as relation', 'res_id_master', 'title', 'res_id', 'identifier', 'dest_address_id'] : $aArgs['select'],
'table' => ['res_attachments'],
'where' => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', 'in_send_attach = TRUE'],
'data' => [$aArgs['ids'], ['OBS', 'DEL', 'TMP', 'FRZ'], 'print_folder'],
'groupBy' => ['res_id_master', 'title', 'res_id', 'identifier', 'dest_address_id'],
'order_by' => empty($aArgs['orderBy']) ? [] : $aArgs['orderBy']
]);
return $aAttachments;
}
public static function getListByResIdMaster(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['resId', 'login']);
ValidatorModel::intVal($aArgs, ['resId', 'limit']);
ValidatorModel::stringType($aArgs, ['login']);
ValidatorModel::arrayType($aArgs, ['excludeAttachmentTypes']);
$aAttachments = DatabaseModel::select([
'select' => [
'res_id', 'identifier', 'title', 'creation_date', 'modification_date', 'validation_date as return_date', 'effective_date as real_return_date',
'relation', 'status', 'attachment_type', 'in_signature_book', 'in_send_attach'
],
'table' => ['res_attachments'],
'where' => ['res_id_master = ?', 'res_attachments.status not in (?)', 'attachment_type not in (?)', '((res_attachments.status = ? AND typist = ?) OR res_attachments.status != ?)'],
'data' => [$aArgs['resId'], ['OBS', 'DEL'], $aArgs['excludeAttachmentTypes'], 'TMP', $aArgs['login'], 'TMP'],
'order_by' => empty($aArgs['orderBy']) ? [] : $aArgs['orderBy'],
'limit' => empty($aArgs['limit']) ? null : $aArgs['limit']
]);
return $aAttachments;
}
public static function create(array $args)
{
ValidatorModel::notEmpty($args, ['format', 'typist', 'creation_date', 'docserver_id', 'path', 'filename', 'fingerprint', 'filesize', 'status', 'relation']);
......
......@@ -696,9 +696,7 @@ class ContactController
$contactToDisplay = ContactController::getFormattedContactWithAddress(['contact' => $contactRaw]);
}
$contactToDisplay = $contactToDisplay['contact']['otherInfo'];
$contact = $contactToDisplay;
$contact = $contactToDisplay['contact']['otherInfo'];
} elseif ($resourceContact['type'] == 'user') {
$contact = UserModel::getLabelledUserById(['id' => $resourceContact['item_id']]);
} elseif ($resourceContact['type'] == 'entity') {
......
......@@ -15,6 +15,7 @@
namespace ExternalSignatoryBook\controllers;
use Attachment\models\AttachmentModel;
use Contact\controllers\ContactController;
use Convert\controllers\ConvertPdfController;
use Docserver\models\DocserverModel;
use Entity\models\EntityModel;
......@@ -76,10 +77,11 @@ class MaarchParapheurController
$arrivedMailMainfilePath = $docserverMainInfo['path_template'] . str_replace('#', '/', $adrMainInfo['path']) . $adrMainInfo['filename'];
$mainResource = ResModel::getOnView([
'select' => ['process_limit_date', 'status', 'category_id', 'alt_identifier', 'subject', 'priority', 'contact_firstname', 'contact_lastname', 'contact_society', 'res_id', 'admission_date', 'creation_date', 'doc_date', 'initiator', 'typist', 'type_label', 'destination'],
'select' => ['process_limit_date', 'status', 'category_id', 'alt_identifier', 'subject', 'priority', 'res_id', 'admission_date', 'creation_date', 'doc_date', 'initiator', 'typist', 'type_label', 'destination'],
'where' => ['res_id = ?'],
'data' => [$aArgs['resIdMaster']]
]);
$recipients = ContactController::getFormattedContacts(['resId' => $mainResource[0]['res_id'], 'mode' => 'recipient']);
if (empty($mainResource)) {
return ['error' => 'Mail does not exist'];
......@@ -131,12 +133,6 @@ class MaarchParapheurController
'data' => ['entity_id', $tmpIds],
'orderBy' => ['listinstance_id']
]);
} elseif ($unit['unit'] == 'senderRecipientInformations') {
$data['senderRecipient'] = ResModel::get([
'select' => ['category_id', 'address_id', 'exp_user_id', 'dest_user_id', 'is_multicontacts', 'res_id'],
'where' => ['res_id in (?)'],
'data' => [$tmpIds]
]);
}
}
......@@ -246,8 +242,12 @@ class MaarchParapheurController
if (!empty($senderPrimaryEntity['entity_label'])) {
$metadata[_INITIATOR_ENTITY] = $senderPrimaryEntity['entity_label'];
}
$contact = trim($mainResource[0]['contact_firstname'] . ' ' . $mainResource[0]['contact_lastname'] . ' ' . $mainResource[0]['contact_society']);
if (!empty($contact)) {
if (!empty($recipients)) {
if (count($recipients) > 1) {
$contact = count($recipients) . ' ' . _RECIPIENTS;
} else {
$contact = $contact[0];
}
$metadata[_RECIPIENTS] = $contact;
}
......@@ -281,8 +281,12 @@ class MaarchParapheurController
if (!empty($senderPrimaryEntity['entity_label'])) {
$metadata[_INITIATOR_ENTITY] = $senderPrimaryEntity['entity_label'];
}
$contact = trim($mainResource[0]['contact_firstname'] . ' ' . $mainResource[0]['contact_lastname'] . ' ' . $mainResource[0]['contact_society']);
if (!empty($contact)) {
if (!empty($recipients)) {
if (count($recipients) > 1) {
$contact = count($recipients) . ' ' . _RECIPIENTS;
} else {
$contact = $contact[0];
}
$metadata[_RECIPIENTS] = $contact;
}
......
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