Skip to content
Snippets Groups Projects
Commit 58e1b4fb authored by Nicolas Couture's avatar Nicolas Couture
Browse files

FIX #21963 TIME 11:00 Correction signature courrier départ spontané

(temps noté hors tests complets + création cahier de tests)
Cette livraison contient les points suivants :
- Prise en charge du courrier départ spontané à signer électroniquement selon tous les scenarii (apposition de griffe + certificat, certificat seul, multi-certificat)
- Propagation du titre du projet de réponse lors d'une signature électronique afin que le nom du fichier ne soit pas vide au téléchargement
- Modification du fichier de configuration afin de rendre paramétrable la position du watermark
- Correctifs du JAR de signature afin de remonter une erreur spécifique lorsqu'aucune DLL de signature déclarée en configuration n'est trouvée sur le poste de travail
parent bafc96e3
No related branches found
No related tags found
No related merge requests found
modules/visa/Cadenas.PNG

707 B

File added
No preview for this file type
No preview for this file type
......@@ -31,6 +31,8 @@
<!-- URL du serveur d'horodatage -->
<urlHoro>http://freetsa.org/tsr</urlHoro>
<checkValidSign>false</checkValidSign>
<!-- Valeurs spécifiques à l'image de signature lorsqu'on est pas dans la recherche du bloc -->
<imageSign>
<modeSign>blocsign</modeSign> <!-- blocsign : recherche du bloc de signature, linkcertif : lien avec le certificat, imageonly : incrustation simple de l'image -->
......@@ -50,12 +52,12 @@
<watermark>
<enabled>true</enabled>
<classicMethod>true</classicMethod>
<text>Signé électroniquement par délégation par [user_firstname] [user_lastname] le [date]</text>
<text>Signé électroniquement par délégation par [user_firstname] [user_lastname] le [date_now]</text>
<date_format>d/m/Y à H:i</date_format>
<font_size>10</font_size>
<font_color>#808080</font_color>
<x_text>-1</x_text>
<y_text>30</y_text>
<x_text>40</x_text>
<y_text>770</y_text>
</watermark>
</CONFIG>
......
......@@ -18,6 +18,7 @@ use Attachment\models\AttachmentModel;
use ContentManagement\controllers\MergeController;
use Convert\controllers\ConvertPdfController;
use Convert\models\AdrModel;
use Docserver\controllers\DocserverController;
use Docserver\models\DocserverModel;
use Entity\models\ListInstanceModel;
use Resource\controllers\ResController;
......@@ -147,7 +148,7 @@ class ElectronicSignController
$pjs = array_values($pjs);
if ($infosDoc[0]['category_id'] == 'outgoing' && empty($pjs)) {
if ($infosDoc['category_id'] == 'outgoing' && empty($pjs)) {
$pjs = [
(object)[
'res_id' => "master_".$aArgs['resIdMaster'],
......@@ -565,14 +566,58 @@ class ElectronicSignController
}
if (strpos($queryParams['objectId'], "master_") !== false) {
$adrInfo = ConvertPdfController::getConvertedPdfById([
'resId' => str_replace("master_", "", $queryParams['objectId']),
'collId' => 'letterbox_coll'
$resId = str_replace("master_", "", $queryParams['objectId']);
$tmpObjectId = $resId;
$document = ResModel::getById([
'select' => ['docserver_id', 'path', 'filename', 'subject', 'status', 'fingerprint', 'format', 'version'],
'resId' => $resId
]);
$signedDocument = AdrModel::getDocuments([
'select' => ['docserver_id', 'path', 'filename'],
'where' => ['res_id = ?', 'type = ?', 'version = ?'],
'data' => [$resId, 'SIGN', $document['version']],
'limit' => 1
]);
$tmpObjectId = str_replace("master_", "", $queryParams['objectId']);
if ($signedDocument[0]){
$adrInfo = [
'docserver_id' => $signedDocument[0]['docserver_id'],
'path' => $signedDocument[0]['path'],
'filename' => $signedDocument[0]['filename']
];
$document['attachment_type'] = 'certified_response';
$addImgSign = false;
$addWatermark = false;
$brutDocument = true;
} else {
if (in_array($document['format'], MergeController::OFFICE_EXTENSIONS)) {
$result = MergeController::mergeAction(['resId' => $resId, 'type' => 'resource', 'userId' => $splitFileJNLP[0]]);
if (!empty($result['errors'])) {
return $response->withStatus(400)->withJson(['errors' => $result['errors']]);
}
$adrInfo = AdrModel::getDocuments([
'select' => ['docserver_id', 'path', 'filename', 'type', 'fingerprint'],
'where' => ['res_id = ?', 'type = ?'],
'data' => [$resId, 'TMP']
]);
$adrInfo = $adrInfo[0];
AdrModel::deleteDocumentAdr(['where' => ['res_id = ?', 'type = ?'], 'data' => [$resId, 'TMP']]);
} else {
$adrInfo = ConvertPdfController::getConvertedPdfById([
'resId' => $resId,
'collId' => 'letterbox_coll'
]);
}
}
$queryParams['objectType'] = "outgoing_mail";
$queryParams['objectTable'] = "res_letterbox";
$queryParams['objectId'] = str_replace("master_", "", $queryParams['objectId']);
$queryParams['objectId'] = $resId;
} else {
$document = AttachmentModel::getById([
'select' => ['docserver_id', 'path', 'filename', 'title', 'status', 'fingerprint', 'attachment_type', 'format'],
......@@ -774,10 +819,34 @@ class ElectronicSignController
/* AJOUT DE LA PJ */
$originId = null;
$title = "";
if (strpos($queryParams['objectId'], "master_") !== false) {
$resIdMaster = str_replace("master_", "", $queryParams['objectId']);
}
else{
/* AJOUT DE LA PIECE DANS ADR_LETTERBOX */
$storeResult = DocserverController::storeResourceOnDocServer([
'collId' => 'letterbox_coll',
'docserverTypeId' => 'DOC',
'encodedResource' => base64_encode($fileContent),
'format' => 'pdf'
]);
if (!empty($storeResult['errors'])) {
return ['errors' => "[storeResourceOnDocServer] {$storeResult['errors']}"];
}
$resource = ResModel::getById(['resId' => $resIdMaster, 'select' => ['version']]);
AdrModel::deleteDocumentAdr(['where' => ['res_id = ?', 'type = ?', 'version = ?'], 'data' => [$resIdMaster, 'SIGN', $resource['version']]]);
AdrModel::createDocumentAdr([
'resId' => $resIdMaster,
'type' => 'SIGN',
'docserverId' => $storeResult['docserver_id'],
'path' => $storeResult['directory'],
'filename' => $storeResult['file_destination_name'],
'version' => $resource['version'],
'fingerprint' => $storeResult['fingerPrint']
]);
AdrModel::deleteDocumentAdr(['where' => ['res_id = ?', 'type = ?', 'version = ?'], 'data' => [$resIdMaster, 'TNL', $resource['version']]]);
} else {
fwrite($fileForceLog, "resId = ".$queryParams['objectId']."\n");
$curPJ = AttachmentModel::getById([
'select' => ['res_id_master', 'attachment_type', 'origin_id', 'origin', 'title'],
......@@ -794,6 +863,8 @@ class ElectronicSignController
}
$resIdMaster = $curPJ['res_id_master'];
$title = $curPJ['title'];
if (!empty($curPJ['origin'])) {
$tmpOrigin = explode(",", $curPJ['origin']);
$originId = $tmpOrigin[0];
......@@ -814,23 +885,25 @@ class ElectronicSignController
}
//AttachmentModel::update(['set' => ['status' => 'CERTIF'], 'where' => ['res_id = ?'], 'data' => [$resIdMaster]]);
$infosPj = [
'title' => $title,
'originId' => $originId,
'encodedFile' => base64_encode($fileContent),
'format' => $extension,
'resIdMaster' => $resIdMaster,
'status' => 'TRA',
'inSignatureBook' => 'true',
'typist' => $queryParams['userMaarch'],
'signatory_user_serial_id' => $queryParams['userMaarch'],
'type' => 'certified_response'
];
fwrite($fileForceLog, "INFOS PJ ");
fwrite($fileForceLog, print_r($infosPj,true));
$id = StoreController::storeAttachment($infosPj);
}
$infosPj = [
'originId' => $originId,
'encodedFile' => base64_encode($fileContent),
'format' => $extension,
'resIdMaster' => $resIdMaster,
'status' => 'TRA',
'inSignatureBook' => 'true',
'typist' => $queryParams['userMaarch'],
'signatory_user_serial_id' => $queryParams['userMaarch'],
'type' => 'certified_response'
];
fwrite($fileForceLog, "INFOS PJ ");
fwrite($fileForceLog, print_r($infosPj,true));
$id = StoreController::storeAttachment($infosPj);
ElectronicSignController::markCertifiedListinstance($resIdMaster);
/* ************** */
......@@ -1055,11 +1128,9 @@ class ElectronicSignController
$font = count($rawFont) == 2 ? $rawFont : $font;
}
$position = [40,770,0,0.8]; //X Y Angle Opacity
if (!empty($watermark['position'])) {
$rawPosition = explode(',', $watermark['position']);
$position = count($rawPosition) == 4 ? $rawPosition : $position;
}
$watermark_x = (int)$watermark['x_text'] ?? 40;
$watermark_y = (int)$watermark['y_text'] ?? 770;
$position = [$watermark_x,$watermark_y,0,0.8]; //X Y Angle Opacity
$libDir = CoreConfigModel::getLibrariesDirectory();
if (!empty($libDir) && is_file($libDir . 'SetaPDF-FormFiller-Full/library/SetaPDF/Autoload.php')) {
......@@ -1119,22 +1190,23 @@ class ElectronicSignController
return ['errors' => ['No available circuit']];
}
$set = ['signatory' => "true"];
if (strpos($listInstance[0]['process_comment'], _HAS_ELECTRONIC_SIGN) === false) {
$processComment = (empty($listInstance[0]['process_comment']))
? _HAS_ELECTRONIC_SIGN : _HAS_ELECTRONIC_SIGN . " - " . $listInstance[0]['process_comment'];
$set = ['process_comment' => $processComment, 'signatory' => "true"];
$set['process_comment'] = $processComment;
if ($listInstance[0]['item_id'] != $GLOBALS['id']) {
$set['delegate'] = $GLOBALS['id'];
}
ListInstanceModel::update([
'set' => $set,
'where' => ['listinstance_id = ?'],
'data' => [$listInstance[0]['listinstance_id']]
]);
}
ListInstanceModel::update([
'set' => $set,
'where' => ['listinstance_id = ?'],
'data' => [$listInstance[0]['listinstance_id']]
]);
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment