From 9b10f030bf5eb5143107a7a1ecea51ba4b3d5890 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 8 Feb 2016 12:20:40 +0100 Subject: [PATCH 1/2] Fix: missing signature and uniformize code between card and script --- htdocs/comm/mailing/card.php | 15 +++++++++------ scripts/emailings/mailing-send.php | 25 +++++++++++++------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index e1d357b6c3a..dc17c68e387 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2016 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -222,6 +222,8 @@ if (empty($reshook)) $tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $signature = (!empty($user->signature))?$user->signature:''; + // Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions) $substitutionarray=array( '__ID__' => $obj->source_id, @@ -234,6 +236,7 @@ if (empty($reshook)) '__OTHER3__' => $other3, '__OTHER4__' => $other4, '__OTHER5__' => $other5, + '__SIGNATURE__' => $signature, // Signature is empty when ran from command line or taken from user in parameter) '__CHECK_READ__' => '', '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'' ); @@ -1093,10 +1096,10 @@ else } print ''; - + dol_fiche_end(); - - + + print "\n"; print '
'."\n"; @@ -1108,7 +1111,7 @@ else print_fiche_titre($langs->trans("EMail"),'',''); dol_fiche_head(); - + print ''; // Subject @@ -1175,7 +1178,7 @@ else print '
'; dol_fiche_end(); - + print '
'; print ''; print '     '; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 9896db73352..1c25d78ba55 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -1,8 +1,9 @@ #!/usr/bin/php - * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2016 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -141,15 +142,15 @@ if ($resql) $sendto = str_replace(',',' ',dolGetFirstLastname($obj2->firstname, $obj2->lastname) ." <".$obj2->email.">"); // Make subtsitutions on topic and body - $other=explode(';',$obj2->other); - $other1=$other[0]; - $other2=$other[1]; - $other3=$other[2]; - $other4=$other[3]; - $other5=$other[4]; - // Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions) - $signature = (!empty($user->signature))?$user->signature:''; - + $other=explode(';',$obj->other); + $tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $signature = (!empty($user->signature))?$user->signature:''; + + // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray=array( '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, @@ -251,7 +252,7 @@ if ($resql) $error++; } } - + if (!empty($conf->global->MAILING_DELAY)) { sleep($conf->global->MAILING_DELAY); } From 0b2560130758506c8bc94e01bbc5138bc92a92d9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 8 Feb 2016 12:31:40 +0100 Subject: [PATCH 2/2] Fix: wrong object name --- htdocs/comm/mailing/card.php | 2 +- scripts/emailings/mailing-send.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index dc17c68e387..3bca65a3ee7 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -222,7 +222,7 @@ if (empty($reshook)) $tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); - $signature = (!empty($user->signature))?$user->signature:''; + $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''); // Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions) $substitutionarray=array( diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 1c25d78ba55..8baf85ee5fe 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -142,18 +142,18 @@ if ($resql) $sendto = str_replace(',',' ',dolGetFirstLastname($obj2->firstname, $obj2->lastname) ." <".$obj2->email.">"); // Make subtsitutions on topic and body - $other=explode(';',$obj->other); + $other=explode(';',$obj2->other); $tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); - $signature = (!empty($user->signature))?$user->signature:''; + $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''); // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray=array( - '__ID__' => $obj->source_id, - '__EMAIL__' => $obj->email, + '__ID__' => $obj2->source_id, + '__EMAIL__' => $obj2->email, '__LASTNAME__' => $obj2->lastname, '__FIRSTNAME__' => $obj2->firstname, '__MAILTOEMAIL__' => ''.$obj2->email.'',