applying requested updates
[openemr.git] / controllers / C_X12Partner.class.php
blob952b4d5d8b116f83a00969d32cb3d6f5c07498dd
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once($GLOBALS['fileroot'] ."/library/classes/X12Partner.class.php");
6 class C_X12Partner extends Controller {
8 var $template_mod;
9 var $providers;
10 var $x12_partners;
12 function C_X12Partner($template_mod = "general") {
13 parent::Controller();
14 $this->x12_partner = 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&x12_partner&");
18 $this->assign("STYLE", $GLOBALS['style']);
21 function default_action() {
22 return $this->list_action();
25 function edit_action($id = "",$x_obj = null) {
26 if ($x_obj != null && get_class($x_obj) == "x12partner") {
27 $this->x12_partners[0] = $x_obj;
29 elseif (is_numeric($id)) {
30 $this->x12_partners[0] = new X12Partner($id);
32 else {
33 $this->x12_partners[0] = new X12Partner();
35 $this->assign("partner", $this->x12_partners[0]);
36 return $this->fetch($GLOBALS['template_dir'] . "x12_partners/" . $this->template_mod . "_edit.html");
39 function list_action() {
41 $x = new X12Partner();
42 //$x->set_name("Medi-Cal");
43 //$x->set_x12_sender_id("123454");
44 //$x->set_x12_receiver_id("123454");
45 //$x->persist();
46 //$x->populate();
48 $this->assign("partners", $x->x12_partner_factory());
49 return $this->fetch($GLOBALS['template_dir'] . "x12_partners/" . $this->template_mod . "_list.html");
53 function edit_action_process() {
54 if ($_POST['process'] != "true")
55 return;
56 //print_r($_POST);
57 if (is_numeric($_POST['id'])) {
58 $this->x12_partner[0] = new X12Partner($_POST['id']);
60 else {
61 $this->x12_partner[0] = new X12Partner();
64 parent::populate_object($this->x12_partner[0]);
66 $this->x12_partner[0]->persist();
67 //insurance numbers need to be repopulated so that insurance_company_name recieves a value
68 $this->x12_partner[0]->populate();
70 //echo "action processeed";
71 $_POST['process'] = "";
72 $this->_state = false;
73 return $this->edit_action(null,$this->x12_partner[0]);