Fonctionnalité #15975
Review - afficher l'objet dans le courrier envoyé au iparapheur
Start date:
01/19/2021
Due date:
04/06/2021
Tags Courrier:
20.10.10, 21.03.2
ROADMAP:
Description
En tant qu'utilisateur, j'envoie un document dans le iparapheur.
Lorsque je le consulte dans le iparapheur, je vois comme objet du courrier "Projet courrier numéro 91491_12413_315213"
Cela n'est pas parlant pour les utilisateurs.
Il faudrait afficher l'objet du courrier dans le iparapheur.
Pour ce faire, j'ai ajusté le code du fichier :
/var/www/html/maarch_courrier/src/app/external/externalSignatoryBook/controllers/IParapheurController.php
en modifiant ça:
public static function upload($aArgs) { $sousType = $aArgs['sousType']; // Retrieve the annexes of the attachment to sign (other attachments and the original document) $annexes = []; $annexes['letterbox'] = ResModel::get([ 'select' => ['res_id', 'path', 'filename', 'docserver_id', 'format', 'category_id', 'external_id', 'integrations'], 'where' => ['res_id = ?'], 'data' => [$aArgs['resIdMaster']] ]); if (!empty($annexes['letterbox'][0]['docserver_id'])) { $adrMainInfo = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resIdMaster'], 'collId' => 'letterbox_coll']); $letterboxPath = DocserverModel::getByDocserverId(['docserverId' => $adrMainInfo['docserver_id'], 'select' => ['path_template']]); $annexes['letterbox'][0]['filePath'] = $letterboxPath['path_template'] . str_replace('#', '/', $adrMainInfo['path']) . $adrMainInfo['filename']; } $attachments = AttachmentModel::get([ 'select' => ['res_id', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'], 'where' => ['res_id_master = ?', 'attachment_type not in (?)', "status NOT IN ('DEL','OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"], 'data' => [$aArgs['resIdMaster'], ['signed_response']] ]); $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML(); foreach ($attachments as $key => $value) { if (!$attachmentTypes[$value['attachment_type']]['sign']) { $adrInfo = AdrModel::getConvertedDocumentById(['resId' => $value['res_id'], 'collId' => 'attachments_coll', 'type' => 'PDF']); $annexeAttachmentPath = DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id'], 'select' => ['path_template']]); $value['filePath'] = $annexeAttachmentPath['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $adrInfo['path']) . $adrInfo['filename']; unset($attachments[$key]); $annexes['attachments'][] = $value; } } // END annexes $attachmentToFreeze = []; foreach ($attachments as $attachment) { $resId = $attachment['res_id']; $collId = 'attachments_coll'; $dossierId = $resId . '_' . rand(0001, 9999); $response = IParapheurController::uploadFile([ 'resId' => $resId, 'collId' => $collId, 'resIdMaster' => $aArgs['resIdMaster'], 'annexes' => $annexes, 'sousType' => $sousType, 'config' => $aArgs['config'], 'dossierId' => $dossierId ]); if (!empty($response['error'])) { return $response; } else { $attachmentToFreeze[$collId][$resId] = $dossierId; } } // Send main document if in signature book if (!empty($annexes['letterbox'][0])) { $mainDocumentIntegration = json_decode($annexes['letterbox'][0]['integrations'], true); $externalId = json_decode($annexes['letterbox'][0]['external_id'], true); if ($mainDocumentIntegration['inSignatureBook'] && empty($externalId['signatureBookId'])) { $resId = $annexes['letterbox'][0]['res_id']; $collId = 'letterbox_coll'; $dossierId = $resId . '_' . rand(0001, 9999); unset($annexes['letterbox']); $response = IParapheurController::uploadFile([ 'resId' => $resId, 'collId' => $collId, 'resIdMaster' => $aArgs['resIdMaster'], 'annexes' => $annexes, 'sousType' => $sousType, 'config' => $aArgs['config'], 'dossierId' => $dossierId ]); if (!empty($response['error'])) { return $response; } else { $attachmentToFreeze[$collId][$resId] = $dossierId; } } } return ['sended' => $attachmentToFreeze]; } public static function uploadFile($aArgs) { $dossierId = $aArgs['dossierId']; $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resId'], 'collId' => $aArgs['collId']]); if (empty($adrInfo['docserver_id']) || strtolower(pathinfo($adrInfo['filename'], PATHINFO_EXTENSION)) != 'pdf') { return ['error' => 'Document ' . $aArgs['resIdMaster'] . ' is not converted in pdf']; } $attachmentPath = DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id'], 'select' => ['path_template']]); $attachmentFilePath = $attachmentPath['path_template'] . str_replace('#', '/', $adrInfo['path']) . $adrInfo['filename']; $dossierTitre = 'Projet courrier numéro ' . $aArgs['resId']; $mainResource = ResModel::getById(['resId' => $aArgs['resIdMaster'], 'select' => ['process_limit_date']]); if (empty($mainResource['process_limit_date'])) { $processLimitDate = $mainResource['process_limit_date'] = date('Y-m-d', strtotime(date("Y-m-d"). ' + 14 days')); } else { $processLimitDateTmp = explode(" ", $mainResource['process_limit_date']); $processLimitDate = $processLimitDateTmp[0]; }
par
public static function upload($aArgs) { $sousType = $aArgs['sousType']; // Retrieve the annexes of the attachment to sign (other attachments and the original document) $annexes = []; $annexes['letterbox'] = ResModel::get([ 'select' => ['res_id', 'path', 'filename', 'docserver_id', 'format', 'category_id', 'external_id', 'integrations'], 'where' => ['res_id = ?'], 'data' => [$aArgs['resIdMaster']] ]); if (!empty($annexes['letterbox'][0]['docserver_id'])) { $adrMainInfo = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resIdMaster'], 'collId' => 'letterbox_coll']); $letterboxPath = DocserverModel::getByDocserverId(['docserverId' => $adrMainInfo['docserver_id'], 'select' => ['path_template']]); $annexes['letterbox'][0]['filePath'] = $letterboxPath['path_template'] . str_replace('#', '/', $adrMainInfo['path']) . $adrMainInfo['filename']; } $attachments = AttachmentModel::get([ 'select' => ['res_id', 'docserver_id', 'path', 'filename', 'format', 'attachment_type','title'], 'where' => ['res_id_master = ?', 'attachment_type not in (?)', "status NOT IN ('DEL','OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"], 'data' => [$aArgs['resIdMaster'], ['signed_response']] ]); $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML(); foreach ($attachments as $key => $value) { if (!$attachmentTypes[$value['attachment_type']]['sign']) { $adrInfo = AdrModel::getConvertedDocumentById(['resId' => $value['res_id'], 'collId' => 'attachments_coll', 'type' => 'PDF']); $annexeAttachmentPath = DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id'], 'select' => ['path_template']]); $value['filePath'] = $annexeAttachmentPath['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $adrInfo['path']) . $adrInfo['filename']; unset($attachments[$key]); $annexes['attachments'][] = $value; } } // END annexes $attachmentToFreeze = []; foreach ($attachments as $attachment) { $resId = $attachment['res_id']; $title = $attachment['title']; $collId = 'attachments_coll'; $dossierId = $resId . '_' . rand(0001, 9999); $response = IParapheurController::uploadFile([ 'resId' => $resId, 'collId' => $collId, 'resIdMaster' => $aArgs['resIdMaster'], 'annexes' => $annexes, 'sousType' => $sousType, 'config' => $aArgs['config'], 'dossierId' => $dossierId, 'title' => $title ]); if (!empty($response['error'])) { return $response; } else { $attachmentToFreeze[$collId][$resId] = $dossierId; } } // Send main document if in signature book if (!empty($annexes['letterbox'][0])) { $mainDocumentIntegration = json_decode($annexes['letterbox'][0]['integrations'], true); $externalId = json_decode($annexes['letterbox'][0]['external_id'], true); if ($mainDocumentIntegration['inSignatureBook'] && empty($externalId['signatureBookId'])) { $resId = $annexes['letterbox'][0]['res_id']; $collId = 'letterbox_coll'; $dossierId = $resId . '_' . rand(0001, 9999); unset($annexes['letterbox']); $response = IParapheurController::uploadFile([ 'resId' => $resId, 'collId' => $collId, 'resIdMaster' => $aArgs['resIdMaster'], 'annexes' => $annexes, 'sousType' => $sousType, 'config' => $aArgs['config'], 'dossierId' => $dossierId ]); if (!empty($response['error'])) { return $response; } else { $attachmentToFreeze[$collId][$resId] = $dossierId; } } } return ['sended' => $attachmentToFreeze]; } public static function uploadFile($aArgs) { $dossierId = $aArgs['dossierId']; $adrInfo = ConvertPdfController::getConvertedPdfById(['resId' => $aArgs['resId'], 'collId' => $aArgs['collId']]); if (empty($adrInfo['docserver_id']) || strtolower(pathinfo($adrInfo['filename'], PATHINFO_EXTENSION)) != 'pdf') { return ['error' => 'Document ' . $aArgs['resIdMaster'] . ' is not converted in pdf']; } $attachmentPath = DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id'], 'select' => ['path_template']]); $attachmentFilePath = $attachmentPath['path_template'] . str_replace('#', '/', $adrInfo['path']) . $adrInfo['filename']; $dossierTitre = 'Courrier : '. $aArgs['title'] .' Référence : '. $aArgs['resId']; $mainResource = ResModel::getById(['resId' => $aArgs['resIdMaster'], 'select' => ['process_limit_date']]); if (empty($mainResource['process_limit_date'])) { $processLimitDate = $mainResource['process_limit_date'] = date('Y-m-d', strtotime(date("Y-m-d"). ' + 14 days')); } else { $processLimitDateTmp = explode(" ", $mainResource['process_limit_date']); $processLimitDate = $processLimitDateTmp[0]; }
La partie la plus intéressante est celle ci:
$attachmentPath = DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id'], 'select' => ['path_template']]); $attachmentFilePath = $attachmentPath['path_template'] . str_replace('#', '/', $adrInfo['path']) . $adrInfo['filename']; $dossierTitre = 'Courrier : '. $aArgs['title'] .' Référence : '. $aArgs['resId'];
Maintenant on obtient:
Related issues
History
#2 Updated by Henri QUENEAU over 1 year ago
en 20.03
#3 Updated by Support Maarch over 1 year ago
- Status changed from A qualifier to A traiter
#4 Updated by Emmanuel DILLARD over 1 year ago
- Related to Fonctionnalité #14582: Action / iParapheur : Ajout de métadonnées envoyées à Iparapheur added
#5 Updated by Emmanuel DILLARD over 1 year ago
- Subject changed from afficher l'objet dans le courrier envoyé au iparapheur to Review - afficher l'objet dans le courrier envoyé au iparapheur
- Status changed from A traiter to A étudier
#6 Updated by Emmanuel DILLARD over 1 year ago
- Target version changed from Inscription Backlog Courrier to 20.03 (Support restreint)
#7 Updated by Henri QUENEAU over 1 year ago
- Priority changed from 2-Sérieux to 1-Majeur
je le passe en majeur car pour pas que ça soit génant quand on fera le passage en prod pour le support
#8 Updated by Henri QUENEAU over 1 year ago
j'ajoute le diff pour faciliter la vue :
#9 Updated by Emmanuel DILLARD over 1 year ago
- Status changed from A étudier to Complément d'Informations
- Assignee changed from EDI PO to Henri QUENEAU
#11 Updated by Emmanuel DILLARD about 1 year ago
- Status changed from Complément d'Informations to 17
#12 Updated by Henri QUENEAU about 1 year ago
- Status changed from 17 to A traiter
- Assignee changed from Henri QUENEAU to EDI PO
#14 Updated by Emmanuel DILLARD about 1 year ago
- Status changed from A traiter to A étudier
#15 Updated by Emmanuel DILLARD about 1 year ago
- Due date set to 03/15/2021
- Status changed from A étudier to Etude planifiée
#16 Updated by Emmanuel DILLARD about 1 year ago
- Due date deleted (
03/15/2021) - Status changed from Etude planifiée to Prêt à développer
- Target version changed from 20.03 (Support restreint) to Courrier 21.03 (stable)
- Tags Courrier 20.10.8 added
#17 Updated by Emmanuel DILLARD about 1 year ago
- Target version changed from Courrier 21.03 (stable) to Courrier Develop
#18 Updated by Emmanuel DILLARD about 1 year ago
- Project changed from Backlog to CURRENT SPRINT
- Status changed from Prêt à développer to En cours de dev (S)
- Tags Courrier 20.10.10, 21.03.2 added
- Tags Courrier deleted (
20.10.8)
#19 Updated by Florian AZIZIAN about 1 year ago
- Assignee deleted (
EDI PO)
#20 Updated by Emmanuel DILLARD about 1 year ago
- Due date set to 04/06/2021
#21 Updated by Florian AZIZIAN about 1 year ago
- Assignee set to Florian AZIZIAN
#22 Updated by Florian AZIZIAN about 1 year ago
- Status changed from En cours de dev (S) to Développé / Analysé (S)
#23 Updated by Emmanuel DILLARD about 1 year ago
- Project changed from CURRENT SPRINT to Backlog
#24 Updated by Emmanuel DILLARD 11 months ago
- Project changed from Backlog to Backlog Courrier
- Target version changed from Courrier Develop to Develop