CTL Revision (#1950)
[openemr.git] / controllers / C_BillingContact.class.php
blobcce0adb072c0f3a34b45d8bf9a7ec47f7fa4f386
1 <?php
4 class C_InsuranceCompany extends Controller
7 var $template_mod;
8 var $icompanies;
10 function __construct($template_mod = "general")
12 parent::__construct();
13 $this->icompanies = array();
14 $this->template_mod = $template_mod;
15 $this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . attr($_SERVER['QUERY_STRING']));
16 $this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
17 $this->assign("STYLE", $GLOBALS['style']);
18 $this->InsuranceCompany = new InsuranceCompany();
21 function default_action()
23 return $this->list_action();
26 function edit_action($id = "", $patient_id = "", $p_obj = null)
28 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
29 $this->icompanies[0] = $p_obj;
30 } elseif (get_class($this->icompanies[0]) != "insurancecompany") {
31 $this->icompanies[0] = new InsuranceCompany($id);
34 $this->assign("insurancecompany", $this->icompanies[0]);
35 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
38 function list_action($sort = "")
41 if (!empty($sort)) {
42 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("", $sort));
43 } else {
44 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
47 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
51 function edit_action_process()
53 if ($_POST['process'] != "true") {
54 return;
57 //print_r($_POST);
58 if (is_numeric($_POST['id'])) {
59 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
60 } else {
61 $this->icompanies[0] = new InsuranceCompany();
64 parent::populate_object($this->icompanies[0]);
65 //print_r($this->pharmacies[0]);
66 //echo $this->pharmacies[0]->toString(true);
68 $this->icompanies[0]->persist();
70 //echo "action processeed";
71 $_POST['process'] = "";