Merge branch 'envoi_separe'
This commit is contained in:
commit
c70ced219c
3 changed files with 29 additions and 6 deletions
|
@ -196,6 +196,7 @@ function formulaires_gamumail_verifier_dist($slug, $destinataires = 0, $Tclient
|
||||||
}
|
}
|
||||||
|
|
||||||
function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient = [], $Tpdf = [], $redirect = '', $options = []) :Array{
|
function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient = [], $Tpdf = [], $redirect = '', $options = []) :Array{
|
||||||
|
$retour = [];
|
||||||
|
|
||||||
// blocage de l'envoi par appel du pseudo-slug no_gamumail
|
// blocage de l'envoi par appel du pseudo-slug no_gamumail
|
||||||
if ($slug === 'no_gamumail') {
|
if ($slug === 'no_gamumail') {
|
||||||
|
@ -210,9 +211,8 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
|
||||||
include_spip('inc/texte');
|
include_spip('inc/texte');
|
||||||
include_spip('classes/facteur');
|
include_spip('classes/facteur');
|
||||||
|
|
||||||
$retour = [];
|
|
||||||
|
|
||||||
$envoi_separe = _request('envoi_separe') ?? '';
|
$envoi_separe = _request('envoi_separe') ?? '';
|
||||||
|
$options['envoi_separe'] = $envoi_separe;
|
||||||
|
|
||||||
$pour = _request('pour');
|
$pour = _request('pour');
|
||||||
$pour = explode(',', $pour);
|
$pour = explode(',', $pour);
|
||||||
|
@ -275,6 +275,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);
|
||||||
|
@ -341,6 +345,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'];
|
||||||
|
@ -348,6 +353,20 @@ 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', [
|
||||||
|
'args' => [
|
||||||
|
'destinataires' => $destinataires,
|
||||||
|
'contexte' => $c,
|
||||||
|
'options' => $options
|
||||||
|
], 'data' => $c
|
||||||
|
]);
|
||||||
|
|
||||||
$pdf = $recup_pdf($fichier, $c);
|
$pdf = $recup_pdf($fichier, $c);
|
||||||
$nom_fichier = $nom.'.pdf';
|
$nom_fichier = $nom.'.pdf';
|
||||||
$destination = _DIR_TMP.basename($nom_fichier);
|
$destination = _DIR_TMP.basename($nom_fichier);
|
||||||
|
@ -392,9 +411,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
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
|
[(#SET{Tpdf,#ARRAY{
|
||||||
|
fichier,#ENV{pdf_fichier},
|
||||||
|
nom,#ENV{pdf_nom},
|
||||||
|
contexte,#ARRAY{slug, #ENV{slug}}
|
||||||
|
}}
|
||||||
|
)]
|
||||||
<h3 id="titre_slug"><:gamumail:contenu_mail:></h3>
|
<h3 id="titre_slug"><:gamumail:contenu_mail:></h3>
|
||||||
<div class="bloc_contenu_slug ajax">
|
<div class="bloc_contenu_slug ajax">
|
||||||
[(#FORMULAIRE_GAMUMAIL{
|
[(#FORMULAIRE_GAMUMAIL{
|
||||||
#ENV{slug},
|
#ENV{slug},
|
||||||
#ENV{dest},
|
#ENV{dest},
|
||||||
#ENV{client},
|
#ENV{client},
|
||||||
#ENV{Tpdf},
|
#GET{Tpdf},
|
||||||
#ENV{redirect},
|
#ENV{redirect},
|
||||||
#ENV{options}
|
#ENV{options}
|
||||||
})]
|
})]
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
<pipeline nom="remplacements_slug" action='' />
|
<pipeline nom="remplacements_slug" action='' />
|
||||||
<pipeline nom="post_gamumail_ok" action='' />
|
<pipeline nom="post_gamumail_ok" action='' />
|
||||||
|
<pipeline nom="tpdf_charger_contexte" action='' />
|
||||||
|
|
||||||
<pipeline nom="autoriser" inclure="gamumail_autorisations.php" />
|
<pipeline nom="autoriser" inclure="gamumail_autorisations.php" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue