forked from LibreHealthIO/lh-ehr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformsoptions.inc.php
38 lines (32 loc) · 1.38 KB
/
formsoptions.inc.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
<?php
/*
* Functions to be used in the clinical/visit/encounter forms. Any functions specific to the clinical/visit/encounter forms
* that are used in multiple forms should be included in this file.
*
* @copyright Copyright (C) 2017 Terry Hill <[email protected]>
*
*
* LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* See the Mozilla Public License for more details.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* @package LibreHealth EHR
* @author Terry Hill <[email protected]>
* @link http://librehealth.io
*
* Please help the overall project by sending changes you make to the author and to the LibreHealth EHR community.
*
*/
function checkFormIsActive ($form_name, $encounter)
{
# This check if an active file exists and uses it as opposed to creating a new instance of the form.
# This is similar to the code used by ZH in their file checks. Great Idea just not used else where.
$query_if_exists = sqlquery("SELECT f.id FROM $form_name AS f " .
"INNER JOIN forms ON (f.id = forms.form_id) WHERE ".
"forms.deleted = 0 AND forms.encounter = ? ORDER BY f.id DESC", array($encounter));
if (!empty($query_if_exists['id'])) {
$formid = 0 + $query_if_exists['id'];
}
return $formid;
}
?>