From 6043a0b8732bc61845c02f02e97b21642c0c32d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Mar 2011 15:45:46 +0000 Subject: [PATCH] Work on SMS features --- htdocs/admin/sms.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/html.formsms.class.php | 91 +++++++++++++++++++----- htdocs/langs/fr_FR/sms.lang | 4 ++ 4 files changed, 79 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index a787e39bcc7..75755594274 100755 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -321,7 +321,7 @@ else $formsms->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test")); $formsms->withtopicreadonly=0; $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->withcancel=1; $formsms->withfckeditor=0; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 9255e245d3e..16a8a38653a 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -192,7 +192,7 @@ class Conf { $module=strtolower($reg[1]); // 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 elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg)) diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index f5ea6025118..be5807fda9e 100755 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -84,8 +84,7 @@ class FormSms } /** - * Show the form to input an email - * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files + * Show the form to input an sms */ function show_form() { @@ -96,8 +95,27 @@ class FormSms $langs->load("sms"); $form=new Form($DB); + $soc=new Societe($this->db); + if ($this->withtosocid > 0) + { + $soc->fetch($this->withtosocid); + } + + print "\n\n"; + + print ' +'; - print "\n\n"; print "
param["returnurl"]."\">\n"; print ''; foreach ($this->param as $key=>$value) @@ -152,8 +170,26 @@ class FormSms else { print "".$langs->trans("SmsFrom").""; - print ''; - print "\n"; + //print ''; + print ''; + print ''; + print "\n"; } } @@ -161,7 +197,9 @@ class FormSms if ($this->withto || is_array($this->withto)) { print ''; - print $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); + //$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"); + $moretext=''; + print $form->textwithpicto($langs->trans("SmsTo"),$moretext); print ''; if ($this->withtoreadonly) { @@ -169,14 +207,12 @@ class FormSms } else { - print "withto)?"30":"60")."\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"")."\">"; + print "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) + foreach ($soc->thirdparty_and_contact_phone_array() as $key=>$value) { $liste[$key]=$value; } @@ -184,6 +220,7 @@ class FormSms //var_dump($_REQUEST);exit; print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0); } + print ' '.$langs->trans("SmsInfoNumero"); } print "\n"; } @@ -212,8 +249,7 @@ class FormSms // Message if ($this->withbody) { - $defaultmessage=$langs->transnoentities("ThisIsATestMessage"); - + $defaultmessage=''; 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"); } @@ -235,15 +271,34 @@ class FormSms } 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 ''; + print '
'.$langs->trans("SmsInfoCharRemain").': '.(160-dol_strlen($defaultmessage)).'
'; } print "\n"; } - print "
"; + print ' + + '.$langs->trans("DelayBeforeSending").': + + + '.$langs->trans("Type").' : + + + '.$langs->trans("Priority").' : + '; + + print '
'; print "trans("SendSms")."\""; print ">"; if ($this->withcancel) @@ -255,7 +310,7 @@ class FormSms print "\n"; print "\n"; - print "\n"; + print "\n"; } diff --git a/htdocs/langs/fr_FR/sms.lang b/htdocs/langs/fr_FR/sms.lang index d9406d1a59c..9097f0268de 100755 --- a/htdocs/langs/fr_FR/sms.lang +++ b/htdocs/langs/fr_FR/sms.lang @@ -47,3 +47,7 @@ NbOfUniqueSms=Nb de téléphone uniques NbOfSms=Nbre de téléphone ThisIsATestMessage=Ceci est un message de test SendSms=Envoyer SMS +SmsInfoCharRemain=Nb de caractères restant +SmsInfoNumero= (format international ex : +33899701761) +DelayBeforeSending=Délai avant envoi (en minutes) +