psr12 fixes for new PHP_CodeSniffer (#4795)
[openemr.git] / contrib / forms / evaluation / C_FormEvaluation.class.php
blobe770369613d985cf79c52210f733208d782dd70f
1 <?php
3 /**
4 * class C_FormEvaluation
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Daniel Ehrlich <daniel.ehrlich1@gmail.com>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2018 Daniel Ehrlich <daniel.ehrlich1@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once($GLOBALS['fileroot'] . "/library/forms.inc");
16 require_once("FormEvaluation.class.php");
18 use OpenEMR\Billing\BillingUtilities;
19 use OpenEMR\Common\Csrf\CsrfUtils;
21 class C_FormEvaluation extends Controller
23 var $template_dir;
25 function __construct($template_mod = "general")
27 parent::__construct();
28 $this->template_mod = $template_mod;
29 $this->template_dir = dirname(__FILE__) . "/templates/evaluation/";
30 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
31 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
32 $this->assign("STYLE", $GLOBALS['style']);
33 $this->assign("CSRF_TOKEN_FORM", CsrfUtils::collectCsrfToken());
36 function default_action()
38 $evaluation = new FormEvaluation();
39 $this->assign("checks", $evaluation->_form_layout());
40 $this->assign("evaluation", $evaluation);
41 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
44 function view_action($form_id)
46 if (is_numeric($form_id)) {
47 $evaluation = new FormEvaluation($form_id);
48 } else {
49 $evaluation = new FormEvaluation();
52 $this->assign("VIEW", true);
53 $this->assign("checks", $evaluation->_form_layout());
54 $this->assign("evaluation", $evaluation);
55 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
58 function default_action_process()
60 if ($_POST['process'] != "true") {
61 return;
64 $this->evaluation = new FormEvaluation($_POST['id']);
65 parent::populate_object($this->evaluation);
67 $this->evaluation->persist();
68 if ($GLOBALS['encounter'] == "") {
69 $GLOBALS['encounter'] = date("Ymd");
72 addForm($GLOBALS['encounter'], "Evaluation Form", $this->evaluation->id, "evaluation", $GLOBALS['pid'], $_SESSION['userauthorized']);
74 if (!empty($_POST['cpt_code'])) {
75 $sql = "select * from codes where code = ? ORDER BY id";
77 $results = sqlQ($sql, array($_POST['cpt_code']));
79 $row = sqlFetchArray($results);
80 if (!empty($row)) {
81 BillingUtilites::addBilling(date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'], $row['modifier'], $row['units'], $row['fee']);
85 $_POST['process'] = "";
86 return;