mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Work on SMS features
This commit is contained in:
@@ -29,7 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("mails");
|
$langs->load("sms");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ else
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
|
||||||
print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM;
|
print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM;
|
||||||
if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_SMS_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
|
if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && ! isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) print img_warning($langs->trans("ErrorBadPhone"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Autocopy to
|
// Autocopy to
|
||||||
@@ -310,22 +310,20 @@ else
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once(DOL_DOCUMENT_ROOT."/core/class/html.formsms.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/core/class/html.formsms.class.php");
|
||||||
$formsms = new FormSms($db);
|
$formsms = new FormSms($db);
|
||||||
$formsms->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_SMS_FROM);
|
$formsms->fromtype='user';
|
||||||
$formsms->fromsms = (isset($_POST['fromsms'])?$_POST['fromsms']:$conf->global->MAIN_MAIL_SMS_FROM);
|
$formsms->fromid=$user->id;
|
||||||
|
$formsms->fromsms = (isset($_POST['fromsms'])?$_POST['fromsms']:($conf->global->MAIN_MAIL_SMS_FROM?$conf->global->MAIN_MAIL_SMS_FROM:$user->user_mobile));
|
||||||
$formsms->withfromreadonly=0;
|
$formsms->withfromreadonly=0;
|
||||||
$formsms->withsubstit=0;
|
$formsms->withsubstit=0;
|
||||||
$formsms->withfrom=1;
|
$formsms->withfrom=1;
|
||||||
$formsms->witherrorsto=1;
|
$formsms->witherrorsto=1;
|
||||||
$formsms->withto=(isset($_POST['sendto'])?$_POST['sendto']:$user->email?$user->email:1);
|
$formsms->withto=(isset($_POST['sendto'])?$_POST['sendto']:$user->user_mobile?$user->user_mobile:1);
|
||||||
$formsms->withtocc=(isset($_POST['sendtocc'])?$_POST['sendtocc']:1);
|
|
||||||
$formsms->withtoccc=(isset($_POST['sendtoccc'])?$_POST['sendtoccc']:1);
|
|
||||||
$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("PredefinedMailTest"));
|
||||||
$formsms->withbodyreadonly=0;
|
$formsms->withbodyreadonly=0;
|
||||||
$formsms->withcancel=1;
|
$formsms->withcancel=1;
|
||||||
$formsms->withdeliveryreceipt=1;
|
|
||||||
$formsms->withfckeditor=0;
|
$formsms->withfckeditor=0;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formsms->substit=$substitutionarrayfortest;
|
$formsms->substit=$substitutionarrayfortest;
|
||||||
@@ -335,13 +333,7 @@ else
|
|||||||
$formsms->param["mailid"]=$mil->id;
|
$formsms->param["mailid"]=$mil->id;
|
||||||
$formsms->param["returnurl"]=DOL_URL_ROOT."/admin/sms.php";
|
$formsms->param["returnurl"]=DOL_URL_ROOT."/admin/sms.php";
|
||||||
|
|
||||||
// Init list of files
|
$formsms->show_form();
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
|
||||||
{
|
|
||||||
$formsms->clear_attached_files();
|
|
||||||
}
|
|
||||||
|
|
||||||
$formsms->show_form('addfile','removefile');
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $object->client->contact_get_email($_POST['receiver']);
|
$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -936,7 +936,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $object->client->contact_get_email($_POST['receiver']);
|
$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1176,7 +1176,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $object->client->contact_get_email($_POST['receiver']);
|
$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,10 +179,10 @@ class FormMail
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Show the form to input an email
|
* Show the form to input an email
|
||||||
* \param addfileaction Name of action when posting file attachments
|
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||||
* \param removefileaction Name of action when removing file attachments
|
* @param addfileaction Name of action when posting file attachments
|
||||||
* \remarks this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
* @param removefileaction Name of action when removing file attachments
|
||||||
*/
|
*/
|
||||||
function show_form($addfileaction='addfile',$removefileaction='removefile')
|
function show_form($addfileaction='addfile',$removefileaction='removefile')
|
||||||
{
|
{
|
||||||
|
|||||||
304
htdocs/core/class/html.formsms.class.php
Executable file
304
htdocs/core/class/html.formsms.class.php
Executable file
@@ -0,0 +1,304 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/class/html.formmail.class.php
|
||||||
|
* \ingroup core
|
||||||
|
* \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
|
||||||
|
* \version $Id$
|
||||||
|
*/
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
/** \class FormSms
|
||||||
|
* \brief Classe permettant la generation du formulaire d'envoi de Sms
|
||||||
|
* \remarks Utilisation: $formsms = new FormSms($db)
|
||||||
|
* \remarks $formsms->proprietes=1 ou chaine ou tableau de valeurs
|
||||||
|
* \remarks $formsms->show_form() affiche le formulaire
|
||||||
|
*/
|
||||||
|
class FormSms
|
||||||
|
{
|
||||||
|
var $db;
|
||||||
|
|
||||||
|
var $fromname;
|
||||||
|
var $fromsms;
|
||||||
|
var $replytoname;
|
||||||
|
var $replytomail;
|
||||||
|
var $toname;
|
||||||
|
var $tomail;
|
||||||
|
|
||||||
|
var $withsubstit; // Show substitution array
|
||||||
|
var $withfrom;
|
||||||
|
var $withto;
|
||||||
|
var $withtopic;
|
||||||
|
var $withbody;
|
||||||
|
|
||||||
|
var $withfromreadonly;
|
||||||
|
var $withreplytoreadonly;
|
||||||
|
var $withtoreadonly;
|
||||||
|
var $withtopicreadonly;
|
||||||
|
var $withcancel;
|
||||||
|
|
||||||
|
var $substit=array();
|
||||||
|
var $param=array();
|
||||||
|
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Constructeur
|
||||||
|
* \param DB handler d'acces base de donnee
|
||||||
|
*/
|
||||||
|
function FormSms($DB)
|
||||||
|
{
|
||||||
|
$this->db = $DB;
|
||||||
|
|
||||||
|
$this->withfrom=1;
|
||||||
|
$this->withto=1;
|
||||||
|
$this->withtopic=1;
|
||||||
|
$this->withbody=1;
|
||||||
|
|
||||||
|
$this->withfromreadonly=1;
|
||||||
|
$this->withreplytoreadonly=1;
|
||||||
|
$this->withtoreadonly=0;
|
||||||
|
$this->withtopicreadonly=0;
|
||||||
|
$this->withbodyreadonly=0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form to input an email
|
||||||
|
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||||
|
*/
|
||||||
|
function show_form()
|
||||||
|
{
|
||||||
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("mails");
|
||||||
|
$langs->load("sms");
|
||||||
|
|
||||||
|
$form=new Form($DB);
|
||||||
|
|
||||||
|
print "\n<!-- Debut form mail -->\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'].'">';
|
||||||
|
foreach ($this->param as $key=>$value)
|
||||||
|
{
|
||||||
|
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
|
||||||
|
}
|
||||||
|
print "<table class=\"border\" width=\"100%\">\n";
|
||||||
|
|
||||||
|
// Substitution array
|
||||||
|
if ($this->withsubstit)
|
||||||
|
{
|
||||||
|
print "<tr><td colspan=\"2\">";
|
||||||
|
$help="";
|
||||||
|
foreach($this->substit as $key => $val)
|
||||||
|
{
|
||||||
|
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
||||||
|
}
|
||||||
|
print $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// From
|
||||||
|
if ($this->withfrom)
|
||||||
|
{
|
||||||
|
if ($this->withfromreadonly)
|
||||||
|
{
|
||||||
|
print '<input type="hidden" name="fromsms" value="'.$this->fromsms.'">';
|
||||||
|
print "<tr><td width=\"180\">".$langs->trans("SmsFrom")."</td><td>";
|
||||||
|
if ($this->fromtype == 'user')
|
||||||
|
{
|
||||||
|
$langs->load("users");
|
||||||
|
$fuser=new User($this->db);
|
||||||
|
$fuser->fetch($this->fromid);
|
||||||
|
print $fuser->getNomUrl(1);
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
if ($this->fromsms)
|
||||||
|
{
|
||||||
|
print $this->fromsms;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->fromtype)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print '<font class="warning"> <'.$langs->trans("ErrorNoPhoneDefinedForThisUser").'> </font>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<tr><td>".$langs->trans("SmsFrom")."</td><td>";
|
||||||
|
print '<input type="text" name="fromname" size="30" value="'.$this->fromsms.'">';
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// To
|
||||||
|
if ($this->withto || is_array($this->withto))
|
||||||
|
{
|
||||||
|
print '<tr><td width="180">';
|
||||||
|
print $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
|
print '</td><td>';
|
||||||
|
if ($this->withtoreadonly)
|
||||||
|
{
|
||||||
|
print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
|
||||||
|
}
|
||||||
|
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) :"")."\">";
|
||||||
|
if ($this->withtosocid > 0)
|
||||||
|
{
|
||||||
|
$liste=array();
|
||||||
|
$liste[0]=' ';
|
||||||
|
$soc=new Societe($this->db);
|
||||||
|
$soc->fetch($this->withtosocid);
|
||||||
|
foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value)
|
||||||
|
{
|
||||||
|
$liste[$key]=$value;
|
||||||
|
}
|
||||||
|
print " ".$langs->trans("or")." ";
|
||||||
|
//var_dump($_REQUEST);exit;
|
||||||
|
print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Topic
|
||||||
|
/*
|
||||||
|
if ($this->withtopic)
|
||||||
|
{
|
||||||
|
$this->withtopic=make_substitutions($this->withtopic,$this->substit,$langs);
|
||||||
|
|
||||||
|
print "<tr>";
|
||||||
|
print "<td width=\"180\">".$langs->trans("MailTopic")."</td>";
|
||||||
|
print "<td>";
|
||||||
|
if ($this->withtopicreadonly)
|
||||||
|
{
|
||||||
|
print $this->withtopic;
|
||||||
|
print "<input type=\"hidden\" size=\"60\" name=\"subject\" value=\"".$this->withtopic."\">";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<input type=\"text\" size=\"60\" name=\"subject\" value=\"". (isset($_POST["subject"])?$_POST["subject"]:$this->withtopic) ."\">";
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Message
|
||||||
|
if ($this->withbody)
|
||||||
|
{
|
||||||
|
$defaultmessage=$langs->transnoentities("ThisIsATestMessage");
|
||||||
|
|
||||||
|
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
|
||||||
|
/*if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); }
|
||||||
|
if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||||
|
if ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); }
|
||||||
|
if ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); }
|
||||||
|
if ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||||
|
if ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } */
|
||||||
|
$defaultmessage=make_substitutions($defaultmessage,$this->substit,$langs);
|
||||||
|
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
||||||
|
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||||
|
|
||||||
|
print "<tr>";
|
||||||
|
print "<td width=\"180\" valign=\"top\">".$langs->trans("SmsText")."</td>";
|
||||||
|
print "<td>";
|
||||||
|
if ($this->withbodyreadonly)
|
||||||
|
{
|
||||||
|
print nl2br($defaultmessage);
|
||||||
|
print '<input type="hidden" name="message" value="'.$defaultmessage.'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Editeur wysiwyg
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
|
$doleditor=new DolEditor('message',$defaultmessage,'',128,'dolibarr_notes','In',true,false,$this->withfckeditor,3,72);
|
||||||
|
$doleditor->Create();
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align=center colspan=2><center>";
|
||||||
|
print "<input class=\"button\" type=\"submit\" name=\"sendmail\" value=\"".$langs->trans("SendSms")."\"";
|
||||||
|
print ">";
|
||||||
|
if ($this->withcancel)
|
||||||
|
{
|
||||||
|
print " ";
|
||||||
|
print "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"".$langs->trans("Cancel")."\">";
|
||||||
|
}
|
||||||
|
print "</center></td></tr>\n";
|
||||||
|
print "</table>\n";
|
||||||
|
|
||||||
|
print "</form>\n";
|
||||||
|
print "<!-- Fin form mail -->\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>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -637,7 +637,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $commande->client->contact_get_email($_POST['receiver']);
|
$sendto = $commande->client->contact_get_property($_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -687,7 +687,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $facturefourn->client->contact_get_email($_POST['receiver']);
|
$sendto = $facturefourn->client->contact_get_property($_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,6 +231,9 @@ MAIN_MAIL_SENDMODE=Method to use to send EMails
|
|||||||
MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required
|
MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required
|
||||||
MAIN_MAIL_SMTPS_PW=SMTP Password if authentication required
|
MAIN_MAIL_SMTPS_PW=SMTP Password if authentication required
|
||||||
MAIN_MAIL_EMAIL_TLS= Use TLS (SSL) encrypt
|
MAIN_MAIL_EMAIL_TLS= Use TLS (SSL) encrypt
|
||||||
|
MAIN_DISABLE_ALL_SMS=Disable all SMS sendings (for test purposes or demos)
|
||||||
|
MAIN_SMS_SENDMODE=Method to use to send SMS
|
||||||
|
MAIN_MAIL_SMS_FROM=Sender phone number for Sms sending
|
||||||
FeatureNotAvailableOnLinux=Feature not available on Unix like systems. Test your sendmail program locally.
|
FeatureNotAvailableOnLinux=Feature not available on Unix like systems. Test your sendmail program locally.
|
||||||
SubmitTranslation=If translation for this language is not complete or you find errors, you can correct this by editing files into directory <b>langs/%s</b> and submit modified files on www.dolibarr.org forum.
|
SubmitTranslation=If translation for this language is not complete or you find errors, you can correct this by editing files into directory <b>langs/%s</b> and submit modified files on www.dolibarr.org forum.
|
||||||
ModuleSetup=Module setup
|
ModuleSetup=Module setup
|
||||||
|
|||||||
@@ -232,6 +232,9 @@ MAIN_MAIL_SENDMODE= Méthode d'envoi des mails
|
|||||||
MAIN_MAIL_SMTPS_ID= SMTP Authentification ID si authentification SMTP requise
|
MAIN_MAIL_SMTPS_ID= SMTP Authentification ID si authentification SMTP requise
|
||||||
MAIN_MAIL_SMTPS_PW= SMTP Authentification Password si authentification SMTP requise
|
MAIN_MAIL_SMTPS_PW= SMTP Authentification Password si authentification SMTP requise
|
||||||
MAIN_MAIL_EMAIL_TLS= Utilisation du cryptage TLS (SSL)
|
MAIN_MAIL_EMAIL_TLS= Utilisation du cryptage TLS (SSL)
|
||||||
|
MAIN_DISABLE_ALL_SMS=Désactiver globalement tout envoi de Sms (pour mode test ou démos)
|
||||||
|
MAIN_SMS_SENDMODE=Méthode d'envoi des SMS
|
||||||
|
MAIN_MAIL_SMS_FROM=Téléphone émetteur pour envoi Sms
|
||||||
FeatureNotAvailableOnLinux= Fonctionnalité non disponible sous systèmes Unix. Tester votre sendmail localement.
|
FeatureNotAvailableOnLinux= Fonctionnalité non disponible sous systèmes Unix. Tester votre sendmail localement.
|
||||||
SubmitTranslation=Si la traduction pour cette langue est incomplète ou si vous trouvez des erreurs, vous pouvez les corriger en éditant les fichiers dans le répertoire <b>langs/%s</b> et soumettre les modifications sur le forum www.dolibarr.fr.
|
SubmitTranslation=Si la traduction pour cette langue est incomplète ou si vous trouvez des erreurs, vous pouvez les corriger en éditant les fichiers dans le répertoire <b>langs/%s</b> et soumettre les modifications sur le forum www.dolibarr.fr.
|
||||||
ModuleSetup= Configuration du module
|
ModuleSetup= Configuration du module
|
||||||
|
|||||||
49
htdocs/langs/fr_FR/sms.lang
Executable file
49
htdocs/langs/fr_FR/sms.lang
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
# Dolibarr language file - fr_FR - mails
|
||||||
|
CHARSET=UTF-8
|
||||||
|
Sms=Sms
|
||||||
|
SmsSetup=Configuration des Sms
|
||||||
|
SmsDesc=Cet écran vous permet de définir les options globales d'utilisation des fonctions SMS.
|
||||||
|
SmsCard=Fiche SMS
|
||||||
|
AllSms=Toutes les campagnes SMS
|
||||||
|
SmsTargets=Destinataires
|
||||||
|
SmsRecipients=Destinataires
|
||||||
|
SmsRecipient=Destinataire
|
||||||
|
SmsTitle=Description
|
||||||
|
SmsFrom=Émetteur
|
||||||
|
SmsTo=Destinataire(s)
|
||||||
|
SmsTopic=Sujet du mail
|
||||||
|
SmsText=Message
|
||||||
|
SmsMessage=Message du mail
|
||||||
|
ShowSms=Afficher Sms
|
||||||
|
ListOfSms=Liste des campagnes SMS
|
||||||
|
NewSms=Nouvelle campagne SMS
|
||||||
|
EditSms=Éditer sms
|
||||||
|
ResetSms=Nouvel envoi
|
||||||
|
DeleteSms=Supprimer campagne Sms
|
||||||
|
DeleteASms=Supprimer une campagne Sms
|
||||||
|
PreviewSms=Prévisualiser Sms
|
||||||
|
PrepareSms=Préparer Sms
|
||||||
|
CreateSms=Créer Sms
|
||||||
|
SmsResult=Résultat de l'envoi de Sms
|
||||||
|
TestSms=Tester Sms
|
||||||
|
ValidSms=Valider Sms
|
||||||
|
ApproveSms=Approuver Sms
|
||||||
|
SmsStatusDraft=Brouillon
|
||||||
|
SmsStatusValidated=Validé
|
||||||
|
SmsStatusApproved=Approuvé
|
||||||
|
SmsStatusSent=Envoyé
|
||||||
|
SmsStatusSentPartialy=Envoyé partiellement
|
||||||
|
SmsStatusSentCompletely=Envoyé complètement
|
||||||
|
SmsStatusError=Erreur
|
||||||
|
SmsStatusNotSent=Non envoyé
|
||||||
|
SmsSuccessfulySent=Sms correctement envoyé (de %s à %s)
|
||||||
|
ErrorSmsRecipientIsEmpty=Le numéro du destinataire est vide
|
||||||
|
WarningNoSmsAdded=Aucun nouvel numéro de téléphone à ajouter à la liste des destinataires.
|
||||||
|
ConfirmValidSms=Confirmez-vous la validation de cette campagne ?
|
||||||
|
ConfirmResetMailing=Attention, en réinitialisant la campagne Sms <b>%s</b>, vous autorisez son émission en masse une nouvelle fois. Est-ce bien ce que vous voulez faire ?
|
||||||
|
ConfirmDeleteMailing=Confirmez-vous la suppression de la campagne ?
|
||||||
|
NbOfRecipients=Nombre de destinataires
|
||||||
|
NbOfUniqueSms=Nb de téléphone uniques
|
||||||
|
NbOfSms=Nbre de téléphone
|
||||||
|
ThisIsATestMessage=Ceci est un message de test
|
||||||
|
SendSms=Envoyer SMS
|
||||||
@@ -1056,7 +1056,7 @@ function dol_print_ip($ip,$mode=0)
|
|||||||
/**
|
/**
|
||||||
* Return true if email syntax is ok.
|
* Return true if email syntax is ok.
|
||||||
* @param address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
* @param address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||||
* @return boolean true if email syntax is OK, false if KO or empty string/
|
* @return boolean true if email syntax is OK, false if KO or empty string
|
||||||
*/
|
*/
|
||||||
function isValidEmail($address)
|
function isValidEmail($address)
|
||||||
{
|
{
|
||||||
@@ -1075,6 +1075,16 @@ function isValidEmail($address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if phone number syntax is ok.
|
||||||
|
* @param address phone (Ex: "0601010101")
|
||||||
|
* @return boolean true if phone syntax is OK, false if KO or empty string
|
||||||
|
*/
|
||||||
|
function isValidPhone($address)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a strlen call. Works even if mbstring module not enabled.
|
* Make a strlen call. Works even if mbstring module not enabled.
|
||||||
|
|||||||
@@ -1409,14 +1409,14 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la liste des contacts emails existant pour la societe
|
* Return list of contacts emails existing for third party
|
||||||
* \return array tableau des contacts emails
|
* @return array Array of contacts emails
|
||||||
*/
|
*/
|
||||||
function thirdparty_and_contact_email_array()
|
function thirdparty_and_contact_email_array()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$contact_email = $this->contact_email_array();
|
$contact_email = $this->contact_property_array('email');
|
||||||
if ($this->email)
|
if ($this->email)
|
||||||
{
|
{
|
||||||
if (empty($this->name)) $this->name=$this->nom;
|
if (empty($this->name)) $this->name=$this->nom;
|
||||||
@@ -1427,14 +1427,33 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la liste des contacts emails existant pour la societe
|
* Return list of contacts mobile phone existing for third party
|
||||||
* \return array tableau des contacts emails
|
* @return array Array of contacts emails
|
||||||
*/
|
*/
|
||||||
function contact_email_array()
|
function thirdparty_and_contact_phone_array()
|
||||||
{
|
{
|
||||||
$contact_email = array();
|
global $langs;
|
||||||
|
|
||||||
$sql = "SELECT rowid, email, name, firstname";
|
$contact_phone = $this->contact_property_array('mobile');
|
||||||
|
if ($this->tel)
|
||||||
|
{
|
||||||
|
if (empty($this->name)) $this->name=$this->nom;
|
||||||
|
// TODO: Tester si tel non deja present dans tableau contact
|
||||||
|
$contact_phone[-1]=$langs->trans("ThirdParty").': '.dol_trunc($this->nom,16)." <".$this->tel.">";
|
||||||
|
}
|
||||||
|
return $contact_phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of contacts emails or mobile existing for third party
|
||||||
|
* @param mode 'email' or 'mobile'
|
||||||
|
* @return array Array of contacts emails or mobile
|
||||||
|
*/
|
||||||
|
function contact_property_array($mode='email')
|
||||||
|
{
|
||||||
|
$contact_property = array();
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, email, phone_mobile, name, firstname";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
|
||||||
$sql.= " WHERE fk_soc = '".$this->id."'";
|
$sql.= " WHERE fk_soc = '".$this->id."'";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@@ -1447,7 +1466,9 @@ class Societe extends CommonObject
|
|||||||
while ($i < $nump)
|
while ($i < $nump)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$contact_email[$obj->rowid] = trim($obj->firstname." ".$obj->name)." <".$obj->email.">";
|
if ($mode == 'email') $property=$obj->email;
|
||||||
|
else if ($mode == 'mobile') $property=$obj->phone_mobile;
|
||||||
|
$contact_property[$obj->rowid] = trim($obj->firstname." ".$obj->name)." <".$property.">";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1456,7 +1477,7 @@ class Societe extends CommonObject
|
|||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
return $contact_email;
|
return $contact_property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1492,13 +1513,18 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return email of contact from its id
|
* Return property of contact from its id
|
||||||
* @param rowid id of contact
|
* @param rowid id of contact
|
||||||
|
* @param mode 'email' or 'mobile'
|
||||||
* @return string email of contact
|
* @return string email of contact
|
||||||
*/
|
*/
|
||||||
function contact_get_email($rowid)
|
function contact_get_property($rowid,$mode)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE rowid = '".$rowid."'";
|
$contact_property='';
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, email, phone_mobile, name, firstname";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
|
||||||
|
$sql.= " WHERE rowid = '".$rowid."'";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@@ -1507,13 +1533,12 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
if ($nump)
|
if ($nump)
|
||||||
{
|
{
|
||||||
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$contact_email = "$obj->firstname $obj->name <$obj->email>";
|
if ($mode == 'email') $contact_property = "$obj->firstname $obj->name <$obj->email>";
|
||||||
|
else if ($mode == 'mobile') $contact_property = $obj->phone_mobile;
|
||||||
}
|
}
|
||||||
return $contact_email;
|
return $contact_property;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user