* le remplacement de @@nom@@ renvoi que la valeur du champ nom ou un
espace pour supprimer @@nom@@
* le remplacement de @@prenom@@ renvoi que la valeur du champ prenom ou un
espace pour supprimer @@prenom@@
This commit is contained in:
Christophe 2023-04-22 16:59:53 +02:00
parent f1315dd545
commit 752a00ff4c

View file

@ -14,22 +14,21 @@ if (!defined('_ECRIRE_INC_VERSION')) {
**/ **/
function inc_gamumail_remplacements_dist($args, $html) { function inc_gamumail_remplacements_dist($args, $html) {
/** /**
* @@nom@@ => Prenom Nom | Nom (gère la présence/absence du champ prenom dans spip_auteurs) * @@nom@@ => $nom ou un espace pour vider le champ @@nom@@
**/ **/
$nom = sql_getfetsel('nom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])); $nom = sql_getfetsel('nom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])) ?? ' ';
$prenom = $nom; $html = gamumail_remplacer_modele('nom', ucwords($nom), $html);
/**
* @@prenom@@ => $prenom ou un espace pour vider le champ @@prenom@@
**/
$prenom = ' ';
$trouver_table = charger_fonction('trouver_table', 'base'); $trouver_table = charger_fonction('trouver_table', 'base');
$desc = $trouver_table('spip_auteurs'); $desc = $trouver_table('spip_auteurs');
if (array_key_exists('prenom', $desc['field']) if (array_key_exists('prenom', $desc['field'])) {
and $prenom = sql_getfetsel('prenom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0]))) { $prenom = sql_getfetsel('prenom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])) ?? ' ';
$nom = $prenom.' '.$nom;
}
if ($nom) {
$html = gamumail_remplacer_modele('nom', ucwords($nom), $html);
}
if ($prenom) {
$html = gamumail_remplacer_modele('prenom', ucwords($prenom), $html);
} }
$html = gamumail_remplacer_modele('prenom', ucwords($prenom), $html);
/** /**
* @@url_site@@ => URL du site * @@url_site@@ => URL du site