fix from os2doc where duplicate encounter numbers with different PIDs were not considered
[openemr.git] / controllers / C_BillingContact.class.php
blob4d45533005deb282126e382ee50ccb9b35b4a5a8
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once($GLOBALS['fileroot'] ."/library/classes/InsuranceCompany.class.php");
6 class C_InsuranceCompany extends Controller {
8 var $template_mod;
9 var $icompanies;
11 function C_InsuranceCompany($template_mod = "general") {
12 parent::Controller();
13 $this->icompanies = array();
14 $this->template_mod = $template_mod;
15 $this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . $_SERVER['QUERY_STRING']);
16 $this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
17 $this->assign("STYLE", $GLOBALS['style']);
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 $this->assign("insurancecompany", $this->icompanies[0]);
33 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_edit.html");
36 function list_action($sort = "") {
38 if (!empty($sort)) {
39 $this->assign("icompanies", InsuranceCompany::insurance_companies_factory("",$sort));
41 else {
42 $this->assign("icompanies", InsuranceCompany::insurance_companies_factory());
45 return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
49 function edit_action_process() {
50 if ($_POST['process'] != "true")
51 return;
52 //print_r($_POST);
53 if (is_numeric($_POST['id'])) {
54 $this->icompanies[0] = new InsuranceCompany($_POST['id']);
56 else {
57 $this->icompanies[0] = new InsuranceCompany();
60 parent::populate_object($this->icompanies[0]);
61 //print_r($this->pharmacies[0]);
62 //echo $this->pharmacies[0]->toString(true);
64 $this->icompanies[0]->persist();
66 //echo "action processeed";
67 $_POST['process'] = "";