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

FEAT #12510 TIME 1:30 Recipient fusion

parent 8e0668ed
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,31 @@ const DATA_TO_REPLACE = [ ...@@ -114,6 +114,31 @@ const DATA_TO_REPLACE = [
'user.parent_entity_id' => '[userPrimaryEntity.parent_entity_id]', 'user.parent_entity_id' => '[userPrimaryEntity.parent_entity_id]',
'user.entity_type' => '[userPrimaryEntity.entity_type]', 'user.entity_type' => '[userPrimaryEntity.entity_type]',
'user.entity_path' => '[userPrimaryEntity.path]', 'user.entity_path' => '[userPrimaryEntity.path]',
'contact.contact_type_label' => '',
'contact.society_short' => '',
'contact.contact_purpose_label' => '',
'contact.website' => '',
'contact.salutation_header' => '',
'contact.salutation_footer' => '',
'contact.society' => '[recipient.company]',
'contact.departement' => '[recipient.department]',
'contact.title' => '[recipient.civility]',
'contact.contact_lastname' => '[recipient.lastname]',
'contact.contact_firstname' => '[recipient.firstname]',
'contact.lastname' => '[recipient.lastname]',
'contact.firstname' => '[recipient.firstname]',
'contact.function' => '[recipient.function]',
'contact.postal_address' => '[recipient.postal_address]',
'contact.address_num' => '[recipient.address_number]',
'contact.address_street' => '[recipient.address_street]',
'contact.occupancy' => '[recipient.address_additional1]',
'contact.address_complement' => '[recipient.address_additional2]',
'contact.address_town' => '[recipient.address_town]',
'contact.address_postal_code' => '[recipient.address_postcode]',
'contact.address_country' => '[recipient.address_country]',
'contact.phone' => '[recipient.phone]',
'contact.email' => '[recipient.email]',
]; ];
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
namespace ContentManagement\controllers; namespace ContentManagement\controllers;
use Contact\controllers\ContactController;
use Contact\models\ContactModel;
use CustomField\models\ResourceCustomFieldModel; use CustomField\models\ResourceCustomFieldModel;
use Doctype\models\DoctypeModel; use Doctype\models\DoctypeModel;
use Entity\models\EntityModel; use Entity\models\EntityModel;
...@@ -170,6 +172,28 @@ class MergeController ...@@ -170,6 +172,28 @@ class MergeController
$currentUserPrimaryEntity['path'] = EntityModel::getEntityPathByEntityId(['entityId' => $currentUserPrimaryEntity['entity_id'], 'path' => '']); $currentUserPrimaryEntity['path'] = EntityModel::getEntityPathByEntityId(['entityId' => $currentUserPrimaryEntity['entity_id'], 'path' => '']);
} }
//Recipient
$recipient = [];
if (!empty($args['recipientId']) && !empty($args['recipientType'])) {
if ($args['recipientType'] == 'contact') {
$recipient = ContactModel::getById([
'id' => $args['recipientId'],
'select' => [
'civility', 'firstname', 'lastname', 'company', 'department', 'function', 'address_number', 'address_street', 'address_town',
'address_additional1', 'address_additional2', 'address_postcode', 'address_town', 'address_country', 'phone', 'email'
]
]);
$recipient['civility'] = ContactModel::getCivilityLabel(['civilityId' => $recipient['civility']]);
$postalAddress = ContactController::getContactAfnor($recipient);
unset($postalAddress[0]);
$recipient['postal_address'] = implode("\n", $postalAddress);
} elseif ($args['recipientType'] == 'user') {
$recipient = UserModel::getById(['id' => $args['recipientId'], 'select' => ['firstname', 'lastname']]);
} elseif ($args['recipientType'] == 'entity') {
$recipient = EntityModel::getById(['id' => $args['recipientId'], 'select' => ['entity_label as lastname']]);
}
}
//Visas //Visas
$visas = ''; $visas = '';
if (!empty($args['resId'])) { if (!empty($args['resId'])) {
...@@ -277,6 +301,7 @@ class MergeController ...@@ -277,6 +301,7 @@ class MergeController
$dataToBeMerge['parentDestination'] = empty($parentDestination) ? [] : $parentDestination; $dataToBeMerge['parentDestination'] = empty($parentDestination) ? [] : $parentDestination;
$dataToBeMerge['attachment'] = $attachment; $dataToBeMerge['attachment'] = $attachment;
$dataToBeMerge['user'] = $currentUser; $dataToBeMerge['user'] = $currentUser;
$dataToBeMerge['recipient'] = $recipient;
$dataToBeMerge['userPrimaryEntity'] = $currentUserPrimaryEntity; $dataToBeMerge['userPrimaryEntity'] = $currentUserPrimaryEntity;
$dataToBeMerge['visas'] = $visas; $dataToBeMerge['visas'] = $visas;
$dataToBeMerge['opinions'] = $opinions; $dataToBeMerge['opinions'] = $opinions;
......
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