@@ -24,30 +24,30 @@ discard block |
||
24 | 24 | |
25 | 25 | class User extends MX_Controller { |
26 | 26 | |
27 | - function User() { |
|
28 | - parent::__construct(); |
|
29 | - $this->load->helper('template_inheritance'); |
|
30 | - $this->load->helper('form'); |
|
31 | - $this->load->library("astpp/form"); |
|
32 | - $this->load->library("user_form"); |
|
33 | - $this->load->model('Auth_model'); |
|
34 | - $this->load->model('Astpp_common'); |
|
35 | - $this->load->model('user_model'); |
|
36 | - } |
|
37 | - |
|
38 | - function index() { |
|
39 | - if ($this->session->userdata('user_login') == FALSE) |
|
40 | - redirect(base_url() . 'login/login'); |
|
41 | - $data['page_title'] = 'Dashboard'; |
|
42 | - $this->load->view('view_user_dashboard', $data); |
|
43 | - } |
|
44 | - |
|
45 | - function user_dashboard_recent_payments() { |
|
46 | - $result=$this->user_model->user_dashboard_recent_recharge_info(); |
|
27 | + function User() { |
|
28 | + parent::__construct(); |
|
29 | + $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('form'); |
|
31 | + $this->load->library("astpp/form"); |
|
32 | + $this->load->library("user_form"); |
|
33 | + $this->load->model('Auth_model'); |
|
34 | + $this->load->model('Astpp_common'); |
|
35 | + $this->load->model('user_model'); |
|
36 | + } |
|
37 | + |
|
38 | + function index() { |
|
39 | + if ($this->session->userdata('user_login') == FALSE) |
|
40 | + redirect(base_url() . 'login/login'); |
|
41 | + $data['page_title'] = 'Dashboard'; |
|
42 | + $this->load->view('view_user_dashboard', $data); |
|
43 | + } |
|
44 | + |
|
45 | + function user_dashboard_recent_payments() { |
|
46 | + $result=$this->user_model->user_dashboard_recent_recharge_info(); |
|
47 | 47 | $gmtoffset=$this->common->get_timezone_offset(); |
48 | - $i=0; |
|
49 | - $json_data=array(); |
|
50 | - if($result->num_rows() > 0) |
|
48 | + $i=0; |
|
49 | + $json_data=array(); |
|
50 | + if($result->num_rows() > 0) |
|
51 | 51 | { |
52 | 52 | $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',''); |
53 | 53 | $json_data[0]['accountid']='Accounts'; |
@@ -55,63 +55,63 @@ discard block |
||
55 | 55 | $json_data[0]['payment_date']='Date'; |
56 | 56 | $json_data[0]['notes']='Notes'; |
57 | 57 | foreach($result->result_array() as $key=>$data){ |
58 | - $current_timestamp=strtotime($data['payment_date']); |
|
59 | - $modified_date=$current_timestamp+$gmtoffset; |
|
60 | - $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous"; |
|
61 | - $json_data[$i]['accountid']=$data['accountid']; |
|
62 | - $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false); |
|
63 | - $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset); |
|
64 | - $json_data[$i]['notes']=$data['notes']; |
|
65 | - $i++; |
|
66 | - } |
|
67 | - } |
|
68 | - echo json_encode($json_data); |
|
69 | - } |
|
70 | - |
|
71 | - function user_dashboard_package_data() { |
|
72 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
73 | - $json_data = array(); |
|
74 | - $this->db->where('pricelist_id', $accountinfo['pricelist_id']); |
|
75 | - $this->db->select('*'); |
|
76 | - $result = $this->db->get('packages', 10); |
|
77 | - $i = 1; |
|
78 | - if ($result->num_rows() > 0) { |
|
79 | - $json_data[0]['package_name'] = 'Package Name'; |
|
80 | - $json_data[0]['includedseconds'] = 'Included Seconds'; |
|
81 | - $json_data[0]['status'] = 'Status'; |
|
82 | - $result = $result->result_array(); |
|
83 | - foreach ($result as $data) { |
|
84 | - $json_data[$i]['package_name'] = $data['package_name']; |
|
85 | - $json_data[$i]['includedseconds'] = $data['includedseconds']; |
|
86 | - $json_data[$i]['status'] = $this->common->get_status('export', '', $data['status']); |
|
87 | - $i++; |
|
88 | - } |
|
89 | - } |
|
90 | - echo json_encode($json_data); |
|
91 | - } |
|
92 | - function user_dashboard_invoices_data() { |
|
93 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
94 | - $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
95 | - $this->db->where('accountid', $accountinfo['id']); |
|
96 | - $this->db->where('confirm', 1); |
|
97 | - $this->db->select('*'); |
|
98 | - $this->db->order_by('invoice_date', 'desc'); |
|
99 | - $result = $this->db->get('invoices', 10); |
|
100 | - $json_data = array(); |
|
101 | - $gmtoffset = $this->common->get_timezone_offset(); |
|
102 | - if ($result->num_rows() > 0) { |
|
103 | - $result = $result->result_array(); |
|
104 | - $json_data[0]['type'] = 'Invoice Type'; |
|
105 | - $json_data[0]['id'] = 'Number'; |
|
106 | - $json_data[0]['from_date'] = 'From Date'; |
|
107 | - $json_data[0]['invoice_date'] = 'Generated Date'; |
|
108 | - $json_data[0]['amount'] = 'Amount ('.$currency.')'; |
|
109 | - $json_data[0]['inv_type'] = 'Recharge Type'; |
|
110 | - $i = 1; |
|
111 | - foreach ($result as $key => $data) { |
|
112 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$data['id'])); |
|
113 | - |
|
114 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$data['id'])); |
|
58 | + $current_timestamp=strtotime($data['payment_date']); |
|
59 | + $modified_date=$current_timestamp+$gmtoffset; |
|
60 | + $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous"; |
|
61 | + $json_data[$i]['accountid']=$data['accountid']; |
|
62 | + $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false); |
|
63 | + $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset); |
|
64 | + $json_data[$i]['notes']=$data['notes']; |
|
65 | + $i++; |
|
66 | + } |
|
67 | + } |
|
68 | + echo json_encode($json_data); |
|
69 | + } |
|
70 | + |
|
71 | + function user_dashboard_package_data() { |
|
72 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
73 | + $json_data = array(); |
|
74 | + $this->db->where('pricelist_id', $accountinfo['pricelist_id']); |
|
75 | + $this->db->select('*'); |
|
76 | + $result = $this->db->get('packages', 10); |
|
77 | + $i = 1; |
|
78 | + if ($result->num_rows() > 0) { |
|
79 | + $json_data[0]['package_name'] = 'Package Name'; |
|
80 | + $json_data[0]['includedseconds'] = 'Included Seconds'; |
|
81 | + $json_data[0]['status'] = 'Status'; |
|
82 | + $result = $result->result_array(); |
|
83 | + foreach ($result as $data) { |
|
84 | + $json_data[$i]['package_name'] = $data['package_name']; |
|
85 | + $json_data[$i]['includedseconds'] = $data['includedseconds']; |
|
86 | + $json_data[$i]['status'] = $this->common->get_status('export', '', $data['status']); |
|
87 | + $i++; |
|
88 | + } |
|
89 | + } |
|
90 | + echo json_encode($json_data); |
|
91 | + } |
|
92 | + function user_dashboard_invoices_data() { |
|
93 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
94 | + $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
95 | + $this->db->where('accountid', $accountinfo['id']); |
|
96 | + $this->db->where('confirm', 1); |
|
97 | + $this->db->select('*'); |
|
98 | + $this->db->order_by('invoice_date', 'desc'); |
|
99 | + $result = $this->db->get('invoices', 10); |
|
100 | + $json_data = array(); |
|
101 | + $gmtoffset = $this->common->get_timezone_offset(); |
|
102 | + if ($result->num_rows() > 0) { |
|
103 | + $result = $result->result_array(); |
|
104 | + $json_data[0]['type'] = 'Invoice Type'; |
|
105 | + $json_data[0]['id'] = 'Number'; |
|
106 | + $json_data[0]['from_date'] = 'From Date'; |
|
107 | + $json_data[0]['invoice_date'] = 'Generated Date'; |
|
108 | + $json_data[0]['amount'] = 'Amount ('.$currency.')'; |
|
109 | + $json_data[0]['inv_type'] = 'Recharge Type'; |
|
110 | + $i = 1; |
|
111 | + foreach ($result as $key => $data) { |
|
112 | + $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$data['id'])); |
|
113 | + |
|
114 | + $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$data['id'])); |
|
115 | 115 | $invoice_num=$invoice_prefix.$invoiceid; |
116 | 116 | $inv_type=$this->common->get_invoice_total('item_type', '', $data['id']); |
117 | 117 | if($inv_type == ''){ |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | $json_data[$i]['amount'] = $inv_debit; |
132 | 132 | $json_data[$i]['inv_type'] = $inv_type; |
133 | 133 | $i++; |
134 | - } |
|
135 | - } |
|
136 | - echo json_encode($json_data); |
|
137 | - } |
|
134 | + } |
|
135 | + } |
|
136 | + echo json_encode($json_data); |
|
137 | + } |
|
138 | 138 | |
139 | - function user_dashboard_subscription_data(){ |
|
139 | + function user_dashboard_subscription_data(){ |
|
140 | 140 | $accountinfo=$this->session->userdata('accountinfo'); |
141 | 141 | $this->db->where('accountid',$accountinfo['id']); |
142 | 142 | $this->db->select('*'); |
@@ -187,487 +187,487 @@ discard block |
||
187 | 187 | } |
188 | 188 | $i++; |
189 | 189 | } |
190 | - } |
|
191 | - echo json_encode($json_data); |
|
192 | - } |
|
190 | + } |
|
191 | + echo json_encode($json_data); |
|
192 | + } |
|
193 | 193 | |
194 | - function user_edit_account() { |
|
195 | - if ($add_array['id'] != '') { |
|
196 | - $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($add_array['id']), $add_array); |
|
197 | - $data['page_title'] = 'Edit ' . $entity_name; |
|
198 | - if ($this->form_validation->run() == FALSE) { |
|
199 | - $data['validation_errors'] = validation_errors(); |
|
200 | - } else { |
|
201 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
202 | - unset($add_array['number']); |
|
203 | - $this->accounts->accounts_model->edit_account($add_array, $add_array['id']); |
|
204 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
205 | - if ($add_array['id'] == $accountinfo['id']) { |
|
206 | - $this->session->set_userdata('accountinfo',(array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row()); |
|
207 | - } |
|
208 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
209 | - redirect(base_url() . 'user/user/'); |
|
210 | - } |
|
211 | - $this->load->view('view_user_details', $data); |
|
212 | - } else { |
|
213 | - $data['page_title'] = 'Edit ' . $entity_name; |
|
214 | - $where = array('id' => $account_data["id"]); |
|
215 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
216 | - $data["account_data"] = $account->result_array(); |
|
217 | - |
|
218 | - foreach ($account->result_array() as $key => $value) { |
|
219 | - $editable_data = $value; |
|
220 | - } |
|
221 | - $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
222 | - $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($editable_data['id']), $editable_data); |
|
223 | - $this->load->view('view_user_details', $data); |
|
224 | - } |
|
225 | - } |
|
194 | + function user_edit_account() { |
|
195 | + if ($add_array['id'] != '') { |
|
196 | + $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($add_array['id']), $add_array); |
|
197 | + $data['page_title'] = 'Edit ' . $entity_name; |
|
198 | + if ($this->form_validation->run() == FALSE) { |
|
199 | + $data['validation_errors'] = validation_errors(); |
|
200 | + } else { |
|
201 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
202 | + unset($add_array['number']); |
|
203 | + $this->accounts->accounts_model->edit_account($add_array, $add_array['id']); |
|
204 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
205 | + if ($add_array['id'] == $accountinfo['id']) { |
|
206 | + $this->session->set_userdata('accountinfo',(array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row()); |
|
207 | + } |
|
208 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
209 | + redirect(base_url() . 'user/user/'); |
|
210 | + } |
|
211 | + $this->load->view('view_user_details', $data); |
|
212 | + } else { |
|
213 | + $data['page_title'] = 'Edit ' . $entity_name; |
|
214 | + $where = array('id' => $account_data["id"]); |
|
215 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
216 | + $data["account_data"] = $account->result_array(); |
|
217 | + |
|
218 | + foreach ($account->result_array() as $key => $value) { |
|
219 | + $editable_data = $value; |
|
220 | + } |
|
221 | + $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
222 | + $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($editable_data['id']), $editable_data); |
|
223 | + $this->load->view('view_user_details', $data); |
|
224 | + } |
|
225 | + } |
|
226 | 226 | |
227 | - function user_did_edit($edit_id = '') { |
|
228 | - $data['page_title'] = 'Edit DIDs'; |
|
229 | - $account_data = $this->session->userdata("accountinfo"); |
|
230 | - $this->db->where('id',$edit_id); |
|
231 | - $this->db->select('id,call_type,extensions,number'); |
|
232 | - $did_info=(array)$this->db->get('dids')->first_row(); |
|
233 | - $did_info['free_didlist']=$did_info['id']; |
|
234 | - $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(),$did_info); |
|
235 | - $this->load->view('view_user_did_edit', $data); |
|
236 | - } |
|
237 | - |
|
238 | - function user_dids_action($action,$did_id = "") { |
|
239 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
240 | - $reseller_id = $accountinfo['reseller_id']; |
|
241 | - $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
|
227 | + function user_did_edit($edit_id = '') { |
|
228 | + $data['page_title'] = 'Edit DIDs'; |
|
229 | + $account_data = $this->session->userdata("accountinfo"); |
|
230 | + $this->db->where('id',$edit_id); |
|
231 | + $this->db->select('id,call_type,extensions,number'); |
|
232 | + $did_info=(array)$this->db->get('dids')->first_row(); |
|
233 | + $did_info['free_didlist']=$did_info['id']; |
|
234 | + $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(),$did_info); |
|
235 | + $this->load->view('view_user_did_edit', $data); |
|
236 | + } |
|
237 | + |
|
238 | + function user_dids_action($action,$did_id = "") { |
|
239 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
240 | + $reseller_id = $accountinfo['reseller_id']; |
|
241 | + $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
|
242 | 242 | |
243 | - if($did_id !=''){ |
|
244 | - $account_query = $this->db_model->getSelect("*", "accounts",array('id' => $accountinfo['id'])); |
|
245 | - $account_arr = (array) $account_query->first_row(); |
|
246 | - $did_query = $this->db_model->getSelect("*", "dids", array("id" => $did_id)); |
|
247 | - $did_arr = (array) $did_query->first_row(); |
|
248 | - if ($action == "add"){ |
|
249 | - if($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id ) { |
|
250 | - $setup_cost=$did_arr['setup']; |
|
251 | - if ($accountinfo["reseller_id"] > 0) { |
|
252 | - $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'],"reseller_id"=>$accountinfo['reseller_id'])); |
|
253 | - $reseller_pricing_arr = (array)$reseller_pricing_res->first_row(); |
|
254 | - $setup_cost=$reseller_pricing_arr['setup']; |
|
255 | - } |
|
256 | - $available_bal = $this->db_model->get_available_bal($account_arr); |
|
257 | - if ($available_bal >= $setup_cost) { |
|
258 | - $available_bal = $this->db_model->update_balance($setup_cost,$accountinfo["id"], "debit"); |
|
259 | - $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
260 | - $this->common->add_invoice_details($accountinfo,"DIDCHRG",$setup_cost,$did_arr['number']); |
|
261 | - $this->db_model->update("dids", array("accountid" => $accountinfo["id"],"assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
262 | - $this->common->mail_to_users('email_add_did', $account_arr,"",$did_arr['number']); |
|
263 | - $this->session->set_flashdata('astpp_errormsg', 'Did added successfully.'); |
|
264 | - redirect(base_url() . "user/user_didlist/"); |
|
265 | - } else { |
|
266 | - $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
|
267 | - redirect(base_url() . "user/user_didlist/"); |
|
268 | - } |
|
269 | - }else{ |
|
270 | - $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
|
271 | - redirect(base_url() . "user/user_didlist/"); |
|
272 | - } |
|
273 | - } |
|
274 | - if ($action == "edit") { |
|
275 | - $add_array=$this->input->post(); |
|
276 | - $data['form'] = $this->form->build_form($this->user_form->build_user_did_form($add_array['free_didlist']), $add_array); |
|
277 | - if ($this->form_validation->run() == FALSE) { |
|
278 | - $data['validation_errors'] = validation_errors(); |
|
279 | - echo $data['validation_errors']; |
|
280 | - exit; |
|
281 | - } else { |
|
282 | - $update_arr = array("call_type" => $add_array['call_type'], |
|
243 | + if($did_id !=''){ |
|
244 | + $account_query = $this->db_model->getSelect("*", "accounts",array('id' => $accountinfo['id'])); |
|
245 | + $account_arr = (array) $account_query->first_row(); |
|
246 | + $did_query = $this->db_model->getSelect("*", "dids", array("id" => $did_id)); |
|
247 | + $did_arr = (array) $did_query->first_row(); |
|
248 | + if ($action == "add"){ |
|
249 | + if($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id ) { |
|
250 | + $setup_cost=$did_arr['setup']; |
|
251 | + if ($accountinfo["reseller_id"] > 0) { |
|
252 | + $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'],"reseller_id"=>$accountinfo['reseller_id'])); |
|
253 | + $reseller_pricing_arr = (array)$reseller_pricing_res->first_row(); |
|
254 | + $setup_cost=$reseller_pricing_arr['setup']; |
|
255 | + } |
|
256 | + $available_bal = $this->db_model->get_available_bal($account_arr); |
|
257 | + if ($available_bal >= $setup_cost) { |
|
258 | + $available_bal = $this->db_model->update_balance($setup_cost,$accountinfo["id"], "debit"); |
|
259 | + $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
260 | + $this->common->add_invoice_details($accountinfo,"DIDCHRG",$setup_cost,$did_arr['number']); |
|
261 | + $this->db_model->update("dids", array("accountid" => $accountinfo["id"],"assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
262 | + $this->common->mail_to_users('email_add_did', $account_arr,"",$did_arr['number']); |
|
263 | + $this->session->set_flashdata('astpp_errormsg', 'Did added successfully.'); |
|
264 | + redirect(base_url() . "user/user_didlist/"); |
|
265 | + } else { |
|
266 | + $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
|
267 | + redirect(base_url() . "user/user_didlist/"); |
|
268 | + } |
|
269 | + }else{ |
|
270 | + $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
|
271 | + redirect(base_url() . "user/user_didlist/"); |
|
272 | + } |
|
273 | + } |
|
274 | + if ($action == "edit") { |
|
275 | + $add_array=$this->input->post(); |
|
276 | + $data['form'] = $this->form->build_form($this->user_form->build_user_did_form($add_array['free_didlist']), $add_array); |
|
277 | + if ($this->form_validation->run() == FALSE) { |
|
278 | + $data['validation_errors'] = validation_errors(); |
|
279 | + echo $data['validation_errors']; |
|
280 | + exit; |
|
281 | + } else { |
|
282 | + $update_arr = array("call_type" => $add_array['call_type'], |
|
283 | 283 | "extensions" => $add_array['extensions'],"last_modified_date"=>gmdate("Y-m-d H:i:s") |
284 | - ); |
|
285 | - $this->db->update("dids", $update_arr, array("id" => $did_id)); |
|
286 | - if($accountinfo['reseller_id'] > 0 ){ |
|
284 | + ); |
|
285 | + $this->db->update("dids", $update_arr, array("id" => $did_id)); |
|
286 | + if($accountinfo['reseller_id'] > 0 ){ |
|
287 | 287 | |
288 | 288 | $this->db->update('reseller_pricing',$update_arr,array('note'=>$did_arr['number'])); |
289 | - } |
|
290 | - echo json_encode(array("SUCCESS" => $did_arr['number'] . " DID Updated Successfully!")); |
|
291 | - exit; |
|
292 | - } |
|
293 | - $this->load->view('view_user_did_edit', $data); |
|
294 | - } |
|
295 | - if ($action == "delete") { |
|
296 | - $this->db->update("dids", array("accountid" =>0,"assign_date" =>"0000-00-00 00:00:00" , 'charge_upto'=>"0000-00-00 00:00:00"),array("id" => $did_id)); |
|
297 | - $this->common->mail_to_users('email_remove_did', $account_arr,"",$did_arr['number']); |
|
298 | - $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.'); |
|
299 | - redirect(base_url() . "user/user_didlist/"); |
|
300 | - } |
|
301 | - }else{ |
|
289 | + } |
|
290 | + echo json_encode(array("SUCCESS" => $did_arr['number'] . " DID Updated Successfully!")); |
|
291 | + exit; |
|
292 | + } |
|
293 | + $this->load->view('view_user_did_edit', $data); |
|
294 | + } |
|
295 | + if ($action == "delete") { |
|
296 | + $this->db->update("dids", array("accountid" =>0,"assign_date" =>"0000-00-00 00:00:00" , 'charge_upto'=>"0000-00-00 00:00:00"),array("id" => $did_id)); |
|
297 | + $this->common->mail_to_users('email_remove_did', $account_arr,"",$did_arr['number']); |
|
298 | + $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.'); |
|
299 | + redirect(base_url() . "user/user_didlist/"); |
|
300 | + } |
|
301 | + }else{ |
|
302 | 302 | $this->session->set_flashdata('astpp_notification', 'DID not found.'); |
303 | 303 | redirect(base_url() . "user/user_didlist/"); |
304 | - } |
|
305 | - } |
|
306 | - |
|
307 | - function user_rates_list() { |
|
308 | - $data['username'] = $this->session->userdata('user_name'); |
|
309 | - $data['page_title'] = 'My Rates'; |
|
310 | - $data['search_flag'] = true; |
|
311 | - $this->session->set_userdata('advance_search', 0); |
|
312 | - $this->load->module('rates/rates'); |
|
313 | - $data["grid_buttons"] = $this->user_form->user_rates_list_buttons(); |
|
314 | - $data['grid_fields'] = $this->user_form->user_rates_list(); |
|
315 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->user_rates_list_search()); |
|
316 | - $this->load->view('view_user_rates_list', $data); |
|
317 | - } |
|
318 | - |
|
319 | - function user_rates_list_json() { |
|
320 | - $account_data = $this->session->userdata("accountinfo"); |
|
321 | - $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
322 | - $count_all = $this->user_model->get_user_rates_list(false); |
|
323 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
324 | - $json_data = $paging_data["json_paging"]; |
|
325 | - |
|
326 | - $query = $this->user_model->get_user_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
327 | - $grid_fields = json_decode($this->user_form->user_rates_list()); |
|
328 | - foreach ($query->result_array() as $key => $value) { |
|
329 | - $cost=$account_data['type']!=3 ? ($value['cost'] + (($value['cost']*$markup)/100)) : $value['cost']; |
|
330 | - $json_data['rows'][] = array('cell' => array( |
|
331 | - $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
332 | - $value['comment'], |
|
333 | - $this->common_model->calculate_currency($value['connectcost'],'','',true,false), |
|
334 | - $value['includedseconds'], |
|
335 | - $this->common_model->calculate_currency(($cost),'','',true,false), |
|
336 | - $value['init_inc'], |
|
337 | - $value['inc'] |
|
338 | - )); |
|
339 | - } |
|
340 | - echo json_encode($json_data); |
|
341 | - } |
|
304 | + } |
|
305 | + } |
|
306 | + |
|
307 | + function user_rates_list() { |
|
308 | + $data['username'] = $this->session->userdata('user_name'); |
|
309 | + $data['page_title'] = 'My Rates'; |
|
310 | + $data['search_flag'] = true; |
|
311 | + $this->session->set_userdata('advance_search', 0); |
|
312 | + $this->load->module('rates/rates'); |
|
313 | + $data["grid_buttons"] = $this->user_form->user_rates_list_buttons(); |
|
314 | + $data['grid_fields'] = $this->user_form->user_rates_list(); |
|
315 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->user_rates_list_search()); |
|
316 | + $this->load->view('view_user_rates_list', $data); |
|
317 | + } |
|
318 | + |
|
319 | + function user_rates_list_json() { |
|
320 | + $account_data = $this->session->userdata("accountinfo"); |
|
321 | + $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
322 | + $count_all = $this->user_model->get_user_rates_list(false); |
|
323 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
324 | + $json_data = $paging_data["json_paging"]; |
|
325 | + |
|
326 | + $query = $this->user_model->get_user_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
327 | + $grid_fields = json_decode($this->user_form->user_rates_list()); |
|
328 | + foreach ($query->result_array() as $key => $value) { |
|
329 | + $cost=$account_data['type']!=3 ? ($value['cost'] + (($value['cost']*$markup)/100)) : $value['cost']; |
|
330 | + $json_data['rows'][] = array('cell' => array( |
|
331 | + $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
332 | + $value['comment'], |
|
333 | + $this->common_model->calculate_currency($value['connectcost'],'','',true,false), |
|
334 | + $value['includedseconds'], |
|
335 | + $this->common_model->calculate_currency(($cost),'','',true,false), |
|
336 | + $value['init_inc'], |
|
337 | + $value['inc'] |
|
338 | + )); |
|
339 | + } |
|
340 | + echo json_encode($json_data); |
|
341 | + } |
|
342 | 342 | |
343 | - function user_rates_list_search() { |
|
344 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
345 | - |
|
346 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
347 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
348 | - $action = $this->input->post(); |
|
349 | - unset($action['action'],$action['advance_search']); |
|
350 | - if (isset($action['connectcost']['connectcost']) && $action['connectcost']['connectcost'] != '') { |
|
351 | - $action['connectcost']['connectcost'] = $this->common_model->add_calculate_currency($action['connectcost']['connectcost'], "", '', true, false); |
|
352 | - } |
|
353 | - if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
354 | - $account_data = $this->session->userdata("accountinfo"); |
|
355 | - $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
356 | - $markup = ($markup > 0)?$markup:1; |
|
357 | - $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
358 | - if($account_data['type']!=3) |
|
359 | - $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
360 | - } |
|
361 | - $this->session->set_userdata('user_rates_list_search', $action); |
|
362 | - } |
|
363 | - if ($ajax_search != 1) { |
|
364 | - redirect(base_url() . 'user/user_rates_list/'); |
|
365 | - } |
|
366 | - } |
|
367 | - |
|
368 | - function user_rates_list_clearsearchfilter() { |
|
369 | - $this->session->set_userdata('advance_search', 0); |
|
370 | - $this->session->set_userdata('user_rates_list_search', ""); |
|
371 | - } |
|
343 | + function user_rates_list_search() { |
|
344 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
345 | + |
|
346 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
347 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
348 | + $action = $this->input->post(); |
|
349 | + unset($action['action'],$action['advance_search']); |
|
350 | + if (isset($action['connectcost']['connectcost']) && $action['connectcost']['connectcost'] != '') { |
|
351 | + $action['connectcost']['connectcost'] = $this->common_model->add_calculate_currency($action['connectcost']['connectcost'], "", '', true, false); |
|
352 | + } |
|
353 | + if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
354 | + $account_data = $this->session->userdata("accountinfo"); |
|
355 | + $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
356 | + $markup = ($markup > 0)?$markup:1; |
|
357 | + $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
358 | + if($account_data['type']!=3) |
|
359 | + $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
360 | + } |
|
361 | + $this->session->set_userdata('user_rates_list_search', $action); |
|
362 | + } |
|
363 | + if ($ajax_search != 1) { |
|
364 | + redirect(base_url() . 'user/user_rates_list/'); |
|
365 | + } |
|
366 | + } |
|
367 | + |
|
368 | + function user_rates_list_clearsearchfilter() { |
|
369 | + $this->session->set_userdata('advance_search', 0); |
|
370 | + $this->session->set_userdata('user_rates_list_search', ""); |
|
371 | + } |
|
372 | 372 | |
373 | - function user_rates_list_export() { |
|
373 | + function user_rates_list_export() { |
|
374 | 374 | $account_data=$this->session->userdata('accountinfo'); |
375 | - $currency_id=$account_data['currency_id']; |
|
376 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
377 | - $query = $this->user_model->get_user_rates_list(true, '', '', false); |
|
378 | - $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
379 | - ob_clean(); |
|
380 | - $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Initital Increment","Increment"); |
|
381 | - if ($query->num_rows() > 0) { |
|
382 | - foreach ($query->result_array() as $row) { |
|
375 | + $currency_id=$account_data['currency_id']; |
|
376 | + $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
377 | + $query = $this->user_model->get_user_rates_list(true, '', '', false); |
|
378 | + $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
379 | + ob_clean(); |
|
380 | + $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Initital Increment","Increment"); |
|
381 | + if ($query->num_rows() > 0) { |
|
382 | + foreach ($query->result_array() as $row) { |
|
383 | 383 | $cost=$account_data['type']!=3 ? ($row['cost'] + ($row['cost']*$markup)/100) :$row['cost']; |
384 | 384 | $inbound_array[] = array( |
385 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
386 | - $row['comment'], |
|
387 | - $this->common_model->calculate_currency($row['connectcost'],'','',true,false), |
|
388 | - $row['includedseconds'], |
|
385 | + $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
386 | + $row['comment'], |
|
387 | + $this->common_model->calculate_currency($row['connectcost'],'','',true,false), |
|
388 | + $row['includedseconds'], |
|
389 | 389 | $this->common_model->calculate_currency($cost,'','',true,false), |
390 | 390 | $row['init_inc'], |
391 | - $row['inc'] |
|
392 | - ); |
|
393 | - } |
|
394 | - } |
|
395 | - $this->load->helper('csv'); |
|
396 | - array_to_csv($inbound_array, 'Rates_' . date("Y-m-d") . '.csv'); |
|
397 | - } |
|
398 | - |
|
399 | - function user_refill($action = "") { |
|
400 | - if (common_model::$global_config['system_config']['paypal_status'] == 1) { |
|
401 | - redirect(base_url() . 'user/user/'); |
|
402 | - } |
|
403 | - $this->load->module("user/refill"); |
|
404 | - if ($action == "GET_AMT") { |
|
405 | - $amount = $this->input->post("value", true); |
|
406 | - $this->refill->convert_amount($amount); |
|
407 | - } else { |
|
408 | - $this->refill->index(); |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - function user_convert_amount($amount) { |
|
413 | - $amount = $this->common_model->add_calculate_currency($amount, "", "", false, false); |
|
414 | - echo number_format($amount, 5); |
|
415 | - } |
|
391 | + $row['inc'] |
|
392 | + ); |
|
393 | + } |
|
394 | + } |
|
395 | + $this->load->helper('csv'); |
|
396 | + array_to_csv($inbound_array, 'Rates_' . date("Y-m-d") . '.csv'); |
|
397 | + } |
|
398 | + |
|
399 | + function user_refill($action = "") { |
|
400 | + if (common_model::$global_config['system_config']['paypal_status'] == 1) { |
|
401 | + redirect(base_url() . 'user/user/'); |
|
402 | + } |
|
403 | + $this->load->module("user/refill"); |
|
404 | + if ($action == "GET_AMT") { |
|
405 | + $amount = $this->input->post("value", true); |
|
406 | + $this->refill->convert_amount($amount); |
|
407 | + } else { |
|
408 | + $this->refill->index(); |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + function user_convert_amount($amount) { |
|
413 | + $amount = $this->common_model->add_calculate_currency($amount, "", "", false, false); |
|
414 | + echo number_format($amount, 5); |
|
415 | + } |
|
416 | 416 | |
417 | 417 | |
418 | - function user_report_export() { |
|
419 | - $this->load->module('reports/reports'); |
|
420 | - $this->user_cdrreport_export(); |
|
421 | - } |
|
422 | - |
|
423 | - function change_password() { |
|
424 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
425 | - $id = $accountinfo['id']; |
|
426 | - $this->load->model('user_model'); |
|
427 | - |
|
428 | - $query = $this->user_model->change_password($id); |
|
429 | - foreach ($query as $row) { |
|
430 | - $data['password'] = $row->password; |
|
431 | - } |
|
432 | - $databasepassword = $data['password']; |
|
433 | - $password = $_POST['oldpassword']; |
|
434 | - $newpassword = $_POST['newpassword']; |
|
435 | - $conformpassword = $_POST['conformpassword']; |
|
436 | - if ($databasepassword == $password) { |
|
437 | - |
|
438 | - if ($conformpassword == $newpassword) { |
|
439 | - $update = $newpassword; |
|
440 | - $this->load->model('user_model'); |
|
441 | - $this->user_model->change_db_password($update, $id); |
|
442 | - $this->session->set_flashdata('astpp_errormsg', "Password changed Sucessfully....!!!"); |
|
443 | - redirect(base_url() . 'user/user/changepassword/'); |
|
444 | - } else { |
|
445 | - $this->session->set_flashdata('astpp_notification', "New Password & Conformpassword not match."); |
|
446 | - redirect(base_url() . 'user/user/changepassword/'); |
|
447 | - } |
|
448 | - } else { |
|
449 | - $this->session->set_flashdata('astpp_notification', "Invalid old passwword."); |
|
450 | - redirect(base_url() . 'user/user/changepassword/'); |
|
451 | - } |
|
452 | - } |
|
453 | - |
|
454 | - function changepassword() { |
|
455 | - $data['username'] = $this->session->userdata('user_name'); |
|
456 | - $data['page_title'] = 'Change Password'; |
|
457 | - $this->load->view('view_changepassword', $data); |
|
458 | - } |
|
459 | - |
|
460 | - function user_generate_password() { |
|
461 | - echo $this->common->generate_password(); |
|
462 | - } |
|
463 | - |
|
464 | - function user_generate_number($digit) { |
|
465 | - echo $this->common->find_uniq_rendno($digit, 'number', 'accounts'); |
|
466 | - } |
|
467 | - |
|
468 | - function user_refill_coupon_list() { |
|
469 | - $data['username'] = $this->session->userdata('user_name'); |
|
470 | - $data['page_title'] = 'Refill Coupon List'; |
|
471 | - $this->load->module('refill_coupon/refill_coupon'); |
|
472 | - $data['grid_fields'] = $this->refill_coupon->refill_coupon_form->build_user_refill_coupon_grid(); |
|
473 | - $acc_data = $this->session->userdata("accountinfo"); |
|
474 | - $reseller_id = $acc_data['reseller_id']; |
|
475 | - |
|
476 | - $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='" . $reseller_id . "'"); |
|
477 | - $reseller_data = array(); |
|
478 | - $data['refill_coupon_list'] = form_dropdown_all('refill_coupon_list', $reseller_data, ''); |
|
479 | - $this->load->view('view_refill_coupon_list', $data); |
|
480 | - } |
|
481 | - |
|
482 | - function user_refill_coupon_list_json() { |
|
483 | - $account_data = $this->session->userdata("accountinfo"); |
|
484 | - |
|
485 | - $this->load->module('refill_coupon/refill_coupon'); |
|
486 | - $this->refill_coupon->refill_coupon_customer_json($account_data["id"]); |
|
487 | - } |
|
488 | - |
|
489 | - function user_refill_coupon_number($refill_coupon_no) { |
|
490 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
491 | - $reseller_id = $accountinfo['reseller_id']; |
|
492 | - $customer_id = $accountinfo['id']; |
|
493 | - $this->db->where('reseller_id', $reseller_id); |
|
494 | - $this->db->where('number', $refill_coupon_no); |
|
495 | - $this->db->select('*'); |
|
496 | - $refill_coupon_result = $this->db->get('refill_coupon'); |
|
497 | - if ($refill_coupon_result->num_rows() > 0) { |
|
498 | - $refill_coupon_result = $refill_coupon_result->result_array(); |
|
499 | - $refill_coupon_result = $refill_coupon_result[0]; |
|
500 | - if ($refill_coupon_result['status'] == 1) { |
|
501 | - echo json_encode(1); |
|
502 | - } elseif ($refill_coupon_result['status'] == 2) { |
|
503 | - echo json_encode(2); |
|
504 | - } else { |
|
505 | - $this->db->select('balance'); |
|
506 | - $result = (array)$this->db->get_where('accounts',array('id'=>$customer_id))->first_row(); |
|
507 | - $user_balance=$this->db_model->get_available_bal($accountinfo); |
|
508 | - $original_balance=$refill_coupon_result['amount']; |
|
509 | - $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance,'','',TRUE,TRUE); |
|
510 | - $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance+$original_balance,'','',TRUE,TRUE); |
|
511 | - echo json_encode($refill_coupon_result); |
|
512 | - } |
|
513 | - } else { |
|
514 | - echo json_encode(3); |
|
515 | - } |
|
516 | - } |
|
517 | - |
|
518 | - function user_refill_coupon_action($refill_coupon_no) { |
|
519 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
520 | - $reseller_id = $accountinfo['reseller_id']; |
|
521 | - if ($reseller_id == 0) { |
|
522 | - $reseller_id = '-1'; |
|
523 | - } |
|
524 | - $date = gmdate('Y-m-d H:i:s'); |
|
525 | - $customer_id = $accountinfo['id']; |
|
526 | - $this->db->where('number', $refill_coupon_no); |
|
527 | - $this->db->select('amount'); |
|
528 | - $result = $this->db->get('refill_coupon'); |
|
529 | - if ($result->num_rows() > 0) { |
|
530 | - $result = $result->result_array(); |
|
531 | - $amount = $result[0]['amount']; |
|
532 | - $this->db->where('id', $customer_id); |
|
533 | - $this->db->select('balance'); |
|
534 | - $result = $this->db->get('accounts'); |
|
535 | - $result = $result->result_array(); |
|
536 | - $current_balance = $result[0]['balance']; |
|
537 | - $new_balance = $current_balance + $amount; |
|
538 | - $data = array('balance' => $new_balance); |
|
539 | - $this->db->where('id', $customer_id); |
|
540 | - $this->db->update('accounts', $data); |
|
541 | - $this->db->where('number', $refill_coupon_no); |
|
542 | - $refill_coupon_data = array('status' => 2, "account_id" => $customer_id, 'firstused' => $date); |
|
543 | - $this->db->update('refill_coupon', $refill_coupon_data); |
|
544 | - $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. ' . $refill_coupon_no . ''); |
|
545 | - $this->db->insert('payments', $payment_arr); |
|
546 | - } |
|
547 | - redirect(base_url() . "user/user_refill_coupon_list/"); |
|
548 | - } |
|
549 | - |
|
550 | - function user_packages() { |
|
551 | - $data['page_title'] = 'Packages'; |
|
552 | - $data['grid_fields'] = $this->user_form->build_packages_list_for_user(); |
|
553 | - $this->load->view('view_user_packages_list', $data); |
|
554 | - } |
|
555 | - |
|
556 | - function user_packages_json() { |
|
557 | - $json_data = array(); |
|
558 | - $count_all = $this->user_model->get_user_packages_list(false,'',''); |
|
559 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
560 | - $json_data = $paging_data["json_paging"]; |
|
561 | - $query = $this->user_model->get_user_packages_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
562 | - $grid_fields = json_decode($this->user_form->build_packages_list_for_user()); |
|
563 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
564 | - echo json_encode($json_data); |
|
565 | - } |
|
566 | - |
|
567 | - function user_invoices() { |
|
568 | - $data['page_title'] = 'Invoices'; |
|
569 | - $this->load->view('view_user_invoices_list', $data); |
|
570 | - } |
|
571 | - |
|
572 | - function user_invoices_json() { |
|
573 | - $json_data = array(); |
|
574 | - $count_all = $this->user_model->get_user_invoices_list(false); |
|
575 | - $paging_data = $this->form->load_grid_config($count_all, 10, 1); |
|
576 | - $json_data = $paging_data["json_paging"]; |
|
577 | - $query = $this->user_model->get_user_invoices_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
578 | - $this->load->module('invoices/invoices'); |
|
579 | - $grid_fields = json_decode($this->user_form->build_invoices_list_for_user()); |
|
580 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
581 | - echo json_encode($json_data); |
|
582 | - } |
|
583 | - |
|
584 | - function user_emails() { |
|
585 | - $data['page_title'] = 'EMails'; |
|
586 | - $data['grid_fields'] = $this->user_form->build_emails_list_for_user(); |
|
587 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_emails_search()); |
|
588 | - $this->load->view('view_user_emails_list', $data); |
|
589 | - } |
|
590 | - |
|
591 | - function user_emails_json() { |
|
592 | - $json_data = array(); |
|
593 | - $count_all = $this->user_model->get_user_emails_list(false); |
|
594 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
595 | - $json_data = $paging_data["json_paging"]; |
|
596 | - $query = $this->user_model->get_user_emails_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
597 | - $grid_fields = json_decode($this->user_form->build_emails_list_for_user()); |
|
598 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
599 | - echo json_encode($json_data); |
|
600 | - } |
|
601 | - function user_emails_search(){ |
|
602 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
603 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
604 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
605 | - $action = $this->input->post(); |
|
606 | - unset($action['action'],$action['advance_search']); |
|
607 | - $this->session->set_userdata('user_emails_search', $action); |
|
608 | - } |
|
609 | - if (@$ajax_search != 1) { |
|
610 | - redirect(base_url() . 'user/user_emails/'); |
|
611 | - } |
|
612 | - } |
|
613 | - function user_emails_clearsearchfilter(){ |
|
614 | - $this->session->set_userdata('advance_search', 0); |
|
615 | - $this->session->set_userdata('user_emails_search', ""); |
|
616 | - } |
|
617 | - function user_invoice_config() { |
|
618 | - $data['page_title'] = 'Company Profile'; |
|
619 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
620 | - $add_array = $this->input->post(); |
|
621 | - $data["account_data"] = $add_array; |
|
622 | - if (isset($add_array['submit'])) { |
|
623 | - if ($_FILES['file']['name'] == '') { |
|
624 | - $invoiceconf = $this->user_model->get_invoiceconf(); |
|
625 | - $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
626 | - } |
|
627 | - if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
|
628 | - $files = $_FILES['file']; |
|
629 | - if ($files['size'] < 0) { |
|
630 | - $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
|
631 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
632 | - } |
|
633 | - $file = $_FILES['file']; |
|
634 | - $uploadedFile = $file["tmp_name"]; |
|
635 | - $file_name = $file['name']; |
|
636 | - $file_type = $file['type']; |
|
637 | - if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
|
638 | - $dir_path = FCPATH. "upload/"; |
|
639 | - $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
640 | - if (move_uploaded_file($uploadedFile, $path)) { |
|
641 | - $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
|
642 | - } else { |
|
643 | - $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
|
644 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
645 | - } |
|
646 | - } else { |
|
647 | - $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
|
648 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
649 | - } |
|
650 | - } |
|
651 | - $add_array['logo'] = $file_name; |
|
652 | - unset($add_array['submit']); |
|
653 | - if ($add_array['id'] == '') { |
|
654 | - $add_array['accountid'] = $accountinfo['id']; |
|
655 | - $this->user_model->add_invoice_config($add_array); |
|
656 | - } else { |
|
657 | - $this->user_model->edit_invoice_config($add_array, $add_array['id']); |
|
658 | - } |
|
659 | - $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
|
660 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
661 | - } else { |
|
662 | - $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$accountinfo['id']))->first_row(); |
|
663 | - if(isset($data["account_data"]['logo'])){ |
|
664 | - $data["account_data"]['file']=$accountinfo['id']."_".$data["account_data"]['logo']; |
|
665 | - } |
|
666 | - $this->load->view('view_user_invoices_config', $data); |
|
667 | - } |
|
668 | - } |
|
669 | - |
|
670 | - function user_invoice_logo_delete($accountid){ |
|
418 | + function user_report_export() { |
|
419 | + $this->load->module('reports/reports'); |
|
420 | + $this->user_cdrreport_export(); |
|
421 | + } |
|
422 | + |
|
423 | + function change_password() { |
|
424 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
425 | + $id = $accountinfo['id']; |
|
426 | + $this->load->model('user_model'); |
|
427 | + |
|
428 | + $query = $this->user_model->change_password($id); |
|
429 | + foreach ($query as $row) { |
|
430 | + $data['password'] = $row->password; |
|
431 | + } |
|
432 | + $databasepassword = $data['password']; |
|
433 | + $password = $_POST['oldpassword']; |
|
434 | + $newpassword = $_POST['newpassword']; |
|
435 | + $conformpassword = $_POST['conformpassword']; |
|
436 | + if ($databasepassword == $password) { |
|
437 | + |
|
438 | + if ($conformpassword == $newpassword) { |
|
439 | + $update = $newpassword; |
|
440 | + $this->load->model('user_model'); |
|
441 | + $this->user_model->change_db_password($update, $id); |
|
442 | + $this->session->set_flashdata('astpp_errormsg', "Password changed Sucessfully....!!!"); |
|
443 | + redirect(base_url() . 'user/user/changepassword/'); |
|
444 | + } else { |
|
445 | + $this->session->set_flashdata('astpp_notification', "New Password & Conformpassword not match."); |
|
446 | + redirect(base_url() . 'user/user/changepassword/'); |
|
447 | + } |
|
448 | + } else { |
|
449 | + $this->session->set_flashdata('astpp_notification', "Invalid old passwword."); |
|
450 | + redirect(base_url() . 'user/user/changepassword/'); |
|
451 | + } |
|
452 | + } |
|
453 | + |
|
454 | + function changepassword() { |
|
455 | + $data['username'] = $this->session->userdata('user_name'); |
|
456 | + $data['page_title'] = 'Change Password'; |
|
457 | + $this->load->view('view_changepassword', $data); |
|
458 | + } |
|
459 | + |
|
460 | + function user_generate_password() { |
|
461 | + echo $this->common->generate_password(); |
|
462 | + } |
|
463 | + |
|
464 | + function user_generate_number($digit) { |
|
465 | + echo $this->common->find_uniq_rendno($digit, 'number', 'accounts'); |
|
466 | + } |
|
467 | + |
|
468 | + function user_refill_coupon_list() { |
|
469 | + $data['username'] = $this->session->userdata('user_name'); |
|
470 | + $data['page_title'] = 'Refill Coupon List'; |
|
471 | + $this->load->module('refill_coupon/refill_coupon'); |
|
472 | + $data['grid_fields'] = $this->refill_coupon->refill_coupon_form->build_user_refill_coupon_grid(); |
|
473 | + $acc_data = $this->session->userdata("accountinfo"); |
|
474 | + $reseller_id = $acc_data['reseller_id']; |
|
475 | + |
|
476 | + $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='" . $reseller_id . "'"); |
|
477 | + $reseller_data = array(); |
|
478 | + $data['refill_coupon_list'] = form_dropdown_all('refill_coupon_list', $reseller_data, ''); |
|
479 | + $this->load->view('view_refill_coupon_list', $data); |
|
480 | + } |
|
481 | + |
|
482 | + function user_refill_coupon_list_json() { |
|
483 | + $account_data = $this->session->userdata("accountinfo"); |
|
484 | + |
|
485 | + $this->load->module('refill_coupon/refill_coupon'); |
|
486 | + $this->refill_coupon->refill_coupon_customer_json($account_data["id"]); |
|
487 | + } |
|
488 | + |
|
489 | + function user_refill_coupon_number($refill_coupon_no) { |
|
490 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
491 | + $reseller_id = $accountinfo['reseller_id']; |
|
492 | + $customer_id = $accountinfo['id']; |
|
493 | + $this->db->where('reseller_id', $reseller_id); |
|
494 | + $this->db->where('number', $refill_coupon_no); |
|
495 | + $this->db->select('*'); |
|
496 | + $refill_coupon_result = $this->db->get('refill_coupon'); |
|
497 | + if ($refill_coupon_result->num_rows() > 0) { |
|
498 | + $refill_coupon_result = $refill_coupon_result->result_array(); |
|
499 | + $refill_coupon_result = $refill_coupon_result[0]; |
|
500 | + if ($refill_coupon_result['status'] == 1) { |
|
501 | + echo json_encode(1); |
|
502 | + } elseif ($refill_coupon_result['status'] == 2) { |
|
503 | + echo json_encode(2); |
|
504 | + } else { |
|
505 | + $this->db->select('balance'); |
|
506 | + $result = (array)$this->db->get_where('accounts',array('id'=>$customer_id))->first_row(); |
|
507 | + $user_balance=$this->db_model->get_available_bal($accountinfo); |
|
508 | + $original_balance=$refill_coupon_result['amount']; |
|
509 | + $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance,'','',TRUE,TRUE); |
|
510 | + $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance+$original_balance,'','',TRUE,TRUE); |
|
511 | + echo json_encode($refill_coupon_result); |
|
512 | + } |
|
513 | + } else { |
|
514 | + echo json_encode(3); |
|
515 | + } |
|
516 | + } |
|
517 | + |
|
518 | + function user_refill_coupon_action($refill_coupon_no) { |
|
519 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
520 | + $reseller_id = $accountinfo['reseller_id']; |
|
521 | + if ($reseller_id == 0) { |
|
522 | + $reseller_id = '-1'; |
|
523 | + } |
|
524 | + $date = gmdate('Y-m-d H:i:s'); |
|
525 | + $customer_id = $accountinfo['id']; |
|
526 | + $this->db->where('number', $refill_coupon_no); |
|
527 | + $this->db->select('amount'); |
|
528 | + $result = $this->db->get('refill_coupon'); |
|
529 | + if ($result->num_rows() > 0) { |
|
530 | + $result = $result->result_array(); |
|
531 | + $amount = $result[0]['amount']; |
|
532 | + $this->db->where('id', $customer_id); |
|
533 | + $this->db->select('balance'); |
|
534 | + $result = $this->db->get('accounts'); |
|
535 | + $result = $result->result_array(); |
|
536 | + $current_balance = $result[0]['balance']; |
|
537 | + $new_balance = $current_balance + $amount; |
|
538 | + $data = array('balance' => $new_balance); |
|
539 | + $this->db->where('id', $customer_id); |
|
540 | + $this->db->update('accounts', $data); |
|
541 | + $this->db->where('number', $refill_coupon_no); |
|
542 | + $refill_coupon_data = array('status' => 2, "account_id" => $customer_id, 'firstused' => $date); |
|
543 | + $this->db->update('refill_coupon', $refill_coupon_data); |
|
544 | + $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. ' . $refill_coupon_no . ''); |
|
545 | + $this->db->insert('payments', $payment_arr); |
|
546 | + } |
|
547 | + redirect(base_url() . "user/user_refill_coupon_list/"); |
|
548 | + } |
|
549 | + |
|
550 | + function user_packages() { |
|
551 | + $data['page_title'] = 'Packages'; |
|
552 | + $data['grid_fields'] = $this->user_form->build_packages_list_for_user(); |
|
553 | + $this->load->view('view_user_packages_list', $data); |
|
554 | + } |
|
555 | + |
|
556 | + function user_packages_json() { |
|
557 | + $json_data = array(); |
|
558 | + $count_all = $this->user_model->get_user_packages_list(false,'',''); |
|
559 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
560 | + $json_data = $paging_data["json_paging"]; |
|
561 | + $query = $this->user_model->get_user_packages_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
562 | + $grid_fields = json_decode($this->user_form->build_packages_list_for_user()); |
|
563 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
564 | + echo json_encode($json_data); |
|
565 | + } |
|
566 | + |
|
567 | + function user_invoices() { |
|
568 | + $data['page_title'] = 'Invoices'; |
|
569 | + $this->load->view('view_user_invoices_list', $data); |
|
570 | + } |
|
571 | + |
|
572 | + function user_invoices_json() { |
|
573 | + $json_data = array(); |
|
574 | + $count_all = $this->user_model->get_user_invoices_list(false); |
|
575 | + $paging_data = $this->form->load_grid_config($count_all, 10, 1); |
|
576 | + $json_data = $paging_data["json_paging"]; |
|
577 | + $query = $this->user_model->get_user_invoices_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
578 | + $this->load->module('invoices/invoices'); |
|
579 | + $grid_fields = json_decode($this->user_form->build_invoices_list_for_user()); |
|
580 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
581 | + echo json_encode($json_data); |
|
582 | + } |
|
583 | + |
|
584 | + function user_emails() { |
|
585 | + $data['page_title'] = 'EMails'; |
|
586 | + $data['grid_fields'] = $this->user_form->build_emails_list_for_user(); |
|
587 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_emails_search()); |
|
588 | + $this->load->view('view_user_emails_list', $data); |
|
589 | + } |
|
590 | + |
|
591 | + function user_emails_json() { |
|
592 | + $json_data = array(); |
|
593 | + $count_all = $this->user_model->get_user_emails_list(false); |
|
594 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
595 | + $json_data = $paging_data["json_paging"]; |
|
596 | + $query = $this->user_model->get_user_emails_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
597 | + $grid_fields = json_decode($this->user_form->build_emails_list_for_user()); |
|
598 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
599 | + echo json_encode($json_data); |
|
600 | + } |
|
601 | + function user_emails_search(){ |
|
602 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
603 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
604 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
605 | + $action = $this->input->post(); |
|
606 | + unset($action['action'],$action['advance_search']); |
|
607 | + $this->session->set_userdata('user_emails_search', $action); |
|
608 | + } |
|
609 | + if (@$ajax_search != 1) { |
|
610 | + redirect(base_url() . 'user/user_emails/'); |
|
611 | + } |
|
612 | + } |
|
613 | + function user_emails_clearsearchfilter(){ |
|
614 | + $this->session->set_userdata('advance_search', 0); |
|
615 | + $this->session->set_userdata('user_emails_search', ""); |
|
616 | + } |
|
617 | + function user_invoice_config() { |
|
618 | + $data['page_title'] = 'Company Profile'; |
|
619 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
620 | + $add_array = $this->input->post(); |
|
621 | + $data["account_data"] = $add_array; |
|
622 | + if (isset($add_array['submit'])) { |
|
623 | + if ($_FILES['file']['name'] == '') { |
|
624 | + $invoiceconf = $this->user_model->get_invoiceconf(); |
|
625 | + $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
626 | + } |
|
627 | + if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
|
628 | + $files = $_FILES['file']; |
|
629 | + if ($files['size'] < 0) { |
|
630 | + $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
|
631 | + redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
632 | + } |
|
633 | + $file = $_FILES['file']; |
|
634 | + $uploadedFile = $file["tmp_name"]; |
|
635 | + $file_name = $file['name']; |
|
636 | + $file_type = $file['type']; |
|
637 | + if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
|
638 | + $dir_path = FCPATH. "upload/"; |
|
639 | + $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
640 | + if (move_uploaded_file($uploadedFile, $path)) { |
|
641 | + $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
|
642 | + } else { |
|
643 | + $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
|
644 | + redirect(base_url() . 'user/user_invoice_config/'); |
|
645 | + } |
|
646 | + } else { |
|
647 | + $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
|
648 | + redirect(base_url() . 'user/user_invoice_config/'); |
|
649 | + } |
|
650 | + } |
|
651 | + $add_array['logo'] = $file_name; |
|
652 | + unset($add_array['submit']); |
|
653 | + if ($add_array['id'] == '') { |
|
654 | + $add_array['accountid'] = $accountinfo['id']; |
|
655 | + $this->user_model->add_invoice_config($add_array); |
|
656 | + } else { |
|
657 | + $this->user_model->edit_invoice_config($add_array, $add_array['id']); |
|
658 | + } |
|
659 | + $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
|
660 | + redirect(base_url() . 'user/user_invoice_config/'); |
|
661 | + } else { |
|
662 | + $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$accountinfo['id']))->first_row(); |
|
663 | + if(isset($data["account_data"]['logo'])){ |
|
664 | + $data["account_data"]['file']=$accountinfo['id']."_".$data["account_data"]['logo']; |
|
665 | + } |
|
666 | + $this->load->view('view_user_invoices_config', $data); |
|
667 | + } |
|
668 | + } |
|
669 | + |
|
670 | + function user_invoice_logo_delete($accountid){ |
|
671 | 671 | $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid)); |
672 | 672 | $result=$invoiceconf->result_array(); |
673 | 673 | $logo=$result[0]['logo']; |
@@ -675,164 +675,164 @@ discard block |
||
675 | 675 | $where_arr=array('logo'=>$logo); |
676 | 676 | $this->db->where($where_arr); |
677 | 677 | $this->db->update('invoice_conf',$post_arr); |
678 | - } |
|
678 | + } |
|
679 | 679 | |
680 | - function user_myprofile() { |
|
681 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
682 | - $entity_name = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
683 | - $data['page_title'] = 'My Profile'; |
|
684 | - $add_array = $this->input->post(); |
|
685 | - if ($add_array['id'] != '') { |
|
686 | - $add_array['type'] = $accountinfo['type']; |
|
687 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($add_array), $add_array); |
|
688 | - if ($this->form_validation->run() == FALSE) { |
|
689 | - $data['validation_errors'] = validation_errors(); |
|
690 | - } else { |
|
691 | - if ($add_array['id'] == $accountinfo['id']) { |
|
692 | - $this->user_model->edit_account($add_array, $add_array['id']); |
|
693 | - $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
694 | - $result = $result->result_array(); |
|
695 | - $this->session->set_userdata('accountinfo', $result[0]); |
|
696 | - $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!'); |
|
697 | - redirect(base_url() . 'user/user_myprofile/'); |
|
698 | - }else{ |
|
699 | - $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.'); |
|
700 | - } |
|
701 | - } |
|
702 | - } else { |
|
703 | - $where = array('id' => $accountinfo["id"]); |
|
704 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
705 | - $data["account_data"] = $account->result_array(); |
|
706 | - |
|
707 | - foreach ($account->result_array() as $key => $value) { |
|
708 | - $editable_data = $value; |
|
709 | - } |
|
710 | - $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
711 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($editable_data), $editable_data); |
|
712 | - } |
|
713 | - $this->load->view('view_user_details', $data); |
|
714 | - } |
|
680 | + function user_myprofile() { |
|
681 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
682 | + $entity_name = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
683 | + $data['page_title'] = 'My Profile'; |
|
684 | + $add_array = $this->input->post(); |
|
685 | + if ($add_array['id'] != '') { |
|
686 | + $add_array['type'] = $accountinfo['type']; |
|
687 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($add_array), $add_array); |
|
688 | + if ($this->form_validation->run() == FALSE) { |
|
689 | + $data['validation_errors'] = validation_errors(); |
|
690 | + } else { |
|
691 | + if ($add_array['id'] == $accountinfo['id']) { |
|
692 | + $this->user_model->edit_account($add_array, $add_array['id']); |
|
693 | + $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
694 | + $result = $result->result_array(); |
|
695 | + $this->session->set_userdata('accountinfo', $result[0]); |
|
696 | + $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!'); |
|
697 | + redirect(base_url() . 'user/user_myprofile/'); |
|
698 | + }else{ |
|
699 | + $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.'); |
|
700 | + } |
|
701 | + } |
|
702 | + } else { |
|
703 | + $where = array('id' => $accountinfo["id"]); |
|
704 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
705 | + $data["account_data"] = $account->result_array(); |
|
706 | + |
|
707 | + foreach ($account->result_array() as $key => $value) { |
|
708 | + $editable_data = $value; |
|
709 | + } |
|
710 | + $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
711 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($editable_data), $editable_data); |
|
712 | + } |
|
713 | + $this->load->view('view_user_details', $data); |
|
714 | + } |
|
715 | 715 | |
716 | - function user_change_password() { |
|
717 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
718 | - $data['page_title'] = "Change Password"; |
|
719 | - $add_array = $this->input->post(); |
|
720 | - if(!empty($add_array)) { |
|
721 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $add_array); |
|
722 | - if ($this->form_validation->run() == FALSE) { |
|
723 | - $data['validation_errors'] = validation_errors(); |
|
724 | - } else { |
|
725 | - $password_encode = $this->common->encode($add_array['new_password']); |
|
726 | - $data = array('password' => $password_encode); |
|
727 | - $this->db->where('id',$add_array['id']); |
|
728 | - $this->db->update('accounts', $data); |
|
729 | - $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!'); |
|
730 | - redirect(base_url() . 'user/user_change_password/'); |
|
731 | - } |
|
732 | - }else{ |
|
733 | - $data_array['id']=$accountinfo['id']; |
|
734 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array); |
|
735 | - } |
|
736 | - $this->load->view('view_user_change_password', $data); |
|
737 | - } |
|
738 | - |
|
739 | - function user_refill_report() { |
|
740 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
741 | - $data['page_title'] = 'Refill Report'; |
|
742 | - $data['search_flag'] = true; |
|
743 | - $this->session->set_userdata('advance_search', 0); |
|
744 | - $data['grid_fields'] = $this->user_form->build_user_refill_report(); |
|
745 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search()); |
|
746 | - if($accountinfo['type'] == 1){ |
|
747 | - $this->load->view('view_reseller_refill_report', $data); |
|
748 | - }else{ |
|
749 | - $this->load->view('view_user_refill_report', $data); |
|
750 | - } |
|
751 | - } |
|
752 | - |
|
753 | - function user_refill_report_json() { |
|
754 | - $json_data = array(); |
|
755 | - $count_all = $this->user_model->get_user_refill_list(false); |
|
756 | - $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']); |
|
757 | - $json_data = $paging_data["json_paging"]; |
|
758 | - $query = $this->user_model->get_user_refill_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
759 | - $grid_fields = json_decode($this->user_form->build_user_refill_report()); |
|
760 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
761 | - echo json_encode($json_data); |
|
762 | - } |
|
716 | + function user_change_password() { |
|
717 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
718 | + $data['page_title'] = "Change Password"; |
|
719 | + $add_array = $this->input->post(); |
|
720 | + if(!empty($add_array)) { |
|
721 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $add_array); |
|
722 | + if ($this->form_validation->run() == FALSE) { |
|
723 | + $data['validation_errors'] = validation_errors(); |
|
724 | + } else { |
|
725 | + $password_encode = $this->common->encode($add_array['new_password']); |
|
726 | + $data = array('password' => $password_encode); |
|
727 | + $this->db->where('id',$add_array['id']); |
|
728 | + $this->db->update('accounts', $data); |
|
729 | + $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!'); |
|
730 | + redirect(base_url() . 'user/user_change_password/'); |
|
731 | + } |
|
732 | + }else{ |
|
733 | + $data_array['id']=$accountinfo['id']; |
|
734 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array); |
|
735 | + } |
|
736 | + $this->load->view('view_user_change_password', $data); |
|
737 | + } |
|
738 | + |
|
739 | + function user_refill_report() { |
|
740 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
741 | + $data['page_title'] = 'Refill Report'; |
|
742 | + $data['search_flag'] = true; |
|
743 | + $this->session->set_userdata('advance_search', 0); |
|
744 | + $data['grid_fields'] = $this->user_form->build_user_refill_report(); |
|
745 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search()); |
|
746 | + if($accountinfo['type'] == 1){ |
|
747 | + $this->load->view('view_reseller_refill_report', $data); |
|
748 | + }else{ |
|
749 | + $this->load->view('view_user_refill_report', $data); |
|
750 | + } |
|
751 | + } |
|
752 | + |
|
753 | + function user_refill_report_json() { |
|
754 | + $json_data = array(); |
|
755 | + $count_all = $this->user_model->get_user_refill_list(false); |
|
756 | + $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']); |
|
757 | + $json_data = $paging_data["json_paging"]; |
|
758 | + $query = $this->user_model->get_user_refill_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
759 | + $grid_fields = json_decode($this->user_form->build_user_refill_report()); |
|
760 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
761 | + echo json_encode($json_data); |
|
762 | + } |
|
763 | 763 | |
764 | - function user_refill_report_search() { |
|
765 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
766 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
767 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
768 | - $action = $this->input->post(); |
|
769 | - unset($action['action'],$action['advance_search']); |
|
770 | - if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
771 | - $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
772 | - } |
|
773 | - $this->session->set_userdata('user_refill_report_search', $action); |
|
774 | - } |
|
775 | - if (@$ajax_search != 1) { |
|
776 | - redirect(base_url() . 'user/user_refill_report/'); |
|
777 | - } |
|
778 | - } |
|
764 | + function user_refill_report_search() { |
|
765 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
766 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
767 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
768 | + $action = $this->input->post(); |
|
769 | + unset($action['action'],$action['advance_search']); |
|
770 | + if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
771 | + $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
772 | + } |
|
773 | + $this->session->set_userdata('user_refill_report_search', $action); |
|
774 | + } |
|
775 | + if (@$ajax_search != 1) { |
|
776 | + redirect(base_url() . 'user/user_refill_report/'); |
|
777 | + } |
|
778 | + } |
|
779 | 779 | |
780 | - function user_refill_report_clearsearchfilter() { |
|
781 | - $this->session->set_userdata('advance_search', 0); |
|
782 | - $this->session->set_userdata('user_refill_report_search', ""); |
|
783 | - } |
|
780 | + function user_refill_report_clearsearchfilter() { |
|
781 | + $this->session->set_userdata('advance_search', 0); |
|
782 | + $this->session->set_userdata('user_refill_report_search', ""); |
|
783 | + } |
|
784 | 784 | |
785 | - function user_invoices_list() { |
|
785 | + function user_invoices_list() { |
|
786 | 786 | $data['page_title'] = 'Invoices'; |
787 | - $data['search_flag'] = true; |
|
788 | - $this->session->set_userdata('advance_search', 0); |
|
789 | - $data['grid_fields'] = $this->user_form->build_user_invoices(); |
|
790 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_invoices_search()); |
|
791 | - $this->load->view('view_user_invoices_list', $data); |
|
792 | - } |
|
793 | - function user_invoices_list_json() { |
|
794 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
795 | - $where = array("accountid" => $accountinfo['id']); |
|
796 | - $count_all = $this->user_model->get_user_invoice_list(false, '', '', $where); |
|
797 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
798 | - $json_data = $paging_data["json_paging"]; |
|
799 | - $user_currency=$this->common->get_field_name('currency','currency',$accountinfo['currency_id']); |
|
800 | - $invoices_query = $this->user_model->get_user_invoice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $where); |
|
801 | - $invoices_result = $invoices_query->result_array(); |
|
802 | - $ountstanding_value = 0; |
|
803 | - $total_amount = 0; |
|
804 | - $this->db->where('accountid', $accountinfo['id']); |
|
805 | - $this->db->select('sum(credit) as total_credit'); |
|
806 | - $invoice_details_result = $this->db->get('invoice_details'); |
|
807 | - $total_credit = (array)$invoice_details_result->first_row(); |
|
808 | - $total_credit = $total_credit['total_credit']; |
|
809 | - foreach ($invoices_result as $key => $value) { |
|
810 | - $total_amount+=$value['amount']; |
|
811 | - $invoice_date = date("Y-m-d", strtotime($value['invoice_date'])); |
|
812 | - $from_date = date("Y-m-d", strtotime($value['from_date'])); |
|
813 | - $due_date = date("Y-m-d", strtotime($value['due_date'])); |
|
814 | - $outstanding = $value['amount']; |
|
815 | - $invoice_total_query = $this->db_model->select("sum(debit) as debit,sum(credit) as credit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
816 | - if ($invoice_total_query->num_rows() > 0) { |
|
817 | - $invoice_total_query = $invoice_total_query->result_array(); |
|
818 | - $outstanding -= $invoice_total_query[0]['credit']; |
|
819 | - $payment_last = ($invoice_total_query[0]['created_date']) ? date("Y-m-d", strtotime($invoice_total_query[0]['created_date'])) : ''; |
|
820 | - } |
|
821 | - $invoice_total_query = $this->db_model->select("debit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
822 | - if ($invoice_total_query->num_rows() > 0) { |
|
823 | - $invoice_total_result = $invoice_total_query->result_array(); |
|
824 | - } |
|
825 | - $download = '<a href="' . base_url() . '/user/user_invoice_download/' . $value['id'] . '/00' . $value['invoice_prefix'] . $value['invoiceid'] . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
826 | - if($value['type'] == 'I'){ |
|
827 | - if ($outstanding > 0) { |
|
828 | - $payment = ' <a style="padding: 0 8px;" href="' . base_url() . 'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning" title="Payment">Unpaid</a>'; |
|
829 | - } else { |
|
830 | - $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>'; |
|
831 | - } |
|
787 | + $data['search_flag'] = true; |
|
788 | + $this->session->set_userdata('advance_search', 0); |
|
789 | + $data['grid_fields'] = $this->user_form->build_user_invoices(); |
|
790 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_invoices_search()); |
|
791 | + $this->load->view('view_user_invoices_list', $data); |
|
792 | + } |
|
793 | + function user_invoices_list_json() { |
|
794 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
795 | + $where = array("accountid" => $accountinfo['id']); |
|
796 | + $count_all = $this->user_model->get_user_invoice_list(false, '', '', $where); |
|
797 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
798 | + $json_data = $paging_data["json_paging"]; |
|
799 | + $user_currency=$this->common->get_field_name('currency','currency',$accountinfo['currency_id']); |
|
800 | + $invoices_query = $this->user_model->get_user_invoice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $where); |
|
801 | + $invoices_result = $invoices_query->result_array(); |
|
802 | + $ountstanding_value = 0; |
|
803 | + $total_amount = 0; |
|
804 | + $this->db->where('accountid', $accountinfo['id']); |
|
805 | + $this->db->select('sum(credit) as total_credit'); |
|
806 | + $invoice_details_result = $this->db->get('invoice_details'); |
|
807 | + $total_credit = (array)$invoice_details_result->first_row(); |
|
808 | + $total_credit = $total_credit['total_credit']; |
|
809 | + foreach ($invoices_result as $key => $value) { |
|
810 | + $total_amount+=$value['amount']; |
|
811 | + $invoice_date = date("Y-m-d", strtotime($value['invoice_date'])); |
|
812 | + $from_date = date("Y-m-d", strtotime($value['from_date'])); |
|
813 | + $due_date = date("Y-m-d", strtotime($value['due_date'])); |
|
814 | + $outstanding = $value['amount']; |
|
815 | + $invoice_total_query = $this->db_model->select("sum(debit) as debit,sum(credit) as credit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
816 | + if ($invoice_total_query->num_rows() > 0) { |
|
817 | + $invoice_total_query = $invoice_total_query->result_array(); |
|
818 | + $outstanding -= $invoice_total_query[0]['credit']; |
|
819 | + $payment_last = ($invoice_total_query[0]['created_date']) ? date("Y-m-d", strtotime($invoice_total_query[0]['created_date'])) : ''; |
|
820 | + } |
|
821 | + $invoice_total_query = $this->db_model->select("debit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
822 | + if ($invoice_total_query->num_rows() > 0) { |
|
823 | + $invoice_total_result = $invoice_total_query->result_array(); |
|
824 | + } |
|
825 | + $download = '<a href="' . base_url() . '/user/user_invoice_download/' . $value['id'] . '/00' . $value['invoice_prefix'] . $value['invoiceid'] . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
826 | + if($value['type'] == 'I'){ |
|
827 | + if ($outstanding > 0) { |
|
828 | + $payment = ' <a style="padding: 0 8px;" href="' . base_url() . 'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning" title="Payment">Unpaid</a>'; |
|
829 | + } else { |
|
830 | + $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>'; |
|
831 | + } |
|
832 | 832 | }else{ |
833 | - $payment = ''; |
|
833 | + $payment = ''; |
|
834 | 834 | } |
835 | - if($value['generate_type'] == 1){ |
|
835 | + if($value['generate_type'] == 1){ |
|
836 | 836 | $invoice_type='Manually'; |
837 | 837 | }else{ |
838 | 838 | $invoice_type='Automatically'; |
@@ -859,87 +859,87 @@ discard block |
||
859 | 859 | $download . $payment, |
860 | 860 | )); |
861 | 861 | $ountstanding_value = $ountstanding_value + $outstanding; |
862 | - } |
|
863 | - echo json_encode($json_data); |
|
864 | - } |
|
865 | - |
|
866 | - function user_invoices_list_search() { |
|
867 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
868 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
869 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
870 | - $action = $this->input->post(); |
|
862 | + } |
|
863 | + echo json_encode($json_data); |
|
864 | + } |
|
865 | + |
|
866 | + function user_invoices_list_search() { |
|
867 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
868 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
869 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
870 | + $action = $this->input->post(); |
|
871 | 871 | print_r($action); |
872 | - unset($action['action']); |
|
873 | - unset($action['advance_search']); |
|
874 | - $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0] . " 00:00:00" : ''; |
|
875 | - $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1] . " 23:59:59" : ''; |
|
876 | - $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0] . " 00:00:00" : ''; |
|
877 | - $this->session->set_userdata('user_invoice_list_search', $action); |
|
878 | - } |
|
879 | - if (@$ajax_search != 1) { |
|
880 | - redirect(base_url() . 'user/user_invoice_list/'); |
|
881 | - } |
|
882 | - } |
|
883 | - |
|
884 | - function user_invoices_list_clearsearchfilter() { |
|
885 | - $this->session->set_userdata('advance_search', 0); |
|
886 | - $this->session->set_userdata('user_invoice_list_search', ""); |
|
887 | - } |
|
888 | - |
|
889 | - function user_invoices_download($invoiceid) { |
|
890 | - $this->load->module('invoices/invoices'); |
|
891 | - $this->invoices->invoice_main_download($invoiceid); |
|
892 | - } |
|
893 | - function user_list_responce(){ |
|
872 | + unset($action['action']); |
|
873 | + unset($action['advance_search']); |
|
874 | + $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0] . " 00:00:00" : ''; |
|
875 | + $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1] . " 23:59:59" : ''; |
|
876 | + $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0] . " 00:00:00" : ''; |
|
877 | + $this->session->set_userdata('user_invoice_list_search', $action); |
|
878 | + } |
|
879 | + if (@$ajax_search != 1) { |
|
880 | + redirect(base_url() . 'user/user_invoice_list/'); |
|
881 | + } |
|
882 | + } |
|
883 | + |
|
884 | + function user_invoices_list_clearsearchfilter() { |
|
885 | + $this->session->set_userdata('advance_search', 0); |
|
886 | + $this->session->set_userdata('user_invoice_list_search', ""); |
|
887 | + } |
|
888 | + |
|
889 | + function user_invoices_download($invoiceid) { |
|
890 | + $this->load->module('invoices/invoices'); |
|
891 | + $this->invoices->invoice_main_download($invoiceid); |
|
892 | + } |
|
893 | + function user_list_responce(){ |
|
894 | 894 | $this->load->module('invoices/invoices'); |
895 | - $this->invoices->invoice_list_responce(); |
|
896 | - } |
|
897 | - function user_invoice_payment($invoiceid){ |
|
895 | + $this->invoices->invoice_list_responce(); |
|
896 | + } |
|
897 | + function user_invoice_payment($invoiceid){ |
|
898 | 898 | $this->load->module('invoices/invoices'); |
899 | - $this->invoices->invoice_summary($invoiceid); |
|
900 | - } |
|
901 | - function user_invoice_payment_pay($action=""){ |
|
902 | - $this->load->module("user/payment"); |
|
903 | - if($action=="GET_AMT"){ |
|
904 | - $amount = $this->input->post("value",true); |
|
905 | - $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
906 | - echo number_format($amount,2); |
|
907 | - }else{ |
|
908 | - $this->payment->index(); |
|
909 | - } |
|
910 | - } |
|
911 | - function user_invoice_download($invoiceid){ |
|
899 | + $this->invoices->invoice_summary($invoiceid); |
|
900 | + } |
|
901 | + function user_invoice_payment_pay($action=""){ |
|
902 | + $this->load->module("user/payment"); |
|
903 | + if($action=="GET_AMT"){ |
|
904 | + $amount = $this->input->post("value",true); |
|
905 | + $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
906 | + echo number_format($amount,2); |
|
907 | + }else{ |
|
908 | + $this->payment->index(); |
|
909 | + } |
|
910 | + } |
|
911 | + function user_invoice_download($invoiceid){ |
|
912 | 912 | $this->load->module('invoices/invoices'); |
913 | - $this->invoices->invoice_download($invoiceid); |
|
914 | - } |
|
915 | - function user_charges_history() { |
|
913 | + $this->invoices->invoice_download($invoiceid); |
|
914 | + } |
|
915 | + function user_charges_history() { |
|
916 | 916 | $data['page_title'] = 'Charges History'; |
917 | - $this->session->set_userdata('advance_search', 0); |
|
918 | - $data['grid_fields'] = $this->user_form->build_user_charge_history(); |
|
919 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_charge_history_search()); |
|
920 | - $this->load->view('view_user_charges_list', $data); |
|
921 | - } |
|
922 | - |
|
923 | - function user_charges_history_json() { |
|
924 | - $json_data = array(); |
|
925 | - $count_all = $this->user_model->get_user_charge_history(false); |
|
926 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
927 | - $json_data = $paging_data["json_paging"]; |
|
928 | - $query = $this->user_model->get_user_charge_history(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
917 | + $this->session->set_userdata('advance_search', 0); |
|
918 | + $data['grid_fields'] = $this->user_form->build_user_charge_history(); |
|
919 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_charge_history_search()); |
|
920 | + $this->load->view('view_user_charges_list', $data); |
|
921 | + } |
|
922 | + |
|
923 | + function user_charges_history_json() { |
|
924 | + $json_data = array(); |
|
925 | + $count_all = $this->user_model->get_user_charge_history(false); |
|
926 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
927 | + $json_data = $paging_data["json_paging"]; |
|
928 | + $query = $this->user_model->get_user_charge_history(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
929 | 929 | |
930 | 930 | $result= $query->result_array(); |
931 | - $query1 = $this->user_model->get_user_charge_history(true,'',''); |
|
931 | + $query1 = $this->user_model->get_user_charge_history(true,'',''); |
|
932 | 932 | $res= $query1->result_array(); |
933 | 933 | $debit=0; |
934 | 934 | $credit=0; |
935 | 935 | $before_balance=0; |
936 | 936 | $after_balance=0; |
937 | 937 | $i=0; |
938 | - foreach ($result as $key => $value) { |
|
939 | - $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
940 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
941 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
942 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
938 | + foreach ($result as $key => $value) { |
|
939 | + $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
940 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
941 | + $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
942 | + $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
943 | 943 | $invoice_num=$invoice_prefix.$invoiceid; |
944 | 944 | $account=$this->common->get_field_name_coma_new('first_name,last_name,number','accounts',$value['accountid']); |
945 | 945 | $reseller=$this->common->reseller_select_value('first_name,last_name,number','accounts',$value['reseller_id']); |
@@ -955,17 +955,17 @@ discard block |
||
955 | 955 | $debit=$this->common->convert_to_currency('','',$value['debit']); |
956 | 956 | } |
957 | 957 | $credit=$this->common->convert_to_currency('','',$value['credit']); |
958 | - if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
958 | + if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
959 | 959 | $credit = '(-) '.$credit; |
960 | - } |
|
960 | + } |
|
961 | 961 | if($value['after_balance'] == '-'){ |
962 | 962 | $after_balance='-'; |
963 | 963 | }else{ |
964 | 964 | $after_balance=$this->common->convert_to_currency('','',$value['after_balance']); |
965 | 965 | } |
966 | 966 | $description=$value['description']; |
967 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
968 | - $json_data['rows'][] = array('cell' => array( |
|
967 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
968 | + $json_data['rows'][] = array('cell' => array( |
|
969 | 969 | $date, |
970 | 970 | $invoice_num, |
971 | 971 | $item_type, |
@@ -974,1005 +974,1005 @@ discard block |
||
974 | 974 | $credit, |
975 | 975 | $after_balance, |
976 | 976 | $description, |
977 | - )); |
|
977 | + )); |
|
978 | 978 | |
979 | - } |
|
979 | + } |
|
980 | 980 | $debit_sum = 0; |
981 | 981 | $credit_sum = 0; |
982 | 982 | foreach($res as $value){ |
983 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
984 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
983 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
984 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
985 | 985 | $debit_sum += $value['debit']; |
986 | 986 | $credit_sum += $value['credit']; |
987 | 987 | $before_balance += $value['before_balance']; |
988 | 988 | $after_balance += $value['after_balance']; |
989 | 989 | } |
990 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
991 | - echo json_encode($json_data); |
|
992 | - |
|
993 | - |
|
994 | - } |
|
995 | - function user_charges_history_search() { |
|
996 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
997 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
998 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
999 | - $action = $this->input->post(); |
|
1000 | - unset($action['action']); |
|
1001 | - unset($action['advance_search']); |
|
1002 | - $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0] . " 00:00:00" : ''; |
|
1003 | - $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1] . " 23:59:59" : ''; |
|
1004 | - if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1005 | - $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1006 | - } |
|
1007 | - if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
1008 | - $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
1009 | - } |
|
1010 | - $this->session->set_userdata('user_charge_history_search', $action); |
|
1011 | - } |
|
1012 | - if (@$ajax_search != 1) { |
|
1013 | - redirect(base_url() . 'user/user_charges_history/'); |
|
1014 | - } |
|
1015 | - } |
|
1016 | - |
|
1017 | - function user_charges_history_clearsearchfilter() { |
|
1018 | - $this->session->set_userdata('advance_search', 0); |
|
1019 | - $this->session->set_userdata('user_charge_history_search', ""); |
|
1020 | - } |
|
1021 | - function user_subscriptions() { |
|
990 | + $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
991 | + echo json_encode($json_data); |
|
992 | + |
|
993 | + |
|
994 | + } |
|
995 | + function user_charges_history_search() { |
|
996 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
997 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
998 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
999 | + $action = $this->input->post(); |
|
1000 | + unset($action['action']); |
|
1001 | + unset($action['advance_search']); |
|
1002 | + $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0] . " 00:00:00" : ''; |
|
1003 | + $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1] . " 23:59:59" : ''; |
|
1004 | + if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1005 | + $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1006 | + } |
|
1007 | + if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
1008 | + $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
1009 | + } |
|
1010 | + $this->session->set_userdata('user_charge_history_search', $action); |
|
1011 | + } |
|
1012 | + if (@$ajax_search != 1) { |
|
1013 | + redirect(base_url() . 'user/user_charges_history/'); |
|
1014 | + } |
|
1015 | + } |
|
1016 | + |
|
1017 | + function user_charges_history_clearsearchfilter() { |
|
1018 | + $this->session->set_userdata('advance_search', 0); |
|
1019 | + $this->session->set_userdata('user_charge_history_search', ""); |
|
1020 | + } |
|
1021 | + function user_subscriptions() { |
|
1022 | 1022 | $data['page_title'] = 'Subscriptions'; |
1023 | - $this->session->set_userdata('advance_search', 0); |
|
1024 | - $data['grid_fields'] = $this->user_form->build_user_subscription(); |
|
1025 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_subscription_search()); |
|
1026 | - $this->load->view('view_user_subscriptions_list', $data); |
|
1027 | - } |
|
1023 | + $this->session->set_userdata('advance_search', 0); |
|
1024 | + $data['grid_fields'] = $this->user_form->build_user_subscription(); |
|
1025 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_subscription_search()); |
|
1026 | + $this->load->view('view_user_subscriptions_list', $data); |
|
1027 | + } |
|
1028 | 1028 | |
1029 | - function user_subscriptions_json() { |
|
1029 | + function user_subscriptions_json() { |
|
1030 | 1030 | |
1031 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1032 | - $json_data = array(); |
|
1033 | - $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id"; |
|
1034 | - $table = "charges"; |
|
1035 | - $jionTable = array('charge_to_account', 'accounts'); |
|
1036 | - $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.id = charge_to_account.accountid'); |
|
1037 | - $type = array('left', 'inner'); |
|
1038 | - $where = array('accounts.id' => $accountinfo['id']); |
|
1039 | - $order_type = 'charges.id'; |
|
1040 | - $order_by = "ASC"; |
|
1041 | - $this->db_model->build_search("user_subscription_search"); |
|
1042 | - $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
|
1043 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1044 | - $json_data = $paging_data["json_paging"]; |
|
1045 | - $this->db_model->build_search("user_subscription_search"); |
|
1031 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1032 | + $json_data = array(); |
|
1033 | + $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id"; |
|
1034 | + $table = "charges"; |
|
1035 | + $jionTable = array('charge_to_account', 'accounts'); |
|
1036 | + $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.id = charge_to_account.accountid'); |
|
1037 | + $type = array('left', 'inner'); |
|
1038 | + $where = array('accounts.id' => $accountinfo['id']); |
|
1039 | + $order_type = 'charges.id'; |
|
1040 | + $order_by = "ASC"; |
|
1041 | + $this->db_model->build_search("user_subscription_search"); |
|
1042 | + $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
|
1043 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1044 | + $json_data = $paging_data["json_paging"]; |
|
1045 | + $this->db_model->build_search("user_subscription_search"); |
|
1046 | 1046 | |
1047 | - $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, ""); |
|
1048 | - $grid_fields = json_decode($this->user_form->build_user_subscription()); |
|
1049 | - $json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields); |
|
1050 | - echo json_encode($json_data); |
|
1051 | - } |
|
1052 | - function user_subscriptions_search() { |
|
1053 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1054 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1055 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1056 | - $action = $this->input->post(); |
|
1057 | - unset($action['action']); |
|
1058 | - unset($action['advance_search']); |
|
1059 | - if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') { |
|
1060 | - $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false); |
|
1061 | - } |
|
1062 | - if(isset($action['sweep_id']) && $action['sweep_id'] != ''){ |
|
1063 | - $action['charges.sweep_id']=$action['sweep_id']; |
|
1064 | - unset($action['sweep_id']); |
|
1065 | - } |
|
1066 | - $this->session->set_userdata('user_subscription_search', $action); |
|
1067 | - } |
|
1068 | - if (@$ajax_search != 1) { |
|
1069 | - redirect(base_url() . 'user/user_subscriptions/'); |
|
1070 | - } |
|
1071 | - } |
|
1072 | - |
|
1073 | - function user_subscriptions_clearsearchfilter() { |
|
1074 | - $this->session->set_userdata('advance_search', 0); |
|
1075 | - $this->session->set_userdata('user_subscription_search', ""); |
|
1076 | - } |
|
1077 | - |
|
1078 | - function user_didlist() { |
|
1079 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1080 | - $data['page_title'] = 'Purchase DIDs'; |
|
1081 | - $data['search_flag'] = true; |
|
1082 | - $data['grid_fields'] = $this->user_form->build_user_didlist(); |
|
1083 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_didlist_search()); |
|
1084 | - $data["grid_buttons"] = array(); |
|
1085 | - $acc_data = $this->session->userdata("accountinfo"); |
|
1086 | - $data['accountid'] = $acc_data['id']; |
|
1087 | - $data['country_id']=$acc_data['country_id']; |
|
1088 | - $result_did_final = array(); |
|
1089 | - if($accountinfo['reseller_id'] > 0){ |
|
1047 | + $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, ""); |
|
1048 | + $grid_fields = json_decode($this->user_form->build_user_subscription()); |
|
1049 | + $json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields); |
|
1050 | + echo json_encode($json_data); |
|
1051 | + } |
|
1052 | + function user_subscriptions_search() { |
|
1053 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1054 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1055 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1056 | + $action = $this->input->post(); |
|
1057 | + unset($action['action']); |
|
1058 | + unset($action['advance_search']); |
|
1059 | + if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') { |
|
1060 | + $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false); |
|
1061 | + } |
|
1062 | + if(isset($action['sweep_id']) && $action['sweep_id'] != ''){ |
|
1063 | + $action['charges.sweep_id']=$action['sweep_id']; |
|
1064 | + unset($action['sweep_id']); |
|
1065 | + } |
|
1066 | + $this->session->set_userdata('user_subscription_search', $action); |
|
1067 | + } |
|
1068 | + if (@$ajax_search != 1) { |
|
1069 | + redirect(base_url() . 'user/user_subscriptions/'); |
|
1070 | + } |
|
1071 | + } |
|
1072 | + |
|
1073 | + function user_subscriptions_clearsearchfilter() { |
|
1074 | + $this->session->set_userdata('advance_search', 0); |
|
1075 | + $this->session->set_userdata('user_subscription_search', ""); |
|
1076 | + } |
|
1077 | + |
|
1078 | + function user_didlist() { |
|
1079 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1080 | + $data['page_title'] = 'Purchase DIDs'; |
|
1081 | + $data['search_flag'] = true; |
|
1082 | + $data['grid_fields'] = $this->user_form->build_user_didlist(); |
|
1083 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_didlist_search()); |
|
1084 | + $data["grid_buttons"] = array(); |
|
1085 | + $acc_data = $this->session->userdata("accountinfo"); |
|
1086 | + $data['accountid'] = $acc_data['id']; |
|
1087 | + $data['country_id']=$acc_data['country_id']; |
|
1088 | + $result_did_final = array(); |
|
1089 | + if($accountinfo['reseller_id'] > 0){ |
|
1090 | 1090 | $this->db->select('dids.id, dids.number, reseller_pricing.setup, reseller_pricing.monthlycost'); |
1091 | 1091 | $this->db->where('dids.accountid',0); |
1092 | 1092 | $this->db->where('reseller_pricing.note','dids.number',false); |
1093 | 1093 | $this->db->where('reseller_pricing.reseller_id',$accountinfo['reseller_id']); |
1094 | 1094 | $this->db->from('dids,reseller_pricing'); |
1095 | - }else{ |
|
1095 | + }else{ |
|
1096 | 1096 | $this->db->where('parent_id',0); |
1097 | 1097 | $this->db->where('accountid',0); |
1098 | 1098 | $this->db->select('id,number,setup,monthlycost'); |
1099 | 1099 | $this->db->from('dids'); |
1100 | - } |
|
1101 | - $dids_array=(array)$this->db->get()->result_array(); |
|
1102 | - $drp_list=array(); |
|
1103 | - if(!empty($dids_array)){ |
|
1100 | + } |
|
1101 | + $dids_array=(array)$this->db->get()->result_array(); |
|
1102 | + $drp_list=array(); |
|
1103 | + if(!empty($dids_array)){ |
|
1104 | 1104 | foreach ($dids_array as $drp_value) { |
1105 | - if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
1106 | - $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'],'','',true,true); |
|
1107 | - } else { |
|
1105 | + if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
1106 | + $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'],'','',true,true); |
|
1107 | + } else { |
|
1108 | 1108 | $did_cost = 0; |
1109 | - } |
|
1110 | - if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
1109 | + } |
|
1110 | + if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
1111 | 1111 | $did_setup = $this->common_model->to_calculate_currency($drp_value['setup'],'','',true,true); |
1112 | - } else { |
|
1112 | + } else { |
|
1113 | 1113 | $did_setup = 0; |
1114 | - } |
|
1115 | - $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
1114 | + } |
|
1115 | + $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
1116 | 1116 | } |
1117 | - } |
|
1118 | - $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist","id"=>"free_didlist","class"=>"did_dropdown"), $drp_list, ''); |
|
1119 | - $this->load->view('view_user_did_list', $data); |
|
1120 | - } |
|
1121 | - |
|
1122 | - function user_didlist_json() { |
|
1123 | - $account_data = $this->session->userdata("accountinfo"); |
|
1124 | - if ($account_data['reseller_id'] != 0) { |
|
1125 | - $json_data = array(); |
|
1126 | - $where = array('dids.accountid' => $account_data['id']); |
|
1127 | - $jionCondition = 'dids.number = reseller_pricing.note AND dids.parent_id = reseller_pricing.reseller_id'; |
|
1128 | - $count_all = $this->db_model->getJionQueryCount("dids", '*', $where, "reseller_pricing", $jionCondition, 'inner'); |
|
1129 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1130 | - $json_data = $paging_data["json_paging"]; |
|
1131 | - $this->db_model->build_search('user_did_search'); |
|
1132 | - $query = $this->db_model->getJionQuery("dids", 'reseller_pricing.setup,reseller_pricing.cost,reseller_pricing.last_modified_date,reseller_pricing.connectcost,reseller_pricing.inc,reseller_pricing.init_inc,reseller_pricing.includedseconds,reseller_pricing.monthlycost,dids.number,dids.id,dids.accountid,dids.extensions,dids.status,dids.provider_id,dids.allocation_bill_status,reseller_pricing.disconnectionfee,dids.dial_as,dids.call_type,dids.country_id', $where, "reseller_pricing", $jionCondition, 'inner', $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], "dids.id", "", ''); |
|
1133 | - } else { |
|
1134 | - $json_data = array(); |
|
1135 | - $where = array('accountid' => $account_data['id']); |
|
1136 | - $this->db_model->build_search('user_did_search'); |
|
1137 | - $count_all = $this->db_model->countQuery("*", "dids", $where); |
|
1138 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1139 | - $json_data = $paging_data["json_paging"]; |
|
1140 | - $this->db_model->build_search('user_did_search'); |
|
1141 | - $query = $this->db_model->getSelect("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1142 | - } |
|
1143 | - $did_grid_fields = json_decode($this->user_form->build_user_didlist()); |
|
1144 | - $json_data['rows'] = $this->form->build_grid($query, $did_grid_fields); |
|
1145 | - echo json_encode($json_data); |
|
1146 | - } |
|
1147 | - |
|
1148 | - function user_did_country() { |
|
1149 | - $this->load->module('accounts/accounts'); |
|
1150 | - $this->accounts->customer_did_country(); |
|
1151 | - } |
|
1152 | - |
|
1153 | - function user_didlist_search() { |
|
1154 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1155 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1156 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1157 | - $action = $this->input->post(); |
|
1158 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1159 | - if($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0){ |
|
1160 | - $action['dids.call_type']=$action['call_type']; |
|
1161 | - unset($action['call_type']); |
|
1162 | - } |
|
1163 | - unset($action['action']); |
|
1164 | - unset($action['advance_search']); |
|
1165 | - $this->session->set_userdata('user_did_search', $action); |
|
1166 | - } |
|
1167 | - if (@$ajax_search != 1) { |
|
1168 | - redirect(base_url() . 'user/user_didlist/'); |
|
1169 | - } |
|
1170 | - } |
|
1171 | - |
|
1172 | - function user_didlist_clearsearchfilter() { |
|
1173 | - $this->session->set_userdata('advance_search', 0); |
|
1174 | - $this->session->set_userdata('user_did_search', ""); |
|
1175 | - } |
|
1117 | + } |
|
1118 | + $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist","id"=>"free_didlist","class"=>"did_dropdown"), $drp_list, ''); |
|
1119 | + $this->load->view('view_user_did_list', $data); |
|
1120 | + } |
|
1121 | + |
|
1122 | + function user_didlist_json() { |
|
1123 | + $account_data = $this->session->userdata("accountinfo"); |
|
1124 | + if ($account_data['reseller_id'] != 0) { |
|
1125 | + $json_data = array(); |
|
1126 | + $where = array('dids.accountid' => $account_data['id']); |
|
1127 | + $jionCondition = 'dids.number = reseller_pricing.note AND dids.parent_id = reseller_pricing.reseller_id'; |
|
1128 | + $count_all = $this->db_model->getJionQueryCount("dids", '*', $where, "reseller_pricing", $jionCondition, 'inner'); |
|
1129 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1130 | + $json_data = $paging_data["json_paging"]; |
|
1131 | + $this->db_model->build_search('user_did_search'); |
|
1132 | + $query = $this->db_model->getJionQuery("dids", 'reseller_pricing.setup,reseller_pricing.cost,reseller_pricing.last_modified_date,reseller_pricing.connectcost,reseller_pricing.inc,reseller_pricing.init_inc,reseller_pricing.includedseconds,reseller_pricing.monthlycost,dids.number,dids.id,dids.accountid,dids.extensions,dids.status,dids.provider_id,dids.allocation_bill_status,reseller_pricing.disconnectionfee,dids.dial_as,dids.call_type,dids.country_id', $where, "reseller_pricing", $jionCondition, 'inner', $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], "dids.id", "", ''); |
|
1133 | + } else { |
|
1134 | + $json_data = array(); |
|
1135 | + $where = array('accountid' => $account_data['id']); |
|
1136 | + $this->db_model->build_search('user_did_search'); |
|
1137 | + $count_all = $this->db_model->countQuery("*", "dids", $where); |
|
1138 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1139 | + $json_data = $paging_data["json_paging"]; |
|
1140 | + $this->db_model->build_search('user_did_search'); |
|
1141 | + $query = $this->db_model->getSelect("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1142 | + } |
|
1143 | + $did_grid_fields = json_decode($this->user_form->build_user_didlist()); |
|
1144 | + $json_data['rows'] = $this->form->build_grid($query, $did_grid_fields); |
|
1145 | + echo json_encode($json_data); |
|
1146 | + } |
|
1147 | + |
|
1148 | + function user_did_country() { |
|
1149 | + $this->load->module('accounts/accounts'); |
|
1150 | + $this->accounts->customer_did_country(); |
|
1151 | + } |
|
1152 | + |
|
1153 | + function user_didlist_search() { |
|
1154 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1155 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1156 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1157 | + $action = $this->input->post(); |
|
1158 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1159 | + if($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0){ |
|
1160 | + $action['dids.call_type']=$action['call_type']; |
|
1161 | + unset($action['call_type']); |
|
1162 | + } |
|
1163 | + unset($action['action']); |
|
1164 | + unset($action['advance_search']); |
|
1165 | + $this->session->set_userdata('user_did_search', $action); |
|
1166 | + } |
|
1167 | + if (@$ajax_search != 1) { |
|
1168 | + redirect(base_url() . 'user/user_didlist/'); |
|
1169 | + } |
|
1170 | + } |
|
1171 | + |
|
1172 | + function user_didlist_clearsearchfilter() { |
|
1173 | + $this->session->set_userdata('advance_search', 0); |
|
1174 | + $this->session->set_userdata('user_did_search', ""); |
|
1175 | + } |
|
1176 | 1176 | |
1177 | - function user_ipmap(){ |
|
1178 | - $this->session->set_userdata('advance_search', 0); |
|
1179 | - $data['grid_fields'] = $this->user_form->build_user_ipmap(); |
|
1180 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_ipmap_search()); |
|
1181 | - $this->load->view('view_user_ipmap_list', $data); |
|
1182 | - } |
|
1177 | + function user_ipmap(){ |
|
1178 | + $this->session->set_userdata('advance_search', 0); |
|
1179 | + $data['grid_fields'] = $this->user_form->build_user_ipmap(); |
|
1180 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_ipmap_search()); |
|
1181 | + $this->load->view('view_user_ipmap_list', $data); |
|
1182 | + } |
|
1183 | 1183 | |
1184 | - function user_ipmap_json(){ |
|
1185 | - $json_data = array(); |
|
1186 | - $account_data = $this->session->userdata("accountinfo"); |
|
1187 | - $count_all = $this->user_model->user_ipmap_list(false); |
|
1188 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1189 | - $json_data = $paging_data["json_paging"]; |
|
1190 | - $query = $this->user_model->user_ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1191 | - $ipmap_grid_fields = json_decode($this->user_form->build_user_ipmap()); |
|
1192 | - $json_data['rows'] = $this->form->build_grid($query, $ipmap_grid_fields); |
|
1193 | - echo json_encode($json_data); |
|
1194 | - } |
|
1195 | - |
|
1196 | - function user_ipmap_search(){ |
|
1197 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1198 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1199 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1200 | - $action = $this->input->post(); |
|
1201 | - unset($action['action']); |
|
1202 | - unset($action['advance_search']); |
|
1203 | - $this->session->set_userdata('user_ipmap_search', $action); |
|
1204 | - } |
|
1205 | - if (@$ajax_search != 1) { |
|
1206 | - redirect(base_url() . 'user/user_ipmap/'); |
|
1207 | - } |
|
1208 | - } |
|
1184 | + function user_ipmap_json(){ |
|
1185 | + $json_data = array(); |
|
1186 | + $account_data = $this->session->userdata("accountinfo"); |
|
1187 | + $count_all = $this->user_model->user_ipmap_list(false); |
|
1188 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1189 | + $json_data = $paging_data["json_paging"]; |
|
1190 | + $query = $this->user_model->user_ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1191 | + $ipmap_grid_fields = json_decode($this->user_form->build_user_ipmap()); |
|
1192 | + $json_data['rows'] = $this->form->build_grid($query, $ipmap_grid_fields); |
|
1193 | + echo json_encode($json_data); |
|
1194 | + } |
|
1195 | + |
|
1196 | + function user_ipmap_search(){ |
|
1197 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1198 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1199 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1200 | + $action = $this->input->post(); |
|
1201 | + unset($action['action']); |
|
1202 | + unset($action['advance_search']); |
|
1203 | + $this->session->set_userdata('user_ipmap_search', $action); |
|
1204 | + } |
|
1205 | + if (@$ajax_search != 1) { |
|
1206 | + redirect(base_url() . 'user/user_ipmap/'); |
|
1207 | + } |
|
1208 | + } |
|
1209 | 1209 | |
1210 | - function user_ipmap_clearsearchfilter(){ |
|
1211 | - $this->session->set_userdata('advance_search', 0); |
|
1212 | - $this->session->set_userdata('user_ipmap_search', ""); |
|
1213 | - } |
|
1210 | + function user_ipmap_clearsearchfilter(){ |
|
1211 | + $this->session->set_userdata('advance_search', 0); |
|
1212 | + $this->session->set_userdata('user_ipmap_search', ""); |
|
1213 | + } |
|
1214 | 1214 | |
1215 | - function user_ipmap_action($action='delete',$id=false){ |
|
1216 | - $add_array=$this->input->post(); |
|
1217 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1218 | - if($action == 'add'){ |
|
1219 | - $ip = $add_array['ip']; |
|
1220 | - if (strpos($ip, '/') !== false) { |
|
1221 | - $add_array['ip'] = $add_array['ip']; |
|
1222 | - } else { |
|
1223 | - $add_array['ip'] = $add_array['ip'] . '/32'; |
|
1224 | - } |
|
1225 | - $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
|
1226 | - $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
|
1227 | - if ($getdata > 0) { |
|
1228 | - $this->session->set_flashdata('astpp_notification', 'IP already exist in system.'); |
|
1229 | - } else { |
|
1230 | - unset($add_array['action']); |
|
1231 | - $add_array['context'] = 'default'; |
|
1232 | - $add_array['accountid'] = $accountinfo['id']; |
|
1233 | - $ip_flag = $this->db->insert("ip_map", $add_array); |
|
1234 | - if ($ip_flag) { |
|
1235 | - $this->load->library('freeswitch_lib'); |
|
1236 | - $this->load->module('freeswitch/freeswitch'); |
|
1237 | - $command = "api reloadacl"; |
|
1238 | - $response = $this->freeswitch_model->reload_freeswitch($command); |
|
1239 | - $this->session->set_userdata('astpp_notification', $response); |
|
1240 | - } |
|
1241 | - $this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.'); |
|
1242 | - } |
|
1243 | - } |
|
1244 | - if($action =='delete'){ |
|
1245 | - $this->db->delete('ip_map',array('id'=>$id)); |
|
1246 | - $this->session->set_flashdata('astpp_notification', 'IP Removed Sucessfully.'); |
|
1247 | - } |
|
1248 | - redirect(base_url()."user/user_ipmap/"); |
|
1249 | - } |
|
1215 | + function user_ipmap_action($action='delete',$id=false){ |
|
1216 | + $add_array=$this->input->post(); |
|
1217 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1218 | + if($action == 'add'){ |
|
1219 | + $ip = $add_array['ip']; |
|
1220 | + if (strpos($ip, '/') !== false) { |
|
1221 | + $add_array['ip'] = $add_array['ip']; |
|
1222 | + } else { |
|
1223 | + $add_array['ip'] = $add_array['ip'] . '/32'; |
|
1224 | + } |
|
1225 | + $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
|
1226 | + $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
|
1227 | + if ($getdata > 0) { |
|
1228 | + $this->session->set_flashdata('astpp_notification', 'IP already exist in system.'); |
|
1229 | + } else { |
|
1230 | + unset($add_array['action']); |
|
1231 | + $add_array['context'] = 'default'; |
|
1232 | + $add_array['accountid'] = $accountinfo['id']; |
|
1233 | + $ip_flag = $this->db->insert("ip_map", $add_array); |
|
1234 | + if ($ip_flag) { |
|
1235 | + $this->load->library('freeswitch_lib'); |
|
1236 | + $this->load->module('freeswitch/freeswitch'); |
|
1237 | + $command = "api reloadacl"; |
|
1238 | + $response = $this->freeswitch_model->reload_freeswitch($command); |
|
1239 | + $this->session->set_userdata('astpp_notification', $response); |
|
1240 | + } |
|
1241 | + $this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.'); |
|
1242 | + } |
|
1243 | + } |
|
1244 | + if($action =='delete'){ |
|
1245 | + $this->db->delete('ip_map',array('id'=>$id)); |
|
1246 | + $this->session->set_flashdata('astpp_notification', 'IP Removed Sucessfully.'); |
|
1247 | + } |
|
1248 | + redirect(base_url()."user/user_ipmap/"); |
|
1249 | + } |
|
1250 | 1250 | |
1251 | - function user_sipdevices() { |
|
1251 | + function user_sipdevices() { |
|
1252 | 1252 | $data['page_title'] = 'SIP Devices'; |
1253 | - $this->session->set_userdata('advance_search', 0); |
|
1254 | - $data['grid_fields'] = $this->user_form->build_user_sipdevices(); |
|
1255 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_sipdevices_search()); |
|
1256 | - $this->load->view('view_user_sipdevices_list', $data); |
|
1257 | - } |
|
1258 | - |
|
1259 | - function user_sipdevices_json() { |
|
1260 | - $account_data = $this->session->userdata("accountinfo"); |
|
1261 | - $json_data = array(); |
|
1262 | - $count_all = $this->user_model->user_sipdevices_list(false, $account_data['id']); |
|
1263 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1264 | - $json_data = $paging_data["json_paging"]; |
|
1265 | - $devices_result = array(); |
|
1266 | - $query = $this->user_model->user_sipdevices_list(true,$account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1267 | - foreach ($query as $key => $value) { |
|
1253 | + $this->session->set_userdata('advance_search', 0); |
|
1254 | + $data['grid_fields'] = $this->user_form->build_user_sipdevices(); |
|
1255 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_sipdevices_search()); |
|
1256 | + $this->load->view('view_user_sipdevices_list', $data); |
|
1257 | + } |
|
1258 | + |
|
1259 | + function user_sipdevices_json() { |
|
1260 | + $account_data = $this->session->userdata("accountinfo"); |
|
1261 | + $json_data = array(); |
|
1262 | + $count_all = $this->user_model->user_sipdevices_list(false, $account_data['id']); |
|
1263 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1264 | + $json_data = $paging_data["json_paging"]; |
|
1265 | + $devices_result = array(); |
|
1266 | + $query = $this->user_model->user_sipdevices_list(true,$account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1267 | + foreach ($query as $key => $value) { |
|
1268 | 1268 | $path_true = base_url().'/assets/images/true.png'; |
1269 | 1269 | $path_false = base_url().'/assets/images/false.png'; |
1270 | 1270 | $voicemail_enabled = $value['voicemail_enabled'] == 'true'? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">'; |
1271 | - $json_data['rows'][] = array('cell' => array( |
|
1272 | - '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
1273 | - $value['username'], |
|
1274 | - $value['password'], |
|
1275 | - $value['effective_caller_id_name'], |
|
1276 | - $value['effective_caller_id_number'], |
|
1277 | - $this->common->get_status('status', 'sip_devices',$value), |
|
1278 | - $this->common->convert_GMT_to('','',$value['creation_date']), |
|
1279 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
1280 | - $voicemail_enabled, |
|
1281 | - '<a href="'. base_url() .'user/user_sipdevices_edit/' . $value['id'] . '/" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '. |
|
1282 | - '<a href="'. base_url() .'user/user_sipdevices_delete/' .$value['id']. '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>' |
|
1283 | - )); |
|
1284 | - } |
|
1285 | - echo json_encode($json_data); |
|
1286 | - } |
|
1287 | - function user_sipdevices_search() { |
|
1288 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1289 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1290 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1291 | - $action = $this->input->post(); |
|
1292 | - unset($action['action']); |
|
1293 | - unset($action['advance_search']); |
|
1294 | - $this->session->set_userdata('user_sipdevices_search', $action); |
|
1295 | - } |
|
1296 | - if (@$ajax_search != 1) { |
|
1297 | - redirect(base_url() . 'user/user_sipdevices/'); |
|
1298 | - } |
|
1299 | - } |
|
1271 | + $json_data['rows'][] = array('cell' => array( |
|
1272 | + '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
1273 | + $value['username'], |
|
1274 | + $value['password'], |
|
1275 | + $value['effective_caller_id_name'], |
|
1276 | + $value['effective_caller_id_number'], |
|
1277 | + $this->common->get_status('status', 'sip_devices',$value), |
|
1278 | + $this->common->convert_GMT_to('','',$value['creation_date']), |
|
1279 | + $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
1280 | + $voicemail_enabled, |
|
1281 | + '<a href="'. base_url() .'user/user_sipdevices_edit/' . $value['id'] . '/" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '. |
|
1282 | + '<a href="'. base_url() .'user/user_sipdevices_delete/' .$value['id']. '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>' |
|
1283 | + )); |
|
1284 | + } |
|
1285 | + echo json_encode($json_data); |
|
1286 | + } |
|
1287 | + function user_sipdevices_search() { |
|
1288 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1289 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1290 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1291 | + $action = $this->input->post(); |
|
1292 | + unset($action['action']); |
|
1293 | + unset($action['advance_search']); |
|
1294 | + $this->session->set_userdata('user_sipdevices_search', $action); |
|
1295 | + } |
|
1296 | + if (@$ajax_search != 1) { |
|
1297 | + redirect(base_url() . 'user/user_sipdevices/'); |
|
1298 | + } |
|
1299 | + } |
|
1300 | 1300 | |
1301 | - function user_sipdevices_clearsearchfilter() { |
|
1302 | - $this->session->set_userdata('advance_search', 0); |
|
1303 | - $this->session->set_userdata('user_sipdevices_search', ""); |
|
1304 | - } |
|
1301 | + function user_sipdevices_clearsearchfilter() { |
|
1302 | + $this->session->set_userdata('advance_search', 0); |
|
1303 | + $this->session->set_userdata('user_sipdevices_search', ""); |
|
1304 | + } |
|
1305 | 1305 | |
1306 | - function user_sipdevices_add(){ |
|
1307 | - $data['page_title'] = 'Create SIP Device'; |
|
1308 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(),""); |
|
1309 | - $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1310 | - } |
|
1311 | - function user_sipdevices_edit($edit_id=''){ |
|
1312 | - $account_data = $this->session->userdata("accountinfo"); |
|
1313 | - $data['page_title'] = 'Edit SIP Device'; |
|
1314 | - $where = array('id' => $edit_id); |
|
1315 | - $sipdevice_info = $this->user_model->user_sipdevice_info($edit_id); |
|
1316 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($edit_id), $sipdevice_info); |
|
1317 | - $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1318 | - } |
|
1319 | - function user_sipdevices_save(){ |
|
1320 | - $add_array = $this->input->post(); |
|
1321 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($add_array['id']), $add_array); |
|
1322 | - if ($add_array['id'] != '') { |
|
1323 | - $data['page_title'] = 'Edit SIP Devices'; |
|
1324 | - if ($this->form_validation->run() == FALSE) { |
|
1325 | - $data['validation_errors'] = validation_errors(); |
|
1326 | - echo $data['validation_errors']; |
|
1327 | - exit; |
|
1328 | - } else { |
|
1329 | - $this->user_model->user_sipdevice_edit($add_array, $add_array['id']); |
|
1330 | - echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
1331 | - exit; |
|
1332 | - } |
|
1333 | - } else { |
|
1334 | - $data['page_title'] = 'Create SIP Device'; |
|
1335 | - if ($this->form_validation->run() == FALSE) { |
|
1336 | - $data['validation_errors'] = validation_errors(); |
|
1337 | - echo $data['validation_errors']; |
|
1338 | - exit; |
|
1339 | - } else { |
|
1340 | - $this->user_model->user_sipdevice_add($add_array); |
|
1341 | - echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
1342 | - exit; |
|
1343 | - } |
|
1344 | - } |
|
1345 | - } |
|
1346 | - function user_sipdevices_delete($id) { |
|
1347 | - $this->db->delete('sip_devices',array('id'=>$id)); |
|
1348 | - $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Sucessfully!'); |
|
1349 | - redirect(base_url() . "user/user_sipdevices/"); |
|
1350 | - } |
|
1306 | + function user_sipdevices_add(){ |
|
1307 | + $data['page_title'] = 'Create SIP Device'; |
|
1308 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(),""); |
|
1309 | + $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1310 | + } |
|
1311 | + function user_sipdevices_edit($edit_id=''){ |
|
1312 | + $account_data = $this->session->userdata("accountinfo"); |
|
1313 | + $data['page_title'] = 'Edit SIP Device'; |
|
1314 | + $where = array('id' => $edit_id); |
|
1315 | + $sipdevice_info = $this->user_model->user_sipdevice_info($edit_id); |
|
1316 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($edit_id), $sipdevice_info); |
|
1317 | + $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1318 | + } |
|
1319 | + function user_sipdevices_save(){ |
|
1320 | + $add_array = $this->input->post(); |
|
1321 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($add_array['id']), $add_array); |
|
1322 | + if ($add_array['id'] != '') { |
|
1323 | + $data['page_title'] = 'Edit SIP Devices'; |
|
1324 | + if ($this->form_validation->run() == FALSE) { |
|
1325 | + $data['validation_errors'] = validation_errors(); |
|
1326 | + echo $data['validation_errors']; |
|
1327 | + exit; |
|
1328 | + } else { |
|
1329 | + $this->user_model->user_sipdevice_edit($add_array, $add_array['id']); |
|
1330 | + echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
1331 | + exit; |
|
1332 | + } |
|
1333 | + } else { |
|
1334 | + $data['page_title'] = 'Create SIP Device'; |
|
1335 | + if ($this->form_validation->run() == FALSE) { |
|
1336 | + $data['validation_errors'] = validation_errors(); |
|
1337 | + echo $data['validation_errors']; |
|
1338 | + exit; |
|
1339 | + } else { |
|
1340 | + $this->user_model->user_sipdevice_add($add_array); |
|
1341 | + echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
1342 | + exit; |
|
1343 | + } |
|
1344 | + } |
|
1345 | + } |
|
1346 | + function user_sipdevices_delete($id) { |
|
1347 | + $this->db->delete('sip_devices',array('id'=>$id)); |
|
1348 | + $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Sucessfully!'); |
|
1349 | + redirect(base_url() . "user/user_sipdevices/"); |
|
1350 | + } |
|
1351 | 1351 | |
1352 | - function user_sipdevices_delete_multiple(){ |
|
1353 | - $ids = $this->input->post("selected_ids", true); |
|
1354 | - $where = "id IN ($ids)"; |
|
1355 | - $this->db->delete("sip_devices",$where); |
|
1356 | - echo TRUE; |
|
1357 | - } |
|
1352 | + function user_sipdevices_delete_multiple(){ |
|
1353 | + $ids = $this->input->post("selected_ids", true); |
|
1354 | + $where = "id IN ($ids)"; |
|
1355 | + $this->db->delete("sip_devices",$where); |
|
1356 | + echo TRUE; |
|
1357 | + } |
|
1358 | 1358 | |
1359 | - function user_animap_list() { |
|
1359 | + function user_animap_list() { |
|
1360 | 1360 | $data['page_title'] = 'Caller ID'; |
1361 | - $this->session->set_userdata('advance_search', 0); |
|
1362 | - $data['grid_fields'] = $this->user_form->build_user_animap(); |
|
1363 | - $this->load->view('view_user_animap', $data); |
|
1364 | - } |
|
1365 | - |
|
1366 | - function user_animap_list_json() { |
|
1367 | - $account_data = $this->session->userdata("accountinfo"); |
|
1368 | - $json_data = array(); |
|
1369 | - $where = array("accountid" => $account_data['id']); |
|
1370 | - $count_all = $this->db_model->countQuery("*", "ani_map", $where); |
|
1371 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1372 | - $json_data = $paging_data["json_paging"]; |
|
1373 | - $query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1374 | - $grid_fields = json_decode($this->user_form->build_user_animap()); |
|
1375 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1376 | - echo json_encode($json_data); |
|
1377 | - } |
|
1378 | - |
|
1379 | - function user_animap_action($action, $aniid = "") { |
|
1380 | - $add_array = $this->input->post(); |
|
1381 | - if ($action == "add" && $add_array['number'] != '') { |
|
1382 | - $this->db->where('number', $add_array['number']); |
|
1383 | - $this->db->select('count(id) as count'); |
|
1384 | - $cnt_result = $this->db->get('ani_map'); |
|
1385 | - $cnt_result = $cnt_result->result_array(); |
|
1386 | - $count = $cnt_result[0]['count']; |
|
1387 | - if ($count == 0) { |
|
1361 | + $this->session->set_userdata('advance_search', 0); |
|
1362 | + $data['grid_fields'] = $this->user_form->build_user_animap(); |
|
1363 | + $this->load->view('view_user_animap', $data); |
|
1364 | + } |
|
1365 | + |
|
1366 | + function user_animap_list_json() { |
|
1367 | + $account_data = $this->session->userdata("accountinfo"); |
|
1368 | + $json_data = array(); |
|
1369 | + $where = array("accountid" => $account_data['id']); |
|
1370 | + $count_all = $this->db_model->countQuery("*", "ani_map", $where); |
|
1371 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1372 | + $json_data = $paging_data["json_paging"]; |
|
1373 | + $query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1374 | + $grid_fields = json_decode($this->user_form->build_user_animap()); |
|
1375 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1376 | + echo json_encode($json_data); |
|
1377 | + } |
|
1378 | + |
|
1379 | + function user_animap_action($action, $aniid = "") { |
|
1380 | + $add_array = $this->input->post(); |
|
1381 | + if ($action == "add" && $add_array['number'] != '') { |
|
1382 | + $this->db->where('number', $add_array['number']); |
|
1383 | + $this->db->select('count(id) as count'); |
|
1384 | + $cnt_result = $this->db->get('ani_map'); |
|
1385 | + $cnt_result = $cnt_result->result_array(); |
|
1386 | + $count = $cnt_result[0]['count']; |
|
1387 | + if ($count == 0) { |
|
1388 | 1388 | if($add_array['number'] != ""){ |
1389 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1390 | - $insert_arr = array("number" => $add_array['number'], |
|
1391 | - "accountid" => $accountinfo['id'], |
|
1392 | - "context" => "default" |
|
1393 | - ); |
|
1394 | - $this->db->insert("ani_map", $insert_arr); |
|
1395 | - $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!'); |
|
1389 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1390 | + $insert_arr = array("number" => $add_array['number'], |
|
1391 | + "accountid" => $accountinfo['id'], |
|
1392 | + "context" => "default" |
|
1393 | + ); |
|
1394 | + $this->db->insert("ani_map", $insert_arr); |
|
1395 | + $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!'); |
|
1396 | 1396 | }else{ |
1397 | 1397 | $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.'); |
1398 | 1398 | } |
1399 | - } else { |
|
1400 | - $this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.'); |
|
1401 | - } |
|
1402 | - } |
|
1403 | - if ($action == "delete") { |
|
1404 | - $this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!'); |
|
1405 | - $this->db_model->delete("ani_map", array("id" => $aniid)); |
|
1399 | + } else { |
|
1400 | + $this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.'); |
|
1401 | + } |
|
1402 | + } |
|
1403 | + if ($action == "delete") { |
|
1404 | + $this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!'); |
|
1405 | + $this->db_model->delete("ani_map", array("id" => $aniid)); |
|
1406 | 1406 | |
1407 | - } |
|
1408 | - redirect(base_url() . "user/user_animap_list/"); |
|
1409 | - } |
|
1407 | + } |
|
1408 | + redirect(base_url() . "user/user_animap_list/"); |
|
1409 | + } |
|
1410 | 1410 | |
1411 | - function user_alert_threshold() { |
|
1412 | - $data['page_title'] = 'Alert Threshold'; |
|
1413 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1414 | - $add_array = $this->input->post(); |
|
1415 | - if (!empty($add_array)) { |
|
1416 | - unset($add_array['action'],$add_array['id']); |
|
1417 | - $this->user_model->edit_alert_threshold($add_array, $accountinfo['id']); |
|
1418 | - $this->session->set_flashdata('astpp_errormsg', 'Alert Threshold updated successfully!'); |
|
1419 | - redirect(base_url() . 'user/user_alert_threshold/'); |
|
1420 | - } else { |
|
1421 | - $where = array('id' => $accountinfo["id"]); |
|
1422 | - $account = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email", "accounts", $where); |
|
1423 | - $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(),(array)$account->first_row()); |
|
1424 | - $this->load->view('view_user_alert_threshold', $data); |
|
1425 | - } |
|
1426 | - } |
|
1411 | + function user_alert_threshold() { |
|
1412 | + $data['page_title'] = 'Alert Threshold'; |
|
1413 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1414 | + $add_array = $this->input->post(); |
|
1415 | + if (!empty($add_array)) { |
|
1416 | + unset($add_array['action'],$add_array['id']); |
|
1417 | + $this->user_model->edit_alert_threshold($add_array, $accountinfo['id']); |
|
1418 | + $this->session->set_flashdata('astpp_errormsg', 'Alert Threshold updated successfully!'); |
|
1419 | + redirect(base_url() . 'user/user_alert_threshold/'); |
|
1420 | + } else { |
|
1421 | + $where = array('id' => $accountinfo["id"]); |
|
1422 | + $account = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email", "accounts", $where); |
|
1423 | + $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(),(array)$account->first_row()); |
|
1424 | + $this->load->view('view_user_alert_threshold', $data); |
|
1425 | + } |
|
1426 | + } |
|
1427 | 1427 | |
1428 | - function user_cdrs_report() { |
|
1429 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1430 | - $data['page_title'] = 'CDRs'; |
|
1431 | - $data['search_flag'] = true; |
|
1432 | - $data["grid_buttons"] = $this->user_form->build_cdrs_report_buttons(); |
|
1433 | - $data['grid_fields'] = $this->user_form->build_cdrs_report($accountinfo['type']); |
|
1434 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_cdrs_report_search($accountinfo['type'])); |
|
1435 | - $this->load->view('view_user_cdrs_report', $data); |
|
1436 | - } |
|
1437 | - |
|
1438 | - function user_cdrs_report_json() { |
|
1439 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1440 | - $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1441 | - $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1442 | - $count_all = (array) $count_res->first_row(); |
|
1443 | - $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1444 | - $json_data = $paging_data["json_paging"]; |
|
1445 | - $query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1446 | - $grid_fields = json_decode($this->user_form->build_cdrs_report($accountinfo['type'])); |
|
1447 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1448 | - if ($count_all['count'] > 0) { |
|
1449 | - $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1450 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1451 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1452 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1453 | - $json_data['rows'][] = array("cell" => array( |
|
1454 | - "<b>Grand Total</b>", |
|
1455 | - "", |
|
1456 | - "", |
|
1457 | - "", |
|
1458 | - $duration, |
|
1459 | - "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1460 | - "", |
|
1461 | - "", |
|
1462 | - )); |
|
1463 | - } |
|
1464 | - echo json_encode($json_data); |
|
1465 | - } |
|
1466 | - |
|
1467 | - function user_cdrs_report_search() { |
|
1468 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1469 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1470 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1471 | - $action = $this->input->post(); |
|
1472 | - unset($action['action']); |
|
1473 | - unset($action['advance_search']); |
|
1474 | - if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1475 | - $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1476 | - } |
|
1477 | - $this->session->set_userdata('user_cdrs_report_search', $action); |
|
1478 | - } |
|
1479 | - if (@$ajax_search != 1) { |
|
1480 | - redirect(base_url() . 'user/user_cdrs_report/'); |
|
1481 | - } |
|
1482 | - } |
|
1483 | - |
|
1484 | - function user_cdrs_report_clearsearchfilter() { |
|
1485 | - $this->session->set_userdata('advance_search', 0); |
|
1486 | - $this->session->set_userdata('user_cdrs_report_search', ""); |
|
1487 | - } |
|
1488 | - |
|
1489 | - function user_cdrreport_export() { |
|
1428 | + function user_cdrs_report() { |
|
1429 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1430 | + $data['page_title'] = 'CDRs'; |
|
1431 | + $data['search_flag'] = true; |
|
1432 | + $data["grid_buttons"] = $this->user_form->build_cdrs_report_buttons(); |
|
1433 | + $data['grid_fields'] = $this->user_form->build_cdrs_report($accountinfo['type']); |
|
1434 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_cdrs_report_search($accountinfo['type'])); |
|
1435 | + $this->load->view('view_user_cdrs_report', $data); |
|
1436 | + } |
|
1437 | + |
|
1438 | + function user_cdrs_report_json() { |
|
1439 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1440 | + $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1441 | + $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1442 | + $count_all = (array) $count_res->first_row(); |
|
1443 | + $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1444 | + $json_data = $paging_data["json_paging"]; |
|
1445 | + $query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1446 | + $grid_fields = json_decode($this->user_form->build_cdrs_report($accountinfo['type'])); |
|
1447 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1448 | + if ($count_all['count'] > 0) { |
|
1449 | + $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1450 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1451 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1452 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1453 | + $json_data['rows'][] = array("cell" => array( |
|
1454 | + "<b>Grand Total</b>", |
|
1455 | + "", |
|
1456 | + "", |
|
1457 | + "", |
|
1458 | + $duration, |
|
1459 | + "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1460 | + "", |
|
1461 | + "", |
|
1462 | + )); |
|
1463 | + } |
|
1464 | + echo json_encode($json_data); |
|
1465 | + } |
|
1466 | + |
|
1467 | + function user_cdrs_report_search() { |
|
1468 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1469 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1470 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1471 | + $action = $this->input->post(); |
|
1472 | + unset($action['action']); |
|
1473 | + unset($action['advance_search']); |
|
1474 | + if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1475 | + $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1476 | + } |
|
1477 | + $this->session->set_userdata('user_cdrs_report_search', $action); |
|
1478 | + } |
|
1479 | + if (@$ajax_search != 1) { |
|
1480 | + redirect(base_url() . 'user/user_cdrs_report/'); |
|
1481 | + } |
|
1482 | + } |
|
1483 | + |
|
1484 | + function user_cdrs_report_clearsearchfilter() { |
|
1485 | + $this->session->set_userdata('advance_search', 0); |
|
1486 | + $this->session->set_userdata('user_cdrs_report_search', ""); |
|
1487 | + } |
|
1488 | + |
|
1489 | + function user_cdrreport_export() { |
|
1490 | 1490 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
1491 | 1491 | $currency_id=$account_info['currency_id']; |
1492 | 1492 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
1493 | - $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1494 | - $count_all = (array) $count_res->first_row(); |
|
1495 | - ob_clean(); |
|
1496 | - $customer_array[] = array("Date", "CallerID", "Called Number","Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type"); |
|
1497 | - if ($count_all['count'] > 0) { |
|
1498 | - $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1499 | - $currency_info = $this->common->get_currency_info(); |
|
1500 | - $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1501 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1502 | - foreach ($query->result_array() as $value) { |
|
1503 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1504 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1505 | - $customer_array[] = array( |
|
1506 | - $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1507 | - $value['callerid'], |
|
1508 | - $value['callednum'], |
|
1509 | - filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1510 | - $value['notes'], |
|
1511 | - $duration, |
|
1512 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false), |
|
1513 | - $value['disposition'], |
|
1514 | - $value['calltype'] |
|
1515 | - ); |
|
1516 | - } |
|
1517 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1518 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1519 | - $customer_array[] = array("Grand Total", |
|
1520 | - "", |
|
1521 | - "", |
|
1522 | - "", |
|
1493 | + $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1494 | + $count_all = (array) $count_res->first_row(); |
|
1495 | + ob_clean(); |
|
1496 | + $customer_array[] = array("Date", "CallerID", "Called Number","Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type"); |
|
1497 | + if ($count_all['count'] > 0) { |
|
1498 | + $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1499 | + $currency_info = $this->common->get_currency_info(); |
|
1500 | + $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1501 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1502 | + foreach ($query->result_array() as $value) { |
|
1503 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1504 | + floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1505 | + $customer_array[] = array( |
|
1506 | + $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1507 | + $value['callerid'], |
|
1508 | + $value['callednum'], |
|
1509 | + filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1510 | + $value['notes'], |
|
1511 | + $duration, |
|
1512 | + $this->common->calculate_currency_manually($currency_info, $value['debit'],false), |
|
1513 | + $value['disposition'], |
|
1514 | + $value['calltype'] |
|
1515 | + ); |
|
1516 | + } |
|
1517 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1518 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1519 | + $customer_array[] = array("Grand Total", |
|
1520 | + "", |
|
1521 | + "", |
|
1522 | + "", |
|
1523 | 1523 | "", |
1524 | - $duration, |
|
1525 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_debit']), |
|
1526 | - "", |
|
1527 | - "" |
|
1528 | - ); |
|
1529 | - } |
|
1530 | - $this->load->helper('csv'); |
|
1531 | - array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
1532 | - } |
|
1533 | - function user_payment($action=""){ |
|
1534 | - if(common_model::$global_config['system_config']['paypal_status'] == 1){ |
|
1535 | - redirect(base_url() . 'user/user/'); |
|
1536 | - } |
|
1537 | - $this->load->module("user/payment"); |
|
1538 | - if($action=="GET_AMT"){ |
|
1539 | - $amount = $this->input->post("value",true); |
|
1540 | - $this->payment->convert_amount($amount); |
|
1541 | - }else{ |
|
1542 | - $this->payment->index(); |
|
1543 | - } |
|
1544 | - } |
|
1524 | + $duration, |
|
1525 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_debit']), |
|
1526 | + "", |
|
1527 | + "" |
|
1528 | + ); |
|
1529 | + } |
|
1530 | + $this->load->helper('csv'); |
|
1531 | + array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
1532 | + } |
|
1533 | + function user_payment($action=""){ |
|
1534 | + if(common_model::$global_config['system_config']['paypal_status'] == 1){ |
|
1535 | + redirect(base_url() . 'user/user/'); |
|
1536 | + } |
|
1537 | + $this->load->module("user/payment"); |
|
1538 | + if($action=="GET_AMT"){ |
|
1539 | + $amount = $this->input->post("value",true); |
|
1540 | + $this->payment->convert_amount($amount); |
|
1541 | + }else{ |
|
1542 | + $this->payment->index(); |
|
1543 | + } |
|
1544 | + } |
|
1545 | 1545 | |
1546 | - function user_fund_transfer(){ |
|
1547 | - $data['page_title'] = 'Fund Transfer'; |
|
1548 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1549 | - $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1550 | - $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1551 | - $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), ''); |
|
1552 | - $this->load->view('view_user_fund_transfer', $data); |
|
1553 | - } |
|
1546 | + function user_fund_transfer(){ |
|
1547 | + $data['page_title'] = 'Fund Transfer'; |
|
1548 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1549 | + $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1550 | + $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1551 | + $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), ''); |
|
1552 | + $this->load->view('view_user_fund_transfer', $data); |
|
1553 | + } |
|
1554 | 1554 | |
1555 | - function user_fund_transfer_save() { |
|
1556 | - $data['page_title'] = 'Fund Transfer'; |
|
1557 | - $post_array = $this->input->post(); |
|
1558 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1559 | - $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1560 | - $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1561 | - $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), $post_array); |
|
1562 | - if ($this->form_validation->run() == FALSE) { |
|
1563 | - $data['validation_errors'] = validation_errors(); |
|
1564 | - } else { |
|
1565 | - if (trim($post_array['fromaccountid']) != trim($post_array['toaccountid'])) { |
|
1566 | - $account_info = $this->session->userdata('accountinfo'); |
|
1567 | - $balance = $this->common->get_field_name('balance', 'accounts', array('id' => $account_info['id'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1568 | - $toid = $this->common->get_field_name('id', 'accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1569 | - $toaccountinfo=(array)$this->db->get_where('accounts',array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0),1)->first_row(); |
|
1570 | - if($toaccountinfo){ |
|
1571 | - $reseller_id = $toaccountinfo['reseller_id']; |
|
1572 | - $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], '', '', false, false); |
|
1573 | - $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row(); |
|
1574 | - if ($post_array['toaccountid'] == $account_info['number']) { |
|
1575 | - $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1576 | - } |
|
1577 | - elseif ($reseller_id != $account_info['reseller_id']) { |
|
1578 | - $this->session->set_flashdata('astpp_notification', 'You can only transfer fund in same level account.'); |
|
1579 | - } |
|
1580 | - elseif ($post_array['toaccountid'] == '') { |
|
1581 | - $this->session->set_flashdata('astpp_notification', 'Please enter To account number.'); |
|
1582 | - } |
|
1583 | - elseif (empty($post_array['credit'])) { |
|
1584 | - $this->session->set_flashdata('astpp_notification', 'Please enter a amount.'); |
|
1585 | - } |
|
1586 | - elseif ($post_array['credit'] > $balance) { |
|
1587 | - $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.'); |
|
1588 | - } |
|
1589 | - elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1590 | - $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.'); |
|
1591 | - } |
|
1592 | - elseif ($post_array['credit'] < 0) { |
|
1593 | - $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.'); |
|
1594 | - } |
|
1595 | - elseif ($minimum_fund['value'] >= $post_array['credit']) { |
|
1596 | - $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .'); |
|
1597 | - } |
|
1598 | - elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1599 | - $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!'); |
|
1600 | - } |
|
1601 | - elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
|
1602 | - $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !'); |
|
1603 | - }else{ |
|
1604 | - $from['id'] = $post_array['id']; |
|
1605 | - $from['account_currency'] = $post_array['account_currency']; |
|
1606 | - $from['accountid'] = $post_array['fromaccountid']; |
|
1607 | - if ($account['posttoexternal'] == 1) { |
|
1608 | - $from['credit'] = abs($post_array['credit']); |
|
1609 | - $from['payment_type'] = '0'; |
|
1610 | - } else { |
|
1611 | - $from['credit'] = abs($post_array['credit']); |
|
1612 | - $from['payment_type'] = 'debit'; |
|
1613 | - } |
|
1614 | - $from['posttoexternal'] = $account['posttoexternal']; |
|
1555 | + function user_fund_transfer_save() { |
|
1556 | + $data['page_title'] = 'Fund Transfer'; |
|
1557 | + $post_array = $this->input->post(); |
|
1558 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1559 | + $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1560 | + $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1561 | + $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), $post_array); |
|
1562 | + if ($this->form_validation->run() == FALSE) { |
|
1563 | + $data['validation_errors'] = validation_errors(); |
|
1564 | + } else { |
|
1565 | + if (trim($post_array['fromaccountid']) != trim($post_array['toaccountid'])) { |
|
1566 | + $account_info = $this->session->userdata('accountinfo'); |
|
1567 | + $balance = $this->common->get_field_name('balance', 'accounts', array('id' => $account_info['id'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1568 | + $toid = $this->common->get_field_name('id', 'accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1569 | + $toaccountinfo=(array)$this->db->get_where('accounts',array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0),1)->first_row(); |
|
1570 | + if($toaccountinfo){ |
|
1571 | + $reseller_id = $toaccountinfo['reseller_id']; |
|
1572 | + $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], '', '', false, false); |
|
1573 | + $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row(); |
|
1574 | + if ($post_array['toaccountid'] == $account_info['number']) { |
|
1575 | + $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1576 | + } |
|
1577 | + elseif ($reseller_id != $account_info['reseller_id']) { |
|
1578 | + $this->session->set_flashdata('astpp_notification', 'You can only transfer fund in same level account.'); |
|
1579 | + } |
|
1580 | + elseif ($post_array['toaccountid'] == '') { |
|
1581 | + $this->session->set_flashdata('astpp_notification', 'Please enter To account number.'); |
|
1582 | + } |
|
1583 | + elseif (empty($post_array['credit'])) { |
|
1584 | + $this->session->set_flashdata('astpp_notification', 'Please enter a amount.'); |
|
1585 | + } |
|
1586 | + elseif ($post_array['credit'] > $balance) { |
|
1587 | + $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.'); |
|
1588 | + } |
|
1589 | + elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1590 | + $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.'); |
|
1591 | + } |
|
1592 | + elseif ($post_array['credit'] < 0) { |
|
1593 | + $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.'); |
|
1594 | + } |
|
1595 | + elseif ($minimum_fund['value'] >= $post_array['credit']) { |
|
1596 | + $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .'); |
|
1597 | + } |
|
1598 | + elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1599 | + $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!'); |
|
1600 | + } |
|
1601 | + elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
|
1602 | + $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !'); |
|
1603 | + }else{ |
|
1604 | + $from['id'] = $post_array['id']; |
|
1605 | + $from['account_currency'] = $post_array['account_currency']; |
|
1606 | + $from['accountid'] = $post_array['fromaccountid']; |
|
1607 | + if ($account['posttoexternal'] == 1) { |
|
1608 | + $from['credit'] = abs($post_array['credit']); |
|
1609 | + $from['payment_type'] = '0'; |
|
1610 | + } else { |
|
1611 | + $from['credit'] = abs($post_array['credit']); |
|
1612 | + $from['payment_type'] = 'debit'; |
|
1613 | + } |
|
1614 | + $from['posttoexternal'] = $account['posttoexternal']; |
|
1615 | 1615 | |
1616 | - $from['notes'] = $post_array['notes']; |
|
1617 | - $from['action'] = 'save'; |
|
1618 | - $to['id'] = $toid; |
|
1619 | - $to['account_currency'] = $post_array['account_currency']; |
|
1620 | - $to['accountid'] = $post_array['toaccountid']; |
|
1621 | - if ($toaccountinfo['posttoexternal'] == 0) { |
|
1622 | - $to['credit'] = abs($post_array['credit']); |
|
1623 | - $to['payment_type'] = '0'; |
|
1624 | - } else { |
|
1625 | - $to['credit'] = abs($post_array['credit']); |
|
1626 | - $to['payment_type'] = 'debit'; |
|
1627 | - } |
|
1628 | - $to['notes'] = $post_array['notes']; |
|
1629 | - $to['action'] = 'save'; |
|
1630 | - $response = $this->user_model->user_fund_transfer($from); |
|
1631 | - if ($response) { |
|
1632 | - $toresponse = $this->user_model->user_fund_transfer($to); |
|
1633 | - $this->session->set_flashdata('astpp_errormsg', 'Transfer success!'); |
|
1634 | - } else { |
|
1635 | - $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.'); |
|
1636 | - } |
|
1637 | - } |
|
1638 | - }else{ |
|
1616 | + $from['notes'] = $post_array['notes']; |
|
1617 | + $from['action'] = 'save'; |
|
1618 | + $to['id'] = $toid; |
|
1619 | + $to['account_currency'] = $post_array['account_currency']; |
|
1620 | + $to['accountid'] = $post_array['toaccountid']; |
|
1621 | + if ($toaccountinfo['posttoexternal'] == 0) { |
|
1622 | + $to['credit'] = abs($post_array['credit']); |
|
1623 | + $to['payment_type'] = '0'; |
|
1624 | + } else { |
|
1625 | + $to['credit'] = abs($post_array['credit']); |
|
1626 | + $to['payment_type'] = 'debit'; |
|
1627 | + } |
|
1628 | + $to['notes'] = $post_array['notes']; |
|
1629 | + $to['action'] = 'save'; |
|
1630 | + $response = $this->user_model->user_fund_transfer($from); |
|
1631 | + if ($response) { |
|
1632 | + $toresponse = $this->user_model->user_fund_transfer($to); |
|
1633 | + $this->session->set_flashdata('astpp_errormsg', 'Transfer success!'); |
|
1634 | + } else { |
|
1635 | + $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.'); |
|
1636 | + } |
|
1637 | + } |
|
1638 | + }else{ |
|
1639 | 1639 | $this->session->set_flashdata('astpp_notification', 'Account number not found.'); |
1640 | - } |
|
1641 | - } else { |
|
1642 | - $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1643 | - } |
|
1644 | - redirect(base_url() . 'user/user_fund_transfer/'); |
|
1645 | - } |
|
1646 | - $this->load->view('view_user_fund_transfer', $data); |
|
1647 | - } |
|
1648 | - function user_opensips() { |
|
1649 | - $data['username'] = $this->session->userdata('user_name'); |
|
1650 | - $data['page_title'] = 'Opensips List'; |
|
1651 | - $data['search_flag'] = true; |
|
1652 | - $data["fs_grid_buttons"] = $this->user_form->build_user_opensips_buttons(); |
|
1653 | - $data['grid_fields'] = $this->user_form->build_user_opensips(); |
|
1654 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1655 | - $this->load->view('view_opensips_list', $data); |
|
1656 | - } |
|
1657 | - |
|
1658 | - function user_opensips_json() { |
|
1659 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1660 | - $json_data = array(); |
|
1661 | - $count_all = $this->user_model->get_user_opensips(false, $accountinfo['number']); |
|
1662 | - $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'],$_GET['page']); |
|
1663 | - $json_data = $paging_data["json_paging"]; |
|
1664 | - $query = $this->user_model->get_user_opensips(true, $accountinfo['number'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1665 | - $grid_fields = json_decode($this->user_form->build_user_opensips()); |
|
1666 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1667 | - echo json_encode($json_data); |
|
1668 | - } |
|
1669 | - |
|
1670 | - function user_opensips_clearsearchfilter() { |
|
1671 | - $this->session->set_userdata('advance_search', 0); |
|
1672 | - $this->session->set_userdata('user_opensips_search', ""); |
|
1673 | - } |
|
1674 | - |
|
1675 | - function user_opensips_search() { |
|
1676 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1677 | - |
|
1678 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1679 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1680 | - $action = $this->input->post(); |
|
1681 | - unset($action['action']); |
|
1682 | - unset($action['advance_search']); |
|
1683 | - $this->session->set_userdata('user_opensips_search', $action); |
|
1684 | - } |
|
1685 | - if ($ajax_search != 1) { |
|
1686 | - redirect(base_url() . 'user/user_opensips/'); |
|
1687 | - } |
|
1688 | - } |
|
1689 | - |
|
1690 | - function user_opensips_add() { |
|
1640 | + } |
|
1641 | + } else { |
|
1642 | + $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1643 | + } |
|
1644 | + redirect(base_url() . 'user/user_fund_transfer/'); |
|
1645 | + } |
|
1646 | + $this->load->view('view_user_fund_transfer', $data); |
|
1647 | + } |
|
1648 | + function user_opensips() { |
|
1649 | + $data['username'] = $this->session->userdata('user_name'); |
|
1650 | + $data['page_title'] = 'Opensips List'; |
|
1651 | + $data['search_flag'] = true; |
|
1652 | + $data["fs_grid_buttons"] = $this->user_form->build_user_opensips_buttons(); |
|
1653 | + $data['grid_fields'] = $this->user_form->build_user_opensips(); |
|
1654 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1655 | + $this->load->view('view_opensips_list', $data); |
|
1656 | + } |
|
1657 | + |
|
1658 | + function user_opensips_json() { |
|
1659 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1660 | + $json_data = array(); |
|
1661 | + $count_all = $this->user_model->get_user_opensips(false, $accountinfo['number']); |
|
1662 | + $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'],$_GET['page']); |
|
1663 | + $json_data = $paging_data["json_paging"]; |
|
1664 | + $query = $this->user_model->get_user_opensips(true, $accountinfo['number'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1665 | + $grid_fields = json_decode($this->user_form->build_user_opensips()); |
|
1666 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1667 | + echo json_encode($json_data); |
|
1668 | + } |
|
1669 | + |
|
1670 | + function user_opensips_clearsearchfilter() { |
|
1671 | + $this->session->set_userdata('advance_search', 0); |
|
1672 | + $this->session->set_userdata('user_opensips_search', ""); |
|
1673 | + } |
|
1674 | + |
|
1675 | + function user_opensips_search() { |
|
1676 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1677 | + |
|
1678 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1679 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1680 | + $action = $this->input->post(); |
|
1681 | + unset($action['action']); |
|
1682 | + unset($action['advance_search']); |
|
1683 | + $this->session->set_userdata('user_opensips_search', $action); |
|
1684 | + } |
|
1685 | + if ($ajax_search != 1) { |
|
1686 | + redirect(base_url() . 'user/user_opensips/'); |
|
1687 | + } |
|
1688 | + } |
|
1689 | + |
|
1690 | + function user_opensips_add() { |
|
1691 | 1691 | $accountinfo = $this->session->userdata("accountinfo"); |
1692 | - $data['username'] = $this->session->userdata('user_name'); |
|
1693 | - $data['flag'] = 'create'; |
|
1694 | - $data['page_title'] = 'Create Opensips'; |
|
1695 | - $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), ''); |
|
1696 | - $this->load->view('view_opensips_add_edit', $data); |
|
1697 | - } |
|
1692 | + $data['username'] = $this->session->userdata('user_name'); |
|
1693 | + $data['flag'] = 'create'; |
|
1694 | + $data['page_title'] = 'Create Opensips'; |
|
1695 | + $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), ''); |
|
1696 | + $this->load->view('view_opensips_add_edit', $data); |
|
1697 | + } |
|
1698 | 1698 | |
1699 | - function user_opensips_edit($edit_id){ |
|
1699 | + function user_opensips_edit($edit_id){ |
|
1700 | 1700 | $data['page_title'] = 'Edit Opensips'; |
1701 | - $db_config = Common_model::$global_config['system_config']; |
|
1702 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
1703 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1704 | - $where = array('id' => $edit_id); |
|
1705 | - $this->opensips_db->where($where); |
|
1706 | - $account = $this->opensips_db->get("subscriber"); |
|
1707 | - foreach ($account->result_array() as $key => $value) { |
|
1708 | - $edit_data = $value; |
|
1709 | - } |
|
1710 | - $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form($edit_id), $edit_data); |
|
1711 | - $this->load->view('view_opensips_add_edit', $data); |
|
1701 | + $db_config = Common_model::$global_config['system_config']; |
|
1702 | + $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
1703 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1704 | + $where = array('id' => $edit_id); |
|
1705 | + $this->opensips_db->where($where); |
|
1706 | + $account = $this->opensips_db->get("subscriber"); |
|
1707 | + foreach ($account->result_array() as $key => $value) { |
|
1708 | + $edit_data = $value; |
|
1709 | + } |
|
1710 | + $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form($edit_id), $edit_data); |
|
1711 | + $this->load->view('view_opensips_add_edit', $data); |
|
1712 | 1712 | |
1713 | - } |
|
1713 | + } |
|
1714 | 1714 | |
1715 | - function user_opensips_save(){ |
|
1715 | + function user_opensips_save(){ |
|
1716 | 1716 | $add_array = $this->input->post(); |
1717 | - $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), $add_array); |
|
1718 | - if ($add_array['id'] != '') { |
|
1719 | - $data['page_title'] = 'Edit Opensips'; |
|
1720 | - if ($this->form_validation->run() == FALSE) { |
|
1721 | - $data['validation_errors'] = validation_errors(); |
|
1722 | - echo $data['validation_errors']; |
|
1723 | - exit; |
|
1724 | - } else { |
|
1725 | - $auth_flag = $this->validate_device_data($add_array); |
|
1726 | - if($auth_flag == "TRUE"){ |
|
1727 | - $this->user_model->user_opensips_edit($add_array, $add_array['id']); |
|
1728 | - echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!")); |
|
1729 | - exit; |
|
1730 | - }else{ |
|
1731 | - echo json_encode($auth_flag); |
|
1732 | - exit; |
|
1733 | - } |
|
1734 | - } |
|
1735 | - } else { |
|
1736 | - $data['page_title'] = 'Add Opensips'; |
|
1737 | - if ($this->form_validation->run() == FALSE) { |
|
1738 | - $data['validation_errors'] = validation_errors(); |
|
1739 | - echo $data['validation_errors']; |
|
1740 | - exit; |
|
1741 | - } else { |
|
1742 | - $auth_flag = $this->validate_device_data($add_array); |
|
1743 | - if($auth_flag == "TRUE"){ |
|
1744 | - $this->user_model->user_opensips_add($add_array); |
|
1745 | - echo json_encode(array("SUCCESS"=> "OpenSips added successfully!")); |
|
1746 | - exit; |
|
1747 | - }else{ |
|
1748 | - echo json_encode($auth_flag); |
|
1749 | - exit; |
|
1750 | - } |
|
1751 | - } |
|
1752 | - } |
|
1753 | - } |
|
1754 | - function validate_device_data($data){ |
|
1755 | - if(isset($data["username"]) && $data["username"] != ""){ |
|
1756 | - $db_config = Common_model::$global_config['system_config']; |
|
1757 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
1758 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1759 | - $where = array("username"=>$data["username"]); |
|
1760 | - if($data['id'] != ""){ |
|
1761 | - $this->opensips_db->where("id <>",$data['id']); |
|
1762 | - } |
|
1763 | - $this->opensips_db->where($where); |
|
1764 | - $auth_flag = $this->opensips_db->get("subscriber"); |
|
1765 | - $auth_flag = $auth_flag->num_rows(); |
|
1766 | - if($auth_flag == 0){ |
|
1767 | - return "TRUE"; |
|
1768 | - }else{ |
|
1769 | - return array("username_error"=>"Duplicate Username Found.Username Must be Unique"); |
|
1770 | - } |
|
1771 | - }else{ |
|
1772 | - return array("username_error"=>"User name is required field."); |
|
1773 | - } |
|
1774 | - return "0"; |
|
1775 | - } |
|
1717 | + $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), $add_array); |
|
1718 | + if ($add_array['id'] != '') { |
|
1719 | + $data['page_title'] = 'Edit Opensips'; |
|
1720 | + if ($this->form_validation->run() == FALSE) { |
|
1721 | + $data['validation_errors'] = validation_errors(); |
|
1722 | + echo $data['validation_errors']; |
|
1723 | + exit; |
|
1724 | + } else { |
|
1725 | + $auth_flag = $this->validate_device_data($add_array); |
|
1726 | + if($auth_flag == "TRUE"){ |
|
1727 | + $this->user_model->user_opensips_edit($add_array, $add_array['id']); |
|
1728 | + echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!")); |
|
1729 | + exit; |
|
1730 | + }else{ |
|
1731 | + echo json_encode($auth_flag); |
|
1732 | + exit; |
|
1733 | + } |
|
1734 | + } |
|
1735 | + } else { |
|
1736 | + $data['page_title'] = 'Add Opensips'; |
|
1737 | + if ($this->form_validation->run() == FALSE) { |
|
1738 | + $data['validation_errors'] = validation_errors(); |
|
1739 | + echo $data['validation_errors']; |
|
1740 | + exit; |
|
1741 | + } else { |
|
1742 | + $auth_flag = $this->validate_device_data($add_array); |
|
1743 | + if($auth_flag == "TRUE"){ |
|
1744 | + $this->user_model->user_opensips_add($add_array); |
|
1745 | + echo json_encode(array("SUCCESS"=> "OpenSips added successfully!")); |
|
1746 | + exit; |
|
1747 | + }else{ |
|
1748 | + echo json_encode($auth_flag); |
|
1749 | + exit; |
|
1750 | + } |
|
1751 | + } |
|
1752 | + } |
|
1753 | + } |
|
1754 | + function validate_device_data($data){ |
|
1755 | + if(isset($data["username"]) && $data["username"] != ""){ |
|
1756 | + $db_config = Common_model::$global_config['system_config']; |
|
1757 | + $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
1758 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1759 | + $where = array("username"=>$data["username"]); |
|
1760 | + if($data['id'] != ""){ |
|
1761 | + $this->opensips_db->where("id <>",$data['id']); |
|
1762 | + } |
|
1763 | + $this->opensips_db->where($where); |
|
1764 | + $auth_flag = $this->opensips_db->get("subscriber"); |
|
1765 | + $auth_flag = $auth_flag->num_rows(); |
|
1766 | + if($auth_flag == 0){ |
|
1767 | + return "TRUE"; |
|
1768 | + }else{ |
|
1769 | + return array("username_error"=>"Duplicate Username Found.Username Must be Unique"); |
|
1770 | + } |
|
1771 | + }else{ |
|
1772 | + return array("username_error"=>"User name is required field."); |
|
1773 | + } |
|
1774 | + return "0"; |
|
1775 | + } |
|
1776 | 1776 | |
1777 | - function user_opensips_delete($id){ |
|
1778 | - $this->user_model->user_opensips_delete($id); |
|
1779 | - $this->session->set_flashdata('astpp_errormsg', 'Opensips Device Removed Successfully!.'); |
|
1780 | - redirect(base_url() . "user/user_opensips/"); |
|
1781 | - } |
|
1782 | - function user_opensips_delete_multiple(){ |
|
1783 | - $db_config = Common_model::$global_config['system_config']; |
|
1784 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
1785 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1786 | - $ids = $this->input->post("selected_ids", true); |
|
1787 | - $where = "id IN ($ids)"; |
|
1788 | - $this->opensips_db->where($where); |
|
1789 | - $this->opensips_db->delete("subscriber"); |
|
1790 | - echo TRUE; |
|
1791 | - } |
|
1777 | + function user_opensips_delete($id){ |
|
1778 | + $this->user_model->user_opensips_delete($id); |
|
1779 | + $this->session->set_flashdata('astpp_errormsg', 'Opensips Device Removed Successfully!.'); |
|
1780 | + redirect(base_url() . "user/user_opensips/"); |
|
1781 | + } |
|
1782 | + function user_opensips_delete_multiple(){ |
|
1783 | + $db_config = Common_model::$global_config['system_config']; |
|
1784 | + $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
1785 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1786 | + $ids = $this->input->post("selected_ids", true); |
|
1787 | + $where = "id IN ($ids)"; |
|
1788 | + $this->opensips_db->where($where); |
|
1789 | + $this->opensips_db->delete("subscriber"); |
|
1790 | + echo TRUE; |
|
1791 | + } |
|
1792 | 1792 | |
1793 | - function user_cdrs(){ |
|
1794 | - $data['username'] = $this->session->userdata('user_name'); |
|
1795 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1796 | - $data['page_title'] = 'CDRs'; |
|
1797 | - $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1798 | - $this->load->module('reports/reports'); |
|
1799 | - $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
|
1800 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1801 | - $data['accounttype']=$accounttype; |
|
1802 | - $this->load->view('view_user_cdrs', $data); |
|
1803 | - } |
|
1804 | - function user_cdrs_json(){ |
|
1805 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1806 | - $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1807 | - $this->load->module('reports/reports'); |
|
1808 | - $this->reports->customer_cdrreport($accountinfo['id'], $accounttype); |
|
1809 | - } |
|
1810 | - function user_details_search($module_name){ |
|
1811 | - $action = $this->input->post(); |
|
1812 | - $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
1813 | - if(!empty($action['left_panel_search'])){ |
|
1814 | - $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
|
1815 | - } |
|
1816 | - } |
|
1817 | - |
|
1818 | - function user_provider_report_export() { |
|
1819 | - $this->load->module('reports/reports'); |
|
1820 | - $this->provider_cdrreport_export(); |
|
1821 | - } |
|
1793 | + function user_cdrs(){ |
|
1794 | + $data['username'] = $this->session->userdata('user_name'); |
|
1795 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1796 | + $data['page_title'] = 'CDRs'; |
|
1797 | + $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1798 | + $this->load->module('reports/reports'); |
|
1799 | + $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
|
1800 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1801 | + $data['accounttype']=$accounttype; |
|
1802 | + $this->load->view('view_user_cdrs', $data); |
|
1803 | + } |
|
1804 | + function user_cdrs_json(){ |
|
1805 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1806 | + $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1807 | + $this->load->module('reports/reports'); |
|
1808 | + $this->reports->customer_cdrreport($accountinfo['id'], $accounttype); |
|
1809 | + } |
|
1810 | + function user_details_search($module_name){ |
|
1811 | + $action = $this->input->post(); |
|
1812 | + $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
1813 | + if(!empty($action['left_panel_search'])){ |
|
1814 | + $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
|
1815 | + } |
|
1816 | + } |
|
1817 | + |
|
1818 | + function user_provider_report_export() { |
|
1819 | + $this->load->module('reports/reports'); |
|
1820 | + $this->provider_cdrreport_export(); |
|
1821 | + } |
|
1822 | 1822 | |
1823 | 1823 | |
1824 | - function user_provider_cdrs_report() { |
|
1825 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1826 | - $data['page_title'] = 'Provider CDRs Report'; |
|
1827 | - $data['search_flag'] = true; |
|
1828 | - $data["grid_buttons"] = $this->user_form->build_provider_report_buttons(); |
|
1829 | - $data['grid_fields'] = $this->user_form->build_provider_report($accountinfo['type']); |
|
1830 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_provider_report_search($accountinfo['type'])); |
|
1831 | - $this->load->view('view_provider_cdrs_report', $data); |
|
1832 | - } |
|
1833 | - |
|
1834 | - function user_provider_cdrs_report_json() { |
|
1835 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1836 | - $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1837 | - $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1838 | - $count_all = (array) $count_res->first_row(); |
|
1839 | - $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1840 | - $json_data = $paging_data["json_paging"]; |
|
1841 | - $query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1842 | - $grid_fields = json_decode($this->user_form->build_provider_report($accountinfo['type'])); |
|
1843 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1844 | - if ($count_all['count'] > 0) { |
|
1845 | - $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1846 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1847 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1848 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1849 | - $json_data['rows'][] = array("cell" => array( |
|
1850 | - "<b>Grand Total</b>", |
|
1851 | - "", |
|
1852 | - "", |
|
1853 | - "", |
|
1854 | - $duration, |
|
1855 | - "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1856 | - "", |
|
1857 | - "", |
|
1858 | - )); |
|
1859 | - } |
|
1860 | - echo json_encode($json_data); |
|
1861 | - } |
|
1862 | - |
|
1863 | - function user_provider_cdrs_report_search() { |
|
1864 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1865 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1866 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1867 | - $action = $this->input->post(); |
|
1868 | - if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
1869 | - $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
1870 | - } |
|
1871 | - unset($action['action']); |
|
1872 | - unset($action['advance_search']); |
|
1873 | - $this->session->set_userdata('user_provider_cdrs_report_search', $action); |
|
1874 | - } |
|
1875 | - if ($ajax_search != 1) { |
|
1876 | - redirect(base_url() . 'user/user_provider_cdrs_report/'); |
|
1877 | - } |
|
1878 | - } |
|
1879 | - |
|
1880 | - function user_provider_cdrs_report_clearsearchfilter() { |
|
1881 | - $this->session->set_userdata('advance_search', 0); |
|
1882 | - $this->session->set_userdata('user_provider_cdrs_report_search', ""); |
|
1883 | - } |
|
1884 | - |
|
1885 | - function user_provider_cdrreport_export() { |
|
1824 | + function user_provider_cdrs_report() { |
|
1825 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1826 | + $data['page_title'] = 'Provider CDRs Report'; |
|
1827 | + $data['search_flag'] = true; |
|
1828 | + $data["grid_buttons"] = $this->user_form->build_provider_report_buttons(); |
|
1829 | + $data['grid_fields'] = $this->user_form->build_provider_report($accountinfo['type']); |
|
1830 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_provider_report_search($accountinfo['type'])); |
|
1831 | + $this->load->view('view_provider_cdrs_report', $data); |
|
1832 | + } |
|
1833 | + |
|
1834 | + function user_provider_cdrs_report_json() { |
|
1835 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1836 | + $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1837 | + $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1838 | + $count_all = (array) $count_res->first_row(); |
|
1839 | + $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1840 | + $json_data = $paging_data["json_paging"]; |
|
1841 | + $query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1842 | + $grid_fields = json_decode($this->user_form->build_provider_report($accountinfo['type'])); |
|
1843 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1844 | + if ($count_all['count'] > 0) { |
|
1845 | + $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1846 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1847 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1848 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1849 | + $json_data['rows'][] = array("cell" => array( |
|
1850 | + "<b>Grand Total</b>", |
|
1851 | + "", |
|
1852 | + "", |
|
1853 | + "", |
|
1854 | + $duration, |
|
1855 | + "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1856 | + "", |
|
1857 | + "", |
|
1858 | + )); |
|
1859 | + } |
|
1860 | + echo json_encode($json_data); |
|
1861 | + } |
|
1862 | + |
|
1863 | + function user_provider_cdrs_report_search() { |
|
1864 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1865 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1866 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1867 | + $action = $this->input->post(); |
|
1868 | + if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
1869 | + $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
1870 | + } |
|
1871 | + unset($action['action']); |
|
1872 | + unset($action['advance_search']); |
|
1873 | + $this->session->set_userdata('user_provider_cdrs_report_search', $action); |
|
1874 | + } |
|
1875 | + if ($ajax_search != 1) { |
|
1876 | + redirect(base_url() . 'user/user_provider_cdrs_report/'); |
|
1877 | + } |
|
1878 | + } |
|
1879 | + |
|
1880 | + function user_provider_cdrs_report_clearsearchfilter() { |
|
1881 | + $this->session->set_userdata('advance_search', 0); |
|
1882 | + $this->session->set_userdata('user_provider_cdrs_report_search', ""); |
|
1883 | + } |
|
1884 | + |
|
1885 | + function user_provider_cdrreport_export() { |
|
1886 | 1886 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
1887 | 1887 | $currency_id=$account_info['currency_id']; |
1888 | 1888 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
1889 | - $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1890 | - $count_all = (array) $count_res->first_row(); |
|
1891 | - ob_clean(); |
|
1892 | - $customer_array[] = array("Date", "CallerID", "Called Number", "Destination", "Duration", "Cost($currency)", "Disposition", "Call Type"); |
|
1893 | - if ($count_all['count'] > 0) { |
|
1894 | - $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1895 | - $currency_info = $this->common->get_currency_info(); |
|
1896 | - $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1897 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1898 | - foreach ($query->result_array() as $value) { |
|
1899 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1900 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1901 | - $customer_array[] = array( |
|
1902 | - $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1903 | - $value['callerid'], |
|
1904 | - $value['callednum'], |
|
1905 | - filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1906 | - $duration, |
|
1907 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false), |
|
1908 | - $value['disposition'], |
|
1909 | - $value['calltype'] |
|
1910 | - ); |
|
1911 | - } |
|
1912 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1913 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1914 | - $customer_array[] = array("Grand Total", |
|
1915 | - "", |
|
1916 | - "", |
|
1917 | - "", |
|
1918 | - $duration, |
|
1919 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,true), |
|
1920 | - "", |
|
1921 | - "" |
|
1922 | - ); |
|
1923 | - } |
|
1924 | - $this->load->helper('csv'); |
|
1925 | - array_to_csv($customer_array, 'Provider_CDR_' . date("Y-m-d") . '.csv'); |
|
1926 | - } |
|
1927 | - function user_speeddial(){ |
|
1928 | - $data['page_title'] = "Speed Dial"; |
|
1929 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1930 | - $where = array('id' => $accountinfo['id'], "reseller_id" => $accountinfo['reseller_id']); |
|
1931 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
1889 | + $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1890 | + $count_all = (array) $count_res->first_row(); |
|
1891 | + ob_clean(); |
|
1892 | + $customer_array[] = array("Date", "CallerID", "Called Number", "Destination", "Duration", "Cost($currency)", "Disposition", "Call Type"); |
|
1893 | + if ($count_all['count'] > 0) { |
|
1894 | + $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1895 | + $currency_info = $this->common->get_currency_info(); |
|
1896 | + $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1897 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1898 | + foreach ($query->result_array() as $value) { |
|
1899 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1900 | + floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1901 | + $customer_array[] = array( |
|
1902 | + $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1903 | + $value['callerid'], |
|
1904 | + $value['callednum'], |
|
1905 | + filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1906 | + $duration, |
|
1907 | + $this->common->calculate_currency_manually($currency_info, $value['cost'],false), |
|
1908 | + $value['disposition'], |
|
1909 | + $value['calltype'] |
|
1910 | + ); |
|
1911 | + } |
|
1912 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1913 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1914 | + $customer_array[] = array("Grand Total", |
|
1915 | + "", |
|
1916 | + "", |
|
1917 | + "", |
|
1918 | + $duration, |
|
1919 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,true), |
|
1920 | + "", |
|
1921 | + "" |
|
1922 | + ); |
|
1923 | + } |
|
1924 | + $this->load->helper('csv'); |
|
1925 | + array_to_csv($customer_array, 'Provider_CDR_' . date("Y-m-d") . '.csv'); |
|
1926 | + } |
|
1927 | + function user_speeddial(){ |
|
1928 | + $data['page_title'] = "Speed Dial"; |
|
1929 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1930 | + $where = array('id' => $accountinfo['id'], "reseller_id" => $accountinfo['reseller_id']); |
|
1931 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
1932 | 1932 | if ($account->num_rows() > 0) { |
1933 | 1933 | $account_data = (array) $account->first_row(); |
1934 | 1934 | $speeddial_res = $this->db->get_where("speed_dial", array("accountid" => $accountinfo['id'])); |
1935 | 1935 | $speeddial_info = array(); |
1936 | - if ($speeddial_res->num_rows() > 0) { |
|
1937 | - $speeddial_res = $speeddial_res->result_array(); |
|
1938 | - foreach ($speeddial_res as $key => $value) { |
|
1939 | - $speeddial_info[$value['speed_num']] = $value['number']; |
|
1940 | - } |
|
1941 | - } |
|
1942 | - $data['speeddial'] = $speeddial_info; |
|
1936 | + if ($speeddial_res->num_rows() > 0) { |
|
1937 | + $speeddial_res = $speeddial_res->result_array(); |
|
1938 | + foreach ($speeddial_res as $key => $value) { |
|
1939 | + $speeddial_info[$value['speed_num']] = $value['number']; |
|
1940 | + } |
|
1941 | + } |
|
1942 | + $data['speeddial'] = $speeddial_info; |
|
1943 | 1943 | $this->load->view('view_user_speeddial', $data); |
1944 | 1944 | }else{ |
1945 | 1945 | redirect(base_url.'user/user/'); |
1946 | 1946 | } |
1947 | - } |
|
1947 | + } |
|
1948 | 1948 | |
1949 | - function user_speeddial_save(){ |
|
1950 | - $add_array= $this->input->post(); |
|
1951 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1952 | - $where = array("accountid" => $accountinfo['id']); |
|
1949 | + function user_speeddial_save(){ |
|
1950 | + $add_array= $this->input->post(); |
|
1951 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1952 | + $where = array("accountid" => $accountinfo['id']); |
|
1953 | 1953 | $this->db->select('count(id) as count'); |
1954 | 1954 | $this->db->where($where); |
1955 | 1955 | $speed_dial_result = (array)$this->db->get('speed_dial')->first_row(); |
1956 | 1956 | if ($speed_dial_result['count'] == 0) { |
1957 | - for ($i = 0; $i <= 9; $i++) { |
|
1958 | - $dest_number = $add_array['number'] == $i ? $add_array['destination'] : ''; |
|
1959 | - $data[$i] = array("number" => $dest_number, "speed_num" => $i, 'accountid' => $accountinfo['id']); |
|
1960 | - } |
|
1961 | - $this->db->insert_batch('speed_dial', $data); |
|
1957 | + for ($i = 0; $i <= 9; $i++) { |
|
1958 | + $dest_number = $add_array['number'] == $i ? $add_array['destination'] : ''; |
|
1959 | + $data[$i] = array("number" => $dest_number, "speed_num" => $i, 'accountid' => $accountinfo['id']); |
|
1960 | + } |
|
1961 | + $this->db->insert_batch('speed_dial', $data); |
|
1962 | 1962 | } else { |
1963 | - $this->db->where('speed_num', $add_array['number']); |
|
1964 | - $this->db->where('accountid', $accountinfo['id']); |
|
1965 | - $result = $this->db->update('speed_dial', array('number' => $add_array['destination'])); |
|
1963 | + $this->db->where('speed_num', $add_array['number']); |
|
1964 | + $this->db->where('accountid', $accountinfo['id']); |
|
1965 | + $result = $this->db->update('speed_dial', array('number' => $add_array['destination'])); |
|
1966 | 1966 | } |
1967 | - } |
|
1968 | - function user_speeddial_remove() { |
|
1967 | + } |
|
1968 | + function user_speeddial_remove() { |
|
1969 | 1969 | $accountinfo=$this->session->userdata('accountinfo'); |
1970 | 1970 | $add_array=$this->input->post(); |
1971 | - $updateinfo = array('number' => ''); |
|
1972 | - $this->db->where('speed_num', $add_array['number']); |
|
1973 | - $this->db->where('accountid', $accountinfo['id']); |
|
1974 | - $result = $this->db->update('speed_dial', $updateinfo); |
|
1975 | - } |
|
1971 | + $updateinfo = array('number' => ''); |
|
1972 | + $this->db->where('speed_num', $add_array['number']); |
|
1973 | + $this->db->where('accountid', $accountinfo['id']); |
|
1974 | + $result = $this->db->update('speed_dial', $updateinfo); |
|
1975 | + } |
|
1976 | 1976 | } |
1977 | 1977 | |
1978 | 1978 | ?> |
@@ -23,38 +23,38 @@ |
||
23 | 23 | class Payment extends MX_Controller { |
24 | 24 | |
25 | 25 | function Payment() { |
26 | - parent::__construct(); |
|
27 | - $this->load->helper('template_inheritance'); |
|
28 | - $this->load->library('session'); |
|
29 | - $this->load->library('encrypt'); |
|
30 | - $this->load->helper('form'); |
|
26 | + parent::__construct(); |
|
27 | + $this->load->helper('template_inheritance'); |
|
28 | + $this->load->library('session'); |
|
29 | + $this->load->library('encrypt'); |
|
30 | + $this->load->helper('form'); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | 34 | function index(){ |
35 | - $account_data = $this->session->userdata("accountinfo"); |
|
36 | - $data["accountid"] = $account_data["id"]; |
|
37 | - $data["accountid"] = $account_data["id"]; |
|
38 | - $data["page_title"] = "Recharge"; |
|
35 | + $account_data = $this->session->userdata("accountinfo"); |
|
36 | + $data["accountid"] = $account_data["id"]; |
|
37 | + $data["accountid"] = $account_data["id"]; |
|
38 | + $data["page_title"] = "Recharge"; |
|
39 | 39 | |
40 | - $system_config = common_model::$global_config['system_config']; |
|
41 | - if($system_config["paypal_mode"]==0){ |
|
42 | - $data["paypal_url"] = $system_config["paypal_url"]; |
|
43 | - $data["paypal_email_id"] = $system_config["paypal_id"]; |
|
44 | - }else{ |
|
45 | - $data["paypal_url"] = $system_config["paypal_sandbox_url"]; |
|
46 | - $data["paypal_email_id"] = $system_config["paypal_sandbox_id"]; |
|
47 | - } |
|
48 | - $data["paypal_tax"] = $system_config["paypal_tax"]; |
|
40 | + $system_config = common_model::$global_config['system_config']; |
|
41 | + if($system_config["paypal_mode"]==0){ |
|
42 | + $data["paypal_url"] = $system_config["paypal_url"]; |
|
43 | + $data["paypal_email_id"] = $system_config["paypal_id"]; |
|
44 | + }else{ |
|
45 | + $data["paypal_url"] = $system_config["paypal_sandbox_url"]; |
|
46 | + $data["paypal_email_id"] = $system_config["paypal_sandbox_id"]; |
|
47 | + } |
|
48 | + $data["paypal_tax"] = $system_config["paypal_tax"]; |
|
49 | 49 | |
50 | - $data["from_currency"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]); |
|
51 | - $data["to_currency"] = Common_model::$global_config['system_config']['base_currency']; |
|
52 | - $this->load->view("user_payment",$data); |
|
50 | + $data["from_currency"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]); |
|
51 | + $data["to_currency"] = Common_model::$global_config['system_config']['base_currency']; |
|
52 | + $this->load->view("user_payment",$data); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | function convert_amount($amount){ |
56 | - $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
57 | - echo number_format((float)$amount,2); |
|
56 | + $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
57 | + echo number_format((float)$amount,2); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | ?> |
@@ -23,63 +23,63 @@ discard block |
||
23 | 23 | |
24 | 24 | if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
25 | 25 | class User_form{ |
26 | - function __construct($library_name = '') { |
|
27 | - $this->CI = & get_instance(); |
|
28 | - } |
|
26 | + function __construct($library_name = '') { |
|
27 | + $this->CI = & get_instance(); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | function build_packages_list_for_user(){ |
32 | - $grid_field_arr = json_encode(array( |
|
33 | - array(gettext("Name"), "310", "package_name", "", "", "","","true","center"), |
|
34 | - array(gettext("Rate Group"), "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
35 | - array(gettext("Included Seconds"), "260", "includedseconds", "", "", "","","true","center"), |
|
36 | - array(gettext("Status"), "160", "status", "status", "status", "get_status","","true","center"), |
|
37 | - )); |
|
38 | - return $grid_field_arr; |
|
32 | + $grid_field_arr = json_encode(array( |
|
33 | + array(gettext("Name"), "310", "package_name", "", "", "","","true","center"), |
|
34 | + array(gettext("Rate Group"), "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
35 | + array(gettext("Included Seconds"), "260", "includedseconds", "", "", "","","true","center"), |
|
36 | + array(gettext("Status"), "160", "status", "status", "status", "get_status","","true","center"), |
|
37 | + )); |
|
38 | + return $grid_field_arr; |
|
39 | 39 | } |
40 | - function build_refill_list_for_user() { |
|
41 | - $grid_field_arr = json_encode(array( |
|
40 | + function build_refill_list_for_user() { |
|
41 | + $grid_field_arr = json_encode(array( |
|
42 | 42 | |
43 | - array(gettext("Date"), "225", "payment_date", "", "", ""), |
|
44 | - array(gettext("Amount"), "250", "credit", "credit", "credit", "convert_to_currency"), |
|
45 | - array(gettext("Refill By"), "230", "payment_by", "payment_by", "payment_by", "get_refill_by"), |
|
46 | - array(gettext("Note"), "290", "notes", "", "", "") |
|
47 | - )); |
|
48 | - return $grid_field_arr; |
|
49 | - } |
|
43 | + array(gettext("Date"), "225", "payment_date", "", "", ""), |
|
44 | + array(gettext("Amount"), "250", "credit", "credit", "credit", "convert_to_currency"), |
|
45 | + array(gettext("Refill By"), "230", "payment_by", "payment_by", "payment_by", "get_refill_by"), |
|
46 | + array(gettext("Note"), "290", "notes", "", "", "") |
|
47 | + )); |
|
48 | + return $grid_field_arr; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - function build_emails_list_for_user() { |
|
53 | - $grid_field_arr = json_encode(array( |
|
54 | - array(gettext("Date"), "110", "date", "", "", "","","true","center"), |
|
55 | - array(gettext("From"), "170", "from", "", "", "","","true","center"), |
|
56 | - array(gettext("Body"), "550", "body", "", "", "","","true","center"), |
|
57 | - array(gettext("Attachement"), "100", "attachment", "attachment", "attachment", "attachment_icons","","true","center"), |
|
58 | - array(gettext("Status"), "100", "status", "status", "status", "email_status","","true","center"), |
|
59 | - )); |
|
60 | - return $grid_field_arr; |
|
61 | - } |
|
62 | - function build_user_emails_search(){ |
|
63 | - $form['forms'] = array("", array('id' => "user_emails_search")); |
|
64 | - $form['Search'] = array( |
|
65 | - array(gettext('From Date'), 'INPUT', array('name' => 'date[]', 'id' => 'customer_cdr_from_date', 'size' => '20', |
|
52 | + function build_emails_list_for_user() { |
|
53 | + $grid_field_arr = json_encode(array( |
|
54 | + array(gettext("Date"), "110", "date", "", "", "","","true","center"), |
|
55 | + array(gettext("From"), "170", "from", "", "", "","","true","center"), |
|
56 | + array(gettext("Body"), "550", "body", "", "", "","","true","center"), |
|
57 | + array(gettext("Attachement"), "100", "attachment", "attachment", "attachment", "attachment_icons","","true","center"), |
|
58 | + array(gettext("Status"), "100", "status", "status", "status", "email_status","","true","center"), |
|
59 | + )); |
|
60 | + return $grid_field_arr; |
|
61 | + } |
|
62 | + function build_user_emails_search(){ |
|
63 | + $form['forms'] = array("", array('id' => "user_emails_search")); |
|
64 | + $form['Search'] = array( |
|
65 | + array(gettext('From Date'), 'INPUT', array('name' => 'date[]', 'id' => 'customer_cdr_from_date', 'size' => '20', |
|
66 | 66 | 'class' => "text field "), '', 'tOOL TIP', '', 'date[date-date]'), |
67 | 67 | array(gettext('To Date'), 'INPUT', array('name' => 'date[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'date[date-date]'), |
68 | 68 | array(gettext('From'), 'INPUT', array('name' => 'from[from]', '','id'=>'from', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'from[from-string]', '', '', '', 'search_string_type', ''), |
69 | 69 | array(gettext('Body'), 'INPUT', array('name' => 'body[body]', '','id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'body[body-string]', '', '', '', 'search_string_type', ''), |
70 | 70 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
71 | 71 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
72 | - ); |
|
73 | - $form['button_search'] = array('name' => 'action', 'id' => "user_email_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
74 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
75 | - return $form; |
|
76 | - } |
|
72 | + ); |
|
73 | + $form['button_search'] = array('name' => 'action', 'id' => "user_email_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
74 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
75 | + return $form; |
|
76 | + } |
|
77 | 77 | |
78 | - function get_userprofile_form_fields($dataArr = false) { |
|
79 | - if ($dataArr['id'] > 0) |
|
80 | - $val = 'accounts.email.' . $dataArr['id']; |
|
81 | - else |
|
82 | - $val = 'accounts.email'; |
|
78 | + function get_userprofile_form_fields($dataArr = false) { |
|
79 | + if ($dataArr['id'] > 0) |
|
80 | + $val = 'accounts.email.' . $dataArr['id']; |
|
81 | + else |
|
82 | + $val = 'accounts.email'; |
|
83 | 83 | $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
84 | 84 | $password = $this->CI->common->generate_password(); |
85 | 85 | $logintype=$this->CI->session->userdata('logintype'); |
@@ -87,289 +87,289 @@ discard block |
||
87 | 87 | $form['forms'] = array(base_url() . 'user/user_myprofile/', array("id" => "user_form", "name" => "user_form")); |
88 | 88 | |
89 | 89 | $form['User Profile'] = array( |
90 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
91 | - array('', 'HIDDEN', array('name' => 'type', 'value' => '0'), '', '', ''), |
|
92 | - array(gettext('Account Number'), 'INPUT', array('name' => 'number', 'value' => $uname, 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
93 | - $pin, |
|
94 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
95 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
96 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|alpha_dash|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
97 | - array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
98 | - array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
99 | - array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', 'Please Enter Password'), |
|
100 | - array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
101 | - array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
102 | - array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
103 | - array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
104 | - array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
105 | - array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
106 | - array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', '') |
|
107 | - ); |
|
108 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
90 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
91 | + array('', 'HIDDEN', array('name' => 'type', 'value' => '0'), '', '', ''), |
|
92 | + array(gettext('Account Number'), 'INPUT', array('name' => 'number', 'value' => $uname, 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
93 | + $pin, |
|
94 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
95 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
96 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|alpha_dash|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
97 | + array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
98 | + array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
99 | + array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', 'Please Enter Password'), |
|
100 | + array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
101 | + array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
102 | + array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
103 | + array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
104 | + array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
105 | + array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
106 | + array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', '') |
|
107 | + ); |
|
108 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
109 | 109 | |
110 | - return $form; |
|
111 | - } |
|
110 | + return $form; |
|
111 | + } |
|
112 | 112 | |
113 | - function get_userprofile_change_password() { |
|
114 | - $form['forms'] = array(base_url() . 'user/user_change_password/', array("id" => "customer_alert_threshold", "name" => "user_change_password")); |
|
115 | - $form[gettext('Change Password')] = array( |
|
116 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
117 | - array(gettext('Old Password'), 'INPUT', array('name' => 'password', 'size' => '20', 'class' => "text field medium", 'id' => 'new_password'), 'required|password_check[accounts]', 'tOOL TIP', '', ''), |
|
118 | - array(gettext('New Password'), 'INPUT', array('name' => 'new_password', 'size' => '20', 'class' => "text field medium", 'id' => 'new_password'), 'required|', 'tOOL TIP', '', ''), |
|
119 | - array(gettext('Confirm Password'), 'INPUT', array('name' => 'new_confirm_password', 'size' => '20', 'class' => "text field medium", 'id' => 'password'), "required|matches[new_password]", 'tOOL TIP', '', ''), |
|
120 | - ); |
|
121 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
122 | - return $form; |
|
123 | - } |
|
113 | + function get_userprofile_change_password() { |
|
114 | + $form['forms'] = array(base_url() . 'user/user_change_password/', array("id" => "customer_alert_threshold", "name" => "user_change_password")); |
|
115 | + $form[gettext('Change Password')] = array( |
|
116 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
117 | + array(gettext('Old Password'), 'INPUT', array('name' => 'password', 'size' => '20', 'class' => "text field medium", 'id' => 'new_password'), 'required|password_check[accounts]', 'tOOL TIP', '', ''), |
|
118 | + array(gettext('New Password'), 'INPUT', array('name' => 'new_password', 'size' => '20', 'class' => "text field medium", 'id' => 'new_password'), 'required|', 'tOOL TIP', '', ''), |
|
119 | + array(gettext('Confirm Password'), 'INPUT', array('name' => 'new_confirm_password', 'size' => '20', 'class' => "text field medium", 'id' => 'password'), "required|matches[new_password]", 'tOOL TIP', '', ''), |
|
120 | + ); |
|
121 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
122 | + return $form; |
|
123 | + } |
|
124 | 124 | |
125 | - function build_user_invoices(){ |
|
126 | - $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
127 | - $currency_id=$account_info['currency_id']; |
|
128 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
129 | - $url=($this->CI->session->userdata('logintype')==0 )?"/user/user_invoice_download/":'/invoices/invoice_main_download/'; |
|
130 | - $grid_field_arr = json_encode(array( |
|
131 | - array(gettext("Number"),"110","id","id,'',type","invoices","build_concat_string","","true","center"), |
|
132 | - array(gettext("Type"),"100","id","id,'',type","invoices","build_concat_string","","true","center"), |
|
133 | - array(gettext("Generated Date"),"110","invoice_date","invoice_date","","get_invoice_date","","true","center"), |
|
125 | + function build_user_invoices(){ |
|
126 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
127 | + $currency_id=$account_info['currency_id']; |
|
128 | + $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
129 | + $url=($this->CI->session->userdata('logintype')==0 )?"/user/user_invoice_download/":'/invoices/invoice_main_download/'; |
|
130 | + $grid_field_arr = json_encode(array( |
|
131 | + array(gettext("Number"),"110","id","id,'',type","invoices","build_concat_string","","true","center"), |
|
132 | + array(gettext("Type"),"100","id","id,'',type","invoices","build_concat_string","","true","center"), |
|
133 | + array(gettext("Generated Date"),"110","invoice_date","invoice_date","","get_invoice_date","","true","center"), |
|
134 | 134 | array(gettext("From Date"),"100","from_date","from_date","","get_from_date","","true","center"), |
135 | 135 | array(gettext("Due Date"),"100","","","","","","true","center"), |
136 | 136 | array(gettext("Last Pay Date"),"100","","","","","","true","center"), |
137 | 137 | array(gettext("Amount")."($currency)","100","id","id","id","get_invoice_total","","true","right"), |
138 | 138 | array(gettext("Outstanding Amount")."<br>($currency)","150","","","","","","true","right"), |
139 | - array(gettext("Action"),"140","","","",array( |
|
140 | - "DOWNLOAD"=>array("url"=>$url,"mode"=>"single"), |
|
139 | + array(gettext("Action"),"140","","","",array( |
|
140 | + "DOWNLOAD"=>array("url"=>$url,"mode"=>"single"), |
|
141 | 141 | )) |
142 | 142 | )); |
143 | - return $grid_field_arr; |
|
144 | - } |
|
145 | - function build_user_invoices_search() |
|
146 | - { |
|
147 | - $form['forms'] = array("",array('id'=>"user_invoice_search")); |
|
148 | - $form['Search'] = array( |
|
149 | - array(gettext('From Date'), 'INPUT', array('name' => 'from_date[0]','id'=>'invoice_from_date','size' => '20', 'class' => "text field"), '', 'tOOL TIP', '', 'from_date[from_date-date]'), |
|
150 | - array(gettext('To Date'), 'INPUT', array('name' => 'to_date[1]','id'=>'invoice_to_date','size' => '20', 'class' => "text field"), '', 'tOOL TIP', '', 'to_date[to_date-date]'), |
|
151 | - array(gettext('Amount'), 'INPUT', array('name' => 'amount[amount]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'amount[amount-string]', '', '', '', 'search_string_type', ''), |
|
152 | - array(gettext('Generated Date'), 'INPUT', array('name' => 'invoice_date[0]','','size' => '20', 'class' => "text field",'id'=>'invoice_date'), '', 'tOOL TIP', '', 'invoice_date[invoice_date-date]'), |
|
153 | - array('', 'HIDDEN', 'ajax_search','1', '', '', ''), |
|
154 | - array('', 'HIDDEN', 'advance_search','1', '', '', '')); |
|
155 | - $form['button_search'] = array('name' => 'action', 'id'=>"user_invoice_search_btn",'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
156 | - $form['button_reset'] = array('name' => 'action','id'=>"id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
157 | - return $form; |
|
158 | - } |
|
159 | - function build_user_charge_history() { |
|
143 | + return $grid_field_arr; |
|
144 | + } |
|
145 | + function build_user_invoices_search() |
|
146 | + { |
|
147 | + $form['forms'] = array("",array('id'=>"user_invoice_search")); |
|
148 | + $form['Search'] = array( |
|
149 | + array(gettext('From Date'), 'INPUT', array('name' => 'from_date[0]','id'=>'invoice_from_date','size' => '20', 'class' => "text field"), '', 'tOOL TIP', '', 'from_date[from_date-date]'), |
|
150 | + array(gettext('To Date'), 'INPUT', array('name' => 'to_date[1]','id'=>'invoice_to_date','size' => '20', 'class' => "text field"), '', 'tOOL TIP', '', 'to_date[to_date-date]'), |
|
151 | + array(gettext('Amount'), 'INPUT', array('name' => 'amount[amount]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'amount[amount-string]', '', '', '', 'search_string_type', ''), |
|
152 | + array(gettext('Generated Date'), 'INPUT', array('name' => 'invoice_date[0]','','size' => '20', 'class' => "text field",'id'=>'invoice_date'), '', 'tOOL TIP', '', 'invoice_date[invoice_date-date]'), |
|
153 | + array('', 'HIDDEN', 'ajax_search','1', '', '', ''), |
|
154 | + array('', 'HIDDEN', 'advance_search','1', '', '', '')); |
|
155 | + $form['button_search'] = array('name' => 'action', 'id'=>"user_invoice_search_btn",'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
156 | + $form['button_reset'] = array('name' => 'action','id'=>"id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
157 | + return $form; |
|
158 | + } |
|
159 | + function build_user_charge_history() { |
|
160 | 160 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
161 | 161 | $currency_id=$account_info['currency_id']; |
162 | 162 | $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
163 | - $grid_field_arr = json_encode(array( |
|
164 | - array(gettext("Created Date"), "140", "created_date", "", "", ""), |
|
165 | - array(gettext("Invoice Number"), "120", "created_date", "", "", "","","true","center"), |
|
166 | - array(gettext("Charge Type"), "100", "item_type", "", "", ""), |
|
167 | - array(gettext("Before Balance")."<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency","","true","right"), |
|
168 | - array(gettext("Debit")."<br/>($currency)", "120", "debit", "debit", "debit", "convert_to_currency","","true","right"), |
|
169 | - array(gettext("Credit")."<br/>($currency)", "120", "credit", "credit", "credit", "convert_to_currency","","true","right"), |
|
170 | - array(gettext("After Balance")."<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency","","true","right"), |
|
171 | - array(gettext("Description"), "180", "description", "", "", ""), |
|
172 | - )); |
|
173 | - return $grid_field_arr; |
|
174 | - } |
|
175 | - function build_user_charge_history_search() { |
|
176 | - $form['forms'] = array("", array('id' => "user_charge_history_search")); |
|
177 | - $form['Search'] = array( |
|
178 | - array(gettext('From Date'), 'INPUT', array('name' => 'created_date[]', 'id' => 'charge_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
|
179 | - array(gettext('To Date'), 'INPUT', array('name' => 'created_date[]', 'id' => 'charge_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
|
163 | + $grid_field_arr = json_encode(array( |
|
164 | + array(gettext("Created Date"), "140", "created_date", "", "", ""), |
|
165 | + array(gettext("Invoice Number"), "120", "created_date", "", "", "","","true","center"), |
|
166 | + array(gettext("Charge Type"), "100", "item_type", "", "", ""), |
|
167 | + array(gettext("Before Balance")."<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency","","true","right"), |
|
168 | + array(gettext("Debit")."<br/>($currency)", "120", "debit", "debit", "debit", "convert_to_currency","","true","right"), |
|
169 | + array(gettext("Credit")."<br/>($currency)", "120", "credit", "credit", "credit", "convert_to_currency","","true","right"), |
|
170 | + array(gettext("After Balance")."<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency","","true","right"), |
|
171 | + array(gettext("Description"), "180", "description", "", "", ""), |
|
172 | + )); |
|
173 | + return $grid_field_arr; |
|
174 | + } |
|
175 | + function build_user_charge_history_search() { |
|
176 | + $form['forms'] = array("", array('id' => "user_charge_history_search")); |
|
177 | + $form['Search'] = array( |
|
178 | + array(gettext('From Date'), 'INPUT', array('name' => 'created_date[]', 'id' => 'charge_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
|
179 | + array(gettext('To Date'), 'INPUT', array('name' => 'created_date[]', 'id' => 'charge_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
|
180 | 180 | array(gettext('Debit '), 'INPUT', array('name' => 'debit[debit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'debit[debit-integer]', '', '', '', 'search_int_type', ''), |
181 | 181 | array(gettext('Credit '), 'INPUT', array('name' => 'credit[credit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit[credit-integer]', '', '', '', 'search_int_type', ''), |
182 | 182 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
183 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
184 | - ); |
|
185 | - $form['button_search'] = array('name' => 'action', 'id' => "charges_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
186 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
187 | - return $form; |
|
188 | - } |
|
183 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
184 | + ); |
|
185 | + $form['button_search'] = array('name' => 'action', 'id' => "charges_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
186 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
187 | + return $form; |
|
188 | + } |
|
189 | 189 | |
190 | - function build_user_subscription(){ |
|
191 | - $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
190 | + function build_user_subscription(){ |
|
191 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
192 | 192 | $currency_id=$account_info['currency_id']; |
193 | 193 | $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
194 | - $grid_field_arr = json_encode(array( |
|
194 | + $grid_field_arr = json_encode(array( |
|
195 | 195 | array(gettext("Name"), "335", "description", "", "", "","","true","center"), |
196 | - array(gettext("Amount")."($currency)", "335", "charge", "charge", "charge", "convert_to_currency","","true","right"), |
|
197 | - array(gettext("Billing Cycle"), "335", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"), |
|
198 | - )); |
|
199 | - return $grid_field_arr; |
|
200 | - } |
|
196 | + array(gettext("Amount")."($currency)", "335", "charge", "charge", "charge", "convert_to_currency","","true","right"), |
|
197 | + array(gettext("Billing Cycle"), "335", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"), |
|
198 | + )); |
|
199 | + return $grid_field_arr; |
|
200 | + } |
|
201 | 201 | |
202 | - function build_user_subscription_search() { |
|
203 | - $accountinfo = $this->CI->session->userdata("accountinfo"); |
|
204 | - $form['forms'] = array("", array('id' => "user_subscription_search")); |
|
205 | - $form['Search'] = array( |
|
206 | - array(gettext('Name'), 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
207 | - array(gettext('Amount'), 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''), |
|
208 | - array(gettext('Bill Cycle'), 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
202 | + function build_user_subscription_search() { |
|
203 | + $accountinfo = $this->CI->session->userdata("accountinfo"); |
|
204 | + $form['forms'] = array("", array('id' => "user_subscription_search")); |
|
205 | + $form['Search'] = array( |
|
206 | + array(gettext('Name'), 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
207 | + array(gettext('Amount'), 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''), |
|
208 | + array(gettext('Bill Cycle'), 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
209 | 209 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
210 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
211 | - ); |
|
212 | - $form['button_search'] = array('name' => 'action', 'id' => "user_subscriptions_button", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
213 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
210 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
211 | + ); |
|
212 | + $form['button_search'] = array('name' => 'action', 'id' => "user_subscriptions_button", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
213 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
214 | 214 | |
215 | - return $form; |
|
216 | - } |
|
215 | + return $form; |
|
216 | + } |
|
217 | 217 | |
218 | - function build_user_didlist() { |
|
219 | - $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
218 | + function build_user_didlist() { |
|
219 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
220 | 220 | $currency_id=$account_info['currency_id']; |
221 | 221 | $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
222 | - $grid_field_arr = json_encode(array( |
|
222 | + $grid_field_arr = json_encode(array( |
|
223 | 223 | array(gettext("DID"), "105", "number", "", "", "","","true","center"), |
224 | 224 | array(gettext("Country"), "90", "country_id", "country", "countrycode", "get_field_name","","true","center"), |
225 | 225 | array(gettext("Per Minute<br/>Cost")."($currency)", "90", "cost", "cost", "cost", "convert_to_currency","","true","right"), |
226 | 226 | array(gettext("Initial<br/>Increment"), "100", "init_inc", "", "", "","","true","center"), |
227 | - array(gettext("Increment"), "100", "inc", "", "", "","","true","center"), |
|
228 | - array(gettext("Setup<br/>Fee")."($currency)", "100", "setup", "setup", "setup", "convert_to_currency","","true","right"), |
|
229 | - array(gettext("Monthly<br/>Fee")."($currency)", "100", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"), |
|
230 | - array(gettext("Call Type"), "105", "call_type", "call_type", "call_type", "get_call_type","","true","center"), |
|
231 | - array(gettext("Destination"), "153", "extensions", "", "", "","","true","center"), |
|
232 | - array(gettext("Status"), "90", "status", "status", "dids", "get_did_status","","true","center"), |
|
233 | - array(gettext("Modified <br/>Date"), "100", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
234 | - array(gettext("Action"), "80", "", "", "", array("EDIT" => array("url" => "/user/user_did_edit/", "mode" => "popup"), |
|
235 | - "DELETE" => array("url" => "/user/user_dids_action/delete/", "mode" => "single"))) |
|
236 | - )); |
|
237 | - return $grid_field_arr; |
|
238 | - } |
|
227 | + array(gettext("Increment"), "100", "inc", "", "", "","","true","center"), |
|
228 | + array(gettext("Setup<br/>Fee")."($currency)", "100", "setup", "setup", "setup", "convert_to_currency","","true","right"), |
|
229 | + array(gettext("Monthly<br/>Fee")."($currency)", "100", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"), |
|
230 | + array(gettext("Call Type"), "105", "call_type", "call_type", "call_type", "get_call_type","","true","center"), |
|
231 | + array(gettext("Destination"), "153", "extensions", "", "", "","","true","center"), |
|
232 | + array(gettext("Status"), "90", "status", "status", "dids", "get_did_status","","true","center"), |
|
233 | + array(gettext("Modified <br/>Date"), "100", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
234 | + array(gettext("Action"), "80", "", "", "", array("EDIT" => array("url" => "/user/user_did_edit/", "mode" => "popup"), |
|
235 | + "DELETE" => array("url" => "/user/user_dids_action/delete/", "mode" => "single"))) |
|
236 | + )); |
|
237 | + return $grid_field_arr; |
|
238 | + } |
|
239 | 239 | |
240 | - function build_user_didlist_search() { |
|
241 | - $form['forms'] = array("", array('id' => "user_did_search")); |
|
242 | - $form['Search'] = array( |
|
243 | - array(gettext('DID'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
244 | - array(gettext('Country'), 'country_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
245 | - array(gettext('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', ''), |
|
246 | - array(gettext('Call Type'), 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '',''), |
|
247 | - array(gettext('Destination'), 'INPUT', array('name' => 'extensions[extensions]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'extensions[extensions-string]', '', '', '', 'search_string_type', ''), |
|
240 | + function build_user_didlist_search() { |
|
241 | + $form['forms'] = array("", array('id' => "user_did_search")); |
|
242 | + $form['Search'] = array( |
|
243 | + array(gettext('DID'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
244 | + array(gettext('Country'), 'country_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
245 | + array(gettext('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', ''), |
|
246 | + array(gettext('Call Type'), 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '',''), |
|
247 | + array(gettext('Destination'), 'INPUT', array('name' => 'extensions[extensions]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'extensions[extensions-string]', '', '', '', 'search_string_type', ''), |
|
248 | 248 | |
249 | - array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
|
250 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
251 | - ); |
|
249 | + array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
|
250 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
251 | + ); |
|
252 | 252 | |
253 | - $form['button_search'] = array('name' => 'action', 'id' => "user_did_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
254 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
253 | + $form['button_search'] = array('name' => 'action', 'id' => "user_did_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
254 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
255 | 255 | |
256 | - return $form; |
|
257 | - } |
|
256 | + return $form; |
|
257 | + } |
|
258 | 258 | |
259 | - function build_user_ipmap() { |
|
260 | - $grid_field_arr = json_encode(array( |
|
261 | - array(gettext("Name"), "240", "name", "", "", "","","true","center"), |
|
262 | - array(gettext("IP"), "240", "ip", "", "", "","","true","center"), |
|
263 | - array(gettext("Prefix"), "220", "prefix", "", "", "","","true","center"), |
|
264 | - array(gettext("Created Date"), "174", "created_date", "created_date", "created_date", "convert_GMT_to","","true","center"), |
|
265 | - array(gettext("Action"), "150", "", "", "", array("DELETE" => array("url" => "user/user_ipmap_action/delete/", "mode" => "single"))) |
|
266 | - )); |
|
267 | - return $grid_field_arr; |
|
268 | - } |
|
259 | + function build_user_ipmap() { |
|
260 | + $grid_field_arr = json_encode(array( |
|
261 | + array(gettext("Name"), "240", "name", "", "", "","","true","center"), |
|
262 | + array(gettext("IP"), "240", "ip", "", "", "","","true","center"), |
|
263 | + array(gettext("Prefix"), "220", "prefix", "", "", "","","true","center"), |
|
264 | + array(gettext("Created Date"), "174", "created_date", "created_date", "created_date", "convert_GMT_to","","true","center"), |
|
265 | + array(gettext("Action"), "150", "", "", "", array("DELETE" => array("url" => "user/user_ipmap_action/delete/", "mode" => "single"))) |
|
266 | + )); |
|
267 | + return $grid_field_arr; |
|
268 | + } |
|
269 | 269 | |
270 | - function build_user_ipmap_search() { |
|
271 | - $form['forms'] = array("", array('id' => "user_ipmap_search")); |
|
272 | - $form['Search'] = array( |
|
273 | - array(gettext('Name'), 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
274 | - array(gettext('IP'), 'INPUT', array('name' => 'ip[ip]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'ip[ip-string]', '', '', '', 'search_string_type', ''), |
|
275 | - array(gettext('Prefix'), 'INPUT', array('name' => 'prefix[prefix]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'prefix[prefix-string]', '', '', '', 'search_string_type', ''), |
|
270 | + function build_user_ipmap_search() { |
|
271 | + $form['forms'] = array("", array('id' => "user_ipmap_search")); |
|
272 | + $form['Search'] = array( |
|
273 | + array(gettext('Name'), 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
274 | + array(gettext('IP'), 'INPUT', array('name' => 'ip[ip]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'ip[ip-string]', '', '', '', 'search_string_type', ''), |
|
275 | + array(gettext('Prefix'), 'INPUT', array('name' => 'prefix[prefix]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'prefix[prefix-string]', '', '', '', 'search_string_type', ''), |
|
276 | 276 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
277 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
278 | - ); |
|
279 | - $form['button_search'] = array('name' => 'action', 'id' => "user_ipmap_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
277 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
278 | + ); |
|
279 | + $form['button_search'] = array('name' => 'action', 'id' => "user_ipmap_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
280 | 280 | $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => "btn btn-line-sky pull-right margin-x-10"); |
281 | - return $form; |
|
282 | - } |
|
281 | + return $form; |
|
282 | + } |
|
283 | 283 | |
284 | - function build_user_sipdevices(){ |
|
285 | - $grid_field_arr = json_encode(array( |
|
286 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
287 | - array(gettext("User Name"), "105", "username", "", "", "","","true","center"), |
|
288 | - array(gettext("Password"), "105", "password", "", "", "","","true","center"), |
|
289 | - array(gettext("Caller Name"), "110", "effective_caller_id_name", "", "", "","","true","center"), |
|
290 | - array(gettext("Caller Number"), "110", "effective_caller_id_number", "", "", "","","true","center"), |
|
291 | - array(gettext("Status"), "125", "status", "", "", "","","true","center"), |
|
292 | - array(gettext("Created Date"), "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
293 | - array(gettext("Modified Date"), "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
294 | - array(gettext("Voicemail"), "90", "voicemail_enabled", "", "", "","","true","center"), |
|
295 | - array(gettext("Action"), "110", "", "", "", array("EDIT" => array("url" => "/accounts/fssipdevices_action/edit/", "mode" => "single","layout"=>"medium"), |
|
296 | - "DELETE" => array("url" => "/accounts/fssipdevices_action/delete/", "mode" => "single"))) |
|
297 | - )); |
|
298 | - return $grid_field_arr; |
|
299 | - } |
|
284 | + function build_user_sipdevices(){ |
|
285 | + $grid_field_arr = json_encode(array( |
|
286 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
287 | + array(gettext("User Name"), "105", "username", "", "", "","","true","center"), |
|
288 | + array(gettext("Password"), "105", "password", "", "", "","","true","center"), |
|
289 | + array(gettext("Caller Name"), "110", "effective_caller_id_name", "", "", "","","true","center"), |
|
290 | + array(gettext("Caller Number"), "110", "effective_caller_id_number", "", "", "","","true","center"), |
|
291 | + array(gettext("Status"), "125", "status", "", "", "","","true","center"), |
|
292 | + array(gettext("Created Date"), "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
293 | + array(gettext("Modified Date"), "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
294 | + array(gettext("Voicemail"), "90", "voicemail_enabled", "", "", "","","true","center"), |
|
295 | + array(gettext("Action"), "110", "", "", "", array("EDIT" => array("url" => "/accounts/fssipdevices_action/edit/", "mode" => "single","layout"=>"medium"), |
|
296 | + "DELETE" => array("url" => "/accounts/fssipdevices_action/delete/", "mode" => "single"))) |
|
297 | + )); |
|
298 | + return $grid_field_arr; |
|
299 | + } |
|
300 | 300 | |
301 | - function build_user_sipdevices_search(){ |
|
302 | - $form['forms'] = array("", array('id' => "user_sipdevices_search")); |
|
303 | - $form['Search'] = array( |
|
304 | - array(gettext('Username'), 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
301 | + function build_user_sipdevices_search(){ |
|
302 | + $form['forms'] = array("", array('id' => "user_sipdevices_search")); |
|
303 | + $form['Search'] = array( |
|
304 | + array(gettext('Username'), 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
305 | 305 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
306 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
307 | - ); |
|
308 | - $form['button_search'] = array('name' => 'action', 'id' => "user_sipdevices_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
309 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
310 | - return $form; |
|
311 | - } |
|
306 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
307 | + ); |
|
308 | + $form['button_search'] = array('name' => 'action', 'id' => "user_sipdevices_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
309 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
310 | + return $form; |
|
311 | + } |
|
312 | 312 | |
313 | - function build_user_sipdevices_form($id=''){ |
|
313 | + function build_user_sipdevices_form($id=''){ |
|
314 | 314 | $val=$id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username'; |
315 | 315 | $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
316 | - $password = $this->CI->common->generate_password(); |
|
317 | - $form['forms'] = array(base_url() . 'user/user_sipdevices_save/', array("id" => "user_sipdevices_form", "name" => "user_sipdevices_form")); |
|
318 | - $form[gettext('Device Information')] = array( |
|
319 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
320 | - array(gettext('Username'), 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="color: #1BCB61;font-size: 14px;padding-left: 5px;padding-top: 8px;float: left;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
321 | - array(gettext('Password'), 'INPUT', array('name' => 'fs_password', 'size' => '20', 'value'=>$password ,'id'=>'password','class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="color: #1BCB61;font-size: 14px;padding-left: 5px;padding-top: 8px;float: left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
322 | - array(gettext('Caller Name'), 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
323 | - array(gettext('Caller Number'), 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
324 | - array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
325 | - ); |
|
316 | + $password = $this->CI->common->generate_password(); |
|
317 | + $form['forms'] = array(base_url() . 'user/user_sipdevices_save/', array("id" => "user_sipdevices_form", "name" => "user_sipdevices_form")); |
|
318 | + $form[gettext('Device Information')] = array( |
|
319 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
320 | + array(gettext('Username'), 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="color: #1BCB61;font-size: 14px;padding-left: 5px;padding-top: 8px;float: left;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
321 | + array(gettext('Password'), 'INPUT', array('name' => 'fs_password', 'size' => '20', 'value'=>$password ,'id'=>'password','class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="color: #1BCB61;font-size: 14px;padding-left: 5px;padding-top: 8px;float: left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
322 | + array(gettext('Caller Name'), 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
323 | + array(gettext('Caller Number'), 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
324 | + array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
325 | + ); |
|
326 | 326 | |
327 | - $form[gettext('Voicemail Options')] = array( |
|
328 | - array(gettext('Enable'), 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
329 | - array(gettext('Password'), 'INPUT', array('name' => 'voicemail_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
330 | - array(gettext('Mail To'), 'INPUT', array('name' => 'voicemail_mail_to', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
331 | - array(gettext('Attach File'), 'voicemail_attach_file', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
332 | - array(gettext('Local After Email'), 'vm_keep_local_after_email', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
333 | - array(gettext('Send all Message'), 'vm_send_all_message', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
327 | + $form[gettext('Voicemail Options')] = array( |
|
328 | + array(gettext('Enable'), 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
329 | + array(gettext('Password'), 'INPUT', array('name' => 'voicemail_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
330 | + array(gettext('Mail To'), 'INPUT', array('name' => 'voicemail_mail_to', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
331 | + array(gettext('Attach File'), 'voicemail_attach_file', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
332 | + array(gettext('Local After Email'), 'vm_keep_local_after_email', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
333 | + array(gettext('Send all Message'), 'vm_send_all_message', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_sip_config_option'), |
|
334 | 334 | |
335 | - ); |
|
336 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
337 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
338 | - return $form; |
|
339 | - } |
|
335 | + ); |
|
336 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
337 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
338 | + return $form; |
|
339 | + } |
|
340 | 340 | |
341 | - function build_user_animap() { |
|
342 | - $grid_field_arr = json_encode(array(array(gettext("Caller ID"), "735", "number", "", "", "","","true","center"), |
|
343 | - array(gettext("Action"), "275", "", "", "", array("DELETE" => array("url" => "user/user_animap_action/delete/", "mode" => "single"))) |
|
344 | - )); |
|
345 | - return $grid_field_arr; |
|
346 | - } |
|
341 | + function build_user_animap() { |
|
342 | + $grid_field_arr = json_encode(array(array(gettext("Caller ID"), "735", "number", "", "", "","","true","center"), |
|
343 | + array(gettext("Action"), "275", "", "", "", array("DELETE" => array("url" => "user/user_animap_action/delete/", "mode" => "single"))) |
|
344 | + )); |
|
345 | + return $grid_field_arr; |
|
346 | + } |
|
347 | 347 | |
348 | - function user_rates_list_buttons() { |
|
349 | - $buttons_json = json_encode(array( |
|
350 | - array(gettext("Export CSV"),"btn btn-xing" ,"fa fa-download fa-lg", "button_action", "/user/user_rates_list_export/", 'single') |
|
351 | - )); |
|
352 | - return $buttons_json; |
|
353 | - } |
|
348 | + function user_rates_list_buttons() { |
|
349 | + $buttons_json = json_encode(array( |
|
350 | + array(gettext("Export CSV"),"btn btn-xing" ,"fa fa-download fa-lg", "button_action", "/user/user_rates_list_export/", 'single') |
|
351 | + )); |
|
352 | + return $buttons_json; |
|
353 | + } |
|
354 | 354 | |
355 | - function user_rates_list() { |
|
356 | - $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
357 | - $currency_id=$account_info['currency_id']; |
|
358 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
359 | - $grid_field_arr = json_encode(array(array(gettext("Code"), "155", "pattern", "pattern", "", "get_only_numeric_val","","true","center"), |
|
360 | - array(gettext("Destination"), "200", "comment", "", "", "","","true","center"), |
|
361 | - array(gettext("Connect Cost")."($currency)", "200", "connectcost", "", "", "","","true","right"), |
|
362 | - array(gettext("Included Seconds"), "200", "includedseconds", "", "", "","","true","center"), |
|
363 | - array(gettext("Per Minute Cost")."($currency)", "200", "cost", "", "", "","","true","right"), |
|
364 | - array(gettext("Initial Increment"), "130", "init_inc", "", "", "","","true","center"), |
|
365 | - array(gettext("Increment"), "180", "inc", "", "", "","","true","center") |
|
355 | + function user_rates_list() { |
|
356 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
357 | + $currency_id=$account_info['currency_id']; |
|
358 | + $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
359 | + $grid_field_arr = json_encode(array(array(gettext("Code"), "155", "pattern", "pattern", "", "get_only_numeric_val","","true","center"), |
|
360 | + array(gettext("Destination"), "200", "comment", "", "", "","","true","center"), |
|
361 | + array(gettext("Connect Cost")."($currency)", "200", "connectcost", "", "", "","","true","right"), |
|
362 | + array(gettext("Included Seconds"), "200", "includedseconds", "", "", "","","true","center"), |
|
363 | + array(gettext("Per Minute Cost")."($currency)", "200", "cost", "", "", "","","true","right"), |
|
364 | + array(gettext("Initial Increment"), "130", "init_inc", "", "", "","","true","center"), |
|
365 | + array(gettext("Increment"), "180", "inc", "", "", "","","true","center") |
|
366 | 366 | )); |
367 | - return $grid_field_arr; |
|
368 | - } |
|
367 | + return $grid_field_arr; |
|
368 | + } |
|
369 | 369 | |
370 | - function user_rates_list_search() { |
|
371 | - $form['forms'] = array("", array('id' => "user_rates_list_search")); |
|
372 | - $form['Search'] = array( |
|
370 | + function user_rates_list_search() { |
|
371 | + $form['forms'] = array("", array('id' => "user_rates_list_search")); |
|
372 | + $form['Search'] = array( |
|
373 | 373 | array(gettext('Code'), 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_int_type', ''), |
374 | 374 | array(gettext('Destination'), 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''), |
375 | 375 | array(gettext('Connect Cost'), 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''), |
@@ -377,241 +377,241 @@ discard block |
||
377 | 377 | array(gettext('Per Minute Cost'), 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''), |
378 | 378 | array(gettext('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', ''), |
379 | 379 | array(gettext('Increment'), 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''), |
380 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
381 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
382 | - ); |
|
380 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
381 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
382 | + ); |
|
383 | 383 | |
384 | - $form['button_search'] = array('name' => 'action', 'id' => "user_rates_list_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
385 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
384 | + $form['button_search'] = array('name' => 'action', 'id' => "user_rates_list_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
385 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
386 | 386 | |
387 | - return $form; |
|
388 | - } |
|
387 | + return $form; |
|
388 | + } |
|
389 | 389 | |
390 | - function user_alert_threshold(){ |
|
391 | - $form['forms'] = array(base_url() . 'user/user_alert_threshold/', array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold")); |
|
392 | - $form[gettext('Low Balance Alert Email')] = array( |
|
393 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
394 | - array(gettext('Enable Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
|
395 | - array(gettext('Low Balance Alert Level'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
396 | - array(gettext('Email Address'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
397 | - ); |
|
398 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
399 | - return $form; |
|
400 | - } |
|
401 | - function build_cdrs_report($type) { |
|
390 | + function user_alert_threshold(){ |
|
391 | + $form['forms'] = array(base_url() . 'user/user_alert_threshold/', array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold")); |
|
392 | + $form[gettext('Low Balance Alert Email')] = array( |
|
393 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
394 | + array(gettext('Enable Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
|
395 | + array(gettext('Low Balance Alert Level'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
396 | + array(gettext('Email Address'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
397 | + ); |
|
398 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
399 | + return $form; |
|
400 | + } |
|
401 | + function build_cdrs_report($type) { |
|
402 | 402 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
403 | - $currency_id=$account_info['currency_id']; |
|
404 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
403 | + $currency_id=$account_info['currency_id']; |
|
404 | + $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
405 | 405 | |
406 | - if($type == '0' || $type =='1'){ |
|
407 | - $cost_array=array(gettext("Debit")."($currency)", "140", "debit", "debit", "debit", "convert_to_currency","","true","right"); |
|
408 | - } |
|
409 | - if($type =='3'){ |
|
410 | - $cost_array=array(gettext("Debit")."($currency)", "140", "cost", "cost", "cost", "convert_to_currency","","true","right"); |
|
411 | - } |
|
412 | - $grid_field_arr = json_encode(array( |
|
406 | + if($type == '0' || $type =='1'){ |
|
407 | + $cost_array=array(gettext("Debit")."($currency)", "140", "debit", "debit", "debit", "convert_to_currency","","true","right"); |
|
408 | + } |
|
409 | + if($type =='3'){ |
|
410 | + $cost_array=array(gettext("Debit")."($currency)", "140", "cost", "cost", "cost", "convert_to_currency","","true","right"); |
|
411 | + } |
|
412 | + $grid_field_arr = json_encode(array( |
|
413 | 413 | array(gettext("Date"), "170", "callstart", "callstart", "callstart", "convert_GMT_to","","true","center"), |
414 | - array(gettext("Caller ID"), "110", "callerid", "", "", "","","true","center"), |
|
415 | - array(gettext("Called Number"), "160", "callednum", "", "", "","","true","center"), |
|
416 | - array(gettext("Destination"), "160", "notes", "", "", "","","true","center"), |
|
417 | - array(gettext("Duration"), "140", "billseconds", "user_cdrs_report_search", "billseconds", "convert_to_show_in","","true","center"), |
|
418 | - $cost_array, |
|
419 | - array(gettext("Disposition"), "160", "disposition", "", "", "","","true","center"), |
|
420 | - array(gettext("Call Type"), "233", "calltype", "", "", "","","true","center"), |
|
421 | - )); |
|
422 | - return $grid_field_arr; |
|
423 | - } |
|
414 | + array(gettext("Caller ID"), "110", "callerid", "", "", "","","true","center"), |
|
415 | + array(gettext("Called Number"), "160", "callednum", "", "", "","","true","center"), |
|
416 | + array(gettext("Destination"), "160", "notes", "", "", "","","true","center"), |
|
417 | + array(gettext("Duration"), "140", "billseconds", "user_cdrs_report_search", "billseconds", "convert_to_show_in","","true","center"), |
|
418 | + $cost_array, |
|
419 | + array(gettext("Disposition"), "160", "disposition", "", "", "","","true","center"), |
|
420 | + array(gettext("Call Type"), "233", "calltype", "", "", "","","true","center"), |
|
421 | + )); |
|
422 | + return $grid_field_arr; |
|
423 | + } |
|
424 | 424 | |
425 | - function build_cdrs_report_search($type) { |
|
426 | - if($type == '0' || $type =='1'){ |
|
427 | - $cost_array=array(gettext('Debit'), 'INPUT', array('name' => 'debit[debit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'debit[debit-integer]', '', '', '', 'search_int_type', ''); |
|
428 | - } |
|
429 | - if($type =='3'){ |
|
430 | - $cost_array=array(gettext('Debit'), 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''); |
|
431 | - } |
|
432 | - $form['forms'] = array("", array('id' => "user_cdrs_report_search")); |
|
433 | - $form['Search'] = array( |
|
434 | - array(gettext('From Date'), 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
|
435 | - array(gettext('To Date'), 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
|
436 | - array(gettext('Caller ID'), 'INPUT', array('name' => 'callerid[callerid]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'callerid[callerid-string]', '', '', '', 'search_string_type', ''), |
|
437 | - array(gettext('Called Number'), 'INPUT', array('name' => 'callednum[callednum]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'callednum[callednum-string]', '', '', '', 'search_string_type', ''), |
|
438 | - array(gettext('Destination'), 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-integer]', '', '', '', 'search_int_type', ''), |
|
439 | - array(gettext('Duration'), 'INPUT', array('name' => 'billseconds[billseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'billseconds[billseconds-integer]', '', '', '', 'search_int_type', ''), |
|
440 | - $cost_array, |
|
441 | - array(gettext('Disposition'), 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'), |
|
442 | - array(gettext('Call Type'), 'calltype', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_calltype'), |
|
443 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
444 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
445 | - ); |
|
425 | + function build_cdrs_report_search($type) { |
|
426 | + if($type == '0' || $type =='1'){ |
|
427 | + $cost_array=array(gettext('Debit'), 'INPUT', array('name' => 'debit[debit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'debit[debit-integer]', '', '', '', 'search_int_type', ''); |
|
428 | + } |
|
429 | + if($type =='3'){ |
|
430 | + $cost_array=array(gettext('Debit'), 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''); |
|
431 | + } |
|
432 | + $form['forms'] = array("", array('id' => "user_cdrs_report_search")); |
|
433 | + $form['Search'] = array( |
|
434 | + array(gettext('From Date'), 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
|
435 | + array(gettext('To Date'), 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
|
436 | + array(gettext('Caller ID'), 'INPUT', array('name' => 'callerid[callerid]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'callerid[callerid-string]', '', '', '', 'search_string_type', ''), |
|
437 | + array(gettext('Called Number'), 'INPUT', array('name' => 'callednum[callednum]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'callednum[callednum-string]', '', '', '', 'search_string_type', ''), |
|
438 | + array(gettext('Destination'), 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-integer]', '', '', '', 'search_int_type', ''), |
|
439 | + array(gettext('Duration'), 'INPUT', array('name' => 'billseconds[billseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'billseconds[billseconds-integer]', '', '', '', 'search_int_type', ''), |
|
440 | + $cost_array, |
|
441 | + array(gettext('Disposition'), 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'), |
|
442 | + array(gettext('Call Type'), 'calltype', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_calltype'), |
|
443 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
444 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
445 | + ); |
|
446 | 446 | $form['display_in']=array('name' => 'search_in',"id"=>"search_in","function"=>"search_report_in", "content"=>gettext("Display records in"),'label_class' => "search_label col-md-3 no-padding","dropdown_class"=>"form-control","label_style"=>"font-size:13px;","dropdown_style"=>"background: #ddd; width: 21% !important;"); |
447 | - $form['button_search'] = array('name' => 'action', 'id' => "user_cdr_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
448 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
449 | - return $form; |
|
450 | - } |
|
451 | - function build_cdrs_report_buttons() { |
|
452 | - $buttons_json = json_encode(array(array(gettext("Export"),"btn btn-xing" ," fa fa-download fa-lg", "button_action", "/user/user_report_export/", 'single'))); |
|
453 | - return $buttons_json; |
|
454 | - } |
|
447 | + $form['button_search'] = array('name' => 'action', 'id' => "user_cdr_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
448 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
449 | + return $form; |
|
450 | + } |
|
451 | + function build_cdrs_report_buttons() { |
|
452 | + $buttons_json = json_encode(array(array(gettext("Export"),"btn btn-xing" ," fa fa-download fa-lg", "button_action", "/user/user_report_export/", 'single'))); |
|
453 | + return $buttons_json; |
|
454 | + } |
|
455 | 455 | |
456 | - function build_user_refill_report(){ |
|
456 | + function build_user_refill_report(){ |
|
457 | 457 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
458 | 458 | $currency_id=$account_info['currency_id']; |
459 | 459 | $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
460 | - $grid_field_arr = json_encode(array( |
|
461 | - array(gettext("Date"), "220", "payment_date", "", "", "","","true","center"), |
|
462 | - array(gettext("Amount")."($currency)", "220", "credit", "credit", "credit", "convert_to_currency","","true","right"), |
|
463 | - array(gettext("Refill By"), "270", "payment_by", "payment_by", "payment_by", "get_refill_by","","true","center"), |
|
464 | - array(gettext("Note"), "300", "notes", "", "", "","","true","center") |
|
465 | - )); |
|
466 | - return $grid_field_arr; |
|
467 | - } |
|
460 | + $grid_field_arr = json_encode(array( |
|
461 | + array(gettext("Date"), "220", "payment_date", "", "", "","","true","center"), |
|
462 | + array(gettext("Amount")."($currency)", "220", "credit", "credit", "credit", "convert_to_currency","","true","right"), |
|
463 | + array(gettext("Refill By"), "270", "payment_by", "payment_by", "payment_by", "get_refill_by","","true","center"), |
|
464 | + array(gettext("Note"), "300", "notes", "", "", "","","true","center") |
|
465 | + )); |
|
466 | + return $grid_field_arr; |
|
467 | + } |
|
468 | 468 | |
469 | - function build_user_refill_report_search() { |
|
470 | - $form['forms'] = array("", array('id' => "user_refill_report_search")); |
|
471 | - $form['Search'] = array( |
|
472 | - array(gettext('From Date'), 'INPUT', array('name' => 'payment_date[]', 'id' => 'customer_cdr_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'payment_date[payment_date-date]'), |
|
473 | - array(gettext('To Date'), 'INPUT', array('name' => 'payment_date[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'payment_date[payment_date-date]'), |
|
474 | - array(gettext('Amount'), 'INPUT', array('name' => 'credit[credit]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'credit[credit-integer]', '', '', '', 'search_int_type', ''), |
|
475 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
476 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
469 | + function build_user_refill_report_search() { |
|
470 | + $form['forms'] = array("", array('id' => "user_refill_report_search")); |
|
471 | + $form['Search'] = array( |
|
472 | + array(gettext('From Date'), 'INPUT', array('name' => 'payment_date[]', 'id' => 'customer_cdr_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'payment_date[payment_date-date]'), |
|
473 | + array(gettext('To Date'), 'INPUT', array('name' => 'payment_date[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'payment_date[payment_date-date]'), |
|
474 | + array(gettext('Amount'), 'INPUT', array('name' => 'credit[credit]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'credit[credit-integer]', '', '', '', 'search_int_type', ''), |
|
475 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
476 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
477 | 477 | |
478 | - $form['button_search'] = array('name' => 'action', 'id' => "user_refill_report_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
479 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
480 | - return $form; |
|
481 | - } |
|
478 | + $form['button_search'] = array('name' => 'action', 'id' => "user_refill_report_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
479 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
480 | + return $form; |
|
481 | + } |
|
482 | 482 | |
483 | - function build_user_fund_transfer_form($number, $currency_id, $id) { |
|
484 | - $form['forms'] = array(base_url() . 'user/user_fund_transfer_save/', array('id' => 'user_fund_transfer_form', 'method' => 'POST','class'=>'build_user_fund_transfer_frm' ,'name' => 'user_fund_transfer_form')); |
|
485 | - $form[gettext('Fund Transfer')] = array( |
|
486 | - array('', 'HIDDEN', array('name' => 'id', 'value' => $id), '', '', '', ''), |
|
487 | - array('', 'HIDDEN', array('name' => 'account_currency', 'value' => $currency_id), '', '', ''), |
|
488 | - array(gettext('From Account'), 'INPUT', array('name' => 'fromaccountid', 'size' => '20', 'value' => $number, 'readonly' => true, 'class' => "text field medium"), 'required', 'tOOL TIP', 'Please Enter account number'), |
|
489 | - array(gettext('To Account'), 'INPUT', array('name' => 'toaccountid', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', 'Please Enter to account number'), |
|
490 | - array(gettext('Amount'), 'INPUT', array('name' => 'credit', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', ''), |
|
491 | - array(gettext('Note'), 'TEXTAREA', array('name' => 'notes', 'size' => '20', 'cols' => '63', 'rows' => '5', 'class' => "form-control col-md-5 text field medium",'style'=>'height: 80px;'), '', 'tOOL TIP', '') |
|
492 | - ); |
|
493 | - $form['button_save'] = array('name' => 'action', 'content' => 'Transfer', 'value' => gettext('save'), 'id' => "submit", 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
494 | - return $form; |
|
495 | - } |
|
483 | + function build_user_fund_transfer_form($number, $currency_id, $id) { |
|
484 | + $form['forms'] = array(base_url() . 'user/user_fund_transfer_save/', array('id' => 'user_fund_transfer_form', 'method' => 'POST','class'=>'build_user_fund_transfer_frm' ,'name' => 'user_fund_transfer_form')); |
|
485 | + $form[gettext('Fund Transfer')] = array( |
|
486 | + array('', 'HIDDEN', array('name' => 'id', 'value' => $id), '', '', '', ''), |
|
487 | + array('', 'HIDDEN', array('name' => 'account_currency', 'value' => $currency_id), '', '', ''), |
|
488 | + array(gettext('From Account'), 'INPUT', array('name' => 'fromaccountid', 'size' => '20', 'value' => $number, 'readonly' => true, 'class' => "text field medium"), 'required', 'tOOL TIP', 'Please Enter account number'), |
|
489 | + array(gettext('To Account'), 'INPUT', array('name' => 'toaccountid', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', 'Please Enter to account number'), |
|
490 | + array(gettext('Amount'), 'INPUT', array('name' => 'credit', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', ''), |
|
491 | + array(gettext('Note'), 'TEXTAREA', array('name' => 'notes', 'size' => '20', 'cols' => '63', 'rows' => '5', 'class' => "form-control col-md-5 text field medium",'style'=>'height: 80px;'), '', 'tOOL TIP', '') |
|
492 | + ); |
|
493 | + $form['button_save'] = array('name' => 'action', 'content' => 'Transfer', 'value' => gettext('save'), 'id' => "submit", 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
494 | + return $form; |
|
495 | + } |
|
496 | 496 | |
497 | - function build_user_opensips_buttons() { |
|
498 | - $buttons_json = json_encode(array( |
|
499 | - array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/user/user_opensips_add/", "popup"), |
|
500 | - array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/user/user_opensips_delete_multiple/"), |
|
501 | - )); |
|
502 | - return $buttons_json; |
|
503 | - } |
|
504 | - function build_user_opensips() { |
|
505 | - $grid_field_arr = json_encode(array( |
|
506 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
507 | - array("Username", "240", "username", "", "", "","","true","center"), |
|
508 | - array("Password", "240", "password", "", "", "","","true","center"), |
|
509 | - array("Domain", "240", "domain", "", "", "","","true","center"), |
|
510 | - array("Action", "200", "", "", "", |
|
511 | - array("EDIT" => array("url" => 'user/user_opensips_edit/', "mode" => "popup"), |
|
512 | - "DELETE" => array("url" => 'user/user_opensips_delete/', "mode" => "popup") |
|
513 | - )))); |
|
514 | - return $grid_field_arr; |
|
515 | - } |
|
497 | + function build_user_opensips_buttons() { |
|
498 | + $buttons_json = json_encode(array( |
|
499 | + array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/user/user_opensips_add/", "popup"), |
|
500 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/user/user_opensips_delete_multiple/"), |
|
501 | + )); |
|
502 | + return $buttons_json; |
|
503 | + } |
|
504 | + function build_user_opensips() { |
|
505 | + $grid_field_arr = json_encode(array( |
|
506 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
507 | + array("Username", "240", "username", "", "", "","","true","center"), |
|
508 | + array("Password", "240", "password", "", "", "","","true","center"), |
|
509 | + array("Domain", "240", "domain", "", "", "","","true","center"), |
|
510 | + array("Action", "200", "", "", "", |
|
511 | + array("EDIT" => array("url" => 'user/user_opensips_edit/', "mode" => "popup"), |
|
512 | + "DELETE" => array("url" => 'user/user_opensips_delete/', "mode" => "popup") |
|
513 | + )))); |
|
514 | + return $grid_field_arr; |
|
515 | + } |
|
516 | 516 | |
517 | - function build_user_opensips_form($id = false) { |
|
518 | - $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username'; |
|
519 | - $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
|
520 | - $password = $this->CI->common->generate_password(); |
|
521 | - $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
522 | - $form['forms'] = array(base_url() . 'user/user_opensips_save/', array("id" => "opensips_form", "name" => "opensips_form")); |
|
523 | - $form['Opensips Device'] = array( |
|
517 | + function build_user_opensips_form($id = false) { |
|
518 | + $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username'; |
|
519 | + $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
|
520 | + $password = $this->CI->common->generate_password(); |
|
521 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
522 | + $form['forms'] = array(base_url() . 'user/user_opensips_save/', array("id" => "opensips_form", "name" => "opensips_form")); |
|
523 | + $form['Opensips Device'] = array( |
|
524 | 524 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
525 | 525 | array('', 'HIDDEN', array('name' => 'accountcode', 'value' =>$accountinfo['number']), '', '', '', ''), |
526 | 526 | array('Username', 'INPUT', array('name' => 'username', 'size' => '20', 'id' => 'username', 'value' => $uname_user, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
527 | 527 | array('Password', 'PASSWORD', array('name' => 'password', 'size' => '20', 'id' => 'password1', 'value' => $password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
528 | 528 | array('Domain', 'INPUT', array('name' => 'domain', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
529 | 529 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
530 | - ); |
|
531 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
532 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
533 | - return $form; |
|
534 | - } |
|
535 | - function build_user_opensips_search() { |
|
536 | - $form['forms'] = array("", array('id' => "opensips_list_search")); |
|
537 | - $form['Search'] = array( |
|
538 | - array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
539 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
540 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
541 | - ); |
|
530 | + ); |
|
531 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
532 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
533 | + return $form; |
|
534 | + } |
|
535 | + function build_user_opensips_search() { |
|
536 | + $form['forms'] = array("", array('id' => "opensips_list_search")); |
|
537 | + $form['Search'] = array( |
|
538 | + array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
539 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
540 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
541 | + ); |
|
542 | 542 | |
543 | - $form['button_search'] = array('name' => 'action', 'id' => "opensipsdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
544 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
543 | + $form['button_search'] = array('name' => 'action', 'id' => "opensipsdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
544 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
545 | 545 | |
546 | - return $form; |
|
547 | - } |
|
548 | - function build_user_did_form(){ |
|
549 | - $form['forms'] = array(base_url() . 'user/user_dids_action/edit/', array("id" => "user_did_form", "name" => "user_did_form")); |
|
550 | - $form['Edit'] = array( |
|
546 | + return $form; |
|
547 | + } |
|
548 | + function build_user_did_form(){ |
|
549 | + $form['forms'] = array(base_url() . 'user/user_dids_action/edit/', array("id" => "user_did_form", "name" => "user_did_form")); |
|
550 | + $form['Edit'] = array( |
|
551 | 551 | array('', 'HIDDEN', array('name' => 'free_didlist'),'', '', '', ''), |
552 | 552 | array(gettext('DID'), 'INPUT', array('name' => 'number', 'size' => '20', 'class' => "text field medium","readonly"=>"true"), 'trim|required|is_numeric|xss_clean|integer', 'tOOL TIP', 'Please Enter account number'), |
553 | 553 | array(gettext('Call Type'), 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type', ''), |
554 | 554 | array(gettext('Destination'), 'INPUT', array('name' => 'extensions', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
555 | - ); |
|
556 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
557 | - return $form; |
|
555 | + ); |
|
556 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'button', 'id' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
557 | + return $form; |
|
558 | 558 | |
559 | - } |
|
559 | + } |
|
560 | 560 | |
561 | - function build_provider_report_buttons() { |
|
562 | - $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/user/user_provider_cdrreport_export/", 'single'))); |
|
563 | - return $buttons_json; |
|
564 | - } |
|
561 | + function build_provider_report_buttons() { |
|
562 | + $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/user/user_provider_cdrreport_export/", 'single'))); |
|
563 | + return $buttons_json; |
|
564 | + } |
|
565 | 565 | |
566 | 566 | |
567 | - function build_provider_report($type) { |
|
567 | + function build_provider_report($type) { |
|
568 | 568 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
569 | - $currency_id=$account_info['currency_id']; |
|
570 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
569 | + $currency_id=$account_info['currency_id']; |
|
570 | + $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
571 | 571 | |
572 | - if($type == '0' || $type =='1'){ |
|
573 | - $cost_array=array("Debit($currency)", "140", "debit", "debit", "debit", "convert_to_currency","","true","right"); |
|
574 | - } |
|
575 | - if($type =='3'){ |
|
576 | - $cost_array=array("Cost($currency)", "140", "cost", "cost", "cost", "convert_to_currency","","true","right"); |
|
577 | - } |
|
578 | - $grid_field_arr = json_encode(array( |
|
572 | + if($type == '0' || $type =='1'){ |
|
573 | + $cost_array=array("Debit($currency)", "140", "debit", "debit", "debit", "convert_to_currency","","true","right"); |
|
574 | + } |
|
575 | + if($type =='3'){ |
|
576 | + $cost_array=array("Cost($currency)", "140", "cost", "cost", "cost", "convert_to_currency","","true","right"); |
|
577 | + } |
|
578 | + $grid_field_arr = json_encode(array( |
|
579 | 579 | array("Date", "170", "callstart", "callstart", "callstart", "convert_GMT_to","","true","center"), |
580 | - array("Caller ID", "110", "callerid", "", "", "","","true","center"), |
|
581 | - array("Called Number", "160", "callednum", "", "", "","","true","center"), |
|
582 | - array("Destination", "160", "notes", "", "", "","","true","center"), |
|
583 | - array("Duration", "140", "billseconds", "user_provider_cdrs_report_search", "billseconds", "convert_to_show_in","","true","center"), |
|
584 | - $cost_array, |
|
585 | - array("Disposition", "160", "disposition", "", "", "","","true","center"), |
|
586 | - array("Call Type", "233", "calltype", "", "", "","","true","center"), |
|
587 | - )); |
|
588 | - return $grid_field_arr; |
|
589 | - } |
|
580 | + array("Caller ID", "110", "callerid", "", "", "","","true","center"), |
|
581 | + array("Called Number", "160", "callednum", "", "", "","","true","center"), |
|
582 | + array("Destination", "160", "notes", "", "", "","","true","center"), |
|
583 | + array("Duration", "140", "billseconds", "user_provider_cdrs_report_search", "billseconds", "convert_to_show_in","","true","center"), |
|
584 | + $cost_array, |
|
585 | + array("Disposition", "160", "disposition", "", "", "","","true","center"), |
|
586 | + array("Call Type", "233", "calltype", "", "", "","","true","center"), |
|
587 | + )); |
|
588 | + return $grid_field_arr; |
|
589 | + } |
|
590 | 590 | |
591 | 591 | |
592 | - function build_provider_report_search($type) { |
|
592 | + function build_provider_report_search($type) { |
|
593 | 593 | |
594 | - $cost_array=array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''); |
|
595 | - $form['forms'] = array("", array('id' => "user_provider_cdrs_report_search")); |
|
596 | - $form['Search'] = array( |
|
597 | - array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
|
598 | - array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
|
599 | - array('Caller ID', 'INPUT', array('name' => 'callerid[callerid]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'callerid[callerid-string]', '', '', '', 'search_string_type', ''), |
|
600 | - array('Called Number', 'INPUT', array('name' => 'callednum[callednum]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'callednum[callednum-string]', '', '', '', 'search_string_type', ''), |
|
601 | - array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-integer]', '', '', '', 'search_int_type', ''), |
|
602 | - array('Duration', 'INPUT', array('name' => 'billseconds[billseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'billseconds[billseconds-integer]', '', '', '', 'search_int_type', ''), |
|
603 | - $cost_array, |
|
604 | - array('Disposition', 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'), |
|
605 | - array('Call Type', 'calltype', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_calltype'), |
|
594 | + $cost_array=array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''); |
|
595 | + $form['forms'] = array("", array('id' => "user_provider_cdrs_report_search")); |
|
596 | + $form['Search'] = array( |
|
597 | + array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
|
598 | + array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
|
599 | + array('Caller ID', 'INPUT', array('name' => 'callerid[callerid]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'callerid[callerid-string]', '', '', '', 'search_string_type', ''), |
|
600 | + array('Called Number', 'INPUT', array('name' => 'callednum[callednum]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'callednum[callednum-string]', '', '', '', 'search_string_type', ''), |
|
601 | + array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-integer]', '', '', '', 'search_int_type', ''), |
|
602 | + array('Duration', 'INPUT', array('name' => 'billseconds[billseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'billseconds[billseconds-integer]', '', '', '', 'search_int_type', ''), |
|
603 | + $cost_array, |
|
604 | + array('Disposition', 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'), |
|
605 | + array('Call Type', 'calltype', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_calltype'), |
|
606 | 606 | |
607 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
608 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
609 | - ); |
|
607 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
608 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
609 | + ); |
|
610 | 610 | $form['display_in']=array('name' => 'search_in',"id"=>"search_in","function"=>"search_report_in", "content"=>"Display records in",'label_class' => "search_label col-md-3 no-padding","dropdown_class"=>"form-control","label_style"=>"font-size:13px;","dropdown_style"=>"background: #ddd; width: 21% !important;"); |
611 | - $form['button_search'] = array('name' => 'action', 'id' => "user_provider_cdr_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
612 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
613 | - return $form; |
|
614 | - } |
|
611 | + $form['button_search'] = array('name' => 'action', 'id' => "user_provider_cdr_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
612 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
613 | + return $form; |
|
614 | + } |
|
615 | 615 | |
616 | 616 | |
617 | 617 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | <div class="pull-left"> |
44 | 44 | <ul class="breadcrumb"> |
45 | 45 | <?php $accountinfo=$this->session->userdata('accountinfo'); |
46 | - if($accountinfo['type']==1){ ?> |
|
46 | + if($accountinfo['type']==1){ ?> |
|
47 | 47 | <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
48 | 48 | <?php }else{ ?> |
49 | 49 | <li><a href="#">Billing</a></li> |
@@ -3,8 +3,8 @@ |
||
3 | 3 | <?php echo $page_title; ?> |
4 | 4 | <? endblock() ?> |
5 | 5 | <?php |
6 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
7 | - $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
6 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
7 | + $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | <? startblock('extra_head') ?> |
@@ -50,8 +50,8 @@ |
||
50 | 50 | <span class="ui-icon ui-icon-circle-arrow-s"></span></div> |
51 | 51 | <div style="color:red;margin-left: 60px;"> |
52 | 52 | <?php if (isset($validation_errors)) { |
53 | - echo $validation_errors; |
|
54 | - } ?> |
|
53 | + echo $validation_errors; |
|
54 | + } ?> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | </div> |
@@ -22,12 +22,12 @@ |
||
22 | 22 | <div class="pull-left"> |
23 | 23 | <ul class="breadcrumb"> |
24 | 24 | <?php $accountinfo=$this->session->userdata('accountinfo'); |
25 | - if($accountinfo['type']==1){ ?> |
|
25 | + if($accountinfo['type']==1){ ?> |
|
26 | 26 | <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
27 | 27 | <?php }else{ ?> |
28 | 28 | <li><a href="#">Configuration</a></li> |
29 | 29 | <?php } |
30 | - ?> |
|
30 | + ?> |
|
31 | 31 | |
32 | 32 | <li class='active'> |
33 | 33 | <a href="<?= base_url() . "user/user_ipmap/"; ?>">IP Settings</a> |
@@ -24,169 +24,169 @@ discard block |
||
24 | 24 | |
25 | 25 | class user_model extends CI_Model { |
26 | 26 | |
27 | - function user_model() { |
|
28 | - parent::__construct(); |
|
29 | - if(Common_model::$global_config['system_config']['opensips']==0){ |
|
27 | + function user_model() { |
|
28 | + parent::__construct(); |
|
29 | + if(Common_model::$global_config['system_config']['opensips']==0){ |
|
30 | 30 | $db_config = Common_model::$global_config['system_config']; |
31 | 31 | $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
32 | 32 | $this->opensips_db = $this->load->database($opensipdsn, true); |
33 | - } |
|
34 | - } |
|
33 | + } |
|
34 | + } |
|
35 | 35 | |
36 | - function validate_password($pass, $id) { |
|
37 | - $this->db->select('password'); |
|
38 | - $this->db->where('number', $id); |
|
39 | - $query = $this->db->get('accounts'); |
|
40 | - $count = $query->num_rows(); |
|
41 | - return $count; |
|
42 | - } |
|
36 | + function validate_password($pass, $id) { |
|
37 | + $this->db->select('password'); |
|
38 | + $this->db->where('number', $id); |
|
39 | + $query = $this->db->get('accounts'); |
|
40 | + $count = $query->num_rows(); |
|
41 | + return $count; |
|
42 | + } |
|
43 | 43 | |
44 | - function update_password($newpass, $id) { |
|
45 | - $this->db->update('password', $newpass); |
|
46 | - $this->db->where('number', $id); |
|
47 | - $result = $this->db->get('accounts'); |
|
48 | - return $result->result(); |
|
49 | - } |
|
44 | + function update_password($newpass, $id) { |
|
45 | + $this->db->update('password', $newpass); |
|
46 | + $this->db->where('number', $id); |
|
47 | + $result = $this->db->get('accounts'); |
|
48 | + return $result->result(); |
|
49 | + } |
|
50 | 50 | |
51 | - function change_password($id) { |
|
52 | - $this->db->select('password'); |
|
53 | - $this->db->where('id', $id); |
|
54 | - $query = $this->db->get('accounts'); |
|
55 | - $result = $query->result(); |
|
56 | - return $result; |
|
57 | - } |
|
51 | + function change_password($id) { |
|
52 | + $this->db->select('password'); |
|
53 | + $this->db->where('id', $id); |
|
54 | + $query = $this->db->get('accounts'); |
|
55 | + $result = $query->result(); |
|
56 | + return $result; |
|
57 | + } |
|
58 | 58 | |
59 | - function change_db_password($update, $id) { |
|
60 | - $this->db->where('id', $id); |
|
61 | - $this->db->update('accounts', array('password' => $update)); |
|
62 | - } |
|
59 | + function change_db_password($update, $id) { |
|
60 | + $this->db->where('id', $id); |
|
61 | + $this->db->update('accounts', array('password' => $update)); |
|
62 | + } |
|
63 | 63 | |
64 | - function edit_account($accountinfo, $edit_id) { |
|
65 | - unset($accountinfo['action']); |
|
66 | - $this->db->where('id', $edit_id); |
|
67 | - $result = $this->db->update('accounts', $accountinfo); |
|
68 | - return true; |
|
69 | - } |
|
64 | + function edit_account($accountinfo, $edit_id) { |
|
65 | + unset($accountinfo['action']); |
|
66 | + $this->db->where('id', $edit_id); |
|
67 | + $result = $this->db->update('accounts', $accountinfo); |
|
68 | + return true; |
|
69 | + } |
|
70 | 70 | |
71 | - function get_user_packages_list($flag, $start = 0, $limit = 0) { |
|
72 | - $this->db_model->build_search('package_list_search'); |
|
73 | - $account_data = $this->session->userdata("accountinfo"); |
|
74 | - $where = array("pricelist_id" => $account_data['pricelist_id']); |
|
75 | - if ($flag) { |
|
76 | - $query = $this->db_model->getSelect("*", "packages", $where, "id", "ASC", $limit, $start); |
|
77 | - } else { |
|
78 | - $query = $this->db_model->countQuery("*", "packages", $where); |
|
79 | - } |
|
80 | - return $query; |
|
81 | - } |
|
71 | + function get_user_packages_list($flag, $start = 0, $limit = 0) { |
|
72 | + $this->db_model->build_search('package_list_search'); |
|
73 | + $account_data = $this->session->userdata("accountinfo"); |
|
74 | + $where = array("pricelist_id" => $account_data['pricelist_id']); |
|
75 | + if ($flag) { |
|
76 | + $query = $this->db_model->getSelect("*", "packages", $where, "id", "ASC", $limit, $start); |
|
77 | + } else { |
|
78 | + $query = $this->db_model->countQuery("*", "packages", $where); |
|
79 | + } |
|
80 | + return $query; |
|
81 | + } |
|
82 | 82 | |
83 | - function get_user_invoices_list($flag, $start = 0, $limit = 0) { |
|
84 | - $this->db_model->build_search('user_invoice_list_search'); |
|
85 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
86 | - $reseller_id = $accountinfo['id']; |
|
87 | - $this->db->where('accountid', $reseller_id); |
|
88 | - if ($flag) { |
|
89 | - $this->db->select('*'); |
|
90 | - } else { |
|
91 | - $this->db->select('count(id) as count'); |
|
92 | - } |
|
93 | - if ($flag) { |
|
94 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
95 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
96 | - }else{ |
|
97 | - $this->db->order_by('invoice_date', 'desc'); |
|
98 | - } |
|
99 | - } |
|
100 | - $result = $this->db->get('invoices'); |
|
101 | - if ($result->num_rows() > 0) { |
|
102 | - if ($flag) { |
|
103 | - return $result; |
|
104 | - } else { |
|
105 | - $result = $result->result_array(); |
|
106 | - return $result[0]['count']; |
|
107 | - } |
|
108 | - } else { |
|
109 | - if ($flag) { |
|
110 | - $query = (object) array('num_rows' => 0); |
|
111 | - } else { |
|
112 | - $query = 0; |
|
113 | - } |
|
114 | - return $query; |
|
115 | - } |
|
116 | - } |
|
83 | + function get_user_invoices_list($flag, $start = 0, $limit = 0) { |
|
84 | + $this->db_model->build_search('user_invoice_list_search'); |
|
85 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
86 | + $reseller_id = $accountinfo['id']; |
|
87 | + $this->db->where('accountid', $reseller_id); |
|
88 | + if ($flag) { |
|
89 | + $this->db->select('*'); |
|
90 | + } else { |
|
91 | + $this->db->select('count(id) as count'); |
|
92 | + } |
|
93 | + if ($flag) { |
|
94 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
95 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
96 | + }else{ |
|
97 | + $this->db->order_by('invoice_date', 'desc'); |
|
98 | + } |
|
99 | + } |
|
100 | + $result = $this->db->get('invoices'); |
|
101 | + if ($result->num_rows() > 0) { |
|
102 | + if ($flag) { |
|
103 | + return $result; |
|
104 | + } else { |
|
105 | + $result = $result->result_array(); |
|
106 | + return $result[0]['count']; |
|
107 | + } |
|
108 | + } else { |
|
109 | + if ($flag) { |
|
110 | + $query = (object) array('num_rows' => 0); |
|
111 | + } else { |
|
112 | + $query = 0; |
|
113 | + } |
|
114 | + return $query; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - function get_user_charge_history($flag, $start = 0, $limit = 0) { |
|
119 | - $this->db_model->build_search('user_charge_history_search'); |
|
120 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
121 | - $where['accountid']=$accountinfo['id']; |
|
122 | - if($this->session->userdata('advance_search') != 1){ |
|
123 | - $where['created_date >=']=gmdate("Y-m-1 00:00:00"); |
|
124 | - $where['created_date <=']=gmdate("Y-m-d 23:59:59"); |
|
125 | - } |
|
118 | + function get_user_charge_history($flag, $start = 0, $limit = 0) { |
|
119 | + $this->db_model->build_search('user_charge_history_search'); |
|
120 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
121 | + $where['accountid']=$accountinfo['id']; |
|
122 | + if($this->session->userdata('advance_search') != 1){ |
|
123 | + $where['created_date >=']=gmdate("Y-m-1 00:00:00"); |
|
124 | + $where['created_date <=']=gmdate("Y-m-d 23:59:59"); |
|
125 | + } |
|
126 | 126 | $where['item_type <>']='STANDARD'; |
127 | - if ($flag) { |
|
128 | - $query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start); |
|
129 | - } else { |
|
130 | - $query = $this->db_model->countQuery("*", "invoice_details", $where); |
|
131 | - } |
|
132 | - return $query; |
|
133 | - } |
|
127 | + if ($flag) { |
|
128 | + $query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start); |
|
129 | + } else { |
|
130 | + $query = $this->db_model->countQuery("*", "invoice_details", $where); |
|
131 | + } |
|
132 | + return $query; |
|
133 | + } |
|
134 | 134 | |
135 | - function get_user_refill_list($flag, $start = '', $limit = '') { |
|
136 | - $this->db_model->build_search('user_refill_report_search'); |
|
137 | - $accountinfo = $this->session->userdata['accountinfo']; |
|
138 | - $where = array("accountid" => $accountinfo["id"]); |
|
139 | - if ($flag) { |
|
140 | - $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start); |
|
141 | - } else { |
|
142 | - $query = $this->db_model->countQuery("*", "payments", $where); |
|
143 | - } |
|
144 | - return $query; |
|
145 | - } |
|
135 | + function get_user_refill_list($flag, $start = '', $limit = '') { |
|
136 | + $this->db_model->build_search('user_refill_report_search'); |
|
137 | + $accountinfo = $this->session->userdata['accountinfo']; |
|
138 | + $where = array("accountid" => $accountinfo["id"]); |
|
139 | + if ($flag) { |
|
140 | + $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start); |
|
141 | + } else { |
|
142 | + $query = $this->db_model->countQuery("*", "payments", $where); |
|
143 | + } |
|
144 | + return $query; |
|
145 | + } |
|
146 | 146 | |
147 | - function get_user_emails_list($flag, $start = 0, $limit = 0) { |
|
148 | - $account_data = $this->session->userdata("accountinfo"); |
|
149 | - $this->db_model->build_search('user_emails_search'); |
|
147 | + function get_user_emails_list($flag, $start = 0, $limit = 0) { |
|
148 | + $account_data = $this->session->userdata("accountinfo"); |
|
149 | + $this->db_model->build_search('user_emails_search'); |
|
150 | 150 | |
151 | - $where = array('accountid' => $account_data['id']); |
|
152 | - if ($flag) { |
|
153 | - $query = $this->db_model->select("*", "mail_details", $where, "id", "DESC", $limit, $start); |
|
154 | - } else { |
|
155 | - $query = $this->db_model->countQuery("*", "mail_details", $where); |
|
156 | - } |
|
157 | - return $query; |
|
158 | - } |
|
151 | + $where = array('accountid' => $account_data['id']); |
|
152 | + if ($flag) { |
|
153 | + $query = $this->db_model->select("*", "mail_details", $where, "id", "DESC", $limit, $start); |
|
154 | + } else { |
|
155 | + $query = $this->db_model->countQuery("*", "mail_details", $where); |
|
156 | + } |
|
157 | + return $query; |
|
158 | + } |
|
159 | 159 | |
160 | - function add_invoice_config($add_array) { |
|
161 | - $result = $this->db->insert('invoice_conf', $add_array); |
|
162 | - return true; |
|
163 | - } |
|
160 | + function add_invoice_config($add_array) { |
|
161 | + $result = $this->db->insert('invoice_conf', $add_array); |
|
162 | + return true; |
|
163 | + } |
|
164 | 164 | |
165 | - function edit_invoice_config($add_array, $edit_id) { |
|
166 | - $this->db->where('id', $edit_id); |
|
167 | - $result = $this->db->update('invoice_conf', $add_array); |
|
168 | - return true; |
|
169 | - } |
|
165 | + function edit_invoice_config($add_array, $edit_id) { |
|
166 | + $this->db->where('id', $edit_id); |
|
167 | + $result = $this->db->update('invoice_conf', $add_array); |
|
168 | + return true; |
|
169 | + } |
|
170 | 170 | |
171 | - function edit_alert_threshold($add_array, $edit_id) { |
|
172 | - $this->db->where('id', $edit_id); |
|
173 | - $result = $this->db->update('accounts', $add_array); |
|
174 | - return true; |
|
175 | - } |
|
171 | + function edit_alert_threshold($add_array, $edit_id) { |
|
172 | + $this->db->where('id', $edit_id); |
|
173 | + $result = $this->db->update('accounts', $add_array); |
|
174 | + return true; |
|
175 | + } |
|
176 | 176 | |
177 | - function user_ipmap_list($flag,$limit='',$start=''){ |
|
178 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
179 | - $where['accountid']=$accountinfo['id']; |
|
180 | - $this->db_model->build_search('user_ipmap_search'); |
|
181 | - if ($flag) { |
|
182 | - $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start); |
|
183 | - } else { |
|
184 | - $query = $this->db_model->countQuery("*", "ip_map", $where); |
|
185 | - } |
|
186 | - return $query; |
|
187 | - } |
|
188 | - function user_sipdevices_list($flag, $accountid = "",$start = "", $limit = "") { |
|
189 | - $where = array("accountid" => $accountid); |
|
177 | + function user_ipmap_list($flag,$limit='',$start=''){ |
|
178 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
179 | + $where['accountid']=$accountinfo['id']; |
|
180 | + $this->db_model->build_search('user_ipmap_search'); |
|
181 | + if ($flag) { |
|
182 | + $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start); |
|
183 | + } else { |
|
184 | + $query = $this->db_model->countQuery("*", "ip_map", $where); |
|
185 | + } |
|
186 | + return $query; |
|
187 | + } |
|
188 | + function user_sipdevices_list($flag, $accountid = "",$start = "", $limit = "") { |
|
189 | + $where = array("accountid" => $accountid); |
|
190 | 190 | $this->db_model->build_search('user_sipdevices_search'); |
191 | 191 | $query = array(); |
192 | 192 | if ($flag) { |
@@ -218,30 +218,30 @@ discard block |
||
218 | 218 | $query = $this->db_model->countQuery("*", "sip_devices", $where); |
219 | 219 | } |
220 | 220 | return $query; |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | - function user_sipdevice_info($edit_id){ |
|
224 | - $sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array('id' => $edit_id)); |
|
225 | - $sipdevice_arr = (array)$sipdevice_info->first_row(); |
|
226 | - $vars = (array)json_decode($sipdevice_arr['dir_vars']); |
|
227 | - $params = (array)json_decode($sipdevice_arr['dir_params'],true); |
|
228 | - $query = array('id' => $sipdevice_arr['id'], |
|
229 | - 'fs_username' => $sipdevice_arr['username'], |
|
230 | - 'accountcode' => $sipdevice_arr['accountid'], |
|
231 | - 'status' => $sipdevice_arr['status'], |
|
232 | - 'effective_caller_id_name' => $vars['effective_caller_id_name'], |
|
233 | - 'effective_caller_id_number' => $vars['effective_caller_id_number'], |
|
234 | - 'voicemail_enabled' => $params['vm-enabled'], |
|
235 | - 'voicemail_password' => $params['vm-password'], |
|
236 | - 'voicemail_mail_to' => $params['vm-mailto'], |
|
237 | - 'voicemail_attach_file' => $params['vm-attach-file'], |
|
238 | - 'vm_keep_local_after_email' => $params['vm-keep-local-after-email'], |
|
239 | - 'vm_send_all_message' => $params['vm-email-all-messages'], |
|
240 | - 'fs_password' => $params['password']); |
|
241 | - return $query; |
|
242 | - } |
|
243 | - function user_sipdevice_add($add_array){ |
|
244 | - $account_data = $this->session->userdata("accountinfo"); |
|
223 | + function user_sipdevice_info($edit_id){ |
|
224 | + $sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array('id' => $edit_id)); |
|
225 | + $sipdevice_arr = (array)$sipdevice_info->first_row(); |
|
226 | + $vars = (array)json_decode($sipdevice_arr['dir_vars']); |
|
227 | + $params = (array)json_decode($sipdevice_arr['dir_params'],true); |
|
228 | + $query = array('id' => $sipdevice_arr['id'], |
|
229 | + 'fs_username' => $sipdevice_arr['username'], |
|
230 | + 'accountcode' => $sipdevice_arr['accountid'], |
|
231 | + 'status' => $sipdevice_arr['status'], |
|
232 | + 'effective_caller_id_name' => $vars['effective_caller_id_name'], |
|
233 | + 'effective_caller_id_number' => $vars['effective_caller_id_number'], |
|
234 | + 'voicemail_enabled' => $params['vm-enabled'], |
|
235 | + 'voicemail_password' => $params['vm-password'], |
|
236 | + 'voicemail_mail_to' => $params['vm-mailto'], |
|
237 | + 'voicemail_attach_file' => $params['vm-attach-file'], |
|
238 | + 'vm_keep_local_after_email' => $params['vm-keep-local-after-email'], |
|
239 | + 'vm_send_all_message' => $params['vm-email-all-messages'], |
|
240 | + 'fs_password' => $params['password']); |
|
241 | + return $query; |
|
242 | + } |
|
243 | + function user_sipdevice_add($add_array){ |
|
244 | + $account_data = $this->session->userdata("accountinfo"); |
|
245 | 245 | $parms_array = array('password' => $add_array['fs_password'], |
246 | 246 | 'vm-enabled' => $add_array['voicemail_enabled'], |
247 | 247 | 'vm-password' => $add_array['voicemail_password'], |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | 'vm-email-all-messages' => $add_array['vm_send_all_message']); |
252 | 252 | $add_array['status'] = isset($add_array['status'])?$add_array['status']:"0"; |
253 | 253 | $parms_array_vars = array('effective_caller_id_name' => $add_array['effective_caller_id_name'], |
254 | - 'effective_caller_id_number' => $add_array['effective_caller_id_number'], |
|
255 | - 'user_context' => 'default'); |
|
254 | + 'effective_caller_id_number' => $add_array['effective_caller_id_number'], |
|
255 | + 'user_context' => 'default'); |
|
256 | 256 | |
257 | 257 | $new_array = array('creation_date'=>gmdate('Y-m-d H:i:s'), |
258 | - 'username' => $add_array['fs_username'], |
|
259 | - 'accountid' => $account_data['id'], |
|
260 | - 'status' => $add_array['status'], |
|
261 | - 'dir_params' => json_encode($parms_array), |
|
262 | - 'dir_vars' => json_encode($parms_array_vars), |
|
263 | - 'sip_profile_id' => $this->common->get_field_name('id','sip_profiles',array('name'=>'default'))); |
|
258 | + 'username' => $add_array['fs_username'], |
|
259 | + 'accountid' => $account_data['id'], |
|
260 | + 'status' => $add_array['status'], |
|
261 | + 'dir_params' => json_encode($parms_array), |
|
262 | + 'dir_vars' => json_encode($parms_array_vars), |
|
263 | + 'sip_profile_id' => $this->common->get_field_name('id','sip_profiles',array('name'=>'default'))); |
|
264 | 264 | $this->db->insert('sip_devices', $new_array); |
265 | 265 | $this->common->mail_to_users('add_sip_device', $account_data); |
266 | 266 | return true; |
267 | - } |
|
268 | - function user_sipdevice_edit($add_array){ |
|
267 | + } |
|
268 | + function user_sipdevice_edit($add_array){ |
|
269 | 269 | $parms_array = array('password' => $add_array['fs_password'], |
270 | 270 | 'vm-enabled' => $add_array['voicemail_enabled'], |
271 | 271 | 'vm-password' => $add_array['voicemail_password'], |
@@ -286,68 +286,68 @@ discard block |
||
286 | 286 | 'dir_vars' => json_encode($parms_array_vars), 'sip_profile_id' => $add_array['sip_profile_id']); |
287 | 287 | $this->db->update('sip_devices', $new_array,array('id'=>$add_array['id'])); |
288 | 288 | return true; |
289 | - } |
|
290 | - function getuser_cdrs_list($flag, $start, $limit,$export=true) { |
|
291 | - $this->db_model->build_search('user_cdrs_report_search'); |
|
292 | - $account_data = $this->session->userdata("accountinfo"); |
|
293 | - $field_name='debit'; |
|
294 | - if($account_data['type']==0 || $account_data['type']==1){ |
|
295 | - $where['accountid']=$account_data['id']; |
|
289 | + } |
|
290 | + function getuser_cdrs_list($flag, $start, $limit,$export=true) { |
|
291 | + $this->db_model->build_search('user_cdrs_report_search'); |
|
292 | + $account_data = $this->session->userdata("accountinfo"); |
|
293 | + $field_name='debit'; |
|
294 | + if($account_data['type']==0 || $account_data['type']==1){ |
|
295 | + $where['accountid']=$account_data['id']; |
|
296 | 296 | |
297 | - } |
|
298 | - if($account_data['type']==3){ |
|
299 | - $where['provider_id']=$account_data['id']; |
|
300 | - $field_name='cost'; |
|
301 | - } |
|
302 | - $table_name=$account_data['type'] !=1 ? 'cdrs': 'reseller_cdrs'; |
|
303 | - if($this->session->userdata('advance_search') != 1){ |
|
304 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
305 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
306 | - } |
|
307 | - $this->db->where($where); |
|
308 | - $this->db->order_by("callstart desc"); |
|
309 | - if ($flag) { |
|
310 | - if (!$export) |
|
311 | - $this->db->limit($limit, $start); |
|
312 | - $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
313 | - }else { |
|
314 | - $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
315 | - } |
|
316 | - $result = $this->db->get($table_name); |
|
317 | - return $result; |
|
318 | - } |
|
297 | + } |
|
298 | + if($account_data['type']==3){ |
|
299 | + $where['provider_id']=$account_data['id']; |
|
300 | + $field_name='cost'; |
|
301 | + } |
|
302 | + $table_name=$account_data['type'] !=1 ? 'cdrs': 'reseller_cdrs'; |
|
303 | + if($this->session->userdata('advance_search') != 1){ |
|
304 | + $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
305 | + $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
306 | + } |
|
307 | + $this->db->where($where); |
|
308 | + $this->db->order_by("callstart desc"); |
|
309 | + if ($flag) { |
|
310 | + if (!$export) |
|
311 | + $this->db->limit($limit, $start); |
|
312 | + $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
313 | + }else { |
|
314 | + $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
315 | + } |
|
316 | + $result = $this->db->get($table_name); |
|
317 | + return $result; |
|
318 | + } |
|
319 | 319 | |
320 | - function user_fund_transfer($data){ |
|
320 | + function user_fund_transfer($data){ |
|
321 | 321 | $accountinfo = $this->session->userdata['accountinfo']; |
322 | - $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ; |
|
323 | - $data['accountid'] = $data['id']; |
|
324 | - $data['payment_mode'] = $data['payment_type']; |
|
325 | - unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
326 | - if (isset($data)) { |
|
327 | - $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
328 | - $date = gmdate('Y-m-d H:i:s'); |
|
329 | - $accountid=$data['accountid']; |
|
330 | - while($accountid > 0 ){ |
|
331 | - $customer_id=$accountid; |
|
332 | - $accountid=$this->common_model->get_parent_info($accountid); |
|
333 | - $parent_id=$accountid > 0 ? $accountid : -1; |
|
334 | - $balance = $this->db_model->update_balance($data['credit'], $customer_id,$data['payment_mode']); |
|
335 | - if($data['payment_mode'] == 0){ |
|
336 | - $insert_arr = array("accountid" => $customer_id, |
|
337 | - "credit" => $data['credit'], |
|
338 | - 'payment_mode'=>$data['payment_mode'], |
|
339 | - 'type'=>"SYSTEM", |
|
340 | - "notes" => $data['notes'], |
|
341 | - "payment_date" => $date, |
|
342 | - 'payment_by'=>$parent_id, |
|
343 | - ); |
|
344 | - return $this->db->insert("payments", $insert_arr); |
|
345 | - } |
|
346 | - } |
|
347 | - } |
|
348 | - } |
|
349 | - function user_dashboard_recent_recharge_info() |
|
350 | - { |
|
322 | + $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ; |
|
323 | + $data['accountid'] = $data['id']; |
|
324 | + $data['payment_mode'] = $data['payment_type']; |
|
325 | + unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
326 | + if (isset($data)) { |
|
327 | + $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
328 | + $date = gmdate('Y-m-d H:i:s'); |
|
329 | + $accountid=$data['accountid']; |
|
330 | + while($accountid > 0 ){ |
|
331 | + $customer_id=$accountid; |
|
332 | + $accountid=$this->common_model->get_parent_info($accountid); |
|
333 | + $parent_id=$accountid > 0 ? $accountid : -1; |
|
334 | + $balance = $this->db_model->update_balance($data['credit'], $customer_id,$data['payment_mode']); |
|
335 | + if($data['payment_mode'] == 0){ |
|
336 | + $insert_arr = array("accountid" => $customer_id, |
|
337 | + "credit" => $data['credit'], |
|
338 | + 'payment_mode'=>$data['payment_mode'], |
|
339 | + 'type'=>"SYSTEM", |
|
340 | + "notes" => $data['notes'], |
|
341 | + "payment_date" => $date, |
|
342 | + 'payment_by'=>$parent_id, |
|
343 | + ); |
|
344 | + return $this->db->insert("payments", $insert_arr); |
|
345 | + } |
|
346 | + } |
|
347 | + } |
|
348 | + } |
|
349 | + function user_dashboard_recent_recharge_info() |
|
350 | + { |
|
351 | 351 | $accountinfo=$this->session->userdata('accountinfo'); |
352 | 352 | $userlevel_logintype=$this->session->userdata('userlevel_logintype'); |
353 | 353 | |
@@ -358,132 +358,132 @@ discard block |
||
358 | 358 | if($userlevel_logintype == 0 || $userlevel_logintype == 3){ |
359 | 359 | $where_arr=array('accountid'=>$accountinfo['id']); |
360 | 360 | } |
361 | - $this->db->where($where_arr); |
|
362 | - $this->db->select('id,accountid,credit,payment_date,notes'); |
|
363 | - $this->db->from('payments'); |
|
364 | - $this->db->limit(10); |
|
365 | - $this->db->order_by('payment_date','desc'); |
|
361 | + $this->db->where($where_arr); |
|
362 | + $this->db->select('id,accountid,credit,payment_date,notes'); |
|
363 | + $this->db->from('payments'); |
|
364 | + $this->db->limit(10); |
|
365 | + $this->db->order_by('payment_date','desc'); |
|
366 | 366 | return $this->db->get(); |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | - function get_user_rates_list($flag, $start = 0, $limit = 0) { |
|
370 | - $this->db_model->build_search('user_rates_list_search'); |
|
371 | - $account_data = $this->session->userdata("accountinfo"); |
|
372 | - $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0'); |
|
373 | - if ($flag) { |
|
374 | - $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
|
375 | - } else { |
|
376 | - $query = $this->db_model->countQuery("*", "routes", $where); |
|
377 | - } |
|
378 | - return $query; |
|
379 | - } |
|
380 | - function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") { |
|
381 | - $this->db_model->build_search_opensips($this->opensips_db,'user_opensips_search'); |
|
382 | - $this->opensips_db->where('accountcode',$account_number); |
|
383 | - if ($flag) { |
|
384 | - $this->opensips_db->limit($limit,$start); |
|
385 | - } |
|
386 | - $result = $this->opensips_db->get("subscriber"); |
|
387 | - if($result->num_rows() > 0){ |
|
369 | + function get_user_rates_list($flag, $start = 0, $limit = 0) { |
|
370 | + $this->db_model->build_search('user_rates_list_search'); |
|
371 | + $account_data = $this->session->userdata("accountinfo"); |
|
372 | + $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0'); |
|
373 | + if ($flag) { |
|
374 | + $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
|
375 | + } else { |
|
376 | + $query = $this->db_model->countQuery("*", "routes", $where); |
|
377 | + } |
|
378 | + return $query; |
|
379 | + } |
|
380 | + function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") { |
|
381 | + $this->db_model->build_search_opensips($this->opensips_db,'user_opensips_search'); |
|
382 | + $this->opensips_db->where('accountcode',$account_number); |
|
383 | + if ($flag) { |
|
384 | + $this->opensips_db->limit($limit,$start); |
|
385 | + } |
|
386 | + $result = $this->opensips_db->get("subscriber"); |
|
387 | + if($result->num_rows() > 0){ |
|
388 | 388 | if($flag){ |
389 | - return $result; |
|
389 | + return $result; |
|
390 | 390 | } |
391 | 391 | else{ |
392 | - return $result->num_rows(); |
|
392 | + return $result->num_rows(); |
|
393 | 393 | } |
394 | - }else{ |
|
395 | - if($flag){ |
|
396 | - $result=(object)array('num_rows'=>0); |
|
394 | + }else{ |
|
395 | + if($flag){ |
|
396 | + $result=(object)array('num_rows'=>0); |
|
397 | 397 | } |
398 | 398 | else{ |
399 | - $result=0; |
|
399 | + $result=0; |
|
400 | 400 | } |
401 | 401 | return $result; |
402 | - } |
|
403 | - } |
|
404 | - function user_opensips_add($data) { |
|
405 | - unset($data["action"]); |
|
406 | - $data['creation_date']=gmdate("Y-m-d H:i:s"); |
|
407 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
402 | + } |
|
403 | + } |
|
404 | + function user_opensips_add($data) { |
|
405 | + unset($data["action"]); |
|
406 | + $data['creation_date']=gmdate("Y-m-d H:i:s"); |
|
407 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
408 | 408 | $data['reseller_id']=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
409 | - $this->opensips_db->insert("subscriber", $data); |
|
410 | - } |
|
409 | + $this->opensips_db->insert("subscriber", $data); |
|
410 | + } |
|
411 | 411 | |
412 | - function user_opensips_edit($data, $id) { |
|
413 | - unset($data["action"]); |
|
414 | - $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain']); |
|
415 | - $this->opensips_db->where("id", $id); |
|
416 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
417 | - $this->opensips_db->update("subscriber", $data); |
|
418 | - } |
|
419 | - function user_opensips_delete($id) { |
|
420 | - $this->opensips_db->where("id", $id); |
|
421 | - $this->opensips_db->delete("subscriber"); |
|
422 | - return true; |
|
423 | - } |
|
424 | - function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
412 | + function user_opensips_edit($data, $id) { |
|
413 | + unset($data["action"]); |
|
414 | + $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain']); |
|
415 | + $this->opensips_db->where("id", $id); |
|
416 | + $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
417 | + $this->opensips_db->update("subscriber", $data); |
|
418 | + } |
|
419 | + function user_opensips_delete($id) { |
|
420 | + $this->opensips_db->where("id", $id); |
|
421 | + $this->opensips_db->delete("subscriber"); |
|
422 | + return true; |
|
423 | + } |
|
424 | + function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
425 | 425 | $this->db_model->build_search('user_invoice_list_search'); |
426 | 426 | $accountinfo=$this->session->userdata('accountinfo'); |
427 | - $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
427 | + $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
428 | 428 | $this->db->where($where); |
429 | 429 | $or_where= "(type='I' OR type='R')"; |
430 | 430 | $this->db->where($or_where); |
431 | - if ($flag) { |
|
432 | - $query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start); |
|
431 | + if ($flag) { |
|
432 | + $query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start); |
|
433 | 433 | |
434 | - } else { |
|
435 | - $query = $this->db_model->countQuery("*", "invoices", ""); |
|
436 | - } |
|
434 | + } else { |
|
435 | + $query = $this->db_model->countQuery("*", "invoices", ""); |
|
436 | + } |
|
437 | 437 | |
438 | - return $query; |
|
439 | - } |
|
440 | - function get_user_cdrs_info($flag,$accountid,$start = 0, $limit = 0){ |
|
441 | - if ($flag) { |
|
442 | - $query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start); |
|
438 | + return $query; |
|
439 | + } |
|
440 | + function get_user_cdrs_info($flag,$accountid,$start = 0, $limit = 0){ |
|
441 | + if ($flag) { |
|
442 | + $query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start); |
|
443 | 443 | |
444 | - } else { |
|
445 | - $query = $this->db_model->countQuery("*", "invoices", ""); |
|
446 | - } |
|
444 | + } else { |
|
445 | + $query = $this->db_model->countQuery("*", "invoices", ""); |
|
446 | + } |
|
447 | 447 | |
448 | - } |
|
449 | - function get_invoiceconf($accountid) { |
|
450 | - $return_array=array(); |
|
448 | + } |
|
449 | + function get_invoiceconf($accountid) { |
|
450 | + $return_array=array(); |
|
451 | 451 | $logintype = $this->session->userdata('logintype'); |
452 | - if ($logintype == 1 || $logintype == 5) { |
|
452 | + if ($logintype == 1 || $logintype == 5) { |
|
453 | 453 | |
454 | 454 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
455 | - }else{ |
|
456 | - $where=array('id'=> $accountid); |
|
455 | + }else{ |
|
456 | + $where=array('id'=> $accountid); |
|
457 | 457 | } |
458 | - $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
459 | - foreach($query->result_array() as $key => $value) |
|
460 | - { |
|
461 | - $return_array=$value; |
|
462 | - } |
|
463 | - return $return_array; |
|
464 | - } |
|
458 | + $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
459 | + foreach($query->result_array() as $key => $value) |
|
460 | + { |
|
461 | + $return_array=$value; |
|
462 | + } |
|
463 | + return $return_array; |
|
464 | + } |
|
465 | 465 | |
466 | 466 | |
467 | - function getprovider_cdrs_list($flag, $start, $limit,$export=true) { |
|
468 | - $this->db_model->build_search('user_provider_cdrs_report_search'); |
|
469 | - $account_data = $this->session->userdata("accountinfo"); |
|
470 | - $where['provider_id']=$account_data['id']; |
|
471 | - if($this->session->userdata('advance_search') != 1){ |
|
472 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
473 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
474 | - } |
|
475 | - $this->db->where($where); |
|
476 | - $this->db->order_by("callstart","desc"); |
|
477 | - if ($flag) { |
|
478 | - if (!$export) |
|
479 | - $this->db->limit($limit, $start); |
|
480 | - $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
481 | - }else { |
|
482 | - $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
483 | - } |
|
484 | - $result = $this->db->get('cdrs'); |
|
485 | - return $result; |
|
486 | - } |
|
467 | + function getprovider_cdrs_list($flag, $start, $limit,$export=true) { |
|
468 | + $this->db_model->build_search('user_provider_cdrs_report_search'); |
|
469 | + $account_data = $this->session->userdata("accountinfo"); |
|
470 | + $where['provider_id']=$account_data['id']; |
|
471 | + if($this->session->userdata('advance_search') != 1){ |
|
472 | + $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
473 | + $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
474 | + } |
|
475 | + $this->db->where($where); |
|
476 | + $this->db->order_by("callstart","desc"); |
|
477 | + if ($flag) { |
|
478 | + if (!$export) |
|
479 | + $this->db->limit($limit, $start); |
|
480 | + $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
|
481 | + }else { |
|
482 | + $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
|
483 | + } |
|
484 | + $result = $this->db->get('cdrs'); |
|
485 | + return $result; |
|
486 | + } |
|
487 | 487 | |
488 | 488 | } |
489 | 489 |
@@ -22,77 +22,77 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | class Systems extends CI_Controller { |
24 | 24 | |
25 | - function Systems() { |
|
26 | - parent::__construct(); |
|
25 | + function Systems() { |
|
26 | + parent::__construct(); |
|
27 | 27 | |
28 | - $this->load->helper('template_inheritance'); |
|
28 | + $this->load->helper('template_inheritance'); |
|
29 | 29 | $this->load->helper('file'); |
30 | - $this->load->library('session'); |
|
31 | - $this->load->library("system_form"); |
|
32 | - $this->load->library('astpp/form'); |
|
33 | - $this->load->model('system_model'); |
|
34 | - $this->load->dbutil(); |
|
35 | - |
|
36 | - if ($this->session->userdata('user_login') == FALSE) |
|
37 | - redirect(base_url() . '/astpp/login'); |
|
38 | - } |
|
39 | - |
|
40 | - function configuration_edit($edit_id = '') { |
|
41 | - $data['page_title'] = 'Edit Settings'; |
|
42 | - $where = array('id' => $edit_id); |
|
43 | - $account = $this->db_model->getSelect("*", "system", $where); |
|
44 | - foreach ($account->result_array() as $key => $value) { |
|
45 | - $edit_data = $value; |
|
46 | - } |
|
47 | - $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $edit_data); |
|
48 | - $this->load->view('view_configuration_add_edit', $data); |
|
49 | - } |
|
50 | - |
|
51 | - function configuration_search() { |
|
52 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
53 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
54 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
55 | - $action = $this->input->post(); |
|
56 | - unset($action['action']); |
|
57 | - unset($action['advance_search']); |
|
58 | - $this->session->set_userdata('configuration_search', $action); |
|
59 | - } |
|
60 | - if (@$ajax_search != 1) { |
|
61 | - redirect(base_url() . 'systems/configuration/'); |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - function configuration_clearsearchfilter() { |
|
66 | - $this->session->set_userdata('advance_search', 0); |
|
67 | - $this->session->set_userdata('did_search', ""); |
|
68 | - } |
|
69 | - |
|
70 | - function configuration_save() { |
|
71 | - $add_array = $this->input->post(); |
|
72 | - $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $add_array); |
|
73 | - if ($add_array['id'] != '') { |
|
74 | - $data['page_title'] = 'Edit Settings'; |
|
75 | - if ($this->form_validation->run() == FALSE) { |
|
76 | - $data['validation_errors'] = validation_errors(); |
|
77 | - echo $data['validation_errors']; |
|
78 | - exit; |
|
79 | - } else { |
|
80 | - $this->system_model->edit_configuration($add_array, $add_array['id']); |
|
81 | - echo json_encode(array("SUCCESS"=> "setting updated successfully!")); |
|
82 | - exit; |
|
83 | - } |
|
84 | - } |
|
85 | - } |
|
86 | - |
|
87 | - function configuration($group_title='') { |
|
30 | + $this->load->library('session'); |
|
31 | + $this->load->library("system_form"); |
|
32 | + $this->load->library('astpp/form'); |
|
33 | + $this->load->model('system_model'); |
|
34 | + $this->load->dbutil(); |
|
35 | + |
|
36 | + if ($this->session->userdata('user_login') == FALSE) |
|
37 | + redirect(base_url() . '/astpp/login'); |
|
38 | + } |
|
39 | + |
|
40 | + function configuration_edit($edit_id = '') { |
|
41 | + $data['page_title'] = 'Edit Settings'; |
|
42 | + $where = array('id' => $edit_id); |
|
43 | + $account = $this->db_model->getSelect("*", "system", $where); |
|
44 | + foreach ($account->result_array() as $key => $value) { |
|
45 | + $edit_data = $value; |
|
46 | + } |
|
47 | + $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $edit_data); |
|
48 | + $this->load->view('view_configuration_add_edit', $data); |
|
49 | + } |
|
50 | + |
|
51 | + function configuration_search() { |
|
52 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
53 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
54 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
55 | + $action = $this->input->post(); |
|
56 | + unset($action['action']); |
|
57 | + unset($action['advance_search']); |
|
58 | + $this->session->set_userdata('configuration_search', $action); |
|
59 | + } |
|
60 | + if (@$ajax_search != 1) { |
|
61 | + redirect(base_url() . 'systems/configuration/'); |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + function configuration_clearsearchfilter() { |
|
66 | + $this->session->set_userdata('advance_search', 0); |
|
67 | + $this->session->set_userdata('did_search', ""); |
|
68 | + } |
|
69 | + |
|
70 | + function configuration_save() { |
|
71 | + $add_array = $this->input->post(); |
|
72 | + $data['form'] = $this->form->build_form($this->system_form->get_configuration_form_fields(), $add_array); |
|
73 | + if ($add_array['id'] != '') { |
|
74 | + $data['page_title'] = 'Edit Settings'; |
|
75 | + if ($this->form_validation->run() == FALSE) { |
|
76 | + $data['validation_errors'] = validation_errors(); |
|
77 | + echo $data['validation_errors']; |
|
78 | + exit; |
|
79 | + } else { |
|
80 | + $this->system_model->edit_configuration($add_array, $add_array['id']); |
|
81 | + echo json_encode(array("SUCCESS"=> "setting updated successfully!")); |
|
82 | + exit; |
|
83 | + } |
|
84 | + } |
|
85 | + } |
|
86 | + |
|
87 | + function configuration($group_title='') { |
|
88 | 88 | if($group_title==""){ |
89 | 89 | redirect(base_url() . '/dashboard'); |
90 | 90 | } |
91 | 91 | if($group_title=="email"){ |
92 | - $data['test_email_flag'] = true; |
|
92 | + $data['test_email_flag'] = true; |
|
93 | 93 | } |
94 | - $data['username'] = $this->session->userdata('user_name'); |
|
95 | - $data['page_title'] = ucfirst($group_title); |
|
94 | + $data['username'] = $this->session->userdata('user_name'); |
|
95 | + $data['page_title'] = ucfirst($group_title); |
|
96 | 96 | $data['group_title']=$group_title; |
97 | 97 | $where=array("group_title"=>$group_title); |
98 | 98 | $details = $this->db_model->getSelect("*", "system", $where); |
@@ -104,545 +104,545 @@ discard block |
||
104 | 104 | $update_array=array('value'=>$val); |
105 | 105 | $this->system_model->edit_configuration($update_array, $key); |
106 | 106 | } |
107 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
|
108 | - redirect(base_url() . 'systems/configuration/'.$group_title); |
|
109 | - }else{ |
|
107 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!'); |
|
108 | + redirect(base_url() . 'systems/configuration/'.$group_title); |
|
109 | + }else{ |
|
110 | 110 | $this->load->view('view_systemconf', $data); |
111 | 111 | } |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | - function configuration_json() { |
|
115 | - |
|
116 | - $json_data = array(); |
|
117 | - $count_all = $this->system_model->getsystem_list(false, "", ""); |
|
118 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
119 | - $json_data = $paging_data["json_paging"]; |
|
120 | - |
|
121 | - $query = $this->system_model->getsystem_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
122 | - $grid_fields = json_decode($this->system_form->build_system_list_for_admin()); |
|
123 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
124 | - |
|
125 | - echo json_encode($json_data); |
|
126 | - } |
|
127 | - |
|
128 | - function template() { |
|
129 | - $data['username'] = $this->session->userdata('user_name'); |
|
130 | - $data['page_title'] = 'Email Templates'; |
|
131 | - $data['search_flag'] = true; |
|
132 | - $this->session->set_userdata('advance_search', 0); |
|
133 | - $data['grid_fields'] = $this->system_form->build_template_list_for_admin(); |
|
134 | - $data["grid_buttons"] = $this->system_form->build_grid_buttons(); |
|
135 | - $data['form_search'] = $this->form->build_serach_form($this->system_form->get_template_search_form()); |
|
136 | - $this->load->view('view_template_list', $data); |
|
137 | - } |
|
138 | - |
|
139 | - function template_json() { |
|
140 | - $json_data = array(); |
|
141 | - $count_all = $this->system_model->gettemplate_list(false, "", ""); |
|
142 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
143 | - $json_data = $paging_data["json_paging"]; |
|
144 | - |
|
145 | - $query = $this->system_model->gettemplate_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
146 | - $grid_fields = json_decode($this->system_form->build_template_list_for_admin()); |
|
147 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
148 | - |
|
149 | - echo json_encode($json_data); |
|
150 | - } |
|
151 | - |
|
152 | - function template_edit($edit_id = '') { |
|
153 | - $data['page_title'] = 'Edit Email template'; |
|
154 | - $where = array('id' => $edit_id); |
|
155 | - $account = $this->db_model->getSelect("*", "default_templates", $where); |
|
156 | - foreach ($account->result_array() as $key => $value) { |
|
157 | - $edit_data = $value; |
|
158 | - } |
|
159 | - $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $edit_data); |
|
160 | - $this->load->view('view_template_add_edit', $data); |
|
161 | - } |
|
162 | - |
|
163 | - function template_save() { |
|
164 | - $add_array = $this->input->post(); |
|
114 | + function configuration_json() { |
|
115 | + |
|
116 | + $json_data = array(); |
|
117 | + $count_all = $this->system_model->getsystem_list(false, "", ""); |
|
118 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
119 | + $json_data = $paging_data["json_paging"]; |
|
120 | + |
|
121 | + $query = $this->system_model->getsystem_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
122 | + $grid_fields = json_decode($this->system_form->build_system_list_for_admin()); |
|
123 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
124 | + |
|
125 | + echo json_encode($json_data); |
|
126 | + } |
|
127 | + |
|
128 | + function template() { |
|
129 | + $data['username'] = $this->session->userdata('user_name'); |
|
130 | + $data['page_title'] = 'Email Templates'; |
|
131 | + $data['search_flag'] = true; |
|
132 | + $this->session->set_userdata('advance_search', 0); |
|
133 | + $data['grid_fields'] = $this->system_form->build_template_list_for_admin(); |
|
134 | + $data["grid_buttons"] = $this->system_form->build_grid_buttons(); |
|
135 | + $data['form_search'] = $this->form->build_serach_form($this->system_form->get_template_search_form()); |
|
136 | + $this->load->view('view_template_list', $data); |
|
137 | + } |
|
138 | + |
|
139 | + function template_json() { |
|
140 | + $json_data = array(); |
|
141 | + $count_all = $this->system_model->gettemplate_list(false, "", ""); |
|
142 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
143 | + $json_data = $paging_data["json_paging"]; |
|
144 | + |
|
145 | + $query = $this->system_model->gettemplate_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
146 | + $grid_fields = json_decode($this->system_form->build_template_list_for_admin()); |
|
147 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
148 | + |
|
149 | + echo json_encode($json_data); |
|
150 | + } |
|
151 | + |
|
152 | + function template_edit($edit_id = '') { |
|
153 | + $data['page_title'] = 'Edit Email template'; |
|
154 | + $where = array('id' => $edit_id); |
|
155 | + $account = $this->db_model->getSelect("*", "default_templates", $where); |
|
156 | + foreach ($account->result_array() as $key => $value) { |
|
157 | + $edit_data = $value; |
|
158 | + } |
|
159 | + $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $edit_data); |
|
160 | + $this->load->view('view_template_add_edit', $data); |
|
161 | + } |
|
162 | + |
|
163 | + function template_save() { |
|
164 | + $add_array = $this->input->post(); |
|
165 | 165 | |
166 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
167 | - $account_data = $this->session->userdata("accountinfo"); |
|
166 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
167 | + $account_data = $this->session->userdata("accountinfo"); |
|
168 | 168 | $reseller = $account_data['id']; |
169 | - $this->resellertemplate_save($add_array,$reseller); |
|
170 | - } |
|
171 | - else |
|
172 | - { |
|
173 | - $this->admintemplate_save($add_array); |
|
174 | - } |
|
175 | - } |
|
169 | + $this->resellertemplate_save($add_array,$reseller); |
|
170 | + } |
|
171 | + else |
|
172 | + { |
|
173 | + $this->admintemplate_save($add_array); |
|
174 | + } |
|
175 | + } |
|
176 | 176 | |
177 | - function resellertemplate_save($data,$resellerid) |
|
178 | - { |
|
179 | - $where = array('name' => $data['name'],'reseller_id'=>$resellerid); |
|
180 | - $count = $this->db_model->countQuery("*", "default_templates", $where); |
|
181 | - $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
182 | - if($count >0) |
|
183 | - { |
|
184 | - $data['page_title'] = 'Edit Template'; |
|
185 | - if ($this->form_validation->run() == FALSE) { |
|
186 | - $data['validation_errors'] = validation_errors(); |
|
187 | - } else { |
|
177 | + function resellertemplate_save($data,$resellerid) |
|
178 | + { |
|
179 | + $where = array('name' => $data['name'],'reseller_id'=>$resellerid); |
|
180 | + $count = $this->db_model->countQuery("*", "default_templates", $where); |
|
181 | + $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
182 | + if($count >0) |
|
183 | + { |
|
184 | + $data['page_title'] = 'Edit Template'; |
|
185 | + if ($this->form_validation->run() == FALSE) { |
|
186 | + $data['validation_errors'] = validation_errors(); |
|
187 | + } else { |
|
188 | 188 | |
189 | - $this->system_model->edit_resellertemplate($data, $data['id']); |
|
190 | - $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
191 | - redirect(base_url() . 'systems/template/'); |
|
192 | - exit; |
|
193 | - } |
|
194 | - } else { |
|
195 | - if ($this->form_validation->run() == FALSE) { |
|
196 | - $data['validation_errors'] = validation_errors(); |
|
197 | - } else { |
|
198 | - unset($data['form']); |
|
199 | - $data['reseller_id'] = $resellerid; |
|
200 | - $this->system_model->add_resellertemplate($data); |
|
201 | - $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
202 | - redirect(base_url() . 'systems/template/'); |
|
203 | - exit; |
|
204 | - } |
|
205 | - } |
|
206 | - $this->load->view('view_template_add_edit', $data); |
|
207 | - } |
|
208 | - function admintemplate_save($data) |
|
209 | - { |
|
210 | - $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
211 | - if ($data['id'] != '') { |
|
212 | - $data['page_title'] = 'Edit Template'; |
|
213 | - if ($this->form_validation->run() == FALSE) { |
|
214 | - $data['validation_errors'] = validation_errors(); |
|
215 | - } else { |
|
216 | - unset($data['form']); |
|
217 | - unset($data['page_title']); |
|
218 | - $this->system_model->edit_template($data, $data['id']); |
|
219 | - $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
220 | - redirect(base_url() . 'systems/template/'); |
|
221 | - exit; |
|
222 | - } |
|
223 | - } else { |
|
224 | - $data['page_title'] = 'Termination Details'; |
|
225 | - if ($this->form_validation->run() == FALSE) { |
|
226 | - $data['validation_errors'] = validation_errors(); |
|
227 | - } else { |
|
228 | - unset($data['form']); |
|
229 | - $this->system_model->add_template($data); |
|
230 | - $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
231 | - redirect(base_url() . 'systems/template/'); |
|
232 | - exit; |
|
233 | - } |
|
234 | - } |
|
235 | - $this->load->view('view_template_add_edit', $data); |
|
236 | - } |
|
237 | - function template_search() { |
|
238 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
239 | - |
|
240 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
241 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
242 | - $action = $this->input->post(); |
|
243 | - unset($action['action']); |
|
244 | - unset($action['advance_search']); |
|
245 | - $this->session->set_userdata('template_search', $action); |
|
246 | - } |
|
247 | - if (@$ajax_search != 1) { |
|
248 | - redirect(base_url() . 'systems/template/'); |
|
249 | - } |
|
250 | - } |
|
251 | - |
|
252 | - function template_clearsearchfilter() { |
|
253 | - $this->session->set_userdata('advance_search', 0); |
|
254 | - $this->session->set_userdata('did_search', ""); |
|
255 | - } |
|
189 | + $this->system_model->edit_resellertemplate($data, $data['id']); |
|
190 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
191 | + redirect(base_url() . 'systems/template/'); |
|
192 | + exit; |
|
193 | + } |
|
194 | + } else { |
|
195 | + if ($this->form_validation->run() == FALSE) { |
|
196 | + $data['validation_errors'] = validation_errors(); |
|
197 | + } else { |
|
198 | + unset($data['form']); |
|
199 | + $data['reseller_id'] = $resellerid; |
|
200 | + $this->system_model->add_resellertemplate($data); |
|
201 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
202 | + redirect(base_url() . 'systems/template/'); |
|
203 | + exit; |
|
204 | + } |
|
205 | + } |
|
206 | + $this->load->view('view_template_add_edit', $data); |
|
207 | + } |
|
208 | + function admintemplate_save($data) |
|
209 | + { |
|
210 | + $data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data); |
|
211 | + if ($data['id'] != '') { |
|
212 | + $data['page_title'] = 'Edit Template'; |
|
213 | + if ($this->form_validation->run() == FALSE) { |
|
214 | + $data['validation_errors'] = validation_errors(); |
|
215 | + } else { |
|
216 | + unset($data['form']); |
|
217 | + unset($data['page_title']); |
|
218 | + $this->system_model->edit_template($data, $data['id']); |
|
219 | + $this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!'); |
|
220 | + redirect(base_url() . 'systems/template/'); |
|
221 | + exit; |
|
222 | + } |
|
223 | + } else { |
|
224 | + $data['page_title'] = 'Termination Details'; |
|
225 | + if ($this->form_validation->run() == FALSE) { |
|
226 | + $data['validation_errors'] = validation_errors(); |
|
227 | + } else { |
|
228 | + unset($data['form']); |
|
229 | + $this->system_model->add_template($data); |
|
230 | + $this->session->set_flashdata('astpp_errormsg', 'Template added successfully!'); |
|
231 | + redirect(base_url() . 'systems/template/'); |
|
232 | + exit; |
|
233 | + } |
|
234 | + } |
|
235 | + $this->load->view('view_template_add_edit', $data); |
|
236 | + } |
|
237 | + function template_search() { |
|
238 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
239 | + |
|
240 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
241 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
242 | + $action = $this->input->post(); |
|
243 | + unset($action['action']); |
|
244 | + unset($action['advance_search']); |
|
245 | + $this->session->set_userdata('template_search', $action); |
|
246 | + } |
|
247 | + if (@$ajax_search != 1) { |
|
248 | + redirect(base_url() . 'systems/template/'); |
|
249 | + } |
|
250 | + } |
|
251 | + |
|
252 | + function template_clearsearchfilter() { |
|
253 | + $this->session->set_userdata('advance_search', 0); |
|
254 | + $this->session->set_userdata('did_search', ""); |
|
255 | + } |
|
256 | 256 | |
257 | - function country_list() { |
|
258 | - $data['username'] = $this->session->userdata('user_name'); |
|
259 | - $data['page_title'] = 'Countries'; |
|
260 | - $data['search_flag'] = true; |
|
261 | - $data['cur_menu_no'] = 4; |
|
257 | + function country_list() { |
|
258 | + $data['username'] = $this->session->userdata('user_name'); |
|
259 | + $data['page_title'] = 'Countries'; |
|
260 | + $data['search_flag'] = true; |
|
261 | + $data['cur_menu_no'] = 4; |
|
262 | 262 | $this->session->set_userdata('country_search', 0); |
263 | - $data['grid_fields'] = $this->system_form->build_country_list_for_admin(); |
|
264 | - if ($this->session->userdata('logintype') == 2) { |
|
265 | - $data["grid_buttons"] = $this->system_form->build_admin_grid_buttons(); |
|
266 | - } else { |
|
267 | - $data["grid_buttons"] = json_encode(array()); |
|
268 | - } |
|
263 | + $data['grid_fields'] = $this->system_form->build_country_list_for_admin(); |
|
264 | + if ($this->session->userdata('logintype') == 2) { |
|
265 | + $data["grid_buttons"] = $this->system_form->build_admin_grid_buttons(); |
|
266 | + } else { |
|
267 | + $data["grid_buttons"] = json_encode(array()); |
|
268 | + } |
|
269 | 269 | $data['form_search'] = $this->form->build_serach_form($this->system_form->get_search_country_form()); |
270 | - $this->load->view('view_country_list', $data); |
|
271 | - } |
|
270 | + $this->load->view('view_country_list', $data); |
|
271 | + } |
|
272 | 272 | |
273 | - function country_list_json() { |
|
273 | + function country_list_json() { |
|
274 | 274 | $json_data = array(); |
275 | - $count_all = $this->system_model->getcountry_list(false); |
|
276 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
277 | - $json_data = $paging_data["json_paging"]; |
|
278 | - $query = $this->system_model->getcountry_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
279 | - $grid_fields = json_decode($this->system_form->build_country_list_for_admin()); |
|
280 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
281 | - |
|
282 | - echo json_encode($json_data); |
|
283 | - } |
|
275 | + $count_all = $this->system_model->getcountry_list(false); |
|
276 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
277 | + $json_data = $paging_data["json_paging"]; |
|
278 | + $query = $this->system_model->getcountry_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
279 | + $grid_fields = json_decode($this->system_form->build_country_list_for_admin()); |
|
280 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
281 | + |
|
282 | + echo json_encode($json_data); |
|
283 | + } |
|
284 | 284 | |
285 | - function country_list_search() { |
|
286 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
285 | + function country_list_search() { |
|
286 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
287 | 287 | |
288 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
289 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
290 | - $action = $this->input->post(); |
|
291 | - unset($action['action']); |
|
292 | - unset($action['advance_search']); |
|
293 | - $this->session->set_userdata('country_list_search', $action); |
|
294 | - } |
|
295 | - if (@$ajax_search != 1) { |
|
296 | - redirect(base_url() . 'systems/country_list/'); |
|
297 | - } |
|
298 | - } |
|
299 | - |
|
300 | - function country_list_clearsearchfilter() { |
|
301 | - $this->session->set_userdata('advance_search', 0); |
|
302 | - $this->session->set_userdata('country_search', ""); |
|
303 | - } |
|
288 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
289 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
290 | + $action = $this->input->post(); |
|
291 | + unset($action['action']); |
|
292 | + unset($action['advance_search']); |
|
293 | + $this->session->set_userdata('country_list_search', $action); |
|
294 | + } |
|
295 | + if (@$ajax_search != 1) { |
|
296 | + redirect(base_url() . 'systems/country_list/'); |
|
297 | + } |
|
298 | + } |
|
299 | + |
|
300 | + function country_list_clearsearchfilter() { |
|
301 | + $this->session->set_userdata('advance_search', 0); |
|
302 | + $this->session->set_userdata('country_search', ""); |
|
303 | + } |
|
304 | 304 | |
305 | - function country_add() { |
|
305 | + function country_add() { |
|
306 | 306 | $data['username'] = $this->session->userdata('user_name'); |
307 | - $data['flag'] = 'create'; |
|
308 | - $data['page_title'] = 'Add Country'; |
|
309 | - $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), ''); |
|
310 | - $this->load->view('view_country_add_edit', $data); |
|
311 | - } |
|
307 | + $data['flag'] = 'create'; |
|
308 | + $data['page_title'] = 'Add Country'; |
|
309 | + $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), ''); |
|
310 | + $this->load->view('view_country_add_edit', $data); |
|
311 | + } |
|
312 | 312 | |
313 | - function country_list_edit($edit_id = '') { |
|
313 | + function country_list_edit($edit_id = '') { |
|
314 | 314 | $data['page_title'] = 'Edit Country'; |
315 | - $where = array('id' => $edit_id); |
|
316 | - $account = $this->db_model->getSelect("*", "countrycode", $where); |
|
317 | - foreach ($account->result_array() as $key => $value) { |
|
318 | - $edit_data = $value; |
|
319 | - } |
|
320 | - $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $edit_data); |
|
321 | - $this->load->view('view_country_add_edit', $data); |
|
322 | - } |
|
315 | + $where = array('id' => $edit_id); |
|
316 | + $account = $this->db_model->getSelect("*", "countrycode", $where); |
|
317 | + foreach ($account->result_array() as $key => $value) { |
|
318 | + $edit_data = $value; |
|
319 | + } |
|
320 | + $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $edit_data); |
|
321 | + $this->load->view('view_country_add_edit', $data); |
|
322 | + } |
|
323 | 323 | |
324 | 324 | |
325 | - function country_save() { |
|
325 | + function country_save() { |
|
326 | 326 | $add_array = $this->input->post(); |
327 | - $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $add_array); |
|
328 | - if ($add_array['id'] != '') { |
|
329 | - $data['page_title'] = 'Edit Country'; |
|
330 | - if ($this->form_validation->run() == FALSE) { |
|
331 | - $data['validation_errors'] = validation_errors(); |
|
332 | - echo $data['validation_errors']; |
|
333 | - exit; |
|
334 | - } else { |
|
335 | - $this->system_model->edit_country($add_array, $add_array['id']); |
|
336 | - echo json_encode(array("SUCCESS"=> $add_array["country"]." country updated successfully!")); |
|
337 | - exit; |
|
338 | - } |
|
339 | - } else { |
|
340 | - $data['page_title'] = 'Add Country'; |
|
341 | - if ($this->form_validation->run() == FALSE) { |
|
342 | - $data['validation_errors'] = validation_errors(); |
|
343 | - echo $data['validation_errors']; |
|
344 | - exit; |
|
345 | - } else { |
|
346 | - $response = $this->system_model->add_country($add_array); |
|
347 | - echo json_encode(array("SUCCESS"=> $add_array["country"]." country added successfully!")); |
|
348 | - exit; |
|
349 | - } |
|
350 | - } |
|
351 | - } |
|
327 | + $data['form'] = $this->form->build_form($this->system_form->get_country_form_fields(), $add_array); |
|
328 | + if ($add_array['id'] != '') { |
|
329 | + $data['page_title'] = 'Edit Country'; |
|
330 | + if ($this->form_validation->run() == FALSE) { |
|
331 | + $data['validation_errors'] = validation_errors(); |
|
332 | + echo $data['validation_errors']; |
|
333 | + exit; |
|
334 | + } else { |
|
335 | + $this->system_model->edit_country($add_array, $add_array['id']); |
|
336 | + echo json_encode(array("SUCCESS"=> $add_array["country"]." country updated successfully!")); |
|
337 | + exit; |
|
338 | + } |
|
339 | + } else { |
|
340 | + $data['page_title'] = 'Add Country'; |
|
341 | + if ($this->form_validation->run() == FALSE) { |
|
342 | + $data['validation_errors'] = validation_errors(); |
|
343 | + echo $data['validation_errors']; |
|
344 | + exit; |
|
345 | + } else { |
|
346 | + $response = $this->system_model->add_country($add_array); |
|
347 | + echo json_encode(array("SUCCESS"=> $add_array["country"]." country added successfully!")); |
|
348 | + exit; |
|
349 | + } |
|
350 | + } |
|
351 | + } |
|
352 | 352 | |
353 | - function country_remove($id) { |
|
354 | - $this->system_model->remove_country($id); |
|
355 | - $country=$this->common->get_field_name('country','countrycode',$id); |
|
356 | - $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
|
357 | - redirect(base_url() . 'systems/country_list/'); |
|
358 | - } |
|
359 | - |
|
360 | - function country_delete_multiple() { |
|
361 | - $ids = $this->input->post("selected_ids", true); |
|
362 | - $where = "id IN ($ids)"; |
|
363 | - $this->db->where($where); |
|
364 | - echo $this->db->delete("countrycode"); |
|
365 | - } |
|
366 | - function currency_list() { |
|
353 | + function country_remove($id) { |
|
354 | + $this->system_model->remove_country($id); |
|
355 | + $country=$this->common->get_field_name('country','countrycode',$id); |
|
356 | + $this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!'); |
|
357 | + redirect(base_url() . 'systems/country_list/'); |
|
358 | + } |
|
359 | + |
|
360 | + function country_delete_multiple() { |
|
361 | + $ids = $this->input->post("selected_ids", true); |
|
362 | + $where = "id IN ($ids)"; |
|
363 | + $this->db->where($where); |
|
364 | + echo $this->db->delete("countrycode"); |
|
365 | + } |
|
366 | + function currency_list() { |
|
367 | 367 | $base_currency = Common_model::$global_config['system_config']['base_currency']; |
368 | - $data['username'] = $this->session->userdata('user_name'); |
|
369 | - $data['page_title'] = 'Currencies'; |
|
370 | - $data['search_flag'] = true; |
|
371 | - $data['cur_menu_no'] = 4; |
|
368 | + $data['username'] = $this->session->userdata('user_name'); |
|
369 | + $data['page_title'] = 'Currencies'; |
|
370 | + $data['search_flag'] = true; |
|
371 | + $data['cur_menu_no'] = 4; |
|
372 | 372 | $this->session->set_userdata('currency_search', 0); |
373 | - $data['grid_fields'] = $this->system_form->build_currency_list_for_admin(); |
|
374 | - if ($this->session->userdata('logintype') == 2) { |
|
375 | - $data["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons(); |
|
376 | - } else { |
|
377 | - $data["grid_buttons"] = json_encode(array()); |
|
378 | - } |
|
373 | + $data['grid_fields'] = $this->system_form->build_currency_list_for_admin(); |
|
374 | + if ($this->session->userdata('logintype') == 2) { |
|
375 | + $data["grid_buttons"] = $this->system_form->build_admin_currency_grid_buttons(); |
|
376 | + } else { |
|
377 | + $data["grid_buttons"] = json_encode(array()); |
|
378 | + } |
|
379 | 379 | $data['form_search'] = $this->form->build_serach_form($this->system_form->get_search_currency_form()); |
380 | - $this->load->view('view_currency_list', $data); |
|
381 | - } |
|
380 | + $this->load->view('view_currency_list', $data); |
|
381 | + } |
|
382 | 382 | |
383 | - function currency_list_json() { |
|
384 | - $json_data = array(); |
|
383 | + function currency_list_json() { |
|
384 | + $json_data = array(); |
|
385 | 385 | |
386 | - $count_all = $this->system_model->getcurrency_list(false); |
|
387 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
388 | - $json_data = $paging_data["json_paging"]; |
|
386 | + $count_all = $this->system_model->getcurrency_list(false); |
|
387 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
388 | + $json_data = $paging_data["json_paging"]; |
|
389 | 389 | |
390 | - $query = $this->system_model->getcurrency_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
391 | - $grid_fields = json_decode($this->system_form->build_currency_list_for_admin()); |
|
392 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
390 | + $query = $this->system_model->getcurrency_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
391 | + $grid_fields = json_decode($this->system_form->build_currency_list_for_admin()); |
|
392 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
393 | 393 | |
394 | - echo json_encode($json_data); |
|
395 | - } |
|
394 | + echo json_encode($json_data); |
|
395 | + } |
|
396 | 396 | |
397 | - function currency_list_search() { |
|
398 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
397 | + function currency_list_search() { |
|
398 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
399 | 399 | |
400 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
401 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
402 | - $action = $this->input->post(); |
|
403 | - unset($action['action']); |
|
404 | - unset($action['advance_search']); |
|
405 | - $this->session->set_userdata('currency_list_search', $action); |
|
406 | - } |
|
407 | - if (@$ajax_search != 1) { |
|
408 | - redirect(base_url() . 'systems/currency_list/'); |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - function currency_list_clearsearchfilter() { |
|
413 | - $this->session->set_userdata('advance_search', 0); |
|
414 | - $this->session->set_userdata('currency_search', ""); |
|
415 | - } |
|
416 | - |
|
417 | - function currency_add() { |
|
400 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
401 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
402 | + $action = $this->input->post(); |
|
403 | + unset($action['action']); |
|
404 | + unset($action['advance_search']); |
|
405 | + $this->session->set_userdata('currency_list_search', $action); |
|
406 | + } |
|
407 | + if (@$ajax_search != 1) { |
|
408 | + redirect(base_url() . 'systems/currency_list/'); |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + function currency_list_clearsearchfilter() { |
|
413 | + $this->session->set_userdata('advance_search', 0); |
|
414 | + $this->session->set_userdata('currency_search', ""); |
|
415 | + } |
|
416 | + |
|
417 | + function currency_add() { |
|
418 | 418 | $data['username'] = $this->session->userdata('user_name'); |
419 | - $data['flag'] = 'create'; |
|
420 | - $data['page_title'] = 'Add Currency'; |
|
421 | - $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), ''); |
|
422 | - $this->load->view('view_currency_add_edit', $data); |
|
423 | - } |
|
419 | + $data['flag'] = 'create'; |
|
420 | + $data['page_title'] = 'Add Currency'; |
|
421 | + $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), ''); |
|
422 | + $this->load->view('view_currency_add_edit', $data); |
|
423 | + } |
|
424 | 424 | |
425 | - function currency_list_edit($edit_id = '') { |
|
425 | + function currency_list_edit($edit_id = '') { |
|
426 | 426 | $data['page_title'] = 'Edit Currency'; |
427 | - $where = array('id' => $edit_id); |
|
428 | - $account = $this->db_model->getSelect("*", "currency", $where); |
|
429 | - foreach ($account->result_array() as $key => $value) { |
|
430 | - $edit_data = $value; |
|
431 | - } |
|
432 | - $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $edit_data); |
|
433 | - $this->load->view('view_country_add_edit', $data); |
|
434 | - } |
|
427 | + $where = array('id' => $edit_id); |
|
428 | + $account = $this->db_model->getSelect("*", "currency", $where); |
|
429 | + foreach ($account->result_array() as $key => $value) { |
|
430 | + $edit_data = $value; |
|
431 | + } |
|
432 | + $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $edit_data); |
|
433 | + $this->load->view('view_country_add_edit', $data); |
|
434 | + } |
|
435 | 435 | |
436 | 436 | |
437 | - function currency_save() { |
|
437 | + function currency_save() { |
|
438 | 438 | $add_array = $this->input->post(); |
439 | - $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $add_array); |
|
440 | - if ($add_array['id'] != '') { |
|
441 | - $data['page_title'] = 'Edit Currency'; |
|
442 | - $data['page_title'] = 'Edit Currency'; |
|
443 | - if ($this->form_validation->run() == FALSE) { |
|
444 | - $data['validation_errors'] = validation_errors(); |
|
445 | - echo $data['validation_errors']; |
|
446 | - exit; |
|
447 | - } else { |
|
448 | - $this->system_model->edit_currency($add_array, $add_array['id']); |
|
449 | - echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency updated successfully!")); |
|
450 | - exit; |
|
451 | - } |
|
452 | - } else { |
|
453 | - $data['page_title'] = 'Create Currency'; |
|
454 | - if ($this->form_validation->run() == FALSE) { |
|
455 | - $data['validation_errors'] = validation_errors(); |
|
456 | - echo $data['validation_errors']; |
|
457 | - exit; |
|
458 | - } else { |
|
459 | - $response = $this->system_model->add_currency($add_array); |
|
460 | - echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency added successfully!")); |
|
461 | - exit; |
|
462 | - } |
|
463 | - } |
|
464 | - } |
|
439 | + $data['form'] = $this->form->build_form($this->system_form->get_currency_form_fields(), $add_array); |
|
440 | + if ($add_array['id'] != '') { |
|
441 | + $data['page_title'] = 'Edit Currency'; |
|
442 | + $data['page_title'] = 'Edit Currency'; |
|
443 | + if ($this->form_validation->run() == FALSE) { |
|
444 | + $data['validation_errors'] = validation_errors(); |
|
445 | + echo $data['validation_errors']; |
|
446 | + exit; |
|
447 | + } else { |
|
448 | + $this->system_model->edit_currency($add_array, $add_array['id']); |
|
449 | + echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency updated successfully!")); |
|
450 | + exit; |
|
451 | + } |
|
452 | + } else { |
|
453 | + $data['page_title'] = 'Create Currency'; |
|
454 | + if ($this->form_validation->run() == FALSE) { |
|
455 | + $data['validation_errors'] = validation_errors(); |
|
456 | + echo $data['validation_errors']; |
|
457 | + exit; |
|
458 | + } else { |
|
459 | + $response = $this->system_model->add_currency($add_array); |
|
460 | + echo json_encode(array("SUCCESS"=> $add_array["currencyname"]." currency added successfully!")); |
|
461 | + exit; |
|
462 | + } |
|
463 | + } |
|
464 | + } |
|
465 | 465 | |
466 | - function currency_remove($id) { |
|
466 | + function currency_remove($id) { |
|
467 | 467 | $currencyname=$this->common->get_field_name('currencyname','currency',$id); |
468 | - $this->system_model->remove_currency($id); |
|
469 | - $this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!'); |
|
470 | - redirect(base_url() . 'systems/currency_list/'); |
|
471 | - } |
|
472 | - |
|
473 | - function currency_delete_multiple() { |
|
474 | - $ids = $this->input->post("selected_ids", true); |
|
475 | - $where = "id IN ($ids)"; |
|
476 | - $this->db->where($where); |
|
477 | - echo $this->db->delete("currency"); |
|
478 | - } |
|
479 | - function database_backup() |
|
480 | - { |
|
481 | - $data=array(); |
|
482 | - $data['username'] = $this->session->userdata('user_name'); |
|
483 | - $data['page_title'] = 'Database Backup'; |
|
484 | - $filename=$this->db->database."_".date("YmdHms").".sql.gz"; |
|
485 | - $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
|
486 | - $this->load->view('view_database_backup', $data); |
|
487 | - } |
|
488 | - function database_backup_save() |
|
489 | - { |
|
490 | - |
|
491 | - $add_array=$this->input->post(); |
|
468 | + $this->system_model->remove_currency($id); |
|
469 | + $this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!'); |
|
470 | + redirect(base_url() . 'systems/currency_list/'); |
|
471 | + } |
|
472 | + |
|
473 | + function currency_delete_multiple() { |
|
474 | + $ids = $this->input->post("selected_ids", true); |
|
475 | + $where = "id IN ($ids)"; |
|
476 | + $this->db->where($where); |
|
477 | + echo $this->db->delete("currency"); |
|
478 | + } |
|
479 | + function database_backup() |
|
480 | + { |
|
481 | + $data=array(); |
|
482 | + $data['username'] = $this->session->userdata('user_name'); |
|
483 | + $data['page_title'] = 'Database Backup'; |
|
484 | + $filename=$this->db->database."_".date("YmdHms").".sql.gz"; |
|
485 | + $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), ''); |
|
486 | + $this->load->view('view_database_backup', $data); |
|
487 | + } |
|
488 | + function database_backup_save() |
|
489 | + { |
|
490 | + |
|
491 | + $add_array=$this->input->post(); |
|
492 | 492 | |
493 | - $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array); |
|
494 | - $data['page_title'] = 'Database Backup'; |
|
495 | - if($add_array['id'] != ''){ |
|
493 | + $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array); |
|
494 | + $data['page_title'] = 'Database Backup'; |
|
495 | + if($add_array['id'] != ''){ |
|
496 | 496 | |
497 | - }else{ |
|
498 | - if($this->form_validation->run() == FALSE) { |
|
499 | - $data['validation_errors'] = validation_errors(); |
|
500 | - echo $data['validation_errors']; |
|
501 | - exit; |
|
502 | - }else{ |
|
503 | - $db_name = $this->db->database; |
|
504 | - $db_username = $this->db->username; |
|
505 | - $db_password = $this->db->password; |
|
506 | - $db_hostname = $this->db->hostname; |
|
507 | - $filename = $add_array['path']; |
|
508 | - $backup_file=DATABASE_DIRECTORY.$filename; |
|
509 | - if (substr($backup_file,-3)=='.gz'){ |
|
510 | - $backup_file = substr($backup_file,0,-3); |
|
511 | - $do_gzip=1; |
|
512 | - } |
|
513 | - |
|
514 | - $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | - $error_zip=0; |
|
516 | - exec($run_backup,$output,$error); |
|
517 | - if ($do_gzip){ |
|
518 | - $gzip = $this->config->item('gzip-path'); |
|
519 | - $run_gzip = $gzip." ".$backup_file; |
|
520 | - exec($run_gzip,$output,$error_zip); |
|
521 | - } |
|
497 | + }else{ |
|
498 | + if($this->form_validation->run() == FALSE) { |
|
499 | + $data['validation_errors'] = validation_errors(); |
|
500 | + echo $data['validation_errors']; |
|
501 | + exit; |
|
502 | + }else{ |
|
503 | + $db_name = $this->db->database; |
|
504 | + $db_username = $this->db->username; |
|
505 | + $db_password = $this->db->password; |
|
506 | + $db_hostname = $this->db->hostname; |
|
507 | + $filename = $add_array['path']; |
|
508 | + $backup_file=DATABASE_DIRECTORY.$filename; |
|
509 | + if (substr($backup_file,-3)=='.gz'){ |
|
510 | + $backup_file = substr($backup_file,0,-3); |
|
511 | + $do_gzip=1; |
|
512 | + } |
|
513 | + |
|
514 | + $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'"; |
|
515 | + $error_zip=0; |
|
516 | + exec($run_backup,$output,$error); |
|
517 | + if ($do_gzip){ |
|
518 | + $gzip = $this->config->item('gzip-path'); |
|
519 | + $run_gzip = $gzip." ".$backup_file; |
|
520 | + exec($run_gzip,$output,$error_zip); |
|
521 | + } |
|
522 | 522 | |
523 | - if($error == 0 && $error_zip == 0 ){ |
|
524 | - $this->system_model->backup_insert($add_array); |
|
525 | - echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
|
526 | - exit; |
|
527 | - }else{ |
|
528 | - echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
|
529 | - exit; |
|
530 | - } |
|
531 | - } |
|
532 | - } |
|
533 | - } |
|
534 | - function database_restore() { |
|
535 | - $data['page_title'] = 'Database Restore'; |
|
536 | - $data['grid_fields'] = $this->system_form->build_backupdastabase_list(); |
|
537 | - $data["grid_buttons"] = $this->system_form->build_backupdastabase_buttons(); |
|
538 | - $this->load->view('view_database_list', $data); |
|
539 | - } |
|
523 | + if($error == 0 && $error_zip == 0 ){ |
|
524 | + $this->system_model->backup_insert($add_array); |
|
525 | + echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!")); |
|
526 | + exit; |
|
527 | + }else{ |
|
528 | + echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section'; |
|
529 | + exit; |
|
530 | + } |
|
531 | + } |
|
532 | + } |
|
533 | + } |
|
534 | + function database_restore() { |
|
535 | + $data['page_title'] = 'Database Restore'; |
|
536 | + $data['grid_fields'] = $this->system_form->build_backupdastabase_list(); |
|
537 | + $data["grid_buttons"] = $this->system_form->build_backupdastabase_buttons(); |
|
538 | + $this->load->view('view_database_list', $data); |
|
539 | + } |
|
540 | 540 | function database_restore_json() |
541 | - { |
|
542 | - $json_data = array(); |
|
543 | - $count_all = $this->system_model->getbackup_list(false, "", ""); |
|
544 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']); |
|
545 | - $json_data = $paging_data["json_paging"]; |
|
546 | - |
|
547 | - $query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
548 | - $grid_fields = json_decode($this->system_form->build_backupdastabase_list()); |
|
549 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
550 | - |
|
551 | - echo json_encode($json_data); |
|
552 | - exit; |
|
553 | - } |
|
554 | - function database_restore_one($id='') |
|
555 | - { |
|
556 | - $result = $this->system_model->get_backup_data($id); |
|
557 | - $result_array=$result->result_array(); |
|
558 | - if($result->num_rows() > 0) |
|
559 | - { |
|
560 | - $db_name = $this->db->database; |
|
561 | - $db_username = $this->db->username; |
|
562 | - $db_password = $this->db->password; |
|
563 | - $db_hostname = $this->db->hostname; |
|
564 | - $path=DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | - if(file_exists($path)){ |
|
566 | - if (substr($path,-3)=='.gz') { |
|
567 | - $GUNZIP_EXE = $this->config->item('gunzip-path'); |
|
568 | - $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
|
569 | - } |
|
570 | - $MYSQL="/usr/bin/mysql"; |
|
571 | - $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
|
572 | - exec($run_restore); |
|
573 | - $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
|
574 | - redirect(base_url() . 'systems/database_restore/'); |
|
575 | - }else{ |
|
576 | - $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
|
577 | - redirect(base_url() . 'systems/database_restore/'); |
|
578 | - } |
|
579 | - } |
|
580 | - redirect(base_url() . 'systems/database_restore/'); |
|
581 | - } |
|
541 | + { |
|
542 | + $json_data = array(); |
|
543 | + $count_all = $this->system_model->getbackup_list(false, "", ""); |
|
544 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']); |
|
545 | + $json_data = $paging_data["json_paging"]; |
|
546 | + |
|
547 | + $query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
548 | + $grid_fields = json_decode($this->system_form->build_backupdastabase_list()); |
|
549 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
550 | + |
|
551 | + echo json_encode($json_data); |
|
552 | + exit; |
|
553 | + } |
|
554 | + function database_restore_one($id='') |
|
555 | + { |
|
556 | + $result = $this->system_model->get_backup_data($id); |
|
557 | + $result_array=$result->result_array(); |
|
558 | + if($result->num_rows() > 0) |
|
559 | + { |
|
560 | + $db_name = $this->db->database; |
|
561 | + $db_username = $this->db->username; |
|
562 | + $db_password = $this->db->password; |
|
563 | + $db_hostname = $this->db->hostname; |
|
564 | + $path=DATABASE_DIRECTORY.$result_array[0]['path']; |
|
565 | + if(file_exists($path)){ |
|
566 | + if (substr($path,-3)=='.gz') { |
|
567 | + $GUNZIP_EXE = $this->config->item('gunzip-path'); |
|
568 | + $run_gzip = $GUNZIP_EXE." < ".$path." | "; |
|
569 | + } |
|
570 | + $MYSQL="/usr/bin/mysql"; |
|
571 | + $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name; |
|
572 | + exec($run_restore); |
|
573 | + $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.'); |
|
574 | + redirect(base_url() . 'systems/database_restore/'); |
|
575 | + }else{ |
|
576 | + $this->session->set_flashdata('astpp_notification', 'File not exists!'); |
|
577 | + redirect(base_url() . 'systems/database_restore/'); |
|
578 | + } |
|
579 | + } |
|
580 | + redirect(base_url() . 'systems/database_restore/'); |
|
581 | + } |
|
582 | 582 | |
583 | 583 | function database_download($id=''){ |
584 | 584 | |
585 | - $result = $this->system_model->get_backup_data($id); |
|
586 | - $result_array=$result->result_array(); |
|
587 | - if($result->num_rows() > 0) |
|
588 | - { |
|
589 | - $path=$result_array[0]['path']; |
|
590 | - $filename = basename($path); |
|
591 | - $len = filesize($path); |
|
585 | + $result = $this->system_model->get_backup_data($id); |
|
586 | + $result_array=$result->result_array(); |
|
587 | + if($result->num_rows() > 0) |
|
588 | + { |
|
589 | + $path=$result_array[0]['path']; |
|
590 | + $filename = basename($path); |
|
591 | + $len = filesize($path); |
|
592 | 592 | |
593 | - header("Content-Encoding: binary"); |
|
594 | - header("Content-Type: application/octet-stream"); |
|
595 | - header( "content-length: " . $len ); |
|
596 | - header( "content-disposition: attachment; filename=" . $filename ); |
|
597 | - header("Expires: 0"); |
|
598 | - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
599 | - header("Cache-Control: private"); |
|
600 | - header("Pragma: public"); |
|
601 | - ob_clean(); |
|
602 | - $fp=fopen( $path, "r" ); |
|
603 | - fpassthru( $fp ); |
|
604 | - exit; |
|
605 | - } |
|
606 | - } |
|
607 | - |
|
608 | - function database_import() |
|
609 | - { |
|
610 | - $data['page_title'] = 'Import Database'; |
|
611 | - $this->load->view('view_import_database', $data); |
|
593 | + header("Content-Encoding: binary"); |
|
594 | + header("Content-Type: application/octet-stream"); |
|
595 | + header( "content-length: " . $len ); |
|
596 | + header( "content-disposition: attachment; filename=" . $filename ); |
|
597 | + header("Expires: 0"); |
|
598 | + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
599 | + header("Cache-Control: private"); |
|
600 | + header("Pragma: public"); |
|
601 | + ob_clean(); |
|
602 | + $fp=fopen( $path, "r" ); |
|
603 | + fpassthru( $fp ); |
|
604 | + exit; |
|
605 | + } |
|
606 | + } |
|
607 | + |
|
608 | + function database_import() |
|
609 | + { |
|
610 | + $data['page_title'] = 'Import Database'; |
|
611 | + $this->load->view('view_import_database', $data); |
|
612 | 612 | |
613 | - } |
|
613 | + } |
|
614 | 614 | function database_import_file() |
615 | - { |
|
616 | - $filename = $_POST['fname']; |
|
617 | - $upload_greeting_file= $_FILES['userfile']['name']; |
|
618 | - $db_file = explode(".",$upload_greeting_file); |
|
619 | - if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){ |
|
620 | - $target_path = basename( $_FILES['userfile']['name']); |
|
621 | - move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path ); |
|
615 | + { |
|
616 | + $filename = $_POST['fname']; |
|
617 | + $upload_greeting_file= $_FILES['userfile']['name']; |
|
618 | + $db_file = explode(".",$upload_greeting_file); |
|
619 | + if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){ |
|
620 | + $target_path = basename( $_FILES['userfile']['name']); |
|
621 | + move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path ); |
|
622 | 622 | |
623 | - $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
|
624 | - $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
|
625 | - redirect(base_url()."systems/database_restore/"); |
|
626 | - }else{ |
|
627 | - $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
|
628 | - redirect(base_url()."systems/database_restore/"); |
|
629 | - } |
|
630 | - } |
|
631 | - function database_delete($id) |
|
632 | - { |
|
633 | - $where = array("id"=>$id); |
|
634 | - $this->db->where($where); |
|
635 | - $this->db->delete("backup_database"); |
|
636 | - $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
|
637 | - redirect(base_url() . 'systems/database_restore/'); |
|
638 | - return true; |
|
639 | - } |
|
640 | - function database_backup_delete_multiple() { |
|
641 | - $ids = $this->input->post("selected_ids", true); |
|
642 | - $where = "id IN ($ids)"; |
|
643 | - $this->db->where($where); |
|
644 | - echo $this->db->delete("backup_database"); |
|
645 | - } |
|
623 | + $query = $this->system_model->import_database($filename,$_FILES['userfile']['name']); |
|
624 | + $this->session->set_flashdata('astpp_errormsg',"The file ". basename( $_FILES['userfile']['name'])." has been uploaded"); |
|
625 | + redirect(base_url()."systems/database_restore/"); |
|
626 | + }else{ |
|
627 | + $this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format."); |
|
628 | + redirect(base_url()."systems/database_restore/"); |
|
629 | + } |
|
630 | + } |
|
631 | + function database_delete($id) |
|
632 | + { |
|
633 | + $where = array("id"=>$id); |
|
634 | + $this->db->where($where); |
|
635 | + $this->db->delete("backup_database"); |
|
636 | + $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.'); |
|
637 | + redirect(base_url() . 'systems/database_restore/'); |
|
638 | + return true; |
|
639 | + } |
|
640 | + function database_backup_delete_multiple() { |
|
641 | + $ids = $this->input->post("selected_ids", true); |
|
642 | + $where = "id IN ($ids)"; |
|
643 | + $this->db->where($where); |
|
644 | + echo $this->db->delete("backup_database"); |
|
645 | + } |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | ?> |