forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
record_disclosure.php
176 lines (160 loc) · 7.65 KB
/
record_disclosure.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/**
* Patient disclosures main screen.
*
* @package OpenEMR
* @link http:https://www.open-emr.org
* @author Visolve <[email protected]>
* @author Brady Miller <[email protected]>
* @copyright Copyright (c) Visolve <[email protected]>
* @copyright Copyright (c) 2017-2018 Brady Miller <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/
require_once("../../globals.php");
require_once("$srcdir/options.inc.php");
use OpenEMR\Common\Acl\AclMain;
use OpenEMR\Common\Csrf\CsrfUtils;
use OpenEMR\Core\Header;
// Control access
$authWrite = AclMain::aclCheckCore('patients', 'disclosure', '', 'write');
$authAddonly = AclMain::aclCheckCore('patients', 'disclosure', '', 'addonly');
if (!$authWrite && !$authAddonly) {
echo xlt('Not Authorized');
exit;
}
//if the edit button for editing disclosure is set.
if (isset($_GET['editlid'])) {
if (!$authWrite) {
echo xlt('Not Authorized');
exit;
}
$editlid = $_GET['editlid'];
}
?>
<!DOCTYPE html>
<html>
<head>
<?php Header::setupHeader(['datetime-picker', 'opener']); ?>
<script>
//function to validate fields in record disclosure page
function submitform() {
if (document.forms[0].dates.value.length <= 0) {
document.forms[0].dates.focus();
document.forms[0].dates.style.backgroundColor = "red";
}
else if (document.forms[0].recipient_name.value.length <= 0) {
document.forms[0].dates.style.backgroundColor = "white";
document.forms[0].recipient_name.focus();
document.forms[0].recipient_name.style.backgroundColor = "red";
}
else if (document.forms[0].desc_disc.value.length <= 0) {
document.forms[0].recipient_name.style.backgroundColor = "white";
document.forms[0].desc_disc.focus();
document.forms[0].desc_disc.style.backgroundColor = "red";
}
else if (document.forms[0].dates.value.length > 0 && document.forms[0].recipient_name.value.length > 0 && document.forms[0].desc_disc.value.length > 0) {
top.restoreSession();
document.forms[0].submit();
}
}
$(function () {
$("#disclosure_form").submit(function (event) {
event.preventDefault(); //prevent default action
var post_url = $(this).attr("action");
var request_method = $(this).attr("method");
var form_data = $(this).serialize();
$.ajax({
url: post_url,
type: request_method,
data: form_data
}).done(function (r) { //
dlgclose('refreshme', false);
});
});
$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = true; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = false; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
});
});
</script>
</head>
<body>
<div class="container" id="record-disclosure">
<div class="row">
<div class="col-12">
<?php
if (!empty($editlid)) {
?><!--Edit the disclosures-->
<h2 class="title"><?php echo xlt('Edit Disclosure'); ?></h2><?php
} else { ?>
<span class="title"><?php echo xlt('Record Disclosure'); ?></span><?php
} ?>
</div>
<div class="col-12">
<form name="disclosure_form" id="disclosure_form" method="POST" action="disclosure_full.php">
<input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
<div class="btn-group">
<button class='btn btn-primary btn-save' name='form_save' id='form_save'>
<?php echo xlt('Save'); ?>
</button>
<button class="btn btn-secondary btn-cancel" id='cancel' onclick='top.restoreSession();dlgclose()'>
<?php echo xlt('Cancel'); ?>
</button>
</div>
<input type='hidden' name='mode' value="disclosure" />
<div class="form-group mt-3">
<label><?php echo xlt('Date'); ?>:</label>
<?php
if (!empty($editlid)) {
$dres = sqlQuery("select date,recipient,description,event from extended_log where id=?", array($editlid));
$description = $dres["description"];
$app_event = $dres["event"];
$disc_date = $dres["date"];
$recipient_name = $dres["recipient"];
?>
<input type="hidden" name="disclosure_id" value="<?php echo attr($editlid); ?>">
<input type="hidden" name="updatemode" value="disclosure_update">
<input type='entry' size='20' class='datepicker form-control' name='dates' id='dates' value='<?php echo attr($disc_date);?>'/> <?php
} else {
?> <input type='entry' size='20' class='datepicker form-control' name='dates' id='dates' value=''/> <?php
} ?>
</div>
<div class="form-group mt-3">
<label><?php echo xlt('Type of Disclosure'); ?>:</label>
<?php
if (!empty($editlid)) {
//To incorporate the disclosure types into the list_options listings
generate_form_field(array('data_type' => 1,'field_id' => 'disclosure_type','list_id' => 'disclosure_type','fld_length' => '10','max_length' => '63','empty_title' => 'SKIP'), $app_event);
} else {
//To incorporate the disclosure types into the list_options listings
generate_form_field(array('data_type' => 1,'field_id' => 'disclosure_type','list_id' => 'disclosure_type','fld_length' => '10','max_length' => '63','empty_title' => 'SKIP'), ($title ?? ''));
} ?>
</div>
<div class="form-group mt-3">
<label><?php echo xlt('Recipient of the Disclosure'); ?>:</label>
<?php
if (!empty($editlid)) {
?> <input type="entry" class="form-control" name="recipient_name" size="20" value="<?php echo attr($recipient_name); ?>" />
<?php
} else {?>
<input type="entry" class="form-control" name="recipient_name" size="20" value="" />
<?php
}?>
</div>
<div class="form-group mt-3">
<label><?php echo xlt('Description of the Disclosure'); ?>:</label>
<?php if (!empty($editlid)) { ?>
<textarea class="form-control" name="desc_disc" wrap="auto" rows="4" cols="30"><?php echo text($description); ?></textarea>
<?php } else {?>
<textarea class="form-control" name="desc_disc" wrap="auto" rows="4" cols="30"></textarea>
<?php }?>
</div>
</form>
</div>
</div>
</div>
</body>
</html>