Fix for previous commit to work when uploading encrypted files to couchdb
[openemr.git] / contrib / forms / well_child / C_FormWellChild.class.php
blob0e24446291bb755ca32c3c68046110beb5e982da
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
5 require_once ($GLOBALS['fileroot'] . "/library/sql.inc");
6 require_once("FormWellChild.class.php");
8 class C_FormWellChild extends Controller {
10 var $template_dir;
12 function C_FormWellChild($template_mod = "general") {
13 parent::Controller();
14 $this->template_mod = $template_mod;
15 $this->template_dir = dirname(__FILE__) . "/templates/well_child/";
16 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
17 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
18 $this->assign("STYLE", $GLOBALS['style']);
21 function default_action() {
22 $well_child = new FormWellChild();
23 $this->assign("checks",$well_child->_form_layout());
24 $this->assign("checks2",$well_child->_form_layout2());
25 $this->assign("checks3",$well_child->_form_layout3());
26 $this->assign("well_child",$well_child);
27 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
30 function view_action($form_id) {
31 if (is_numeric($form_id)) {
32 $well_child = new FormWellChild($form_id);
34 else {
35 $well_child = new FormWellChild();
37 $this->assign("VIEW",true);
38 $this->assign("checks",$well_child->_form_layout());
39 $this->assign("checks2",$well_child->_form_layout2());
40 $this->assign("checks3",$well_child->_form_layout3());
41 $this->assign("well_child",$well_child);
42 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
46 function default_action_process() {
47 if ($_POST['process'] != "true")
48 return;
49 $this->well_child = new FormWellChild($_POST['id']);
50 parent::populate_object($this->well_child);
52 $new_form = false;
53 if (empty($_POST['id'])) {
54 $new_form = true;
57 $this->well_child->persist();
58 if ($GLOBALS['encounter'] == "") {
59 $GLOBALS['encounter'] = date("Ymd");
62 if ($new_form) {
63 addForm($GLOBALS['encounter'], "Well Child Visit", $this->well_child->id, "well_child", $GLOBALS['pid'], $_SESSION['userauthorized']);
66 if (!empty($_POST['cpt_code'])) {
67 $sql = "select * from codes where code ='" . mysql_real_escape_string($_POST['cpt_code']) . "' order by id";
69 $results = sqlQ($sql);
71 $row = mysql_fetch_array($results);
72 if (!empty($row)) {
73 addBilling( date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'],$row['modifier'],$row['units'],$row['fee']);
78 $_POST['process'] = "";
79 return;