3 * emailnotification script.
7 * @author Jason 'Toolbox' Oettinger <jason@oettinger.email>
8 * @link http://www.open-emr.org
9 * @copyright Copyright (c) 2008 cfapress
10 * @copyright Copyright (c) 2017 Jason 'Toolbox' Oettinger <jason@oettinger.email>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
14 require_once("$srcdir/registry.inc");
15 require_once("../../library/acl.inc");
16 require_once("batchcom.inc.php");
17 use OpenEMR\Core\Header
;
20 if (!acl_check('admin', 'notification')) {
21 echo "<html>\n<body>\n<h1>";
22 echo xlt('You are not authorized for this.');
23 echo "</h1>\n</body>\n</html>\n";
28 $next_app_date = date("Y-m-d");
31 $provider_name="EMR Group";
32 $message="Welcome to EMR Group";
34 $email_sender = "EMR Group";
35 $email_subject = "Welcome to EMR Group";
37 if ($_POST['form_action']=='save') {
38 //validation uses the functions in notification.inc.php
39 if ($_POST['email_sender']=="") {
40 $form_err .= xl('Empty value in "Email Sender"') . '<br>';
43 if ($_POST['email_subject']=="") {
44 $form_err .= xl('Empty value in "Email Subject"') . '<br>';
48 if (!check_date_format($_POST['next_app_date'])) {
49 $form_err .= xl('Date format for "Next Appointment" is not valid') . '<br>';
53 if ($_POST['provider_name']=="") {
54 $form_err .= xl('Empty value in "Name of Provider"') . '<br>';
57 if ($_POST['message']=="") {
58 $form_err .= xl('Empty value in "Email Text"') . '<br>';
63 $next_app_time = $_POST['hour'].":".$_POST['min'];
64 $sql_text = " ( `notification_id` , `sms_gateway_type` , `next_app_date` , `next_app_time` , `provider_name` , `message` , `email_sender` , `email_subject` , `type` ) ";
65 $sql_value = " (?, ?, ?, ?, ?, ?, ?, ?, ?) ";
66 $values = array($_POST['notification_id'], $_POST['sms_gateway_type'], $_POST['next_app_date'], $next_app_time,
67 $_POST['provider_name'], $_POST['message'], $_POST['email_sender'], $_POST['email_subject'],
69 $query = "REPLACE INTO `automatic_notification` $sql_text VALUES $sql_value";
71 $id = sqlInsert($query, $values);
72 $sql_msg = xl("ERROR!... in Update");
74 $sql_msg = xl("Email Notification Settings Updated Successfully");
79 // fetch data from table
80 $sql="select * from automatic_notification where type='Email'";
81 $result = sqlQuery($sql);
83 $notification_id = $result['notification_id'];
84 $sms_gateway_type = $result['sms_gateway_type'];
85 $next_app_date = $result['next_app_date'];
86 list($hour,$min) = @explode
(":", $result['next_app_time']);
87 $provider_name = $result['provider_name'];
88 $email_sender = $result['email_sender'];
89 $email_subject = $result['email_subject'];
90 $message = $result['message'];
93 //my_print_r($result);
95 // menu arrays (done this way so it's easier to validate input on validate selections)
96 $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');
97 $min_array = array('00','05','10','15','20','25','30','35','40','45','50','55');
99 //START OUT OUR PAGE....
103 <?php Header
::setupHeader(); ?
>
104 <title
><?php
echo xlt("Email Notification"); ?
></title
>
106 <body
class="body_top container">
108 <?php
require_once("batch_navigation.php");?
>
109 <h1
class="col-md-12">
110 <a href
="batchcom.php"><?php
echo xlt('Batch Communication Tool'); ?
></a
>
111 <small
><?php
echo xlt('Email Notification'); ?
></small
>
117 echo '<div class="alert alert-danger">' . xlt('The following errors occurred') . ': ' . text($form_err) . '</div>';
121 echo '<div class="alert alert-info">' . xlt('The following errors occurred') . ': ' . text($sql_msg) . '</div>';
124 <form name
="select_form" method
="post" action
="">
125 <input type
="Hidden" name
="type" value
="Email">
126 <input type
="Hidden" name
="notification_id" value
="<?php echo attr($notification_id);?>">
128 <div
class="col-md-4 form-group">
129 <label
for="email_sender"><?php
echo xlt('Email Sender')?
>:</label
>
130 <input
class="form-control" type
="text" name
="email_sender" size
="40" value
="<?php echo attr($email_sender); ?>" placeholder
="<?php xla('sender name'); ?>">
132 <div
class="col-md-4 form-group">
133 <label
for="email_subject"><?php
echo xlt('Email Subject')?
>:</label
>
134 <input
class="form-control" type
="text" name
="email_subject" size
="40" value
="<?php echo attr($email_subject); ?>" placeholder
="<?php xla('email subject'); ?>">
136 <div
class="col-md-4 form-group">
137 <label
for="provider_name"><?php
echo xlt('Name of Provider')?
>:</label
>
138 <input
class="form-control" type
="text" name
="provider_name" size
="40" value
="<?php echo attr($provider_name); ?>" placeholder
="<?php xla('provider name'); ?>">
142 <div
class="col-md-12 form-group">
143 <label
for="message"><?php
echo xlt('SMS Text Usable Tags'); ?
>: ***NAME
***, ***PROVIDER
***, ***DATE
***, ***STARTTIME
***, ***ENDTIME
*** (i
.e
. Dear
***NAME
***):</label
>
144 <textarea
class="form-control" cols
="35" rows
="8" name
="message"><?php
echo text($message); ?
></textarea
>
148 <div
class="col-md-12 form-group">
149 <button
class="btn btn-default btn-save" type
="submit" name
="form_action" value
="save"><?php
echo xlt('Save'); ?
></button
>