Support for larger size codes (such as SNOMED US Extension codes)
[openemr.git] / interface / batchcom / smsnotification.php
blobe4bfcde0d044a8c9972cb104714a58933581d748
1 <?php
2 //INCLUDES, DO ANY ACTIONS, THEN GET OUR DATA
3 include_once("../globals.php");
4 include_once("$srcdir/registry.inc");
5 include_once("$srcdir/sql.inc");
6 include_once("../../library/acl.inc");
7 include_once("batchcom.inc.php");
9 // gacl control
10 $thisauth = acl_check('admin', 'notification');
12 if (!$thisauth) {
13 echo "<html>\n<body>\n";
14 echo "<p>".xl('You are not authorized for this.','','','</p>')."\n";
15 echo "</body>\n</html>\n";
16 exit();
19 // default value
20 $next_app_date = date("Y-m-d");
21 $hour="12";
22 $min="15";
23 $provider_name="EMR Group";
24 $message="Welcome to EMR Group";
25 $type = "SMS";
27 // process form
28 if ($_POST['form_action']=='Save')
30 //validation uses the functions in notification.inc.php
31 //validate dates
32 if (!check_date_format($_POST['next_app_date'])) $form_err.=xl('Date format for "Next Appointment" is not valid','','<br>');
33 // validate selections
34 if ($_POST['sms_gateway_type']=="") $form_err.=xl('Error in "SMS Gateway" selection','','<br>');
35 // validates and or
36 if ($_POST['provider_name']=="") $form_err.=xl('Empty value in "Name of Provider"','','<br>');
37 if ($_POST['message']=="") $form_err.=xl('Empty value in "SMS Text"','','<br>');
38 //process sql
39 if (!$form_err)
41 $next_app_time = $_POST[hour].":".$_POST['min'];
42 $sql_text=" ( `notification_id` , `sms_gateway_type` , `next_app_date` , `next_app_time` , `provider_name` , `message` , `email_sender` , `email_subject` , `type` ) ";
43 $sql_value=" ( '".$_POST[notification_id]."' , '".$_POST[sms_gateway_type]."' , '".$_POST[next_app_date]."' , '".$next_app_time."' , '".$_POST[provider_name]."' , '".$_POST[message]."' , '".$_POST[email_sender]."' , '".$_POST[email_subject]."' , '".$type."' ) ";
44 $query = "REPLACE INTO `automatic_notification` $sql_text VALUES $sql_value";
45 //echo $query;
46 $id = sqlInsert($query);
47 $sql_msg="ERROR!... in Update";
48 if($id) $sql_msg="SMS Notification Settings Updated Successfully";
52 // fetch data from table
53 $sql="select * from automatic_notification where type='$type'";
54 $result = sqlQuery($sql);
55 if($result)
57 $notification_id = $result[notification_id];
58 $sms_gateway_type = $result[sms_gateway_type];
59 $next_app_date = $result[next_app_date];
60 list($hour,$min) = @explode(":",$result[next_app_time]);
61 $provider_name=$result[provider_name];
62 $message=$result[message];
64 //my_print_r($result);
66 // menu arrays (done this way so it's easier to validate input on validate selections)
67 $sms_gateway=Array ('CLICKATELL','TMB4');
68 $hour_array =array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','21','21','22','23');
69 $min_array = array('00','05','10','15','20','25','30','35','40','45','50','55');
71 //START OUT OUR PAGE....
73 <html>
74 <head>
75 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
76 <link rel="stylesheet" href="batchcom.css" type="text/css">
77 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
78 <script type="text/javascript" src="../../library/calendar.js"></script>
81 </head>
82 <body class="body_top">
83 <span class="title"><?php include_once("batch_navigation.php");?></span>
84 <span class="title"><?php xl('SMS Notification','e')?></span>
85 <br><br>
86 <!-- for the popup date selector -->
87 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
88 <FORM name="select_form" METHOD=POST ACTION="">
89 <input type="Hidden" name="type" value="<?php echo $type;?>">
90 <input type="Hidden" name="notification_id" value="<?php echo $notification_id;?>">
91 <div class="text">
92 <div class="main_box">
93 <?php
94 if ($form_err) {
95 echo ("The following errors occurred<br>$form_err<br><br>");
97 if ($sql_msg) {
98 echo ("$sql_msg<br><br>");
100 xl('SMS Gateway','e')?>:
101 <SELECT NAME="sms_gateway_type">
102 <option value="">Select SMS Gateway</option>
103 <?php foreach ($sms_gateway as $value) {?>
104 <option value="<?php echo $value;?>" <?php if ($sms_gateway_type == $value) {echo "selected";}?>><?php echo $value;?></option>
105 <?php }?>
106 </SELECT>
107 <br>
109 <?php xl('Name of Provider','e')?> :
110 <INPUT TYPE="text" NAME="provider_name" size="40" value="<?php echo $provider_name?>">
111 <br>
112 <?php xl('SMS Text, Usable Tag: ***NAME***, ***PROVIDER***, ***DATE***, ***STARTTIME***, ***ENDTIME***<br> i.e. Dear ***NAME***','e')?>
113 <br>
114 <TEXTAREA NAME="message" ROWS="8" COLS="35"><?php echo $message?></TEXTAREA>
115 <br><br>
116 <INPUT TYPE="submit" name="form_action" value="Save">
117 </div>
118 </div>
119 </FORM>