Work on SMS features

This commit is contained in:
Laurent Destailleur 2011-03-06 15:58:53 +00:00
parent 6043a0b873
commit 3da46d4961
3 changed files with 11 additions and 16 deletions

View File

@ -618,8 +618,8 @@ else
// Tableau des parametres complementaires du post
$formmail->param["action"]="send";
$formmail->param["models"]="body";
$formmail->param["mailid"]=$mil->id;
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
$formmail->param["mailid"]=0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
// Init list of files
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
@ -663,8 +663,8 @@ else
// Tableau des parametres complementaires du post
$formmail->param["action"]="sendhtml";
$formmail->param["models"]="body";
$formmail->param["mailid"]=$mil->id;
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
$formmail->param["mailid"]=0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
// Init list of files
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')

View File

@ -65,8 +65,7 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["can
/*
* Send sms
*/
if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
&& ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST["removedfile"] && ! $_POST['cancel'])
if ($_POST['action'] == 'send' && ! $_POST['cancel'])
{
$error=0;
@ -76,9 +75,6 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
$errors_to = $_POST["errorstosms"];
$sendto = $_POST["sendto"];
$sendtocc = $_POST["sendtocc"];
$sendtoccc = $_POST["sendtoccc"];
$subject = $_POST['subject'];
$body = $_POST['message'];
$deliveryreceipt= $_POST["deliveryreceipt"];
@ -102,18 +98,17 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
{
// Le message est-il en html
$msgishtml=0; // Message is not HTML
if ($_POST['action'] == 'sendhtml') $msgishtml=1; // Force message to HTML
// Pratique les substitutions sur le sujet et message
$subject=make_substitutions($subject,$substitutionarrayfortest,$langs);
$body=make_substitutions($body,$substitutionarrayfortest,$langs);
require_once(DOL_DOCUMENT_ROOT."/lib/CSMSFile.class.php");
$mailfile = new CSMSFile($subject,$sendto,$email_from,$body,
$smsfile = new CSMSFile($subject,$sendto,$email_from,$body,
$filepath,$mimetype,$filename,
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml,$errors_to);
$result=$mailfile->sendfile();
$result=$smsfile->sendfile();
if ($result)
{
@ -121,7 +116,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
}
else
{
$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>';
$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$smsfile->error.' '.$result.'</div>';
}
$_GET["action"]='';
@ -330,8 +325,8 @@ else
// Tableau des parametres complementaires du post
$formsms->param["action"]="send";
$formsms->param["models"]="body";
$formsms->param["mailid"]=$mil->id;
$formsms->param["returnurl"]=DOL_URL_ROOT."/admin/sms.php";
$formsms->param["smsid"]=0;
$formsms->param["returnurl"]=$_SERVER["PHP_SELF"];
$formsms->show_form();

View File

@ -116,7 +116,7 @@ function limitChars(textarea, limit, infodiv)
}
</script>';
print "<form method=\"POST\" name=\"mailform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
print "<form method=\"POST\" name=\"smsform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
foreach ($this->param as $key=>$value)
{