3 * Notification Settings 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";
27 $type = 'SMS/Email Settings';
29 if ($_POST['form_action']=='save') {
30 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
34 if ($_POST['Send_SMS_Before_Hours']=="") {
35 $form_err .= xl('Empty value in "SMS Hours"') . '<br>';
38 if ($_POST['Send_Email_Before_Hours']=="") {
39 $form_err .= xl('Empty value in "Email Hours"') . '<br>';
42 if ($_POST['SMS_gateway_username']=="") {
43 $form_err .= xl('Empty value in "Username"') . '<br>';
46 if ($_POST['SMS_gateway_password']=="") {
47 $form_err .= xl('Empty value in "Password"') . '<br>';
52 $sql_text = " ( `SettingsId` , `Send_SMS_Before_Hours` , `Send_Email_Before_Hours` , `SMS_gateway_password` , `SMS_gateway_apikey` , `SMS_gateway_username` , `type` ) ";
53 $sql_value = " (?, ?, ?, ?, ?, ?, ?) ";
54 $values = array($_POST['SettingsId'], $_POST['Send_SMS_Before_Hours'], $_POST['Send_Email_Before_Hours'],
55 $_POST['SMS_gateway_password'], $_POST['SMS_gateway_apikey'], $_POST['SMS_gateway_username'],
57 $query = "REPLACE INTO `notification_settings` $sql_text VALUES $sql_value";
59 $id = sqlInsert($query, $values);
60 $sql_msg = xl("ERROR!... in Update");
62 $sql_msg = xl("SMS/Email Alert Settings Updated Successfully");
67 // fetch data from table
68 $sql="select * from notification_settings where type='SMS/Email Settings'";
69 $result = sqlQuery($sql);
71 $SettingsId = $result['SettingsId'];
72 $Send_SMS_Before_Hours = $result['Send_SMS_Before_Hours'];
73 $Send_Email_Before_Hours = $result['Send_Email_Before_Hours'];
74 $SMS_gateway_password = $result['SMS_gateway_password'];
75 $SMS_gateway_username = $result['SMS_gateway_username'];
76 $SMS_gateway_apikey = $result['SMS_gateway_apikey'];
79 //my_print_r($result);
80 //START OUT OUR PAGE....
84 <?php Header
::setupHeader(); ?
>
85 <title
><?php
echo xlt("Notification Settings"); ?
></title
>
87 <body
class="body_top container">
89 <?php
require_once("batch_navigation.php");?
>
90 <h1
class="col-md-12">
91 <a href
="batchcom.php"><?php
echo xlt('Batch Communication Tool'); ?
></a
>
92 <small
><?php
echo xlt('SMS/Email Alert Settings'); ?
></small
>
98 echo '<div class="alert alert-danger">' . xlt('The following errors occurred') . ': ' . text($form_err) . '</div>';
102 echo '<div class="alert alert-info">' . xlt('The following occurred') . ': ' . text($sql_msg) . '</div>';
105 <form name
="select_form" method
="post" action
="">
106 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
107 <input type
="hidden" name
="type" value
="SMS">
108 <input type
="Hidden" name
="SettingsId" value
="<?php echo attr($SettingsId);?>">
111 <div
class="col-md-6 form-group">
112 <label
for="Send_SMS_Before_Hours"><?php
echo xlt('SMS send before')?
>:</label
>
113 <input
class="form-control" type
="num" name
="Send_SMS_Before_Hours" size
="10" maxlength
="3" value
="<?php echo attr($Send_SMS_Before_Hours); ?>" placeholder
="###">
115 <div
class="col-md-6 form-group">
116 <label
for="Send_Email_Before_Hours"><?php
echo xlt('Email send before')?
>:</label
>
117 <input
class="form-control" type
="num" name
="Send_Email_Before_Hours" size
="10" maxlength
="3" value
="<?php echo attr($Send_Email_Before_Hours); ?>" placeholder
="###">
121 <div
class="col-md-6 form-group">
122 <label
for="SMS_gateway_username"><?php
echo xlt('Username for SMS Gateway')?
>:</label
>
123 <input
class="form-control" type
="text" name
="SMS_gateway_username" size
="40" value
="<?php echo attr($SMS_gateway_username); ?>" placeholder
="<?php echo xla('username'); ?>">
125 <div
class="col-md-6 form-group">
126 <label
for="SMS_gateway_password"><?php
echo xlt('Password for SMS Gateway')?
>:</label
>
127 <input
class="form-control" type
="password" name
="SMS_gateway_password" size
="40" value
="<?php echo attr($SMS_gateway_password); ?>" placeholder
="<?php echo xla('password'); ?>">
131 <div
class="col-md-12 form-group">
132 <label
for="SMS_gateway_apikey"><?php
echo xlt('SMS Gateway API key')?
>:</label
>
133 <input
class="form-control" type
="text" name
="SMS_gateway_apikey" size
="40" value
="<?php echo attr($SMS_gateway_apikey); ?>" placeholder
="<?php echo xla('key'); ?>">
137 <div
class="col-md-12 form-group">
138 <button
class="btn btn-default btn-save" type
="submit" name
="form_action" value
="save"><?php
echo xlt('Save'); ?
></button
>