From dddcd76b17edbf798264538ae886116c3a40350a Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Fri, 10 May 2019 14:48:30 +0100 Subject: [PATCH] FEAT #10529 TIME 1 print entity separator style sheet --- .../controllers/ConvertPdfController.php | 1 - .../controllers/EntitySeparatorController.php | 30 ++++++------------- src/core/lang/lang-en.php | 2 +- src/core/lang/lang-fr.php | 2 +- src/core/lang/lang-nl.php | 2 +- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/app/convert/controllers/ConvertPdfController.php b/src/app/convert/controllers/ConvertPdfController.php index 8e594521740..d2660425d9a 100755 --- a/src/app/convert/controllers/ConvertPdfController.php +++ b/src/app/convert/controllers/ConvertPdfController.php @@ -19,7 +19,6 @@ use Attachment\models\AttachmentModel; use Convert\models\AdrModel; use Docserver\controllers\DocserverController; use Docserver\models\DocserverModel; -use Resource\controllers\StoreController; use Resource\models\ResModel; use SrcCore\models\CoreConfigModel; use SrcCore\models\ValidatorModel; diff --git a/src/app/entity/controllers/EntitySeparatorController.php b/src/app/entity/controllers/EntitySeparatorController.php index 70a1794e92a..a094f051048 100755 --- a/src/app/entity/controllers/EntitySeparatorController.php +++ b/src/app/entity/controllers/EntitySeparatorController.php @@ -44,7 +44,7 @@ class EntitySeparatorController $entitiesList = []; if ($bodyData['target'] == 'generic') { - $entitiesList['COURRIER'] = 'Maarch Courrier'; + $entitiesList['GÉNÉRIQUE'] = 'Maarch Courrier'; } else { if (!Validator::arrayType()->notEmpty()->validate($bodyData['entities'])) { return $response->withStatus(403)->withJson(['errors' => 'entities is not set or empty']); @@ -74,14 +74,12 @@ class EntitySeparatorController } foreach ($entitiesList as $entityId => $entityLabel) { $pdf->AddPage(); - $pdf->SetFont('', 'B', 20); - $pdf->Cell(250, 20, _PRINT_SEP_TITLE, 0, 1, 'C'); - $pdf->Cell(250, 20, $entityId, 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); + $pdf->SetFont('', 'B', 25); if ($bodyData['type'] == 'qrcode') { $qrCode = new QrCode($prefix . $entityId); - $pdf->Image('@'.$qrCode->writeString(), 0, 0, 80); + $qrCode->setSize(600); + $pdf->Image('@'.$qrCode->writeString(), 0, 40, 200, '', '', '', '', false, '', 'C'); } else { $barcode = new Barcode(); $bobj = $barcode->getBarcodeObj( @@ -96,25 +94,15 @@ class EntitySeparatorController $pdf->Image('@'.$bobj->getPngData(), 40, 50, 120); } - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, '', 0, 1, 'C'); - $pdf->Cell(180, 10, utf8_decode(_ENTITY), 1, 1, 'C'); + $pdf->SetY($pdf->GetY() + 300); + $pdf->Cell(0, 20, _PRINT_SEP_TITLE, 0, 2, 'C', false); + $pdf->SetY($pdf->GetY() + 60); + $pdf->Cell(0, 30, _ENTITY, 1, 1, 'C'); $pdf->SetFont('', 'B', 12); - $pdf->Cell(180, 10, utf8_decode($entityLabel), 1, 1, 'C'); + $pdf->Cell(0, 30, $entityLabel . ' (' . $entityId . ')', 1, 1, 'C'); } $fileContent = $pdf->Output('', 'S'); - $finfo = new \finfo(FILEINFO_MIME_TYPE); - $mimeType = $finfo->buffer($fileContent); - - $response->write($fileContent); - $response = $response->withAddedHeader('Content-Disposition', "inline; filename=entitySeparator.pdf"); return $response->withJson(base64_encode($fileContent)); } diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php index ab5fdf6ef1b..2b5a00068f2 100755 --- a/src/core/lang/lang-en.php +++ b/src/core/lang/lang-en.php @@ -497,4 +497,4 @@ define("_FILE_NOT_ALLOWED_INFO_2", "with MIME-type"); define("_FILE_NOT_ALLOWED_INFO_3", "is not allowed"); define("_ENTITY", "Entity"); -define("_PRINT_SEP_TITLE", "Scan separator"); +define("_PRINT_SEP_TITLE", "Mail separator"); diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index b37733902af..4cf1233c840 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -496,4 +496,4 @@ define("_FILE_NOT_ALLOWED_INFO_1", "L'extension"); define("_FILE_NOT_ALLOWED_INFO_2", "avec le type MIME"); define("_FILE_NOT_ALLOWED_INFO_3", "n'est pas autorisée"); define("_ENTITY", "Entité"); -define("_PRINT_SEP_TITLE", "Séparateur de scan"); +define("_PRINT_SEP_TITLE", "Séparateur de courrier"); diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php index 247795abf33..5520946a164 100755 --- a/src/core/lang/lang-nl.php +++ b/src/core/lang/lang-nl.php @@ -499,4 +499,4 @@ define("_FILE_NOT_ALLOWED_INFO_2", "with MIME-type_TO_TRANSLATE"); define("_FILE_NOT_ALLOWED_INFO_3", "is not allowed_TO_TRANSLATE"); define("_ENTITY", "Entity_TO_TRANSLATE"); -define("_PRINT_SEP_TITLE", "Scan separator_TO_TRANSLATE"); +define("_PRINT_SEP_TITLE", "Mail separator_TO_TRANSLATE"); -- GitLab