Improved Code Sniffing (#928)
[openemr.git] / controllers / C_InsuranceCompany.class.php
blobabaad37c18bc72d3e8a1e7f8ecf3cd4549eafda5
1 <?php
4 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?" . $_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("WEB_ROOT", $GLOBALS['webroot'] );
18 $this->assign("SUPPORT_ENCOUNTER_CLAIMS", $GLOBALS['support_encounter_claims'] );
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;
32 elseif (get_class($this->icompanies[0]) != "insurancecompany" ) {
33 $this->icompanies[0] = new InsuranceCompany($id);
36 $x = new X12Partner();
37 $this->assign("x12_partners", $x->_utility_array($x->x12_partner_factory()));
39 $this->assign("insurancecompany", $this->icompanies[0]);
40 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
43 function list_action($sort = "")
46 if (!empty($sort)) {
47 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("",$sort));
49 else {
50 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
53 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
57 function edit_action_process()
59 if ($_POST['process'] != "true")
60 return;
61 //print_r($_POST);
62 if (is_numeric($_POST['id'])) {
63 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
65 else {
66 $this->icompanies[0] = new InsuranceCompany();
69 parent::populate_object($this->icompanies[0]);
71 $this->icompanies[0]->persist();
72 $this->icompanies[0]->populate();
74 //echo "action processeed";
75 $_POST['process'] = "";
76 header('Location:'.$GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&action=list");//Z&H