Fix cancel front payment.
[openemr.git] / interface / batchcom / settingsnotification.php
blob03eadc294b3a8ecfac1e990ac8b067c3a5a1bb2a
1 <?php
2 /**
3 * Notification Settings Script
5 * @package OpenEMR
6 * @author cfapress
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;
19 // gacl control
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";
24 exit();
27 $type = 'SMS/Email Settings';
28 // process form
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>';
46 //process sql
47 if (!$form_err) {
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'],
52 $type);
53 $query = "REPLACE INTO `notification_settings` $sql_text VALUES $sql_value";
54 //echo $query;
55 $id = sqlInsert($query, $values);
56 $sql_msg = xl("ERROR!... in Update");
57 if ($id) {
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);
66 if ($result) {
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....
78 <html>
79 <head>
80 <?php Header::setupHeader(); ?>
81 <title><?php echo xlt("Notification Settings"); ?></title>
82 </head>
83 <body class="body_top container">
84 <header class="row">
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>
89 </h1>
90 </header>
91 <main>
92 <?php
93 if ($form_err) {
94 echo '<div class="alert alert-danger">' . xlt('The following errors occurred') . ': ' . text($form_err) . '</div>';
97 if ($sql_msg) {
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);?>">
105 <div class="row">
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="###">
109 </div>
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="###">
113 </div>
114 </div>
115 <div class="row">
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'); ?>">
119 </div>
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'); ?>">
123 </div>
124 </div>
125 <div class="row">
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'); ?>">
129 </div>
130 </div>
131 <div class="row">
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>
134 </div>
135 </div>
137 </form>
138 </main>
140 </body>
141 </html>