Can add a field errors-to to emailings

This commit is contained in:
Laurent Destailleur 2009-05-24 22:01:19 +00:00
parent 824969bfa3
commit c50d2cea03
5 changed files with 45 additions and 24 deletions

View File

@ -4,18 +4,21 @@ English Dolibarr changelog
***** Changelog for 2.7 compared to 2.6 *****
For users:
- New: Add an help and support center.
- New: Add a help and support center.
- New: Can export commercial proposals.
- New: Can use a cache for xcal exports.
- New: Option for faster confirmation process with one ajax popup.
- New: Complete theme bluelagoon and rodolphe
- New: Can select third parties emails in emailing module for all
third parties with expired contract's lines.
- New: Can add a field errors-to in emailing.
- New: Can use inline images in emails.
- Fix: Customer code was not correct on PDF it if contains special
characters.
- Fix: Can update price even with "NPR" VAT rates.
- Fix: When product type is missing, description is not lost when adding
new product lines.
- Fix: CC and BCC in emails was not used if using SMTPS handler.
For translators:
- Update some language files.

View File

@ -26,6 +26,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/comm/mailing/mailing.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
@ -87,7 +88,7 @@ if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes')
}
}
// Action envoi mailing pour tous
// Action send emailing for everybody
if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
{
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
@ -272,7 +273,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
}
}
// Action envoi test mailing
// Action send test emailing
if ($_POST["action"] == 'send' && ! $_POST["cancel"])
{
$mil = new Mailing($db);
@ -320,19 +321,21 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
}
}
// Action ajout mailing
// Action add emailing
if ($_POST["action"] == 'add')
{
$message='';
$mil = new Mailing($db);
$mil->email_from = trim($_POST["from"]);
$mil->titre = trim($_POST["titre"]);
$mil->sujet = trim($_POST["sujet"]);
$mil->body = trim($_POST["body"]);
$mil->bgcolor = trim($_POST["bgcolor"]);
$mil->bgimage = trim($_POST["bgimage"]);
$mil->email_from = trim($_POST["from"]);
$mil->email_replyto = trim($_POST["replyto"]);
$mil->email_errorsto = trim($_POST["errorsto"]);
$mil->titre = trim($_POST["titre"]);
$mil->sujet = trim($_POST["sujet"]);
$mil->body = trim($_POST["body"]);
$mil->bgcolor = trim($_POST["bgcolor"]);
$mil->bgimage = trim($_POST["bgimage"]);
if (! $mil->titre) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle"));
if (! $mil->sujet) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic"));
@ -351,22 +354,25 @@ if ($_POST["action"] == 'add')
$_GET["action"]="create";
}
// Action mise a jour mailing
// Action update emailing
if ($_POST["action"] == 'update')
{
$mil = new Mailing($db);
$mil->id = $_POST["id"];
$mil->email_from = $_POST["from"];
$mil->titre = $_POST["titre"];
$mil->sujet = $_POST["sujet"];
$mil->body = $_POST["body"];
$mil->bgcolor = $_POST["bgcolor"];
$mil->bgimage = $_POST["bgimage"];
$mil->id = $_POST["id"];
$mil->email_from = trim($_POST["from"]);
$mil->email_replyto = trim($_POST["replyto"]);
$mil->email_errorsto = trim($_POST["errorsto"]);
$mil->titre = trim($_POST["titre"]);
$mil->sujet = trim($_POST["sujet"]);
$mil->body = trim($_POST["body"]);
$mil->bgcolor = trim($_POST["bgcolor"]);
$mil->bgimage = trim($_POST["bgimage"]);
if ($mil->update())
if ($mil->update($user))
{
Header("Location: fiche.php?id=".$mil->id);
exit;
}
}
@ -489,6 +495,7 @@ if ($_GET["action"] == 'create')
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
print '<tr><td colspan="2">&nbsp;</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td><input class="flat" name="errorsto" size="40" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value="'.$_POST['sujet'].'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("BackgroundColor").'</td><td colspan="3">';
$htmlother->select_color($_POST['bgcolor'],'bgcolor','new_mailing');
@ -593,7 +600,12 @@ else
print '</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$mil->titre.'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.htmlentities($mil->email_from).'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.htmlentities($mil->email_from);
if (! isValidEMail($mil->email_from)) print img_warning($langs->trans("BadEMail"));
print '</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.htmlentities($mil->email_errorsto);
if (! isValidEMail($mil->email_errorsto)) print img_warning($langs->trans("BadEMail"));
print '</td></tr>';
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$mil->getLibStatut(4).'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("TotalNbOfDistinctRecipients").'</td><td colspan="3">'.($mil->nbemail?$mil->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>').'</td></tr>';
@ -761,6 +773,7 @@ else
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$mil->id.'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3"><input class="flat" type="text" size=40 name="titre" value="'.$mil->titre.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3"><input class="flat" type="text" size=40 name="from" value="'.$mil->email_from.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3"><input class="flat" type="text" size=40 name="errorsto" value="'.$mil->email_errorsto.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("BackgroundColor").'</td><td colspan="3">';
$htmlother->select_color($mil->bgcolor,'bgcolor','edit_mailing');

View File

@ -79,7 +79,7 @@ class Mailing extends CommonObject
/**
* \brief Create an EMailing
* \param user object utilisateur qui cree
* \param user Object of user making creation
* \return -1 if error, Id of created object if OK
*/
function create($user)
@ -134,16 +134,19 @@ class Mailing extends CommonObject
}
/**
* \brief Update les infos du mailing
* \return < 0 si erreur, > 0 si ok
* \brief Update emailing record
* \param user Object of user making change
* \return < 0 if KO, > 0 if OK
*/
function update()
function update($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
$sql .= " SET titre = '".addslashes($this->titre)."'";
$sql .= ", sujet = '".addslashes($this->sujet)."'";
$sql .= ", body = '".addslashes($this->body)."'";
$sql .= ", email_from = '".$this->email_from."'";
$sql .= ", email_replyto = '".$this->email_replyto."'";
$sql .= ", email_errorsto = '".$this->email_errorsto."'";
$sql .= ", bgcolor = '".($this->bgcolor?$this->bgcolor:null)."'";
$sql .= ", bgimage = '".($this->bgimage?$this->bgimage:null)."'";
$sql .= " WHERE rowid = ".$this->id;

View File

@ -61,6 +61,7 @@ YouCanAddYourOwnPredefindedListHere=To create your email selector module, see ht
EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values
MailingAddFile=Attach this file
NoAttachedFiles=No attached files
BadEMail=Bad value for EMail
# Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...)

View File

@ -61,6 +61,7 @@ YouCanAddYourOwnPredefindedListHere=Pour créer votre module sélection mails, v
EMailTestSubstitutionReplacedByGenericValues=En mode test, les variables de substitution sont remplacées par des valeurs génériques
MailingAddFile=Joindre ce fichier
NoAttachedFiles=Aucun fichier joint
BadEMail=EMail incorrect
# Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts des tiers (prospects, clients, fournisseurs...)