Work on SMS features
This commit is contained in:
parent
5fbe077deb
commit
6043a0b873
@ -321,7 +321,7 @@ else
|
|||||||
$formsms->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
|
$formsms->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
|
||||||
$formsms->withtopicreadonly=0;
|
$formsms->withtopicreadonly=0;
|
||||||
$formsms->withfile=2;
|
$formsms->withfile=2;
|
||||||
$formsms->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("PredefinedMailTest"));
|
$formsms->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("ThisIsATestMessage"));
|
||||||
$formsms->withbodyreadonly=0;
|
$formsms->withbodyreadonly=0;
|
||||||
$formsms->withcancel=1;
|
$formsms->withcancel=1;
|
||||||
$formsms->withfckeditor=0;
|
$formsms->withfckeditor=0;
|
||||||
|
|||||||
@ -192,7 +192,7 @@ class Conf
|
|||||||
{
|
{
|
||||||
$module=strtolower($reg[1]);
|
$module=strtolower($reg[1]);
|
||||||
// Add this module in list of modules that need smarty
|
// Add this module in list of modules that need smarty
|
||||||
$this->sms_engine[]=$module;
|
$this->sms_engine[$module]=$module;
|
||||||
}
|
}
|
||||||
// If this is a module constant
|
// If this is a module constant
|
||||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
|
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
|
||||||
|
|||||||
@ -84,8 +84,7 @@ class FormSms
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form to input an email
|
* Show the form to input an sms
|
||||||
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
|
||||||
*/
|
*/
|
||||||
function show_form()
|
function show_form()
|
||||||
{
|
{
|
||||||
@ -96,8 +95,27 @@ class FormSms
|
|||||||
$langs->load("sms");
|
$langs->load("sms");
|
||||||
|
|
||||||
$form=new Form($DB);
|
$form=new Form($DB);
|
||||||
|
$soc=new Societe($this->db);
|
||||||
|
if ($this->withtosocid > 0)
|
||||||
|
{
|
||||||
|
$soc->fetch($this->withtosocid);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n<!-- Debut form SMS -->\n";
|
||||||
|
|
||||||
|
print '
|
||||||
|
<script language="javascript">
|
||||||
|
function limitChars(textarea, limit, infodiv)
|
||||||
|
{
|
||||||
|
var text = textarea.value;
|
||||||
|
var textlength = text.length;
|
||||||
|
var info = document.getElementById(infodiv);
|
||||||
|
|
||||||
|
info.innerHTML = \''.$langs->trans("SmsInfoCharRemain").': \' + (limit - textlength);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
</script>';
|
||||||
|
|
||||||
print "\n<!-- Debut form mail -->\n";
|
|
||||||
print "<form method=\"POST\" name=\"mailform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
|
print "<form method=\"POST\" name=\"mailform\" 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)
|
||||||
@ -152,8 +170,26 @@ class FormSms
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr><td>".$langs->trans("SmsFrom")."</td><td>";
|
print "<tr><td>".$langs->trans("SmsFrom")."</td><td>";
|
||||||
print '<input type="text" name="fromname" size="30" value="'.$this->fromsms.'">';
|
//print '<input type="text" name="fromname" size="30" value="'.$this->fromsms.'">';
|
||||||
print "</td></tr>\n";
|
print '<select name="fromsms" id="valid" class="flat">';
|
||||||
|
if ($conf->global->MAIN_SMS_SENDMODE == 'ovh')
|
||||||
|
{
|
||||||
|
dol_include_once('/ovh/class/ovhsms.class.php');
|
||||||
|
$sms = new OvhSms($db);
|
||||||
|
$resultsender = $sms->SmsSenderList($conf->global->OVHSMS_ACCOUNT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$resultsender[0]->number=$this->fromsms;
|
||||||
|
}
|
||||||
|
$i=0;
|
||||||
|
while($resultsender[$i]){
|
||||||
|
print '<option value="'.$resultsender[$i]->number.'">'.$resultsender[$i]->number.'</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print '</select>';
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +197,9 @@ class FormSms
|
|||||||
if ($this->withto || is_array($this->withto))
|
if ($this->withto || is_array($this->withto))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">';
|
print '<tr><td width="180">';
|
||||||
print $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
//$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients");
|
||||||
|
$moretext='';
|
||||||
|
print $form->textwithpicto($langs->trans("SmsTo"),$moretext);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($this->withtoreadonly)
|
if ($this->withtoreadonly)
|
||||||
{
|
{
|
||||||
@ -169,14 +207,12 @@ class FormSms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"".(is_array($this->withto)?"30":"60")."\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"")."\">";
|
print "<input size=\"16\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto):"+")."\">";
|
||||||
if ($this->withtosocid > 0)
|
if ($this->withtosocid > 0)
|
||||||
{
|
{
|
||||||
$liste=array();
|
$liste=array();
|
||||||
$liste[0]=' ';
|
$liste[0]=' ';
|
||||||
$soc=new Societe($this->db);
|
foreach ($soc->thirdparty_and_contact_phone_array() as $key=>$value)
|
||||||
$soc->fetch($this->withtosocid);
|
|
||||||
foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value)
|
|
||||||
{
|
{
|
||||||
$liste[$key]=$value;
|
$liste[$key]=$value;
|
||||||
}
|
}
|
||||||
@ -184,6 +220,7 @@ class FormSms
|
|||||||
//var_dump($_REQUEST);exit;
|
//var_dump($_REQUEST);exit;
|
||||||
print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
|
print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
|
||||||
}
|
}
|
||||||
|
print ' '.$langs->trans("SmsInfoNumero");
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
@ -212,8 +249,7 @@ class FormSms
|
|||||||
// Message
|
// Message
|
||||||
if ($this->withbody)
|
if ($this->withbody)
|
||||||
{
|
{
|
||||||
$defaultmessage=$langs->transnoentities("ThisIsATestMessage");
|
$defaultmessage='';
|
||||||
|
|
||||||
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
|
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
|
||||||
/*if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); }
|
/*if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); }
|
||||||
if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||||
@ -235,15 +271,34 @@ class FormSms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Editeur wysiwyg
|
print '<textarea cols="40" name="message" id="message" rows="4" onkeyup="limitChars(this, 160, \'charlimitinfo\')">'.$defaultmessage.'</textarea>';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
print '<div id="charlimitinfo">'.$langs->trans("SmsInfoCharRemain").': '.(160-dol_strlen($defaultmessage)).'</div></td>';
|
||||||
$doleditor=new DolEditor('message',$defaultmessage,'',128,'dolibarr_notes','In',true,false,$this->withfckeditor,3,72);
|
|
||||||
$doleditor->Create();
|
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr><td align=center colspan=2><center>";
|
print '
|
||||||
|
<tr>
|
||||||
|
<td>'.$langs->trans("DelayBeforeSending").':</td>
|
||||||
|
<td> <input name="deferred" id="deferred" size="4" value="0"></td></tr>
|
||||||
|
|
||||||
|
<tr><td>'.$langs->trans("Type").' :</td><td>
|
||||||
|
<select name="class" id="valid" class="flat">
|
||||||
|
<option value="0">Flash</option>
|
||||||
|
<option value="1" selected="selected">Standard</option>
|
||||||
|
<option value="2">SIM</option>
|
||||||
|
<option value="3">ToolKit</option>
|
||||||
|
</select></td></tr>
|
||||||
|
|
||||||
|
<tr><td>'.$langs->trans("Priority").' :</td><td>
|
||||||
|
<select name="class" id="valid" class="flat">
|
||||||
|
<option value="0">0</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3" selected="selected">3</option>
|
||||||
|
</select></td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td align="center" colspan="2"><center>';
|
||||||
print "<input class=\"button\" type=\"submit\" name=\"sendmail\" value=\"".$langs->trans("SendSms")."\"";
|
print "<input class=\"button\" type=\"submit\" name=\"sendmail\" value=\"".$langs->trans("SendSms")."\"";
|
||||||
print ">";
|
print ">";
|
||||||
if ($this->withcancel)
|
if ($this->withcancel)
|
||||||
@ -255,7 +310,7 @@ class FormSms
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
print "<!-- Fin form mail -->\n";
|
print "<!-- Fin form SMS -->\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -47,3 +47,7 @@ NbOfUniqueSms=Nb de téléphone uniques
|
|||||||
NbOfSms=Nbre de téléphone
|
NbOfSms=Nbre de téléphone
|
||||||
ThisIsATestMessage=Ceci est un message de test
|
ThisIsATestMessage=Ceci est un message de test
|
||||||
SendSms=Envoyer SMS
|
SendSms=Envoyer SMS
|
||||||
|
SmsInfoCharRemain=Nb de caractères restant
|
||||||
|
SmsInfoNumero= (format international ex : +33899701761)
|
||||||
|
DelayBeforeSending=Délai avant envoi (en minutes)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user