just a minor label change to prior commit
[openemr.git] / controllers / C_InsuranceCompany.class.php
blob9998bb99b224f086ddd03eb7fa8d6d47bdf14102
1 <?php
4 class C_InsuranceCompany extends Controller {
6 var $template_mod;
7 var $icompanies;
9 function __construct($template_mod = "general") {
10 parent::__construct();
11 $this->icompanies = array();
12 $this->template_mod = $template_mod;
13 $this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . $_SERVER['QUERY_STRING']);
14 $this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
15 $this->assign("STYLE", $GLOBALS['style']);
16 $this->assign("WEB_ROOT", $GLOBALS['webroot'] );
17 $this->InsuranceCompany = new InsuranceCompany();
20 function default_action() {
21 return $this->list_action();
24 function edit_action($id = "",$patient_id="",$p_obj = null) {
25 if ($p_obj != null && get_class($p_obj) == "insurancecompany") {
26 $this->icompanies[0] = $p_obj;
28 elseif (get_class($this->icompanies[0]) != "insurancecompany" ) {
29 $this->icompanies[0] = new InsuranceCompany($id);
32 $x = new X12Partner();
33 $this->assign("x12_partners", $x->_utility_array($x->x12_partner_factory()));
35 $this->assign("insurancecompany", $this->icompanies[0]);
36 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
39 function list_action($sort = "") {
41 if (!empty($sort)) {
42 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("",$sort));
44 else {
45 $this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
48 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
52 function edit_action_process() {
53 if ($_POST['process'] != "true")
54 return;
55 //print_r($_POST);
56 if (is_numeric($_POST['id'])) {
57 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
59 else {
60 $this->icompanies[0] = new InsuranceCompany();
63 parent::populate_object($this->icompanies[0]);
65 $this->icompanies[0]->persist();
66 $this->icompanies[0]->populate();
68 //echo "action processeed";
69 $_POST['process'] = "";
70 header('Location:'.$GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&action=list");//Z&H