7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once($GLOBALS['fileroot'] . "/library/forms.inc");
14 require_once("FormPriorAuth.class.php");
16 use OpenEMR\Common\Csrf\CsrfUtils
;
18 class C_FormPriorAuth
extends Controller
22 function __construct($template_mod = "general")
24 parent
::__construct();
25 $returnurl = 'encounter_top.php';
26 $this->template_mod
= $template_mod;
27 $this->template_dir
= dirname(__FILE__
) . "/templates/prior_auth/";
28 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
29 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
30 $this->assign("STYLE", $GLOBALS['style']);
31 $this->assign("CSRF_TOKEN_FORM", CsrfUtils
::collectCsrfToken());
34 function default_action()
36 $prior_auth = new FormPriorAuth();
37 $this->assign("prior_auth", $prior_auth);
38 return $this->fetch($this->template_dir
. $this->template_mod
. "_new.html");
41 function view_action($form_id)
43 if (is_numeric($form_id)) {
44 $prior_auth = new FormPriorAuth($form_id);
46 $prior_auth = new FormPriorAuth();
49 $this->assign("VIEW", true);
50 $this->assign("prior_auth", $prior_auth);
51 return $this->fetch($this->template_dir
. $this->template_mod
. "_new.html");
54 function default_action_process()
56 if ($_POST['process'] != "true") {
60 $this->prior_auth
= new FormPriorAuth($_POST['id']);
61 parent
::populate_object($this->prior_auth
);
64 $this->prior_auth
->persist();
65 if ($GLOBALS['encounter'] == "") {
66 $GLOBALS['encounter'] = date("Ymd");
69 if (empty($_POST['id'])) {
70 addForm($GLOBALS['encounter'], "Prior Authorization", $this->prior_auth
->id
, "prior_auth", $GLOBALS['pid'], $_SESSION['userauthorized']);
71 $_POST['process'] = "";