Ajoute l'envoi des pdfs
a tester
This commit is contained in:
parent
176386f241
commit
2406e6fb28
1 changed files with 33 additions and 9 deletions
|
@ -10,7 +10,7 @@ include_spip('inc/filtres');
|
||||||
* @param string $slug modele du mail a charger
|
* @param string $slug modele du mail a charger
|
||||||
* @param int|string $auteur id_auteur ou email du destinataire
|
* @param int|string $auteur id_auteur ou email du destinataire
|
||||||
* @param array $Tclient []['objet' => 'app_client', 'id_objet' => 3, 'champ' => 'email'] ou ['objet' => 'app_client', 'id_objet' => 3, 'champ' => 'email']
|
* @param array $Tclient []['objet' => 'app_client', 'id_objet' => 3, 'champ' => 'email'] ou ['objet' => 'app_client', 'id_objet' => 3, 'champ' => 'email']
|
||||||
* @param array $Tpdf []['fichier' => 'pdf_facture', 'contexte' => ['id_app_facture' => 3]] ou ['fichier' => 'pdf_facture', 'contexte' => ['id_app_facture' => 3]]
|
* @param array $Tpdf []['fichier' => 'pdf_facture', 'nom' => 'facture_123', 'contexte' => ['id_app_facture' => 3]] ou ['fichier' => 'pdf_facture', 'contexte' => ['id_app_facture' => 3]]
|
||||||
* @param string $redirect
|
* @param string $redirect
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return array $valeurs
|
* @return array $valeurs
|
||||||
|
@ -99,7 +99,7 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
|
||||||
$sujet = _request('sujet');
|
$sujet = _request('sujet');
|
||||||
$html = propre(_request('texte'));
|
$html = propre(_request('texte'));
|
||||||
$Tid_doc = _request('Tid_doc');
|
$Tid_doc = _request('Tid_doc');
|
||||||
$Tpdfs = _request('Tpdfs_ok');
|
$Tpdfs_ok = _request('Tpdfs_ok');
|
||||||
$texte = facteur_mail_html2text($html);
|
$texte = facteur_mail_html2text($html);
|
||||||
|
|
||||||
$pour = explode(',', $pour);
|
$pour = explode(',', $pour);
|
||||||
|
@ -130,6 +130,30 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// les pdfs
|
||||||
|
if (!empty($Tpdfs_ok) and is_array($Tpdfs_ok)) {
|
||||||
|
$recup_pdf = charger_fonction('charger_pdf','inc');
|
||||||
|
foreach ($Tpdfs_ok as $pdf) {
|
||||||
|
foreach ($Tpdf as $p) {
|
||||||
|
if ($p['fichier'] === $pdf) {
|
||||||
|
$c = $p['contexte'];
|
||||||
|
$nom = $p['nom'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf = $recup_pdf($pdf, $c);
|
||||||
|
$nom_fichier = $nom.'.pdf';
|
||||||
|
$destination = _DIR_TMP.basename($nom_fichier);
|
||||||
|
file_put_contents($destination,$pdf);
|
||||||
|
$pieces_jointes[] = [
|
||||||
|
'chemin' => $destination,
|
||||||
|
'nom' => $nom_fichier,
|
||||||
|
'encodage' => 'base64',
|
||||||
|
'mime' => 'application/pdf'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$corps = [
|
$corps = [
|
||||||
'html' => $html,
|
'html' => $html,
|
||||||
'texte' => $texte,
|
'texte' => $texte,
|
||||||
|
|
Loading…
Add table
Reference in a new issue