Work on SMS features
This commit is contained in:
parent
6043a0b873
commit
3da46d4961
@ -618,8 +618,8 @@ else
|
|||||||
// Tableau des parametres complementaires du post
|
// Tableau des parametres complementaires du post
|
||||||
$formmail->param["action"]="send";
|
$formmail->param["action"]="send";
|
||||||
$formmail->param["models"]="body";
|
$formmail->param["models"]="body";
|
||||||
$formmail->param["mailid"]=$mil->id;
|
$formmail->param["mailid"]=0;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||||
@ -663,8 +663,8 @@ else
|
|||||||
// Tableau des parametres complementaires du post
|
// Tableau des parametres complementaires du post
|
||||||
$formmail->param["action"]="sendhtml";
|
$formmail->param["action"]="sendhtml";
|
||||||
$formmail->param["models"]="body";
|
$formmail->param["models"]="body";
|
||||||
$formmail->param["mailid"]=$mil->id;
|
$formmail->param["mailid"]=0;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||||
|
|||||||
@ -65,8 +65,7 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["can
|
|||||||
/*
|
/*
|
||||||
* Send sms
|
* Send sms
|
||||||
*/
|
*/
|
||||||
if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
if ($_POST['action'] == 'send' && ! $_POST['cancel'])
|
||||||
&& ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST["removedfile"] && ! $_POST['cancel'])
|
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -76,9 +75,6 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
|||||||
|
|
||||||
$errors_to = $_POST["errorstosms"];
|
$errors_to = $_POST["errorstosms"];
|
||||||
$sendto = $_POST["sendto"];
|
$sendto = $_POST["sendto"];
|
||||||
$sendtocc = $_POST["sendtocc"];
|
|
||||||
$sendtoccc = $_POST["sendtoccc"];
|
|
||||||
$subject = $_POST['subject'];
|
|
||||||
$body = $_POST['message'];
|
$body = $_POST['message'];
|
||||||
$deliveryreceipt= $_POST["deliveryreceipt"];
|
$deliveryreceipt= $_POST["deliveryreceipt"];
|
||||||
|
|
||||||
@ -102,18 +98,17 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
|||||||
{
|
{
|
||||||
// Le message est-il en html
|
// Le message est-il en html
|
||||||
$msgishtml=0; // Message is not 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
|
// Pratique les substitutions sur le sujet et message
|
||||||
$subject=make_substitutions($subject,$substitutionarrayfortest,$langs);
|
$subject=make_substitutions($subject,$substitutionarrayfortest,$langs);
|
||||||
$body=make_substitutions($body,$substitutionarrayfortest,$langs);
|
$body=make_substitutions($body,$substitutionarrayfortest,$langs);
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/CSMSFile.class.php");
|
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,
|
$filepath,$mimetype,$filename,
|
||||||
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml,$errors_to);
|
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml,$errors_to);
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
$result=$smsfile->sendfile();
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -121,7 +116,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
|||||||
}
|
}
|
||||||
else
|
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"]='';
|
$_GET["action"]='';
|
||||||
@ -330,8 +325,8 @@ else
|
|||||||
// Tableau des parametres complementaires du post
|
// Tableau des parametres complementaires du post
|
||||||
$formsms->param["action"]="send";
|
$formsms->param["action"]="send";
|
||||||
$formsms->param["models"]="body";
|
$formsms->param["models"]="body";
|
||||||
$formsms->param["mailid"]=$mil->id;
|
$formsms->param["smsid"]=0;
|
||||||
$formsms->param["returnurl"]=DOL_URL_ROOT."/admin/sms.php";
|
$formsms->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
$formsms->show_form();
|
$formsms->show_form();
|
||||||
|
|
||||||
|
|||||||
@ -116,7 +116,7 @@ function limitChars(textarea, limit, infodiv)
|
|||||||
}
|
}
|
||||||
</script>';
|
</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'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
foreach ($this->param as $key=>$value)
|
foreach ($this->param as $key=>$value)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user