diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 7cb2382b902..a87b670dacb 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -110,72 +110,72 @@ if ($mil->fetch($_GET["id"]) == 0)
// Affiche les listes de sélection
- print '
';
- print '';
- print ''.$langs->trans("RecipientSelectionModules").' ';
- print ''.$langs->trans("NbOfRecipients").' ';
- print '';
if ($mil->statut == 0) {
- print $langs->trans("Actions");
- }
- print ' ';
- print " \n";
-
- clearstatcache();
-
- $handle=opendir($dir);
-
- $var=True;
- while (($file = readdir($handle))!==false)
- {
- if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
- {
- if (eregi("(.*)\.(.*)\.(.*)",$file,$reg)) {
- $var = !$var;
- $modulename=$reg[1];
-
- // Chargement de la classe
- $file = $dir."/".$modulename.".modules.php";
- $classname = "mailing_".$modulename;
- require_once($file);
-
- print '';
-
- print '';
- $obj = new $classname($db);
- print $obj->getDesc();
- print ' ';
-
- /*
- print '';
- print $modulename;
- print " ";
- */
- print ''.$obj->getNbOfRecipients().' ';
-
- print '';
- if ($mil->statut == 0) {
- print '';
- }
- else {
- //print $langs->trans("MailNoChangePossible");
- print " ";
- }
- print ' ';
- }
- print " \n";
+ print '';
+ print '';
+ print ''.$langs->trans("RecipientSelectionModules").' ';
+ print ''.$langs->trans("NbOfRecipients").' ';
+ print '';
+ if ($mil->statut == 0) {
+ print $langs->trans("Actions");
}
- }
- closedir($handle);
+ print ' ';
+ print " \n";
+
+ clearstatcache();
+
+ $handle=opendir($dir);
+
+ $var=True;
+ while (($file = readdir($handle))!==false)
+ {
+ if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
+ {
+ if (eregi("(.*)\.(.*)\.(.*)",$file,$reg)) {
+ $var = !$var;
+ $modulename=$reg[1];
+
+ // Chargement de la classe
+ $file = $dir."/".$modulename.".modules.php";
+ $classname = "mailing_".$modulename;
+ require_once($file);
+
+ print '';
+
+ print '';
+ $obj = new $classname($db);
+ print $obj->getDesc();
+ print ' ';
+
+ /*
+ print '';
+ print $modulename;
+ print " ";
+ */
+ print ''.$obj->getNbOfRecipients().' ';
+
+ print '';
+ if ($mil->statut == 0) {
+ print '';
+ }
+ else {
+ //print $langs->trans("MailNoChangePossible");
+ print " ";
+ }
+ print ' ';
+ }
+ print " \n";
+ }
+ }
+ closedir($handle);
- if ($mil->statut == 0) {
print '';
print ' ';
print ' ';
+
+ print '
';
}
- print '
';
-
// Liste des destinataires électionnés
$NBMAX=100;
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index e982d2c0ae7..19b7e90a2c1 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -86,12 +86,12 @@ if ($_POST["action"] == 'add')
{
$mil = new Mailing($db);
- $mil->from = $_POST["from"];
+ $mil->email_from = $_POST["from"];
$mil->titre = $_POST["titre"];
$mil->sujet = $_POST["sujet"];
$mil->body = $_POST["body"];
- if ($mil->create($user))
+ if ($mil->create($user) >= 0)
{
Header("Location: fiche.php?id=".$mil->id);
}
diff --git a/htdocs/comm/mailing/mailing.class.php b/htdocs/comm/mailing/mailing.class.php
index 73bfb36af51..fe728926c20 100644
--- a/htdocs/comm/mailing/mailing.class.php
+++ b/htdocs/comm/mailing/mailing.class.php
@@ -145,7 +145,7 @@ class Mailing
$sql .= " SET titre = '".addslashes($this->titre)."'";
$sql .= " , sujet = '".addslashes($this->sujet)."'";
$sql .= " , body = '".addslashes($this->body)."'";
- $sql .= " , email_from = '".$this->from."'";
+ $sql .= " , email_from = '".$this->email_from."'";
$sql .= " WHERE rowid = ".$this->id;
$result=$this->db->query($sql);
diff --git a/htdocs/html.formmail.class.php b/htdocs/html.formmail.class.php
index 4c8040251bb..f482651ba3c 100644
--- a/htdocs/html.formmail.class.php
+++ b/htdocs/html.formmail.class.php
@@ -44,7 +44,7 @@ class FormMail
var $replytomail;
var $toname;
var $tomail;
-
+
var $withfrom;
var $withto;
var $withtocc;
@@ -83,6 +83,7 @@ class FormMail
$this->withtoreadonly=0;
$this->withtoccreadonly=0;
$this->withtopicreadonly=0;
+ $this->withbodyreadonly=0;
return 1;
}
@@ -167,7 +168,14 @@ class FormMail
print "";
print "".$langs->trans("MailTopic")." ";
print "";
- print " ";
+ if ($this->withtopicreadonly) {
+ print $this->withtopic;
+ print " withtopic."\">";
+ }
+ else
+ {
+ print " withtopic."\">";
+ }
print " \n";
}
@@ -187,6 +195,7 @@ class FormMail
$defaultmessage="";
// \todo A partir du type, proposer liste de messages dans table llx_models
+ if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
if ($this->param["models"]=='facture_send') { $defaultmessage="Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n"; }
if ($this->param["models"]=='facture_relance') { $defaultmessage="Nous apportons à votre connaissance que la facture __FACREF__ ne semble toujours pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n"; }
@@ -196,9 +205,15 @@ class FormMail
print "";
print "".$langs->trans("MailText")." ";
print "";
- print "';
+ } else {
+ print ' ';
+ }
print " \n";
}