'."\n";
// Substitution array
if ($this->withsubstit)
{
- print "| ";
+ $out.= ' |
';
$help="";
foreach($this->substit as $key => $val)
{
$help.=$key.' -> '.$langs->trans($val).' ';
}
- print $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
- print " |
\n";
+ $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
+ $out.= "\n";
}
// From
@@ -230,42 +250,42 @@ class FormMail
{
if ($this->withfromreadonly)
{
- print '';
- print '';
- print "| ".$langs->trans("MailFrom")." | ";
+ $out.= '';
+ $out.= '';
+ $out.= ' |
| '.$langs->trans("MailFrom").' | ';
if ($this->fromtype == 'user')
{
$langs->load("users");
$fuser=new User($this->db);
$fuser->fetch($this->fromid);
- print $fuser->getNomUrl(1);
+ $out.= $fuser->getNomUrl(1);
}
else
{
- print $this->fromname;
+ $out.= $this->fromname;
}
if ($this->frommail)
{
- print " <".$this->frommail.">";
+ $out.= " <".$this->frommail.">";
}
else
{
if ($this->fromtype)
{
$langs->load("errors");
- print ' <'.$langs->trans("ErrorNoMailDefinedForThisUser").'> ';
+ $out.= ' <'.$langs->trans("ErrorNoMailDefinedForThisUser").'> ';
}
}
- print " |
\n";
- print "\n";
+ $out.= "\n";
+ $out.= "\n";
}
else
{
- print "| ".$langs->trans("MailFrom")." | ";
- print $langs->trans("Name").':';
- print ' ';
- print $langs->trans("EMail").':<>';
- print " |
\n";
+ $out.= "| ".$langs->trans("MailFrom")." | ";
+ $out.= $langs->trans("Name").':';
+ $out.= ' ';
+ $out.= $langs->trans("EMail").':<>';
+ $out.= " |
\n";
}
}
@@ -274,10 +294,10 @@ class FormMail
{
if ($this->withreplytoreadonly)
{
- print '';
- print '';
- print "| ".$langs->trans("MailReply")." | ".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):"");
- print " |
\n";
+ $out.= '';
+ $out.= '';
+ $out.= "| ".$langs->trans("MailReply")." | ".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):"");
+ $out.= " |
\n";
}
}
@@ -287,32 +307,32 @@ class FormMail
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
if ($this->witherrorstoreadonly)
{
- print '';
- print "| ".$langs->trans("MailErrorsTo")." | ";
- print $this->errorstomail;
- print " |
\n";
+ $out.= '';
+ $out.= '| '.$langs->trans("MailErrorsTo").' | ';
+ $out.= $this->errorstomail;
+ $out.= " |
\n";
}
else
{
- print "| ".$langs->trans("MailErrorsTo")." | ";
- print "errorstomail."\">";
- print " |
\n";
+ $out.= '| '.$langs->trans("MailErrorsTo").' | ';
+ $out.= '';
+ $out.= " |
\n";
}
}
// To
if ($this->withto || is_array($this->withto))
{
- print '| ';
- print $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
- print ' | ';
+ $out.= ' |
| ';
+ $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
+ $out.= ' | ';
if ($this->withtoreadonly)
{
- print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
+ $out.= (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
}
else
{
- print "withto)?"30":"60")."\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"")."\">";
+ $out.= 'withto) :"").'" />';
if ($this->withtosocid > 0)
{
$liste=array();
@@ -323,27 +343,27 @@ class FormMail
{
$liste[$key]=$value;
}
- print " ".$langs->trans("or")." ";
+ $out.= " ".$langs->trans("or")." ";
//var_dump($_REQUEST);exit;
- print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
+ $out.= $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
}
}
- print " |
\n";
+ $out.= "\n";
}
// CC
if ($this->withtocc || is_array($this->withtocc))
{
- print '| ';
- print $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
- print ' | ';
+ $out.= ' |
| ';
+ $out.= $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
+ $out.= ' | ';
if ($this->withtoccreadonly)
{
- print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
+ $out.= (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
}
else
{
- print "withtocc)?"30":"60")."\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") )."\">";
+ $out.= 'withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
if ($this->withtoccsocid > 0)
{
$liste=array();
@@ -354,26 +374,26 @@ class FormMail
{
$liste[$key]=$value;
}
- print " ".$langs->trans("or")." ";
- print $form->selectarray("receivercc", $liste, isset($_REQUEST["receivercc"])?$_REQUEST["receivercc"]:0);
+ $out.= " ".$langs->trans("or")." ";
+ $out.= $form->selectarray("receivercc", $liste, isset($_REQUEST["receivercc"])?$_REQUEST["receivercc"]:0);
}
}
- print " |
\n";
+ $out.= "\n";
}
// CCC
if ($this->withtoccc || is_array($this->withtoccc))
{
- print '| ';
- print $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
- print ' | ';
+ $out.= ' |
| ';
+ $out.= $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
+ $out.= ' | ';
if ($this->withtocccreadonly)
{
- print (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
+ $out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
}
else
{
- print "withtoccc)?"30":"60")."\" name=\"sendtoccc\" value=\"".((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") )."\">";
+ $out.= 'withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
if ($this->withtocccsocid > 0)
{
$liste=array();
@@ -384,29 +404,29 @@ class FormMail
{
$liste[$key]=$value;
}
- print " ".$langs->trans("or")." ";
- print $form->selectarray("receiverccc", $liste, isset($_REQUEST["receiverccc"])?$_REQUEST["receiverccc"]:0);
+ $out.= " ".$langs->trans("or")." ";
+ $out.= $form->selectarray("receiverccc", $liste, isset($_REQUEST["receiverccc"])?$_REQUEST["receiverccc"]:0);
}
}
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
- print " |
\n";
+ $out.= "\n";
}
// Ask delivery receipt
if ($this->withdeliveryreceipt)
{
- print '| '.$langs->trans("DeliveryReceipt").' | ';
+ $out.= ' |
| '.$langs->trans("DeliveryReceipt").' | ';
if ($this->withdeliveryreceiptreadonly)
{
- print yn($this->withdeliveryreceipt);
+ $out.= yn($this->withdeliveryreceipt);
}
else
{
- print $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0) ,1);
+ $out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0) ,1);
}
- print " |
\n";
+ $out.= "\n";
}
// Topic
@@ -414,50 +434,50 @@ class FormMail
{
$this->withtopic=make_substitutions($this->withtopic,$this->substit);
- print "";
- print "| ".$langs->trans("MailTopic")." | ";
- print "";
+ $out.= ' |
';
+ $out.= '| '.$langs->trans("MailTopic").' | ';
+ $out.= '';
if ($this->withtopicreadonly)
{
- print $this->withtopic;
- print "withtopic."\">";
+ $out.= $this->withtopic;
+ $out.= '';
}
else
{
- print "withtopic) ."\">";
+ $out.= 'withtopic) .'" />';
}
- print " |
\n";
+ $out.= "\n";
}
// Attached files
if ($this->withfile)
{
- print "";
- print '| '.$langs->trans("MailFile")." | ";
- print "";
+ $out.= ' |
';
+ $out.= '| '.$langs->trans("MailFile").' | ';
+ $out.= '';
//print '';
}
- print " |
\n";
+ $out.= "\n";
}
// Message
@@ -497,42 +517,48 @@ class FormMail
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
- print "";
- print "| ".$langs->trans("MailText")." | ";
- print "";
+ $out.= ' |
';
+ $out.= '| '.$langs->trans("MailText").' | ';
+ $out.= '';
if ($this->withbodyreadonly)
{
- print nl2br($defaultmessage);
- print '';
+ $out.= nl2br($defaultmessage);
+ $out.= '';
}
else
{
// Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('message',$defaultmessage,'',280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72);
- $doleditor->Create();
+ $out.= $doleditor->Create(1);
}
- print " |
\n";
+ $out.= "\n";
}
-
- print "";
- print "trans("SendMail")."\"";
- // Add a javascript test to avoid to forget to submit file before sending email
- if ($this->withfile == 2 && $conf->use_javascript_ajax)
+
+ if ($this->withform)
{
- print ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
+ $out.= '| ';
+ $out.= 'withfile == 2 && $conf->use_javascript_ajax)
+ {
+ $out.= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
+ }
+ $out.= ' />';
+ if ($this->withcancel)
+ {
+ $out.= ' ';
+ $out.= '';
+ }
+ $out.= ' | '."\n";
}
- print ">";
- if ($this->withcancel)
- {
- print " ";
- print "trans("Cancel")."\">";
- }
- print " |
\n";
- print "
\n";
+
+ $out.= '