@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
25 | +if ( ! defined('BASEPATH')) |
|
26 | 26 | exit('No direct script access allowed'); |
27 | 27 | |
28 | 28 | class Charges_form { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | function get_charge_form_fields() { |
34 | - $form['forms'] = array(base_url() . 'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form')); |
|
34 | + $form['forms'] = array(base_url().'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form')); |
|
35 | 35 | $form['Information'] = array( |
36 | 36 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
37 | 37 | array('Name', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | $account_data = $this->CI->session->userdata("accountinfo"); |
53 | 53 | $loginid = $account_data['id']; |
54 | 54 | |
55 | - }else{ |
|
55 | + } else { |
|
56 | 56 | $loginid = "0"; |
57 | 57 | } |
58 | 58 | $form['forms'] = array("", array('id' => "charges_search")); |
59 | 59 | $form['Search'] = array( |
60 | 60 | array('Name', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
61 | - array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0,'reseller_id'=>$loginid)), |
|
61 | + array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0, 'reseller_id'=>$loginid)), |
|
62 | 62 | array('Amount', 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''), |
63 | 63 | array('Billing Cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
64 | 64 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | function build_charge_list_for_admin() { |
78 | 78 | |
79 | 79 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
80 | - $currency_id=$account_info['currency_id']; |
|
81 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
80 | + $currency_id = $account_info['currency_id']; |
|
81 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
82 | 82 | |
83 | 83 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
84 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
84 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
85 | 85 | /** |
86 | 86 | ASTPP 3.0 |
87 | 87 | For DID edit on DID number |
88 | 88 | **/ |
89 | - array(gettext("Name"), "140", "description", "", "", "","EDITABLE","true","center"), |
|
89 | + array(gettext("Name"), "140", "description", "", "", "", "EDITABLE", "true", "center"), |
|
90 | 90 | /**************************************************/ |
91 | - array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
92 | - array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency","","true","right"), |
|
93 | - array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"), |
|
94 | - array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"), |
|
91 | + array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"), |
|
92 | + array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"), |
|
93 | + array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"), |
|
94 | + array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"), |
|
95 | 95 | /** |
96 | 96 | ASTPP 3.0 |
97 | 97 | Show Creation date,last_modified date in reseller grid with admin login |
98 | 98 | **/ |
99 | - array(gettext("Status"), "125", "status", "status", "charges", "get_status","","true","center"), |
|
100 | - array(gettext("Created Date"), "150", "creation_date", "", "", "","","true","center"), |
|
101 | - array(gettext("Modified Date"), "150", "last_modified_date", "", "", "","","true","center"), |
|
99 | + array(gettext("Status"), "125", "status", "status", "charges", "get_status", "", "true", "center"), |
|
100 | + array(gettext("Created Date"), "150", "creation_date", "", "", "", "", "true", "center"), |
|
101 | + array(gettext("Modified Date"), "150", "last_modified_date", "", "", "", "", "true", "center"), |
|
102 | 102 | /************************************************/ |
103 | 103 | /* |
104 | 104 | ASTPP 3.0 |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | /********************************************/ |
115 | 115 | |
116 | 116 | function build_grid_buttons() { |
117 | - $buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"), |
|
118 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/charges/periodiccharges_delete_multiple/") |
|
117 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"), |
|
118 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/charges/periodiccharges_delete_multiple/") |
|
119 | 119 | )); |
120 | 120 | return $buttons_json; |
121 | 121 | } |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | function build_charges_list_for_customer($accountid, $accounttype) { |
124 | 124 | |
125 | 125 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
126 | - $currency_id=$account_info['currency_id']; |
|
127 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
126 | + $currency_id = $account_info['currency_id']; |
|
127 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
128 | 128 | |
129 | - $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "","","true","center"), |
|
130 | - array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency","","true","right"), |
|
131 | - array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"), |
|
132 | - array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"), |
|
133 | - array("Created Date", "150", "creation_date", "", "", "","","true","center"), |
|
134 | - array("Modified Date", "150", "last_modified_date", "", "", "","","true","center"), |
|
129 | + $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "", "", "true", "center"), |
|
130 | + array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"), |
|
131 | + array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"), |
|
132 | + array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"), |
|
133 | + array("Created Date", "150", "creation_date", "", "", "", "", "true", "center"), |
|
134 | + array("Modified Date", "150", "last_modified_date", "", "", "", "", "true", "center"), |
|
135 | 135 | array("Action", "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_subscription_action/delete/$accountid/$accounttype/", "mode" => "single"))) |
136 | 136 | )); |
137 | 137 | return $grid_field_arr; |
@@ -19,9 +19,9 @@ |
||
19 | 19 | |
20 | 20 | }); |
21 | 21 | </script> |
22 | - <script src="<?php echo base_url();?>assets/demo/sh/shBrushJScript.js"></script> |
|
23 | - <script src="<?php echo base_url();?>assets/demo/sh/shCore.js"></script> |
|
24 | - <script src="<?php echo base_url();?>assets/demo/jquery.searchabledropdown-1.0.8.src.js"></script> |
|
22 | + <script src="<?php echo base_url(); ?>assets/demo/sh/shBrushJScript.js"></script> |
|
23 | + <script src="<?php echo base_url(); ?>assets/demo/sh/shCore.js"></script> |
|
24 | + <script src="<?php echo base_url(); ?>assets/demo/jquery.searchabledropdown-1.0.8.src.js"></script> |
|
25 | 25 | |
26 | 26 | |
27 | 27 | <? endblock() ?> |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $this->db->insert("charges", $add_array); |
64 | 64 | $insert_id = $this->db->insert_id(); |
65 | 65 | $data = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $add_array['pricelist_id'])); |
66 | - if($data->num_rows > 0){ |
|
67 | - foreach ($data->result_array() as $key => $value){ |
|
66 | + if ($data->num_rows > 0) { |
|
67 | + foreach ($data->result_array() as $key => $value) { |
|
68 | 68 | $this->common->mail_to_users('add_subscription', $value); |
69 | 69 | } |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->db->where("id", $id); |
89 | 89 | $this->db->update("charges", $data); |
90 | 90 | |
91 | - if($data['pricelist_id'] == 0){ |
|
91 | + if ($data['pricelist_id'] == 0) { |
|
92 | 92 | $this->db->where("charge_id", $id); |
93 | 93 | $this->db->delete("charge_to_account"); |
94 | 94 | } |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | $data = $data->result_array(); |
104 | 104 | $data = $data[0]; |
105 | 105 | $data = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $data['pricelist_id'])); |
106 | - if($data->num_rows > 0){ |
|
107 | - foreach ($data->result_array() as $key => $value){ |
|
106 | + if ($data->num_rows > 0) { |
|
107 | + foreach ($data->result_array() as $key => $value) { |
|
108 | 108 | $this->common->mail_to_users('remove_subscription', $value); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | return true; |
112 | 112 | } |
113 | 113 | |
114 | - function add_account_charges($pricelistid,$chargeid,$flag){ |
|
115 | - if($flag){ |
|
114 | + function add_account_charges($pricelistid, $chargeid, $flag) { |
|
115 | + if ($flag) { |
|
116 | 116 | $this->db->where("charge_id", $chargeid); |
117 | 117 | $this->db->delete("charge_to_account"); |
118 | 118 | } |
119 | 119 | $account = $this->db_model->getSelect("*", "accounts", array("pricelist_id"=>$pricelistid)); |
120 | - if($account->num_rows > 0){ |
|
121 | - foreach ($account->result_array() as $key => $value){ |
|
122 | - $charge_arr = array("charge_id"=>$chargeid,"accountid"=>$value['id'],"assign_date"=>gmdate("Y-m-d H:i:s")); |
|
120 | + if ($account->num_rows > 0) { |
|
121 | + foreach ($account->result_array() as $key => $value) { |
|
122 | + $charge_arr = array("charge_id"=>$chargeid, "accountid"=>$value['id'], "assign_date"=>gmdate("Y-m-d H:i:s")); |
|
123 | 123 | $this->db->insert("charge_to_account", $charge_arr); |
124 | 124 | } |
125 | 125 | } |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | $this->load->library('csvreader'); |
36 | 36 | |
37 | 37 | if ($this->session->userdata('user_login') == FALSE) |
38 | - redirect(base_url() . '/astpp/login'); |
|
38 | + redirect(base_url().'/astpp/login'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | function did_add() { |
42 | 42 | $data['page_title'] = 'Create DID'; |
43 | 43 | $data['form'] = $this->form->build_form($this->did_form->get_dids_form_fields(), ''); |
44 | 44 | $data['country_id'] = $this->common->get_field_name('id', 'countrycode', array('country' => Common_model::$global_config['system_config']['country'])); |
45 | - if (!$data['country_id']) { |
|
45 | + if ( ! $data['country_id']) { |
|
46 | 46 | $data['country_id'] = 1; |
47 | 47 | } |
48 | 48 | $this->load->view('view_did_add_edit', $data); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $data['country_id'] = Common_model::$global_config['system_config']['country']; |
65 | 65 | } |
66 | 66 | /* * ************************************************* */ |
67 | - if (!$data['country_id']) { |
|
67 | + if ( ! $data['country_id']) { |
|
68 | 68 | $data['country_id'] = 1; |
69 | 69 | } |
70 | 70 | $edit_data['setup'] = $this->common_model->to_calculate_currency($edit_data['setup'], '', '', false, false); |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | |
84 | 84 | function did_save() { |
85 | 85 | $add_array = $this->input->post(); |
86 | - $parent_id =isset($add_array['parent_id']) && $add_array['parent_id'] >0 ? $add_array['parent_id'] : ''; |
|
87 | - $accountid =isset($add_array['accountid']) && $add_array['accountid'] > 0 ? $add_array['accountid'] : ''; |
|
88 | - $data['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($add_array['id'],$parent_id,$accountid), $add_array); |
|
86 | + $parent_id = isset($add_array['parent_id']) && $add_array['parent_id'] > 0 ? $add_array['parent_id'] : ''; |
|
87 | + $accountid = isset($add_array['accountid']) && $add_array['accountid'] > 0 ? $add_array['accountid'] : ''; |
|
88 | + $data['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($add_array['id'], $parent_id, $accountid), $add_array); |
|
89 | 89 | if ($add_array['id'] != '') { |
90 | 90 | $data['page_title'] = 'Edit DID'; |
91 | 91 | if ($this->form_validation->run() == FALSE) { |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | } else { |
96 | 96 | $number = $add_array['number']; |
97 | 97 | unset($add_array['number']); |
98 | - $add_array['accountid']=isset($add_array['accountid']) ?$add_array['accountid'] : 0; |
|
98 | + $add_array['accountid'] = isset($add_array['accountid']) ? $add_array['accountid'] : 0; |
|
99 | 99 | $add_array['setup'] = $this->common_model->add_calculate_currency($add_array['setup'], '', '', false, false); |
100 | 100 | $add_array['monthlycost'] = $this->common_model->add_calculate_currency($add_array['monthlycost'], '', '', false, false); |
101 | 101 | $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false); |
102 | 102 | $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false); |
103 | 103 | $this->did_model->edit_did($add_array, $add_array['id'], $number); |
104 | - echo json_encode(array("SUCCESS" => $number . " DID Updated Successfully!")); |
|
104 | + echo json_encode(array("SUCCESS" => $number." DID Updated Successfully!")); |
|
105 | 105 | exit; |
106 | 106 | } |
107 | 107 | } else { |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $add_array['monthlycost'] = $this->common_model->add_calculate_currency($add_array['monthlycost'], '', '', false, false); |
121 | 121 | $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false); |
122 | 122 | $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false); |
123 | - $add_array['accountid']=isset($add_array['accountid'])?$add_array['accountid'] : 0; |
|
123 | + $add_array['accountid'] = isset($add_array['accountid']) ? $add_array['accountid'] : 0; |
|
124 | 124 | $this->did_model->add_did($add_array); |
125 | - echo json_encode(array("SUCCESS" => $add_array["number"] . " DID Added Successfully!")); |
|
125 | + echo json_encode(array("SUCCESS" => $add_array["number"]." DID Added Successfully!")); |
|
126 | 126 | exit; |
127 | 127 | exit; |
128 | 128 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | function did_remove($id) { |
133 | 133 | $this->did_model->remove_did($id); |
134 | 134 | $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully!'); |
135 | - redirect(base_url() . 'did/did_list/'); |
|
135 | + redirect(base_url().'did/did_list/'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /* |
@@ -141,54 +141,54 @@ discard block |
||
141 | 141 | */ |
142 | 142 | |
143 | 143 | function did_list_release($id) { |
144 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
145 | - $this->db->where('id',$id); |
|
144 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
145 | + $this->db->where('id', $id); |
|
146 | 146 | $this->db->select('parent_id,accountid,number'); |
147 | - $did_info=(array)$this->db->get('dids')->first_row(); |
|
148 | - if($did_info['parent_id'] > 0){ |
|
149 | - $str=$this->common->get_parent_info($did_info['parent_id'],$accountinfo['id']); |
|
150 | - $str=rtrim($str,","); |
|
151 | - $account_result=(array)$this->db->get_where('accounts',"id IN (".$str.")")->result_array(); |
|
152 | - foreach($account_result as $key=>$acc_row){ |
|
153 | - $acc_row['did_number']=$did_info['number']; |
|
147 | + $did_info = (array)$this->db->get('dids')->first_row(); |
|
148 | + if ($did_info['parent_id'] > 0) { |
|
149 | + $str = $this->common->get_parent_info($did_info['parent_id'], $accountinfo['id']); |
|
150 | + $str = rtrim($str, ","); |
|
151 | + $account_result = (array)$this->db->get_where('accounts', "id IN (".$str.")")->result_array(); |
|
152 | + foreach ($account_result as $key=>$acc_row) { |
|
153 | + $acc_row['did_number'] = $did_info['number']; |
|
154 | 154 | $this->common->mail_to_users('email_remove_did', $acc_row); |
155 | 155 | } |
156 | 156 | } |
157 | - if($accountinfo['type'] == -1){ |
|
158 | - $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s")); |
|
157 | + if ($accountinfo['type'] == -1) { |
|
158 | + $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00", "last_modified_date"=>gmdate("Y-m-d H:i:s")); |
|
159 | 159 | $where = array('id' => $id); |
160 | 160 | $this->db->where($where); |
161 | 161 | $this->db->update('dids', $update_array); |
162 | - if($did_info['parent_id'] > 0){ |
|
163 | - $this->db->where('note',$did_info['number']); |
|
162 | + if ($did_info['parent_id'] > 0) { |
|
163 | + $this->db->where('note', $did_info['number']); |
|
164 | 164 | $this->db->delete("reseller_pricing"); |
165 | 165 | } |
166 | - }else{ |
|
167 | - $reseller_ids=$this->common->get_subreseller_info($accountinfo['id']); |
|
168 | - $reseller_ids=rtrim($reseller_ids,","); |
|
169 | - $where="parent_id IN ($reseller_ids)"; |
|
170 | - $this->db->where('note',$did_info['number']); |
|
171 | - $this->db->delete('reseller_pricing',$where); |
|
166 | + } else { |
|
167 | + $reseller_ids = $this->common->get_subreseller_info($accountinfo['id']); |
|
168 | + $reseller_ids = rtrim($reseller_ids, ","); |
|
169 | + $where = "parent_id IN ($reseller_ids)"; |
|
170 | + $this->db->where('note', $did_info['number']); |
|
171 | + $this->db->delete('reseller_pricing', $where); |
|
172 | 172 | } |
173 | - if($accountinfo['type']==1){ |
|
174 | - $update_array = array('parent_id' => $accountinfo['id'], 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s")); |
|
175 | - }else{ |
|
176 | - $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s")); |
|
173 | + if ($accountinfo['type'] == 1) { |
|
174 | + $update_array = array('parent_id' => $accountinfo['id'], 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00", "last_modified_date"=>gmdate("Y-m-d H:i:s")); |
|
175 | + } else { |
|
176 | + $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00", "last_modified_date"=>gmdate("Y-m-d H:i:s")); |
|
177 | 177 | } |
178 | 178 | $where = array('id' => $id); |
179 | 179 | $this->db->where($where); |
180 | 180 | $this->db->update('dids', $update_array); |
181 | - $accountid=$did_info['accountid'] > 0 ? $did_info['accountid']:0; |
|
182 | - if($did_info['accountid'] > 0 ){ |
|
183 | - $email_user_id=$did_info['accountid']; |
|
184 | - }elseif($did_info['parent_id'] > 0){ |
|
185 | - $email_user_id=$did_info['parent_id']; |
|
181 | + $accountid = $did_info['accountid'] > 0 ? $did_info['accountid'] : 0; |
|
182 | + if ($did_info['accountid'] > 0) { |
|
183 | + $email_user_id = $did_info['accountid']; |
|
184 | + }elseif ($did_info['parent_id'] > 0) { |
|
185 | + $email_user_id = $did_info['parent_id']; |
|
186 | 186 | } |
187 | - $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$email_user_id))->first_row(); |
|
187 | + $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$email_user_id))->first_row(); |
|
188 | 188 | $accountinfo['did_number'] = $did_info['number']; |
189 | 189 | $this->common->mail_to_users('email_remove_did', $accountinfo); |
190 | 190 | $this->session->set_flashdata('astpp_errormsg', 'DID Released Successfully!'); |
191 | - redirect(base_url() . 'did/did_list/'); |
|
191 | + redirect(base_url().'did/did_list/'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | function did_list() { |
@@ -204,33 +204,33 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | if ($this->session->userdata['userlevel_logintype'] == '1') { |
207 | - $drp_list=array(); |
|
207 | + $drp_list = array(); |
|
208 | 208 | $accountinfo = $this->session->userdata('accountinfo'); |
209 | - if($accountinfo['reseller_id'] > 0){ |
|
210 | - $dids_array=$this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo['reseller_id']." AND a.parent_id =".$accountinfo['reseller_id'])->result_array(); |
|
211 | - }else{ |
|
209 | + if ($accountinfo['reseller_id'] > 0) { |
|
210 | + $dids_array = $this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo['reseller_id']." AND a.parent_id =".$accountinfo['reseller_id'])->result_array(); |
|
211 | + } else { |
|
212 | 212 | $this->db->select('id,monthlycost,setup,number'); |
213 | - $this->db->where('accountid',0); |
|
214 | - $this->db->where('parent_id',0); |
|
215 | - $dids_array=$this->db->get('dids')->result_array(); |
|
213 | + $this->db->where('accountid', 0); |
|
214 | + $this->db->where('parent_id', 0); |
|
215 | + $dids_array = $this->db->get('dids')->result_array(); |
|
216 | 216 | } |
217 | - if(!empty($dids_array)){ |
|
217 | + if ( ! empty($dids_array)) { |
|
218 | 218 | foreach ($dids_array as $drp_value) { |
219 | - if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
219 | + if ( ! empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
220 | 220 | $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'], '', '', true, false); |
221 | 221 | } else { |
222 | 222 | $did_cost = 0; |
223 | 223 | } |
224 | - if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
224 | + if ( ! empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
225 | 225 | $did_setup = $this->common_model->to_calculate_currency($drp_value['setup'], '', '', true, false); |
226 | 226 | } else { |
227 | 227 | $did_setup = 0; |
228 | 228 | } |
229 | - $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
229 | + $drp_list[$drp_value['id']] = $drp_value['number'].' ( Setup : '.$did_setup.')'.'( Monthly : '.$did_cost.' )'; |
|
230 | 230 | /* * ********************************************************************************************* */ |
231 | 231 | } |
232 | 232 | } |
233 | - $data['didlist'] = form_dropdown_all(array("name"=>"free_did_list","id"=>"free_did_list","class"=>"did_dropdown"), $drp_list, ''); |
|
233 | + $data['didlist'] = form_dropdown_all(array("name"=>"free_did_list", "id"=>"free_did_list", "class"=>"did_dropdown"), $drp_list, ''); |
|
234 | 234 | } |
235 | 235 | if ($this->session->userdata['userlevel_logintype'] == '1') { |
236 | 236 | $data['grid_fields'] = $this->did_form->build_did_list_for_reseller_login(); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $this->session->set_userdata('did_list_search', $action); |
271 | 271 | } |
272 | 272 | if (@$ajax_search != 1) { |
273 | - redirect(base_url() . 'did/did_list/'); |
|
273 | + redirect(base_url().'did/did_list/'); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
@@ -318,10 +318,10 @@ discard block |
||
318 | 318 | */ |
319 | 319 | function customer_did($accountid, $accounttype) { |
320 | 320 | $json_data = array(); |
321 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_did'); |
|
322 | - $account_arr=(array)$this->db->get_where('accounts',array("id"=>$accountid))->first_row(); |
|
321 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_did'); |
|
322 | + $account_arr = (array)$this->db->get_where('accounts', array("id"=>$accountid))->first_row(); |
|
323 | 323 | $field_name = $accounttype == "reseller" ? "parent_id" : 'accountid'; |
324 | - $like_str=!empty($instant_search) ? |
|
324 | + $like_str = ! empty($instant_search) ? |
|
325 | 325 | "(a.note like '%$instant_search%' |
326 | 326 | OR a.init_inc like '%$instant_search%' |
327 | 327 | OR a.inc like '%$instant_search%' |
@@ -330,32 +330,32 @@ discard block |
||
330 | 330 | OR a.setup like '%$instant_search%' |
331 | 331 | OR a.monthlycost like '%$instant_search%' |
332 | 332 | OR a.connectcost like '%$instant_search%' |
333 | - )" :null; |
|
333 | + )" : null; |
|
334 | 334 | if ($account_arr['reseller_id'] != 0) { |
335 | - if(!empty($like_str)) |
|
335 | + if ( ! empty($like_str)) |
|
336 | 336 | $this->db->where($like_str); |
337 | - if($accounttype=='reseller'){ |
|
338 | - $this->db->where('a.note','b.number',false); |
|
339 | - $this->db->where('a.reseller_id',$account_arr['id']); |
|
340 | - $this->db->where('a.parent_id',$account_arr['reseller_id']); |
|
337 | + if ($accounttype == 'reseller') { |
|
338 | + $this->db->where('a.note', 'b.number', false); |
|
339 | + $this->db->where('a.reseller_id', $account_arr['id']); |
|
340 | + $this->db->where('a.parent_id', $account_arr['reseller_id']); |
|
341 | 341 | $this->db->select('count(a.id) as count'); |
342 | - $count_result=(array)$this->db->get('reseller_pricing as a,dids as b')->first_row(); |
|
342 | + $count_result = (array)$this->db->get('reseller_pricing as a,dids as b')->first_row(); |
|
343 | 343 | $paging_data = $this->form->load_grid_config($count_result['count'], $_GET['rp'], $_GET['page']); |
344 | 344 | $json_data = $paging_data["json_paging"]; |
345 | - $this->db->where('a.note','b.number',false); |
|
346 | - $this->db->where('a.reseller_id',$account_arr['id']); |
|
347 | - $this->db->where('a.parent_id',$account_arr['reseller_id']); |
|
345 | + $this->db->where('a.note', 'b.number', false); |
|
346 | + $this->db->where('a.reseller_id', $account_arr['id']); |
|
347 | + $this->db->where('a.parent_id', $account_arr['reseller_id']); |
|
348 | 348 | $this->db->select('a . * , b.id, a.reseller_id AS accountid,a.note as number,b.country_id as country_id'); |
349 | - $this->db->limit($paging_data["paging"]["page_no"],$paging_data["paging"]["start"]); |
|
350 | - $query=$this->db->get('reseller_pricing as a,dids as b'); |
|
351 | - }else{ |
|
352 | - $count_result=(array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr['reseller_id'])->first_row(); |
|
349 | + $this->db->limit($paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
350 | + $query = $this->db->get('reseller_pricing as a,dids as b'); |
|
351 | + } else { |
|
352 | + $count_result = (array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr['reseller_id'])->first_row(); |
|
353 | 353 | $paging_data = $this->form->load_grid_config($count_result['count'], $_GET['rp'], $_GET['page']); |
354 | 354 | $json_data = $paging_data["json_paging"]; |
355 | - $query=$this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr['id']." AND a.note = b.number AND a.reseller_id =".$account_arr['reseller_id']); |
|
355 | + $query = $this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr['id']." AND a.note = b.number AND a.reseller_id =".$account_arr['reseller_id']); |
|
356 | 356 | } |
357 | - }else{ |
|
358 | - $like_str=!empty($instant_search) ? |
|
357 | + } else { |
|
358 | + $like_str = ! empty($instant_search) ? |
|
359 | 359 | "(dids.number like '%$instant_search%' |
360 | 360 | OR dids.inc like '%$instant_search%' |
361 | 361 | OR dids.cost like '%$instant_search%' |
@@ -363,14 +363,14 @@ discard block |
||
363 | 363 | OR dids.setup like '%$instant_search%' |
364 | 364 | OR dids.monthlycost like '%$instant_search%' |
365 | 365 | OR dids.connectcost like '%$instant_search%' |
366 | - )" :null; |
|
367 | - if(!empty($like_str)) |
|
366 | + )" : null; |
|
367 | + if ( ! empty($like_str)) |
|
368 | 368 | $this->db->where($like_str); |
369 | 369 | $where = array($field_name => $accountid); |
370 | 370 | $count_all = $this->db_model->countQuery("*", "dids", $where); |
371 | 371 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
372 | 372 | $json_data = $paging_data["json_paging"]; |
373 | - if(!empty($like_str)) |
|
373 | + if ( ! empty($like_str)) |
|
374 | 374 | $this->db->where($like_str); |
375 | 375 | $query = $this->db_model->select("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
376 | 376 | } |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | $ids = $this->input->post("selected_ids", true); |
383 | 383 | $where = "id IN ($ids)"; |
384 | 384 | $this->db->where($where); |
385 | - $this->db->select("group_concat(concat('''',number,'''')) as number",false); |
|
386 | - $dids_result=(array)$this->db->get('dids')->first_row(); |
|
387 | - $notes_where="note IN (".$dids_result['number'].")"; |
|
385 | + $this->db->select("group_concat(concat('''',number,'''')) as number", false); |
|
386 | + $dids_result = (array)$this->db->get('dids')->first_row(); |
|
387 | + $notes_where = "note IN (".$dids_result['number'].")"; |
|
388 | 388 | $this->db->where($notes_where); |
389 | 389 | $this->db->delete('reseller_pricing'); |
390 | 390 | $this->db->where($where); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function did_reseller_edit($action = false, $id = false) { |
400 | 400 | $data['page_title'] = 'Edit DID '; |
401 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
401 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
402 | 402 | if ($action == 'edit') { |
403 | 403 | if (($this->input->post())) { |
404 | 404 | $post = $this->input->post(); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $accountinfo = $this->did_model->get_account($accountinfo['number']); |
428 | 428 | $reseller_did = $this->db_model->getSelect("*", "reseller_pricing", array('id' => $id)); |
429 | 429 | $reseller_didinfo = (array)$reseller_did->first_row(); |
430 | - if (!empty($reseller_didinfo)) { |
|
430 | + if ( ! empty($reseller_didinfo)) { |
|
431 | 431 | $reseller_didinfo['setup'] = $this->common_model->to_calculate_currency($reseller_didinfo['setup'], '', '', true, false); |
432 | 432 | $reseller_didinfo['monthlycost'] = $this->common_model->to_calculate_currency($reseller_didinfo['monthlycost'], '', '', true, false); |
433 | 433 | $reseller_didinfo['connectcost'] = $this->common_model->to_calculate_currency($reseller_didinfo['connectcost'], '', '', true, false); |
@@ -441,43 +441,43 @@ discard block |
||
441 | 441 | } |
442 | 442 | } |
443 | 443 | if ($action == 'delete') { |
444 | - $this->db->where('id',$id); |
|
444 | + $this->db->where('id', $id); |
|
445 | 445 | $this->db->select('note'); |
446 | - $reseller_pricing=(array)$this->db->get('reseller_pricing')->first_row(); |
|
447 | - $did_number=$reseller_pricing['note']; |
|
448 | - $did_info=(array)$this->db->get_where('dids',array('number'=>$did_number))->first_row(); |
|
449 | - $query="select count(id) as count from reseller_pricing where id >= (select id from reseller_pricing where note =$did_number AND parent_id =".$accountinfo['reseller_id']." AND reseller_id =".$accountinfo['id'].") AND note= $did_number order by id desc"; |
|
450 | - $result=(array)$this->db->query($query)->first_row(); |
|
451 | - if($result['count'] > 0){ |
|
452 | - $str=$this->common->get_parent_info($did_info['parent_id'],$accountinfo['id']); |
|
453 | - $str=rtrim($str,","); |
|
454 | - $account_result=(array)$this->db->get_where('accounts',"id IN (".$str.")")->result_array(); |
|
455 | - foreach($account_result as $key=>$acc_row){ |
|
456 | - $acc_row['did_number']=$did_info['number']; |
|
446 | + $reseller_pricing = (array)$this->db->get('reseller_pricing')->first_row(); |
|
447 | + $did_number = $reseller_pricing['note']; |
|
448 | + $did_info = (array)$this->db->get_where('dids', array('number'=>$did_number))->first_row(); |
|
449 | + $query = "select count(id) as count from reseller_pricing where id >= (select id from reseller_pricing where note =$did_number AND parent_id =".$accountinfo['reseller_id']." AND reseller_id =".$accountinfo['id'].") AND note= $did_number order by id desc"; |
|
450 | + $result = (array)$this->db->query($query)->first_row(); |
|
451 | + if ($result['count'] > 0) { |
|
452 | + $str = $this->common->get_parent_info($did_info['parent_id'], $accountinfo['id']); |
|
453 | + $str = rtrim($str, ","); |
|
454 | + $account_result = (array)$this->db->get_where('accounts', "id IN (".$str.")")->result_array(); |
|
455 | + foreach ($account_result as $key=>$acc_row) { |
|
456 | + $acc_row['did_number'] = $did_info['number']; |
|
457 | 457 | $this->common->mail_to_users('email_remove_did', $acc_row); |
458 | 458 | } |
459 | - $reseller_ids=$this->common->get_subreseller_info($accountinfo['id']); |
|
460 | - $reseller_ids=rtrim($reseller_ids,","); |
|
461 | - $where="parent_id IN ($reseller_ids)"; |
|
462 | - $this->db->where('note',$did_info['number']); |
|
463 | - $this->db->delete('reseller_pricing',$where); |
|
464 | - $this->db->where('reseller_id',$accountinfo['id']); |
|
465 | - $this->db->where('note',$did_info['number']); |
|
459 | + $reseller_ids = $this->common->get_subreseller_info($accountinfo['id']); |
|
460 | + $reseller_ids = rtrim($reseller_ids, ","); |
|
461 | + $where = "parent_id IN ($reseller_ids)"; |
|
462 | + $this->db->where('note', $did_info['number']); |
|
463 | + $this->db->delete('reseller_pricing', $where); |
|
464 | + $this->db->where('reseller_id', $accountinfo['id']); |
|
465 | + $this->db->where('note', $did_info['number']); |
|
466 | 466 | $this->db->delete('reseller_pricing'); |
467 | 467 | } |
468 | - $this->db->where('number',$did_number); |
|
468 | + $this->db->where('number', $did_number); |
|
469 | 469 | $this->db->select('accountid'); |
470 | - $did_array=(array)$this->db->get('dids')->first_row(); |
|
471 | - if($did_array['accountid'] > 0){ |
|
472 | - $customer_info=(array)$this->db->get_where('accounts',array('id'=>$did_array['accountid']))->first_row(); |
|
473 | - $customer_info['did_number']=$did_number; |
|
470 | + $did_array = (array)$this->db->get('dids')->first_row(); |
|
471 | + if ($did_array['accountid'] > 0) { |
|
472 | + $customer_info = (array)$this->db->get_where('accounts', array('id'=>$did_array['accountid']))->first_row(); |
|
473 | + $customer_info['did_number'] = $did_number; |
|
474 | 474 | $this->common->mail_to_users('email_remove_did', $customer_info); |
475 | 475 | } |
476 | - $did_array=array("accountid"=>0,"parent_id"=>$accountinfo['reseller_id'], "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00"); |
|
477 | - $this->db->where('number',$did_number); |
|
478 | - $this->db->update('dids',$did_array); |
|
476 | + $did_array = array("accountid"=>0, "parent_id"=>$accountinfo['reseller_id'], "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00"); |
|
477 | + $this->db->where('number', $did_number); |
|
478 | + $this->db->update('dids', $did_array); |
|
479 | 479 | $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully!'); |
480 | - redirect(base_url() . 'did/did_list/'); |
|
480 | + redirect(base_url().'did/did_list/'); |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
@@ -486,37 +486,37 @@ discard block |
||
486 | 486 | $accountinfo = $this->session->userdata('accountinfo'); |
487 | 487 | $where = array('id' => $accountinfo['id']); |
488 | 488 | $account = $this->db_model->getSelect("*", "accounts", $where); |
489 | - $currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id'])); |
|
490 | - $accountinfo= (array)$account->first_row(); |
|
489 | + $currency_name = $this->common->get_field_name('currency', "currency", array('id'=>$accountinfo['currency_id'])); |
|
490 | + $accountinfo = (array)$account->first_row(); |
|
491 | 491 | if (($this->input->post())) { |
492 | 492 | $post = $this->input->post(); |
493 | 493 | if (isset($post['free_did_list']) && $post['free_did_list'] != '') { |
494 | 494 | // For deduction of admin price to reseller |
495 | 495 | $didinfo = $this->did_model->get_did_by_number($post['free_did_list']); |
496 | - if($accountinfo['reseller_id'] > 0 ){ |
|
497 | - $reseller_pricing_query = $this->db_model->getSelect("call_type,setup,extensions,monthlycost,connectcost,includedseconds,cost,inc", "reseller_pricing", array("note" => $didinfo['number'],'reseller_id'=>$accountinfo['reseller_id'])); |
|
496 | + if ($accountinfo['reseller_id'] > 0) { |
|
497 | + $reseller_pricing_query = $this->db_model->getSelect("call_type,setup,extensions,monthlycost,connectcost,includedseconds,cost,inc", "reseller_pricing", array("note" => $didinfo['number'], 'reseller_id'=>$accountinfo['reseller_id'])); |
|
498 | 498 | $reseller_pricing_result = (array)$reseller_pricing_query->first_row(); |
499 | - $didinfo['call_type']=$reseller_pricing_result['call_type']; |
|
500 | - $didinfo['extensions']=$reseller_pricing_result['extensions']; |
|
501 | - $didinfo['setup']=$reseller_pricing_result['setup']; |
|
502 | - $didinfo['monthlycost']=$reseller_pricing_result['monthlycost']; |
|
503 | - $didinfo['connectcost']=$reseller_pricing_result['connectcost']; |
|
504 | - $didinfo['includedseconds']=$reseller_pricing_result['includedseconds']; |
|
505 | - $didinfo['cost']=$reseller_pricing_result['cost']; |
|
506 | - $didinfo['inc']=$reseller_pricing_result['inc']; |
|
499 | + $didinfo['call_type'] = $reseller_pricing_result['call_type']; |
|
500 | + $didinfo['extensions'] = $reseller_pricing_result['extensions']; |
|
501 | + $didinfo['setup'] = $reseller_pricing_result['setup']; |
|
502 | + $didinfo['monthlycost'] = $reseller_pricing_result['monthlycost']; |
|
503 | + $didinfo['connectcost'] = $reseller_pricing_result['connectcost']; |
|
504 | + $didinfo['includedseconds'] = $reseller_pricing_result['includedseconds']; |
|
505 | + $didinfo['cost'] = $reseller_pricing_result['cost']; |
|
506 | + $didinfo['inc'] = $reseller_pricing_result['inc']; |
|
507 | 507 | } |
508 | 508 | $available_bal = $this->db_model->get_available_bal($accountinfo); |
509 | 509 | $accountinfo['did_number'] = $didinfo['number']; |
510 | 510 | $accountinfo['did_country_id'] = $didinfo['country_id']; |
511 | - $accountinfo['did_setup'] = $this->common_model->calculate_currency($didinfo['setup'],'',$currency_name,true,true); |
|
512 | - $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($didinfo['monthlycost'],'',$currency_name,true,true); |
|
511 | + $accountinfo['did_setup'] = $this->common_model->calculate_currency($didinfo['setup'], '', $currency_name, true, true); |
|
512 | + $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($didinfo['monthlycost'], '', $currency_name, true, true); |
|
513 | 513 | $accountinfo['did_maxchannels'] = $didinfo['maxchannels']; |
514 | 514 | if ($available_bal >= $didinfo["setup"]) { |
515 | 515 | $available_bal = $this->db_model->update_balance($didinfo['setup'], $accountinfo['id'], "debit"); |
516 | - $this->db_model->update("dids", array('parent_id' => $accountinfo['id'],"assign_date"=>gmdate("Y-m-d H:i:s")), array("id" => $didinfo['id'])); |
|
516 | + $this->db_model->update("dids", array('parent_id' => $accountinfo['id'], "assign_date"=>gmdate("Y-m-d H:i:s")), array("id" => $didinfo['id'])); |
|
517 | 517 | $this->did_model->insert_reseller_pricing($accountinfo, $didinfo); |
518 | - $this->common->add_invoice_details($accountinfo,"DIDCHRG",$didinfo['setup'],$didinfo['number']); |
|
519 | - $this->common->mail_to_users('email_add_did', $accountinfo,"",$didinfo['number']); |
|
518 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $didinfo['setup'], $didinfo['number']); |
|
519 | + $this->common->mail_to_users('email_add_did', $accountinfo, "", $didinfo['number']); |
|
520 | 520 | $this->session->set_flashdata('astpp_errormsg', 'DID Purchased Successfully.'); |
521 | 521 | } else { |
522 | 522 | $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $this->session->set_flashdata('astpp_notification', 'Please Select DID.'); |
526 | 526 | } |
527 | 527 | } |
528 | - redirect(base_url() . 'did/did_list/'); |
|
528 | + redirect(base_url().'did/did_list/'); |
|
529 | 529 | exit; |
530 | 530 | } |
531 | 531 | |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | |
548 | 548 | function did_download_sample_file($file_name) { |
549 | 549 | $this->load->helper('download'); |
550 | - $full_path = base_url() . "assets/Rates_File/" . $file_name . ".csv"; |
|
551 | - $arrContextOptions=array( |
|
550 | + $full_path = base_url()."assets/Rates_File/".$file_name.".csv"; |
|
551 | + $arrContextOptions = array( |
|
552 | 552 | "ssl"=>array( |
553 | 553 | "verify_peer"=>false, |
554 | 554 | "verify_peer_name"=>false, |
@@ -567,28 +567,28 @@ discard block |
||
567 | 567 | $this->session->set_userdata('import_did_rate_csv', ""); |
568 | 568 | $error_data = $this->session->userdata('import_did_csv_error'); |
569 | 569 | $full_path = $this->config->item('rates-file-path'); |
570 | - if (file_exists($full_path . $error_data) && $error_data != "") { |
|
571 | - unlink($full_path . $error_data); |
|
570 | + if (file_exists($full_path.$error_data) && $error_data != "") { |
|
571 | + unlink($full_path.$error_data); |
|
572 | 572 | $this->session->set_userdata('import_did_csv_error', ""); |
573 | 573 | } |
574 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
575 | - $this->db->where('id',$accountinfo['currency_id']); |
|
574 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
575 | + $this->db->where('id', $accountinfo['currency_id']); |
|
576 | 576 | $this->db->select('currency'); |
577 | - $currency_info=(array)$this->db->get('currency')->first_row(); |
|
578 | - $data['fields']="DID,Country,Account,Per Minute Cost(".$currency_info['currency']."),Initial Increment,Increment,Setup Fee(".$currency_info['currency']."),Monthly Fee(".$currency_info['currency']."),Call Type,Destination,Status"; |
|
577 | + $currency_info = (array)$this->db->get('currency')->first_row(); |
|
578 | + $data['fields'] = "DID,Country,Account,Per Minute Cost(".$currency_info['currency']."),Initial Increment,Increment,Setup Fee(".$currency_info['currency']."),Monthly Fee(".$currency_info['currency']."),Call Type,Destination,Status"; |
|
579 | 579 | $this->load->view('view_import_did', $data); |
580 | 580 | } |
581 | 581 | |
582 | 582 | function did_preview_file() { |
583 | 583 | $data['page_title'] = 'Import DIDs'; |
584 | 584 | $config_did_array = $this->config->item('DID-rates-field'); |
585 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
586 | - $this->db->where('id',$accountinfo['currency_id']); |
|
585 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
586 | + $this->db->where('id', $accountinfo['currency_id']); |
|
587 | 587 | $this->db->select('currency'); |
588 | - $currency_info=(array)$this->db->get('currency')->first_row(); |
|
589 | - foreach($config_did_array as $key=>$value){ |
|
588 | + $currency_info = (array)$this->db->get('currency')->first_row(); |
|
589 | + foreach ($config_did_array as $key=>$value) { |
|
590 | 590 | $key = str_replace('CURRENCY', $currency_info['currency'], $key); |
591 | - $did_fields_array[$key]=$value; |
|
591 | + $did_fields_array[$key] = $value; |
|
592 | 592 | } |
593 | 593 | $check_header = $this->input->post('check_header', true); |
594 | 594 | $invalid_flag = false; |
@@ -599,10 +599,10 @@ discard block |
||
599 | 599 | if ($error == 0) { |
600 | 600 | $uploadedFile = $_FILES["didimport"]["tmp_name"]; |
601 | 601 | $full_path = $this->config->item('rates-file-path'); |
602 | - $actual_file_name = "ASTPP-DIDs-" . date("Y-m-d H:i:s") . "." . $ext; |
|
603 | - if (move_uploaded_file($uploadedFile, $full_path . $actual_file_name)) { |
|
602 | + $actual_file_name = "ASTPP-DIDs-".date("Y-m-d H:i:s").".".$ext; |
|
603 | + if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) { |
|
604 | 604 | $data['page_title'] = 'Import DIDs Preview'; |
605 | - $data['csv_tmp_data'] = $this->csvreader->parse_file($full_path . $actual_file_name, $did_fields_array, $check_header); |
|
605 | + $data['csv_tmp_data'] = $this->csvreader->parse_file($full_path.$actual_file_name, $did_fields_array, $check_header); |
|
606 | 606 | $data['provider_id'] = $_POST['provider_id']; |
607 | 607 | $data['check_header'] = $check_header; |
608 | 608 | $this->session->set_userdata('import_did_rate_csv', $actual_file_name); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | if ($invalid_flag) { |
620 | 620 | $str = ''; |
621 | 621 | if (empty($_FILES['didimport']['name'])) { |
622 | - $str.= '<br/>Please Select File.'; |
|
622 | + $str .= '<br/>Please Select File.'; |
|
623 | 623 | } |
624 | 624 | $data['error'] = $str; |
625 | 625 | } |
@@ -630,35 +630,35 @@ discard block |
||
630 | 630 | $new_final_arr = array(); |
631 | 631 | $invalid_array = array(); |
632 | 632 | $new_final_arr_key = $this->config->item('DID-rates-field'); |
633 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
634 | - $reseller_id = $accountinfo['type']==1 ? $accountinfo['id']: 0; |
|
633 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
634 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
635 | 635 | |
636 | 636 | $full_path = $this->config->item('rates-file-path'); |
637 | 637 | $did_file_name = $this->session->userdata('import_did_rate_csv'); |
638 | - $csv_tmp_data = $this->csvreader->parse_file($full_path . $did_file_name, $new_final_arr_key, $check_header); |
|
638 | + $csv_tmp_data = $this->csvreader->parse_file($full_path.$did_file_name, $new_final_arr_key, $check_header); |
|
639 | 639 | $flag = false; |
640 | 640 | $i = 0; |
641 | 641 | $number_arr = array(); |
642 | - $reseller_array=array(); |
|
643 | - $final_reseller_array=array(); |
|
642 | + $reseller_array = array(); |
|
643 | + $final_reseller_array = array(); |
|
644 | 644 | foreach ($csv_tmp_data as $key => $csv_data) { |
645 | 645 | |
646 | 646 | if (isset($csv_data['number']) && $csv_data['number'] != '' && $i != 0) { |
647 | 647 | $str = null; |
648 | - if(isset($csv_data['call_type'])){ |
|
649 | - if(strtolower($csv_data['call_type']) == 'sip-did'){ |
|
648 | + if (isset($csv_data['call_type'])) { |
|
649 | + if (strtolower($csv_data['call_type']) == 'sip-did') { |
|
650 | 650 | $call_type = '3'; |
651 | 651 | } |
652 | - else if(strtolower($csv_data['call_type']) == 'did-local'){ |
|
652 | + else if (strtolower($csv_data['call_type']) == 'did-local') { |
|
653 | 653 | $call_type = '1'; |
654 | 654 | } |
655 | - else if(strtolower($csv_data['call_type']) == 'other'){ |
|
655 | + else if (strtolower($csv_data['call_type']) == 'other') { |
|
656 | 656 | $call_type = '2'; |
657 | 657 | } |
658 | 658 | else { |
659 | 659 | $call_type = '0'; |
660 | 660 | } |
661 | - }else{ |
|
661 | + } else { |
|
662 | 662 | $call_type = '0'; |
663 | 663 | } |
664 | 664 | $csv_data['accountid'] = isset($csv_data['accountid']) ? $csv_data['accountid'] : 0; |
@@ -667,77 +667,77 @@ discard block |
||
667 | 667 | $csv_data['call_type'] = $call_type; |
668 | 668 | $csv_data['extensions'] = isset($csv_data['extensions']) ? $csv_data['extensions'] : ''; |
669 | 669 | $csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0; |
670 | - $csv_data['cost'] = !empty($csv_data['cost']) && is_numeric($csv_data['cost']) && $csv_data['cost'] ? $csv_data['cost'] : 0; |
|
671 | - $csv_data['setup'] = !empty($csv_data['setup']) && is_numeric($csv_data['setup']) && $csv_data['setup'] > 0 ? $csv_data['setup'] : 0; |
|
672 | - $csv_data['monthlycost'] = !empty($csv_data['monthlycost']) && is_numeric($csv_data['monthlycost']) && $csv_data['monthlycost'] > 0 ? $csv_data['monthlycost'] : 0; |
|
673 | - $csv_data['connectcost'] = !empty($csv_data['connectcost']) && is_numeric($csv_data['connectcost']) && $csv_data['connectcost'] > 0 ? $csv_data['connectcost'] : 0; |
|
670 | + $csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) && $csv_data['cost'] ? $csv_data['cost'] : 0; |
|
671 | + $csv_data['setup'] = ! empty($csv_data['setup']) && is_numeric($csv_data['setup']) && $csv_data['setup'] > 0 ? $csv_data['setup'] : 0; |
|
672 | + $csv_data['monthlycost'] = ! empty($csv_data['monthlycost']) && is_numeric($csv_data['monthlycost']) && $csv_data['monthlycost'] > 0 ? $csv_data['monthlycost'] : 0; |
|
673 | + $csv_data['connectcost'] = ! empty($csv_data['connectcost']) && is_numeric($csv_data['connectcost']) && $csv_data['connectcost'] > 0 ? $csv_data['connectcost'] : 0; |
|
674 | 674 | $csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0; |
675 | 675 | $str = $this->data_validate($csv_data); |
676 | 676 | if ($str != "") { |
677 | 677 | $invalid_array[$i] = $csv_data; |
678 | 678 | $invalid_array[$i]['error'] = $str; |
679 | 679 | } else { |
680 | - if (!in_array($csv_data['number'], $number_arr)) { |
|
680 | + if ( ! in_array($csv_data['number'], $number_arr)) { |
|
681 | 681 | $number_count = $this->db_model->countQuery('id', 'dids', array('number' => $csv_data['number'])); |
682 | 682 | if ($number_count > 0) { |
683 | 683 | $invalid_array[$i] = $csv_data; |
684 | 684 | $invalid_array[$i]['error'] = 'Duplicate DID found from database'; |
685 | 685 | } else { |
686 | - if($csv_data['accountid'] > 0 && $csv_data['setup'] > 0){ |
|
686 | + if ($csv_data['accountid'] > 0 && $csv_data['setup'] > 0) { |
|
687 | 687 | $this->db->where('type IN(0,1,3)'); |
688 | - $this->db->where('reseller_id',0); |
|
689 | - $this->db->where('deleted',0); |
|
690 | - $this->db->where('status',0); |
|
691 | - $account_info=(array)$this->db->get_where('accounts',array("number"=>$csv_data['accountid']))->first_row(); |
|
692 | - if($account_info){ |
|
693 | - $account_balance=$this->db_model->get_available_bal($account_info); |
|
688 | + $this->db->where('reseller_id', 0); |
|
689 | + $this->db->where('deleted', 0); |
|
690 | + $this->db->where('status', 0); |
|
691 | + $account_info = (array)$this->db->get_where('accounts', array("number"=>$csv_data['accountid']))->first_row(); |
|
692 | + if ($account_info) { |
|
693 | + $account_balance = $this->db_model->get_available_bal($account_info); |
|
694 | 694 | $setup = $this->common_model->add_calculate_currency($csv_data['setup'], '', '', false, false); |
695 | - if($account_balance >= $setup){ |
|
696 | - $field_name=$account_info['type']==1 ? 'parent_id':'accountid'; |
|
697 | - $currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$account_info['currency_id'])); |
|
695 | + if ($account_balance >= $setup) { |
|
696 | + $field_name = $account_info['type'] == 1 ? 'parent_id' : 'accountid'; |
|
697 | + $currency_name = $this->common->get_field_name('currency', "currency", array('id'=>$account_info['currency_id'])); |
|
698 | 698 | $csv_data['monthlycost'] = $this->common_model->add_calculate_currency($csv_data['monthlycost'], '', '', false, false); |
699 | 699 | $csv_data['cost'] = $this->common_model->add_calculate_currency($csv_data['cost'], '', '', false, false); |
700 | 700 | $csv_data['connectcost'] = $this->common_model->add_calculate_currency($csv_data['connectcost'], '', '', false, false); |
701 | - $csv_data['setup']=$setup; |
|
702 | - $csv_data[$field_name]=$account_info['id']; |
|
703 | - $csv_data['status']=$this->common->get_import_status($csv_data['status']); |
|
704 | - $available_bal = $this->db_model->update_balance($csv_data["setup"],$account_info['id'], "debit"); |
|
701 | + $csv_data['setup'] = $setup; |
|
702 | + $csv_data[$field_name] = $account_info['id']; |
|
703 | + $csv_data['status'] = $this->common->get_import_status($csv_data['status']); |
|
704 | + $available_bal = $this->db_model->update_balance($csv_data["setup"], $account_info['id'], "debit"); |
|
705 | 705 | $account_info['did_number'] = $csv_data['number']; |
706 | 706 | $account_info['did_country_id'] = $csv_data['country_id']; |
707 | - $account_info['did_setup'] = $this->common_model->calculate_currency($csv_data['setup'],'',$currency_name,true,true); |
|
708 | - $account_info['did_monthlycost'] = $this->common_model->calculate_currency($csv_data['monthlycost'],'',$currency_name,true,true); |
|
707 | + $account_info['did_setup'] = $this->common_model->calculate_currency($csv_data['setup'], '', $currency_name, true, true); |
|
708 | + $account_info['did_monthlycost'] = $this->common_model->calculate_currency($csv_data['monthlycost'], '', $currency_name, true, true); |
|
709 | 709 | $account_info['did_maxchannels'] = "0"; |
710 | - $csv_data['country_id']=$this->common->get_field_name('id','countrycode',array("country"=>$csv_data['country_id'])); |
|
711 | - if($account_info['type']==1){ |
|
712 | - $reseller_array=$csv_data; |
|
713 | - $reseller_array['note']=$csv_data['number']; |
|
714 | - $reseller_array['reseller_id']=$account_info['id']; |
|
715 | - $reseller_array['parent_id']=$account_info['reseller_id']; |
|
716 | - $reseller_array['assign_date']=gmdate("Y-m-d H:i:s"); |
|
717 | - unset($reseller_array['number'],$csv_data['accountid'],$reseller_array['accountid'],$reseller_array['country_id'],$reseller_array['init_inc']); |
|
718 | - $csv_data['accountid']=0; |
|
719 | - $final_reseller_array[$i]=$reseller_array; |
|
720 | - }else{ |
|
721 | - $csv_data['parent_id']=0; |
|
710 | + $csv_data['country_id'] = $this->common->get_field_name('id', 'countrycode', array("country"=>$csv_data['country_id'])); |
|
711 | + if ($account_info['type'] == 1) { |
|
712 | + $reseller_array = $csv_data; |
|
713 | + $reseller_array['note'] = $csv_data['number']; |
|
714 | + $reseller_array['reseller_id'] = $account_info['id']; |
|
715 | + $reseller_array['parent_id'] = $account_info['reseller_id']; |
|
716 | + $reseller_array['assign_date'] = gmdate("Y-m-d H:i:s"); |
|
717 | + unset($reseller_array['number'], $csv_data['accountid'], $reseller_array['accountid'], $reseller_array['country_id'], $reseller_array['init_inc']); |
|
718 | + $csv_data['accountid'] = 0; |
|
719 | + $final_reseller_array[$i] = $reseller_array; |
|
720 | + } else { |
|
721 | + $csv_data['parent_id'] = 0; |
|
722 | 722 | } |
723 | - $csv_data['assign_date']=gmdate("Y-m-d H:i:s"); |
|
723 | + $csv_data['assign_date'] = gmdate("Y-m-d H:i:s"); |
|
724 | 724 | $new_final_arr[$i] = $csv_data; |
725 | 725 | $this->common->mail_to_users('email_add_did', $account_info); |
726 | - }else{ |
|
726 | + } else { |
|
727 | 727 | $invalid_array[$i] = $csv_data; |
728 | 728 | $invalid_array[$i]['error'] = 'Account have not sufficient amount to purchase this DID.'; |
729 | 729 | } |
730 | - }else{ |
|
730 | + } else { |
|
731 | 731 | $invalid_array[$i] = $csv_data; |
732 | 732 | $invalid_array[$i]['error'] = 'Account not found or assign to invalid account'; |
733 | 733 | } |
734 | - }else{ |
|
734 | + } else { |
|
735 | 735 | $csv_data['setup'] = $this->common_model->add_calculate_currency($csv_data['setup'], '', '', false, false); |
736 | 736 | $csv_data['monthlycost'] = $this->common_model->add_calculate_currency($csv_data['monthlycost'], '', '', false, false); |
737 | 737 | $csv_data['cost'] = $this->common_model->add_calculate_currency($csv_data['cost'], '', '', false, false); |
738 | 738 | $csv_data['connectcost'] = $this->common_model->add_calculate_currency($csv_data['connectcost'], '', '', false, false); |
739 | - $csv_data['accountid']=0; |
|
740 | - $csv_data['country_id']=$this->common->get_field_name('id','countrycode',array("country"=>$csv_data['country_id'])); |
|
739 | + $csv_data['accountid'] = 0; |
|
740 | + $csv_data['country_id'] = $this->common->get_field_name('id', 'countrycode', array("country"=>$csv_data['country_id'])); |
|
741 | 741 | $new_final_arr[$i] = $csv_data; |
742 | 742 | } |
743 | 743 | } |
@@ -750,17 +750,17 @@ discard block |
||
750 | 750 | } |
751 | 751 | $i++; |
752 | 752 | } |
753 | - if (!empty($new_final_arr)) { |
|
753 | + if ( ! empty($new_final_arr)) { |
|
754 | 754 | $result = $this->did_model->bulk_insert_dids($new_final_arr); |
755 | 755 | } |
756 | - if(!empty($final_reseller_array)){ |
|
756 | + if ( ! empty($final_reseller_array)) { |
|
757 | 757 | $this->db->insert_batch('reseller_pricing', $final_reseller_array); |
758 | 758 | } |
759 | 759 | unlink($full_path.$did_file_name); |
760 | 760 | $count = count($invalid_array); |
761 | 761 | if ($count > 0) { |
762 | 762 | $session_id = "-1"; |
763 | - $fp = fopen($full_path . $session_id . '.csv', 'w'); |
|
763 | + $fp = fopen($full_path.$session_id.'.csv', 'w'); |
|
764 | 764 | foreach ($new_final_arr_key as $key => $value) { |
765 | 765 | $custom_array[0][$key] = ucfirst($key); |
766 | 766 | } |
@@ -770,16 +770,16 @@ discard block |
||
770 | 770 | fputcsv($fp, $err_data); |
771 | 771 | } |
772 | 772 | fclose($fp); |
773 | - $this->session->set_userdata('import_did_csv_error', $session_id . ".csv"); |
|
773 | + $this->session->set_userdata('import_did_csv_error', $session_id.".csv"); |
|
774 | 774 | $data["error"] = $invalid_array; |
775 | 775 | $data['provider_id'] = $provider_id; |
776 | - $data['import_record_count'] = count($new_final_arr)+count($reseller_array); |
|
776 | + $data['import_record_count'] = count($new_final_arr) + count($reseller_array); |
|
777 | 777 | $data['failure_count'] = count($invalid_array) - 1; |
778 | 778 | $data['page_title'] = 'DID Import Error'; |
779 | 779 | $this->load->view('view_import_error', $data); |
780 | 780 | } else { |
781 | - $this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' DIDs Imported Successfully!'); |
|
782 | - redirect(base_url() . "did/did_list/"); |
|
781 | + $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' DIDs Imported Successfully!'); |
|
782 | + redirect(base_url()."did/did_list/"); |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | |
@@ -788,17 +788,17 @@ discard block |
||
788 | 788 | $alpha_regex = "/^[a-z ,.'-]+$/i"; |
789 | 789 | $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i"; |
790 | 790 | $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; |
791 | - $str.= $csvdata['number'] != '' ? null : 'Number,'; |
|
791 | + $str .= $csvdata['number'] != '' ? null : 'Number,'; |
|
792 | 792 | $str = rtrim($str, ','); |
793 | - if (!$str) { |
|
794 | - $str.= is_numeric($csvdata['number']) ? null : 'Number,'; |
|
795 | - $str.=!empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : ( empty($csvdata['connectcost']) ? null : 'Connect Cost,'); |
|
796 | - $str.=!empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : ( empty($csvdata['includedseconds']) ? null : 'Included Seconds,'); |
|
793 | + if ( ! $str) { |
|
794 | + $str .= is_numeric($csvdata['number']) ? null : 'Number,'; |
|
795 | + $str .= ! empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,'); |
|
796 | + $str .= ! empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,'); |
|
797 | 797 | if ($str) { |
798 | 798 | $str = rtrim($str, ','); |
799 | 799 | $error_field = explode(',', $str); |
800 | 800 | $count = count($error_field); |
801 | - $str.= $count > 1 ? ' are not valid' : ' is not Valid'; |
|
801 | + $str .= $count > 1 ? ' are not valid' : ' is not Valid'; |
|
802 | 802 | return $str; |
803 | 803 | } else { |
804 | 804 | return false; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $str = rtrim($str, ','); |
808 | 808 | $error_field = explode(',', $str); |
809 | 809 | $count = count($error_field); |
810 | - $str.= $count > 1 ? ' are required' : ' is Required'; |
|
810 | + $str .= $count > 1 ? ' are required' : ' is Required'; |
|
811 | 811 | return $str; |
812 | 812 | } |
813 | 813 | } |
@@ -816,38 +816,38 @@ discard block |
||
816 | 816 | $this->load->helper('download'); |
817 | 817 | $error_data = $this->session->userdata('import_did_csv_error'); |
818 | 818 | $full_path = $this->config->item('rates-file-path'); |
819 | - $data = file_get_contents($full_path . $error_data); |
|
819 | + $data = file_get_contents($full_path.$error_data); |
|
820 | 820 | force_download("error_did_rates.csv", $data); |
821 | 821 | } |
822 | 822 | |
823 | 823 | function did_export_data_xls() { |
824 | 824 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
825 | - $currency_id=$account_info['currency_id']; |
|
826 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
825 | + $currency_id = $account_info['currency_id']; |
|
826 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
827 | 827 | $query = $this->did_model->getdid_list(true, '0', '10000000'); |
828 | 828 | ob_clean(); |
829 | - $outbound_array[] = array("DID", "Country", "Account","Per Minute Cost($currency)","Initial Increment","Increment","Setup Fee($currency)","Monthly Fee($currency)","Call Type","Destination","Status","Modified Date","Is Purchased"); |
|
829 | + $outbound_array[] = array("DID", "Country", "Account", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Setup Fee($currency)", "Monthly Fee($currency)", "Call Type", "Destination", "Status", "Modified Date", "Is Purchased"); |
|
830 | 830 | if ($query->num_rows() > 0) { |
831 | 831 | foreach ($query->result_array() as $row) { |
832 | 832 | $outbound_array[] = array( |
833 | 833 | $row['number'], |
834 | 834 | $this->common->get_field_name("country", "countrycode", $row['country_id']), |
835 | 835 | $this->common->get_field_name("number", "accounts", $row['accountid']), |
836 | - $this->common_model->calculate_currency($row['cost'], '', '',true, false), |
|
836 | + $this->common_model->calculate_currency($row['cost'], '', '', true, false), |
|
837 | 837 | $row['init_inc'], |
838 | 838 | $row['inc'], |
839 | - $this->common_model->calculate_currency($row['setup'], '', '',true, false), |
|
840 | - $this->common_model->calculate_currency($row['monthlycost'], '', '',true, false), |
|
841 | - $this->common->get_call_type("","",$row['call_type']), |
|
839 | + $this->common_model->calculate_currency($row['setup'], '', '', true, false), |
|
840 | + $this->common_model->calculate_currency($row['monthlycost'], '', '', true, false), |
|
841 | + $this->common->get_call_type("", "", $row['call_type']), |
|
842 | 842 | $row['extensions'], |
843 | - $this->common->get_status('export','',$row['status']), |
|
843 | + $this->common->get_status('export', '', $row['status']), |
|
844 | 844 | $row['last_modified_date'], |
845 | 845 | $this->common->check_did_avl_export($row['number']) |
846 | 846 | ); |
847 | 847 | } |
848 | 848 | } |
849 | 849 | $this->load->helper('csv'); |
850 | - array_to_csv($outbound_array, 'DIDs_' . date("Y-m-d") . '.csv'); |
|
850 | + array_to_csv($outbound_array, 'DIDs_'.date("Y-m-d").'.csv'); |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
25 | +if ( ! defined('BASEPATH')) |
|
26 | 26 | exit('No direct script access allowed'); |
27 | 27 | |
28 | 28 | class did_form { |
@@ -31,48 +31,48 @@ discard block |
||
31 | 31 | $this->CI = & get_instance(); |
32 | 32 | } |
33 | 33 | |
34 | - function get_dids_form_fields($id=false,$parent_id='0',$account_id='0') { |
|
35 | - if ($id != 0){ |
|
36 | - if($parent_id > 0){ |
|
37 | - $account_dropdown = array('Reseller', array('name' => 'parent_id', 'disabled' => 'disabled','class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"1", "deleted" => "0","status" => "0")); |
|
38 | - }else{ |
|
39 | - if($account_id > 0){ |
|
40 | - $account_dropdown = array('Account ', array('name' => 'accountid', 'disabled' => 'disabled','class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0,3", "deleted" => "0","status" => "0")); |
|
34 | + function get_dids_form_fields($id = false, $parent_id = '0', $account_id = '0') { |
|
35 | + if ($id != 0) { |
|
36 | + if ($parent_id > 0) { |
|
37 | + $account_dropdown = array('Reseller', array('name' => 'parent_id', 'disabled' => 'disabled', 'class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"1", "deleted" => "0", "status" => "0")); |
|
38 | + } else { |
|
39 | + if ($account_id > 0) { |
|
40 | + $account_dropdown = array('Account ', array('name' => 'accountid', 'disabled' => 'disabled', 'class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"0,3", "deleted" => "0", "status" => "0")); |
|
41 | 41 | } |
42 | - else{ |
|
43 | - $account_dropdown = array('Account', 'accountid', 'SELECT', '',array("name"=>"accountid","rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3","deleted" => "0","status" => "0" )); |
|
42 | + else { |
|
43 | + $account_dropdown = array('Account', 'accountid', 'SELECT', '', array("name"=>"accountid", "rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0", "status" => "0")); |
|
44 | 44 | } |
45 | 45 | } |
46 | - } else{ |
|
47 | - $account_dropdown = array('Account', 'accountid', 'SELECT','' , array("name"=>"accountid","rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0" )); |
|
46 | + } else { |
|
47 | + $account_dropdown = array('Account', 'accountid', 'SELECT', '', array("name"=>"accountid", "rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0", "status" => "0")); |
|
48 | 48 | } |
49 | 49 | |
50 | - $val= $id > 0 ? 'dids.number.'.$id : 'dids.number'; |
|
51 | - $form['forms'] = array(base_url() . '/did/did_save/', array('id' => 'did_form', 'method' => 'POST', 'name' => 'did_form')); |
|
50 | + $val = $id > 0 ? 'dids.number.'.$id : 'dids.number'; |
|
51 | + $form['forms'] = array(base_url().'/did/did_save/', array('id' => 'did_form', 'method' => 'POST', 'name' => 'did_form')); |
|
52 | 52 | $form['DID Information'] = array( |
53 | 53 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
54 | 54 | array('DID', 'INPUT', array('name' => 'number', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_numeric|xss_clean|integer', 'tOOL TIP', 'Please Enter account number'), |
55 | - array('Country',array('name'=>'country_id','class'=>'country_id'), 'SELECT', '',array("name"=>"country_id","rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
55 | + array('Country', array('name'=>'country_id', 'class'=>'country_id'), 'SELECT', '', array("name"=>"country_id", "rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
56 | 56 | array('City', 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
57 | 57 | array('Province', 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
58 | - array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type" => "3", "deleted" => "0","status" => "0")), |
|
58 | + array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type" => "3", "deleted" => "0", "status" => "0")), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | $form['Billing Information'] = array( |
62 | 62 | $account_dropdown, |
63 | - array('Connection Cost', 'INPUT', array('name' => 'connectcost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
64 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '50', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
65 | - array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
66 | - array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Initial Increment'), |
|
67 | - array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Increment'), |
|
68 | - array('Setup Fee', 'INPUT', array('name' => 'setup', 'size' => '15', 'class' => 'text field medium'), 'trim|is_numeric|xss_clean', 'tOOL TIP', ''), |
|
69 | - array('Monthly<br>Fee', 'INPUT', array('name' => 'monthlycost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
63 | + array('Connection Cost', 'INPUT', array('name' => 'connectcost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
64 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '50', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
65 | + array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
66 | + array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Initial Increment'), |
|
67 | + array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Increment'), |
|
68 | + array('Setup Fee', 'INPUT', array('name' => 'setup', 'size' => '15', 'class' => 'text field medium'), 'trim|is_numeric|xss_clean', 'tOOL TIP', ''), |
|
69 | + array('Monthly<br>Fee', 'INPUT', array('name' => 'monthlycost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $form['DID Setting'] = array( |
73 | 73 | array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type', ''), |
74 | 74 | array('Destination', 'INPUT', array('name' => 'extensions', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
75 | - array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
75 | + array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
76 | 76 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
77 | 77 | |
78 | 78 | ); |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | $form['Search'] = array( |
92 | 92 | array('DID', 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
93 | 93 | array('Country', 'country_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
94 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
94 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"0", "deleted" => "0")), |
|
95 | 95 | array('Initial Increment', 'INPUT', array('name' => 'init_inc[init_inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'init_inc[init_inc-integer]', '', '', '', 'search_int_type', ''), |
96 | - array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '',''), |
|
96 | + array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '', ''), |
|
97 | 97 | array('Destination', 'INPUT', array('name' => 'extensions[extensions]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'extensions[extensions-string]', '', '', '', 'search_string_type', ''), |
98 | 98 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
99 | 99 | |
100 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
100 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
101 | 101 | ); |
102 | 102 | |
103 | 103 | $form['button_search'] = array('name' => 'action', 'id' => "did_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | $form['forms'] = array("", array('id' => "did_search")); |
113 | 113 | $form['Search'] = array( |
114 | 114 | array('DID', 'INPUT', array('name' => 'note[note]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'note[note-string]', '', '', '', 'search_string_type', ''), |
115 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
116 | - array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '',''), |
|
115 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"0", "deleted" => "0")), |
|
116 | + array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '', ''), |
|
117 | 117 | array('Destination', 'INPUT', array('name' => 'extensions[extensions]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'extensions[extensions-string]', '', '', '', 'search_string_type', ''), |
118 | 118 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
119 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
119 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | $form['button_search'] = array('name' => 'action', 'id' => "did_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
@@ -131,31 +131,31 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function build_did_list_for_admin() { |
133 | 133 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
134 | - $currency_id=$account_info['currency_id']; |
|
135 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
134 | + $currency_id = $account_info['currency_id']; |
|
135 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
139 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
139 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | ASTPP 3.0 |
143 | 143 | For DID edit on DID number |
144 | 144 | **/ |
145 | - array(gettext("DID"), "80", "number", "", "", "","EDITABLE","true","center"), |
|
146 | - array(gettext("Country"), "60", "country_id", "country", "countrycode", "get_field_name","","true","center"), |
|
145 | + array(gettext("DID"), "80", "number", "", "", "", "EDITABLE", "true", "center"), |
|
146 | + array(gettext("Country"), "60", "country_id", "country", "countrycode", "get_field_name", "", "true", "center"), |
|
147 | 147 | array(gettext("Account"), "95", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new"), |
148 | - array("Per Minute <br>Cost($currency)", "85", "cost", "cost", "cost", "convert_to_currency","","true","right"), |
|
149 | - array(gettext("Initial <br>Increment"), "80", "init_inc", "", "", "","","true","center"), |
|
150 | - array(gettext("Increment"), "90", "inc", "", "", "","","true","center"), |
|
151 | - array("Setup <br>Fee($currency)", "70", "setup", "setup", "setup", "convert_to_currency","","true","right"), |
|
152 | - array("Monthly<br>Fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"), |
|
153 | - array(gettext("Call Type"), "90", "call_type", "call_type", "call_type", "get_call_type","","true","center"), |
|
154 | - array(gettext("Destination"), "80", "extensions", "", "", "","","true","center"), |
|
155 | - array(gettext("Status"), "90", "status", "status", "dids", "get_status","","true","center"), |
|
156 | - array(gettext("Modified <br/>Date"), "90", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
157 | - array(gettext("Is Purchased?"), "110", "number", "number", "number", "check_did_avl","","true","center"), |
|
158 | - array("Action", "100", "", "", "", array("EDIT" => array("url" => "did/did_edit/", "mode" => "popup","layout"=>"medium"), |
|
148 | + array("Per Minute <br>Cost($currency)", "85", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"), |
|
149 | + array(gettext("Initial <br>Increment"), "80", "init_inc", "", "", "", "", "true", "center"), |
|
150 | + array(gettext("Increment"), "90", "inc", "", "", "", "", "true", "center"), |
|
151 | + array("Setup <br>Fee($currency)", "70", "setup", "setup", "setup", "convert_to_currency", "", "true", "right"), |
|
152 | + array("Monthly<br>Fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency", "", "true", "right"), |
|
153 | + array(gettext("Call Type"), "90", "call_type", "call_type", "call_type", "get_call_type", "", "true", "center"), |
|
154 | + array(gettext("Destination"), "80", "extensions", "", "", "", "", "true", "center"), |
|
155 | + array(gettext("Status"), "90", "status", "status", "dids", "get_status", "", "true", "center"), |
|
156 | + array(gettext("Modified <br/>Date"), "90", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"), |
|
157 | + array(gettext("Is Purchased?"), "110", "number", "number", "number", "check_did_avl", "", "true", "center"), |
|
158 | + array("Action", "100", "", "", "", array("EDIT" => array("url" => "did/did_edit/", "mode" => "popup", "layout"=>"medium"), |
|
159 | 159 | "DELETE" => array("url" => "did/did_remove/", "mode" => "single"))) |
160 | 160 | )); |
161 | 161 | return $grid_field_arr; |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | */ |
168 | 168 | function build_did_list_for_reseller_login() { |
169 | 169 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
170 | - $currency_id=$account_info['currency_id']; |
|
171 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
170 | + $currency_id = $account_info['currency_id']; |
|
171 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
172 | 172 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
173 | 173 | $grid_field_arr = json_encode(array( |
174 | - array("DID", "90", "number", "", "", "","EDITABLE","","true","center"), |
|
175 | - array("Account", "100", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
176 | - array("Per Minute<br>Cost($currency)", "80", "cost", "cost", "cost", "convert_to_currency","","true","right"), |
|
177 | - array("Initial <br>Increment", "100", "init_inc", "", "", "","","true","center"), |
|
178 | - array("Increment", "95", "inc", "", "", "","","true","center"), |
|
179 | - array("Setup <br> Fee($currency)", "90", "setup", "setup", "setup", "convert_to_currency","","true","right"), |
|
180 | - array("Monthly<br> fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"), |
|
181 | - array("Call Type", "80", "call_type", "call_type", "call_type", "get_call_type","","true","center"), |
|
182 | - array("Destination", "95", "extensions", "", "", "","","true","center"), |
|
183 | - array("Status", "90", "status", "status", "reseller_pricing", "get_status","","true","center"), |
|
184 | - array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
185 | - array("Is purchased?", "100", "number", "number", "number", "check_did_avl_reseller","","true","center"), |
|
174 | + array("DID", "90", "number", "", "", "", "EDITABLE", "", "true", "center"), |
|
175 | + array("Account", "100", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"), |
|
176 | + array("Per Minute<br>Cost($currency)", "80", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"), |
|
177 | + array("Initial <br>Increment", "100", "init_inc", "", "", "", "", "true", "center"), |
|
178 | + array("Increment", "95", "inc", "", "", "", "", "true", "center"), |
|
179 | + array("Setup <br> Fee($currency)", "90", "setup", "setup", "setup", "convert_to_currency", "", "true", "right"), |
|
180 | + array("Monthly<br> fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency", "", "true", "right"), |
|
181 | + array("Call Type", "80", "call_type", "call_type", "call_type", "get_call_type", "", "true", "center"), |
|
182 | + array("Destination", "95", "extensions", "", "", "", "", "true", "center"), |
|
183 | + array("Status", "90", "status", "status", "reseller_pricing", "get_status", "", "true", "center"), |
|
184 | + array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"), |
|
185 | + array("Is purchased?", "100", "number", "number", "number", "check_did_avl_reseller", "", "true", "center"), |
|
186 | 186 | array("Action", "90", "", "", "", array("EDIT" => array("url" => "did/did_reseller_edit/edit/", "mode" => "popup"), |
187 | 187 | "DELETE" => array("url" => "did/did_reseller_edit/delete/", "mode" => "single"))) |
188 | 188 | )); |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | /************************************************************************/ |
192 | 192 | function build_grid_buttons() { |
193 | 193 | $buttons_json = json_encode(array( |
194 | - array(gettext("Create"),"btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/did/did_add/", "popup","medium"), |
|
195 | - array(gettext("Delete"), "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/did/did_delete_multiple/"), |
|
196 | - array(gettext("Import"), "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/did/did_import/", '',"small"), |
|
197 | - array(gettext("Export"),"btn btn-xing" ,"fa fa-download fa-lg", "button_action", "/did/did_export_data_xls", 'single') |
|
194 | + array(gettext("Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/did/did_add/", "popup", "medium"), |
|
195 | + array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/did/did_delete_multiple/"), |
|
196 | + array(gettext("Import"), "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/did/did_import/", '', "small"), |
|
197 | + array(gettext("Export"), "btn btn-xing", "fa fa-download fa-lg", "button_action", "/did/did_export_data_xls", 'single') |
|
198 | 198 | )); |
199 | 199 | return $buttons_json; |
200 | 200 | } |
201 | 201 | |
202 | 202 | function build_did_list_for_customer($accountid, $accounttype) { |
203 | 203 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
204 | - $currency_id=$account_info['currency_id']; |
|
205 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
204 | + $currency_id = $account_info['currency_id']; |
|
205 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
206 | 206 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
207 | 207 | $grid_field_arr = json_encode(array( |
208 | - array("DID", "110", "number", "", "", "","","true","center"), |
|
209 | - array("Country", "110", "country_id", "country", "countrycode", "get_field_name","","true","center"), |
|
210 | - array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"), |
|
211 | - array("Initial Increment", "140", "init_inc", "", "", "","","true","center"), |
|
212 | - array("Increment", "120", "inc", "", "", "","","true","center"), |
|
213 | - array("Setup Fee($currency)", "140", "setup", "setup", "setup", "convert_to_currency","","true","right"), |
|
214 | - array("Monthly Fee($currency)", "140", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"), |
|
208 | + array("DID", "110", "number", "", "", "", "", "true", "center"), |
|
209 | + array("Country", "110", "country_id", "country", "countrycode", "get_field_name", "", "true", "center"), |
|
210 | + array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"), |
|
211 | + array("Initial Increment", "140", "init_inc", "", "", "", "", "true", "center"), |
|
212 | + array("Increment", "120", "inc", "", "", "", "", "true", "center"), |
|
213 | + array("Setup Fee($currency)", "140", "setup", "setup", "setup", "convert_to_currency", "", "true", "right"), |
|
214 | + array("Monthly Fee($currency)", "140", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency", "", "true", "right"), |
|
215 | 215 | array("Action", "110", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_dids_action/delete/$accountid/$accounttype/", "mode" => "single"))) |
216 | 216 | )); |
217 | 217 | return $grid_field_arr; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | <div class="col-md-12"> |
17 | 17 | <div class="w-box"> |
18 | 18 | <span style="margin-left:10px; text-align: center;background-color: none;color:#1c8400;"> |
19 | - <? if(isset($error) && !empty($error)) { |
|
19 | + <? if (isset($error) && ! empty($error)) { |
|
20 | 20 | echo $error; |
21 | 21 | }?> |
22 | 22 | </span> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php include(FCPATH.'application/views/popup_header.php'); ?> |
2 | -<script type="text/javascript" src="<?php echo base_url();?>assets/js/jquery-1.7.1.js"></script> |
|
2 | +<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/jquery-1.7.1.js"></script> |
|
3 | 3 | <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/facebox.js"></script> |
4 | 4 | <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flexigrid.js"></script> |
5 | 5 | <script type="text/javascript" src="/js/validate.js"></script> |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | <li class="col-md-12"> |
47 | 47 | <label class="col-md-3 no-padding">Call Type</label> |
48 | 48 | <select name="call_type" class="col-md-5 form-control selectpicker" data-live-search='true'> |
49 | - <?php $calltype=$this->common->set_call_type(); |
|
50 | - foreach($calltype as $key=>$value){ |
|
51 | - $selected=$reseller_didinfo['call_type']==$key ? "selected='selected'" : ''; |
|
49 | + <?php $calltype = $this->common->set_call_type(); |
|
50 | + foreach ($calltype as $key=>$value) { |
|
51 | + $selected = $reseller_didinfo['call_type'] == $key ? "selected='selected'" : ''; |
|
52 | 52 | echo "<option value='$key'$selected>$value</option>"; |
53 | 53 | } |
54 | 54 | ?> |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | <div class="row"> |
29 | 29 | <div class="col-md-12"> |
30 | 30 | |
31 | - Records Imported Successfully: <?= $import_record_count;?><br/> |
|
31 | + Records Imported Successfully: <?= $import_record_count; ?><br/> |
|
32 | 32 | Records Not Imported : <?= $failure_count?></div> |
33 | 33 | </div> |
34 | 34 | </div> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | </div> |
39 | 39 | </div> |
40 | 40 | <br/> |
41 | - <?php if(isset($provider_id) && $provider_id != ""){ ?><div class="col-md-12 padding-b-10"> |
|
41 | + <?php if (isset($provider_id) && $provider_id != "") { ?><div class="col-md-12 padding-b-10"> |
|
42 | 42 | <div class="pull-right"> |
43 | 43 | <a href="<?= base_url().'did/did_error_download/'?>"><input class="btn btn-line-sky margin-x-10" id="dwnld_err" type="button" name="action" value="Download Errors" /> </a> |
44 | 44 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | DID Import Process <?//= isset($pricelistid)?$this->common->get_field_name('name', 'pricelists',$pricelistid):"";?><? //= $page_title ?> |
6 | 6 | <? endblock() ?> |
7 | 7 | <? startblock('content') ?> |
8 | -<?php if(!isset($csv_tmp_data)){ ?> |
|
8 | +<?php if ( ! isset($csv_tmp_data)) { ?> |
|
9 | 9 | |
10 | 10 | <section class="slice color-three padding-t-20"> |
11 | 11 | <div class="w-section inverse no-padding"> |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | <div class="col-md-12"> |
16 | 16 | <div class="w-box"> |
17 | 17 | <span style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;"> |
18 | - <? if(isset($error) && !empty($error)) { |
|
18 | + <? if (isset($error) && ! empty($error)) { |
|
19 | 19 | echo $error; |
20 | 20 | }?> |
21 | 21 | </span> |
22 | 22 | <h3 class="padding-t-10 padding-l-16">File must be in the following format(.csv):</h3> |
23 | - <p><?= $fields;?></p> |
|
23 | + <p><?= $fields; ?></p> |
|
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 | <div class="col-md-12 no-padding"> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <div class="col-md-12 no-padding"> |
31 | 31 | <label class="col-md-3">Provider:</label> |
32 | 32 | <div> |
33 | - <? $provider_id = form_dropdown('provider_id', $this->db_model->build_concat_select_dropdown("id,first_name,number", " accounts", "where_arr", array("type" => "3","status"=>"0","deleted" => "0")), ''); |
|
33 | + <? $provider_id = form_dropdown('provider_id', $this->db_model->build_concat_select_dropdown("id,first_name,number", " accounts", "where_arr", array("type" => "3", "status"=>"0", "deleted" => "0")), ''); |
|
34 | 34 | echo $provider_id; |
35 | 35 | ?> </div> |
36 | 36 | </div> |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | <?php }?> |
85 | 85 | |
86 | 86 | <?php |
87 | - if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
87 | + if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?> |
|
88 | 88 | <section class="slice color-three"> |
89 | 89 | <div class="w-section inverse no-padding"> |
90 | 90 | <div class="container"> |
91 | 91 | <div class="row"> |
92 | 92 | |
93 | 93 | <div class="col-md-12 margin-t-10"> |
94 | - <form id="import_form" name="import_form" action="<?=base_url()?>did/did_import_file/<?= $provider_id?>/<?=$check_header;?>/" method="POST"> |
|
94 | + <form id="import_form" name="import_form" action="<?=base_url()?>did/did_import_file/<?= $provider_id?>/<?=$check_header; ?>/" method="POST"> |
|
95 | 95 | <table width="100%" border="1" class="details_table table"> |
96 | - <?php $cnt =0; |
|
97 | - foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
98 | - if($csv_key < 15){ |
|
96 | + <?php $cnt = 0; |
|
97 | + foreach ($csv_tmp_data as $csv_key => $csv_value) { |
|
98 | + if ($csv_key < 15) { |
|
99 | 99 | echo "<tr>"; |
100 | - foreach($csv_value as $field_name => $field_val){ |
|
101 | - if($csv_key == 0){ |
|
100 | + foreach ($csv_value as $field_name => $field_val) { |
|
101 | + if ($csv_key == 0) { |
|
102 | 102 | $cnt++; |
103 | 103 | echo "<th>".ucfirst($field_name)."</th>"; |
104 | - }else{ |
|
104 | + } else { |
|
105 | 105 | echo "<td class='portlet-content'>".$field_val."</td>"; |
106 | 106 | } |
107 | 107 | } |