From 4051264f78c1ebd6b8c1c86be49e4748d5f76d54 Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Sat, 2 Apr 2022 01:54:21 +0200 Subject: [PATCH] Filename with count signature --- app.php | 1 + public/js/signature.js | 2 +- templates/signature.html.php | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.php b/app.php index 1a0dd5d..2180074 100644 --- a/app.php +++ b/app.php @@ -210,6 +210,7 @@ $f3->route('GET /signature/@hash/pdf', if (!$layers) { Web::instance()->send($originalFile, null, 0, TRUE, $filename); } + $filename = str_replace('.pdf', '_signe-'.count($layers).'x.pdf', $filename); copy($originalFile, $finalFile); $bufferFile = str_replace('.pdf', '_tmp.pdf', $originalFile); foreach($layers as $layerFile) { diff --git a/public/js/signature.js b/public/js/signature.js index 936e24d..aa48cd9 100644 --- a/public/js/signature.js +++ b/public/js/signature.js @@ -1040,7 +1040,7 @@ var pageSignature = async function(url) { } pdfBlob = await response.blob(); if(response.headers.get('Content-Disposition').match(/attachment; filename="/)) { - filename = response.headers.get('Content-Disposition').replace(/^[^"]*"/, "").replace(/"[^"]*$/, ""); + filename = response.headers.get('Content-Disposition').replace(/^[^"]*"/, "").replace(/"[^"]*$/, "").replace(/_signe-[0-9]+\x.pdf/, '.pdf'); } } else { pdfBlob = await getPDFBlobFromCache(url); diff --git a/templates/signature.html.php b/templates/signature.html.php index 3e3d254..9efd735 100644 --- a/templates/signature.html.php +++ b/templates/signature.html.php @@ -44,7 +44,7 @@
-

Lettre de demande de renouvellement aux SCOP_signe.pdf

+

@@ -231,6 +231,6 @@ hash = ""; - +