Fix: Maxi debug of emailing feature

This commit is contained in:
Laurent Destailleur 2010-12-13 18:40:04 +00:00
parent 55a4f545ed
commit 6539f61785
9 changed files with 59 additions and 47 deletions

View File

@ -213,7 +213,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
$var=!$var;
// Affiche les listes de selection
// Show email selectors
if ($mil->statut == 0)
{
print_fiche_titre($langs->trans("ToAddRecipientsChooseHere"),($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''),'');
@ -384,14 +384,14 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$parm,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$parm,"",'align="center"',$sortfield,$sortorder);
// Date
// Date sendinf
if ($mil->statut < 2)
{
print '<td class="liste_titre">&nbsp;</td>';
}
else
{
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"mc.date_envoi",$parm,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$parm,'','align="center"',$sortfield,$sortorder);
}
// Statut

View File

@ -166,13 +166,13 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes')
// sendto en RFC2822
$sendto = str_replace(',',' ',$obj->prenom." ".$obj->nom)." <".$obj->email.">";
// Make subtsitutions on topic and body
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
$other=explode(';',$obj->other);
$other1=$other[0];
$other2=$other[1];
$other3=$other[2];
$other4=$other[3];
$other5=$other[4];
$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]);
$substitutionarray=array(
'__ID__' => $obj->source_id,
'__EMAIL__' => $obj->email,
@ -490,7 +490,7 @@ if ($_POST["action"] == 'update' && empty($_POST["removedfile"]) && empty($_POST
}
// Action confirmation validation
if ($_REQUEST["action"] == 'confirm_valide')
if ($_REQUEST["action"] == 'confirm_valid')
{
if ($_REQUEST["confirm"] == 'yes')
@ -646,9 +646,9 @@ else
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
// Confirmation de la validation du mailing
if ($_GET["action"] == 'valide')
if ($_GET["action"] == 'valid')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$mil->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valide",'','',2);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$mil->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1);
if ($ret == 'html') print '<br>';
}
@ -662,7 +662,7 @@ else
// Confirm delete
if ($_GET["action"] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$mil->id,$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete",'','',2);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$mil->id,$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete",'','',1);
if ($ret == 'html') print '<br>';
}
@ -674,20 +674,28 @@ else
*/
if ($_GET["action"] == 'sendall')
{
// Define message to recommand from command line
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
$message='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
$message.='<br><textarea cols="50" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$_GET["id"].'</textarea>';
$message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
$mesg.='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
$mesg.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$_GET["id"].'</textarea>';
$mesg.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
$_GET["action"]='';
}
else
{
$text=$langs->trans('ConfirmSendingEmailing').'<br>';
$text=$langs->trans("MailingNeedCommand");
$text.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$_GET["id"].'</textarea>';
$text.='<br><br>';
$text.=$langs->trans('ConfirmSendingEmailing').'<br>';
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed','','',2);
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260);
if ($ret == 'html') print '<br>';
}
}
@ -756,21 +764,12 @@ else
if ($mesg) print $mesg;
if ($_GET["action"] == 'sendall')
{
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
$message='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
$message.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$_GET["id"].'</textarea>';
}
if ($message) print $message;
/*
* Boutons d'action
*/
if ($_GET["action"] == '')
if (GETPOST("cancel") || GETPOST("confirm")=='no' || GETPOST("action") == ''
|| in_array(GETPOST('action'),array('valid','delete','sendall')))
{
print "\n\n<div class=\"tabsAction\">\n";
@ -795,7 +794,7 @@ else
}
else
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valide&amp;id='.$mil->id.'">'.$langs->trans("ValidMailing").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valid&amp;id='.$mil->id.'">'.$langs->trans("ValidMailing").'</a>';
}
}

View File

