From a7fe6a811fb574fe4b29491bef01e0bdfdaa0f08 Mon Sep 17 00:00:00 2001 From: tofulm Date: Mon, 13 Nov 2023 14:09:17 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20-=20la=20fonction=20charger=5Fpdf()=20a?= =?UTF-8?q?ccepte=20maintenant=20un=203e=20args,=20les=20opts=20-=20on=20a?= =?UTF-8?q?joute=20dans=20l'array=20des=20pieces=20jointes=20des=20infos?= =?UTF-8?q?=20(qui=20(d'o=C3=B9=20vient=20=20=20se=20pi=C3=A8ce=20jointe)?= =?UTF-8?q?=20et=20quoi=20(son=20id))=20-=20on=20deplace=20l'affichage=20d?= =?UTF-8?q?es=20tPDFS=20dans=20un=20inclure=20:=20=20=20gamumail/inc-pdf?= =?UTF-8?q?=5Fenvoyes.html=20qui=20permet=20d'etre=20facilement=20surcharg?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- formulaires/gamumail.html | 58 ++++++++++++----------------------- formulaires/gamumail.php | 38 ++++++++++++++--------- gamumail/inc-pdf_envoyes.html | 26 ++++++++++++++++ inc/charger_pdf.php | 2 +- 4 files changed, 70 insertions(+), 54 deletions(-) create mode 100644 gamumail/inc-pdf_envoyes.html diff --git a/formulaires/gamumail.html b/formulaires/gamumail.html index 245f24a..1e0845a 100644 --- a/formulaires/gamumail.html +++ b/formulaires/gamumail.html @@ -116,49 +116,29 @@ [(#CHEMIN{gamumail/#GET{fichier}.html}|oui) ] - #SET{name,Tpdfs_ok} - -

<:gamumail:pdf_envoyes:>

-
- #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} - #SET{obli,"obligatoire"} -
- -
- - [(#SET{url_pdf, #URL_PAGE{spipdf} - |parametre_url{spipdf, #VALEUR|table_valeur{fichier}} - |parametre_url{lang, #GET{lang_dest}} - })] - - [(#SET{url_pdf,[(#GET{url_pdf}|parametre_url{#CLE,#VALEUR})]})] - - -
- -
-
-
+ #SET{name,docs_spip} -

<:gamumail:documents_attaches:>

-
- #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} -
+
+

<:gamumail:documents_attaches:>

+
+ #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} +
- [(#GET{erreurs})] - - -
- -
- + [(#GET{erreurs})] + +
-
+ +
+ +
+
+
#SET{fichier,all_fichiers} diff --git a/formulaires/gamumail.php b/formulaires/gamumail.php index 7ca8aff..353a77d 100644 --- a/formulaires/gamumail.php +++ b/formulaires/gamumail.php @@ -351,7 +351,9 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re 'chemin' => $destination, 'nom' => $nom_fichier, 'encodage' => 'base64', - 'mime' => $type_mime + 'mime' => $type_mime, + 'quoi' => 'docs_spip', + 'qui' => $id_document ]; } } @@ -372,7 +374,9 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re 'chemin' => $destination, 'nom' => $nom_fichier, 'encodage' => 'base64', - 'mime' => $type_mime + 'mime' => $type_mime, + 'quoi' => 'docs_spip', + 'qui' => $id_doc ]; } } @@ -384,7 +388,9 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re 'chemin' => $fichier['tmp_name'], 'nom' => $fichier['name'], 'encodage' => 'base64', - 'mime' => $fichier['type'] + 'mime' => $fichier['type'], + 'quoi' => 'televerser', + 'qui' => $fichier['name'] ]; } } @@ -420,17 +426,21 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re ], 'data' => $c ]); - $pdf = $recup_pdf($fichier, $c); - $nom_fichier = $nom.'.pdf'; - $destination = _DIR_TMP.basename($nom_fichier); - $Tpdf_del[] = $destination; - file_put_contents($destination,$pdf); - $pieces_jointes[] = [ - 'chemin' => $destination, - 'nom' => $nom_fichier, - 'encodage' => 'base64', - 'mime' => 'application/pdf' - ]; + $pdf = $recup_pdf($fichier, $c, $args); + if (!empty($pdf)) { + $nom_fichier = $nom.'.pdf'; + $destination = _DIR_TMP.basename($nom_fichier); + $Tpdf_del[] = $destination; + file_put_contents($destination,$pdf); + $pieces_jointes[] = [ + 'chemin' => $destination, + 'nom' => $nom_fichier, + 'encodage' => 'base64', + 'mime' => 'application/pdf', + 'quoi' => 'pdf_genere', + 'qui' => $fichier + ]; + } } } diff --git a/gamumail/inc-pdf_envoyes.html b/gamumail/inc-pdf_envoyes.html new file mode 100644 index 0000000..cc278ca --- /dev/null +++ b/gamumail/inc-pdf_envoyes.html @@ -0,0 +1,26 @@ +#SET{name,Tpdfs_ok} +
+ +

<:gamumail:pdf_envoyes:>

+
+ #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} + #SET{obli,"obligatoire"} +
+ +
+ + [(#SET{url_pdf, #URL_PAGE{spipdf} + |parametre_url{spipdf, #VALEUR|table_valeur{fichier}} + |parametre_url{lang, #GET{lang_dest}} + })] + + [(#SET{url_pdf,[(#GET{url_pdf}|parametre_url{#CLE,#VALEUR})]})] + + +
+ +
+
+
+
+ diff --git a/inc/charger_pdf.php b/inc/charger_pdf.php index ec1d35c..aeec439 100644 --- a/inc/charger_pdf.php +++ b/inc/charger_pdf.php @@ -3,7 +3,7 @@ if (!defined('_ECRIRE_INC_VERSION')){ return; } -function inc_charger_pdf_dist($fichier_pdf, $contexte = []){ +function inc_charger_pdf_dist($fichier_pdf, $contexte = [], $args = []){ $login = lire_config('curl_login'); $password = lire_config('curl_mdp');