Focus the search term on load
[openemr.git] / interface / batchcom / emailnotification.php
blobf3bfbc280d83a0df9ad1532af21d20ee51b6cb41
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 = "Email";
26 $email_sender = "EMR Group";
27 $email_subject = "Welcome to EMR Group";
28 // process form
29 if ($_POST['form_action']=='Save')
31 //validation uses the functions in notification.inc.php
32 if ($_POST['email_sender']=="") $form_err.=xl('Empty value in "Email Sender"','','<br>');
33 if ($_POST['email_subject']=="") $form_err.=xl('Empty value in "Email Subject"','','<br>');
34 //validate dates
35 if (!check_date_format($_POST['next_app_date'])) $form_err.=xl('Date format for "Next Appointment" is not valid','','<br>');
36 // validates and or
37 if ($_POST['provider_name']=="") $form_err.=xl('Empty value in "Name of Provider"','','<br>');
38 if ($_POST['message']=="") $form_err.=xl('Empty value in "Email Text"','','<br>');
39 //process sql
40 if (!$form_err)
42 $next_app_time = $_POST[hour].":".$_POST['min'];
43 $sql_text=" ( `notification_id` , `sms_gateway_type` , `next_app_date` , `next_app_time` , `provider_name` , `message` , `email_sender` , `email_subject` , `type` ) ";
44 $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."' ) ";
45 $query = "REPLACE INTO `automatic_notification` $sql_text VALUES $sql_value";
46 //echo $query;
47 $id = sqlInsert($query);
48 $sql_msg="ERROR!... in Update";
49 if($id) $sql_msg="Email Notification Settings Updated Successfully";
53 // fetch data from table
54 $sql="select * from automatic_notification where type='$type'";
55 $result = sqlQuery($sql);
56 if($result)
58 $notification_id = $result[notification_id];
59 $sms_gateway_type = $result[sms_gateway_type];
60 $next_app_date = $result[next_app_date];
61 list($hour,$min) = @explode(":",$result[next_app_time]);
62 $provider_name=$result[provider_name];
63 $email_sender=$result[email_sender];
64 $email_subject=$result[email_subject];
65 $message=$result[message];
67 //my_print_r($result);
69 // menu arrays (done this way so it's easier to validate input on validate selections)
70 $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');
71 $min_array = array('00','05','10','15','20','25','30','35','40','45','50','55');
73 //START OUT OUR PAGE....
75 <html>
76 <head>
77 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
78 <link rel="stylesheet" href="batchcom.css" type="text/css">
79 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
80 <script type="text/javascript" src="../../library/calendar.js"></script>
83 </head>
84 <body class="body_top">
85 <span class="title"><?php include_once("batch_navigation.php");?></span>
86 <span class="title"><?php xl('Email Notification','e')?></span>
87 <br><br>
88 <!-- for the popup date selector -->
89 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
90 <FORM name="select_form" METHOD=POST ACTION="">
91 <input type="Hidden" name="type" value="<?php echo $type;?>">
92 <input type="Hidden" name="notification_id" value="<?php echo $notification_id;?>">
93 <div class="text">
94 <div class="main_box">
95 <?php
96 if ($form_err) {
97 echo ("The following errors occurred<br>$form_err<br><br>");
99 if ($sql_msg) {
100 echo ("$sql_msg<br><br>");
103 <?php xl('Email Sender','e')?> :
104 <INPUT TYPE="text" NAME="email_sender" size="40" value="<?php echo $email_sender?>">
105 <br>
106 <?php xl('Email Subject','e')?> :
107 <INPUT TYPE="text" NAME="email_subject" size="60" value="<?php echo $email_subject?>">
108 <br>
110 <?php xl('Name of Provider','e')?> :
111 <INPUT TYPE="text" NAME="provider_name" size="40" value="<?php echo $provider_name?>">
112 <br>
113 <?php xl('SMS Text, Usable Tag: ***NAME***, ***PROVIDER***, ***DATE***, ***STARTTIME***, ***ENDTIME***<br> i.e. Dear ***NAME***','e')?>
114 <br>
115 <TEXTAREA NAME="message" ROWS="8" COLS="35"><?php echo $message?></TEXTAREA>
116 <br><br>
117 <INPUT TYPE="submit" name="form_action" value="Save">
118 </div>
119 </div>
120 </FORM>