fix: restore url and text for immunizations card (#6991)
[openemr.git] / controllers / C_InsuranceCompany.class.php
blobbd0a3da92240ada12b2a1dc47eaf254a1b9f54be
1 <?php
3 class C_InsuranceCompany extends Controller
5 var $template_mod;
6 var $icompanies;
7 var $InsuranceCompany;
9 public function __construct($template_mod = "general")
11 parent::__construct();
12 $this->icompanies = array();
13 $this->template_mod = $template_mod;
14 $this->template_dir = __DIR__ . "/templates/insurance_companies/";
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->assign("SUPPORT_ENCOUNTER_CLAIMS", $GLOBALS['support_encounter_claims']);
19 $this->assign("SUPPORT_ELIGIBILITY_REQUESTS", $GLOBALS['enable_eligibility_requests']);
20 $this->InsuranceCompany = new InsuranceCompany();
23 public function default_action()
25 return $this->list_action();
28 public function edit_action($id = "", $patient_id = "", $p_obj = null)
30 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
31 $this->icompanies[0] = $p_obj;
32 } elseif (empty($this->icompanies[0]) || $this->icompanies[0] == null || 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 public function list_action()
46 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
48 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
52 public function edit_action_process()
54 if ($_POST['process'] != "true") {
55 return;
58 if (is_numeric($_POST['id'])) {
59 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
60 } else {
61 $this->icompanies[0] = new InsuranceCompany();
64 self::populate_object($this->icompanies[0]);
66 $this->icompanies[0]->persist();
67 $this->icompanies[0]->populate();
69 $_POST['process'] = "";
70 header('Location:' . $GLOBALS['webroot'] . "/controller.php?" . "practice_settings&insurance_company&action=list");//Z&H