New: SMS sending now works with OVH

This commit is contained in:
Laurent Destailleur 2011-03-06 21:44:28 +00:00
parent 0c1e2a21e2
commit 5b4434d6a6
3 changed files with 10 additions and 51 deletions

View File

@ -38,7 +38,8 @@ accessforbidden();
$substitutionarrayfortest=array(
'__ID__' => 'TESTIdRecord',
'__EMAIL__' => 'TESTEMail',
'__PHONEFROM__' => 'TESTPhoneFrom',
'__PHONETO__' => 'TESTPhoneTo',
'__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname'
);

View File

@ -86,7 +86,7 @@ class FormSms
/**
* Show the form to input an sms
*/
function show_form()
function show_form($width='180px')
{
global $conf, $langs, $user;
@ -133,7 +133,7 @@ function limitChars(textarea, limit, infodiv)
{
$help.=$key.' -> '.$langs->trans($val).'<br>';
}
print $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
print $form->textwithpicto($langs->trans("SmsTestSubstitutionReplacedByGenericValues"),$help);
print "</td></tr>\n";
}
@ -143,7 +143,7 @@ function limitChars(textarea, limit, infodiv)
if ($this->withfromreadonly)
{
print '<input type="hidden" name="fromsms" value="'.$this->fromsms.'">';
print "<tr><td width=\"180\">".$langs->trans("SmsFrom")."</td><td>";
print "<tr><td width=\"".$width."\">".$langs->trans("SmsFrom")."</td><td>";
if ($this->fromtype == 'user')
{
$langs->load("users");
@ -169,7 +169,7 @@ function limitChars(textarea, limit, infodiv)
}
else
{
print "<tr><td>".$langs->trans("SmsFrom")."</td><td>";
print "<tr><td width=\"".$width."\">".$langs->trans("SmsFrom")."</td><td>";
//print '<input type="text" name="fromname" size="30" value="'.$this->fromsms.'">';
if ($conf->global->MAIN_SMS_SENDMODE == 'ovh')
{
@ -318,47 +318,6 @@ function limitChars(textarea, limit, infodiv)
print "<!-- Fin form SMS -->\n";
}
/**
* \brief Affiche la partie de formulaire pour saisie d'un sms
* \param withtopic 1 pour proposer a la saisie le sujet
* \param withbody 1 pour proposer a la saisie le corps du message
* \param withfile 1 pour proposer a la saisie l'ajout d'un fichier joint
* \todo Fonction a virer quand fichier /comm/mailing.php vire (= quand ecran dans /comm/mailing prets)
*/
function sms_topicmessagefile($withtopic=1,$withbody=1,$withfile=1,$defaultbody)
{
global $langs;
$langs->load("other");
print "<table class=\"border\" width=\"100%\">";
// Topic
if ($withtopic)
{
print "<tr>";
print "<td width=\"180\">".$langs->trans("MailTopic")."</td>";
print "<td>";
print "<input type=\"text\" size=\"60\" name=\"subject\" value=\"\">";
print "</td></tr>";
}
// Message
if ($withbody)
{
print "<tr>";
print "<td width=\"180\" valign=\"top\">".$langs->trans("MailText")."</td>";
print "<td>";
print "<textarea rows=\"8\" cols=\"72\" name=\"message\">";
print $defaultbody;
print "</textarea>";
print "</td></tr>";
}
print "</table>";
}
}
?>

View File

@ -134,15 +134,14 @@ class CSMSFile
$ovhsms->class=$this->class;
$res=$ovhsms->SmsSend();
if (! $res)
if ($res <= 0)
{
$this->error="Failed to send SMS<br>Check your server logs and your firewalls setup";
dol_syslog("CSMSFile::sendfile: mail end error=".$this->error, LOG_ERROR);
$this->error=$ovhsms->error;
dol_syslog("CSMSFile::sendfile: sms send error=".$this->error, LOG_ERROR);
}
else
{
dol_syslog("CSMSFile::sendfile: mail end success", LOG_DEBUG);
dol_syslog("CSMSFile::sendfile: sms send success", LOG_DEBUG);
}
}
else