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 ($_POST['Send_SMS_Before_Hours']=="") {
31 $form_err .= xl('Empty value in "SMS Hours"') . '<br>';
34 if ($_POST['Send_Email_Before_Hours']=="") {
35 $form_err .= xl('Empty value in "Email Hours"') . '<br>';
38 if ($_POST['SMS_gateway_username']=="") {
39 $form_err .= xl('Empty value in "Username"') . '<br>';
42 if ($_POST['SMS_gateway_password']=="") {
43 $form_err .= xl('Empty value in "Password"') . '<br>';
48 $sql_text = " ( `SettingsId` , `Send_SMS_Before_Hours` , `Send_Email_Before_Hours` , `SMS_gateway_password` , `SMS_gateway_apikey` , `SMS_gateway_username` , `type` ) ";
49 $sql_value = " (?, ?, ?, ?, ?, ?, ?) ";
50 $values = array($_POST['SettingsId'], $_POST['Send_SMS_Before_Hours'], $_POST['Send_Email_Before_Hours'],
51 $_POST['SMS_gateway_password'], $_POST['SMS_gateway_apikey'], $_POST['SMS_gateway_username'],
53 $query = "REPLACE INTO `notification_settings` $sql_text VALUES $sql_value";
55 $id = sqlInsert($query, $values);
56 $sql_msg = xl("ERROR!... in Update");
58 $sql_msg = xl("SMS/Email Alert Settings Updated Successfully");
63 // fetch data from table
64 $sql="select * from notification_settings where type='SMS/Email Settings'";
65 $result = sqlQuery($sql);
67 $SettingsId = $result['SettingsId'];
68 $Send_SMS_Before_Hours = $result['Send_SMS_Before_Hours'];
69 $Send_Email_Before_Hours = $result['Send_Email_Before_Hours'];
70 $SMS_gateway_password = $result['SMS_gateway_password'];
71 $SMS_gateway_username = $result['SMS_gateway_username'];
72 $SMS_gateway_apikey = $result['SMS_gateway_apikey'];
75 //my_print_r($result);
76 //START OUT OUR PAGE....
80 <?php Header
::setupHeader(); ?
>
81 <title
><?php
echo xlt("Notification Settings"); ?
></title
>
83 <body
class="body_top container">
85 <?php
require_once("batch_navigation.php");?
>
86 <h1
class="col-md-12">
87 <a href
="batchcom.php"><?php
echo xlt('Batch Communication Tool'); ?
></a
>
88 <small
><?php
echo xlt('SMS/Email Alert Settings'); ?
></small
>
94 echo '<div class="alert alert-danger">' . xlt('The following errors occurred') . ': ' . text($form_err) . '</div>';
98 echo '<div class="alert alert-info">' . xlt('The following errors occurred') . ': ' . text($sql_msg) . '</div>';
101 <form name
="select_form" method
="post" action
="">
102 <input type
="hidden" name
="type" value
="SMS">
103 <input type
="Hidden" name
="SettingsId" value
="<?php echo attr($SettingsId);?>">
106 <div
class="col-md-6 form-group">
107 <label
for="Send_SMS_Before_Hours"><?php
echo xlt('SMS send before')?
>:</label
>
108 <input
class="form-control" type
="num" name
="Send_SMS_Before_Hours" size
="10" maxlength
="3" value
="<?php echo attr($Send_SMS_Before_Hours); ?>" placeholder
="###">
110 <div
class="col-md-6 form-group">
111 <label
for="Send_Email_Before_Hours"><?php
echo xlt('Email send before')?
>:</label
>
112 <input
class="form-control" type
="num" name
="Send_Email_Before_Hours" size
="10" maxlength
="3" value
="<?php echo attr($Send_Email_Before_Hours); ?>" placeholder
="###">
116 <div
class="col-md-6 form-group">
117 <label
for="SMS_gateway_username"><?php
echo xlt('Username for SMS Gateway')?
>:</label
>
118 <input
class="form-control" type
="text" name
="SMS_gateway_username" size
="40" value
="<?php echo attr($SMS_gateway_username); ?>" placeholder
="<?php echo xla('username'); ?>">
120 <div
class="col-md-6 form-group">
121 <label
for="SMS_gateway_password"><?php
echo xlt('Password for SMS Gateway')?
>:</label
>
122 <input
class="form-control" type
="password" name
="SMS_gateway_password" size
="40" value
="<?php echo attr($SMS_gateway_password); ?>" placeholder
="<?php echo xla('password'); ?>">
126 <div
class="col-md-12 form-group">
127 <label
for="SMS_gateway_apikey"><?php
echo xlt('SMS Gateway API key')?
>:</label
>
128 <input
class="form-control" type
="text" name
="SMS_gateway_apikey" size
="40" value
="<?php echo attr($SMS_gateway_apikey); ?>" placeholder
="<?php echo xla('key'); ?>">
132 <div
class="col-md-12 form-group">
133 <button
class="btn btn-default btn-save" type
="submit" name
="form_action" value
="save"><?php
echo xlt('Save'); ?
></button
>