Hello,

Attached patches for:
- run the module "ovhsms" with the core functions (and setup) of
Dolibarr 3.1
- be able to add a field hidden 'socid' in SMS form


greetings
>From 544fe356f80c07fdca08dfd429765894ffa13165 Mon Sep 17 00:00:00 2001
From: jfefe <[email protected]>
Date: Mon, 17 Oct 2011 00:33:31 +0200
Subject: [PATCH 2/4] Fix:  work with ovhsms module

---
 htdocs/core/class/html.formsms.class.php |    4 ++--
 htdocs/lib/CSMSFile.class.php            |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php
index 68dedb7..c425471 100755
--- a/htdocs/core/class/html.formsms.class.php
+++ b/htdocs/core/class/html.formsms.class.php
@@ -170,9 +170,9 @@ function limitChars(textarea, limit, infodiv)
 			{
 				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')
+				if ($conf->global->MAIN_SMS_SENDMODE == 'ovhsms')
                 {
-                    dol_include_once('/ovh/class/ovhsms.class.php');
+                    dol_include_once('/ovhsms/class/ovhsms.class.php');
                     try
                     {
                         $sms = new OvhSms($this->db);
diff --git a/htdocs/lib/CSMSFile.class.php b/htdocs/lib/CSMSFile.class.php
index 1ac2edc..f1ccce5 100755
--- a/htdocs/lib/CSMSFile.class.php
+++ b/htdocs/lib/CSMSFile.class.php
@@ -77,7 +77,7 @@ class CSMSFile
 		dol_syslog("CSMSFile::CSMSFile: deliveryreceipt=".$deliveryreceipt." deferred=".$deferred." priority=".$priority." class=".$class, LOG_DEBUG);
 
 		// Action according to choosed sending method
-		if ($conf->global->MAIN_SMS_SENDMODE == 'ovh')
+		if ($conf->global->MAIN_SMS_SENDMODE == 'ovhsms')
 		{
 		    $this->addr_from=$from;
 		    $this->addr_to=$to;
@@ -121,9 +121,9 @@ class CSMSFile
 		if (empty($conf->global->MAIN_DISABLE_ALL_SMS))
 		{
 			// Action according to choosed sending method
-			if ($conf->global->MAIN_SMS_SENDMODE == 'ovh')
+			if ($conf->global->MAIN_SMS_SENDMODE == 'ovhsms')
 			{
-				dol_include_once('/ovh/class/ovhsms.class.php');
+				dol_include_once('/ovhsms/class/ovhsms.class.php');
 				$ovhsms=new OvhSms($this->db);
 				//$ovhsms->session='';
 				//$ovhsms->account='';
-- 
1.7.2.5

>From 17bdcba4de393e76bbc20f07b160ec668215a30b Mon Sep 17 00:00:00 2001
From: jfefe <[email protected]>
Date: Mon, 17 Oct 2011 00:48:04 +0200
Subject: [PATCH 3/4] Fix : JS limit char

---
 htdocs/core/class/html.formsms.class.php |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php
index c425471..f0d5a54 100755
--- a/htdocs/core/class/html.formsms.class.php
+++ b/htdocs/core/class/html.formsms.class.php
@@ -224,7 +224,7 @@ function limitChars(textarea, limit, infodiv)
 			}
 			else
 			{
-			    print "<input size=\"16\" name=\"sendto\" value=\"".(! is_array($this->withto) && $this->withto != '1'? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto):"+")."\">";
+			    print "<input size=\"16\" id=\"dest\" name=\"sendto\" value=\"".(! is_array($this->withto) && $this->withto != '1'? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto):"+")."\">";
 				if (! empty($this->withtosocid) && $this->withtosocid > 0)
 				{
 					$liste=array();
@@ -261,7 +261,7 @@ function limitChars(textarea, limit, infodiv)
 			else
 			{
                 print '<textarea cols="40" name="message" id="message" rows="4" onkeyup="limitChars(this, 160, \'charlimitinfo\')">'.$defaultmessage.'</textarea>';
-                print '<div id="charlimitinfo">'.$langs->trans("SmsInfoCharRemain").': '.(160-dol_strlen($defaultmessage)).'</div></td>';
+				print '<div  style="color:#aa3333; font-size:12px; font-family:vardana" >'.$langs->trans("SmsInfoCharRemain").' : <span id="charlimitinfo" >'. ( 160 - dol_strlen($defaultmessage)).'</span></div></td>';
 			}
 			print "</td></tr>\n";
 		}
-- 
1.7.2.5

>From 0cb805fcfac05970e194521f5951403ec4d9a9eb Mon Sep 17 00:00:00 2001
From: jfefe <[email protected]>
Date: Mon, 17 Oct 2011 01:51:12 +0200
Subject: [PATCH 4/4] Nice error message
 Add input socid into sms form

---
 htdocs/admin/sms.php                     |    4 ++--
 htdocs/core/class/html.formsms.class.php |   10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php
index 342289a..f0390a3 100755
--- a/htdocs/admin/sms.php
+++ b/htdocs/admin/sms.php
@@ -152,8 +152,8 @@ print_fiche_titre($langs->trans("SmsSetup"),'','setup');
 print $langs->trans("SmsDesc")."<br>\n";
 print "<br>\n";
 
-if ($message) print $message.'<br>';
-
+if ($message)
+   dol_htmloutput_mesg($message);
 // List of sending methods
 $listofmethods=(is_array($conf->sms_engine)?$conf->sms_engine:array());
 asort($listofmethods);
diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php
index f0d5a54..ee4f772 100755
--- a/htdocs/core/class/html.formsms.class.php
+++ b/htdocs/core/class/html.formsms.class.php
@@ -53,6 +53,8 @@ class FormSms
 	var $withtoreadonly;
 	var $withtopicreadonly;
 	var $withcancel;
+	
+	var $socidsms;
 
 	var $substit=array();
 	var $param=array();
@@ -78,6 +80,8 @@ class FormSms
 		$this->withtoreadonly=0;
 		$this->withtopicreadonly=0;
 		$this->withbodyreadonly=0;
+		
+		$this->withsocidreadonly=1;
 
 		return 1;
 	}
@@ -214,12 +218,18 @@ function limitChars(textarea, limit, infodiv)
 		if ($this->withto || is_array($this->withto))
 		{
 			print '<tr><td width="180">';
+			
+			if ($this->withsocidreadonly)
+			{
+				print '<input type="hidden" name="socid" value="'.$this->socidsms.'">';
+			}
 			//$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients");
 			$moretext='';
 			print $form->textwithpicto($langs->trans("SmsTo"),$moretext);
 			print '</td><td>';
 			if ($this->withtoreadonly)
 			{
+				
 				print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
 			}
 			else
-- 
1.7.2.5

_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à