Fonctionnalité #15975
Review - afficher l'objet dans le courrier envoyé au iparapheur
Début:
19/01/2021
Echéance:
06/04/2021
Version applicable MC:
Tags Courrier:
20.10.10, 21.03.2
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:
Demandes liées
Historique
#2 Mis à jour par Henri QUENEAU il y a plus de 3 ans
en 20.03
#3 Mis à jour par Support Maarch il y a plus de 3 ans
- Statut changé de A qualifier à A traiter
#4 Mis à jour par Emmanuel DILLARD il y a plus de 3 ans
- Lié à Fonctionnalité #14582: Action / iParapheur : Ajout de métadonnées envoyées à Iparapheur ajouté
#5 Mis à jour par Emmanuel DILLARD il y a plus de 3 ans
- Sujet changé de afficher l'objet dans le courrier envoyé au iparapheur à Review - afficher l'objet dans le courrier envoyé au iparapheur
- Statut changé de A traiter à R&D - A étudier
#6 Mis à jour par Emmanuel DILLARD il y a plus de 3 ans
- Version cible changé de Inscription Backlog Courrier à 20.03 (Fin de vie)
#7 Mis à jour par Henri QUENEAU il y a environ 3 ans
- Priorité changé de 2-Sérieux à 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 Mis à jour par Henri QUENEAU il y a environ 3 ans
j'ajoute le diff pour faciliter la vue :
#9 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Statut changé de R&D - A étudier à Complément d'Informations
- Assigné à changé de EDI PO à Henri QUENEAU
#11 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Statut changé de Complément d'Informations à 17
#12 Mis à jour par Henri QUENEAU il y a environ 3 ans
- Statut changé de 17 à A traiter
- Assigné à changé de Henri QUENEAU à EDI PO
#14 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Statut changé de A traiter à R&D - A étudier
#15 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Echéance mis à 15/03/2021
- Statut changé de R&D - A étudier à Etude planifiée
#16 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Echéance
15/03/2021supprimé - Statut changé de Etude planifiée à R&D - A planifier
- Version cible changé de 20.03 (Fin de vie) à Courrier 21.03 (stable)
- Tags Courrier 20.10.8 ajouté
#17 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Version cible changé de Courrier 21.03 (stable) à Courrier Develop
#18 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Projet changé de Backlog à CURRENT SPRINT
- Statut changé de R&D - A planifier à R&D - En cours
- Tags Courrier 20.10.10, 21.03.2 ajouté
- Tags Courrier
20.10.8supprimé
#19 Mis à jour par Florian AZIZIAN il y a environ 3 ans
- Assigné à
EDI POsupprimé
#20 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Echéance mis à 06/04/2021
#21 Mis à jour par Florian AZIZIAN il y a environ 3 ans
- Assigné à mis à Florian AZIZIAN
#22 Mis à jour par Florian AZIZIAN il y a environ 3 ans
- Statut changé de R&D - En cours à R&D - Terminé
#23 Mis à jour par Emmanuel DILLARD il y a environ 3 ans
- Projet changé de CURRENT SPRINT à Backlog
#24 Mis à jour par Emmanuel DILLARD il y a presque 3 ans
- Projet changé de Backlog à Backlog Courrier
- Version cible changé de Courrier Develop à Develop
#25 Mis à jour par Emmanuel DILLARD il y a environ un an
- Version cible changé de Develop à 2301
MAJ version cible Develop->2301