@ -1791,11 +1791,12 @@ class Form
* @param formquestion an array with forms complementary inputs
* @param selectedchoice "" or "no" or "yes"
* @param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
* @param height Force height of box
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
*/
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=0)
{
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax);
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height);
}
/**
@ -1807,18 +1808,20 @@ class Form
* @param formquestion an array with forms complementary inputs
* @param selectedchoice "" or "no" or "yes"
* @param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
* @param height Force height of box
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
*/
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=0)
{
global $langs,$conf;
$more='';
$formconfirm='';
if (empty($height)) $height=170;
if ($formquestion)
{
$more.='<tr class="valid"><td class="valid" colspan="3">'."\n";
$more.='<table class="nobordernopadding" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n";
foreach ($formquestion as $key => $input)
@ -1867,7 +1870,6 @@ class Form
}
}
$more.='</table>'."\n";
$more.='</td></tr>'."\n";
}
$formconfirm.= "\n<!-- begin form_confirm -->\n";
@ -1886,8 +1888,8 @@ class Form
jQuery("#dialog-confirm").dialog({
autoOpen: true,
resizable: false,
height:170,
width:590,
height:'.$height.',
width:600,
modal: true,
closeOnEscape: false,
close: function(event, ui) {
@ -1921,7 +1923,12 @@ class Form
$formconfirm.= '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'."\n";
// Ligne formulaire
$formconfirm.= $more;
if ($more)
{
$formconfirm.='<tr class="valid"><td class="valid" colspan="3">'."\n";
$formconfirm.=$more;
$formconfirm.='</td></tr>'."\n";
}
// Ligne message
$formconfirm.= '<tr class="valid">';

View File

@ -112,7 +112,7 @@ class mailing_dolibarr_services_expired extends MailingTargets
$num = $this->db->num_rows($result);
$i = 0;
dolibarr_syslog("dolibarr_services_expired.modules.php:add_to_target ".$num." targets found");
dolibarr_syslog(get_class($this)."::add_to_target ".$num." targets found");
$old = '';
while ($i < $num)

View File

@ -139,6 +139,7 @@ class mailing_fraise extends MailingTargets
{
global $langs,$_POST;
$langs->load("members");
$langs->load("companies");
$cibles = array();
$now=dol_now();
@ -149,7 +150,7 @@ class mailing_fraise extends MailingTargets
// La requete doit retourner: id, email, fk_contact, name, firstname
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
$sql.= " a.nom as name, a.prenom as firstname,";
$sql.= " a.datefin"; // Other fields
$sql.= " a.datefin, a.civilite, a.login, a.societe"; // Other fields
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql.= " WHERE a.email IS NOT NULL";
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
@ -162,7 +163,7 @@ class mailing_fraise extends MailingTargets
//print $sql;
// Add targets into table
dol_syslog("fraise.modules.php sql=".$sql);
dol_syslog(get_class($this)."::add_to_target sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
@ -183,7 +184,10 @@ class mailing_fraise extends MailingTargets
'fk_contact' => $obj->fk_contact,
'name' => $obj->name,
'firstname' => $obj->firstname,
'other' => $obj->datefin?($langs->transnoentities("DateEnd").'='.dol_print_date($this->db->jdate($obj->datefin),'day')):'',
'other' => ($langs->transnoentities("DateEnd").'='.dol_print_date($this->db->jdate($obj->datefin),'day')).';'.
($langs->transnoentities("Civility").'='.$obj->civilite).';'.
($langs->transnoentities("Login").'='.$obj->login).';'.
($langs->transnoentities("Company").'='.$obj->societe),
'source_url' => $this->url($obj->id),
'source_id' => $obj->id,
'source_type' => 'member'

View File

@ -161,6 +161,7 @@ class mailing_framboise extends MailingTargets
global $conf, $langs;
$langs->load("companies");
$langs->load("categories");
$s='';
$s.='<select name="filter" class="flat">';
@ -179,8 +180,8 @@ class mailing_framboise extends MailingTargets
{
$num = $this->db->num_rows($resql);
if ($num) $s.='<option value="0">&nbsp;</option>';
else $s.='<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
$s.='<option value="0">&nbsp;</option>';
if (! $num) $s.='<option value="0" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
$i = 0;
while ($i < $num)

View File

@ -128,6 +128,7 @@ ALTER TABLE llx_product ADD COLUMN ref_ext varchar(32) after entity;
ALTER TABLE llx_mailing_cibles CHANGE COLUMN url source_url integer;
ALTER TABLE llx_mailing_cibles MODIFY source_url varchar(160);
ALTER TABLE llx_mailing_cibles ADD COLUMN source_id integer after source_url;
ALTER TABLE llx_mailing_cibles ADD COLUMN source_type varchar(16) after source_id;

View File

@ -90,9 +90,9 @@ SearchAMailing=Search mailing
SendMailing=Send emailing
SendMail=Send email
SentBy=Sent by
MailingNeedCommand=For securities reason, sending an emailing should be performed from command line. Ask your administrator to launch the following command to send the emailing to all recipients:
MailingNeedCommand=For security reason, sending an emailing should be performed from command line. Ask your administrator to launch the following command to send the emailing to all recipients:
MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other.
ConfirmSendingEmailing=Are you sure you want to send mailing ?
ConfirmSendingEmailing=Are you sure you want to send emailing without command line and from web mode ?
LimitSendingEmailing=On line sending of emailings are limited for security and timeout reasons to <b>%s</b> recipients by sending session.
TargetsReset=Clear list
ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing

View File

@ -92,7 +92,7 @@ SendMail=Envoi mail
SentBy=Envoyé par
MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire les envois d'un mailing de masse depuis une ligne de commande. Demandez à votre administrateur de lancer la commande suivante pour envoyer le mailing à tous les destinataires :
MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer en ligne en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers.
ConfirmSendingEmailing=Confirmez-vous l'envoi de l'emailing ?
ConfirmSendingEmailing=Confirmez-vous l'envoi de l'emailing depuis le mode web ?
LimitSendingEmailing=L'envoi d'un emailing depuis les écrans est limité pour raisons de sécurité et de timeout à <b>%s</b> destinataires par session d'envoi.
TargetsReset=Vider liste
ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquer le bouton