3 require_once($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once($GLOBALS['fileroot'] . "/library/classes/InsuranceCompany.class.php");
5 require_once($GLOBALS['fileroot'] . "/library/classes/X12Partner.class.php");
7 class C_InsuranceCompany
extends Controller
{
12 function __construct($template_mod = "general") {
13 parent
::__construct();
14 $this->icompanies
= array();
15 $this->template_mod
= $template_mod;
16 $this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . $_SERVER['QUERY_STRING']);
17 $this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
18 $this->assign("STYLE", $GLOBALS['style']);
19 $this->assign("WEB_ROOT", $GLOBALS['webroot'] );
20 $this->InsuranceCompany
= new InsuranceCompany();
23 function default_action() {
24 return $this->list_action();
27 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;
31 elseif (get_class($this->icompanies
[0]) != "insurancecompany" ) {
32 $this->icompanies
[0] = new InsuranceCompany($id);
35 $x = new X12Partner();
36 $this->assign("x12_partners", $x->_utility_array($x->x12_partner_factory()));
38 $this->assign("insurancecompany", $this->icompanies
[0]);
39 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod
. "_edit.html");
42 function list_action($sort = "") {
45 $this->assign("icompanies", $this->InsuranceCompany
->insurance_companies_factory("",$sort));
48 $this->assign("icompanies", $this->InsuranceCompany
->insurance_companies_factory());
51 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod
. "_list.html");
55 function edit_action_process() {
56 if ($_POST['process'] != "true")
59 if (is_numeric($_POST['id'])) {
60 $this->icompanies
[0] = new InsuranceCompany($_POST['id']);
63 $this->icompanies
[0] = new InsuranceCompany();
66 parent
::populate_object($this->icompanies
[0]);
68 $this->icompanies
[0]->persist();
69 $this->icompanies
[0]->populate();
71 //echo "action processeed";
72 $_POST['process'] = "";
73 header('Location:'.$GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&action=list");//Z&H