Fixes for restoreSession logic. (#4378)
[openemr.git] / controllers / C_InsuranceCompany.class.php
blobacce89e77fd86a9e288213984fb48a2c9df4fbde
1 <?php
3 class C_InsuranceCompany extends Controller
6 var $template_mod;
7 var $icompanies;
9 function __construct($template_mod = "general")
11 parent::__construct();
12 $this->icompanies = array();
13 $this->template_mod = $template_mod;
14 $this->assign("FORM_ACTION", $GLOBALS['webroot'] . "/controller.php?" . attr($_SERVER['QUERY_STRING']));
15 $this->assign("CURRENT_ACTION", $GLOBALS['webroot'] . "/controller.php?" . "practice_settings&insurance_company&");
16 $this->assign("STYLE", $GLOBALS['style']);
17 $this->assign("SUPPORT_ENCOUNTER_CLAIMS", $GLOBALS['support_encounter_claims']);
18 $this->assign("SUPPORT_ELIGIBILITY_REQUESTS", $GLOBALS['enable_oa']);
19 $this->InsuranceCompany = new InsuranceCompany();
22 function default_action()
24 return $this->list_action();
27 function edit_action($id = "", $patient_id = "", $p_obj = null)
29 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
30 $this->icompanies[0] = $p_obj;
31 } elseif (empty($this->icompanies[0]) || $this->icompanies[0] == null || get_class($this->icompanies[0]) != "insurancecompany") {
32 $this->icompanies[0] = new InsuranceCompany($id);
35 $x = new X12Partner();
36 $this->assign("x12_partners", $x->_utility_array($x->x12_partner_factory()));
38 $this->assign("insurancecompany", $this->icompanies[0]);
39 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
42 function list_action($sort = "")
45 if (!empty($sort)) {
46 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("", $sort));
47 } else {
48 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
51 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
55 function edit_action_process()
57 if ($_POST['process'] != "true") {
58 return;
61 //print_r($_POST);
62 if (is_numeric($_POST['id'])) {
63 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
64 } else {
65 $this->icompanies[0] = new InsuranceCompany();
68 parent::populate_object($this->icompanies[0]);
70 $this->icompanies[0]->persist();
71 $this->icompanies[0]->populate();
73 //echo "action processeed";
74 $_POST['process'] = "";
75 header('Location:' . $GLOBALS['webroot'] . "/controller.php?" . "practice_settings&insurance_company&action=list");//Z&H