Skip to content
Snippets Groups Projects
Commit ea5bebb4 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

Merge branch 'fix/24950/21.03' into '21.03'

[24950] ixBus - Ne pas joindre le document principal en annexe lorsqu'il est transmis pour signature

See merge request maarch/MaarchCourrier!1098
parents 5be9ddb7 1c414eb6
No related branches found
No related tags found
No related merge requests found
......@@ -252,6 +252,7 @@ class IxbusController
}
$bodyData['nom'] = $mainResource['subject'];
$fileName = TextFormatModel::formatFilename(['filename' => $mainResource['subject'], 'maxLength' => 250]) . '.pdf';
$createdFile = IxBusController::createFolder(['config' => $aArgs['config'], 'body' => $bodyData]);
if (!empty($createdFile['error'])) {
......@@ -263,13 +264,17 @@ class IxbusController
'config' => $aArgs['config'],
'folderId' => $folderId,
'filePath' => $filePath,
'fileName' => TextFormatModel::formatFilename(['filename' => $mainResource['subject'], 'maxLength' => 250]) . '.pdf',
'fileName' => $fileName,
'fileType' => 'principal'
]);
if (!empty($addedFile['error'])) {
return ['error' => $addedFile['message']];
}
$attachmentsData = array_filter($attachmentsData, function ($attachment) use ($filePath, $fileName) {
return !($attachment['filePath'] === $filePath && $attachment['fileName'] === $fileName);
});
foreach ($attachmentsData as $attachmentData) {
$addedFile = IxBusController::addFileToFolder([
'config' => $aArgs['config'],
......
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