feat: on passe par remplacements slug sur le nom du fichier pdf

This commit is contained in:
Christophe 2023-11-07 10:34:00 +01:00
parent ab2476fdcf
commit 9c1ad3591d

View file

@ -267,6 +267,10 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $redirect, &
$Tid_doc = _request('Tid_doc'); $Tid_doc = _request('Tid_doc');
$texte = facteur_mail_html2text($html); $texte = facteur_mail_html2text($html);
$args = $options;
$args['slug'] = $slug;
$args['destinataires'] = $destinataires;
$pieces_jointes = []; $pieces_jointes = [];
if ($f = charger_fonction('traiter_av_pdf', 'gamumail', true)) { if ($f = charger_fonction('traiter_av_pdf', 'gamumail', true)) {
$options = $f($options, $destinataires, $Tclient, $Tpdf); $options = $f($options, $destinataires, $Tclient, $Tpdf);
@ -333,6 +337,7 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $redirect, &
$recup_pdf = charger_fonction('charger_pdf','inc'); $recup_pdf = charger_fonction('charger_pdf','inc');
foreach ($Tpdfs_ok as $pdf) { foreach ($Tpdfs_ok as $pdf) {
$nom = "mon_fichier";
foreach ($Tpdf as $cle => $p) { foreach ($Tpdf as $cle => $p) {
if ($p['fichier'].'_'.$cle === $pdf) { if ($p['fichier'].'_'.$cle === $pdf) {
$fichier = $p['fichier']; $fichier = $p['fichier'];
@ -340,6 +345,12 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $redirect, &
$nom = isset($p['nom']) ? $p['nom'] : $fichier; $nom = isset($p['nom']) ? $p['nom'] : $fichier;
} }
} }
$nom = pipeline('remplacements_slug', array(
'args' => $args,
'data' => $nom
));
$c = pipeline('tpdf_charger_contexte', [ $c = pipeline('tpdf_charger_contexte', [
'args' => [ 'args' => [
'destinataires' => $destinataires, 'destinataires' => $destinataires,
@ -392,9 +403,6 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $redirect, &
$html = $html_header . $html . $html_footer; $html = $html_header . $html . $html_footer;
// pipeline pour les traitement du contenu des slugs spécifiques de chaque plugin // pipeline pour les traitement du contenu des slugs spécifiques de chaque plugin
$args = $options;
$args['slug'] = $slug;
$args['destinataires'] = $destinataires;
$html = pipeline('remplacements_slug', array( $html = pipeline('remplacements_slug', array(
'args' => $args, 'args' => $args,
'data' => $html 'data' => $html