Fixes for restoreSession logic. (#4378)
[openemr.git] / controllers / C_BillingContact.class.php
blobf7687bb30163c14ca760d10638ae013a40765434
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->InsuranceCompany = new InsuranceCompany();
20 function default_action()
22 return $this->list_action();
25 function edit_action($id = "", $patient_id = "", $p_obj = null)
27 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
28 $this->icompanies[0] = $p_obj;
29 } elseif (get_class($this->icompanies[0]) != "insurancecompany") {
30 $this->icompanies[0] = new InsuranceCompany($id);
33 $this->assign("insurancecompany", $this->icompanies[0]);
34 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
37 function list_action($sort = "")
40 if (!empty($sort)) {
41 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("", $sort));
42 } else {
43 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
46 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
50 function edit_action_process()
52 if ($_POST['process'] != "true") {
53 return;
56 //print_r($_POST);
57 if (is_numeric($_POST['id'])) {
58 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
59 } else {
60 $this->icompanies[0] = new InsuranceCompany();
63 parent::populate_object($this->icompanies[0]);
64 //print_r($this->pharmacies[0]);
65 //echo $this->pharmacies[0]->toString(true);
67 $this->icompanies[0]->persist();
69 //echo "action processeed";
70 $_POST['process'] = "";