Implement SMS on SugarCRM meeting module

Implement SMS on SugarCRM meeting module

April 24, 2018 PHP SugarCRM Uncategorized 0

Step 1: first make one checkbox on meeting module name send_sms_c

Step 2: write below code on /var/www/D2/include/javascript/sugar_grp1.js after line:135

 

function check_form(formname){var go_func = 0; var str1 = location.href; var str2 = 'ModuleBuilder'; var url_check =str1.indexOf(str2);if (( url_check == -1 ) && (typeof(module_sugar_grp1) != 'undefined')){funcmod (module_sugar_grp1);};if(typeof(siw)!='undefined'&&siw&&typeof(siw.selectingSomething)!='undefined'&&siw.selectingSomething)return false;return validate_form(formname,'');}

 

function funcmod(mod1){  if((mod1 == 'Meetings') && (action_sugar_grp1 == "EditView")){if(document.getElementById('send_sms_c').checked == true){window.open('meet.php?p='+parent_id.value+'&date1='+date_start.value+'&des='+description.value,'SMS','width=600, height=300');}return true;}}

Step 3 : make one file name meet.php on the /var/www/D2/

<?php
require_once($sugarRoot . 'config.php'); /////// here include config file from particular path $con=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
$db=mysql_select_db($sugar_config['dbconfig']['db_name'],$con);
?>
<?php
if($_GET['p']=='')
{
echo"<center><h3><font color='#FF0000'>contact is not selected</font></h3></center>";
echo" <script>setTimeout('self.close()',1300 )</script>"; // after 5 seconds
//echo"<script>window.close();</script>";
exit;
}
else if($_GET['p']!="")
{
//http://localhost/crm/cou.php?p=account&date1=08/28/2010&docno=ws&coutype=SaleReplSent&duedate=08/29/2010&des=cv
$accval = $_GET['p'];
$datesent = $_GET['date1'] ;
// $codno = $_GET['docno'];
// $contact = $_GET['contact'];
// $duedate = $_GET['duedate'];
$des = $_GET['des'] ;
//echo $accval;
$qryid = "select * from contacts where id='".$accval."'" ;
$resarr = mysql_query($qryid);
$fet = mysql_fetch_array($resarr);
// echo $fet['id'];
//$resarr = mysql_query($qryid);
//exit;
$qrymob = "select phone_mobile from contacts where id='".$fet["id"]."'" ;
$remob = mysql_query($qrymob);
$fet = mysql_fetch_array($remob);
// echo $fet['phone_alternate'];
}
if($_POST["submit"]=="Send")
{
// $m = trim($_POST["msgtxt"]); //text area value
// $noval = $_POST["mobtxt"]; // mobile no
// $nozero = substr($noval,2,11);//0
// echo "<script>alert ($nozero) </script>";
//exit;
// $p = '91'.$nozero; //91mobileno
//echo $p;exit;
$con = mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
$db = mysql_select_db($sugar_config['dbconfig']['db_name'],$con);
// $selqry = "select * from config where name='url'";
$no = $_POST["mobtxt"];
$p = '91'.$no;
$m = $_POST["msgtxt"];
$m=rawurlencode($m);
// $catid = $_POST["smslist"];
//$tx = $_POST["txt"];
//$m=rawurlencode($m);
$str="user=username&password=parekh1234&sender=sendername&sender=919860609000&text=$m&PhoneNumber=$p&track=1";
ob_start();
header("Location:http://www.sms.in/sendsmsv2.asp?$str");
ob_flush();
}
?>
<html>
<head>
<link rel="stylesheet" href="fonts.larger.css"/>
</head>
<body >
<title>SMS Window</title>
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript">
function fundiv()
{
//alert("hi");
document.getElementById("div1").style.display="block";
document.getElementById("div2").style.display="block";
}
function fun()
{
document.getElementById('sp').disabled=false;
//alert(document.getElementById('sp').value);
}
function CountLeft( field,count,max)
{
if (field.value.length >max)
field.value = field.value.substring(0,max);
else
document.getElementById('sp').innerHTML =max- field.value.length;
}
function valid()
{
//alert("hi");
if(document.fname.addcatname.value=="")
{
alert("Enter SMS Name");
document.fname.addcatname.focus();
return false;
}
//document.getElementById("div1").style.display="block";
//document.getElementById("div2").style.display="block";
}
</script>
<form name='fname' method='post' action=''>
<table border='0' cellpadding='2' cellspacing='2' bgcolor="#FFFFFF" style="width:400px" >
<tr><td colspan="2">
<center><strong><i><h1>MEETING Schedule</h1><i></strong></center>
</td></tr>
<tr>
<td>Enter Mob No&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<input type='text' class="text-2" name='mobtxt' id='mobtxt' value=" <?php echo $fet['phone_mobile']; ?>" style="width:121px"/>
</td>
</tr>
<tr>
<td valign="top">Enter Message</td>
<td>
<textarea name="msgtxt" class="text-2" id="msgtxt" rows="5" cols="30" onChange="fun() onKeyDown="CountLeft(this.msgtxt.text,'sp',130);"onKeyUp="CountLeft(this.form.msgtxt,'sp',130);">
<?php echo "Meeting Start Dt&Time:".$datesent;?>
<?php echo " Des:".$des; ?></textarea>
</td>
</tr>
<tr>
<td valign="top"></td>
<td>
<!-- <input type="text" name="txt" id="txt" disabled="disabled" onKeyDown="CountLeft(this.txt.text,'sp',150);"onKeyUp="CountLeft(this.form.txt,'sp',150);">-->
<font>
<span id="sp" name="sp" >130
</span>
characters left
</font>
</td>
</tr>
<tr>
<td> <center> &nbsp&nbsp&nbsp<input type="submit" class="button" name="submit" id="submit" value="Send" style="border-left=0px;border-right=0px;"/> </center></td>
<td>
<center> <input type="reset" name="reset" class="button" id="reset" value="Reset"/></center>
</td>
</tr>
</table>
</form>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *