@@ -23,74 +23,74 @@ |
||
23 | 23 | ############################################################################### |
24 | 24 | |
25 | 25 | if (!defined('BASEPATH')) |
26 | - exit('No direct script access allowed'); |
|
26 | + exit('No direct script access allowed'); |
|
27 | 27 | |
28 | 28 | class Animap_form { |
29 | - function __construct($library_name = '') { |
|
30 | - $this->CI = & get_instance(); |
|
31 | - } |
|
29 | + function __construct($library_name = '') { |
|
30 | + $this->CI = & get_instance(); |
|
31 | + } |
|
32 | 32 | |
33 | - function get_animap_form_fields($edit_id) { |
|
33 | + function get_animap_form_fields($edit_id) { |
|
34 | 34 | $id=$edit_id; |
35 | - $form['forms'] = array(base_url() . 'animap/animap_save/', array('id' => 'animap_form', 'method' => 'POST', 'name' => 'animap_form')); |
|
35 | + $form['forms'] = array(base_url() . 'animap/animap_save/', array('id' => 'animap_form', 'method' => 'POST', 'name' => 'animap_form')); |
|
36 | 36 | $val=$id > 0 ? 'ani_map.number.'.$id : 'ani_map.number'; |
37 | - $form['Caller ID'] = array( |
|
38 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
39 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0")), |
|
40 | - array('Caller ID', 'INPUT', array('name' => 'number', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|numeric|xss_clean', 'tOOL TIP', 'Please Enter ANI number'), |
|
41 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
37 | + $form['Caller ID'] = array( |
|
38 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
39 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0")), |
|
40 | + array('Caller ID', 'INPUT', array('name' => 'number', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|numeric|xss_clean', 'tOOL TIP', 'Please Enter ANI number'), |
|
41 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
42 | 42 | |
43 | - ); |
|
44 | - $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\')'); |
|
45 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
46 | - return $form; |
|
47 | - } |
|
43 | + ); |
|
44 | + $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\')'); |
|
45 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
46 | + return $form; |
|
47 | + } |
|
48 | 48 | |
49 | - function get_animap_search_form() { |
|
50 | - $logintype = $this->CI->session->userdata('logintype'); |
|
49 | + function get_animap_search_form() { |
|
50 | + $logintype = $this->CI->session->userdata('logintype'); |
|
51 | 51 | |
52 | - $form['forms'] = array("", array('id' => "animap_search")); |
|
53 | - $form['Search'] = array( |
|
54 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
55 | - array('Caller ID', 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
56 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
52 | + $form['forms'] = array("", array('id' => "animap_search")); |
|
53 | + $form['Search'] = array( |
|
54 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
55 | + array('Caller ID', 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
56 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
57 | 57 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
58 | 58 | |
59 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
60 | - ); |
|
61 | - $form['button_search'] = array('name' => 'action', 'id' => "animap_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
62 | - $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'); |
|
59 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
60 | + ); |
|
61 | + $form['button_search'] = array('name' => 'action', 'id' => "animap_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
62 | + $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'); |
|
63 | 63 | |
64 | - return $form; |
|
65 | - } |
|
64 | + return $form; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - function build_animap_list_for_admin() { |
|
69 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
70 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
68 | + function build_animap_list_for_admin() { |
|
69 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
70 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
71 | 71 | array("Account", "250", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
72 | - array("Caller ID", "250", "number", "", "", "","","true","center"), |
|
73 | - /* |
|
72 | + array("Caller ID", "250", "number", "", "", "","","true","center"), |
|
73 | + /* |
|
74 | 74 | ASTPP 3.0 |
75 | 75 | creation field show in grid |
76 | 76 | */ |
77 | - array("Status", "180", "status", "status", "ani_map", "get_status","","true","center"), |
|
78 | - array("Created Date", "220", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
79 | - array("Modified Date", "220", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
77 | + array("Status", "180", "status", "status", "ani_map", "get_status","","true","center"), |
|
78 | + array("Created Date", "220", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
79 | + array("Modified Date", "220", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
80 | 80 | |
81 | - /********************************************************************/ |
|
82 | - array("Action", "100", "", "", "", array("EDIT" => array("url" => "animap/animap_edit/", "mode" => "popup", 'popup'), |
|
83 | - "DELETE" => array("url" => "/animap/animap_delete/", "mode" => "single"))) |
|
84 | - )); |
|
85 | - return $grid_field_arr; |
|
86 | - } |
|
81 | + /********************************************************************/ |
|
82 | + array("Action", "100", "", "", "", array("EDIT" => array("url" => "animap/animap_edit/", "mode" => "popup", 'popup'), |
|
83 | + "DELETE" => array("url" => "/animap/animap_delete/", "mode" => "single"))) |
|
84 | + )); |
|
85 | + return $grid_field_arr; |
|
86 | + } |
|
87 | 87 | |
88 | - function build_grid_buttons() { |
|
89 | - $buttons_json = json_encode(array(array("Add" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/animap/animap_add/", "popup"), |
|
90 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/animap/animap_delete_multiple/") |
|
91 | - )); |
|
92 | - return $buttons_json; |
|
93 | - } |
|
88 | + function build_grid_buttons() { |
|
89 | + $buttons_json = json_encode(array(array("Add" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/animap/animap_add/", "popup"), |
|
90 | + array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/animap/animap_delete_multiple/") |
|
91 | + )); |
|
92 | + return $buttons_json; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | 96 |
@@ -24,68 +24,68 @@ |
||
24 | 24 | |
25 | 25 | class ANIMAP_model extends CI_Model { |
26 | 26 | |
27 | - function ANIMAP_model() { |
|
28 | - parent::__construct(); |
|
29 | - } |
|
27 | + function ANIMAP_model() { |
|
28 | + parent::__construct(); |
|
29 | + } |
|
30 | 30 | |
31 | - function animap_list($flag, $start = 0, $limit = 0) { |
|
31 | + function animap_list($flag, $start = 0, $limit = 0) { |
|
32 | 32 | |
33 | 33 | $accountinfo = $this->session->userdata('accountinfo'); |
34 | 34 | |
35 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
36 | - $qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => $accountinfo['id'])); |
|
37 | - $result = $qry->result_array(); |
|
35 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
36 | + $qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => $accountinfo['id'])); |
|
37 | + $result = $qry->result_array(); |
|
38 | 38 | |
39 | - foreach ($result as $value1) { |
|
40 | - $value[] = $value1['id']; |
|
39 | + foreach ($result as $value1) { |
|
40 | + $value[] = $value1['id']; |
|
41 | 41 | |
42 | 42 | |
43 | - } |
|
44 | - $this->db->where_in('accountid', $value); |
|
45 | - } else { |
|
46 | - $qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => 0)); |
|
47 | - $result = $qry->result_array(); |
|
43 | + } |
|
44 | + $this->db->where_in('accountid', $value); |
|
45 | + } else { |
|
46 | + $qry = $this->db_model->getselect('id', 'accounts', array('reseller_id' => 0)); |
|
47 | + $result = $qry->result_array(); |
|
48 | 48 | |
49 | - foreach ($result as $value1) { |
|
50 | - $value[] = $value1['id']; |
|
51 | - } |
|
52 | - $this->db->where_in('accountid', $value); |
|
53 | - } |
|
54 | - $this->db_model->build_search('animap_list_search'); |
|
55 | - if ($flag) { |
|
56 | - $query = $this->db_model->select("*", "ani_map", "", "id", "ASC", $limit, $start); |
|
57 | - } else { |
|
58 | - $query = $this->db_model->countQuery("*", "ani_map", ""); |
|
59 | - } |
|
60 | - return $query; |
|
61 | - } |
|
49 | + foreach ($result as $value1) { |
|
50 | + $value[] = $value1['id']; |
|
51 | + } |
|
52 | + $this->db->where_in('accountid', $value); |
|
53 | + } |
|
54 | + $this->db_model->build_search('animap_list_search'); |
|
55 | + if ($flag) { |
|
56 | + $query = $this->db_model->select("*", "ani_map", "", "id", "ASC", $limit, $start); |
|
57 | + } else { |
|
58 | + $query = $this->db_model->countQuery("*", "ani_map", ""); |
|
59 | + } |
|
60 | + return $query; |
|
61 | + } |
|
62 | 62 | |
63 | - function add_animap($add_array) { |
|
64 | - /* |
|
63 | + function add_animap($add_array) { |
|
64 | + /* |
|
65 | 65 | ASTPP 3.0 |
66 | 66 | Add creation date |
67 | 67 | */ |
68 | - $data=array('creation_date'=>gmdate('Y-m-d H:i:s'),'number'=>$add_array['number'],'accountid'=>$add_array['accountid'],'status'=>$add_array['status'],'context'=>'default'); |
|
69 | - $this->db->insert("ani_map", $data); |
|
70 | - return $this->db->insert_id(); |
|
71 | - } |
|
68 | + $data=array('creation_date'=>gmdate('Y-m-d H:i:s'),'number'=>$add_array['number'],'accountid'=>$add_array['accountid'],'status'=>$add_array['status'],'context'=>'default'); |
|
69 | + $this->db->insert("ani_map", $data); |
|
70 | + return $this->db->insert_id(); |
|
71 | + } |
|
72 | 72 | |
73 | - function edit_animap($add_array, $id) { |
|
74 | - /* |
|
73 | + function edit_animap($add_array, $id) { |
|
74 | + /* |
|
75 | 75 | ASTPP 3.0 |
76 | 76 | last modify date update |
77 | 77 | */ |
78 | - $data=array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'number'=>$add_array['number'],'accountid'=>$add_array['accountid'],'status'=>$add_array['status'],'context'=>'default'); |
|
79 | - /*********************************************************/ |
|
80 | - $this->db->where("id", $id); |
|
81 | - return $this->db->update("ani_map", $data); |
|
82 | - } |
|
78 | + $data=array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'number'=>$add_array['number'],'accountid'=>$add_array['accountid'],'status'=>$add_array['status'],'context'=>'default'); |
|
79 | + /*********************************************************/ |
|
80 | + $this->db->where("id", $id); |
|
81 | + return $this->db->update("ani_map", $data); |
|
82 | + } |
|
83 | 83 | |
84 | - function remove_animap($id) { |
|
85 | - $this->db->where("id", $id); |
|
86 | - $this->db->delete("ani_map"); |
|
87 | - return true; |
|
88 | - } |
|
84 | + function remove_animap($id) { |
|
85 | + $this->db->where("id", $id); |
|
86 | + $this->db->delete("ani_map"); |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | 91 |
@@ -24,1359 +24,1359 @@ discard block |
||
24 | 24 | |
25 | 25 | class Accounts extends MX_Controller { |
26 | 26 | |
27 | - function Accounts() { |
|
28 | - parent::__construct(); |
|
29 | - $this->load->helper('template_inheritance'); |
|
30 | - |
|
31 | - $this->load->library('accounts_form'); |
|
32 | - $this->load->library('astpp/form'); |
|
33 | - |
|
34 | - $this->load->model('common_model'); |
|
35 | - $this->load->library('session'); |
|
36 | - $this->load->helper('form'); |
|
37 | - $this->load->model('accounts_model'); |
|
38 | - $this->load->model('Astpp_common'); |
|
39 | - $this->protected_pages = array('account_list'); |
|
40 | - if ($this->session->userdata('user_login') == FALSE) |
|
41 | - redirect(base_url() . '/login/login'); |
|
42 | - } |
|
43 | - |
|
44 | - function customer_list() { |
|
45 | - $data['username'] = $this->session->userdata('user_name'); |
|
46 | - $data['page_title'] = 'Customers'; |
|
47 | - $data['search_flag'] = true; |
|
48 | - /** |
|
27 | + function Accounts() { |
|
28 | + parent::__construct(); |
|
29 | + $this->load->helper('template_inheritance'); |
|
30 | + |
|
31 | + $this->load->library('accounts_form'); |
|
32 | + $this->load->library('astpp/form'); |
|
33 | + |
|
34 | + $this->load->model('common_model'); |
|
35 | + $this->load->library('session'); |
|
36 | + $this->load->helper('form'); |
|
37 | + $this->load->model('accounts_model'); |
|
38 | + $this->load->model('Astpp_common'); |
|
39 | + $this->protected_pages = array('account_list'); |
|
40 | + if ($this->session->userdata('user_login') == FALSE) |
|
41 | + redirect(base_url() . '/login/login'); |
|
42 | + } |
|
43 | + |
|
44 | + function customer_list() { |
|
45 | + $data['username'] = $this->session->userdata('user_name'); |
|
46 | + $data['page_title'] = 'Customers'; |
|
47 | + $data['search_flag'] = true; |
|
48 | + /** |
|
49 | 49 | ASTPP 3.0 |
50 | 50 | Customer Batch Update. |
51 | - * */ |
|
52 | - $data['batch_update_flag'] = true; |
|
53 | - /* * *********************************** */ |
|
54 | - $this->session->set_userdata('advance_search', 0); |
|
55 | - $data['grid_fields'] = $this->accounts_form->build_account_list_for_customer(); |
|
56 | - $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_customer(); |
|
57 | - $data['form_search'] = $this->form->build_serach_form($this->accounts_form->get_search_customer_form()); |
|
58 | - /** |
|
51 | + * */ |
|
52 | + $data['batch_update_flag'] = true; |
|
53 | + /* * *********************************** */ |
|
54 | + $this->session->set_userdata('advance_search', 0); |
|
55 | + $data['grid_fields'] = $this->accounts_form->build_account_list_for_customer(); |
|
56 | + $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_customer(); |
|
57 | + $data['form_search'] = $this->form->build_serach_form($this->accounts_form->get_search_customer_form()); |
|
58 | + /** |
|
59 | 59 | ASTPP 3.0 |
60 | 60 | Customer Batch Update. |
61 | - * */ |
|
61 | + * */ |
|
62 | 62 | |
63 | - $data['form_batch_update'] = $this->form->build_batchupdate_form($this->accounts_form->customer_batch_update_form()); |
|
64 | - /* * *****************************************************************************************8 */ |
|
65 | - $this->load->view('view_accounts_list', $data); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * -------Here we write code for controller accounts functions account_list------ |
|
70 | - * Listing of Accounts table data through php function json_encode |
|
71 | - */ |
|
72 | - function customer_list_json() { |
|
73 | - $json_data = array(); |
|
74 | - $count_all = $this->accounts_model->get_customer_Account_list(false); |
|
75 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
76 | - $json_data = $paging_data["json_paging"]; |
|
77 | - $query = $this->accounts_model->get_customer_Account_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
78 | - $grid_fields = json_decode($this->accounts_form->build_account_list_for_customer()); |
|
79 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
80 | - echo json_encode($json_data); |
|
81 | - } |
|
82 | - |
|
83 | - function customer_list_search() { |
|
84 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
85 | - |
|
86 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
87 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
88 | - $action = $this->input->post(); |
|
89 | - unset($action['action']); |
|
90 | - unset($action['advance_search']); |
|
91 | - if (isset($action['balance']['balance']) && $action['balance']['balance'] != '') { |
|
92 | - $action['balance']['balance'] = $this->common_model->add_calculate_currency($action['balance']['balance'], "", '', false, false); |
|
93 | - } |
|
94 | - if (isset($action['credit_limit']['credit_limit']) && $action['credit_limit']['credit_limit'] != '') { |
|
95 | - $action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '', false, false); |
|
96 | - } |
|
97 | - $this->session->set_userdata('customer_list_search', $action); |
|
98 | - } |
|
99 | - if (@$ajax_search != 1) { |
|
100 | - redirect(base_url() . 'accounts/customer_list/'); |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - function customer_list_clearsearchfilter() { |
|
105 | - $this->session->set_userdata('advance_search', 0); |
|
106 | - $this->session->set_userdata('customer_list_search', ""); |
|
107 | - } |
|
108 | - |
|
109 | - function customer_export_cdr_xls() { |
|
110 | - $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
111 | - $currency_id=$account_info['currency_id']; |
|
112 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
113 | - $query = $this->accounts_model->get_customer_Account_list(true, '', '', true); |
|
114 | - ob_clean(); |
|
115 | - $customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Balance ($currency)", "Credit Limit ($currency)", "First Used", "Expiry Date","CC","Status","Created Date"); |
|
116 | - if ($query->num_rows() > 0) { |
|
117 | - |
|
118 | - foreach ($query->result_array() as $row) { |
|
119 | - $customer_array[] = array( |
|
120 | - $row['number'], |
|
121 | - $row['first_name'], |
|
122 | - $row['last_name'], |
|
123 | - $row['company_name'], |
|
124 | - $this->common->get_field_name('name', 'pricelists', $row['pricelist_id']), |
|
125 | - $this->common_model->calculate_currency_customer($row['balance']), |
|
126 | - $this->common_model->calculate_currency_customer($row['credit_limit']), |
|
127 | - $row['first_used'], |
|
128 | - $row['expiry'], |
|
129 | - $row['maxchannels'], |
|
130 | - $this->common->get_status('export', '', $row['status']), |
|
131 | - $row['creation'], |
|
132 | - ); |
|
133 | - } |
|
134 | - } |
|
135 | - $this->load->helper('csv'); |
|
136 | - array_to_csv($customer_array, 'Customers_' . date("Y-m-d") . '.csv'); |
|
137 | - } |
|
138 | - |
|
139 | - function provider_add() { |
|
140 | - $this->customer_add(3); |
|
141 | - } |
|
142 | - |
|
143 | - function provider_edit($edit_id = '') { |
|
144 | - $this->customer_edit($edit_id); |
|
145 | - } |
|
146 | - |
|
147 | - function provider_save() { |
|
148 | - $add_array = $this->input->post(); |
|
149 | - $this->customer_save($add_array); |
|
150 | - } |
|
151 | - |
|
152 | - function customer_add($type = 0) { |
|
63 | + $data['form_batch_update'] = $this->form->build_batchupdate_form($this->accounts_form->customer_batch_update_form()); |
|
64 | + /* * *****************************************************************************************8 */ |
|
65 | + $this->load->view('view_accounts_list', $data); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * -------Here we write code for controller accounts functions account_list------ |
|
70 | + * Listing of Accounts table data through php function json_encode |
|
71 | + */ |
|
72 | + function customer_list_json() { |
|
73 | + $json_data = array(); |
|
74 | + $count_all = $this->accounts_model->get_customer_Account_list(false); |
|
75 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
76 | + $json_data = $paging_data["json_paging"]; |
|
77 | + $query = $this->accounts_model->get_customer_Account_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
78 | + $grid_fields = json_decode($this->accounts_form->build_account_list_for_customer()); |
|
79 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
80 | + echo json_encode($json_data); |
|
81 | + } |
|
82 | + |
|
83 | + function customer_list_search() { |
|
84 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
85 | + |
|
86 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
87 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
88 | + $action = $this->input->post(); |
|
89 | + unset($action['action']); |
|
90 | + unset($action['advance_search']); |
|
91 | + if (isset($action['balance']['balance']) && $action['balance']['balance'] != '') { |
|
92 | + $action['balance']['balance'] = $this->common_model->add_calculate_currency($action['balance']['balance'], "", '', false, false); |
|
93 | + } |
|
94 | + if (isset($action['credit_limit']['credit_limit']) && $action['credit_limit']['credit_limit'] != '') { |
|
95 | + $action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '', false, false); |
|
96 | + } |
|
97 | + $this->session->set_userdata('customer_list_search', $action); |
|
98 | + } |
|
99 | + if (@$ajax_search != 1) { |
|
100 | + redirect(base_url() . 'accounts/customer_list/'); |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + function customer_list_clearsearchfilter() { |
|
105 | + $this->session->set_userdata('advance_search', 0); |
|
106 | + $this->session->set_userdata('customer_list_search', ""); |
|
107 | + } |
|
108 | + |
|
109 | + function customer_export_cdr_xls() { |
|
110 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
111 | + $currency_id=$account_info['currency_id']; |
|
112 | + $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
113 | + $query = $this->accounts_model->get_customer_Account_list(true, '', '', true); |
|
114 | + ob_clean(); |
|
115 | + $customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Balance ($currency)", "Credit Limit ($currency)", "First Used", "Expiry Date","CC","Status","Created Date"); |
|
116 | + if ($query->num_rows() > 0) { |
|
117 | + |
|
118 | + foreach ($query->result_array() as $row) { |
|
119 | + $customer_array[] = array( |
|
120 | + $row['number'], |
|
121 | + $row['first_name'], |
|
122 | + $row['last_name'], |
|
123 | + $row['company_name'], |
|
124 | + $this->common->get_field_name('name', 'pricelists', $row['pricelist_id']), |
|
125 | + $this->common_model->calculate_currency_customer($row['balance']), |
|
126 | + $this->common_model->calculate_currency_customer($row['credit_limit']), |
|
127 | + $row['first_used'], |
|
128 | + $row['expiry'], |
|
129 | + $row['maxchannels'], |
|
130 | + $this->common->get_status('export', '', $row['status']), |
|
131 | + $row['creation'], |
|
132 | + ); |
|
133 | + } |
|
134 | + } |
|
135 | + $this->load->helper('csv'); |
|
136 | + array_to_csv($customer_array, 'Customers_' . date("Y-m-d") . '.csv'); |
|
137 | + } |
|
138 | + |
|
139 | + function provider_add() { |
|
140 | + $this->customer_add(3); |
|
141 | + } |
|
142 | + |
|
143 | + function provider_edit($edit_id = '') { |
|
144 | + $this->customer_edit($edit_id); |
|
145 | + } |
|
146 | + |
|
147 | + function provider_save() { |
|
148 | + $add_array = $this->input->post(); |
|
149 | + $this->customer_save($add_array); |
|
150 | + } |
|
151 | + |
|
152 | + function customer_add($type = 0) { |
|
153 | 153 | $accountinfo = $this->session->userdata('accountinfo'); |
154 | - $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
|
155 | - $data['username'] = $this->session->userdata('user_name'); |
|
156 | - $data['flag'] = 'create'; |
|
157 | - $data['page_title'] = 'Create ' . $entity_type; |
|
158 | - $data['back_flag'] = true; |
|
159 | - $data['country_id'] = $accountinfo['country_id']; |
|
160 | - $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
161 | - $data['currency_id'] = $accountinfo['currency_id']; |
|
162 | - $data['timezone_id'] = $accountinfo['timezone_id']; |
|
163 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_type), ''); |
|
164 | - if (!$data['timezone_id']) { |
|
165 | - $data['timezone_id'] = 1; |
|
166 | - } |
|
167 | - if (!$data['currency_id']) { |
|
168 | - $data['currency_id'] = 1; |
|
169 | - } |
|
170 | - if (!$data['country_id']) { |
|
171 | - $data['country_id'] = 1; |
|
172 | - } |
|
173 | - $data['entity_name'] = $entity_type; |
|
174 | - $this->load->view('view_accounts_create', $data); |
|
175 | - } |
|
176 | - |
|
177 | - function customer_edit($edit_id = '') { |
|
178 | - //Get Account information from session. |
|
179 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
180 | - //Get Parent informartion |
|
181 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
182 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
183 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
184 | - if ($account->num_rows > 0) { |
|
185 | - $account_data = (array) $account->first_row(); |
|
186 | - $entity_name = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
187 | - $data['page_title'] =ucfirst($entity_name) . " Profile"; |
|
188 | - $data['invoice_date'] = $account_data['invoice_day']; |
|
189 | - $data["account_data"] = $account_data; |
|
190 | - $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
191 | - $data['entity_name'] = $entity_name; |
|
192 | - //Purpose : Get assigned taxes value for customer |
|
193 | - $taxes_data = $this->db_model->getSelect("group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array("accountid" => $edit_id)); |
|
194 | - if (isset($taxes_data) && $taxes_data->num_rows() > 0) { |
|
195 | - $taxes_data = $taxes_data->result_array(); |
|
196 | - $account_data["tax_id"] = explode(",", $taxes_data[0]['taxes_id']); |
|
197 | - } |
|
198 | - /* * *** |
|
154 | + $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
|
155 | + $data['username'] = $this->session->userdata('user_name'); |
|
156 | + $data['flag'] = 'create'; |
|
157 | + $data['page_title'] = 'Create ' . $entity_type; |
|
158 | + $data['back_flag'] = true; |
|
159 | + $data['country_id'] = $accountinfo['country_id']; |
|
160 | + $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
161 | + $data['currency_id'] = $accountinfo['currency_id']; |
|
162 | + $data['timezone_id'] = $accountinfo['timezone_id']; |
|
163 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_type), ''); |
|
164 | + if (!$data['timezone_id']) { |
|
165 | + $data['timezone_id'] = 1; |
|
166 | + } |
|
167 | + if (!$data['currency_id']) { |
|
168 | + $data['currency_id'] = 1; |
|
169 | + } |
|
170 | + if (!$data['country_id']) { |
|
171 | + $data['country_id'] = 1; |
|
172 | + } |
|
173 | + $data['entity_name'] = $entity_type; |
|
174 | + $this->load->view('view_accounts_create', $data); |
|
175 | + } |
|
176 | + |
|
177 | + function customer_edit($edit_id = '') { |
|
178 | + //Get Account information from session. |
|
179 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
180 | + //Get Parent informartion |
|
181 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
182 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
183 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
184 | + if ($account->num_rows > 0) { |
|
185 | + $account_data = (array) $account->first_row(); |
|
186 | + $entity_name = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
187 | + $data['page_title'] =ucfirst($entity_name) . " Profile"; |
|
188 | + $data['invoice_date'] = $account_data['invoice_day']; |
|
189 | + $data["account_data"] = $account_data; |
|
190 | + $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
191 | + $data['entity_name'] = $entity_name; |
|
192 | + //Purpose : Get assigned taxes value for customer |
|
193 | + $taxes_data = $this->db_model->getSelect("group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array("accountid" => $edit_id)); |
|
194 | + if (isset($taxes_data) && $taxes_data->num_rows() > 0) { |
|
195 | + $taxes_data = $taxes_data->result_array(); |
|
196 | + $account_data["tax_id"] = explode(",", $taxes_data[0]['taxes_id']); |
|
197 | + } |
|
198 | + /* * *** |
|
199 | 199 | ASTPP 3.0 |
200 | 200 | Password decode |
201 | 201 | * **** */ |
202 | - $account_data['password'] = $this->common->decode($account_data['password']); |
|
203 | - /* * ********************** */ |
|
204 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $edit_id), $account_data); |
|
205 | - $data['edit_id']=$edit_id; |
|
206 | - $this->load->view('view_customer_details', $data); |
|
207 | - } else { |
|
208 | - redirect(base_url() . 'accounts/customer_list/'); |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - function customer_save($add_array = false) { |
|
213 | - $add_array = $this->input->post(); |
|
214 | - $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type'])); |
|
215 | - $data['country_id'] = $add_array['country_id']; |
|
216 | - $data['timezone_id'] = $add_array['timezone_id']; |
|
217 | - $data['currency_id'] = $add_array['currency_id']; |
|
218 | - $data['entity_name'] = $entity_name; |
|
219 | - $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
220 | - $data['edit_id']=$add_array['id']; |
|
221 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array); |
|
222 | - if ($add_array['id'] != '') { |
|
223 | - $data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']); |
|
224 | - if ($this->form_validation->run() == FALSE) { |
|
225 | - $data['validation_errors'] = validation_errors(); |
|
226 | - } else { |
|
227 | - /* * **** |
|
202 | + $account_data['password'] = $this->common->decode($account_data['password']); |
|
203 | + /* * ********************** */ |
|
204 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $edit_id), $account_data); |
|
205 | + $data['edit_id']=$edit_id; |
|
206 | + $this->load->view('view_customer_details', $data); |
|
207 | + } else { |
|
208 | + redirect(base_url() . 'accounts/customer_list/'); |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + function customer_save($add_array = false) { |
|
213 | + $add_array = $this->input->post(); |
|
214 | + $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type'])); |
|
215 | + $data['country_id'] = $add_array['country_id']; |
|
216 | + $data['timezone_id'] = $add_array['timezone_id']; |
|
217 | + $data['currency_id'] = $add_array['currency_id']; |
|
218 | + $data['entity_name'] = $entity_name; |
|
219 | + $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
220 | + $data['edit_id']=$add_array['id']; |
|
221 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array); |
|
222 | + if ($add_array['id'] != '') { |
|
223 | + $data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']); |
|
224 | + if ($this->form_validation->run() == FALSE) { |
|
225 | + $data['validation_errors'] = validation_errors(); |
|
226 | + } else { |
|
227 | + /* * **** |
|
228 | 228 | ASTPP 3.0 |
229 | 229 | Password encode |
230 | 230 | * **** */ |
231 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
232 | - /* * ****************** */ |
|
233 | - $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
234 | - //Purpose : Get assigned taxes value for customer |
|
235 | - |
|
236 | - $query = $this->accounts_model->remove_all_account_tax($add_array['id']); |
|
237 | - if (isset($add_array['tax_id'])) { |
|
238 | - foreach ($add_array['tax_id'] as $key => $val) { |
|
239 | - $data1 = array( |
|
240 | - 'accountid' => $add_array['id'], |
|
241 | - 'taxes_id' => $val, |
|
242 | - ); |
|
243 | - $this->accounts_model->add_account_tax($data1); |
|
244 | - } |
|
245 | - unset($add_array['tax_id']); |
|
246 | - } |
|
247 | - //Completed |
|
248 | - unset($add_array['posttoexternal'],$add_array['number']); |
|
249 | - $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
250 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
251 | - redirect(base_url() . 'accounts/customer_list/'); |
|
252 | - exit; |
|
253 | - } |
|
254 | - $data["account_data"]["0"] = $add_array; |
|
255 | - $this->load->view('view_customer_details', $data); |
|
256 | - } else { |
|
257 | - $data['page_title'] = 'Create ' . $entity_name; |
|
258 | - if ($this->form_validation->run() == FALSE) { |
|
259 | - $data['validation_errors'] = validation_errors(); |
|
260 | - } else { |
|
261 | - /* * **** |
|
231 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
232 | + /* * ****************** */ |
|
233 | + $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
234 | + //Purpose : Get assigned taxes value for customer |
|
235 | + |
|
236 | + $query = $this->accounts_model->remove_all_account_tax($add_array['id']); |
|
237 | + if (isset($add_array['tax_id'])) { |
|
238 | + foreach ($add_array['tax_id'] as $key => $val) { |
|
239 | + $data1 = array( |
|
240 | + 'accountid' => $add_array['id'], |
|
241 | + 'taxes_id' => $val, |
|
242 | + ); |
|
243 | + $this->accounts_model->add_account_tax($data1); |
|
244 | + } |
|
245 | + unset($add_array['tax_id']); |
|
246 | + } |
|
247 | + //Completed |
|
248 | + unset($add_array['posttoexternal'],$add_array['number']); |
|
249 | + $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
250 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
251 | + redirect(base_url() . 'accounts/customer_list/'); |
|
252 | + exit; |
|
253 | + } |
|
254 | + $data["account_data"]["0"] = $add_array; |
|
255 | + $this->load->view('view_customer_details', $data); |
|
256 | + } else { |
|
257 | + $data['page_title'] = 'Create ' . $entity_name; |
|
258 | + if ($this->form_validation->run() == FALSE) { |
|
259 | + $data['validation_errors'] = validation_errors(); |
|
260 | + } else { |
|
261 | + /* * **** |
|
262 | 262 | ASTPP 3.0 |
263 | 263 | Password encode |
264 | 264 | * **** */ |
265 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
266 | - /* * ****************** */ |
|
267 | - $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
268 | - $last_id = $this->accounts_model->add_account($add_array); |
|
269 | - |
|
270 | - if (isset($add_array['tax_id'])) { |
|
271 | - foreach ($add_array['tax_id'] as $key => $val) { |
|
272 | - $data1 = array( |
|
273 | - 'accountid' => $last_id, |
|
274 | - 'taxes_id' => $val, |
|
275 | - ); |
|
276 | - $this->accounts_model->add_account_tax($data1); |
|
277 | - } |
|
278 | - unset($add_array['tax_id']); |
|
279 | - } |
|
280 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' added successfully!'); |
|
281 | - redirect(base_url() . 'accounts/customer_list/'); |
|
282 | - exit; |
|
283 | - } |
|
284 | - $this->load->view('view_accounts_create', $data); |
|
285 | - } |
|
286 | - } |
|
287 | - |
|
288 | - function provider_speeddial($edit_id) { |
|
289 | - $this->customer_speeddial($edit_id); |
|
290 | - } |
|
291 | - |
|
292 | - function customer_speeddial($edit_id) { |
|
293 | - //Get Account information from session. |
|
294 | - $data['page_title'] = "Speed Dial"; |
|
295 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
296 | - //Get Parent informartion |
|
297 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
298 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
299 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
300 | - |
|
301 | - if ($account->num_rows > 0) { |
|
302 | - $account_data = (array) $account->first_row(); |
|
303 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
304 | - $data['page_title'] = 'Speed Dial'; |
|
305 | - $data['accounttype'] = $accounttype; |
|
306 | - $data['invoice_date'] = $account_data['invoice_day']; |
|
307 | - $data["account_data"] = $account_data; |
|
308 | - $data['edit_id'] = $edit_id; |
|
309 | - $speeddial_res = $this->db->get_where("speed_dial", array("accountid" => $edit_id)); |
|
310 | - $speeddial_info = array(); |
|
311 | - if ($speeddial_res->num_rows() > 0) { |
|
312 | - $speeddial_res = $speeddial_res->result_array(); |
|
313 | - foreach ($speeddial_res as $key => $value) { |
|
314 | - $speeddial_info[$value['speed_num']] = $value['number']; |
|
315 | - } |
|
316 | - } |
|
317 | - $data['speeddial'] = $speeddial_info; |
|
318 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($accounttype, $edit_id), $account_data); |
|
319 | - $this->load->view('view_customer_speed_dial', $data); |
|
320 | - } else { |
|
321 | - redirect(base_url() . 'accounts/customer_list/'); |
|
322 | - } |
|
323 | - } |
|
324 | - |
|
325 | - function customer_speeddial_save($number, $accountid, $speed_num) { |
|
326 | - $where = array("accountid" => $accountid); |
|
327 | - $account = $this->db_model->getSelect("*", "speed_dial", $where); |
|
328 | - if ($account->num_rows() == 0) { |
|
329 | - for ($i = 0; $i <= 9; $i++) { |
|
330 | - $dest_number = $speed_num == $i ? $number : ''; |
|
331 | - $data[$i] = array("number" => $dest_number, "speed_num" => $i, 'accountid' => $accountid); |
|
332 | - } |
|
333 | - $this->db->insert_batch('speed_dial', $data); |
|
334 | - } else { |
|
335 | - $updateinfo = array('number' => $number); |
|
336 | - $this->db->where('speed_num', $speed_num); |
|
337 | - $this->db->where('accountid', $accountid); |
|
338 | - $result = $this->db->update('speed_dial', $updateinfo); |
|
339 | - } |
|
340 | - } |
|
341 | - |
|
342 | - function customer_speeddial_remove($accountid, $speed_num) { |
|
343 | - $updateinfo = array('number' => ''); |
|
344 | - $this->db->where('speed_num', $speed_num); |
|
345 | - $this->db->where('accountid', $accountid); |
|
346 | - $result = $this->db->update('speed_dial', $updateinfo); |
|
347 | - } |
|
348 | - |
|
349 | - function provider_ipmap($edit_id) { |
|
350 | - $this->customer_ipmap($edit_id); |
|
351 | - } |
|
352 | - |
|
353 | - function customer_ipmap($edit_id) { |
|
354 | - $data['page_title'] = "IP Settings"; |
|
355 | - $data['add_form']=true; |
|
356 | - //Get Account information from session. |
|
357 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
358 | - //Get Parent informartion |
|
359 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
360 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
361 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
362 | - if ($account_res->num_rows > 0) { |
|
363 | - $account_data = (array) $account_res->first_row(); |
|
364 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
365 | - $data["grid_fields"] = $this->accounts_form->build_ip_list_for_customer($edit_id, $accounttype); |
|
366 | - $data['edit_id'] = $edit_id; |
|
367 | - $data['accounttype'] = $accounttype; |
|
368 | - $this->load->view('view_customer_ipmap', $data); |
|
369 | - } else { |
|
370 | - redirect(base_url() . 'accounts/customer_list/'); |
|
371 | - exit; |
|
372 | - } |
|
373 | - } |
|
374 | - |
|
375 | - function customer_ipmap_json($accountid, $accounttype) { |
|
376 | - $json_data = array(); |
|
377 | - $where = array("accountid" => $accountid); |
|
378 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_ipmap'); |
|
379 | - $like_str=!empty($instant_search) ? "(name like '%$instant_search%' OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" :null; |
|
380 | - if(!empty($like_str)) |
|
381 | - $this->db->where($like_str); |
|
382 | - $count_all = $this->db_model->countQuery("*", "ip_map", $where); |
|
383 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
384 | - $json_data = $paging_data["json_paging"]; |
|
385 | - if(!empty($like_str)) |
|
386 | - $this->db->where($like_str); |
|
387 | - $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
388 | - $grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype)); |
|
389 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
265 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
266 | + /* * ****************** */ |
|
267 | + $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
268 | + $last_id = $this->accounts_model->add_account($add_array); |
|
269 | + |
|
270 | + if (isset($add_array['tax_id'])) { |
|
271 | + foreach ($add_array['tax_id'] as $key => $val) { |
|
272 | + $data1 = array( |
|
273 | + 'accountid' => $last_id, |
|
274 | + 'taxes_id' => $val, |
|
275 | + ); |
|
276 | + $this->accounts_model->add_account_tax($data1); |
|
277 | + } |
|
278 | + unset($add_array['tax_id']); |
|
279 | + } |
|
280 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' added successfully!'); |
|
281 | + redirect(base_url() . 'accounts/customer_list/'); |
|
282 | + exit; |
|
283 | + } |
|
284 | + $this->load->view('view_accounts_create', $data); |
|
285 | + } |
|
286 | + } |
|
287 | + |
|
288 | + function provider_speeddial($edit_id) { |
|
289 | + $this->customer_speeddial($edit_id); |
|
290 | + } |
|
291 | + |
|
292 | + function customer_speeddial($edit_id) { |
|
293 | + //Get Account information from session. |
|
294 | + $data['page_title'] = "Speed Dial"; |
|
295 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
296 | + //Get Parent informartion |
|
297 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
298 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
299 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
300 | + |
|
301 | + if ($account->num_rows > 0) { |
|
302 | + $account_data = (array) $account->first_row(); |
|
303 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
304 | + $data['page_title'] = 'Speed Dial'; |
|
305 | + $data['accounttype'] = $accounttype; |
|
306 | + $data['invoice_date'] = $account_data['invoice_day']; |
|
307 | + $data["account_data"] = $account_data; |
|
308 | + $data['edit_id'] = $edit_id; |
|
309 | + $speeddial_res = $this->db->get_where("speed_dial", array("accountid" => $edit_id)); |
|
310 | + $speeddial_info = array(); |
|
311 | + if ($speeddial_res->num_rows() > 0) { |
|
312 | + $speeddial_res = $speeddial_res->result_array(); |
|
313 | + foreach ($speeddial_res as $key => $value) { |
|
314 | + $speeddial_info[$value['speed_num']] = $value['number']; |
|
315 | + } |
|
316 | + } |
|
317 | + $data['speeddial'] = $speeddial_info; |
|
318 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($accounttype, $edit_id), $account_data); |
|
319 | + $this->load->view('view_customer_speed_dial', $data); |
|
320 | + } else { |
|
321 | + redirect(base_url() . 'accounts/customer_list/'); |
|
322 | + } |
|
323 | + } |
|
324 | + |
|
325 | + function customer_speeddial_save($number, $accountid, $speed_num) { |
|
326 | + $where = array("accountid" => $accountid); |
|
327 | + $account = $this->db_model->getSelect("*", "speed_dial", $where); |
|
328 | + if ($account->num_rows() == 0) { |
|
329 | + for ($i = 0; $i <= 9; $i++) { |
|
330 | + $dest_number = $speed_num == $i ? $number : ''; |
|
331 | + $data[$i] = array("number" => $dest_number, "speed_num" => $i, 'accountid' => $accountid); |
|
332 | + } |
|
333 | + $this->db->insert_batch('speed_dial', $data); |
|
334 | + } else { |
|
335 | + $updateinfo = array('number' => $number); |
|
336 | + $this->db->where('speed_num', $speed_num); |
|
337 | + $this->db->where('accountid', $accountid); |
|
338 | + $result = $this->db->update('speed_dial', $updateinfo); |
|
339 | + } |
|
340 | + } |
|
341 | + |
|
342 | + function customer_speeddial_remove($accountid, $speed_num) { |
|
343 | + $updateinfo = array('number' => ''); |
|
344 | + $this->db->where('speed_num', $speed_num); |
|
345 | + $this->db->where('accountid', $accountid); |
|
346 | + $result = $this->db->update('speed_dial', $updateinfo); |
|
347 | + } |
|
348 | + |
|
349 | + function provider_ipmap($edit_id) { |
|
350 | + $this->customer_ipmap($edit_id); |
|
351 | + } |
|
352 | + |
|
353 | + function customer_ipmap($edit_id) { |
|
354 | + $data['page_title'] = "IP Settings"; |
|
355 | + $data['add_form']=true; |
|
356 | + //Get Account information from session. |
|
357 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
358 | + //Get Parent informartion |
|
359 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
360 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
361 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
362 | + if ($account_res->num_rows > 0) { |
|
363 | + $account_data = (array) $account_res->first_row(); |
|
364 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
365 | + $data["grid_fields"] = $this->accounts_form->build_ip_list_for_customer($edit_id, $accounttype); |
|
366 | + $data['edit_id'] = $edit_id; |
|
367 | + $data['accounttype'] = $accounttype; |
|
368 | + $this->load->view('view_customer_ipmap', $data); |
|
369 | + } else { |
|
370 | + redirect(base_url() . 'accounts/customer_list/'); |
|
371 | + exit; |
|
372 | + } |
|
373 | + } |
|
374 | + |
|
375 | + function customer_ipmap_json($accountid, $accounttype) { |
|
376 | + $json_data = array(); |
|
377 | + $where = array("accountid" => $accountid); |
|
378 | + $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_ipmap'); |
|
379 | + $like_str=!empty($instant_search) ? "(name like '%$instant_search%' OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" :null; |
|
380 | + if(!empty($like_str)) |
|
381 | + $this->db->where($like_str); |
|
382 | + $count_all = $this->db_model->countQuery("*", "ip_map", $where); |
|
383 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
384 | + $json_data = $paging_data["json_paging"]; |
|
385 | + if(!empty($like_str)) |
|
386 | + $this->db->where($like_str); |
|
387 | + $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
388 | + $grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype)); |
|
389 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
390 | 390 | |
391 | - echo json_encode($json_data); |
|
392 | - } |
|
393 | - |
|
394 | - function provider_ipmap_action($action, $accountid, $accounttype, $ipmapid = "") { |
|
395 | - $this->customer_ipmap_action($action, $accountid, $accounttype, $ipmapid); |
|
396 | - } |
|
397 | - |
|
398 | - function customer_ipmap_action($action, $accountid, $accounttype, $ipmapid = "") { |
|
399 | - $add_array = $this->input->post(); |
|
400 | - if ($action == "add") { |
|
401 | - if ($add_array['ip'] != "") { |
|
402 | - $ip = $add_array['ip']; |
|
403 | - if (strpos($ip, '/') !== false) { |
|
404 | - $add_array['ip'] = $add_array['ip']; |
|
405 | - } else { |
|
406 | - $add_array['ip'] = $add_array['ip'] . '/32'; |
|
407 | - } |
|
408 | - $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
|
409 | - $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
|
410 | - if ($getdata > 0) { |
|
411 | - $this->session->set_flashdata('astpp_notification', 'IP already exist in system.'); |
|
412 | - } else { |
|
413 | - if ($accounttype == "provider") { |
|
414 | - $add_array['pricelist_id'] = 0; |
|
415 | - } |
|
416 | - unset($add_array['action']); |
|
417 | - $add_array['context'] = 'default'; |
|
418 | - $add_array['accountid'] = $accountid; |
|
419 | - $ip_flag = $this->db->insert("ip_map", $add_array); |
|
420 | - if ($ip_flag) { |
|
421 | - $this->load->library('freeswitch_lib'); |
|
422 | - $this->load->module('freeswitch/freeswitch'); |
|
423 | - $command = "api reloadacl"; |
|
424 | - $response = $this->freeswitch_model->reload_freeswitch($command); |
|
425 | - $this->session->set_userdata('astpp_notification', $response); |
|
426 | - } |
|
427 | - $this->session->set_flashdata('astpp_errormsg', 'IP added sucessfully.'); |
|
428 | - } |
|
429 | - } |
|
430 | - } |
|
431 | - if ($action == "delete") { |
|
432 | - $ip_flag = $this->db_model->delete("ip_map", array("id" => $ipmapid)); |
|
433 | - if ($ip_flag) { |
|
434 | - $this->load->library('freeswitch_lib'); |
|
435 | - $this->load->model("freeswitch_model"); |
|
436 | - $command = "api reloadacl"; |
|
437 | - $this->freeswitch_model->reload_freeswitch($command); |
|
438 | - } |
|
439 | - $this->session->set_flashdata('astpp_notification', 'IP removed sucessfully.'); |
|
440 | - } |
|
441 | - redirect(base_url() . "accounts/" . $accounttype . "_ipmap/" . $accountid . "/"); |
|
442 | - } |
|
443 | - |
|
444 | - //This function using for provider t |
|
445 | - function provider_animap($edit_id) { |
|
446 | - $this->customer_animap($edit_id, 'provider'); |
|
447 | - } |
|
448 | - |
|
449 | - // This function using for showing data of customer/provider CallerID Tab |
|
450 | - function customer_animap($edit_id, $entity_type = 'customer') { |
|
451 | - //Get Account information from session. |
|
452 | - $data['page_title'] = "Caller ID"; |
|
453 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
454 | - //Get Parent informartion |
|
455 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
456 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
457 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
458 | - if ($account_res->num_rows > 0) { |
|
459 | - $account_data = (array) $account_res->first_row(); |
|
460 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
461 | - $data["grid_fields"] = $this->accounts_form->build_animap_list_for_customer($edit_id, $accounttype); |
|
462 | - $data['edit_id'] = $edit_id; |
|
463 | - $data['accounttype'] = $accounttype; |
|
464 | - $this->load->view('view_customer_animap', $data); |
|
465 | - } else { |
|
466 | - redirect(base_url() . 'accounts/customer_list/'); |
|
467 | - exit; |
|
468 | - } |
|
469 | - } |
|
470 | - |
|
471 | - function customer_animap_json($accountid, $accounttype) { |
|
472 | - $json_data = array(); |
|
473 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); |
|
474 | - $like_str=!empty($instant_search) ? "(number like '%$instant_search%' OR creation_date like '%$instant_search%' )" :null; |
|
475 | - if(!empty($like_str)) |
|
476 | - $this->db->where($like_str); |
|
477 | - $where = array("accountid" => $accountid); |
|
478 | - $count_all = $this->db_model->countQuery("*", "ani_map", $where); |
|
479 | - |
|
480 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
481 | - $json_data = $paging_data["json_paging"]; |
|
482 | - if(!empty($like_str)) |
|
483 | - $this->db->where($like_str); |
|
484 | - $query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
485 | - |
|
486 | - $grid_fields = json_decode($this->accounts_form->build_animap_list_for_customer($accountid, $accounttype)); |
|
487 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
488 | - |
|
489 | - echo json_encode($json_data); |
|
490 | - } |
|
491 | - |
|
492 | - function provider_animap_action($action, $accountid, $aniid = "") { |
|
493 | - $this->customer_animap_action($action, $accountid, $aniid); |
|
494 | - } |
|
495 | - |
|
496 | - //This function using for customer/provider callerID add/delete |
|
497 | - function customer_animap_action($action, $accountid, $aniid = "") { |
|
498 | - $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
499 | - $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
500 | - $url = "accounts/" . $entity_type . "_animap/$accountid/"; |
|
501 | - if ($action == "add") { |
|
502 | - $ani = $this->input->post(); |
|
503 | - $this->db->where('number', $ani['number']); |
|
504 | - $this->db->select('count(id) as count'); |
|
505 | - $cnt_result = $this->db->get('ani_map'); |
|
506 | - $cnt_result = $cnt_result->result_array(); |
|
507 | - $count = $cnt_result[0]['count']; |
|
508 | - if ($count == 0) { |
|
509 | - if ($ani['number'] != "") { |
|
510 | - /* |
|
391 | + echo json_encode($json_data); |
|
392 | + } |
|
393 | + |
|
394 | + function provider_ipmap_action($action, $accountid, $accounttype, $ipmapid = "") { |
|
395 | + $this->customer_ipmap_action($action, $accountid, $accounttype, $ipmapid); |
|
396 | + } |
|
397 | + |
|
398 | + function customer_ipmap_action($action, $accountid, $accounttype, $ipmapid = "") { |
|
399 | + $add_array = $this->input->post(); |
|
400 | + if ($action == "add") { |
|
401 | + if ($add_array['ip'] != "") { |
|
402 | + $ip = $add_array['ip']; |
|
403 | + if (strpos($ip, '/') !== false) { |
|
404 | + $add_array['ip'] = $add_array['ip']; |
|
405 | + } else { |
|
406 | + $add_array['ip'] = $add_array['ip'] . '/32'; |
|
407 | + } |
|
408 | + $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
|
409 | + $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
|
410 | + if ($getdata > 0) { |
|
411 | + $this->session->set_flashdata('astpp_notification', 'IP already exist in system.'); |
|
412 | + } else { |
|
413 | + if ($accounttype == "provider") { |
|
414 | + $add_array['pricelist_id'] = 0; |
|
415 | + } |
|
416 | + unset($add_array['action']); |
|
417 | + $add_array['context'] = 'default'; |
|
418 | + $add_array['accountid'] = $accountid; |
|
419 | + $ip_flag = $this->db->insert("ip_map", $add_array); |
|
420 | + if ($ip_flag) { |
|
421 | + $this->load->library('freeswitch_lib'); |
|
422 | + $this->load->module('freeswitch/freeswitch'); |
|
423 | + $command = "api reloadacl"; |
|
424 | + $response = $this->freeswitch_model->reload_freeswitch($command); |
|
425 | + $this->session->set_userdata('astpp_notification', $response); |
|
426 | + } |
|
427 | + $this->session->set_flashdata('astpp_errormsg', 'IP added sucessfully.'); |
|
428 | + } |
|
429 | + } |
|
430 | + } |
|
431 | + if ($action == "delete") { |
|
432 | + $ip_flag = $this->db_model->delete("ip_map", array("id" => $ipmapid)); |
|
433 | + if ($ip_flag) { |
|
434 | + $this->load->library('freeswitch_lib'); |
|
435 | + $this->load->model("freeswitch_model"); |
|
436 | + $command = "api reloadacl"; |
|
437 | + $this->freeswitch_model->reload_freeswitch($command); |
|
438 | + } |
|
439 | + $this->session->set_flashdata('astpp_notification', 'IP removed sucessfully.'); |
|
440 | + } |
|
441 | + redirect(base_url() . "accounts/" . $accounttype . "_ipmap/" . $accountid . "/"); |
|
442 | + } |
|
443 | + |
|
444 | + //This function using for provider t |
|
445 | + function provider_animap($edit_id) { |
|
446 | + $this->customer_animap($edit_id, 'provider'); |
|
447 | + } |
|
448 | + |
|
449 | + // This function using for showing data of customer/provider CallerID Tab |
|
450 | + function customer_animap($edit_id, $entity_type = 'customer') { |
|
451 | + //Get Account information from session. |
|
452 | + $data['page_title'] = "Caller ID"; |
|
453 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
454 | + //Get Parent informartion |
|
455 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
456 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
457 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
458 | + if ($account_res->num_rows > 0) { |
|
459 | + $account_data = (array) $account_res->first_row(); |
|
460 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
461 | + $data["grid_fields"] = $this->accounts_form->build_animap_list_for_customer($edit_id, $accounttype); |
|
462 | + $data['edit_id'] = $edit_id; |
|
463 | + $data['accounttype'] = $accounttype; |
|
464 | + $this->load->view('view_customer_animap', $data); |
|
465 | + } else { |
|
466 | + redirect(base_url() . 'accounts/customer_list/'); |
|
467 | + exit; |
|
468 | + } |
|
469 | + } |
|
470 | + |
|
471 | + function customer_animap_json($accountid, $accounttype) { |
|
472 | + $json_data = array(); |
|
473 | + $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); |
|
474 | + $like_str=!empty($instant_search) ? "(number like '%$instant_search%' OR creation_date like '%$instant_search%' )" :null; |
|
475 | + if(!empty($like_str)) |
|
476 | + $this->db->where($like_str); |
|
477 | + $where = array("accountid" => $accountid); |
|
478 | + $count_all = $this->db_model->countQuery("*", "ani_map", $where); |
|
479 | + |
|
480 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
481 | + $json_data = $paging_data["json_paging"]; |
|
482 | + if(!empty($like_str)) |
|
483 | + $this->db->where($like_str); |
|
484 | + $query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
485 | + |
|
486 | + $grid_fields = json_decode($this->accounts_form->build_animap_list_for_customer($accountid, $accounttype)); |
|
487 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
488 | + |
|
489 | + echo json_encode($json_data); |
|
490 | + } |
|
491 | + |
|
492 | + function provider_animap_action($action, $accountid, $aniid = "") { |
|
493 | + $this->customer_animap_action($action, $accountid, $aniid); |
|
494 | + } |
|
495 | + |
|
496 | + //This function using for customer/provider callerID add/delete |
|
497 | + function customer_animap_action($action, $accountid, $aniid = "") { |
|
498 | + $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
499 | + $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
500 | + $url = "accounts/" . $entity_type . "_animap/$accountid/"; |
|
501 | + if ($action == "add") { |
|
502 | + $ani = $this->input->post(); |
|
503 | + $this->db->where('number', $ani['number']); |
|
504 | + $this->db->select('count(id) as count'); |
|
505 | + $cnt_result = $this->db->get('ani_map'); |
|
506 | + $cnt_result = $cnt_result->result_array(); |
|
507 | + $count = $cnt_result[0]['count']; |
|
508 | + if ($count == 0) { |
|
509 | + if ($ani['number'] != "") { |
|
510 | + /* |
|
511 | 511 | ASTPP 3.0 |
512 | 512 | Add creation field |
513 | 513 | */ |
514 | - $insert_arr = array('creation_date' => gmdate('Y-m-d H:i:s'), "number" => $this->input->post('number'), "accountid" => $accountid, |
|
515 | - "context" => "default"); |
|
516 | - /* * *********************************** */ |
|
517 | - $this->db->insert("ani_map", $insert_arr); |
|
518 | - $this->session->set_flashdata('astpp_errormsg', 'Caller ID added successfully!'); |
|
519 | - } else { |
|
520 | - $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.'); |
|
521 | - } |
|
522 | - } else { |
|
523 | - $this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.'); |
|
524 | - } |
|
525 | - } |
|
526 | - if ($action == "delete") { |
|
527 | - $this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!'); |
|
528 | - $this->db_model->delete("ani_map", array("id" => $aniid)); |
|
529 | - } |
|
530 | - redirect(base_url() . $url); |
|
531 | - } |
|
532 | - |
|
533 | - //This function using by Customer/Provider edit tab |
|
534 | - function customer_details_json($module, $accountid) { |
|
535 | - $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
536 | - $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
537 | - if ($module == "pattern") { |
|
538 | - $this->load->module('rates/rates'); |
|
539 | - $this->rates->customer_block_pattern_list($accountid, $entity_type); |
|
540 | - } |
|
541 | - if ($module == "freeswitch") { |
|
542 | - $this->load->module('freeswitch/freeswitch'); |
|
543 | - $this->freeswitch->customer_fssipdevices_json($accountid, $entity_type); |
|
544 | - } |
|
545 | - if ($module == "did") { |
|
546 | - $this->load->module('did/did'); |
|
547 | - $this->did->customer_did($accountid, $entity_type); |
|
548 | - } |
|
549 | - if ($module == "invoices") { |
|
550 | - $this->load->module('invoices/invoices'); |
|
551 | - $this->invoices->customer_invoices($accountid,$entity_type, false); |
|
552 | - } |
|
553 | - if ($module == "subscription") { |
|
554 | - $this->load->module('charges/charges'); |
|
555 | - $this->charges->customer_charge_list($accountid, $entity_type); |
|
556 | - } |
|
557 | - if ($module == "cdrs") { |
|
558 | - $this->load->module('reports/reports'); |
|
559 | - $this->reports->customer_cdrreport($accountid, $entity_type); |
|
560 | - } |
|
561 | - if ($module == "charges") { |
|
562 | - $this->load->module('reports/reports'); |
|
563 | - $this->reports->customer_charge_history($accountid,$entity_type); |
|
564 | - } |
|
565 | - if ($module == "refill") { |
|
566 | - $this->load->module('reports/reports'); |
|
567 | - $this->reports->customer_refillreport($accountid,$entity_type); |
|
568 | - } |
|
569 | - if ($module == "emailhistory") { |
|
570 | - $this->load->module('email/email'); |
|
571 | - $this->email->customer_mail_record($accountid, $entity_type); |
|
572 | - } |
|
573 | - if ($module == "opensips") { |
|
574 | - $this->load->module('opensips/opensips'); |
|
575 | - $this->opensips->customer_opensips_json($accountid,$entity_type); |
|
576 | - } |
|
577 | - } |
|
578 | - function customer_details_search($module_name){ |
|
579 | - $action = $this->input->post(); |
|
580 | - $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
581 | - if(!empty($action['left_panel_search'])){ |
|
582 | - $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
|
583 | - } |
|
584 | - } |
|
585 | - function provider_sipdevices($edit_id) { |
|
586 | - $this->customer_sipdevices($edit_id); |
|
587 | - } |
|
588 | - |
|
589 | - function customer_sipdevices($edit_id) { |
|
590 | - $data['page_title'] = "SIP Devices"; |
|
591 | - //Get Account information from session. |
|
592 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
593 | - //Get Parent informartion |
|
594 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
595 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
596 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
597 | - if ($account_res->num_rows > 0) { |
|
598 | - $account_data = (array) $account_res->first_row(); |
|
599 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
600 | - $this->load->module('freeswitch/freeswitch'); |
|
601 | - $data["grid_buttons"] = $this->freeswitch->freeswitch_form->fsdevices_build_grid_buttons($edit_id, $accounttype); |
|
602 | - $data['grid_fields'] = $this->freeswitch->freeswitch_form->build_devices_list_for_customer(); |
|
603 | - $data['edit_id'] = $edit_id; |
|
604 | - $data['accounttype'] = $accounttype; |
|
605 | - $this->load->view('view_customer_sipdevices', $data); |
|
606 | - } else { |
|
607 | - redirect(base_url() . 'accounts/customer_list/'); |
|
608 | - exit; |
|
609 | - } |
|
610 | - } |
|
611 | - |
|
612 | - function provider_fssipdevices_action($action, $id, $accountid) { |
|
613 | - $this->customer_fssipdevices_action($action, $id, $accountid); |
|
614 | - } |
|
615 | - |
|
616 | - function customer_fssipdevices_action($action, $id, $accountid) { |
|
617 | - $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
618 | - $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
619 | - $this->load->module('freeswitch/freeswitch'); |
|
620 | - if ($action == "delete") { |
|
621 | - $this->freeswitch->freeswitch_model->delete_freeswith_devices($id); |
|
622 | - $this->session->set_flashdata('astpp_notification', 'Sip Device removed successfully!'); |
|
623 | - redirect(base_url() . "accounts/" . $entity_type . "_sipdevices/$accountid/"); |
|
624 | - } |
|
625 | - if ($action == "edit") { |
|
626 | - $this->freeswitch->customer_fssipdevices_edit($id, $accountid); |
|
627 | - $this->session->set_flashdata('astpp_errormsg', 'Sip updated successfully!'); |
|
628 | - } |
|
629 | - } |
|
630 | - |
|
631 | - function provider_opensips($edit_id) { |
|
632 | - $this->customer_opensips($edit_id); |
|
633 | - } |
|
634 | - |
|
635 | - function customer_opensips($edit_id) { |
|
636 | - $data['page_title'] = "Opensips Devices"; |
|
637 | - //Get Account information from session. |
|
638 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
639 | - //Get Parent informartion |
|
640 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
641 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
642 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
643 | - if ($account_res->num_rows > 0) { |
|
644 | - $account_data = (array) $account_res->first_row(); |
|
645 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
646 | - $this->load->module('freeswitch/freeswitch'); |
|
647 | - $this->load->module('opensips/opensips'); |
|
648 | - $data["grid_buttons"] = $this->opensips->opensips_form->opensips_customer_build_grid_buttons($edit_id); |
|
649 | - $data['grid_fields'] = $this->opensips->opensips_form->opensips_customer_build_opensips_list($edit_id); |
|
650 | - $data['edit_id'] = $edit_id; |
|
651 | - $data['accounttype'] = $accounttype; |
|
652 | - $this->load->view('view_customer_opensips_devices', $data); |
|
653 | - } else { |
|
654 | - redirect(base_url() . 'accounts/customer_list/'); |
|
655 | - exit; |
|
656 | - } |
|
657 | - } |
|
658 | - |
|
659 | - function customer_opensips_action($action, $accountid, $id) { |
|
660 | - $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
661 | - $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
662 | - $url = "accounts/" . $entity_type . "_opensips/$accountid/"; |
|
663 | - $this->load->module('opensips/opensips'); |
|
664 | - if ($action == "delete") { |
|
665 | - $this->opensips->opensips_model->remove_opensips($id); |
|
666 | - $this->session->set_flashdata('astpp_notification', 'Opensips removed successfully!'); |
|
667 | - redirect(base_url() . $url); |
|
668 | - } |
|
669 | - if ($action == "edit") { |
|
670 | - $this->opensips->customer_opensips_edit($accountid, $id); |
|
671 | - $this->session->set_flashdata('astpp_errormsg', 'Opensips updated successfully!'); |
|
672 | - } |
|
673 | - } |
|
674 | - |
|
675 | - function provider_charges($edit_id) { |
|
676 | - $this->customer_charges($edit_id); |
|
677 | - } |
|
678 | - |
|
679 | - function reseller_charges($edit_id) { |
|
680 | - $this->customer_charges($edit_id); |
|
681 | - } |
|
682 | - |
|
683 | - function customer_charges($edit_id) { |
|
684 | - $data['page_title'] = "Charges History"; |
|
685 | - //Get Account information from session. |
|
686 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
687 | - //Get Parent informartion |
|
688 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
689 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
690 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
691 | - if ($account_res->num_rows > 0) { |
|
692 | - $account_data = (array) $account_res->first_row(); |
|
693 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
694 | - $data['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), ''); |
|
695 | - $this->load->module('reports/reports'); |
|
696 | - $data['grid_fields'] = $this->reports->reports_form->build_charge_list_for_customer($edit_id, $accounttype); |
|
697 | - $data['edit_id'] = $edit_id; |
|
698 | - $data['accounttype'] = $accounttype; |
|
699 | - $this->load->view('view_customer_charges', $data); |
|
700 | - } else { |
|
701 | - redirect(base_url() . 'accounts/customer_list/'); |
|
702 | - exit; |
|
703 | - } |
|
704 | - } |
|
705 | - |
|
706 | - function provider_subscription($edit_id) { |
|
707 | - $this->customer_subscription($edit_id); |
|
708 | - } |
|
709 | - |
|
710 | - function reseller_subscription($edit_id) { |
|
711 | - $this->customer_subscription($edit_id); |
|
712 | - } |
|
713 | - |
|
714 | - function customer_subscription($edit_id) { |
|
715 | - $data['page_title'] = "Subscription"; |
|
716 | - //Get Account information from session. |
|
717 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
718 | - //Get Parent informartion |
|
719 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
720 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
721 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
722 | - if ($account_res->num_rows > 0) { |
|
723 | - $account_data = (array) $account_res->first_row(); |
|
724 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
725 | - $data['chargelist'] = form_dropdown_all(array("name" => 'applayable_charge', 'id' => 'applayable_charge', 'class' => ""), $this->Astpp_common->list_applyable_charges($edit_id), ''); |
|
726 | - $this->load->module('charges/charges'); |
|
727 | - $data['grid_fields'] = $this->charges->charges_form->build_charges_list_for_customer($edit_id, $accounttype); |
|
728 | - $data['edit_id'] = $edit_id; |
|
729 | - $data['accounttype'] = $accounttype; |
|
730 | - $this->load->view('view_customer_subscriptions', $data); |
|
731 | - } else { |
|
732 | - redirect(base_url() . 'accounts/customer_list/'); |
|
733 | - exit; |
|
734 | - } |
|
735 | - } |
|
736 | - |
|
737 | - function reseller_subscription_action($action, $accountid, $accounttype, $chargeid = "") { |
|
738 | - $this->customer_subscription_action($action, $accountid, $accounttype, $chargeid); |
|
739 | - } |
|
740 | - |
|
741 | - function provider_subscription_action($action, $accountid, $accounttype, $chargeid = "") { |
|
742 | - $this->customer_subscription_action($action, $accountid, $accounttype, $chargeid); |
|
743 | - } |
|
744 | - |
|
745 | - function customer_subscription_action($action, $accountid, $accounttype, $chargeid = "") { |
|
746 | - |
|
747 | - /** |
|
514 | + $insert_arr = array('creation_date' => gmdate('Y-m-d H:i:s'), "number" => $this->input->post('number'), "accountid" => $accountid, |
|
515 | + "context" => "default"); |
|
516 | + /* * *********************************** */ |
|
517 | + $this->db->insert("ani_map", $insert_arr); |
|
518 | + $this->session->set_flashdata('astpp_errormsg', 'Caller ID added successfully!'); |
|
519 | + } else { |
|
520 | + $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.'); |
|
521 | + } |
|
522 | + } else { |
|
523 | + $this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.'); |
|
524 | + } |
|
525 | + } |
|
526 | + if ($action == "delete") { |
|
527 | + $this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!'); |
|
528 | + $this->db_model->delete("ani_map", array("id" => $aniid)); |
|
529 | + } |
|
530 | + redirect(base_url() . $url); |
|
531 | + } |
|
532 | + |
|
533 | + //This function using by Customer/Provider edit tab |
|
534 | + function customer_details_json($module, $accountid) { |
|
535 | + $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
536 | + $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
537 | + if ($module == "pattern") { |
|
538 | + $this->load->module('rates/rates'); |
|
539 | + $this->rates->customer_block_pattern_list($accountid, $entity_type); |
|
540 | + } |
|
541 | + if ($module == "freeswitch") { |
|
542 | + $this->load->module('freeswitch/freeswitch'); |
|
543 | + $this->freeswitch->customer_fssipdevices_json($accountid, $entity_type); |
|
544 | + } |
|
545 | + if ($module == "did") { |
|
546 | + $this->load->module('did/did'); |
|
547 | + $this->did->customer_did($accountid, $entity_type); |
|
548 | + } |
|
549 | + if ($module == "invoices") { |
|
550 | + $this->load->module('invoices/invoices'); |
|
551 | + $this->invoices->customer_invoices($accountid,$entity_type, false); |
|
552 | + } |
|
553 | + if ($module == "subscription") { |
|
554 | + $this->load->module('charges/charges'); |
|
555 | + $this->charges->customer_charge_list($accountid, $entity_type); |
|
556 | + } |
|
557 | + if ($module == "cdrs") { |
|
558 | + $this->load->module('reports/reports'); |
|
559 | + $this->reports->customer_cdrreport($accountid, $entity_type); |
|
560 | + } |
|
561 | + if ($module == "charges") { |
|
562 | + $this->load->module('reports/reports'); |
|
563 | + $this->reports->customer_charge_history($accountid,$entity_type); |
|
564 | + } |
|
565 | + if ($module == "refill") { |
|
566 | + $this->load->module('reports/reports'); |
|
567 | + $this->reports->customer_refillreport($accountid,$entity_type); |
|
568 | + } |
|
569 | + if ($module == "emailhistory") { |
|
570 | + $this->load->module('email/email'); |
|
571 | + $this->email->customer_mail_record($accountid, $entity_type); |
|
572 | + } |
|
573 | + if ($module == "opensips") { |
|
574 | + $this->load->module('opensips/opensips'); |
|
575 | + $this->opensips->customer_opensips_json($accountid,$entity_type); |
|
576 | + } |
|
577 | + } |
|
578 | + function customer_details_search($module_name){ |
|
579 | + $action = $this->input->post(); |
|
580 | + $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
581 | + if(!empty($action['left_panel_search'])){ |
|
582 | + $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
|
583 | + } |
|
584 | + } |
|
585 | + function provider_sipdevices($edit_id) { |
|
586 | + $this->customer_sipdevices($edit_id); |
|
587 | + } |
|
588 | + |
|
589 | + function customer_sipdevices($edit_id) { |
|
590 | + $data['page_title'] = "SIP Devices"; |
|
591 | + //Get Account information from session. |
|
592 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
593 | + //Get Parent informartion |
|
594 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
595 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
596 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
597 | + if ($account_res->num_rows > 0) { |
|
598 | + $account_data = (array) $account_res->first_row(); |
|
599 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
600 | + $this->load->module('freeswitch/freeswitch'); |
|
601 | + $data["grid_buttons"] = $this->freeswitch->freeswitch_form->fsdevices_build_grid_buttons($edit_id, $accounttype); |
|
602 | + $data['grid_fields'] = $this->freeswitch->freeswitch_form->build_devices_list_for_customer(); |
|
603 | + $data['edit_id'] = $edit_id; |
|
604 | + $data['accounttype'] = $accounttype; |
|
605 | + $this->load->view('view_customer_sipdevices', $data); |
|
606 | + } else { |
|
607 | + redirect(base_url() . 'accounts/customer_list/'); |
|
608 | + exit; |
|
609 | + } |
|
610 | + } |
|
611 | + |
|
612 | + function provider_fssipdevices_action($action, $id, $accountid) { |
|
613 | + $this->customer_fssipdevices_action($action, $id, $accountid); |
|
614 | + } |
|
615 | + |
|
616 | + function customer_fssipdevices_action($action, $id, $accountid) { |
|
617 | + $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
618 | + $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
619 | + $this->load->module('freeswitch/freeswitch'); |
|
620 | + if ($action == "delete") { |
|
621 | + $this->freeswitch->freeswitch_model->delete_freeswith_devices($id); |
|
622 | + $this->session->set_flashdata('astpp_notification', 'Sip Device removed successfully!'); |
|
623 | + redirect(base_url() . "accounts/" . $entity_type . "_sipdevices/$accountid/"); |
|
624 | + } |
|
625 | + if ($action == "edit") { |
|
626 | + $this->freeswitch->customer_fssipdevices_edit($id, $accountid); |
|
627 | + $this->session->set_flashdata('astpp_errormsg', 'Sip updated successfully!'); |
|
628 | + } |
|
629 | + } |
|
630 | + |
|
631 | + function provider_opensips($edit_id) { |
|
632 | + $this->customer_opensips($edit_id); |
|
633 | + } |
|
634 | + |
|
635 | + function customer_opensips($edit_id) { |
|
636 | + $data['page_title'] = "Opensips Devices"; |
|
637 | + //Get Account information from session. |
|
638 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
639 | + //Get Parent informartion |
|
640 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
641 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
642 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
643 | + if ($account_res->num_rows > 0) { |
|
644 | + $account_data = (array) $account_res->first_row(); |
|
645 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
646 | + $this->load->module('freeswitch/freeswitch'); |
|
647 | + $this->load->module('opensips/opensips'); |
|
648 | + $data["grid_buttons"] = $this->opensips->opensips_form->opensips_customer_build_grid_buttons($edit_id); |
|
649 | + $data['grid_fields'] = $this->opensips->opensips_form->opensips_customer_build_opensips_list($edit_id); |
|
650 | + $data['edit_id'] = $edit_id; |
|
651 | + $data['accounttype'] = $accounttype; |
|
652 | + $this->load->view('view_customer_opensips_devices', $data); |
|
653 | + } else { |
|
654 | + redirect(base_url() . 'accounts/customer_list/'); |
|
655 | + exit; |
|
656 | + } |
|
657 | + } |
|
658 | + |
|
659 | + function customer_opensips_action($action, $accountid, $id) { |
|
660 | + $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
661 | + $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
662 | + $url = "accounts/" . $entity_type . "_opensips/$accountid/"; |
|
663 | + $this->load->module('opensips/opensips'); |
|
664 | + if ($action == "delete") { |
|
665 | + $this->opensips->opensips_model->remove_opensips($id); |
|
666 | + $this->session->set_flashdata('astpp_notification', 'Opensips removed successfully!'); |
|
667 | + redirect(base_url() . $url); |
|
668 | + } |
|
669 | + if ($action == "edit") { |
|
670 | + $this->opensips->customer_opensips_edit($accountid, $id); |
|
671 | + $this->session->set_flashdata('astpp_errormsg', 'Opensips updated successfully!'); |
|
672 | + } |
|
673 | + } |
|
674 | + |
|
675 | + function provider_charges($edit_id) { |
|
676 | + $this->customer_charges($edit_id); |
|
677 | + } |
|
678 | + |
|
679 | + function reseller_charges($edit_id) { |
|
680 | + $this->customer_charges($edit_id); |
|
681 | + } |
|
682 | + |
|
683 | + function customer_charges($edit_id) { |
|
684 | + $data['page_title'] = "Charges History"; |
|
685 | + //Get Account information from session. |
|
686 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
687 | + //Get Parent informartion |
|
688 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
689 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
690 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
691 | + if ($account_res->num_rows > 0) { |
|
692 | + $account_data = (array) $account_res->first_row(); |
|
693 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
694 | + $data['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), ''); |
|
695 | + $this->load->module('reports/reports'); |
|
696 | + $data['grid_fields'] = $this->reports->reports_form->build_charge_list_for_customer($edit_id, $accounttype); |
|
697 | + $data['edit_id'] = $edit_id; |
|
698 | + $data['accounttype'] = $accounttype; |
|
699 | + $this->load->view('view_customer_charges', $data); |
|
700 | + } else { |
|
701 | + redirect(base_url() . 'accounts/customer_list/'); |
|
702 | + exit; |
|
703 | + } |
|
704 | + } |
|
705 | + |
|
706 | + function provider_subscription($edit_id) { |
|
707 | + $this->customer_subscription($edit_id); |
|
708 | + } |
|
709 | + |
|
710 | + function reseller_subscription($edit_id) { |
|
711 | + $this->customer_subscription($edit_id); |
|
712 | + } |
|
713 | + |
|
714 | + function customer_subscription($edit_id) { |
|
715 | + $data['page_title'] = "Subscription"; |
|
716 | + //Get Account information from session. |
|
717 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
718 | + //Get Parent informartion |
|
719 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
720 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
721 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
722 | + if ($account_res->num_rows > 0) { |
|
723 | + $account_data = (array) $account_res->first_row(); |
|
724 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
725 | + $data['chargelist'] = form_dropdown_all(array("name" => 'applayable_charge', 'id' => 'applayable_charge', 'class' => ""), $this->Astpp_common->list_applyable_charges($edit_id), ''); |
|
726 | + $this->load->module('charges/charges'); |
|
727 | + $data['grid_fields'] = $this->charges->charges_form->build_charges_list_for_customer($edit_id, $accounttype); |
|
728 | + $data['edit_id'] = $edit_id; |
|
729 | + $data['accounttype'] = $accounttype; |
|
730 | + $this->load->view('view_customer_subscriptions', $data); |
|
731 | + } else { |
|
732 | + redirect(base_url() . 'accounts/customer_list/'); |
|
733 | + exit; |
|
734 | + } |
|
735 | + } |
|
736 | + |
|
737 | + function reseller_subscription_action($action, $accountid, $accounttype, $chargeid = "") { |
|
738 | + $this->customer_subscription_action($action, $accountid, $accounttype, $chargeid); |
|
739 | + } |
|
740 | + |
|
741 | + function provider_subscription_action($action, $accountid, $accounttype, $chargeid = "") { |
|
742 | + $this->customer_subscription_action($action, $accountid, $accounttype, $chargeid); |
|
743 | + } |
|
744 | + |
|
745 | + function customer_subscription_action($action, $accountid, $accounttype, $chargeid = "") { |
|
746 | + |
|
747 | + /** |
|
748 | 748 | ASTPP 3.0 |
749 | 749 | For Email Broadcast when Subscription Add - Delete |
750 | - * */ |
|
751 | - $accountinfo = $this->db_model->getSelect("*", "accounts", array("id" => $accountid)); |
|
752 | - $accountinfo = (array) $accountinfo->first_row(); |
|
753 | - /* * ****************************** */ |
|
754 | - if ($action == "add") { |
|
755 | - $charge_id = $this->input->post("applayable_charge", true); |
|
756 | - if ($charge_id != "") { |
|
757 | - $insert_arr = array("charge_id" => $charge_id, "accountid" => $accountid, "assign_date" => gmdate("Y-m-d H:i:s")); |
|
758 | - $this->db->insert("charge_to_account", $insert_arr); |
|
759 | - $this->session->set_flashdata('astpp_errormsg', 'Subscripton Added Sucessfully.'); |
|
760 | - $template_name = 'add_subscription'; |
|
761 | - } |
|
762 | - } |
|
763 | - if ($action == "delete") { |
|
764 | - $this->db_model->delete("charge_to_account", array("id" => $chargeid)); |
|
765 | - $this->session->set_flashdata('astpp_notification', 'Subscription Removed Sucessfully.'); |
|
766 | - $template_name = 'remove_subscription'; |
|
767 | - } |
|
768 | - /** |
|
750 | + * */ |
|
751 | + $accountinfo = $this->db_model->getSelect("*", "accounts", array("id" => $accountid)); |
|
752 | + $accountinfo = (array) $accountinfo->first_row(); |
|
753 | + /* * ****************************** */ |
|
754 | + if ($action == "add") { |
|
755 | + $charge_id = $this->input->post("applayable_charge", true); |
|
756 | + if ($charge_id != "") { |
|
757 | + $insert_arr = array("charge_id" => $charge_id, "accountid" => $accountid, "assign_date" => gmdate("Y-m-d H:i:s")); |
|
758 | + $this->db->insert("charge_to_account", $insert_arr); |
|
759 | + $this->session->set_flashdata('astpp_errormsg', 'Subscripton Added Sucessfully.'); |
|
760 | + $template_name = 'add_subscription'; |
|
761 | + } |
|
762 | + } |
|
763 | + if ($action == "delete") { |
|
764 | + $this->db_model->delete("charge_to_account", array("id" => $chargeid)); |
|
765 | + $this->session->set_flashdata('astpp_notification', 'Subscription Removed Sucessfully.'); |
|
766 | + $template_name = 'remove_subscription'; |
|
767 | + } |
|
768 | + /** |
|
769 | 769 | ASTPP 3.0 |
770 | 770 | For Email Broadcast when Subscription Delete |
771 | - * */ |
|
772 | - $this->common->mail_to_users($template_name, $accountinfo); |
|
773 | - /* * ********************************* */ |
|
774 | - redirect(base_url() . "accounts/" . $accounttype . "_subscription/$accountid/"); |
|
775 | - } |
|
776 | - |
|
777 | - function provider_dids($edit_id) { |
|
778 | - $this->customer_dids($edit_id); |
|
779 | - } |
|
780 | - |
|
781 | - function customer_dids($edit_id) { |
|
782 | - $data['page_title'] = "DID"; |
|
783 | - //Get Account information from session. |
|
784 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
785 | - //Get Parent informartion |
|
786 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
787 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
788 | - $account_res = $this->db_model->getSelect("type,country_id", "accounts", $where); |
|
789 | - if ($account_res->num_rows > 0) { |
|
790 | - $account_data = (array) $account_res->first_row(); |
|
791 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
792 | - $this->load->module('did/did'); |
|
793 | - $data['grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, $accounttype); |
|
794 | - $data['edit_id'] = $edit_id; |
|
795 | - $data['accounttype'] = $accounttype; |
|
796 | - $result_did_final = array(); |
|
797 | - $did_info = array("name" => "free_didlist", "id" => "free_didlist", "class" => "free_didlist"); |
|
798 | - $data['didlist'] = form_dropdown_all($did_info, $result_did_final, ''); |
|
799 | - $data['country_id'] = $account_data['country_id']; |
|
800 | - $this->load->view('view_customer_dids', $data); |
|
801 | - } else { |
|
802 | - redirect(base_url() . 'accounts/customer_list/'); |
|
803 | - exit; |
|
804 | - } |
|
805 | - } |
|
806 | - |
|
807 | - function provider_dids_action($action, $accountid, $accounttype, $did_id = "") { |
|
808 | - $this->customer_dids_action($action, $accountid, $accounttype, $did_id); |
|
809 | - } |
|
810 | - |
|
811 | - function reseller_dids_action($action, $accountid, $accounttype, $did_id = "") { |
|
812 | - $this->customer_dids_action($action, $accountid, $accounttype, $did_id); |
|
813 | - } |
|
814 | - |
|
815 | - function customer_dids_action($action, $accountid, $accounttype, $did_id = "") { |
|
816 | - //Get account information from session. |
|
817 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
818 | - //Get Parent informartion |
|
819 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
820 | - $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
|
821 | - if ($did_id != "") { |
|
822 | - $account_arr = (array)$this->db->get_where("accounts", array("id" => $accountid))->first_row(); |
|
823 | - $did_arr = (array) $this->db->get_where("dids", array("id" => $did_id))->first_row(); |
|
824 | - $field_name = $account_arr['type'] ==1 ? "parent_id" : 'accountid'; |
|
825 | - if ($action == "add") { |
|
826 | - if ($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id) { |
|
827 | - if ($accountinfo['type'] == 1) { |
|
828 | - //for getting reseller setup price if reseller customer purchase |
|
829 | - $reseller_pricing_query = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'], 'reseller_id' => $reseller_id)); |
|
830 | - if ($reseller_pricing_query->num_rows() > 0) { |
|
831 | - $reseller_pricing = (array) $reseller_pricing_query->first_row(); |
|
832 | - $did_arr=array_merge($did_arr,$reseller_pricing); |
|
833 | - } |
|
834 | - } |
|
835 | - $available_bal = $this->db_model->get_available_bal($account_arr); |
|
836 | - if ($available_bal >= $did_arr['setup']) { |
|
837 | - $available_bal = $this->db_model->update_balance($did_arr['setup'], $accountid, "debit"); |
|
838 | - $this->db_model->update("dids", array($field_name => $accountid, "assign_date" => gmdate("Y-m-d H:i:s")), array("id" => $did_id)); |
|
839 | - if ($account_arr['type'] == 1) { |
|
840 | - $this->load->module('did/did'); |
|
841 | - $this->did->did_model->insert_reseller_pricing($account_arr, $did_arr); |
|
842 | - } |
|
843 | - $this->common->add_invoice_details($account_arr, "DIDCHRG", $did_arr['setup'], $did_arr['number']); |
|
844 | - $account_arr['did_number'] = $did_arr['number']; |
|
845 | - $account_arr['did_country_id'] = $this->common->get_field_name('country', 'countrycode', $did_arr['country_id']); |
|
771 | + * */ |
|
772 | + $this->common->mail_to_users($template_name, $accountinfo); |
|
773 | + /* * ********************************* */ |
|
774 | + redirect(base_url() . "accounts/" . $accounttype . "_subscription/$accountid/"); |
|
775 | + } |
|
776 | + |
|
777 | + function provider_dids($edit_id) { |
|
778 | + $this->customer_dids($edit_id); |
|
779 | + } |
|
780 | + |
|
781 | + function customer_dids($edit_id) { |
|
782 | + $data['page_title'] = "DID"; |
|
783 | + //Get Account information from session. |
|
784 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
785 | + //Get Parent informartion |
|
786 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
787 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
788 | + $account_res = $this->db_model->getSelect("type,country_id", "accounts", $where); |
|
789 | + if ($account_res->num_rows > 0) { |
|
790 | + $account_data = (array) $account_res->first_row(); |
|
791 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
792 | + $this->load->module('did/did'); |
|
793 | + $data['grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, $accounttype); |
|
794 | + $data['edit_id'] = $edit_id; |
|
795 | + $data['accounttype'] = $accounttype; |
|
796 | + $result_did_final = array(); |
|
797 | + $did_info = array("name" => "free_didlist", "id" => "free_didlist", "class" => "free_didlist"); |
|
798 | + $data['didlist'] = form_dropdown_all($did_info, $result_did_final, ''); |
|
799 | + $data['country_id'] = $account_data['country_id']; |
|
800 | + $this->load->view('view_customer_dids', $data); |
|
801 | + } else { |
|
802 | + redirect(base_url() . 'accounts/customer_list/'); |
|
803 | + exit; |
|
804 | + } |
|
805 | + } |
|
806 | + |
|
807 | + function provider_dids_action($action, $accountid, $accounttype, $did_id = "") { |
|
808 | + $this->customer_dids_action($action, $accountid, $accounttype, $did_id); |
|
809 | + } |
|
810 | + |
|
811 | + function reseller_dids_action($action, $accountid, $accounttype, $did_id = "") { |
|
812 | + $this->customer_dids_action($action, $accountid, $accounttype, $did_id); |
|
813 | + } |
|
814 | + |
|
815 | + function customer_dids_action($action, $accountid, $accounttype, $did_id = "") { |
|
816 | + //Get account information from session. |
|
817 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
818 | + //Get Parent informartion |
|
819 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
820 | + $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
|
821 | + if ($did_id != "") { |
|
822 | + $account_arr = (array)$this->db->get_where("accounts", array("id" => $accountid))->first_row(); |
|
823 | + $did_arr = (array) $this->db->get_where("dids", array("id" => $did_id))->first_row(); |
|
824 | + $field_name = $account_arr['type'] ==1 ? "parent_id" : 'accountid'; |
|
825 | + if ($action == "add") { |
|
826 | + if ($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id) { |
|
827 | + if ($accountinfo['type'] == 1) { |
|
828 | + //for getting reseller setup price if reseller customer purchase |
|
829 | + $reseller_pricing_query = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'], 'reseller_id' => $reseller_id)); |
|
830 | + if ($reseller_pricing_query->num_rows() > 0) { |
|
831 | + $reseller_pricing = (array) $reseller_pricing_query->first_row(); |
|
832 | + $did_arr=array_merge($did_arr,$reseller_pricing); |
|
833 | + } |
|
834 | + } |
|
835 | + $available_bal = $this->db_model->get_available_bal($account_arr); |
|
836 | + if ($available_bal >= $did_arr['setup']) { |
|
837 | + $available_bal = $this->db_model->update_balance($did_arr['setup'], $accountid, "debit"); |
|
838 | + $this->db_model->update("dids", array($field_name => $accountid, "assign_date" => gmdate("Y-m-d H:i:s")), array("id" => $did_id)); |
|
839 | + if ($account_arr['type'] == 1) { |
|
840 | + $this->load->module('did/did'); |
|
841 | + $this->did->did_model->insert_reseller_pricing($account_arr, $did_arr); |
|
842 | + } |
|
843 | + $this->common->add_invoice_details($account_arr, "DIDCHRG", $did_arr['setup'], $did_arr['number']); |
|
844 | + $account_arr['did_number'] = $did_arr['number']; |
|
845 | + $account_arr['did_country_id'] = $this->common->get_field_name('country', 'countrycode', $did_arr['country_id']); |
|
846 | 846 | $account_arr['did_setup'] = $this->common_model->to_calculate_currency($did_arr['setup'], "", '', true, true); |
847 | 847 | $account_arr['did_monthlycost'] = $this->common_model->to_calculate_currency($did_arr['monthlycost'], "", '', true,true); |
848 | 848 | $account_arr['did_maxchannels'] = $did_arr['maxchannels']; |
849 | 849 | |
850 | - $this->common->mail_to_users('email_add_did', $account_arr); |
|
851 | - $this->session->set_flashdata('astpp_errormsg', 'DID Purchased Successfully.'); |
|
852 | - } else { |
|
853 | - $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this DID'); |
|
854 | - } |
|
855 | - } else { |
|
856 | - $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
|
857 | - } |
|
858 | - } |
|
859 | - if ($action == "delete") { |
|
860 | - $data = array("accountid" => "0", "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00"); |
|
861 | - if ($accounttype == 'reseller') { |
|
862 | - $data = array("accountid" => "0", "parent_id" => $reseller_id, "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00"); |
|
863 | - } |
|
864 | - $this->db_model->update("dids", $data, array("id" => $did_id)); |
|
865 | - if ($accounttype == 'reseller') { |
|
866 | - $this->db->where('reseller_id', $account_arr['id']); |
|
867 | - $this->db->where('note', $did_arr['number']); |
|
868 | - $this->db->delete('reseller_pricing'); |
|
869 | - } |
|
870 | - $account_arr['did_number']=$did_arr['number']; |
|
871 | - $this->common->mail_to_users('email_remove_did', $account_arr); |
|
872 | - $this->session->set_flashdata('astpp_notification', 'Did Removed Successfully.'); |
|
873 | - } |
|
874 | - } |
|
875 | - redirect(base_url() . "accounts/" . $accounttype . "_dids/$accountid/"); |
|
876 | - } |
|
877 | - |
|
878 | - function provider_invoices($edit_id) { |
|
879 | - $this->customer_invoices($edit_id); |
|
880 | - } |
|
881 | - |
|
882 | - function reseller_invoices($edit_id) { |
|
883 | - $this->customer_invoices($edit_id); |
|
884 | - } |
|
885 | - |
|
886 | - function customer_invoices($edit_id) { |
|
887 | - $data['page_title'] = "Invoice"; |
|
888 | - //Get Account information from session. |
|
889 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
890 | - //Get Parent informartion |
|
891 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
892 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
893 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
894 | - if ($account_res->num_rows > 0) { |
|
895 | - $account_data = (array) $account_res->first_row(); |
|
896 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
897 | - $this->load->module('invoices/invoices'); |
|
898 | - $data['grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_customer_admin(false); |
|
899 | - $data['edit_id'] = $edit_id; |
|
900 | - $data['accounttype'] = $accounttype; |
|
901 | - $this->load->view('view_customer_invoices', $data); |
|
902 | - } else { |
|
903 | - redirect(base_url() . 'accounts/customer_list/'); |
|
904 | - exit; |
|
905 | - } |
|
906 | - } |
|
907 | - |
|
908 | - function provider_blocked_prefixes($edit_id) { |
|
909 | - $this->customer_blocked_prefixes($edit_id); |
|
910 | - } |
|
911 | - |
|
912 | - function customer_blocked_prefixes($edit_id) { |
|
913 | - $data['page_title'] = "Blocked Codes"; |
|
914 | - //Get Account information from session. |
|
915 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
916 | - //Get Parent informartion |
|
917 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
918 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
919 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
920 | - if ($account_res->num_rows > 0) { |
|
921 | - $account_data = (array) $account_res->first_row(); |
|
922 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
923 | - $this->load->module('rates/rates'); |
|
924 | - $data['grid_fields'] = $this->rates->rates_form->build_pattern_list_for_customer($edit_id, $accounttype); |
|
925 | - $data['grid_buttons'] = $this->rates->rates_form->set_pattern_grid_buttons($edit_id); |
|
926 | - $data['edit_id'] = $edit_id; |
|
927 | - $data['accounttype'] = $accounttype; |
|
928 | - $this->load->view('view_customer_blocked_prefixes', $data); |
|
929 | - } else { |
|
930 | - redirect(base_url() . 'accounts/customer_list/'); |
|
931 | - exit; |
|
932 | - } |
|
933 | - } |
|
934 | - |
|
935 | - function customer_add_blockpatterns($accountid) { |
|
936 | - $data['username'] = $this->session->userdata('user_name'); |
|
937 | - $data['page_title'] = 'Unblocked Codes'; |
|
938 | - $this->session->set_userdata('advance_search', 0); |
|
939 | - $this->load->module('rates/rates'); |
|
940 | - $data['patters_grid_fields'] = $this->rates->rates_form->build_block_pattern_list_for_customer(); |
|
941 | - $data["accountid"] = $accountid; |
|
942 | - $this->load->view('view_block_prefix_list', $data); |
|
943 | - } |
|
944 | - |
|
945 | - function customer_add_blockpatterns_json($accountid) { |
|
946 | - $this->load->module('rates/rates'); |
|
947 | - $json_data = array(); |
|
948 | - $count_all = $this->rates_model->getunblocked_pattern_list($accountid, false); |
|
949 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
950 | - $json_data = $paging_data["json_paging"]; |
|
951 | - |
|
952 | - $query = $this->rates->rates_model->getunblocked_pattern_list($accountid, true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
953 | - $grid_fields = json_decode($this->rates->rates_form->build_block_pattern_list_for_customer()); |
|
954 | - $json_data['rows'] = $this->rates->form->build_grid($query, $grid_fields); |
|
955 | - echo json_encode($json_data); |
|
956 | - } |
|
957 | - |
|
958 | - function customer_block_prefix($accountid) { |
|
959 | - $result = $this->accounts_model->insert_block($this->input->post('prefixies', true), $accountid); |
|
960 | - echo $result; |
|
961 | - exit; |
|
962 | - } |
|
963 | - |
|
964 | - function provider_delete_block_pattern($accountid, $patternid) { |
|
965 | - $this->customer_delete_block_pattern($accountid, $patternid); |
|
966 | - } |
|
967 | - |
|
968 | - function customer_delete_block_pattern($accountid, $patternid) { |
|
969 | - $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
970 | - $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
971 | - $url = "accounts/" . $entity_type . "_blocked_prefixes/$accountid"; |
|
972 | - $this->db_model->delete("block_patterns", array("id" => $patternid)); |
|
973 | - $this->session->set_flashdata('astpp_notification', 'Block Code Removed Sucessfully!'); |
|
850 | + $this->common->mail_to_users('email_add_did', $account_arr); |
|
851 | + $this->session->set_flashdata('astpp_errormsg', 'DID Purchased Successfully.'); |
|
852 | + } else { |
|
853 | + $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this DID'); |
|
854 | + } |
|
855 | + } else { |
|
856 | + $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
|
857 | + } |
|
858 | + } |
|
859 | + if ($action == "delete") { |
|
860 | + $data = array("accountid" => "0", "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00"); |
|
861 | + if ($accounttype == 'reseller') { |
|
862 | + $data = array("accountid" => "0", "parent_id" => $reseller_id, "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00"); |
|
863 | + } |
|
864 | + $this->db_model->update("dids", $data, array("id" => $did_id)); |
|
865 | + if ($accounttype == 'reseller') { |
|
866 | + $this->db->where('reseller_id', $account_arr['id']); |
|
867 | + $this->db->where('note', $did_arr['number']); |
|
868 | + $this->db->delete('reseller_pricing'); |
|
869 | + } |
|
870 | + $account_arr['did_number']=$did_arr['number']; |
|
871 | + $this->common->mail_to_users('email_remove_did', $account_arr); |
|
872 | + $this->session->set_flashdata('astpp_notification', 'Did Removed Successfully.'); |
|
873 | + } |
|
874 | + } |
|
875 | + redirect(base_url() . "accounts/" . $accounttype . "_dids/$accountid/"); |
|
876 | + } |
|
877 | + |
|
878 | + function provider_invoices($edit_id) { |
|
879 | + $this->customer_invoices($edit_id); |
|
880 | + } |
|
881 | + |
|
882 | + function reseller_invoices($edit_id) { |
|
883 | + $this->customer_invoices($edit_id); |
|
884 | + } |
|
885 | + |
|
886 | + function customer_invoices($edit_id) { |
|
887 | + $data['page_title'] = "Invoice"; |
|
888 | + //Get Account information from session. |
|
889 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
890 | + //Get Parent informartion |
|
891 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
892 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
893 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
894 | + if ($account_res->num_rows > 0) { |
|
895 | + $account_data = (array) $account_res->first_row(); |
|
896 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
897 | + $this->load->module('invoices/invoices'); |
|
898 | + $data['grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_customer_admin(false); |
|
899 | + $data['edit_id'] = $edit_id; |
|
900 | + $data['accounttype'] = $accounttype; |
|
901 | + $this->load->view('view_customer_invoices', $data); |
|
902 | + } else { |
|
903 | + redirect(base_url() . 'accounts/customer_list/'); |
|
904 | + exit; |
|
905 | + } |
|
906 | + } |
|
907 | + |
|
908 | + function provider_blocked_prefixes($edit_id) { |
|
909 | + $this->customer_blocked_prefixes($edit_id); |
|
910 | + } |
|
911 | + |
|
912 | + function customer_blocked_prefixes($edit_id) { |
|
913 | + $data['page_title'] = "Blocked Codes"; |
|
914 | + //Get Account information from session. |
|
915 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
916 | + //Get Parent informartion |
|
917 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
918 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
919 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
920 | + if ($account_res->num_rows > 0) { |
|
921 | + $account_data = (array) $account_res->first_row(); |
|
922 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
923 | + $this->load->module('rates/rates'); |
|
924 | + $data['grid_fields'] = $this->rates->rates_form->build_pattern_list_for_customer($edit_id, $accounttype); |
|
925 | + $data['grid_buttons'] = $this->rates->rates_form->set_pattern_grid_buttons($edit_id); |
|
926 | + $data['edit_id'] = $edit_id; |
|
927 | + $data['accounttype'] = $accounttype; |
|
928 | + $this->load->view('view_customer_blocked_prefixes', $data); |
|
929 | + } else { |
|
930 | + redirect(base_url() . 'accounts/customer_list/'); |
|
931 | + exit; |
|
932 | + } |
|
933 | + } |
|
934 | + |
|
935 | + function customer_add_blockpatterns($accountid) { |
|
936 | + $data['username'] = $this->session->userdata('user_name'); |
|
937 | + $data['page_title'] = 'Unblocked Codes'; |
|
938 | + $this->session->set_userdata('advance_search', 0); |
|
939 | + $this->load->module('rates/rates'); |
|
940 | + $data['patters_grid_fields'] = $this->rates->rates_form->build_block_pattern_list_for_customer(); |
|
941 | + $data["accountid"] = $accountid; |
|
942 | + $this->load->view('view_block_prefix_list', $data); |
|
943 | + } |
|
944 | + |
|
945 | + function customer_add_blockpatterns_json($accountid) { |
|
946 | + $this->load->module('rates/rates'); |
|
947 | + $json_data = array(); |
|
948 | + $count_all = $this->rates_model->getunblocked_pattern_list($accountid, false); |
|
949 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
950 | + $json_data = $paging_data["json_paging"]; |
|
951 | + |
|
952 | + $query = $this->rates->rates_model->getunblocked_pattern_list($accountid, true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
953 | + $grid_fields = json_decode($this->rates->rates_form->build_block_pattern_list_for_customer()); |
|
954 | + $json_data['rows'] = $this->rates->form->build_grid($query, $grid_fields); |
|
955 | + echo json_encode($json_data); |
|
956 | + } |
|
957 | + |
|
958 | + function customer_block_prefix($accountid) { |
|
959 | + $result = $this->accounts_model->insert_block($this->input->post('prefixies', true), $accountid); |
|
960 | + echo $result; |
|
961 | + exit; |
|
962 | + } |
|
963 | + |
|
964 | + function provider_delete_block_pattern($accountid, $patternid) { |
|
965 | + $this->customer_delete_block_pattern($accountid, $patternid); |
|
966 | + } |
|
967 | + |
|
968 | + function customer_delete_block_pattern($accountid, $patternid) { |
|
969 | + $entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid)); |
|
970 | + $entity_type = strtolower($this->common->get_entity_type('', '', $entity_type)); |
|
971 | + $url = "accounts/" . $entity_type . "_blocked_prefixes/$accountid"; |
|
972 | + $this->db_model->delete("block_patterns", array("id" => $patternid)); |
|
973 | + $this->session->set_flashdata('astpp_notification', 'Block Code Removed Sucessfully!'); |
|
974 | 974 | |
975 | - redirect(base_url() . $url); |
|
976 | - } |
|
977 | - function customer_blockedprefixes_delete_multiple(){ |
|
978 | - $ids = $this->input->post("selected_ids", true); |
|
979 | - $where = "id IN ($ids)"; |
|
980 | - $this->db->delete("block_patterns",$where); |
|
981 | - echo TRUE; |
|
982 | - } |
|
983 | - |
|
984 | - /* ASTPP 3.0 |
|
975 | + redirect(base_url() . $url); |
|
976 | + } |
|
977 | + function customer_blockedprefixes_delete_multiple(){ |
|
978 | + $ids = $this->input->post("selected_ids", true); |
|
979 | + $where = "id IN ($ids)"; |
|
980 | + $this->db->delete("block_patterns",$where); |
|
981 | + echo TRUE; |
|
982 | + } |
|
983 | + |
|
984 | + /* ASTPP 3.0 |
|
985 | 985 | * Using function using for provider cdrs tab |
986 | 986 | */ |
987 | 987 | |
988 | - function provider_cdrs($edit_id) { |
|
989 | - $this->customer_cdrs($edit_id); |
|
990 | - } |
|
988 | + function provider_cdrs($edit_id) { |
|
989 | + $this->customer_cdrs($edit_id); |
|
990 | + } |
|
991 | 991 | |
992 | - /* * ************************************************ */ |
|
993 | - /* ASTPP 3.0 |
|
992 | + /* * ************************************************ */ |
|
993 | + /* ASTPP 3.0 |
|
994 | 994 | * Using function using for reseller cdrs tab |
995 | 995 | */ |
996 | 996 | |
997 | - function reseller_cdrs($edit_id) { |
|
998 | - $this->customer_cdrs($edit_id); |
|
999 | - } |
|
997 | + function reseller_cdrs($edit_id) { |
|
998 | + $this->customer_cdrs($edit_id); |
|
999 | + } |
|
1000 | 1000 | |
1001 | - /* * ************************************************ */ |
|
1002 | - /* ASTPP 3.0 |
|
1001 | + /* * ************************************************ */ |
|
1002 | + /* ASTPP 3.0 |
|
1003 | 1003 | * Using function using for customer cdrs tab |
1004 | 1004 | */ |
1005 | 1005 | |
1006 | - function customer_cdrs($edit_id) { |
|
1007 | - $data['page_title'] = "CDRs"; |
|
1008 | - //Get Account information from session. |
|
1009 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1010 | - //Get Parent informartion |
|
1011 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1012 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1013 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1014 | - if ($account_res->num_rows > 0) { |
|
1015 | - $account_data = (array) $account_res->first_row(); |
|
1016 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1017 | - $this->load->module('reports/reports'); |
|
1018 | - $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
|
1019 | - $data['edit_id'] = $edit_id; |
|
1020 | - $data['accounttype'] = $accounttype; |
|
1021 | - $this->load->view('view_customer_cdrs_list', $data); |
|
1022 | - } else { |
|
1023 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1024 | - exit; |
|
1025 | - } |
|
1026 | - } |
|
1027 | - |
|
1028 | - /* * ***************************************** */ |
|
1029 | - /* ASTPP 3.0 |
|
1006 | + function customer_cdrs($edit_id) { |
|
1007 | + $data['page_title'] = "CDRs"; |
|
1008 | + //Get Account information from session. |
|
1009 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1010 | + //Get Parent informartion |
|
1011 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1012 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1013 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1014 | + if ($account_res->num_rows > 0) { |
|
1015 | + $account_data = (array) $account_res->first_row(); |
|
1016 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1017 | + $this->load->module('reports/reports'); |
|
1018 | + $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
|
1019 | + $data['edit_id'] = $edit_id; |
|
1020 | + $data['accounttype'] = $accounttype; |
|
1021 | + $this->load->view('view_customer_cdrs_list', $data); |
|
1022 | + } else { |
|
1023 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1024 | + exit; |
|
1025 | + } |
|
1026 | + } |
|
1027 | + |
|
1028 | + /* * ***************************************** */ |
|
1029 | + /* ASTPP 3.0 |
|
1030 | 1030 | * Using for provider refillreporttab. |
1031 | 1031 | */ |
1032 | - function reseller_packages($edit_id){ |
|
1033 | - $data['page_title'] = "Packages"; |
|
1034 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1035 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1036 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1037 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1038 | - if ($account_res->num_rows > 0) { |
|
1039 | - $account_data = (array) $account_res->first_row(); |
|
1040 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1041 | - $this->load->module('package/package'); |
|
1042 | - $data['grid_fields'] = $this->package->package_form->build_package_list_for_reseller(); |
|
1043 | - $data['edit_id'] = $edit_id; |
|
1044 | - $data['accounttype'] = $accounttype; |
|
1045 | - $this->load->view('view_reseller_package_list', $data); |
|
1046 | - }else { |
|
1047 | - redirect(base_url() . 'accounts/reseller_list/'); |
|
1048 | - exit; |
|
1049 | - } |
|
1050 | - } |
|
1032 | + function reseller_packages($edit_id){ |
|
1033 | + $data['page_title'] = "Packages"; |
|
1034 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1035 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1036 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1037 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1038 | + if ($account_res->num_rows > 0) { |
|
1039 | + $account_data = (array) $account_res->first_row(); |
|
1040 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1041 | + $this->load->module('package/package'); |
|
1042 | + $data['grid_fields'] = $this->package->package_form->build_package_list_for_reseller(); |
|
1043 | + $data['edit_id'] = $edit_id; |
|
1044 | + $data['accounttype'] = $accounttype; |
|
1045 | + $this->load->view('view_reseller_package_list', $data); |
|
1046 | + }else { |
|
1047 | + redirect(base_url() . 'accounts/reseller_list/'); |
|
1048 | + exit; |
|
1049 | + } |
|
1050 | + } |
|
1051 | 1051 | |
1052 | - function reseller_refillreport($edit_id){ |
|
1053 | - $this->customer_refillreport($edit_id); |
|
1054 | - } |
|
1055 | - function provider_refillreport($edit_id) { |
|
1056 | - $this->customer_refillreport($edit_id); |
|
1057 | - } |
|
1058 | - |
|
1059 | - /* * ***************************************** */ |
|
1060 | - /* ASTPP 3.0 |
|
1052 | + function reseller_refillreport($edit_id){ |
|
1053 | + $this->customer_refillreport($edit_id); |
|
1054 | + } |
|
1055 | + function provider_refillreport($edit_id) { |
|
1056 | + $this->customer_refillreport($edit_id); |
|
1057 | + } |
|
1058 | + |
|
1059 | + /* * ***************************************** */ |
|
1060 | + /* ASTPP 3.0 |
|
1061 | 1061 | * Using for customer refill report tab. |
1062 | 1062 | */ |
1063 | 1063 | |
1064 | - function customer_refillreport($edit_id) { |
|
1065 | - $data['page_title'] = "Refill Report"; |
|
1066 | - //Get Account information from session. |
|
1067 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1068 | - //Get Parent informartion |
|
1069 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1070 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1071 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1072 | - if ($account_res->num_rows > 0) { |
|
1073 | - $account_data = (array) $account_res->first_row(); |
|
1074 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1075 | - $this->load->module('reports/reports'); |
|
1076 | - $data['grid_fields'] = $this->reports->reports_form->build_refillreport_for_customer(); |
|
1077 | - $data['edit_id'] = $edit_id; |
|
1078 | - $data['accounttype'] = $accounttype; |
|
1079 | - $this->load->view('view_customer_refill_report', $data); |
|
1080 | - } else { |
|
1081 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1082 | - exit; |
|
1083 | - } |
|
1084 | - } |
|
1085 | - |
|
1086 | - /* * ***************************************** */ |
|
1087 | - /* ASTPP 3.0 |
|
1064 | + function customer_refillreport($edit_id) { |
|
1065 | + $data['page_title'] = "Refill Report"; |
|
1066 | + //Get Account information from session. |
|
1067 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1068 | + //Get Parent informartion |
|
1069 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1070 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1071 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1072 | + if ($account_res->num_rows > 0) { |
|
1073 | + $account_data = (array) $account_res->first_row(); |
|
1074 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1075 | + $this->load->module('reports/reports'); |
|
1076 | + $data['grid_fields'] = $this->reports->reports_form->build_refillreport_for_customer(); |
|
1077 | + $data['edit_id'] = $edit_id; |
|
1078 | + $data['accounttype'] = $accounttype; |
|
1079 | + $this->load->view('view_customer_refill_report', $data); |
|
1080 | + } else { |
|
1081 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1082 | + exit; |
|
1083 | + } |
|
1084 | + } |
|
1085 | + |
|
1086 | + /* * ***************************************** */ |
|
1087 | + /* ASTPP 3.0 |
|
1088 | 1088 | * Using for provider email history tab. |
1089 | 1089 | */ |
1090 | - function reseller_emailhistory($edit_id) { |
|
1091 | - $this->customer_emailhistory($edit_id); |
|
1092 | - } |
|
1093 | - function provider_emailhistory($edit_id) { |
|
1094 | - $this->customer_emailhistory($edit_id); |
|
1095 | - } |
|
1096 | - |
|
1097 | - /* * ***************************************** */ |
|
1098 | - /* ASTPP 3.0 |
|
1090 | + function reseller_emailhistory($edit_id) { |
|
1091 | + $this->customer_emailhistory($edit_id); |
|
1092 | + } |
|
1093 | + function provider_emailhistory($edit_id) { |
|
1094 | + $this->customer_emailhistory($edit_id); |
|
1095 | + } |
|
1096 | + |
|
1097 | + /* * ***************************************** */ |
|
1098 | + /* ASTPP 3.0 |
|
1099 | 1099 | * Using for customer email history tab. |
1100 | 1100 | */ |
1101 | 1101 | |
1102 | - function customer_emailhistory($edit_id) { |
|
1103 | - $data['page_title'] = "Emails"; |
|
1104 | - //Get Account information from session. |
|
1105 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1106 | - //Get Parent informartion |
|
1107 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1108 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1109 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1110 | - if ($account_res->num_rows > 0) { |
|
1111 | - $account_data = (array) $account_res->first_row(); |
|
1112 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1113 | - $this->load->module('email/email'); |
|
1114 | - $data['grid_fields'] = $this->email->email_form->build_list_for_email_customer($edit_id, $accounttype); |
|
1115 | - $data['edit_id'] = $edit_id; |
|
1116 | - $data['accounttype'] = $accounttype; |
|
1117 | - $this->load->view('view_customer_email_history', $data); |
|
1118 | - } else { |
|
1119 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1120 | - exit; |
|
1121 | - } |
|
1122 | - } |
|
1123 | - |
|
1124 | - /* * *********************************************** */ |
|
1125 | - /* ASTPP 3.0 |
|
1102 | + function customer_emailhistory($edit_id) { |
|
1103 | + $data['page_title'] = "Emails"; |
|
1104 | + //Get Account information from session. |
|
1105 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1106 | + //Get Parent informartion |
|
1107 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1108 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1109 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1110 | + if ($account_res->num_rows > 0) { |
|
1111 | + $account_data = (array) $account_res->first_row(); |
|
1112 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1113 | + $this->load->module('email/email'); |
|
1114 | + $data['grid_fields'] = $this->email->email_form->build_list_for_email_customer($edit_id, $accounttype); |
|
1115 | + $data['edit_id'] = $edit_id; |
|
1116 | + $data['accounttype'] = $accounttype; |
|
1117 | + $this->load->view('view_customer_email_history', $data); |
|
1118 | + } else { |
|
1119 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1120 | + exit; |
|
1121 | + } |
|
1122 | + } |
|
1123 | + |
|
1124 | + /* * *********************************************** */ |
|
1125 | + /* ASTPP 3.0 |
|
1126 | 1126 | * Using for provider Alert threshold history tab. |
1127 | 1127 | */ |
1128 | 1128 | |
1129 | - function reseller_alert_threshold($edit_id) { |
|
1130 | - $this->customer_alert_threshold($edit_id); |
|
1131 | - } |
|
1132 | - function provider_alert_threshold($edit_id) { |
|
1133 | - $this->customer_alert_threshold($edit_id); |
|
1134 | - } |
|
1129 | + function reseller_alert_threshold($edit_id) { |
|
1130 | + $this->customer_alert_threshold($edit_id); |
|
1131 | + } |
|
1132 | + function provider_alert_threshold($edit_id) { |
|
1133 | + $this->customer_alert_threshold($edit_id); |
|
1134 | + } |
|
1135 | 1135 | |
1136 | - /* * *********************************************** */ |
|
1137 | - /* ASTPP 3.0 |
|
1136 | + /* * *********************************************** */ |
|
1137 | + /* ASTPP 3.0 |
|
1138 | 1138 | * Using for customer Alert threshold history tab. |
1139 | 1139 | */ |
1140 | 1140 | |
1141 | - function customer_alert_threshold($edit_id) { |
|
1142 | - $data['page_title'] = "Alert Threshold"; |
|
1143 | - //Get Account information from session. |
|
1144 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1145 | - //Get Parent informartion |
|
1146 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1147 | - $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1148 | - $account_res = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email,type,id", "accounts", $where); |
|
1149 | - if ($account_res->num_rows > 0) { |
|
1150 | - $account_data = (array) $account_res->first_row(); |
|
1151 | - $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1152 | - unset($account_data['type']); |
|
1153 | - $data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($accounttype), $account_data); |
|
1154 | - $data['edit_id'] = $edit_id; |
|
1155 | - $data['accounttype'] = $accounttype; |
|
1156 | - $this->load->view('view_customer_alert_threshold', $data); |
|
1157 | - } else { |
|
1158 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1159 | - exit; |
|
1160 | - } |
|
1161 | - } |
|
1162 | - function reseller_alert_threshold_save($entity_type) { |
|
1163 | - $this->customer_alert_threshold_save($entity_type); |
|
1164 | - } |
|
1165 | - function provider_alert_threshold_save($entity_type) { |
|
1166 | - $this->customer_alert_threshold_save($entity_type); |
|
1167 | - } |
|
1168 | - |
|
1169 | - function customer_alert_threshold_save($entity_type) { |
|
1170 | - $add_array = $this->input->post(); |
|
1171 | - if (isset($add_array['id']) && !empty($add_array['id'])) { |
|
1172 | - $data['page_title'] = "Alert Threshold"; |
|
1173 | - $data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($entity_type), $add_array); |
|
1174 | - $data['edit_id'] = $add_array['id']; |
|
1175 | - $data['accounttype'] = $entity_type; |
|
1176 | - //Get Account information from session. |
|
1177 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1178 | - //Get Parent informartion |
|
1179 | - $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1180 | - $where = array('id' => $add_array['id'], "reseller_id" => $reseller_id); |
|
1181 | - $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1182 | - if ($account_res->num_rows > 0) { |
|
1183 | - if ($this->form_validation->run() == FALSE) { |
|
1184 | - $data['validation_errors'] = validation_errors(); |
|
1185 | - } else { |
|
1186 | - $this->db->where('id', $add_array['id']); |
|
1187 | - $id=$add_array['id']; |
|
1188 | - unset($add_array['id'], $add_array['action']); |
|
1189 | - $this->db->update('accounts', $add_array); |
|
1190 | - $this->session->set_flashdata('astpp_errormsg','Alert threshold updated successfully!'); |
|
1191 | - redirect(base_url() . 'accounts/'.$entity_type.'_alert_threshold/'.$id."/"); |
|
1192 | - exit; |
|
1193 | - } |
|
1194 | - } else { |
|
1195 | - redirect(base_url() . 'accounts/'.$entity_type.'_list/'); |
|
1196 | - exit; |
|
1197 | - } |
|
1198 | - $this->load->view('view_customer_alert_threshold', $data); |
|
1199 | - } else { |
|
1200 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1201 | - exit; |
|
1202 | - } |
|
1203 | - } |
|
1204 | - |
|
1205 | - function customer_bulk_creation() { |
|
1206 | - $type=0; |
|
1207 | - $data['entity_name'] = strtolower($this->common->get_entity_type('', '', $type)); |
|
1208 | - $data['page_title'] = 'Mass Customer'; |
|
1209 | - $data['country_id'] = Common_model::$global_config['system_config']['country']; |
|
1210 | - $data['currency_id'] = $this->common->get_field_name('id', 'currency', array('currency' => Common_model::$global_config['system_config']['base_currency'])); |
|
1211 | - $data['timezone_id'] = Common_model::$global_config['system_config']['default_timezone']; |
|
1212 | - if (!$data['timezone_id']) { |
|
1213 | - $data['timezone_id'] = 1; |
|
1214 | - } |
|
1215 | - if (!$data['currency_id']) { |
|
1216 | - $data['currency_id'] = 1; |
|
1217 | - } |
|
1218 | - if (!$data['country_id']) { |
|
1219 | - $data['country_id'] = 1; |
|
1220 | - } |
|
1221 | - $data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), ''); |
|
1222 | - $this->load->view('view_bulk_account_creation', $data); |
|
1223 | - } |
|
1224 | - |
|
1225 | - function customer_bulk_save() { |
|
1226 | - $data['page_title'] = 'Create Bulk Customer'; |
|
1227 | - $add_array = $this->input->post(); |
|
1228 | - if (!empty($add_array) && isset($add_array)) { |
|
1229 | - $currentlength = $this->accounts_model->get_max_limit($add_array); |
|
1230 | - $account_data = $this->session->userdata("accountinfo"); |
|
1231 | - $add_array['reseller_id'] = $account_data['type']==1 ? $account_data['id']:0; |
|
1232 | - $data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), $add_array); |
|
1233 | - if ($this->form_validation->run() == FALSE) { |
|
1234 | - $data['validation_errors'] = validation_errors(); |
|
1235 | - echo $data['validation_errors']; |
|
1236 | - exit; |
|
1237 | - } |
|
1238 | - if($currentlength <= 0){ |
|
1141 | + function customer_alert_threshold($edit_id) { |
|
1142 | + $data['page_title'] = "Alert Threshold"; |
|
1143 | + //Get Account information from session. |
|
1144 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1145 | + //Get Parent informartion |
|
1146 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1147 | + $where = array('id' => $edit_id, "reseller_id" => $reseller_id); |
|
1148 | + $account_res = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email,type,id", "accounts", $where); |
|
1149 | + if ($account_res->num_rows > 0) { |
|
1150 | + $account_data = (array) $account_res->first_row(); |
|
1151 | + $accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type'])); |
|
1152 | + unset($account_data['type']); |
|
1153 | + $data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($accounttype), $account_data); |
|
1154 | + $data['edit_id'] = $edit_id; |
|
1155 | + $data['accounttype'] = $accounttype; |
|
1156 | + $this->load->view('view_customer_alert_threshold', $data); |
|
1157 | + } else { |
|
1158 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1159 | + exit; |
|
1160 | + } |
|
1161 | + } |
|
1162 | + function reseller_alert_threshold_save($entity_type) { |
|
1163 | + $this->customer_alert_threshold_save($entity_type); |
|
1164 | + } |
|
1165 | + function provider_alert_threshold_save($entity_type) { |
|
1166 | + $this->customer_alert_threshold_save($entity_type); |
|
1167 | + } |
|
1168 | + |
|
1169 | + function customer_alert_threshold_save($entity_type) { |
|
1170 | + $add_array = $this->input->post(); |
|
1171 | + if (isset($add_array['id']) && !empty($add_array['id'])) { |
|
1172 | + $data['page_title'] = "Alert Threshold"; |
|
1173 | + $data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($entity_type), $add_array); |
|
1174 | + $data['edit_id'] = $add_array['id']; |
|
1175 | + $data['accounttype'] = $entity_type; |
|
1176 | + //Get Account information from session. |
|
1177 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1178 | + //Get Parent informartion |
|
1179 | + $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0; |
|
1180 | + $where = array('id' => $add_array['id'], "reseller_id" => $reseller_id); |
|
1181 | + $account_res = $this->db_model->getSelect("type", "accounts", $where); |
|
1182 | + if ($account_res->num_rows > 0) { |
|
1183 | + if ($this->form_validation->run() == FALSE) { |
|
1184 | + $data['validation_errors'] = validation_errors(); |
|
1185 | + } else { |
|
1186 | + $this->db->where('id', $add_array['id']); |
|
1187 | + $id=$add_array['id']; |
|
1188 | + unset($add_array['id'], $add_array['action']); |
|
1189 | + $this->db->update('accounts', $add_array); |
|
1190 | + $this->session->set_flashdata('astpp_errormsg','Alert threshold updated successfully!'); |
|
1191 | + redirect(base_url() . 'accounts/'.$entity_type.'_alert_threshold/'.$id."/"); |
|
1192 | + exit; |
|
1193 | + } |
|
1194 | + } else { |
|
1195 | + redirect(base_url() . 'accounts/'.$entity_type.'_list/'); |
|
1196 | + exit; |
|
1197 | + } |
|
1198 | + $this->load->view('view_customer_alert_threshold', $data); |
|
1199 | + } else { |
|
1200 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1201 | + exit; |
|
1202 | + } |
|
1203 | + } |
|
1204 | + |
|
1205 | + function customer_bulk_creation() { |
|
1206 | + $type=0; |
|
1207 | + $data['entity_name'] = strtolower($this->common->get_entity_type('', '', $type)); |
|
1208 | + $data['page_title'] = 'Mass Customer'; |
|
1209 | + $data['country_id'] = Common_model::$global_config['system_config']['country']; |
|
1210 | + $data['currency_id'] = $this->common->get_field_name('id', 'currency', array('currency' => Common_model::$global_config['system_config']['base_currency'])); |
|
1211 | + $data['timezone_id'] = Common_model::$global_config['system_config']['default_timezone']; |
|
1212 | + if (!$data['timezone_id']) { |
|
1213 | + $data['timezone_id'] = 1; |
|
1214 | + } |
|
1215 | + if (!$data['currency_id']) { |
|
1216 | + $data['currency_id'] = 1; |
|
1217 | + } |
|
1218 | + if (!$data['country_id']) { |
|
1219 | + $data['country_id'] = 1; |
|
1220 | + } |
|
1221 | + $data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), ''); |
|
1222 | + $this->load->view('view_bulk_account_creation', $data); |
|
1223 | + } |
|
1224 | + |
|
1225 | + function customer_bulk_save() { |
|
1226 | + $data['page_title'] = 'Create Bulk Customer'; |
|
1227 | + $add_array = $this->input->post(); |
|
1228 | + if (!empty($add_array) && isset($add_array)) { |
|
1229 | + $currentlength = $this->accounts_model->get_max_limit($add_array); |
|
1230 | + $account_data = $this->session->userdata("accountinfo"); |
|
1231 | + $add_array['reseller_id'] = $account_data['type']==1 ? $account_data['id']:0; |
|
1232 | + $data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), $add_array); |
|
1233 | + if ($this->form_validation->run() == FALSE) { |
|
1234 | + $data['validation_errors'] = validation_errors(); |
|
1235 | + echo $data['validation_errors']; |
|
1236 | + exit; |
|
1237 | + } |
|
1238 | + if($currentlength <= 0){ |
|
1239 | 1239 | echo json_encode(array("prefix_error" => "Your Account Limit has been reached.Please Change Your Prefix.")); |
1240 | - exit; |
|
1241 | - } |
|
1242 | - if ($add_array['account_length'] <= strlen($add_array['prefix'])) { |
|
1243 | - echo json_encode(array("account_length_error" => "Please Enter Proper Account Length.")); |
|
1244 | - exit; |
|
1245 | - } |
|
1246 | - if ($currentlength > 0 && $add_array['count'] > $currentlength) { |
|
1247 | - echo json_encode(array("count_error" => "You Can Create Maximum " . $currentlength . " accounts with " . $add_array['prefix'] . " prefix")); |
|
1248 | - exit; |
|
1249 | - } else { |
|
1250 | - $this->accounts_model->bulk_insert_accounts($add_array); |
|
1251 | - echo json_encode(array("SUCCESS" => "Bulk customer generate successfully!")); |
|
1252 | - exit; |
|
1253 | - } |
|
1254 | - } else { |
|
1255 | - redirect(base_url() . "accounts/customer_list/"); |
|
1256 | - } |
|
1257 | - } |
|
1258 | - |
|
1259 | - function customer_invoice_option($value = false) { |
|
1260 | - $sweepid = $this->input->post("sweepid", true); |
|
1261 | - $invoice_dropdown = $this->common->set_invoice_option($sweepid, "", "", $value); |
|
1262 | - echo $invoice_dropdown; |
|
1263 | - } |
|
1264 | - |
|
1265 | - /* * ***** |
|
1240 | + exit; |
|
1241 | + } |
|
1242 | + if ($add_array['account_length'] <= strlen($add_array['prefix'])) { |
|
1243 | + echo json_encode(array("account_length_error" => "Please Enter Proper Account Length.")); |
|
1244 | + exit; |
|
1245 | + } |
|
1246 | + if ($currentlength > 0 && $add_array['count'] > $currentlength) { |
|
1247 | + echo json_encode(array("count_error" => "You Can Create Maximum " . $currentlength . " accounts with " . $add_array['prefix'] . " prefix")); |
|
1248 | + exit; |
|
1249 | + } else { |
|
1250 | + $this->accounts_model->bulk_insert_accounts($add_array); |
|
1251 | + echo json_encode(array("SUCCESS" => "Bulk customer generate successfully!")); |
|
1252 | + exit; |
|
1253 | + } |
|
1254 | + } else { |
|
1255 | + redirect(base_url() . "accounts/customer_list/"); |
|
1256 | + } |
|
1257 | + } |
|
1258 | + |
|
1259 | + function customer_invoice_option($value = false) { |
|
1260 | + $sweepid = $this->input->post("sweepid", true); |
|
1261 | + $invoice_dropdown = $this->common->set_invoice_option($sweepid, "", "", $value); |
|
1262 | + echo $invoice_dropdown; |
|
1263 | + } |
|
1264 | + |
|
1265 | + /* * ***** |
|
1266 | 1266 | ASTPP 3.0 |
1267 | 1267 | in customer Edit put one dropdown with the name of country and change with Purchase dropdown. |
1268 | 1268 | * ***** */ |
1269 | 1269 | |
1270 | - function customer_did_country() { |
|
1271 | - $country_id = $_POST['country_id']; |
|
1272 | - $accountid= $this->input->post('accountid',true); |
|
1273 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1274 | - $entity_info=(array)$this->db->get_where('accounts',array("id"=>$accountid))->first_row(); |
|
1275 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
1276 | - if ($entity_info['reseller_id'] > 0) { |
|
1277 | - $parent_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : $accountinfo['reseller_id']; |
|
1278 | - $query = 'select dids.id as id,dids.number as number,reseller_pricing.setup as setup, reseller_pricing.monthlycost as monthlycost from dids,reseller_pricing where dids.number= reseller_pricing.note and reseller_pricing.reseller_id =' . $parent_id . " and dids.accountid=0 and dids.country_id =" . $country_id; |
|
1279 | - $did_list = $this->db->query($query); |
|
1280 | - } else { |
|
1281 | - $did_list = $this->db_model->getSelect("id,number,setup,monthlycost", "dids", array('country_id' => $country_id, 'accountid' => '0', 'parent_id' => $reseller_id)); |
|
1282 | - } |
|
1283 | - $did_arr = array(); |
|
1284 | - if ($did_list->num_rows > 0) { |
|
1285 | - $did_data = $did_list->result_array(); |
|
1286 | - foreach ($did_data as $key => $value) { |
|
1287 | - $did_arr[$value['id']] = $value['number'] . " (Setup Cost : " . $this->common_model->calculate_currency($value['setup'], '', '', true) . ") (Monthly cost : " . $this->common_model->calculate_currency($value['monthlycost'], '', '', true) . ")"; |
|
1288 | - } |
|
1289 | - } |
|
1290 | - $did_info = array("name" => "free_didlist", "id" => "free_didlist", "class" => "free_didlist"); |
|
1291 | - echo form_dropdown_all($did_info, $did_arr, ''); |
|
1292 | - exit; |
|
1293 | - } |
|
1294 | - |
|
1295 | - /* * ************************************************************** */ |
|
1296 | - |
|
1297 | - function customer_payment_process_add($id = '') { |
|
1298 | - $account = $this->accounts_model->get_account_by_number($id); |
|
1299 | - $currency = $this->accounts_model->get_currency_by_id($account['currency_id']); |
|
1300 | - $data['username'] = $this->session->userdata('user_name'); |
|
1301 | - $data['page_title'] = 'Refill Process'; |
|
1302 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_payment_fields($currency['currency'], $account['number'], $currency['currency'], $id), ''); |
|
1303 | - $this->load->view('view_accounts_process_payment', $data); |
|
1304 | - } |
|
1305 | - function customer_payment_save($id = '') { |
|
1270 | + function customer_did_country() { |
|
1271 | + $country_id = $_POST['country_id']; |
|
1272 | + $accountid= $this->input->post('accountid',true); |
|
1273 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1274 | + $entity_info=(array)$this->db->get_where('accounts',array("id"=>$accountid))->first_row(); |
|
1275 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
1276 | + if ($entity_info['reseller_id'] > 0) { |
|
1277 | + $parent_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : $accountinfo['reseller_id']; |
|
1278 | + $query = 'select dids.id as id,dids.number as number,reseller_pricing.setup as setup, reseller_pricing.monthlycost as monthlycost from dids,reseller_pricing where dids.number= reseller_pricing.note and reseller_pricing.reseller_id =' . $parent_id . " and dids.accountid=0 and dids.country_id =" . $country_id; |
|
1279 | + $did_list = $this->db->query($query); |
|
1280 | + } else { |
|
1281 | + $did_list = $this->db_model->getSelect("id,number,setup,monthlycost", "dids", array('country_id' => $country_id, 'accountid' => '0', 'parent_id' => $reseller_id)); |
|
1282 | + } |
|
1283 | + $did_arr = array(); |
|
1284 | + if ($did_list->num_rows > 0) { |
|
1285 | + $did_data = $did_list->result_array(); |
|
1286 | + foreach ($did_data as $key => $value) { |
|
1287 | + $did_arr[$value['id']] = $value['number'] . " (Setup Cost : " . $this->common_model->calculate_currency($value['setup'], '', '', true) . ") (Monthly cost : " . $this->common_model->calculate_currency($value['monthlycost'], '', '', true) . ")"; |
|
1288 | + } |
|
1289 | + } |
|
1290 | + $did_info = array("name" => "free_didlist", "id" => "free_didlist", "class" => "free_didlist"); |
|
1291 | + echo form_dropdown_all($did_info, $did_arr, ''); |
|
1292 | + exit; |
|
1293 | + } |
|
1294 | + |
|
1295 | + /* * ************************************************************** */ |
|
1296 | + |
|
1297 | + function customer_payment_process_add($id = '') { |
|
1298 | + $account = $this->accounts_model->get_account_by_number($id); |
|
1299 | + $currency = $this->accounts_model->get_currency_by_id($account['currency_id']); |
|
1300 | + $data['username'] = $this->session->userdata('user_name'); |
|
1301 | + $data['page_title'] = 'Refill Process'; |
|
1302 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_payment_fields($currency['currency'], $account['number'], $currency['currency'], $id), ''); |
|
1303 | + $this->load->view('view_accounts_process_payment', $data); |
|
1304 | + } |
|
1305 | + function customer_payment_save($id = '') { |
|
1306 | 1306 | $post_array = $this->input->post(); |
1307 | 1307 | $data['username'] = $this->session->userdata('user_name'); |
1308 | - $data['page_title'] = 'Process Payment'; |
|
1309 | - $account = $this->accounts_model->get_account_by_number($post_array['id']); |
|
1310 | - $currency = $this->accounts_model->get_currency_by_id($account['currency_id']); |
|
1311 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_payment_fields($currency['currency'], $account['number'], $currency['currency'], $id), ''); |
|
1308 | + $data['page_title'] = 'Process Payment'; |
|
1309 | + $account = $this->accounts_model->get_account_by_number($post_array['id']); |
|
1310 | + $currency = $this->accounts_model->get_currency_by_id($account['currency_id']); |
|
1311 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_payment_fields($currency['currency'], $account['number'], $currency['currency'], $id), ''); |
|
1312 | 1312 | if ($this->form_validation->run() == FALSE) { |
1313 | - $data['validation_errors'] = validation_errors(); |
|
1314 | - echo $data['validation_errors']; |
|
1315 | - exit; |
|
1313 | + $data['validation_errors'] = validation_errors(); |
|
1314 | + echo $data['validation_errors']; |
|
1315 | + exit; |
|
1316 | 1316 | } else { |
1317 | - $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], "", '', false, false); |
|
1318 | - $logintype = $this->session->userdata('logintype'); |
|
1319 | - $username = $this->session->userdata('username'); |
|
1320 | - $login_user_data = $this->session->userdata("accountinfo"); |
|
1321 | - $accountinfo = $this->accounts_model->get_account_by_number($post_array['id']); |
|
1322 | - if($accountinfo['reseller_id'] == 0){ |
|
1323 | - $where = array("accountid"=> 1); |
|
1317 | + $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], "", '', false, false); |
|
1318 | + $logintype = $this->session->userdata('logintype'); |
|
1319 | + $username = $this->session->userdata('username'); |
|
1320 | + $login_user_data = $this->session->userdata("accountinfo"); |
|
1321 | + $accountinfo = $this->accounts_model->get_account_by_number($post_array['id']); |
|
1322 | + if($accountinfo['reseller_id'] == 0){ |
|
1323 | + $where = array("accountid"=> 1); |
|
1324 | 1324 | }else{ |
1325 | - $where = array("accountid"=> $accountinfo['id']); |
|
1325 | + $where = array("accountid"=> $accountinfo['id']); |
|
1326 | 1326 | } |
1327 | 1327 | $query = $this->db_model->getSelect("*", "invoice_conf", $where); |
1328 | 1328 | if($query->num_rows >0){ |
1329 | - $invoice_conf = $query->result_array(); |
|
1330 | - $invoice_conf = $invoice_conf[0]; |
|
1329 | + $invoice_conf = $query->result_array(); |
|
1330 | + $invoice_conf = $invoice_conf[0]; |
|
1331 | 1331 | }else{ |
1332 | - $query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1)); |
|
1333 | - $invoice_conf = $query->result_array(); |
|
1334 | - $invoice_conf = $invoice_conf[0]; |
|
1335 | - } |
|
1336 | - $last_invoice_ID = $this->get_invoice_date("invoiceid",$accountinfo["id"]); |
|
1337 | - $invoice_prefix=$invoice_conf['invoice_prefix']; |
|
1338 | - $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days")); |
|
1339 | - $response = $this->accounts_model->account_process_payment($post_array); |
|
1340 | - |
|
1341 | - if($post_array['payment_type']== 1 ){ |
|
1342 | - $this->load->module('invoices/invoices'); |
|
1343 | - $invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date); |
|
1332 | + $query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1)); |
|
1333 | + $invoice_conf = $query->result_array(); |
|
1334 | + $invoice_conf = $invoice_conf[0]; |
|
1335 | + } |
|
1336 | + $last_invoice_ID = $this->get_invoice_date("invoiceid",$accountinfo["id"]); |
|
1337 | + $invoice_prefix=$invoice_conf['invoice_prefix']; |
|
1338 | + $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days")); |
|
1339 | + $response = $this->accounts_model->account_process_payment($post_array); |
|
1340 | + |
|
1341 | + if($post_array['payment_type']== 1 ){ |
|
1342 | + $this->load->module('invoices/invoices'); |
|
1343 | + $invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date); |
|
1344 | 1344 | $account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']); |
1345 | - $insert_arr = array("accountid" => $post_array['id'], |
|
1346 | - "description" => trim($post_array['notes']), |
|
1347 | - "debit" => $post_array['credit'], |
|
1348 | - "credit" => '0', |
|
1349 | - "created_date" => gmdate("Y-m-d H:i:s"), |
|
1350 | - "invoiceid"=>$invoice_id, |
|
1351 | - "reseller_id"=>'0', |
|
1352 | - "item_type"=>'POSTCHARG', |
|
1353 | - "item_id"=>'0', |
|
1354 | - 'before_balance'=>$account_balance+$post_array['credit'], |
|
1355 | - 'after_balance'=>$account_balance, |
|
1356 | - ); |
|
1357 | - $this->db->insert("invoice_details", $insert_arr); |
|
1358 | - }else{ |
|
1359 | - $this->load->module('invoices/invoices'); |
|
1360 | - $invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date); |
|
1361 | - $account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']); |
|
1362 | - $insert_arr = array("accountid" => $post_array['id'], |
|
1363 | - "description" => trim($post_array['notes']), |
|
1364 | - "debit" => 0, |
|
1365 | - "credit" => $post_array['credit'], |
|
1366 | - "created_date" => gmdate("Y-m-d H:i:s"), |
|
1367 | - "invoiceid"=>$invoice_id, |
|
1368 | - "reseller_id"=>$accountinfo['reseller_id'], |
|
1369 | - "item_type"=>'Refill', |
|
1370 | - "item_id"=>'0', |
|
1371 | - 'before_balance'=>$account_balance-$post_array['credit'], |
|
1372 | - 'after_balance'=>$account_balance, |
|
1373 | - ); |
|
1374 | - $this->db->insert("invoice_details", $insert_arr); |
|
1375 | - if($login_user_data['type'] ==1){ |
|
1376 | - $reseller_ids=$this->common->get_parent_info($login_user_data['id'],0); |
|
1377 | - $reseller_ids=rtrim($reseller_ids,","); |
|
1378 | - $reseller_arr=explode(",",$reseller_ids); |
|
1379 | - if(!empty($reseller_arr)){ |
|
1345 | + $insert_arr = array("accountid" => $post_array['id'], |
|
1346 | + "description" => trim($post_array['notes']), |
|
1347 | + "debit" => $post_array['credit'], |
|
1348 | + "credit" => '0', |
|
1349 | + "created_date" => gmdate("Y-m-d H:i:s"), |
|
1350 | + "invoiceid"=>$invoice_id, |
|
1351 | + "reseller_id"=>'0', |
|
1352 | + "item_type"=>'POSTCHARG', |
|
1353 | + "item_id"=>'0', |
|
1354 | + 'before_balance'=>$account_balance+$post_array['credit'], |
|
1355 | + 'after_balance'=>$account_balance, |
|
1356 | + ); |
|
1357 | + $this->db->insert("invoice_details", $insert_arr); |
|
1358 | + }else{ |
|
1359 | + $this->load->module('invoices/invoices'); |
|
1360 | + $invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date); |
|
1361 | + $account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']); |
|
1362 | + $insert_arr = array("accountid" => $post_array['id'], |
|
1363 | + "description" => trim($post_array['notes']), |
|
1364 | + "debit" => 0, |
|
1365 | + "credit" => $post_array['credit'], |
|
1366 | + "created_date" => gmdate("Y-m-d H:i:s"), |
|
1367 | + "invoiceid"=>$invoice_id, |
|
1368 | + "reseller_id"=>$accountinfo['reseller_id'], |
|
1369 | + "item_type"=>'Refill', |
|
1370 | + "item_id"=>'0', |
|
1371 | + 'before_balance'=>$account_balance-$post_array['credit'], |
|
1372 | + 'after_balance'=>$account_balance, |
|
1373 | + ); |
|
1374 | + $this->db->insert("invoice_details", $insert_arr); |
|
1375 | + if($login_user_data['type'] ==1){ |
|
1376 | + $reseller_ids=$this->common->get_parent_info($login_user_data['id'],0); |
|
1377 | + $reseller_ids=rtrim($reseller_ids,","); |
|
1378 | + $reseller_arr=explode(",",$reseller_ids); |
|
1379 | + if(!empty($reseller_arr)){ |
|
1380 | 1380 | $custom_array=$post_array; |
1381 | 1381 | foreach($reseller_arr as $key=>$reseller_id){ |
1382 | 1382 | $custom_array['id']=$reseller_id; |
@@ -1386,31 +1386,31 @@ discard block |
||
1386 | 1386 | $invoice_id=$this->invoices->invoices->generate_receipt($reseller_info['id'],$custom_array['credit'],$reseller_info,$last_invoice_ID+1,$invoice_prefix,$due_date); |
1387 | 1387 | $account_balance = $this->common->get_field_name('balance', 'accounts', $reseller_info['id']); |
1388 | 1388 | $insert_arr = array("accountid" => $reseller_info['id'], |
1389 | - "description" => trim($custom_array['notes']), |
|
1390 | - "debit" => 0, |
|
1391 | - "credit" => $custom_array['credit'], |
|
1392 | - "created_date" => gmdate("Y-m-d H:i:s"), |
|
1393 | - "invoiceid"=>$invoice_id, |
|
1394 | - "reseller_id"=>$reseller_info['reseller_id'], |
|
1395 | - "item_type"=>'Refill', |
|
1396 | - "item_id"=>'0', |
|
1397 | - 'before_balance'=>$account_balance-$custom_array['credit'], |
|
1398 | - 'after_balance'=>$account_balance, |
|
1399 | - ); |
|
1400 | - $this->db->insert("invoice_details", $insert_arr); |
|
1389 | + "description" => trim($custom_array['notes']), |
|
1390 | + "debit" => 0, |
|
1391 | + "credit" => $custom_array['credit'], |
|
1392 | + "created_date" => gmdate("Y-m-d H:i:s"), |
|
1393 | + "invoiceid"=>$invoice_id, |
|
1394 | + "reseller_id"=>$reseller_info['reseller_id'], |
|
1395 | + "item_type"=>'Refill', |
|
1396 | + "item_id"=>'0', |
|
1397 | + 'before_balance'=>$account_balance-$custom_array['credit'], |
|
1398 | + 'after_balance'=>$account_balance, |
|
1399 | + ); |
|
1400 | + $this->db->insert("invoice_details", $insert_arr); |
|
1401 | + } |
|
1402 | + } |
|
1401 | 1403 | } |
1402 | - } |
|
1403 | - } |
|
1404 | 1404 | } |
1405 | - $message = $post_array['payment_type']== 0 ? "Recharge successfully!" : "Post charge applied successfully."; |
|
1405 | + $message = $post_array['payment_type']== 0 ? "Recharge successfully!" : "Post charge applied successfully."; |
|
1406 | 1406 | /***********************************************************************************************/ |
1407 | - echo json_encode(array("SUCCESS"=> $message)); |
|
1408 | - exit; |
|
1409 | - // } |
|
1410 | - } |
|
1411 | - $this->load->view('view_accounts_process_payment', $data); |
|
1412 | - } |
|
1413 | - function get_invoice_date($select,$accountid){ |
|
1407 | + echo json_encode(array("SUCCESS"=> $message)); |
|
1408 | + exit; |
|
1409 | + // } |
|
1410 | + } |
|
1411 | + $this->load->view('view_accounts_process_payment', $data); |
|
1412 | + } |
|
1413 | + function get_invoice_date($select,$accountid){ |
|
1414 | 1414 | $query = $this->db_model->select($select, "invoices", '',"id","DESC","1","0"); |
1415 | 1415 | if($query->num_rows >0){ |
1416 | 1416 | $invoiceid = $query->result_array(); |
@@ -1418,1058 +1418,1058 @@ discard block |
||
1418 | 1418 | return $invoice_date; |
1419 | 1419 | } |
1420 | 1420 | return false; |
1421 | - } |
|
1421 | + } |
|
1422 | 1422 | /***************************************Completed********************************************************/ |
1423 | 1423 | |
1424 | 1424 | |
1425 | - /** |
|
1426 | - * -------Here we write code for controller accounts functions add_callerid------ |
|
1427 | - * Add caller ids against account no |
|
1428 | - * @account_number: Account No |
|
1429 | - */ |
|
1430 | - function customer_add_callerid($id = "") { |
|
1431 | - $data['username'] = $this->session->userdata('user_name'); |
|
1432 | - $data['page_title'] = 'Force Caller Id'; |
|
1433 | - $account_num = $this->accounts_model->get_account_number($id); |
|
1434 | - $result = $this->accounts_model->get_callerid($id); |
|
1435 | - if ($result->num_rows() > 0) { |
|
1436 | - foreach ($result->result_array() as $values) { |
|
1437 | - $data['accountid'] = $values['accountid']; |
|
1438 | - $data['callerid_name'] = $values['callerid_name']; |
|
1439 | - $data['callerid_number'] = $values['callerid_number']; |
|
1440 | - $data['status'] = $values['status']; |
|
1441 | - $data['flag'] = '1'; |
|
1442 | - } |
|
1443 | - } else { |
|
1444 | - $data['accountid'] = $id; |
|
1445 | - $data['callerid_name'] = ''; |
|
1446 | - $data['callerid_number'] = ''; |
|
1447 | - $data['status'] = '0'; |
|
1448 | - $data['flag'] = '0'; |
|
1449 | - } |
|
1450 | - $data['accountid'] = $account_num['number']; |
|
1451 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_callerid_fields(), $data); |
|
1452 | - $post_array = $this->input->post(); |
|
1425 | + /** |
|
1426 | + * -------Here we write code for controller accounts functions add_callerid------ |
|
1427 | + * Add caller ids against account no |
|
1428 | + * @account_number: Account No |
|
1429 | + */ |
|
1430 | + function customer_add_callerid($id = "") { |
|
1431 | + $data['username'] = $this->session->userdata('user_name'); |
|
1432 | + $data['page_title'] = 'Force Caller Id'; |
|
1433 | + $account_num = $this->accounts_model->get_account_number($id); |
|
1434 | + $result = $this->accounts_model->get_callerid($id); |
|
1435 | + if ($result->num_rows() > 0) { |
|
1436 | + foreach ($result->result_array() as $values) { |
|
1437 | + $data['accountid'] = $values['accountid']; |
|
1438 | + $data['callerid_name'] = $values['callerid_name']; |
|
1439 | + $data['callerid_number'] = $values['callerid_number']; |
|
1440 | + $data['status'] = $values['status']; |
|
1441 | + $data['flag'] = '1'; |
|
1442 | + } |
|
1443 | + } else { |
|
1444 | + $data['accountid'] = $id; |
|
1445 | + $data['callerid_name'] = ''; |
|
1446 | + $data['callerid_number'] = ''; |
|
1447 | + $data['status'] = '0'; |
|
1448 | + $data['flag'] = '0'; |
|
1449 | + } |
|
1450 | + $data['accountid'] = $account_num['number']; |
|
1451 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_callerid_fields(), $data); |
|
1452 | + $post_array = $this->input->post(); |
|
1453 | 1453 | |
1454 | - if (!empty($post_array)) { |
|
1455 | - if ($this->form_validation->run() == FALSE) { |
|
1456 | - $data['validation_errors'] = validation_errors(); |
|
1457 | - echo $data['validation_errors']; |
|
1458 | - exit; |
|
1459 | - } else { |
|
1460 | - if ($post_array['flag'] == '1') { |
|
1461 | - $this->accounts_model->edit_callerid($post_array); |
|
1462 | - echo json_encode(array("SUCCESS"=> "Account callerID updated successfully!")); |
|
1463 | - exit; |
|
1464 | - } else { |
|
1465 | - $this->accounts_model->add_callerid($post_array); |
|
1466 | - echo json_encode(array("SUCCESS"=> "Account callerID added successfully!")); |
|
1467 | - exit; |
|
1468 | - } |
|
1469 | - } |
|
1470 | - } |
|
1471 | - $this->load->view('view_accounts_add_callerid', $data); |
|
1472 | - } |
|
1473 | - function reseller_add($type = "") { |
|
1454 | + if (!empty($post_array)) { |
|
1455 | + if ($this->form_validation->run() == FALSE) { |
|
1456 | + $data['validation_errors'] = validation_errors(); |
|
1457 | + echo $data['validation_errors']; |
|
1458 | + exit; |
|
1459 | + } else { |
|
1460 | + if ($post_array['flag'] == '1') { |
|
1461 | + $this->accounts_model->edit_callerid($post_array); |
|
1462 | + echo json_encode(array("SUCCESS"=> "Account callerID updated successfully!")); |
|
1463 | + exit; |
|
1464 | + } else { |
|
1465 | + $this->accounts_model->add_callerid($post_array); |
|
1466 | + echo json_encode(array("SUCCESS"=> "Account callerID added successfully!")); |
|
1467 | + exit; |
|
1468 | + } |
|
1469 | + } |
|
1470 | + } |
|
1471 | + $this->load->view('view_accounts_add_callerid', $data); |
|
1472 | + } |
|
1473 | + function reseller_add($type = "") { |
|
1474 | 1474 | $accountinfo = $this->session->userdata('accountinfo'); |
1475 | - $data['username'] = $this->session->userdata('user_name'); |
|
1476 | - $data['flag'] = 'create'; |
|
1477 | - $data['page_title'] = 'Create Reseller'; |
|
1478 | - $data['back_flag'] = true; |
|
1479 | - $data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields(), ''); |
|
1480 | - $data['country_id'] = $accountinfo['country_id']; |
|
1475 | + $data['username'] = $this->session->userdata('user_name'); |
|
1476 | + $data['flag'] = 'create'; |
|
1477 | + $data['page_title'] = 'Create Reseller'; |
|
1478 | + $data['back_flag'] = true; |
|
1479 | + $data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields(), ''); |
|
1480 | + $data['country_id'] = $accountinfo['country_id']; |
|
1481 | 1481 | $data['currency_id'] = $accountinfo['currency_id']; |
1482 | - $data['timezone_id'] = $accountinfo['timezone_id']; |
|
1483 | - if (!$data['timezone_id']) { |
|
1484 | - $data['timezone_id'] = 1; |
|
1485 | - } |
|
1486 | - if (!$data['currency_id']) { |
|
1487 | - $data['currency_id'] = 1; |
|
1488 | - } |
|
1489 | - if (!$data['country_id']) { |
|
1490 | - $data['country_id'] = 1; |
|
1491 | - } |
|
1492 | - |
|
1493 | - $this->load->view('view_accounts_create', $data); |
|
1494 | - } |
|
1495 | - |
|
1496 | - function reseller_edit($edit_id = '') { |
|
1497 | - $data['page_title'] = 'Edit Reseller'; |
|
1498 | - $where = array('id' => $edit_id); |
|
1499 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
1500 | - $data["account_data"] = $account->result_array(); |
|
1501 | - $acc_data = $this->session->userdata("accountinfo"); |
|
1502 | - foreach ($account->result_array() as $key => $value) { |
|
1503 | - $edit_data = $value; |
|
1504 | - } |
|
1505 | - $taxes_data = $this->db_model->getSelect("group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array("accountid" => $edit_id)); |
|
1506 | - if (isset($taxes_data) && $taxes_data->num_rows() > 0) { |
|
1507 | - $taxes_data = $taxes_data->result_array(); |
|
1508 | - $edit_data["tax_id"] = explode(",", $taxes_data[0]['taxes_id']); |
|
1509 | - } |
|
1510 | - |
|
1511 | - /** |
|
1482 | + $data['timezone_id'] = $accountinfo['timezone_id']; |
|
1483 | + if (!$data['timezone_id']) { |
|
1484 | + $data['timezone_id'] = 1; |
|
1485 | + } |
|
1486 | + if (!$data['currency_id']) { |
|
1487 | + $data['currency_id'] = 1; |
|
1488 | + } |
|
1489 | + if (!$data['country_id']) { |
|
1490 | + $data['country_id'] = 1; |
|
1491 | + } |
|
1492 | + |
|
1493 | + $this->load->view('view_accounts_create', $data); |
|
1494 | + } |
|
1495 | + |
|
1496 | + function reseller_edit($edit_id = '') { |
|
1497 | + $data['page_title'] = 'Edit Reseller'; |
|
1498 | + $where = array('id' => $edit_id); |
|
1499 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
1500 | + $data["account_data"] = $account->result_array(); |
|
1501 | + $acc_data = $this->session->userdata("accountinfo"); |
|
1502 | + foreach ($account->result_array() as $key => $value) { |
|
1503 | + $edit_data = $value; |
|
1504 | + } |
|
1505 | + $taxes_data = $this->db_model->getSelect("group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array("accountid" => $edit_id)); |
|
1506 | + if (isset($taxes_data) && $taxes_data->num_rows() > 0) { |
|
1507 | + $taxes_data = $taxes_data->result_array(); |
|
1508 | + $edit_data["tax_id"] = explode(",", $taxes_data[0]['taxes_id']); |
|
1509 | + } |
|
1510 | + |
|
1511 | + /** |
|
1512 | 1512 | ASTPP 3.0 |
1513 | 1513 | Add For Signup module |
1514 | - * */ |
|
1515 | - $encrypted_string = $this->common->encode($edit_data['id']); |
|
1516 | - $encrypt = $this->common->encode_params($encrypted_string); |
|
1517 | - $edit_data['registration_url'] = base_url() . "signup/" . $encrypt; |
|
1518 | - /* * *********************************************************** */ |
|
1519 | - /* * *** |
|
1514 | + * */ |
|
1515 | + $encrypted_string = $this->common->encode($edit_data['id']); |
|
1516 | + $encrypt = $this->common->encode_params($encrypted_string); |
|
1517 | + $edit_data['registration_url'] = base_url() . "signup/" . $encrypt; |
|
1518 | + /* * *********************************************************** */ |
|
1519 | + /* * *** |
|
1520 | 1520 | ASTPP 3.0 |
1521 | 1521 | Password decode |
1522 | 1522 | * **** */ |
1523 | - $edit_data['password'] = $this->common->decode($edit_data['password']); |
|
1524 | - $edit_data['credit_limit']=$this->common_model->calculate_currency(($edit_data['credit_limit']),'','',true,false); |
|
1525 | - $entity_name = strtolower($this->common->get_entity_type('', '', $edit_data['type'])); |
|
1526 | - $data['edit_id']=$edit_id; |
|
1527 | - $data['page_title'] =ucfirst($entity_name)." Profile"; |
|
1528 | - $data['entity_name'] = $entity_name; |
|
1529 | - /* * ********************** */ |
|
1530 | - $data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($edit_id), $edit_data); |
|
1531 | - $this->load->view('view_reseller_details', $data); |
|
1532 | - } |
|
1533 | - |
|
1534 | - /* * *********************************************************** */ |
|
1535 | - |
|
1536 | - function reseller_save() { |
|
1537 | - $add_array = $this->input->post(); |
|
1538 | - $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type'])); |
|
1539 | - $data['country_id'] = $add_array['country_id']; |
|
1540 | - $data['timezone_id'] = $add_array['timezone_id']; |
|
1541 | - $data['currency_id'] = $add_array['currency_id']; |
|
1542 | - $data['entity_name'] = $entity_name; |
|
1543 | - $data['edit_id']=$add_array['id']; |
|
1544 | - $data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($add_array['id']), $add_array); |
|
1545 | - if ($add_array['id'] != '') { |
|
1546 | - $data['page_title'] = 'Edit Reseller'; |
|
1547 | - if ($this->form_validation->run() == FALSE) { |
|
1548 | - $data['validation_errors'] = validation_errors(); |
|
1549 | - } else { |
|
1550 | - /* * **** |
|
1523 | + $edit_data['password'] = $this->common->decode($edit_data['password']); |
|
1524 | + $edit_data['credit_limit']=$this->common_model->calculate_currency(($edit_data['credit_limit']),'','',true,false); |
|
1525 | + $entity_name = strtolower($this->common->get_entity_type('', '', $edit_data['type'])); |
|
1526 | + $data['edit_id']=$edit_id; |
|
1527 | + $data['page_title'] =ucfirst($entity_name)." Profile"; |
|
1528 | + $data['entity_name'] = $entity_name; |
|
1529 | + /* * ********************** */ |
|
1530 | + $data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($edit_id), $edit_data); |
|
1531 | + $this->load->view('view_reseller_details', $data); |
|
1532 | + } |
|
1533 | + |
|
1534 | + /* * *********************************************************** */ |
|
1535 | + |
|
1536 | + function reseller_save() { |
|
1537 | + $add_array = $this->input->post(); |
|
1538 | + $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type'])); |
|
1539 | + $data['country_id'] = $add_array['country_id']; |
|
1540 | + $data['timezone_id'] = $add_array['timezone_id']; |
|
1541 | + $data['currency_id'] = $add_array['currency_id']; |
|
1542 | + $data['entity_name'] = $entity_name; |
|
1543 | + $data['edit_id']=$add_array['id']; |
|
1544 | + $data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($add_array['id']), $add_array); |
|
1545 | + if ($add_array['id'] != '') { |
|
1546 | + $data['page_title'] = 'Edit Reseller'; |
|
1547 | + if ($this->form_validation->run() == FALSE) { |
|
1548 | + $data['validation_errors'] = validation_errors(); |
|
1549 | + } else { |
|
1550 | + /* * **** |
|
1551 | 1551 | ASTPP 3.0 |
1552 | 1552 | Password encode |
1553 | 1553 | * **** */ |
1554 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
1555 | - /* * ****************** */ |
|
1556 | - $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1557 | - $query = $this->accounts_model->remove_all_account_tax($add_array['id']); |
|
1558 | - if (isset($add_array['tax_id'])) { |
|
1559 | - foreach ($add_array['tax_id'] as $key => $val) { |
|
1560 | - $data1 = array( |
|
1561 | - 'accountid' => $add_array['id'], |
|
1562 | - 'taxes_id' => $val, |
|
1563 | - ); |
|
1564 | - $this->accounts_model->add_account_tax($data1); |
|
1565 | - } |
|
1566 | - unset($add_array['tax_id']); |
|
1567 | - } |
|
1568 | - unset($add_array['number'],$add_array['registration_url']); |
|
1569 | - $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
1570 | - $this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!'); |
|
1571 | - |
|
1572 | - redirect(base_url() . 'accounts/reseller_list/'); |
|
1573 | - exit; |
|
1574 | - } |
|
1575 | - $data["account_data"]["0"] = $add_array; |
|
1576 | - $edit_id = $add_array["id"]; |
|
1577 | - $data['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), ''); |
|
1578 | - |
|
1579 | - $this->load->module('charges/charges'); |
|
1580 | - $data['charges_grid_field'] = $this->charges->charges_form->build_charges_list_for_customer($edit_id, "reseller"); |
|
1581 | - |
|
1582 | - $data["sipiax_grid_field"] = json_decode($this->accounts_form->build_sipiax_list_for_customer()); |
|
1583 | - |
|
1584 | - $this->load->module('did/did'); |
|
1585 | - $data['did_grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, "reseller"); |
|
1586 | - $data['didlist'] = form_dropdown('free_did_list', $this->db_model->build_dropdown("id,number", "dids", "accountid", "0"), ''); |
|
1587 | - |
|
1588 | - |
|
1589 | - $this->load->module('invoices/invoices'); |
|
1590 | - $data['invoice_grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_admin(); |
|
1591 | - |
|
1592 | - $this->load->module('reports/reports'); |
|
1593 | - $data['cdrs_grid_fields'] = $this->reports->reports_form->build_report_list_for_user(); |
|
1594 | - $this->load->view('view_reseller_details', $data); |
|
1595 | - } else { |
|
1596 | - |
|
1597 | - $data['page_title'] = 'Create Reseller'; |
|
1598 | - if ($this->form_validation->run() == FALSE) { |
|
1599 | - $data['validation_errors'] = validation_errors(); |
|
1600 | - } else { |
|
1601 | - /* * **** |
|
1554 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
1555 | + /* * ****************** */ |
|
1556 | + $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1557 | + $query = $this->accounts_model->remove_all_account_tax($add_array['id']); |
|
1558 | + if (isset($add_array['tax_id'])) { |
|
1559 | + foreach ($add_array['tax_id'] as $key => $val) { |
|
1560 | + $data1 = array( |
|
1561 | + 'accountid' => $add_array['id'], |
|
1562 | + 'taxes_id' => $val, |
|
1563 | + ); |
|
1564 | + $this->accounts_model->add_account_tax($data1); |
|
1565 | + } |
|
1566 | + unset($add_array['tax_id']); |
|
1567 | + } |
|
1568 | + unset($add_array['number'],$add_array['registration_url']); |
|
1569 | + $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
1570 | + $this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!'); |
|
1571 | + |
|
1572 | + redirect(base_url() . 'accounts/reseller_list/'); |
|
1573 | + exit; |
|
1574 | + } |
|
1575 | + $data["account_data"]["0"] = $add_array; |
|
1576 | + $edit_id = $add_array["id"]; |
|
1577 | + $data['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), ''); |
|
1578 | + |
|
1579 | + $this->load->module('charges/charges'); |
|
1580 | + $data['charges_grid_field'] = $this->charges->charges_form->build_charges_list_for_customer($edit_id, "reseller"); |
|
1581 | + |
|
1582 | + $data["sipiax_grid_field"] = json_decode($this->accounts_form->build_sipiax_list_for_customer()); |
|
1583 | + |
|
1584 | + $this->load->module('did/did'); |
|
1585 | + $data['did_grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, "reseller"); |
|
1586 | + $data['didlist'] = form_dropdown('free_did_list', $this->db_model->build_dropdown("id,number", "dids", "accountid", "0"), ''); |
|
1587 | + |
|
1588 | + |
|
1589 | + $this->load->module('invoices/invoices'); |
|
1590 | + $data['invoice_grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_admin(); |
|
1591 | + |
|
1592 | + $this->load->module('reports/reports'); |
|
1593 | + $data['cdrs_grid_fields'] = $this->reports->reports_form->build_report_list_for_user(); |
|
1594 | + $this->load->view('view_reseller_details', $data); |
|
1595 | + } else { |
|
1596 | + |
|
1597 | + $data['page_title'] = 'Create Reseller'; |
|
1598 | + if ($this->form_validation->run() == FALSE) { |
|
1599 | + $data['validation_errors'] = validation_errors(); |
|
1600 | + } else { |
|
1601 | + /* * **** |
|
1602 | 1602 | ASTPP 3.0 |
1603 | 1603 | Password encode |
1604 | 1604 | * **** */ |
1605 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
1606 | - /* * ****************** */ |
|
1607 | - $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1608 | - $last_id = $this->accounts_model->add_account($add_array); |
|
1609 | - if (isset($add_array['tax_id'])) { |
|
1610 | - foreach ($add_array['tax_id'] as $key => $val) { |
|
1611 | - $data1 = array( |
|
1612 | - 'accountid' => $last_id, |
|
1613 | - 'taxes_id' => $val, |
|
1614 | - ); |
|
1615 | - $this->accounts_model->add_account_tax($data1); |
|
1616 | - } |
|
1617 | - unset($add_array['tax_id']); |
|
1618 | - } |
|
1619 | - $this->session->set_flashdata('astpp_errormsg', 'Reseller added successfully!'); |
|
1620 | - redirect(base_url() . 'accounts/reseller_list/'); |
|
1621 | - exit; |
|
1622 | - } |
|
1623 | - $this->load->view('view_accounts_create', $data); |
|
1624 | - } |
|
1625 | - } |
|
1626 | - |
|
1627 | - function reseller_dids($edit_id) { |
|
1628 | - $this->customer_dids($edit_id); |
|
1629 | - } |
|
1630 | - |
|
1631 | - function customer_generate_password() { |
|
1632 | - echo $this->common->generate_password(); |
|
1633 | - } |
|
1634 | - |
|
1635 | - function customer_generate_number($digit='') { |
|
1605 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
1606 | + /* * ****************** */ |
|
1607 | + $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1608 | + $last_id = $this->accounts_model->add_account($add_array); |
|
1609 | + if (isset($add_array['tax_id'])) { |
|
1610 | + foreach ($add_array['tax_id'] as $key => $val) { |
|
1611 | + $data1 = array( |
|
1612 | + 'accountid' => $last_id, |
|
1613 | + 'taxes_id' => $val, |
|
1614 | + ); |
|
1615 | + $this->accounts_model->add_account_tax($data1); |
|
1616 | + } |
|
1617 | + unset($add_array['tax_id']); |
|
1618 | + } |
|
1619 | + $this->session->set_flashdata('astpp_errormsg', 'Reseller added successfully!'); |
|
1620 | + redirect(base_url() . 'accounts/reseller_list/'); |
|
1621 | + exit; |
|
1622 | + } |
|
1623 | + $this->load->view('view_accounts_create', $data); |
|
1624 | + } |
|
1625 | + } |
|
1626 | + |
|
1627 | + function reseller_dids($edit_id) { |
|
1628 | + $this->customer_dids($edit_id); |
|
1629 | + } |
|
1630 | + |
|
1631 | + function customer_generate_password() { |
|
1632 | + echo $this->common->generate_password(); |
|
1633 | + } |
|
1634 | + |
|
1635 | + function customer_generate_number($digit='') { |
|
1636 | 1636 | |
1637 | - echo $this->common->find_uniq_rendno($digit, 'number', 'accounts'); |
|
1638 | - } |
|
1637 | + echo $this->common->find_uniq_rendno($digit, 'number', 'accounts'); |
|
1638 | + } |
|
1639 | 1639 | |
1640 | - function admin_add($type = 2) { |
|
1640 | + function admin_add($type = 2) { |
|
1641 | 1641 | $accountinfo = $this->session->userdata('accountinfo'); |
1642 | 1642 | $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
1643 | - $entitytype = str_replace(' ', '', $entity_type); |
|
1644 | - $data['username'] = $this->session->userdata('user_name'); |
|
1645 | - $data['flag'] = 'create'; |
|
1646 | - $data['page_title'] = 'Create ' . ucfirst($entity_type); |
|
1647 | - $data['back_flag'] = true; |
|
1648 | - $data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype), ''); |
|
1649 | - $data['country_id'] = $accountinfo['country_id']; |
|
1650 | - $data['currency_id'] = $accountinfo['currency_id']; |
|
1651 | - $data['timezone_id'] = $accountinfo['timezone_id']; |
|
1652 | - if (!$data['timezone_id']) { |
|
1653 | - $data['timezone_id'] = 1; |
|
1654 | - } |
|
1655 | - if (!$data['currency_id']) { |
|
1656 | - $data['currency_id'] = 1; |
|
1657 | - } |
|
1658 | - if (!$data['country_id']) { |
|
1659 | - $data['country_id'] = 1; |
|
1660 | - } |
|
1661 | - $data['entity_name'] = $entity_type; |
|
1662 | - $this->load->view('view_accounts_create', $data); |
|
1663 | - } |
|
1664 | - |
|
1665 | - function admin_edit($edit_id = '') { |
|
1643 | + $entitytype = str_replace(' ', '', $entity_type); |
|
1644 | + $data['username'] = $this->session->userdata('user_name'); |
|
1645 | + $data['flag'] = 'create'; |
|
1646 | + $data['page_title'] = 'Create ' . ucfirst($entity_type); |
|
1647 | + $data['back_flag'] = true; |
|
1648 | + $data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype), ''); |
|
1649 | + $data['country_id'] = $accountinfo['country_id']; |
|
1650 | + $data['currency_id'] = $accountinfo['currency_id']; |
|
1651 | + $data['timezone_id'] = $accountinfo['timezone_id']; |
|
1652 | + if (!$data['timezone_id']) { |
|
1653 | + $data['timezone_id'] = 1; |
|
1654 | + } |
|
1655 | + if (!$data['currency_id']) { |
|
1656 | + $data['currency_id'] = 1; |
|
1657 | + } |
|
1658 | + if (!$data['country_id']) { |
|
1659 | + $data['country_id'] = 1; |
|
1660 | + } |
|
1661 | + $data['entity_name'] = $entity_type; |
|
1662 | + $this->load->view('view_accounts_create', $data); |
|
1663 | + } |
|
1664 | + |
|
1665 | + function admin_edit($edit_id = '') { |
|
1666 | 1666 | $data['back_flag'] = true; |
1667 | - $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$edit_id))->first_row(); |
|
1668 | - $type = $accountinfo['type'] == -1 ? 2 : $accountinfo['type']; |
|
1669 | - $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
|
1670 | - $entitytype = str_replace(' ', '', $entity_type); |
|
1671 | - $accountinfo['password'] = $this->common->decode($accountinfo['password']); |
|
1672 | - $data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $edit_id), $accountinfo); |
|
1673 | - $data['page_title'] = 'Edit ' . ucfirst($entity_type); |
|
1674 | - $this->load->view('view_admin_details', $data); |
|
1667 | + $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$edit_id))->first_row(); |
|
1668 | + $type = $accountinfo['type'] == -1 ? 2 : $accountinfo['type']; |
|
1669 | + $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
|
1670 | + $entitytype = str_replace(' ', '', $entity_type); |
|
1671 | + $accountinfo['password'] = $this->common->decode($accountinfo['password']); |
|
1672 | + $data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $edit_id), $accountinfo); |
|
1673 | + $data['page_title'] = 'Edit ' . ucfirst($entity_type); |
|
1674 | + $this->load->view('view_admin_details', $data); |
|
1675 | 1675 | |
1676 | - } |
|
1677 | - |
|
1678 | - function admin_save($add_array = false) { |
|
1679 | - $add_array = $this->input->post(); |
|
1680 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1681 | - $type = $add_array['type'] == -1 ? 2 : $add_array['type']; |
|
1682 | - $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
|
1683 | - $entitytype = str_replace(' ', '', $entity_type); |
|
1684 | - $data['username'] = $this->session->userdata('user_name'); |
|
1685 | - $data['flag'] = 'create'; |
|
1686 | - $data['page_title'] = 'Create ' . $entity_type; |
|
1687 | - $data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $add_array['id']), $add_array); |
|
1688 | - if ($add_array['id'] != '') { |
|
1689 | - $data['page_title'] = 'Edit ' . $entity_type; |
|
1690 | - if ($this->form_validation->run() == FALSE) { |
|
1691 | - $data['validation_errors'] = validation_errors(); |
|
1692 | - } else { |
|
1693 | - /* * **** |
|
1676 | + } |
|
1677 | + |
|
1678 | + function admin_save($add_array = false) { |
|
1679 | + $add_array = $this->input->post(); |
|
1680 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1681 | + $type = $add_array['type'] == -1 ? 2 : $add_array['type']; |
|
1682 | + $entity_type = strtolower($this->common->get_entity_type('', '', $type)); |
|
1683 | + $entitytype = str_replace(' ', '', $entity_type); |
|
1684 | + $data['username'] = $this->session->userdata('user_name'); |
|
1685 | + $data['flag'] = 'create'; |
|
1686 | + $data['page_title'] = 'Create ' . $entity_type; |
|
1687 | + $data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $add_array['id']), $add_array); |
|
1688 | + if ($add_array['id'] != '') { |
|
1689 | + $data['page_title'] = 'Edit ' . $entity_type; |
|
1690 | + if ($this->form_validation->run() == FALSE) { |
|
1691 | + $data['validation_errors'] = validation_errors(); |
|
1692 | + } else { |
|
1693 | + /* * **** |
|
1694 | 1694 | ASTPP 3.0 |
1695 | 1695 | Password encode |
1696 | 1696 | * **** */ |
1697 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
1698 | - /* * ****************** */ |
|
1699 | - $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1700 | - $query = $this->accounts_model->remove_all_account_tax($add_array['id']); |
|
1701 | - if (isset($add_array['tax_id'])) { |
|
1702 | - foreach ($add_array['tax_id'] as $key => $val) { |
|
1703 | - $data1 = array( |
|
1704 | - 'accountid' => $add_array['id'], |
|
1705 | - 'taxes_id' => $val, |
|
1706 | - ); |
|
1707 | - $this->accounts_model->add_account_tax($data1); |
|
1708 | - } |
|
1709 | - unset($add_array['tax_id']); |
|
1710 | - } |
|
1711 | - unset($add_array['number']); |
|
1712 | - $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
1713 | - if ($add_array['id'] == $accountinfo['id']) { |
|
1714 | - $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
1715 | - $result = $result->result_array(); |
|
1716 | - $this->session->set_userdata('accountinfo', $result[0]); |
|
1717 | - } |
|
1718 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' updated successfully!'); |
|
1719 | - redirect(base_url() . 'accounts/admin_list/'); |
|
1720 | - exit; |
|
1721 | - } |
|
1722 | - $this->load->view('view_admin_details', $data); |
|
1723 | - } else { |
|
1724 | - $data['page_title'] = 'Create ' . ucfirst($entity_type); |
|
1725 | - if ($this->form_validation->run() == FALSE) { |
|
1726 | - $data['validation_errors'] = validation_errors(); |
|
1727 | - } else { |
|
1728 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
1729 | - $last_id = $this->accounts_model->add_account($add_array); |
|
1730 | - if (isset($add_array['tax_id'])) { |
|
1731 | - foreach ($add_array['tax_id'] as $key => $val) { |
|
1732 | - $data1 = array( |
|
1733 | - 'accountid' => $last_id, |
|
1734 | - 'taxes_id' => $val, |
|
1735 | - ); |
|
1736 | - $this->accounts_model->add_account_tax($data1); |
|
1737 | - } |
|
1738 | - unset($add_array['tax_id']); |
|
1739 | - } |
|
1740 | - $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1741 | - |
|
1742 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' added successfully!'); |
|
1743 | - redirect(base_url() . 'accounts/admin_list/'); |
|
1744 | - exit; |
|
1745 | - }$this->load->view('view_accounts_create', $data); |
|
1746 | - } |
|
1747 | - } |
|
1748 | - |
|
1749 | - function subadmin_add($type = "") { |
|
1750 | - $this->admin_add(4); |
|
1751 | - } |
|
1752 | - |
|
1753 | - function subadmin_edit($edit_id = '') { |
|
1754 | - $this->admin_edit($edit_id); |
|
1755 | - } |
|
1756 | - |
|
1757 | - function subadmin_save() { |
|
1758 | - $add_array = $this->input->post(); |
|
1759 | - $this->admin_save($add_array); |
|
1760 | - } |
|
1761 | - |
|
1762 | - function chargelist_json($accountid) { |
|
1763 | - $json_data = array(); |
|
1764 | - $sweeplist = $this->common_model->get_sweep_list(); |
|
1765 | - |
|
1766 | - $select = "charges.description,charges.charge,charges.sweep"; |
|
1767 | - $table = "charges"; |
|
1768 | - $jionTable = array('charge_to_account', 'accounts'); |
|
1769 | - $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.number = charge_to_account.cardnum'); |
|
1770 | - $type = array('left', 'inner'); |
|
1771 | - $where = array('accounts.accountid' => $accountid); |
|
1772 | - $order_type = 'charges.id'; |
|
1773 | - $order_by = "ASC"; |
|
1774 | - |
|
1775 | - $account_charge_count = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
|
1776 | - |
|
1777 | - $count_all = $account_charge_count; |
|
1778 | - $config['total_rows'] = $count_all; |
|
1779 | - $config['per_page'] = $_GET['rp']; |
|
1780 | - |
|
1781 | - $page_no = $_GET['page']; |
|
1782 | - $json_data['page'] = $page_no; |
|
1783 | - |
|
1784 | - $json_data['total'] = $config['total_rows']; |
|
1785 | - $perpage = $config['per_page']; |
|
1786 | - $start = ($page_no - 1) * $perpage; |
|
1787 | - if ($start < 0) |
|
1788 | - $start = 0; |
|
1789 | - |
|
1790 | - $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, ""); |
|
1791 | - if ($account_charge_list->num_rows > 0) { |
|
1792 | - foreach ($account_charge_list->result() as $key => $charges_value) { |
|
1793 | - $json_data['rows'][] = array('cell' => array( |
|
1794 | - $charges_value->description, |
|
1795 | - $charges_value->charge, |
|
1796 | - $sweeplist[$charges_value->sweep] |
|
1797 | - )); |
|
1798 | - } |
|
1799 | - } |
|
1800 | - echo json_encode($json_data); |
|
1801 | - } |
|
1802 | - |
|
1803 | - function admin_list() { |
|
1804 | - $data['username'] = $this->session->userdata('user_name'); |
|
1805 | - $data['page_title'] = 'Admins'; |
|
1806 | - $data['search_flag'] = true; |
|
1807 | - $data['cur_menu_no'] = 1; |
|
1808 | - $this->session->set_userdata('advance_search', 0); |
|
1809 | - $data['grid_fields'] = $this->accounts_form->build_account_list_for_admin(); |
|
1810 | - $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_admin(); |
|
1811 | - $data['form_search'] = $this->form->build_serach_form($this->accounts_form->get_admin_search_form()); |
|
1812 | - $this->load->view('view_accounts_list', $data); |
|
1813 | - } |
|
1814 | - |
|
1815 | - /** |
|
1816 | - * -------Here we write code for controller accounts functions account_list------ |
|
1817 | - * Listing of Accounts table data through php function json_encode |
|
1818 | - */ |
|
1819 | - function admin_list_json() { |
|
1820 | - $json_data = array(); |
|
1821 | - $account_data = $this->session->userdata("accountinfo"); |
|
1822 | - $reseller_id = $account_data['type'] == 1 ? $account_data['id'] : 0; |
|
1823 | - $count_all = $this->accounts_model->get_admin_Account_list(false, '', '', $reseller_id); |
|
1824 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1825 | - $json_data = $paging_data["json_paging"]; |
|
1826 | - |
|
1827 | - $query = $this->accounts_model->get_admin_Account_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $reseller_id); |
|
1828 | - $grid_fields = json_decode($this->accounts_form->build_account_list_for_admin()); |
|
1829 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1830 | - |
|
1831 | - echo json_encode($json_data); |
|
1832 | - } |
|
1833 | - |
|
1834 | - /** |
|
1697 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
1698 | + /* * ****************** */ |
|
1699 | + $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1700 | + $query = $this->accounts_model->remove_all_account_tax($add_array['id']); |
|
1701 | + if (isset($add_array['tax_id'])) { |
|
1702 | + foreach ($add_array['tax_id'] as $key => $val) { |
|
1703 | + $data1 = array( |
|
1704 | + 'accountid' => $add_array['id'], |
|
1705 | + 'taxes_id' => $val, |
|
1706 | + ); |
|
1707 | + $this->accounts_model->add_account_tax($data1); |
|
1708 | + } |
|
1709 | + unset($add_array['tax_id']); |
|
1710 | + } |
|
1711 | + unset($add_array['number']); |
|
1712 | + $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
1713 | + if ($add_array['id'] == $accountinfo['id']) { |
|
1714 | + $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
1715 | + $result = $result->result_array(); |
|
1716 | + $this->session->set_userdata('accountinfo', $result[0]); |
|
1717 | + } |
|
1718 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' updated successfully!'); |
|
1719 | + redirect(base_url() . 'accounts/admin_list/'); |
|
1720 | + exit; |
|
1721 | + } |
|
1722 | + $this->load->view('view_admin_details', $data); |
|
1723 | + } else { |
|
1724 | + $data['page_title'] = 'Create ' . ucfirst($entity_type); |
|
1725 | + if ($this->form_validation->run() == FALSE) { |
|
1726 | + $data['validation_errors'] = validation_errors(); |
|
1727 | + } else { |
|
1728 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
1729 | + $last_id = $this->accounts_model->add_account($add_array); |
|
1730 | + if (isset($add_array['tax_id'])) { |
|
1731 | + foreach ($add_array['tax_id'] as $key => $val) { |
|
1732 | + $data1 = array( |
|
1733 | + 'accountid' => $last_id, |
|
1734 | + 'taxes_id' => $val, |
|
1735 | + ); |
|
1736 | + $this->accounts_model->add_account_tax($data1); |
|
1737 | + } |
|
1738 | + unset($add_array['tax_id']); |
|
1739 | + } |
|
1740 | + $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
|
1741 | + |
|
1742 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' added successfully!'); |
|
1743 | + redirect(base_url() . 'accounts/admin_list/'); |
|
1744 | + exit; |
|
1745 | + }$this->load->view('view_accounts_create', $data); |
|
1746 | + } |
|
1747 | + } |
|
1748 | + |
|
1749 | + function subadmin_add($type = "") { |
|
1750 | + $this->admin_add(4); |
|
1751 | + } |
|
1752 | + |
|
1753 | + function subadmin_edit($edit_id = '') { |
|
1754 | + $this->admin_edit($edit_id); |
|
1755 | + } |
|
1756 | + |
|
1757 | + function subadmin_save() { |
|
1758 | + $add_array = $this->input->post(); |
|
1759 | + $this->admin_save($add_array); |
|
1760 | + } |
|
1761 | + |
|
1762 | + function chargelist_json($accountid) { |
|
1763 | + $json_data = array(); |
|
1764 | + $sweeplist = $this->common_model->get_sweep_list(); |
|
1765 | + |
|
1766 | + $select = "charges.description,charges.charge,charges.sweep"; |
|
1767 | + $table = "charges"; |
|
1768 | + $jionTable = array('charge_to_account', 'accounts'); |
|
1769 | + $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.number = charge_to_account.cardnum'); |
|
1770 | + $type = array('left', 'inner'); |
|
1771 | + $where = array('accounts.accountid' => $accountid); |
|
1772 | + $order_type = 'charges.id'; |
|
1773 | + $order_by = "ASC"; |
|
1774 | + |
|
1775 | + $account_charge_count = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
|
1776 | + |
|
1777 | + $count_all = $account_charge_count; |
|
1778 | + $config['total_rows'] = $count_all; |
|
1779 | + $config['per_page'] = $_GET['rp']; |
|
1780 | + |
|
1781 | + $page_no = $_GET['page']; |
|
1782 | + $json_data['page'] = $page_no; |
|
1783 | + |
|
1784 | + $json_data['total'] = $config['total_rows']; |
|
1785 | + $perpage = $config['per_page']; |
|
1786 | + $start = ($page_no - 1) * $perpage; |
|
1787 | + if ($start < 0) |
|
1788 | + $start = 0; |
|
1789 | + |
|
1790 | + $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, ""); |
|
1791 | + if ($account_charge_list->num_rows > 0) { |
|
1792 | + foreach ($account_charge_list->result() as $key => $charges_value) { |
|
1793 | + $json_data['rows'][] = array('cell' => array( |
|
1794 | + $charges_value->description, |
|
1795 | + $charges_value->charge, |
|
1796 | + $sweeplist[$charges_value->sweep] |
|
1797 | + )); |
|
1798 | + } |
|
1799 | + } |
|
1800 | + echo json_encode($json_data); |
|
1801 | + } |
|
1802 | + |
|
1803 | + function admin_list() { |
|
1804 | + $data['username'] = $this->session->userdata('user_name'); |
|
1805 | + $data['page_title'] = 'Admins'; |
|
1806 | + $data['search_flag'] = true; |
|
1807 | + $data['cur_menu_no'] = 1; |
|
1808 | + $this->session->set_userdata('advance_search', 0); |
|
1809 | + $data['grid_fields'] = $this->accounts_form->build_account_list_for_admin(); |
|
1810 | + $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_admin(); |
|
1811 | + $data['form_search'] = $this->form->build_serach_form($this->accounts_form->get_admin_search_form()); |
|
1812 | + $this->load->view('view_accounts_list', $data); |
|
1813 | + } |
|
1814 | + |
|
1815 | + /** |
|
1816 | + * -------Here we write code for controller accounts functions account_list------ |
|
1817 | + * Listing of Accounts table data through php function json_encode |
|
1818 | + */ |
|
1819 | + function admin_list_json() { |
|
1820 | + $json_data = array(); |
|
1821 | + $account_data = $this->session->userdata("accountinfo"); |
|
1822 | + $reseller_id = $account_data['type'] == 1 ? $account_data['id'] : 0; |
|
1823 | + $count_all = $this->accounts_model->get_admin_Account_list(false, '', '', $reseller_id); |
|
1824 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1825 | + $json_data = $paging_data["json_paging"]; |
|
1826 | + |
|
1827 | + $query = $this->accounts_model->get_admin_Account_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $reseller_id); |
|
1828 | + $grid_fields = json_decode($this->accounts_form->build_account_list_for_admin()); |
|
1829 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1830 | + |
|
1831 | + echo json_encode($json_data); |
|
1832 | + } |
|
1833 | + |
|
1834 | + /** |
|
1835 | 1835 | ASTPP 3.0 |
1836 | 1836 | Customer Batch Update. |
1837 | - * */ |
|
1838 | - function customer_batch_update() { |
|
1839 | - $batch_update_arr = $this->input->post(); |
|
1840 | - $result = $this->accounts_model->customer_rates_batch_update($batch_update_arr); |
|
1841 | - echo json_encode(array("SUCCESS" => "Customer batch updated successfully!")); |
|
1842 | - exit; |
|
1843 | - } |
|
1844 | - |
|
1845 | - /* * ********************************************************************* */ |
|
1846 | - |
|
1847 | - function reseller_list() { |
|
1848 | - $data['username'] = $this->session->userdata('user_name'); |
|
1849 | - $data['page_title'] = 'Resellers'; |
|
1850 | - $data['search_flag'] = true; |
|
1851 | - /** |
|
1837 | + * */ |
|
1838 | + function customer_batch_update() { |
|
1839 | + $batch_update_arr = $this->input->post(); |
|
1840 | + $result = $this->accounts_model->customer_rates_batch_update($batch_update_arr); |
|
1841 | + echo json_encode(array("SUCCESS" => "Customer batch updated successfully!")); |
|
1842 | + exit; |
|
1843 | + } |
|
1844 | + |
|
1845 | + /* * ********************************************************************* */ |
|
1846 | + |
|
1847 | + function reseller_list() { |
|
1848 | + $data['username'] = $this->session->userdata('user_name'); |
|
1849 | + $data['page_title'] = 'Resellers'; |
|
1850 | + $data['search_flag'] = true; |
|
1851 | + /** |
|
1852 | 1852 | ASTPP 3.0 |
1853 | 1853 | Reseller Batch Update |
1854 | - * */ |
|
1855 | - $data['batch_update_flag'] = true; |
|
1856 | - /* * *************************************** */ |
|
1857 | - $this->session->set_userdata('advance_search', 0); |
|
1858 | - $data['grid_fields'] = $this->accounts_form->build_account_list_for_reseller(); |
|
1859 | - $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_reseller(); |
|
1860 | - $data['form_search'] = $this->form->build_serach_form($this->accounts_form->get_reseller_search_form()); |
|
1861 | - $data['form_batch_update'] = $this->form->build_batchupdate_form($this->accounts_form->reseller_batch_update_form()); |
|
1862 | - /* * ************************************************************************************************************ */ |
|
1863 | - $this->load->view('view_accounts_list', $data); |
|
1864 | - } |
|
1865 | - |
|
1866 | - /** |
|
1867 | - * -------Here we write code for controller accounts functions account_list------ |
|
1868 | - * Listing of Accounts table data through php function json_encode |
|
1869 | - */ |
|
1870 | - function reseller_list_json() { |
|
1871 | - $json_data = array(); |
|
1872 | - $count_all = $this->accounts_model->get_reseller_Account_list(false); |
|
1873 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1874 | - $json_data = $paging_data["json_paging"]; |
|
1875 | - |
|
1876 | - $query = $this->accounts_model->get_reseller_Account_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1877 | - $grid_fields = json_decode($this->accounts_form->build_account_list_for_reseller()); |
|
1878 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1879 | - |
|
1880 | - echo json_encode($json_data); |
|
1881 | - } |
|
1882 | - |
|
1883 | - function reseller_list_search() { |
|
1884 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1885 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1886 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1887 | - $action = $this->input->post(); |
|
1888 | - unset($action['action']); |
|
1889 | - unset($action['advance_search']); |
|
1890 | - if (isset($action['balance']['balance']) && $action['balance']['balance'] != '') { |
|
1891 | - $action['balance']['balance'] = $this->common_model->add_calculate_currency($action['balance']['balance'], "", '', true, false); |
|
1892 | - } |
|
1893 | - if (isset($action['credit_limit']['credit_limit']) && $action['credit_limit']['credit_limit'] != '') { |
|
1894 | - $action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '',true, false); |
|
1895 | - } |
|
1896 | - $this->session->set_userdata('reseller_list_search', $action); |
|
1897 | - } |
|
1898 | - if (@$ajax_search != 1) { |
|
1899 | - redirect(base_url() . 'accounts/reseller_list/'); |
|
1900 | - } |
|
1901 | - } |
|
1902 | - |
|
1903 | - function reseller_batch_update() { |
|
1904 | - $batch_update_arr = $this->input->post(); |
|
1905 | - $result = $this->accounts_model->reseller_rates_batch_update($batch_update_arr); |
|
1906 | - echo json_encode(array("SUCCESS" => "Reseller batch updated successfully!")); |
|
1907 | - exit; |
|
1908 | - } |
|
1909 | - |
|
1910 | - function admin_list_clearsearchfilter() { |
|
1911 | - $this->session->set_userdata('advance_search', 0); |
|
1912 | - $this->session->set_userdata('admin_list_search', ""); |
|
1913 | - } |
|
1914 | - |
|
1915 | - function admin_list_search() { |
|
1916 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1917 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1918 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1919 | - $action = $this->input->post(); |
|
1920 | - unset($action['action']); |
|
1921 | - unset($action['advance_search']); |
|
1922 | - $this->session->set_userdata('admin_list_search', $action); |
|
1923 | - } |
|
1924 | - if (@$ajax_search != 1) { |
|
1925 | - redirect(base_url() . 'accounts/admin_list/'); |
|
1926 | - } |
|
1927 | - } |
|
1928 | - |
|
1929 | - function reseller_list_clearsearchfilter() { |
|
1930 | - $this->session->set_userdata('advance_search', 0); |
|
1931 | - $this->session->set_userdata('reseller_list_search', ""); |
|
1932 | - } |
|
1933 | - |
|
1934 | - |
|
1935 | - function customer_delete($id) { |
|
1936 | - $this->common->customer_delete_dependencies($id); |
|
1937 | - $this->session->set_flashdata('astpp_notification', 'Customer removed successfully!'); |
|
1938 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1939 | - } |
|
1940 | - |
|
1941 | - function reseller_delete($id) { |
|
1942 | - $this->common->subreseller_list($id); |
|
1943 | - $this->session->set_flashdata('astpp_notification', 'Reseller removed successfully!'); |
|
1944 | - redirect(base_url() . 'accounts/reseller_list/'); |
|
1945 | - } |
|
1946 | - |
|
1947 | - function free_customer_did($accountid) { |
|
1948 | - $this->db->where(array("accountid" => $accountid)); |
|
1949 | - $this->db->update("dids", array('accountid' => "0")); |
|
1950 | - return true; |
|
1951 | - } |
|
1952 | - |
|
1953 | - function free_ani_map($accountid) { |
|
1954 | - $this->db->where(array("accountid" => $accountid)); |
|
1955 | - $this->db->delete('ani_map'); |
|
1956 | - return true; |
|
1957 | - } |
|
1958 | - |
|
1959 | - function free_reseller_did($ids) { |
|
1960 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1961 | - $reseller_id = $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
|
1962 | - $data = array('parent_id' => $reseller_id, 'accountid' => 0); |
|
1963 | - $where = "parent_id IN ($ids)"; |
|
1964 | - $this->db->where($where); |
|
1965 | - $this->db->update('dids', $data); |
|
1966 | - $where = "reseller_id IN ($ids)"; |
|
1967 | - $this->db->where($where); |
|
1968 | - $this->db->delete('reseller_pricing'); |
|
1969 | - return true; |
|
1970 | - } |
|
1971 | - |
|
1972 | - function provider_delete($id) { |
|
1973 | - $this->accounts_model->remove_customer($id); |
|
1974 | - $this->session->set_flashdata('astpp_notification', 'Provider removed successfully!'); |
|
1975 | - redirect(base_url() . 'accounts/customer_list/'); |
|
1976 | - } |
|
1977 | - |
|
1978 | - function admin_delete($id) { |
|
1979 | - $this->accounts_model->remove_customer($id); |
|
1980 | - $this->session->set_flashdata('astpp_notification', 'Admin removed successfully!'); |
|
1981 | - redirect(base_url() . 'accounts/admin_list/'); |
|
1982 | - } |
|
1983 | - |
|
1984 | - function subadmin_delete($id) { |
|
1985 | - $this->accounts_model->remove_customer($id); |
|
1986 | - $this->session->set_flashdata('astpp_notification', 'Sub admin removed successfully!'); |
|
1987 | - redirect(base_url() . 'accounts/admin_list/'); |
|
1988 | - } |
|
1854 | + * */ |
|
1855 | + $data['batch_update_flag'] = true; |
|
1856 | + /* * *************************************** */ |
|
1857 | + $this->session->set_userdata('advance_search', 0); |
|
1858 | + $data['grid_fields'] = $this->accounts_form->build_account_list_for_reseller(); |
|
1859 | + $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_reseller(); |
|
1860 | + $data['form_search'] = $this->form->build_serach_form($this->accounts_form->get_reseller_search_form()); |
|
1861 | + $data['form_batch_update'] = $this->form->build_batchupdate_form($this->accounts_form->reseller_batch_update_form()); |
|
1862 | + /* * ************************************************************************************************************ */ |
|
1863 | + $this->load->view('view_accounts_list', $data); |
|
1864 | + } |
|
1865 | + |
|
1866 | + /** |
|
1867 | + * -------Here we write code for controller accounts functions account_list------ |
|
1868 | + * Listing of Accounts table data through php function json_encode |
|
1869 | + */ |
|
1870 | + function reseller_list_json() { |
|
1871 | + $json_data = array(); |
|
1872 | + $count_all = $this->accounts_model->get_reseller_Account_list(false); |
|
1873 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1874 | + $json_data = $paging_data["json_paging"]; |
|
1875 | + |
|
1876 | + $query = $this->accounts_model->get_reseller_Account_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1877 | + $grid_fields = json_decode($this->accounts_form->build_account_list_for_reseller()); |
|
1878 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1879 | + |
|
1880 | + echo json_encode($json_data); |
|
1881 | + } |
|
1882 | + |
|
1883 | + function reseller_list_search() { |
|
1884 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1885 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1886 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1887 | + $action = $this->input->post(); |
|
1888 | + unset($action['action']); |
|
1889 | + unset($action['advance_search']); |
|
1890 | + if (isset($action['balance']['balance']) && $action['balance']['balance'] != '') { |
|
1891 | + $action['balance']['balance'] = $this->common_model->add_calculate_currency($action['balance']['balance'], "", '', true, false); |
|
1892 | + } |
|
1893 | + if (isset($action['credit_limit']['credit_limit']) && $action['credit_limit']['credit_limit'] != '') { |
|
1894 | + $action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '',true, false); |
|
1895 | + } |
|
1896 | + $this->session->set_userdata('reseller_list_search', $action); |
|
1897 | + } |
|
1898 | + if (@$ajax_search != 1) { |
|
1899 | + redirect(base_url() . 'accounts/reseller_list/'); |
|
1900 | + } |
|
1901 | + } |
|
1902 | + |
|
1903 | + function reseller_batch_update() { |
|
1904 | + $batch_update_arr = $this->input->post(); |
|
1905 | + $result = $this->accounts_model->reseller_rates_batch_update($batch_update_arr); |
|
1906 | + echo json_encode(array("SUCCESS" => "Reseller batch updated successfully!")); |
|
1907 | + exit; |
|
1908 | + } |
|
1909 | + |
|
1910 | + function admin_list_clearsearchfilter() { |
|
1911 | + $this->session->set_userdata('advance_search', 0); |
|
1912 | + $this->session->set_userdata('admin_list_search', ""); |
|
1913 | + } |
|
1914 | + |
|
1915 | + function admin_list_search() { |
|
1916 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1917 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1918 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1919 | + $action = $this->input->post(); |
|
1920 | + unset($action['action']); |
|
1921 | + unset($action['advance_search']); |
|
1922 | + $this->session->set_userdata('admin_list_search', $action); |
|
1923 | + } |
|
1924 | + if (@$ajax_search != 1) { |
|
1925 | + redirect(base_url() . 'accounts/admin_list/'); |
|
1926 | + } |
|
1927 | + } |
|
1928 | + |
|
1929 | + function reseller_list_clearsearchfilter() { |
|
1930 | + $this->session->set_userdata('advance_search', 0); |
|
1931 | + $this->session->set_userdata('reseller_list_search', ""); |
|
1932 | + } |
|
1933 | + |
|
1934 | + |
|
1935 | + function customer_delete($id) { |
|
1936 | + $this->common->customer_delete_dependencies($id); |
|
1937 | + $this->session->set_flashdata('astpp_notification', 'Customer removed successfully!'); |
|
1938 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1939 | + } |
|
1940 | + |
|
1941 | + function reseller_delete($id) { |
|
1942 | + $this->common->subreseller_list($id); |
|
1943 | + $this->session->set_flashdata('astpp_notification', 'Reseller removed successfully!'); |
|
1944 | + redirect(base_url() . 'accounts/reseller_list/'); |
|
1945 | + } |
|
1946 | + |
|
1947 | + function free_customer_did($accountid) { |
|
1948 | + $this->db->where(array("accountid" => $accountid)); |
|
1949 | + $this->db->update("dids", array('accountid' => "0")); |
|
1950 | + return true; |
|
1951 | + } |
|
1952 | + |
|
1953 | + function free_ani_map($accountid) { |
|
1954 | + $this->db->where(array("accountid" => $accountid)); |
|
1955 | + $this->db->delete('ani_map'); |
|
1956 | + return true; |
|
1957 | + } |
|
1958 | + |
|
1959 | + function free_reseller_did($ids) { |
|
1960 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1961 | + $reseller_id = $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
|
1962 | + $data = array('parent_id' => $reseller_id, 'accountid' => 0); |
|
1963 | + $where = "parent_id IN ($ids)"; |
|
1964 | + $this->db->where($where); |
|
1965 | + $this->db->update('dids', $data); |
|
1966 | + $where = "reseller_id IN ($ids)"; |
|
1967 | + $this->db->where($where); |
|
1968 | + $this->db->delete('reseller_pricing'); |
|
1969 | + return true; |
|
1970 | + } |
|
1971 | + |
|
1972 | + function provider_delete($id) { |
|
1973 | + $this->accounts_model->remove_customer($id); |
|
1974 | + $this->session->set_flashdata('astpp_notification', 'Provider removed successfully!'); |
|
1975 | + redirect(base_url() . 'accounts/customer_list/'); |
|
1976 | + } |
|
1977 | + |
|
1978 | + function admin_delete($id) { |
|
1979 | + $this->accounts_model->remove_customer($id); |
|
1980 | + $this->session->set_flashdata('astpp_notification', 'Admin removed successfully!'); |
|
1981 | + redirect(base_url() . 'accounts/admin_list/'); |
|
1982 | + } |
|
1983 | + |
|
1984 | + function subadmin_delete($id) { |
|
1985 | + $this->accounts_model->remove_customer($id); |
|
1986 | + $this->session->set_flashdata('astpp_notification', 'Sub admin removed successfully!'); |
|
1987 | + redirect(base_url() . 'accounts/admin_list/'); |
|
1988 | + } |
|
1989 | 1989 | |
1990 | - function reseller_details_json($module, $accountid) { |
|
1991 | - |
|
1992 | - if ($module == "did") { |
|
1993 | - $this->load->module('did/did'); |
|
1994 | - $this->did->reseller_did($accountid, "reseller"); |
|
1995 | - } |
|
1996 | - if ($module == "invoices") { |
|
1997 | - $this->load->module('invoices/invoices'); |
|
1998 | - $this->invoices->customer_invoices($accountid,"reseller"); |
|
1999 | - } |
|
2000 | - if ($module == "charges") { |
|
2001 | - $this->load->module('charges/charges'); |
|
2002 | - $this->charges->customer_charge_list($accountid, "reseller"); |
|
2003 | - } |
|
2004 | - if($module =='packages'){ |
|
1990 | + function reseller_details_json($module, $accountid) { |
|
1991 | + |
|
1992 | + if ($module == "did") { |
|
1993 | + $this->load->module('did/did'); |
|
1994 | + $this->did->reseller_did($accountid, "reseller"); |
|
1995 | + } |
|
1996 | + if ($module == "invoices") { |
|
1997 | + $this->load->module('invoices/invoices'); |
|
1998 | + $this->invoices->customer_invoices($accountid,"reseller"); |
|
1999 | + } |
|
2000 | + if ($module == "charges") { |
|
2001 | + $this->load->module('charges/charges'); |
|
2002 | + $this->charges->customer_charge_list($accountid, "reseller"); |
|
2003 | + } |
|
2004 | + if($module =='packages'){ |
|
2005 | 2005 | $this->load->module('package/package'); |
2006 | 2006 | $this->package->package_list_reseller($accountid, "reseller"); |
2007 | - } |
|
2008 | - } |
|
2009 | - |
|
2010 | - function provider_details_json($module, $accountid) { |
|
2011 | - if ($module == "invoices") { |
|
2012 | - $this->load->module('invoices/invoices'); |
|
2013 | - $this->invoices->customer_invoices($accountid); |
|
2014 | - } |
|
2015 | - } |
|
2016 | - |
|
2017 | - function customer_add_postcharges($accounttype, $accountid) { |
|
2018 | - $charge = $this->input->post("amount", true); |
|
2019 | - if ($charge != "") { |
|
2020 | - $charge = $this->common_model->add_calculate_currency($charge, "", '', false, false); |
|
2021 | - $date = date('Y-m-d H:i:s'); |
|
2022 | - $insert_arr = array("accountid" => $accountid, "description" => $this->input->post("desc", true), |
|
2023 | - "created_date" => $date, "debit" => $charge, "charge_type" => "post_charge"); |
|
2024 | - $this->db->insert("invoice_item", $insert_arr); |
|
2025 | - |
|
2026 | - $this->accounts_model->update_balance($charge, $accountid, "debit"); |
|
2027 | - redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages"); |
|
2028 | - } else { |
|
2029 | - redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages"); |
|
2030 | - } |
|
2031 | - } |
|
2032 | - |
|
2033 | - function reseller_did_action($action, $accountid, $accounttype, $did_id = "") { |
|
2034 | - if ($action == "add") { |
|
2035 | - $did_id = $this->input->post("free_did_list", true); |
|
2036 | - if ($did_id != "") { |
|
2037 | - $account_query = $this->db_model->getSelect("*", "accounts", array("id" => $accountid)); |
|
2038 | - |
|
2039 | - $account_arr = $account_query->result_array(); |
|
2040 | - $idofaccount = $accountid; |
|
2041 | - $this->db_model->update("dids", array("parent_id" => $accountid, 'assign_date' => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
2042 | - $accountid = $idofaccount; |
|
2043 | - $this->load->module('did/did'); |
|
2044 | - $this->did->did_model->add_reseller_pricing($accountid, $did_id); |
|
2045 | - |
|
2046 | - $this->session->set_flashdata('astpp_errormsg', 'DID added successfully.'); |
|
2047 | - redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did"); |
|
2048 | - } else { |
|
2049 | - redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did"); |
|
2050 | - } |
|
2051 | - } |
|
2052 | - if ($action == "delete") { |
|
2053 | - $this->db->where('id', $did_id); |
|
2054 | - $this->db->select('note'); |
|
2055 | - $pricing_res = $this->db->get('reseller_pricing'); |
|
2056 | - if ($pricing_res->num_rows() > 0) { |
|
2057 | - $pricing_res = $pricing_res->result_array(); |
|
2058 | - $did_number = $pricing_res[0]['note']; |
|
2059 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
2060 | - if ($this->session->userdata['userlevel_logintype'] == -1) { |
|
2061 | - $parent_id = 0; |
|
2062 | - } else { |
|
2063 | - $parent_id = $this->session->userdata['accountinfo']['id']; |
|
2064 | - } |
|
2065 | - |
|
2066 | - $reseller_ids = $this->common->subreseller_list($accountinfo['id']); |
|
2067 | - $pricing_where = "parent_id = $parent_id AND note = $did_number"; |
|
2068 | - $this->db->where($pricing_where); |
|
2069 | - $this->db->delete('reseller_pricing'); |
|
2070 | - $dids_where = "parent_id IN ($reseller_ids) AND number = $did_number"; |
|
2071 | - $this->db->where($dids_where); |
|
2072 | - $data = array('accountid' => 0, 'parent_id' => $accountinfo['id']); |
|
2073 | - $this->db->update('dids', $data); |
|
2074 | - $this->session->set_flashdata('astpp_notification', 'DID removed successfully.'); |
|
2075 | - } else { |
|
2076 | - $this->session->set_flashdata('astpp_notification', 'DID already removed before.'); |
|
2077 | - } |
|
2078 | - redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did"); |
|
2079 | - } |
|
2080 | - } |
|
2081 | - |
|
2082 | - function customer_selected_delete() { |
|
2083 | - $ids = $this->input->post("selected_ids", true); |
|
2084 | - $customer_ids=explode(",",$ids); |
|
2085 | - foreach($customer_ids as $customer_id){ |
|
2007 | + } |
|
2008 | + } |
|
2009 | + |
|
2010 | + function provider_details_json($module, $accountid) { |
|
2011 | + if ($module == "invoices") { |
|
2012 | + $this->load->module('invoices/invoices'); |
|
2013 | + $this->invoices->customer_invoices($accountid); |
|
2014 | + } |
|
2015 | + } |
|
2016 | + |
|
2017 | + function customer_add_postcharges($accounttype, $accountid) { |
|
2018 | + $charge = $this->input->post("amount", true); |
|
2019 | + if ($charge != "") { |
|
2020 | + $charge = $this->common_model->add_calculate_currency($charge, "", '', false, false); |
|
2021 | + $date = date('Y-m-d H:i:s'); |
|
2022 | + $insert_arr = array("accountid" => $accountid, "description" => $this->input->post("desc", true), |
|
2023 | + "created_date" => $date, "debit" => $charge, "charge_type" => "post_charge"); |
|
2024 | + $this->db->insert("invoice_item", $insert_arr); |
|
2025 | + |
|
2026 | + $this->accounts_model->update_balance($charge, $accountid, "debit"); |
|
2027 | + redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages"); |
|
2028 | + } else { |
|
2029 | + redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages"); |
|
2030 | + } |
|
2031 | + } |
|
2032 | + |
|
2033 | + function reseller_did_action($action, $accountid, $accounttype, $did_id = "") { |
|
2034 | + if ($action == "add") { |
|
2035 | + $did_id = $this->input->post("free_did_list", true); |
|
2036 | + if ($did_id != "") { |
|
2037 | + $account_query = $this->db_model->getSelect("*", "accounts", array("id" => $accountid)); |
|
2038 | + |
|
2039 | + $account_arr = $account_query->result_array(); |
|
2040 | + $idofaccount = $accountid; |
|
2041 | + $this->db_model->update("dids", array("parent_id" => $accountid, 'assign_date' => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
2042 | + $accountid = $idofaccount; |
|
2043 | + $this->load->module('did/did'); |
|
2044 | + $this->did->did_model->add_reseller_pricing($accountid, $did_id); |
|
2045 | + |
|
2046 | + $this->session->set_flashdata('astpp_errormsg', 'DID added successfully.'); |
|
2047 | + redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did"); |
|
2048 | + } else { |
|
2049 | + redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did"); |
|
2050 | + } |
|
2051 | + } |
|
2052 | + if ($action == "delete") { |
|
2053 | + $this->db->where('id', $did_id); |
|
2054 | + $this->db->select('note'); |
|
2055 | + $pricing_res = $this->db->get('reseller_pricing'); |
|
2056 | + if ($pricing_res->num_rows() > 0) { |
|
2057 | + $pricing_res = $pricing_res->result_array(); |
|
2058 | + $did_number = $pricing_res[0]['note']; |
|
2059 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
2060 | + if ($this->session->userdata['userlevel_logintype'] == -1) { |
|
2061 | + $parent_id = 0; |
|
2062 | + } else { |
|
2063 | + $parent_id = $this->session->userdata['accountinfo']['id']; |
|
2064 | + } |
|
2065 | + |
|
2066 | + $reseller_ids = $this->common->subreseller_list($accountinfo['id']); |
|
2067 | + $pricing_where = "parent_id = $parent_id AND note = $did_number"; |
|
2068 | + $this->db->where($pricing_where); |
|
2069 | + $this->db->delete('reseller_pricing'); |
|
2070 | + $dids_where = "parent_id IN ($reseller_ids) AND number = $did_number"; |
|
2071 | + $this->db->where($dids_where); |
|
2072 | + $data = array('accountid' => 0, 'parent_id' => $accountinfo['id']); |
|
2073 | + $this->db->update('dids', $data); |
|
2074 | + $this->session->set_flashdata('astpp_notification', 'DID removed successfully.'); |
|
2075 | + } else { |
|
2076 | + $this->session->set_flashdata('astpp_notification', 'DID already removed before.'); |
|
2077 | + } |
|
2078 | + redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did"); |
|
2079 | + } |
|
2080 | + } |
|
2081 | + |
|
2082 | + function customer_selected_delete() { |
|
2083 | + $ids = $this->input->post("selected_ids", true); |
|
2084 | + $customer_ids=explode(",",$ids); |
|
2085 | + foreach($customer_ids as $customer_id){ |
|
2086 | 2086 | $customer_id = str_replace("'", "", $customer_id); |
2087 | - $this->common->customer_delete_dependencies($customer_id); |
|
2088 | - } |
|
2089 | - echo TRUE; |
|
2090 | - } |
|
2091 | - |
|
2092 | - function reseller_selected_delete() { |
|
2093 | - $ids = $this->input->post("selected_ids", true); |
|
2094 | - $id_arr = explode(',', $ids); |
|
2095 | - foreach ($id_arr as $data) { |
|
2087 | + $this->common->customer_delete_dependencies($customer_id); |
|
2088 | + } |
|
2089 | + echo TRUE; |
|
2090 | + } |
|
2091 | + |
|
2092 | + function reseller_selected_delete() { |
|
2093 | + $ids = $this->input->post("selected_ids", true); |
|
2094 | + $id_arr = explode(',', $ids); |
|
2095 | + foreach ($id_arr as $data) { |
|
2096 | 2096 | $data = str_replace("'", "", $data); |
2097 | 2097 | $this->common->subreseller_list($data); |
2098 | - } |
|
2099 | - echo TRUE; |
|
2100 | - } |
|
2101 | - |
|
2102 | - function callshop_selected_delete() { |
|
2103 | - echo $this->delete_multiple(); |
|
2104 | - } |
|
2105 | - |
|
2106 | - function provider_selected_delete() { |
|
2107 | - echo $this->delete_multiple(); |
|
2108 | - } |
|
2109 | - |
|
2110 | - function subadmin_selected_delete() { |
|
2111 | - echo $this->delete_multiple(); |
|
2112 | - } |
|
2113 | - |
|
2114 | - function admin_selected_delete() { |
|
2115 | - echo $this->delete_multiple(); |
|
2116 | - } |
|
2117 | - |
|
2118 | - function delete_multiple() { |
|
2119 | - $ids = $this->input->post("selected_ids", true); |
|
2120 | - $where = "id IN ($ids)"; |
|
2121 | - $data = array('deleted' => 1); |
|
2122 | - $this->db->where($where); |
|
2123 | - $this->db->update("accounts", $data); |
|
2124 | - echo TRUE; |
|
2125 | - } |
|
2126 | - |
|
2127 | - function customer_account_taxes($action = false, $id = false) { |
|
2128 | - $data['username'] = $this->session->userdata('user_name'); |
|
2129 | - $data['page_title'] = 'Account Taxes'; |
|
2130 | - |
|
2131 | - if ($action == false) |
|
2132 | - $action = "list"; |
|
2133 | - |
|
2134 | - if ($action == 'list') { |
|
2135 | - $this->load->view('view_account_taxes_list', $data); |
|
2136 | - } elseif ($action == 'add') { |
|
2137 | - |
|
2138 | - if (($this->input->post())) { |
|
2139 | - $post_array = $this->input->post(); |
|
2140 | - $query = $this->accounts_model->remove_all_account_tax($post_array['account_id']); |
|
2141 | - |
|
2142 | - foreach ($post_array as $key => $value) { |
|
2143 | - $id = explode("_", $key); |
|
2144 | - if ($id[0] == 'tax') { |
|
2145 | - $data = array( |
|
2146 | - 'accountid' => $post_array['account_id'], |
|
2147 | - 'taxes_id' => $post_array[$key], |
|
2148 | - ); |
|
2149 | - $this->accounts_model->add_account_tax($data); |
|
2150 | - } |
|
2151 | - } |
|
2152 | - $this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!'); |
|
2153 | - redirect(base_url() . 'accounts/customer_list/'); |
|
2154 | - } |
|
2155 | - $data['id'] = array(); |
|
2156 | - $data['taxesList'] = $this->common_model->get_list_taxes(); |
|
2157 | - $this->load->view('view_accounting_taxes_add', $data); |
|
2158 | - } elseif ($action == 'edit') { |
|
2159 | - $taxes_id = $this->accounts_model->get_accounttax_by_id($id); |
|
2160 | - $account_num = $this->accounts_model->get_account_number($id); |
|
2161 | - $data['accountnum'] = $account_num['number']; |
|
2162 | - $data['account_id'] = $id; |
|
2163 | - for ($i = 0; $i < count($taxes_id); $i++) { |
|
2164 | - $tax_ids[] = $taxes_id[$i]['taxes_id']; |
|
2165 | - } |
|
2166 | - $data['tax_ids'] = $tax_ids; |
|
2167 | - |
|
2168 | - $data['tax_id'] = $taxes_id; |
|
2169 | - |
|
2170 | - if (($this->input->post())) { |
|
2171 | - $post_array = $this->input->post(); |
|
2172 | - $accountinfo = $this->accounts_model->get_account_by_number($post_array['account_id']); |
|
2173 | - $query = $this->accounts_model->remove_all_account_tax($post_array['account_id']); |
|
2174 | - foreach ($post_array as $key => $value) { |
|
2175 | - $id = explode("_", $key); |
|
2176 | - if ($id[0] == 'tax') { |
|
2177 | - $data = array( |
|
2178 | - 'accountid' => $post_array['account_id'], |
|
2179 | - 'taxes_id' => $post_array[$key], |
|
2180 | - ); |
|
2181 | - $this->accounts_model->add_account_tax($data); |
|
2182 | - } |
|
2183 | - } |
|
2184 | - if ($accountinfo['type'] == '0') { |
|
2185 | - $link = base_url() . '/accounts/customer_list/'; |
|
2186 | - } else { |
|
2187 | - $link = base_url() . '/accounts/reseller_list/'; |
|
2188 | - } |
|
2189 | - $this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!'); |
|
2190 | - redirect($link); |
|
2191 | - } |
|
2192 | - $data['taxesList'] = $this->common_model->get_list_taxes(); |
|
2193 | - $this->load->view('view_accounting_taxes_add', $data); |
|
2194 | - } elseif ($action == 'delete') { |
|
2195 | - $this->accounting_model->remove_account_tax($id); |
|
2196 | - $this->session->set_flashdata('astpp_notification', 'Account tax removed successfully!'); |
|
2197 | - redirect(base_url() . 'accounting/account_taxes/'); |
|
2198 | - } |
|
2199 | - } |
|
2200 | - |
|
2201 | - /** |
|
2202 | - * -------Here we write code for controller accounting functions vallid_account_tax------ |
|
2203 | - * here this function called by ajax form and vallidate the account number |
|
2204 | - * @$_POST['username']: Account Number |
|
2205 | - */ |
|
2206 | - function valid_account_tax() { |
|
2207 | - $tax_id = ''; |
|
2208 | - if (!empty($_POST['username'])) { |
|
2209 | - |
|
2210 | - $account_num = mysql_real_escape_string($_POST['username']); |
|
2211 | - $row = $this->accounts_model->check_account_num($account_num); |
|
2212 | - if (isset($row['accountid']) && $row['accountid'] != '') { |
|
2213 | - $taxes_id = $this->accounts_model->get_accounttax_by_id($row['accountid']); |
|
2214 | - if ($taxes_id) { |
|
2215 | - foreach ($taxes_id as $id) { |
|
2216 | - $tax_id.=$id['taxes_id'] . ","; |
|
2217 | - } |
|
2218 | - |
|
2219 | - $tax_id = rtrim($tax_id, ","); |
|
2220 | - echo $row['accountid'] . ',' . $tax_id; |
|
2221 | - } else { |
|
2222 | - echo $row['accountid']; |
|
2223 | - } |
|
2224 | - } |
|
2225 | - } |
|
2226 | - } |
|
2227 | - |
|
2228 | - function reseller_edit_account() { |
|
2229 | - $account_data = $this->session->userdata("accountinfo"); |
|
2230 | - |
|
2231 | - $add_array = $this->input->post(); |
|
2232 | - $data['form'] = $this->form->build_form($this->accounts_form->get_reseller_own_form_fields(), $add_array); |
|
2233 | - if ($add_array['id'] != '') { |
|
2234 | - $data['page_title'] = 'Edit Reseller'; |
|
2235 | - if ($this->form_validation->run() == FALSE) { |
|
2236 | - $data['validation_errors'] = validation_errors(); |
|
2237 | - } else { |
|
2238 | - $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
2239 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
2240 | - if ($add_array['id'] == $accountinfo['id']) { |
|
2241 | - $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
2242 | - $result = $result->result_array(); |
|
2243 | - $this->session->set_userdata('accountinfo', $result[0]); |
|
2244 | - } |
|
2245 | - $this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!'); |
|
2246 | - redirect(base_url() . '/dashboard/'); |
|
2247 | - } |
|
2248 | - $this->load->view('view_reseller_edit_details_own', $data); |
|
2249 | - } else { |
|
2250 | - $data['page_title'] = 'Edit Reseller'; |
|
2251 | - $where = array('id' => $account_data["id"]); |
|
2252 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
2253 | - $data["account_data"] = $account->result_array(); |
|
2254 | - foreach ($account->result_array() as $key => $value) { |
|
2255 | - $editable_data = $value; |
|
2256 | - } |
|
2257 | - $data['form'] = $this->form->build_form($this->accounts_form->get_reseller_own_form_fields(), $editable_data); |
|
2258 | - $this->load->view('view_reseller_edit_details_own', $data); |
|
2259 | - } |
|
2260 | - } |
|
2261 | - /** |
|
2262 | - * -------Here we write code for controller accounts functions add_callerid------ |
|
2263 | - * Add caller ids against account no |
|
2264 | - * @account_number: Account No |
|
2265 | - */ |
|
2266 | - function customer_animap_list($id = '') { |
|
2267 | - $data['animap_id'] = $id; |
|
2268 | - $data['username'] = $this->session->userdata('user_name'); |
|
2269 | - $data['page_title'] = "Caller Id List"; |
|
2270 | - $this->session->set_userdata('animap_search', 0); |
|
2271 | - $data['grid_fields'] = $this->accounts_form->build_animap_list(); |
|
2272 | - $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_destination(); |
|
2273 | - $this->load->view('view_ani_map', $data); |
|
2274 | - } |
|
2275 | - |
|
2276 | - function customer_animap_list_json($id = '') { |
|
2277 | - $json_data = array(); |
|
2278 | - $count_all = $this->accounts_model->get_animap(false, '', '', $id); |
|
2279 | - $data['callingcard_id'] = $id; |
|
2280 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
2281 | - $json_data = $paging_data["json_paging"]; |
|
2282 | - $query = $this->accounts_model->get_animap(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $id); |
|
2283 | - $grid_fields = json_decode($this->accounts_form->build_animap_list()); |
|
2284 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
2285 | - echo json_encode($json_data); |
|
2286 | - exit; |
|
2287 | - } |
|
2288 | - |
|
2289 | - function customer_animap_list_action($id = '') { |
|
2290 | - $add_array = $this->input->post(); |
|
2291 | - $add_array['id'] = trim($add_array['id']); |
|
2292 | - $add_array['number'] = trim($add_array['number']); |
|
2293 | - if (isset($add_array['id']) && $add_array['id'] != '') { |
|
2294 | - $add_array['id'] = trim($add_array['id']); |
|
2295 | - $id = $add_array['id']; |
|
2296 | - } |
|
2297 | - $where = array("number" => $add_array['number']); |
|
2298 | - $pro = $this->accounts_model->animap_authentication($where, $id); |
|
2299 | - if ($pro > 0) { |
|
2300 | - echo "2"; |
|
2301 | - exit; |
|
2302 | - } |
|
2303 | - if (isset($add_array['number']) && !empty($add_array['number'])) { |
|
2304 | - if (isset($add_array['id']) && $add_array['id'] != '') { |
|
2305 | - unset($add_array['animap_id']); |
|
2306 | - $response = $this->accounts_model->edit_animap($add_array, $add_array['id']); |
|
2307 | - echo "1"; |
|
2308 | - exit; |
|
2309 | - } else { |
|
2310 | - $add_array['context'] = "default"; |
|
2311 | - unset($add_array['animap_id']); |
|
2312 | - $add_array['accountid'] = $id; |
|
2313 | - $response = $this->accounts_model->add_animap($add_array); |
|
2314 | - echo "0"; |
|
2315 | - exit; |
|
2316 | - } |
|
2317 | - } else { |
|
2318 | - echo "3"; |
|
2319 | - exit; |
|
2320 | - } |
|
2321 | - } |
|
2322 | - |
|
2323 | - function customer_animap_list_remove($id) { |
|
2324 | - $this->accounts_model->remove_ani_map($id); |
|
2325 | - echo "1"; |
|
2326 | - exit; |
|
2327 | - } |
|
2328 | - |
|
2329 | - function customer_animap_list_edit($id) { |
|
2330 | - $where = array('id' => $id); |
|
2331 | - $account = $this->db_model->getSelect("*", "ani_map", $where); |
|
2332 | - foreach ($account->result_array() as $key => $value) { |
|
2333 | - $edit_data = $value; |
|
2334 | - } |
|
2335 | - $value_edit = ''; |
|
2336 | - foreach ($edit_data as $key => $value) { |
|
2337 | - $value_edit.=$value . ","; |
|
2338 | - } |
|
2339 | - echo rtrim($value_edit, ','); |
|
2340 | - exit; |
|
2341 | - } |
|
2342 | - |
|
2343 | - function provider_edit_account() { |
|
2344 | - $this->customer_edit_account(); |
|
2345 | - } |
|
2346 | - |
|
2347 | - function customer_show_password($id) { |
|
2348 | - $account = $this->db_model->getSelect("password", "accounts", array('id' => $id)); |
|
2349 | - $account_data = $account->result_array(); |
|
2350 | - $password = $this->common->decode($account_data[0]['password']); |
|
2351 | - echo $password; |
|
2352 | - } |
|
2353 | - |
|
2354 | - function reseller_export_cdr_xls() { |
|
2098 | + } |
|
2099 | + echo TRUE; |
|
2100 | + } |
|
2101 | + |
|
2102 | + function callshop_selected_delete() { |
|
2103 | + echo $this->delete_multiple(); |
|
2104 | + } |
|
2105 | + |
|
2106 | + function provider_selected_delete() { |
|
2107 | + echo $this->delete_multiple(); |
|
2108 | + } |
|
2109 | + |
|
2110 | + function subadmin_selected_delete() { |
|
2111 | + echo $this->delete_multiple(); |
|
2112 | + } |
|
2113 | + |
|
2114 | + function admin_selected_delete() { |
|
2115 | + echo $this->delete_multiple(); |
|
2116 | + } |
|
2117 | + |
|
2118 | + function delete_multiple() { |
|
2119 | + $ids = $this->input->post("selected_ids", true); |
|
2120 | + $where = "id IN ($ids)"; |
|
2121 | + $data = array('deleted' => 1); |
|
2122 | + $this->db->where($where); |
|
2123 | + $this->db->update("accounts", $data); |
|
2124 | + echo TRUE; |
|
2125 | + } |
|
2126 | + |
|
2127 | + function customer_account_taxes($action = false, $id = false) { |
|
2128 | + $data['username'] = $this->session->userdata('user_name'); |
|
2129 | + $data['page_title'] = 'Account Taxes'; |
|
2130 | + |
|
2131 | + if ($action == false) |
|
2132 | + $action = "list"; |
|
2133 | + |
|
2134 | + if ($action == 'list') { |
|
2135 | + $this->load->view('view_account_taxes_list', $data); |
|
2136 | + } elseif ($action == 'add') { |
|
2137 | + |
|
2138 | + if (($this->input->post())) { |
|
2139 | + $post_array = $this->input->post(); |
|
2140 | + $query = $this->accounts_model->remove_all_account_tax($post_array['account_id']); |
|
2141 | + |
|
2142 | + foreach ($post_array as $key => $value) { |
|
2143 | + $id = explode("_", $key); |
|
2144 | + if ($id[0] == 'tax') { |
|
2145 | + $data = array( |
|
2146 | + 'accountid' => $post_array['account_id'], |
|
2147 | + 'taxes_id' => $post_array[$key], |
|
2148 | + ); |
|
2149 | + $this->accounts_model->add_account_tax($data); |
|
2150 | + } |
|
2151 | + } |
|
2152 | + $this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!'); |
|
2153 | + redirect(base_url() . 'accounts/customer_list/'); |
|
2154 | + } |
|
2155 | + $data['id'] = array(); |
|
2156 | + $data['taxesList'] = $this->common_model->get_list_taxes(); |
|
2157 | + $this->load->view('view_accounting_taxes_add', $data); |
|
2158 | + } elseif ($action == 'edit') { |
|
2159 | + $taxes_id = $this->accounts_model->get_accounttax_by_id($id); |
|
2160 | + $account_num = $this->accounts_model->get_account_number($id); |
|
2161 | + $data['accountnum'] = $account_num['number']; |
|
2162 | + $data['account_id'] = $id; |
|
2163 | + for ($i = 0; $i < count($taxes_id); $i++) { |
|
2164 | + $tax_ids[] = $taxes_id[$i]['taxes_id']; |
|
2165 | + } |
|
2166 | + $data['tax_ids'] = $tax_ids; |
|
2167 | + |
|
2168 | + $data['tax_id'] = $taxes_id; |
|
2169 | + |
|
2170 | + if (($this->input->post())) { |
|
2171 | + $post_array = $this->input->post(); |
|
2172 | + $accountinfo = $this->accounts_model->get_account_by_number($post_array['account_id']); |
|
2173 | + $query = $this->accounts_model->remove_all_account_tax($post_array['account_id']); |
|
2174 | + foreach ($post_array as $key => $value) { |
|
2175 | + $id = explode("_", $key); |
|
2176 | + if ($id[0] == 'tax') { |
|
2177 | + $data = array( |
|
2178 | + 'accountid' => $post_array['account_id'], |
|
2179 | + 'taxes_id' => $post_array[$key], |
|
2180 | + ); |
|
2181 | + $this->accounts_model->add_account_tax($data); |
|
2182 | + } |
|
2183 | + } |
|
2184 | + if ($accountinfo['type'] == '0') { |
|
2185 | + $link = base_url() . '/accounts/customer_list/'; |
|
2186 | + } else { |
|
2187 | + $link = base_url() . '/accounts/reseller_list/'; |
|
2188 | + } |
|
2189 | + $this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!'); |
|
2190 | + redirect($link); |
|
2191 | + } |
|
2192 | + $data['taxesList'] = $this->common_model->get_list_taxes(); |
|
2193 | + $this->load->view('view_accounting_taxes_add', $data); |
|
2194 | + } elseif ($action == 'delete') { |
|
2195 | + $this->accounting_model->remove_account_tax($id); |
|
2196 | + $this->session->set_flashdata('astpp_notification', 'Account tax removed successfully!'); |
|
2197 | + redirect(base_url() . 'accounting/account_taxes/'); |
|
2198 | + } |
|
2199 | + } |
|
2200 | + |
|
2201 | + /** |
|
2202 | + * -------Here we write code for controller accounting functions vallid_account_tax------ |
|
2203 | + * here this function called by ajax form and vallidate the account number |
|
2204 | + * @$_POST['username']: Account Number |
|
2205 | + */ |
|
2206 | + function valid_account_tax() { |
|
2207 | + $tax_id = ''; |
|
2208 | + if (!empty($_POST['username'])) { |
|
2209 | + |
|
2210 | + $account_num = mysql_real_escape_string($_POST['username']); |
|
2211 | + $row = $this->accounts_model->check_account_num($account_num); |
|
2212 | + if (isset($row['accountid']) && $row['accountid'] != '') { |
|
2213 | + $taxes_id = $this->accounts_model->get_accounttax_by_id($row['accountid']); |
|
2214 | + if ($taxes_id) { |
|
2215 | + foreach ($taxes_id as $id) { |
|
2216 | + $tax_id.=$id['taxes_id'] . ","; |
|
2217 | + } |
|
2218 | + |
|
2219 | + $tax_id = rtrim($tax_id, ","); |
|
2220 | + echo $row['accountid'] . ',' . $tax_id; |
|
2221 | + } else { |
|
2222 | + echo $row['accountid']; |
|
2223 | + } |
|
2224 | + } |
|
2225 | + } |
|
2226 | + } |
|
2227 | + |
|
2228 | + function reseller_edit_account() { |
|
2229 | + $account_data = $this->session->userdata("accountinfo"); |
|
2230 | + |
|
2231 | + $add_array = $this->input->post(); |
|
2232 | + $data['form'] = $this->form->build_form($this->accounts_form->get_reseller_own_form_fields(), $add_array); |
|
2233 | + if ($add_array['id'] != '') { |
|
2234 | + $data['page_title'] = 'Edit Reseller'; |
|
2235 | + if ($this->form_validation->run() == FALSE) { |
|
2236 | + $data['validation_errors'] = validation_errors(); |
|
2237 | + } else { |
|
2238 | + $this->accounts_model->edit_account($add_array, $add_array['id']); |
|
2239 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
2240 | + if ($add_array['id'] == $accountinfo['id']) { |
|
2241 | + $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
2242 | + $result = $result->result_array(); |
|
2243 | + $this->session->set_userdata('accountinfo', $result[0]); |
|
2244 | + } |
|
2245 | + $this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!'); |
|
2246 | + redirect(base_url() . '/dashboard/'); |
|
2247 | + } |
|
2248 | + $this->load->view('view_reseller_edit_details_own', $data); |
|
2249 | + } else { |
|
2250 | + $data['page_title'] = 'Edit Reseller'; |
|
2251 | + $where = array('id' => $account_data["id"]); |
|
2252 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
2253 | + $data["account_data"] = $account->result_array(); |
|
2254 | + foreach ($account->result_array() as $key => $value) { |
|
2255 | + $editable_data = $value; |
|
2256 | + } |
|
2257 | + $data['form'] = $this->form->build_form($this->accounts_form->get_reseller_own_form_fields(), $editable_data); |
|
2258 | + $this->load->view('view_reseller_edit_details_own', $data); |
|
2259 | + } |
|
2260 | + } |
|
2261 | + /** |
|
2262 | + * -------Here we write code for controller accounts functions add_callerid------ |
|
2263 | + * Add caller ids against account no |
|
2264 | + * @account_number: Account No |
|
2265 | + */ |
|
2266 | + function customer_animap_list($id = '') { |
|
2267 | + $data['animap_id'] = $id; |
|
2268 | + $data['username'] = $this->session->userdata('user_name'); |
|
2269 | + $data['page_title'] = "Caller Id List"; |
|
2270 | + $this->session->set_userdata('animap_search', 0); |
|
2271 | + $data['grid_fields'] = $this->accounts_form->build_animap_list(); |
|
2272 | + $data["grid_buttons"] = $this->accounts_form->build_grid_buttons_destination(); |
|
2273 | + $this->load->view('view_ani_map', $data); |
|
2274 | + } |
|
2275 | + |
|
2276 | + function customer_animap_list_json($id = '') { |
|
2277 | + $json_data = array(); |
|
2278 | + $count_all = $this->accounts_model->get_animap(false, '', '', $id); |
|
2279 | + $data['callingcard_id'] = $id; |
|
2280 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
2281 | + $json_data = $paging_data["json_paging"]; |
|
2282 | + $query = $this->accounts_model->get_animap(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $id); |
|
2283 | + $grid_fields = json_decode($this->accounts_form->build_animap_list()); |
|
2284 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
2285 | + echo json_encode($json_data); |
|
2286 | + exit; |
|
2287 | + } |
|
2288 | + |
|
2289 | + function customer_animap_list_action($id = '') { |
|
2290 | + $add_array = $this->input->post(); |
|
2291 | + $add_array['id'] = trim($add_array['id']); |
|
2292 | + $add_array['number'] = trim($add_array['number']); |
|
2293 | + if (isset($add_array['id']) && $add_array['id'] != '') { |
|
2294 | + $add_array['id'] = trim($add_array['id']); |
|
2295 | + $id = $add_array['id']; |
|
2296 | + } |
|
2297 | + $where = array("number" => $add_array['number']); |
|
2298 | + $pro = $this->accounts_model->animap_authentication($where, $id); |
|
2299 | + if ($pro > 0) { |
|
2300 | + echo "2"; |
|
2301 | + exit; |
|
2302 | + } |
|
2303 | + if (isset($add_array['number']) && !empty($add_array['number'])) { |
|
2304 | + if (isset($add_array['id']) && $add_array['id'] != '') { |
|
2305 | + unset($add_array['animap_id']); |
|
2306 | + $response = $this->accounts_model->edit_animap($add_array, $add_array['id']); |
|
2307 | + echo "1"; |
|
2308 | + exit; |
|
2309 | + } else { |
|
2310 | + $add_array['context'] = "default"; |
|
2311 | + unset($add_array['animap_id']); |
|
2312 | + $add_array['accountid'] = $id; |
|
2313 | + $response = $this->accounts_model->add_animap($add_array); |
|
2314 | + echo "0"; |
|
2315 | + exit; |
|
2316 | + } |
|
2317 | + } else { |
|
2318 | + echo "3"; |
|
2319 | + exit; |
|
2320 | + } |
|
2321 | + } |
|
2322 | + |
|
2323 | + function customer_animap_list_remove($id) { |
|
2324 | + $this->accounts_model->remove_ani_map($id); |
|
2325 | + echo "1"; |
|
2326 | + exit; |
|
2327 | + } |
|
2328 | + |
|
2329 | + function customer_animap_list_edit($id) { |
|
2330 | + $where = array('id' => $id); |
|
2331 | + $account = $this->db_model->getSelect("*", "ani_map", $where); |
|
2332 | + foreach ($account->result_array() as $key => $value) { |
|
2333 | + $edit_data = $value; |
|
2334 | + } |
|
2335 | + $value_edit = ''; |
|
2336 | + foreach ($edit_data as $key => $value) { |
|
2337 | + $value_edit.=$value . ","; |
|
2338 | + } |
|
2339 | + echo rtrim($value_edit, ','); |
|
2340 | + exit; |
|
2341 | + } |
|
2342 | + |
|
2343 | + function provider_edit_account() { |
|
2344 | + $this->customer_edit_account(); |
|
2345 | + } |
|
2346 | + |
|
2347 | + function customer_show_password($id) { |
|
2348 | + $account = $this->db_model->getSelect("password", "accounts", array('id' => $id)); |
|
2349 | + $account_data = $account->result_array(); |
|
2350 | + $password = $this->common->decode($account_data[0]['password']); |
|
2351 | + echo $password; |
|
2352 | + } |
|
2353 | + |
|
2354 | + function reseller_export_cdr_xls() { |
|
2355 | 2355 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
2356 | 2356 | $currency_id=$account_info['currency_id']; |
2357 | 2357 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
2358 | 2358 | ob_clean(); |
2359 | - $query = $this->accounts_model->get_reseller_Account_list(true, '', '', true); |
|
2360 | - $customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Account type", "Balance($currency)", "Credit Limit($currency)", "Status","Created Date"); |
|
2361 | - if ($query->num_rows() > 0) { |
|
2362 | - |
|
2363 | - foreach ($query->result_array() as $row) { |
|
2364 | - $customer_array[] = array( |
|
2365 | - $row['number'], |
|
2366 | - $row['first_name'], |
|
2367 | - $row['last_name'], |
|
2368 | - $row['company_name'], |
|
2369 | - $this->common->get_field_name('name', 'pricelists', $row['pricelist_id']), |
|
2370 | - $this->common->get_account_type('', '', $row['posttoexternal']), |
|
2371 | - $this->common_model->calculate_currency($row['balance'],false,false), |
|
2372 | - $this->common_model->calculate_currency($row['credit_limit'],false,false), |
|
2373 | - $this->common->get_status('export', '', $row['status']), |
|
2374 | - $row['creation'], |
|
2375 | - ); |
|
2376 | - } |
|
2377 | - } |
|
2378 | - $this->load->helper('csv'); |
|
2379 | - array_to_csv($customer_array, 'Resellers_' . date("Y-m-d") . '.csv'); |
|
2380 | - } |
|
2381 | - function customer_validate_ip(){ |
|
2382 | - $add_array=$this->input->post(); |
|
2383 | - if(!empty($add_array)){ |
|
2384 | - $ip = $add_array['ip']; |
|
2385 | - if (strpos($ip, '/') !== false) { |
|
2386 | - $add_array['ip'] = $add_array['ip']; |
|
2387 | - } else { |
|
2388 | - $add_array['ip'] = $add_array['ip'] . '/32'; |
|
2389 | - } |
|
2390 | - $this->db->where('ip',$add_array['ip']); |
|
2391 | - $this->db->where('prefix',$add_array['prefix']); |
|
2392 | - $this->db->select('count(ip) as count'); |
|
2393 | - $ip_map_result=(array)$this->db->get('ip_map')->first_row(); |
|
2394 | - if($ip_map_result['count'] > 0 ){ |
|
2395 | - echo 'FALSE'; |
|
2396 | - }else{ |
|
2397 | - echo 'TRUE'; |
|
2398 | - } |
|
2399 | - }else{ |
|
2400 | - echo 'FALSE'; |
|
2401 | - } |
|
2359 | + $query = $this->accounts_model->get_reseller_Account_list(true, '', '', true); |
|
2360 | + $customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Account type", "Balance($currency)", "Credit Limit($currency)", "Status","Created Date"); |
|
2361 | + if ($query->num_rows() > 0) { |
|
2362 | + |
|
2363 | + foreach ($query->result_array() as $row) { |
|
2364 | + $customer_array[] = array( |
|
2365 | + $row['number'], |
|
2366 | + $row['first_name'], |
|
2367 | + $row['last_name'], |
|
2368 | + $row['company_name'], |
|
2369 | + $this->common->get_field_name('name', 'pricelists', $row['pricelist_id']), |
|
2370 | + $this->common->get_account_type('', '', $row['posttoexternal']), |
|
2371 | + $this->common_model->calculate_currency($row['balance'],false,false), |
|
2372 | + $this->common_model->calculate_currency($row['credit_limit'],false,false), |
|
2373 | + $this->common->get_status('export', '', $row['status']), |
|
2374 | + $row['creation'], |
|
2375 | + ); |
|
2376 | + } |
|
2377 | + } |
|
2378 | + $this->load->helper('csv'); |
|
2379 | + array_to_csv($customer_array, 'Resellers_' . date("Y-m-d") . '.csv'); |
|
2380 | + } |
|
2381 | + function customer_validate_ip(){ |
|
2382 | + $add_array=$this->input->post(); |
|
2383 | + if(!empty($add_array)){ |
|
2384 | + $ip = $add_array['ip']; |
|
2385 | + if (strpos($ip, '/') !== false) { |
|
2386 | + $add_array['ip'] = $add_array['ip']; |
|
2387 | + } else { |
|
2388 | + $add_array['ip'] = $add_array['ip'] . '/32'; |
|
2389 | + } |
|
2390 | + $this->db->where('ip',$add_array['ip']); |
|
2391 | + $this->db->where('prefix',$add_array['prefix']); |
|
2392 | + $this->db->select('count(ip) as count'); |
|
2393 | + $ip_map_result=(array)$this->db->get('ip_map')->first_row(); |
|
2394 | + if($ip_map_result['count'] > 0 ){ |
|
2395 | + echo 'FALSE'; |
|
2396 | + }else{ |
|
2397 | + echo 'TRUE'; |
|
2398 | + } |
|
2399 | + }else{ |
|
2400 | + echo 'FALSE'; |
|
2401 | + } |
|
2402 | 2402 | |
2403 | - } |
|
2403 | + } |
|
2404 | 2404 | function reseller_invoice_config($id=''){ |
2405 | - $data['page_title'] = 'Company Profile'; |
|
2406 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
2407 | - $add_array = $this->input->post(); |
|
2408 | - $data["account_data"] = $add_array; |
|
2409 | - if (isset($add_array['submit'])) { |
|
2410 | - if ($_FILES['file']['name'] == '') { |
|
2411 | - $this->load->module('invoices/invoices'); |
|
2412 | - $this->load->model("invoices_model"); |
|
2413 | - $invoiceconf = $this->invoices_model->get_invoiceconf(); |
|
2414 | - $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
2415 | - } |
|
2416 | - if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
|
2417 | - $files = $_FILES['file']; |
|
2418 | - if ($files['size'] < 0) { |
|
2419 | - $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
|
2420 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2421 | - } |
|
2422 | - $file = $_FILES['file']; |
|
2423 | - $uploadedFile = $file["tmp_name"]; |
|
2424 | - $file_name = $file['name']; |
|
2425 | - $file_type = $file['type']; |
|
2426 | - if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
|
2427 | - $dir_path = FCPATH. "upload/"; |
|
2428 | - $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
2429 | - if (move_uploaded_file($uploadedFile, $path)) { |
|
2430 | - $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
|
2431 | - } else { |
|
2432 | - $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
|
2433 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2434 | - } |
|
2435 | - } else { |
|
2436 | - $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
|
2437 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2438 | - } |
|
2439 | - } |
|
2440 | - $add_array['logo'] = $file_name; |
|
2441 | - unset($add_array['submit']); |
|
2442 | - if ($add_array['id'] == '') { |
|
2443 | - $this->accounts_model->add_invoice_config($add_array); |
|
2444 | - } else { |
|
2445 | - $this->accounts_model->edit_invoice_config($add_array, $add_array['id']); |
|
2446 | - } |
|
2447 | - $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
|
2448 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2449 | - } else { |
|
2450 | - $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$id))->first_row(); |
|
2451 | - $data["accounttype"]='Reseller'; |
|
2452 | - $data["edit_id"]=$id; |
|
2453 | - if(isset($data["account_data"]['logo'])){ |
|
2454 | - $data["account_data"]['file']=$id."_".$data["account_data"]['logo']; |
|
2455 | - } |
|
2456 | - $this->load->view('view_reseller_invoices_config', $data); |
|
2457 | - } |
|
2405 | + $data['page_title'] = 'Company Profile'; |
|
2406 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
2407 | + $add_array = $this->input->post(); |
|
2408 | + $data["account_data"] = $add_array; |
|
2409 | + if (isset($add_array['submit'])) { |
|
2410 | + if ($_FILES['file']['name'] == '') { |
|
2411 | + $this->load->module('invoices/invoices'); |
|
2412 | + $this->load->model("invoices_model"); |
|
2413 | + $invoiceconf = $this->invoices_model->get_invoiceconf(); |
|
2414 | + $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
2415 | + } |
|
2416 | + if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
|
2417 | + $files = $_FILES['file']; |
|
2418 | + if ($files['size'] < 0) { |
|
2419 | + $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
|
2420 | + redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2421 | + } |
|
2422 | + $file = $_FILES['file']; |
|
2423 | + $uploadedFile = $file["tmp_name"]; |
|
2424 | + $file_name = $file['name']; |
|
2425 | + $file_type = $file['type']; |
|
2426 | + if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
|
2427 | + $dir_path = FCPATH. "upload/"; |
|
2428 | + $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
2429 | + if (move_uploaded_file($uploadedFile, $path)) { |
|
2430 | + $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
|
2431 | + } else { |
|
2432 | + $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
|
2433 | + redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2434 | + } |
|
2435 | + } else { |
|
2436 | + $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
|
2437 | + redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2438 | + } |
|
2439 | + } |
|
2440 | + $add_array['logo'] = $file_name; |
|
2441 | + unset($add_array['submit']); |
|
2442 | + if ($add_array['id'] == '') { |
|
2443 | + $this->accounts_model->add_invoice_config($add_array); |
|
2444 | + } else { |
|
2445 | + $this->accounts_model->edit_invoice_config($add_array, $add_array['id']); |
|
2446 | + } |
|
2447 | + $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
|
2448 | + redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
2449 | + } else { |
|
2450 | + $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$id))->first_row(); |
|
2451 | + $data["accounttype"]='Reseller'; |
|
2452 | + $data["edit_id"]=$id; |
|
2453 | + if(isset($data["account_data"]['logo'])){ |
|
2454 | + $data["account_data"]['file']=$id."_".$data["account_data"]['logo']; |
|
2455 | + } |
|
2456 | + $this->load->view('view_reseller_invoices_config', $data); |
|
2457 | + } |
|
2458 | 2458 | } |
2459 | 2459 | |
2460 | - function reseller_invoice_logo_delete($accountid){ |
|
2461 | - $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid)); |
|
2462 | - $result=$invoiceconf->result_array(); |
|
2463 | - $logo=$result[0]['logo']; |
|
2464 | - $post_arr=array('logo'=>''); |
|
2465 | - $where_arr=array('logo'=>$logo); |
|
2466 | - $this->db->where($where_arr); |
|
2467 | - $this->db->update('invoice_conf',$post_arr); |
|
2468 | - } |
|
2460 | + function reseller_invoice_logo_delete($accountid){ |
|
2461 | + $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid)); |
|
2462 | + $result=$invoiceconf->result_array(); |
|
2463 | + $logo=$result[0]['logo']; |
|
2464 | + $post_arr=array('logo'=>''); |
|
2465 | + $where_arr=array('logo'=>$logo); |
|
2466 | + $this->db->where($where_arr); |
|
2467 | + $this->db->update('invoice_conf',$post_arr); |
|
2468 | + } |
|
2469 | 2469 | |
2470 | 2470 | |
2471 | - function customer_global_grid_list(){ |
|
2472 | - echo gettext($_POST['display']); |
|
2471 | + function customer_global_grid_list(){ |
|
2472 | + echo gettext($_POST['display']); |
|
2473 | 2473 | } |
2474 | 2474 | |
2475 | 2475 |
@@ -22,673 +22,673 @@ |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | if (!defined('BASEPATH')) |
25 | - exit('No direct script access allowed'); |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | |
27 | 27 | class Accounts_form { |
28 | - function __construct($library_name = '') { |
|
29 | - $this->CI = & get_instance(); |
|
30 | - } |
|
28 | + function __construct($library_name = '') { |
|
29 | + $this->CI = & get_instance(); |
|
30 | + } |
|
31 | 31 | |
32 | - function get_customer_form_fields($entity_type = false, $id = false) { |
|
32 | + function get_customer_form_fields($entity_type = false, $id = false) { |
|
33 | 33 | |
34 | - $expiry_date = gmdate('Y-m-d H:i:s', strtotime('+10 years')); |
|
35 | - $readable = FALSE; |
|
36 | - $type = $entity_type == 'customer' ? 0 : 3; |
|
37 | - $uname = $this->CI->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
38 | - $pin = Common_model::$global_config['system_config']['pinlength']; |
|
39 | - $pin_number=$this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts'); |
|
40 | - $uname_user = $this->CI->common->find_uniq_rendno('10', 'number', 'accounts'); |
|
41 | - $password = $this->CI->common->generate_password(); |
|
42 | - $logintype = $this->CI->session->userdata('logintype'); |
|
43 | - if ($logintype == 1 || $logintype == 5) { |
|
44 | - $account_data = $this->CI->session->userdata("accountinfo"); |
|
45 | - $loginid = $account_data['id']; |
|
46 | - } else { |
|
47 | - $loginid = "0"; |
|
48 | - } |
|
49 | - $sip_device = null; |
|
50 | - $opensips_device = null; |
|
51 | - if (!$entity_type) { |
|
52 | - $entity_type = 'customer'; |
|
53 | - } |
|
54 | - $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true); |
|
34 | + $expiry_date = gmdate('Y-m-d H:i:s', strtotime('+10 years')); |
|
35 | + $readable = FALSE; |
|
36 | + $type = $entity_type == 'customer' ? 0 : 3; |
|
37 | + $uname = $this->CI->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
38 | + $pin = Common_model::$global_config['system_config']['pinlength']; |
|
39 | + $pin_number=$this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts'); |
|
40 | + $uname_user = $this->CI->common->find_uniq_rendno('10', 'number', 'accounts'); |
|
41 | + $password = $this->CI->common->generate_password(); |
|
42 | + $logintype = $this->CI->session->userdata('logintype'); |
|
43 | + if ($logintype == 1 || $logintype == 5) { |
|
44 | + $account_data = $this->CI->session->userdata("accountinfo"); |
|
45 | + $loginid = $account_data['id']; |
|
46 | + } else { |
|
47 | + $loginid = "0"; |
|
48 | + } |
|
49 | + $sip_device = null; |
|
50 | + $opensips_device = null; |
|
51 | + if (!$entity_type) { |
|
52 | + $entity_type = 'customer'; |
|
53 | + } |
|
54 | + $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true); |
|
55 | 55 | |
56 | - if ($id > 0) { |
|
57 | - $readable = 'disabled'; |
|
58 | - $val = 'accounts.email.' . $id; |
|
59 | - $account_val='accounts.number.'.$id; |
|
60 | - $password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|', 'tOOL TIP', ''); |
|
61 | - $balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', ''); |
|
62 | - $account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', ''); |
|
63 | - /* * ******************************** */ |
|
64 | - } else { |
|
65 | - $val = 'accounts.email'; |
|
66 | - $account_val='accounts.number'; |
|
67 | - if (common_model::$global_config['system_config']['opensips'] == 0) { |
|
56 | + if ($id > 0) { |
|
57 | + $readable = 'disabled'; |
|
58 | + $val = 'accounts.email.' . $id; |
|
59 | + $account_val='accounts.number.'.$id; |
|
60 | + $password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|', 'tOOL TIP', ''); |
|
61 | + $balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', ''); |
|
62 | + $account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', ''); |
|
63 | + /* * ******************************** */ |
|
64 | + } else { |
|
65 | + $val = 'accounts.email'; |
|
66 | + $account_val='accounts.number'; |
|
67 | + if (common_model::$global_config['system_config']['opensips'] == 0) { |
|
68 | 68 | $sip_device = array('Create Opensips Device', 'opensips_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate'); |
69 | - } else { |
|
70 | - $sip_device = array('Create SIP Device', 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate'); |
|
71 | - } |
|
69 | + } else { |
|
70 | + $sip_device = array('Create SIP Device', 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate'); |
|
71 | + } |
|
72 | 72 | $account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>'); |
73 | - $password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>'); |
|
74 | - $balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', ''); |
|
75 | - } |
|
76 | - $pin = array('Pin', 'INPUT', array('name' => 'pin', 'value' => $pin_number, 'size' => '20', 'class' => "text field medium", 'id' => 'change_pin'), 'required|is_numeric', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Pin" class="change_pin fa fa-refresh" ></i>'); |
|
77 | - $form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/'.$id."/", array("id" => "customer_form", "name" => "customer_form")); |
|
78 | - $form[gettext('Account Profile')] = array( |
|
79 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
80 | - array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''), |
|
73 | + $password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>'); |
|
74 | + $balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', ''); |
|
75 | + } |
|
76 | + $pin = array('Pin', 'INPUT', array('name' => 'pin', 'value' => $pin_number, 'size' => '20', 'class' => "text field medium", 'id' => 'change_pin'), 'required|is_numeric', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Pin" class="change_pin fa fa-refresh" ></i>'); |
|
77 | + $form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/'.$id."/", array("id" => "customer_form", "name" => "customer_form")); |
|
78 | + $form[gettext('Account Profile')] = array( |
|
79 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
80 | + array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''), |
|
81 | 81 | $account, |
82 | - $password, |
|
83 | - $pin, |
|
84 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'class' => "text field medium"), 'required', 'tOOL TIP', ''), |
|
85 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
86 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
87 | - array(gettext('Phone'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
88 | - array(gettext('Mobile'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
89 | - array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
90 | - array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
91 | - array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
92 | - array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
93 | - array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
94 | - array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
95 | - array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
96 | - array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
97 | - array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()) |
|
98 | - ); |
|
99 | - |
|
100 | - $form[gettext('Account Settings')] = array( |
|
101 | - array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
|
102 | - array(gettext('Allow Recording'), 'is_recording', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
103 | - array(gettext('Allow IP Management'), 'allow_ip_management', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
104 | - $sip_device, |
|
105 | - array(gettext('Number Translation'), 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
106 | - array(gettext('Concurrent Calls'), 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''), |
|
107 | - array(gettext('Interval'), 'INPUT', array('name' => 'interval', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''), |
|
108 | - array(gettext('First Used'), 'INPUT', array('name' => 'first_used', 'size' => '20', 'readonly' => true, 'class' => "text field medium", 'value' => '0000-00-00 00:00:00'), '', 'tOOL TIP', ''), |
|
109 | - array(gettext('Account Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''), |
|
110 | - array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry', 'size' => '20', 'class' => "text field medium", 'value' => $expiry_date, 'id' => 'expiry'), '', 'tOOL TIP', ''), |
|
111 | - ); |
|
82 | + $password, |
|
83 | + $pin, |
|
84 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'class' => "text field medium"), 'required', 'tOOL TIP', ''), |
|
85 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
86 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
87 | + array(gettext('Phone'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
88 | + array(gettext('Mobile'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
89 | + array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
90 | + array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
91 | + array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
92 | + array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
93 | + array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
94 | + array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
95 | + array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
96 | + array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
97 | + array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()) |
|
98 | + ); |
|
99 | + |
|
100 | + $form[gettext('Account Settings')] = array( |
|
101 | + array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
|
102 | + array(gettext('Allow Recording'), 'is_recording', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
103 | + array(gettext('Allow IP Management'), 'allow_ip_management', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
104 | + $sip_device, |
|
105 | + array(gettext('Number Translation'), 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
106 | + array(gettext('Concurrent Calls'), 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''), |
|
107 | + array(gettext('Interval'), 'INPUT', array('name' => 'interval', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''), |
|
108 | + array(gettext('First Used'), 'INPUT', array('name' => 'first_used', 'size' => '20', 'readonly' => true, 'class' => "text field medium", 'value' => '0000-00-00 00:00:00'), '', 'tOOL TIP', ''), |
|
109 | + array(gettext('Account Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''), |
|
110 | + array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry', 'size' => '20', 'class' => "text field medium", 'value' => $expiry_date, 'id' => 'expiry'), '', 'tOOL TIP', ''), |
|
111 | + ); |
|
112 | 112 | |
113 | - $form[gettext('Billing Settings')] = array( |
|
114 | - array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", "rules" => "dropdown"), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => $loginid)), |
|
115 | - array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
116 | - array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'class' => 'sweep_id', 'id' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
117 | - array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
118 | - $balance, |
|
119 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
120 | - array(gettext('Allow Local Calls'), 'local_call', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
121 | - array(gettext('LC Charge / Min'), 'INPUT', array('name' => 'charge_per_min', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
122 | - array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, "reseller_id" => $loginid), 'multi'), |
|
123 | - ); |
|
113 | + $form[gettext('Billing Settings')] = array( |
|
114 | + array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", "rules" => "dropdown"), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => $loginid)), |
|
115 | + array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
116 | + array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'class' => 'sweep_id', 'id' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
117 | + array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
118 | + $balance, |
|
119 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
120 | + array(gettext('Allow Local Calls'), 'local_call', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
121 | + array(gettext('LC Charge / Min'), 'INPUT', array('name' => 'charge_per_min', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
122 | + array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, "reseller_id" => $loginid), 'multi'), |
|
123 | + ); |
|
124 | 124 | if($id==0){ |
125 | 125 | $form[gettext('Alert Threshold')] = array( |
126 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
127 | - array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
|
128 | - array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
129 | - array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
126 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
127 | + array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
|
128 | + array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
129 | + array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
130 | 130 | ); |
131 | 131 | } |
132 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
133 | - $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Cancel'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/accounts/customer_list/\')'); |
|
134 | - if ($id > 0) { |
|
132 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
133 | + $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Cancel'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/accounts/customer_list/\')'); |
|
134 | + if ($id > 0) { |
|
135 | 135 | unset($form[gettext('Account Settings')][3]); |
136 | 136 | } |
137 | - return $form; |
|
138 | - } |
|
139 | - |
|
140 | - function customer_alert_threshold($entity_type) { |
|
141 | - $form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_alert_threshold_save/' . $entity_type . "/", array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold")); |
|
142 | - $form[gettext('Alert Threshold')] = array( |
|
143 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
144 | - array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
|
145 | - array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
146 | - array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
147 | - ); |
|
148 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
149 | - return $form; |
|
150 | - } |
|
151 | - |
|
152 | - function customer_bulk_generate_form() { |
|
153 | - $logintype = $this->CI->session->userdata('logintype'); |
|
154 | - $sip_device = null; |
|
155 | - $opensips_device = null; |
|
156 | - if ($logintype == 1 || $logintype == 5) { |
|
157 | - $account_data = $this->CI->session->userdata("accountinfo"); |
|
158 | - $loginid = $account_data['id']; |
|
159 | - } else { |
|
160 | - $loginid = "0"; |
|
161 | - if (common_model::$global_config['system_config']['opensips'] == 0) { |
|
162 | - $opensips_device = array(gettext('Create Opensips Device'), 'opensips_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'); |
|
163 | - } else { |
|
164 | - $sip_device = array(gettext('Create SIP Device'), 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'); |
|
165 | - } |
|
166 | - } |
|
167 | - $form['forms'] = array(base_url() . 'accounts/customer_bulk_save/', array("id" => "customer_bulk_form", "name" => "customer_bulk_form")); |
|
168 | - $form[gettext('General Details')] = array( |
|
169 | - array(gettext('Account Count'), 'INPUT', array('name' => 'count', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
170 | - array(gettext('Start Prefix'), 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
171 | - array(gettext('Acc. Number Length'), 'INPUT', array('name' => 'account_length', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
172 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
173 | - array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
174 | - array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
175 | - array(gettext('Generate Pin'), 'pin', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_pin_allow_customer'), |
|
176 | - array(gettext('Allow Recording'), 'is_recording', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
177 | - array(gettext('Allow IP Management'), 'allow_ip_management', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
178 | - $sip_device, |
|
179 | - $opensips_device |
|
180 | - ); |
|
181 | - $form[gettext('Default Settings')] = array( |
|
182 | - array(gettext('Rate Group'), array('name' => 'pricelist_id', 'class' => 'pricelist_id'), 'SELECT', '', "required", 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => $loginid)), |
|
183 | - array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
184 | - array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'id' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
185 | - array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
186 | - array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
187 | - array(gettext('Balance'), 'INPUT', array('name' => 'balance', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', ''), |
|
188 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), 'trim|currency_decimal|xss_clean', 'tOOL TIP', ''), |
|
189 | - array(gettext('Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''), |
|
190 | - array(gettext('Allow Local Calls'), 'local_call', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
191 | - array(gettext('LC Charge / Min'), 'INPUT', array('name' => 'charge_per_min', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', '') |
|
192 | - ); |
|
193 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
194 | - $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Close'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
195 | - return $form; |
|
196 | - } |
|
197 | - |
|
198 | - function get_customer_callerid_fields() { |
|
199 | - $form['forms'] = array(base_url() . 'accounts/customer_add_callerid/', array("id" => "callerid_form")); |
|
200 | - $form[gettext('Information')] = array( |
|
201 | - array('', 'HIDDEN', array('name' => 'flag'), '', '', '', ''), |
|
202 | - array(gettext('Account'), 'INPUT', array('name' => 'accountid', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
203 | - array(gettext('Enable'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
204 | - array(gettext('Caller Id Name'), 'INPUT', array('name' => 'callerid_name', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
|
205 | - array(gettext('Caller Id Number'), 'INPUT', array('name' => 'callerid_number', 'size' => '20', 'class' => "text field medium"), 'trim|numeric', 'tOOL TIP', '') |
|
206 | - ); |
|
207 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', "id" => "submit", 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
208 | - $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Close'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
209 | - return $form; |
|
210 | - } |
|
211 | - |
|
212 | - function get_customer_payment_fields($currency, $number, $currency_id, $id) { |
|
213 | - $form['forms'] = array(base_url() . 'accounts/customer_payment_save/', array('id' => 'acccount_charges_form', 'method' => 'POST', 'name' => 'acccount_charges_form')); |
|
214 | - $form['Refill information'] = array( |
|
215 | - array('', 'HIDDEN', array('name' => 'id', 'value' => $id), '', '', '', ''), |
|
216 | - array('', 'HIDDEN', array('name' => 'account_currency', 'value' => $currency_id), '', '', ''), |
|
217 | - array(gettext('Account'), 'INPUT', array('name' => 'accountid', 'size' => '20', 'value' => $number, 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
218 | - array(gettext('Amount'), 'INPUT', array('name' => 'credit', 'size' => '20', 'class' => "text col-md-5 field medium"), 'trim|required', 'tOOL TIP', ''), |
|
219 | - array(gettext('Type'), 'payment_type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_payment_type'), |
|
220 | - array(gettext('Note'), 'TEXTAREA', array('name' => 'notes', 'size' => '20', 'cols' => '50', 'rows' => '3', 'class' => "text col-md-5 field medium", 'style' => "width: 450px; height: 100px;"), '', 'tOOL TIP', '')); |
|
221 | - /* *************************************** */ |
|
222 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Process'), 'value' => 'save', 'id' => "submit", 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
223 | - $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Close'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
224 | - return $form; |
|
225 | - } |
|
226 | - |
|
227 | - function get_form_reseller_fields($id = false) { |
|
228 | - $readable = false; |
|
229 | - $invoice_config = null; |
|
230 | - $concurrent_calls=null; |
|
231 | - $logintype = $this->CI->session->userdata('logintype'); |
|
232 | - $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
233 | - $password = $this->CI->common->generate_password(); |
|
234 | - $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true); |
|
235 | - if ($logintype == 1 || $logintype == 5) { |
|
236 | - $account_data = $this->CI->session->userdata("accountinfo"); |
|
237 | - $loginid = $account_data['id']; |
|
238 | - } else { |
|
239 | - $loginid = "0"; |
|
240 | - } |
|
241 | - if ($id > 0) { |
|
242 | - $val = 'accounts.email.' . $id; |
|
243 | - $account_val='accounts.number.'.$id; |
|
244 | - $readable = 'disabled'; |
|
245 | - $password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', ''); |
|
246 | - $concurrent_calls=array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''); |
|
247 | - $account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', ''); |
|
248 | - } else { |
|
249 | - $val = 'accounts.email'; |
|
250 | - $account_val='accounts.number'; |
|
251 | - $invoice_config = array('Use same credential for Invoice Config', 'invoice_config_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate'); |
|
252 | - $password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>'); |
|
253 | - $account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>'); |
|
254 | - } |
|
255 | - if ($id == "") { |
|
256 | - $reg_url = array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''); |
|
257 | - } else { |
|
258 | - $reg_url = array('Registration URL', 'INPUT', array('name' => 'registration_url', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'tOOL TIP', ''); |
|
259 | - } |
|
260 | - /* * ****************************************************************** */ |
|
261 | - $form['forms'] = array(base_url() . 'accounts/reseller_save/', array("id" => "reseller_form", "name" => "reseller_form")); |
|
262 | - $form['Client Panel Access'] = array( |
|
263 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
264 | - array('', 'HIDDEN', array('name' => 'type', 'value' => '1'), '', '', ''), |
|
265 | - $account, |
|
266 | - $password, |
|
267 | - $reg_url, |
|
268 | - ); |
|
269 | - if ($id > 0) { |
|
137 | + return $form; |
|
138 | + } |
|
139 | + |
|
140 | + function customer_alert_threshold($entity_type) { |
|
141 | + $form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_alert_threshold_save/' . $entity_type . "/", array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold")); |
|
142 | + $form[gettext('Alert Threshold')] = array( |
|
143 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
144 | + array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
|
145 | + array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''), |
|
146 | + array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
147 | + ); |
|
148 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
149 | + return $form; |
|
150 | + } |
|
151 | + |
|
152 | + function customer_bulk_generate_form() { |
|
153 | + $logintype = $this->CI->session->userdata('logintype'); |
|
154 | + $sip_device = null; |
|
155 | + $opensips_device = null; |
|
156 | + if ($logintype == 1 || $logintype == 5) { |
|
157 | + $account_data = $this->CI->session->userdata("accountinfo"); |
|
158 | + $loginid = $account_data['id']; |
|
159 | + } else { |
|
160 | + $loginid = "0"; |
|
161 | + if (common_model::$global_config['system_config']['opensips'] == 0) { |
|
162 | + $opensips_device = array(gettext('Create Opensips Device'), 'opensips_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'); |
|
163 | + } else { |
|
164 | + $sip_device = array(gettext('Create SIP Device'), 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'); |
|
165 | + } |
|
166 | + } |
|
167 | + $form['forms'] = array(base_url() . 'accounts/customer_bulk_save/', array("id" => "customer_bulk_form", "name" => "customer_bulk_form")); |
|
168 | + $form[gettext('General Details')] = array( |
|
169 | + array(gettext('Account Count'), 'INPUT', array('name' => 'count', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
170 | + array(gettext('Start Prefix'), 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
171 | + array(gettext('Acc. Number Length'), 'INPUT', array('name' => 'account_length', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
172 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
173 | + array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
174 | + array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
175 | + array(gettext('Generate Pin'), 'pin', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_pin_allow_customer'), |
|
176 | + array(gettext('Allow Recording'), 'is_recording', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
177 | + array(gettext('Allow IP Management'), 'allow_ip_management', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
178 | + $sip_device, |
|
179 | + $opensips_device |
|
180 | + ); |
|
181 | + $form[gettext('Default Settings')] = array( |
|
182 | + array(gettext('Rate Group'), array('name' => 'pricelist_id', 'class' => 'pricelist_id'), 'SELECT', '', "required", 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => $loginid)), |
|
183 | + array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
184 | + array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'id' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
185 | + array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
186 | + array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
187 | + array(gettext('Balance'), 'INPUT', array('name' => 'balance', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', ''), |
|
188 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), 'trim|currency_decimal|xss_clean', 'tOOL TIP', ''), |
|
189 | + array(gettext('Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''), |
|
190 | + array(gettext('Allow Local Calls'), 'local_call', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
191 | + array(gettext('LC Charge / Min'), 'INPUT', array('name' => 'charge_per_min', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', '') |
|
192 | + ); |
|
193 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
194 | + $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Close'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
195 | + return $form; |
|
196 | + } |
|
197 | + |
|
198 | + function get_customer_callerid_fields() { |
|
199 | + $form['forms'] = array(base_url() . 'accounts/customer_add_callerid/', array("id" => "callerid_form")); |
|
200 | + $form[gettext('Information')] = array( |
|
201 | + array('', 'HIDDEN', array('name' => 'flag'), '', '', '', ''), |
|
202 | + array(gettext('Account'), 'INPUT', array('name' => 'accountid', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
203 | + array(gettext('Enable'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'), |
|
204 | + array(gettext('Caller Id Name'), 'INPUT', array('name' => 'callerid_name', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
|
205 | + array(gettext('Caller Id Number'), 'INPUT', array('name' => 'callerid_number', 'size' => '20', 'class' => "text field medium"), 'trim|numeric', 'tOOL TIP', '') |
|
206 | + ); |
|
207 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', "id" => "submit", 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
208 | + $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Close'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
209 | + return $form; |
|
210 | + } |
|
211 | + |
|
212 | + function get_customer_payment_fields($currency, $number, $currency_id, $id) { |
|
213 | + $form['forms'] = array(base_url() . 'accounts/customer_payment_save/', array('id' => 'acccount_charges_form', 'method' => 'POST', 'name' => 'acccount_charges_form')); |
|
214 | + $form['Refill information'] = array( |
|
215 | + array('', 'HIDDEN', array('name' => 'id', 'value' => $id), '', '', '', ''), |
|
216 | + array('', 'HIDDEN', array('name' => 'account_currency', 'value' => $currency_id), '', '', ''), |
|
217 | + array(gettext('Account'), 'INPUT', array('name' => 'accountid', 'size' => '20', 'value' => $number, 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
218 | + array(gettext('Amount'), 'INPUT', array('name' => 'credit', 'size' => '20', 'class' => "text col-md-5 field medium"), 'trim|required', 'tOOL TIP', ''), |
|
219 | + array(gettext('Type'), 'payment_type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_payment_type'), |
|
220 | + array(gettext('Note'), 'TEXTAREA', array('name' => 'notes', 'size' => '20', 'cols' => '50', 'rows' => '3', 'class' => "text col-md-5 field medium", 'style' => "width: 450px; height: 100px;"), '', 'tOOL TIP', '')); |
|
221 | + /* *************************************** */ |
|
222 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Process'), 'value' => 'save', 'id' => "submit", 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
223 | + $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Close'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
224 | + return $form; |
|
225 | + } |
|
226 | + |
|
227 | + function get_form_reseller_fields($id = false) { |
|
228 | + $readable = false; |
|
229 | + $invoice_config = null; |
|
230 | + $concurrent_calls=null; |
|
231 | + $logintype = $this->CI->session->userdata('logintype'); |
|
232 | + $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
233 | + $password = $this->CI->common->generate_password(); |
|
234 | + $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true); |
|
235 | + if ($logintype == 1 || $logintype == 5) { |
|
236 | + $account_data = $this->CI->session->userdata("accountinfo"); |
|
237 | + $loginid = $account_data['id']; |
|
238 | + } else { |
|
239 | + $loginid = "0"; |
|
240 | + } |
|
241 | + if ($id > 0) { |
|
242 | + $val = 'accounts.email.' . $id; |
|
243 | + $account_val='accounts.number.'.$id; |
|
244 | + $readable = 'disabled'; |
|
245 | + $password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', ''); |
|
246 | + $concurrent_calls=array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''); |
|
247 | + $account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', ''); |
|
248 | + } else { |
|
249 | + $val = 'accounts.email'; |
|
250 | + $account_val='accounts.number'; |
|
251 | + $invoice_config = array('Use same credential for Invoice Config', 'invoice_config_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate'); |
|
252 | + $password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>'); |
|
253 | + $account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>'); |
|
254 | + } |
|
255 | + if ($id == "") { |
|
256 | + $reg_url = array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''); |
|
257 | + } else { |
|
258 | + $reg_url = array('Registration URL', 'INPUT', array('name' => 'registration_url', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'tOOL TIP', ''); |
|
259 | + } |
|
260 | + /* * ****************************************************************** */ |
|
261 | + $form['forms'] = array(base_url() . 'accounts/reseller_save/', array("id" => "reseller_form", "name" => "reseller_form")); |
|
262 | + $form['Client Panel Access'] = array( |
|
263 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
264 | + array('', 'HIDDEN', array('name' => 'type', 'value' => '1'), '', '', ''), |
|
265 | + $account, |
|
266 | + $password, |
|
267 | + $reg_url, |
|
268 | + ); |
|
269 | + if ($id > 0) { |
|
270 | 270 | |
271 | - $form[gettext('Billing Information')] = array( |
|
272 | - array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
273 | - $concurrent_calls, |
|
274 | - array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
275 | - array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
276 | - array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
277 | - array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
278 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
279 | - array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'), |
|
280 | - ); |
|
271 | + $form[gettext('Billing Information')] = array( |
|
272 | + array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
273 | + $concurrent_calls, |
|
274 | + array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
275 | + array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
276 | + array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
277 | + array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
278 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
279 | + array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'), |
|
280 | + ); |
|
281 | 281 | |
282 | 282 | } |
283 | 283 | else{ |
284 | - $form[gettext('Billing Information')] = array( |
|
285 | - array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
284 | + $form[gettext('Billing Information')] = array( |
|
285 | + array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
286 | 286 | |
287 | - array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
288 | - array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
289 | - array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
290 | - array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
291 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
292 | - array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'), |
|
293 | - $invoice_config, |
|
294 | - ); |
|
287 | + array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
|
288 | + array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'), |
|
289 | + array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
290 | + array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
291 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
292 | + array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'), |
|
293 | + $invoice_config, |
|
294 | + ); |
|
295 | 295 | } |
296 | - $form[gettext('Reseller Profile')] = array( |
|
297 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '50', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
298 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
299 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '50', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
300 | - array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
301 | - array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
302 | - array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
303 | - array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
304 | - array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
305 | - array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
306 | - array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
307 | - array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
308 | - array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
309 | - array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
310 | - array(gettext('Account Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
|
311 | - ); |
|
312 | - if($id==0){ |
|
296 | + $form[gettext('Reseller Profile')] = array( |
|
297 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '50', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
298 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
299 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '50', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
300 | + array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
301 | + array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
302 | + array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
303 | + array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
304 | + array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
305 | + array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
306 | + array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
307 | + array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
308 | + array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
309 | + array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
310 | + array(gettext('Account Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
|
311 | + ); |
|
312 | + if($id==0){ |
|
313 | 313 | $form[gettext('Alert Threshold')] = array( |
314 | 314 | array('Email Alert?', 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'), |
315 | - array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
316 | - array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
315 | + array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
316 | + array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''), |
|
317 | 317 | ); |
318 | 318 | } |
319 | - $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Cancel'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/accounts/reseller_list/\')'); |
|
320 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
321 | - return $form; |
|
322 | - } |
|
323 | - |
|
324 | - function get_form_admin_fields($entity_type = '', $id = false) { |
|
325 | - $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
326 | - $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true); |
|
327 | - if ($id > 0) { |
|
328 | - $val = 'accounts.email.' . $id; |
|
329 | - $account_val='accounts.number.'.$id; |
|
330 | - $password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', ''); |
|
331 | - $account=array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', ''); |
|
332 | - } else { |
|
333 | - $val = 'accounts.email'; |
|
334 | - $account_val='accounts.number'; |
|
335 | - $password = $this->CI->common->generate_password(); |
|
336 | - $password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20','class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>'); |
|
337 | - $account = array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>'); |
|
338 | - /* * ****************** */ |
|
339 | - } |
|
319 | + $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Cancel'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/accounts/reseller_list/\')'); |
|
320 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
321 | + return $form; |
|
322 | + } |
|
323 | + |
|
324 | + function get_form_admin_fields($entity_type = '', $id = false) { |
|
325 | + $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts'); |
|
326 | + $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true); |
|
327 | + if ($id > 0) { |
|
328 | + $val = 'accounts.email.' . $id; |
|
329 | + $account_val='accounts.number.'.$id; |
|
330 | + $password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', ''); |
|
331 | + $account=array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', ''); |
|
332 | + } else { |
|
333 | + $val = 'accounts.email'; |
|
334 | + $account_val='accounts.number'; |
|
335 | + $password = $this->CI->common->generate_password(); |
|
336 | + $password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20','class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>'); |
|
337 | + $account = array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>'); |
|
338 | + /* * ****************** */ |
|
339 | + } |
|
340 | 340 | |
341 | 341 | |
342 | - $type = $entity_type == 'admin' ? 2 : 4; |
|
343 | - $form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/', array("id" => "admin_form", "name" => "admin_form")); |
|
344 | - $form['Client Panel Access'] = array( |
|
345 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
346 | - array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''), |
|
347 | - $account, |
|
348 | - $password, |
|
349 | - /* * ********************* */ |
|
350 | - ); |
|
351 | - $form[gettext($entity_type . ' Profile')] = array( |
|
352 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'maxlength' => '40', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
353 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
354 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
355 | - array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
356 | - array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
357 | - array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
358 | - array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15','class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
359 | - array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
360 | - array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
361 | - array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
362 | - array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
363 | - array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
364 | - array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
365 | - array(gettext('Account Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
|
366 | - array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
367 | - ); |
|
368 | - |
|
369 | - $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Cancel'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/accounts/admin_list/\')'); |
|
370 | - $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
371 | - return $form; |
|
372 | - } |
|
373 | - |
|
374 | - |
|
375 | - /** |
|
342 | + $type = $entity_type == 'admin' ? 2 : 4; |
|
343 | + $form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/', array("id" => "admin_form", "name" => "admin_form")); |
|
344 | + $form['Client Panel Access'] = array( |
|
345 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
346 | + array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''), |
|
347 | + $account, |
|
348 | + $password, |
|
349 | + /* * ********************* */ |
|
350 | + ); |
|
351 | + $form[gettext($entity_type . ' Profile')] = array( |
|
352 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'maxlength' => '40', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
353 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
354 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''), |
|
355 | + array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
356 | + array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
357 | + array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''), |
|
358 | + array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15','class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
359 | + array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
360 | + array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
361 | + array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
362 | + array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'), |
|
363 | + array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), |
|
364 | + array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''), |
|
365 | + array(gettext('Account Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
|
366 | + array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()), |
|
367 | + ); |
|
368 | + |
|
369 | + $form['button_cancel'] = array('name' => 'action', 'content' => gettext('Cancel'), 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/accounts/admin_list/\')'); |
|
370 | + $form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
371 | + return $form; |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + /** |
|
376 | 376 | ASTPP 3.0 |
377 | 377 | Reseller Batch Update |
378 | - * */ |
|
379 | - function reseller_batch_update_form() { |
|
380 | - |
|
381 | - $status = array('Status', array('name' => 'status[status]', 'id' => 'status'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', '', 'set_status', '', '', array('name' => 'status[operator]', 'class' => 'update_drp'), 'update_drp_type'); |
|
382 | - $form['forms'] = array("accounts/reseller_batch_update/", array('id' => "reseller_batch_update")); |
|
383 | - $form[gettext('Batch Update')] = array( |
|
384 | - array(gettext('Rate Group'), array('name' => 'pricelist_id[pricelist_id]', 'id' => 'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name' => 'pricelist_id[operator]', 'class' => 'update_drp'), 'update_drp_type'), |
|
385 | - array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''), |
|
378 | + * */ |
|
379 | + function reseller_batch_update_form() { |
|
380 | + |
|
381 | + $status = array('Status', array('name' => 'status[status]', 'id' => 'status'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', '', 'set_status', '', '', array('name' => 'status[operator]', 'class' => 'update_drp'), 'update_drp_type'); |
|
382 | + $form['forms'] = array("accounts/reseller_batch_update/", array('id' => "reseller_batch_update")); |
|
383 | + $form[gettext('Batch Update')] = array( |
|
384 | + array(gettext('Rate Group'), array('name' => 'pricelist_id[pricelist_id]', 'id' => 'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name' => 'pricelist_id[operator]', 'class' => 'update_drp'), 'update_drp_type'), |
|
385 | + array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''), |
|
386 | 386 | |
387 | - $status, |
|
388 | - ); |
|
389 | - $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => gettext('Update'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
390 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
387 | + $status, |
|
388 | + ); |
|
389 | + $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => gettext('Update'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
390 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
391 | 391 | |
392 | - return $form; |
|
393 | - } |
|
392 | + return $form; |
|
393 | + } |
|
394 | 394 | |
395 | - /* * ***************************************************************************************************************************** */ |
|
395 | + /* * ***************************************************************************************************************************** */ |
|
396 | 396 | |
397 | - /** |
|
397 | + /** |
|
398 | 398 | ASTPP 3.0 |
399 | 399 | Customer Batch Update |
400 | - * */ |
|
401 | - function customer_batch_update_form() { |
|
402 | - |
|
403 | - $status = array('Status', array('name' => 'status[status]', 'id' => 'status'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', '', 'set_status', '', '', array('name' => 'status[operator]', 'class' => 'update_drp'), 'update_drp_type'); |
|
404 | - $form['forms'] = array("accounts/customer_batch_update/", array('id' => "reseller_batch_update")); |
|
405 | - $form[gettext('Batch Update')] = array( |
|
406 | - array(gettext('Rate Group'), array('name' => 'pricelist_id[pricelist_id]', 'id' => 'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name' => 'pricelist_id[operator]', 'class' => 'update_drp'), 'update_drp_type'), |
|
407 | - array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''), |
|
408 | - $status, |
|
409 | - ); |
|
410 | - $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => gettext('Update'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
411 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
412 | - |
|
413 | - return $form; |
|
414 | - } |
|
400 | + * */ |
|
401 | + function customer_batch_update_form() { |
|
402 | + |
|
403 | + $status = array('Status', array('name' => 'status[status]', 'id' => 'status'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', '', 'set_status', '', '', array('name' => 'status[operator]', 'class' => 'update_drp'), 'update_drp_type'); |
|
404 | + $form['forms'] = array("accounts/customer_batch_update/", array('id' => "reseller_batch_update")); |
|
405 | + $form[gettext('Batch Update')] = array( |
|
406 | + array(gettext('Rate Group'), array('name' => 'pricelist_id[pricelist_id]', 'id' => 'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name' => 'pricelist_id[operator]', 'class' => 'update_drp'), 'update_drp_type'), |
|
407 | + array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''), |
|
408 | + $status, |
|
409 | + ); |
|
410 | + $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => gettext('Update'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
411 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => gettext('Clear'), 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
412 | + |
|
413 | + return $form; |
|
414 | + } |
|
415 | 415 | |
416 | - /* * ***************************************************************************************************************************** */ |
|
416 | + /* * ***************************************************************************************************************************** */ |
|
417 | 417 | |
418 | 418 | |
419 | 419 | |
420 | - function get_search_customer_form() { |
|
420 | + function get_search_customer_form() { |
|
421 | 421 | $logintype = $this->CI->session->userdata('userlevel_logintype'); |
422 | 422 | if($logintype != 1){ |
423 | - $form['forms'] = array("", array('id' => "account_search")); |
|
424 | - $form[gettext('Search')] = array( |
|
425 | - array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
426 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
427 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
428 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
429 | - array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
430 | - array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'balance[balance-integer]', '', '', '', 'search_int_type', ''), |
|
431 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit[credit_limit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit_limit[credit_limit-integer]', '', '', '', 'search_int_type', ''), |
|
432 | - array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
433 | - array(gettext('First Used'), 'INPUT', array('name' => 'first_used[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'first_used'), '', 'tOOL TIP', '', 'first_used[first_used-date]'), |
|
434 | - array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry[0]', 'id' => 'expiry', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'expiry[expiry-date]'), |
|
435 | - array('CC', 'INPUT', array('name' => 'maxchannels[maxchannels]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'maxchannels[maxchannels]', '', '', '', 'search_string_type', ''), |
|
436 | - array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
437 | - array(gettext('Created Date'), 'INPUT', array('name' => 'creation[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'creation'), '', 'tOOL TIP', '', 'creation[creation-date]'), |
|
438 | - array(gettext('Entity Type'), 'type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_entity_type_customer'), |
|
439 | - array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type_search'), |
|
440 | - array(gettext('Billing Cycle'), 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_Billing_Schedule_status'), |
|
441 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
442 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
443 | - ); |
|
423 | + $form['forms'] = array("", array('id' => "account_search")); |
|
424 | + $form[gettext('Search')] = array( |
|
425 | + array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
426 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
427 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
428 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
429 | + array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
430 | + array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'balance[balance-integer]', '', '', '', 'search_int_type', ''), |
|
431 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit[credit_limit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit_limit[credit_limit-integer]', '', '', '', 'search_int_type', ''), |
|
432 | + array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
433 | + array(gettext('First Used'), 'INPUT', array('name' => 'first_used[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'first_used'), '', 'tOOL TIP', '', 'first_used[first_used-date]'), |
|
434 | + array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry[0]', 'id' => 'expiry', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'expiry[expiry-date]'), |
|
435 | + array('CC', 'INPUT', array('name' => 'maxchannels[maxchannels]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'maxchannels[maxchannels]', '', '', '', 'search_string_type', ''), |
|
436 | + array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
437 | + array(gettext('Created Date'), 'INPUT', array('name' => 'creation[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'creation'), '', 'tOOL TIP', '', 'creation[creation-date]'), |
|
438 | + array(gettext('Entity Type'), 'type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_entity_type_customer'), |
|
439 | + array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type_search'), |
|
440 | + array(gettext('Billing Cycle'), 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_Billing_Schedule_status'), |
|
441 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
442 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
443 | + ); |
|
444 | 444 | |
445 | - } |
|
445 | + } |
|
446 | 446 | else |
447 | 447 | { |
448 | 448 | |
449 | 449 | $form['forms'] = array("", array('id' => "account_search")); |
450 | - $form[gettext('Search')] = array( |
|
451 | - array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
452 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
453 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
454 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
455 | - array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
456 | - array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'balance[balance-integer]', '', '', '', 'search_int_type', ''), |
|
457 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit[credit_limit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit_limit[credit_limit-integer]', '', '', '', 'search_int_type', ''), |
|
458 | - array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
459 | - array(gettext('First Used'), 'INPUT', array('name' => 'first_used[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'first_used'), '', 'tOOL TIP', '', 'first_used[first_used-date]'), |
|
460 | - array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry[0]', 'id' => 'expiry', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'expiry[expiry-date]'), |
|
461 | - array('CC', 'INPUT', array('name' => 'maxchannels[maxchannels]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'maxchannels[maxchannels]', '', '', '', 'search_string_type', ''), |
|
462 | - array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
463 | - array(gettext('Created Date'), 'INPUT', array('name' => 'creation[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'creation'), '', 'tOOL TIP', '', 'creation[creation-date]'), |
|
464 | - array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type_search'), |
|
465 | - array(gettext('Billing Cycle'), 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_Billing_Schedule_status'), |
|
466 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
467 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
468 | - ); |
|
450 | + $form[gettext('Search')] = array( |
|
451 | + array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
452 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
453 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
454 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
455 | + array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
456 | + array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'balance[balance-integer]', '', '', '', 'search_int_type', ''), |
|
457 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit[credit_limit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit_limit[credit_limit-integer]', '', '', '', 'search_int_type', ''), |
|
458 | + array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
459 | + array(gettext('First Used'), 'INPUT', array('name' => 'first_used[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'first_used'), '', 'tOOL TIP', '', 'first_used[first_used-date]'), |
|
460 | + array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry[0]', 'id' => 'expiry', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'expiry[expiry-date]'), |
|
461 | + array('CC', 'INPUT', array('name' => 'maxchannels[maxchannels]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'maxchannels[maxchannels]', '', '', '', 'search_string_type', ''), |
|
462 | + array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
463 | + array(gettext('Created Date'), 'INPUT', array('name' => 'creation[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'creation'), '', 'tOOL TIP', '', 'creation[creation-date]'), |
|
464 | + array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type_search'), |
|
465 | + array(gettext('Billing Cycle'), 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_Billing_Schedule_status'), |
|
466 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
467 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
468 | + ); |
|
469 | 469 | |
470 | - } |
|
470 | + } |
|
471 | 471 | |
472 | - $form['button_search'] = array('name' => 'action', 'id' => "account_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
473 | - $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'); |
|
474 | - |
|
475 | - return $form; |
|
476 | - } |
|
477 | - |
|
478 | - function get_reseller_search_form() { |
|
479 | - $form['forms'] = array("", array('id' => "account_search")); |
|
480 | - $form[gettext('Search')] = array( |
|
481 | - array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
482 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
483 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
484 | - array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
485 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
486 | - array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
487 | - array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type_search'), |
|
488 | - array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'balance[balance-integer]', '', '', '', 'search_int_type', ''), |
|
472 | + $form['button_search'] = array('name' => 'action', 'id' => "account_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
473 | + $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'); |
|
474 | + |
|
475 | + return $form; |
|
476 | + } |
|
477 | + |
|
478 | + function get_reseller_search_form() { |
|
479 | + $form['forms'] = array("", array('id' => "account_search")); |
|
480 | + $form[gettext('Search')] = array( |
|
481 | + array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
482 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
483 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
484 | + array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
485 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
486 | + array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
487 | + array(gettext('Account Type'), 'posttoexternal', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type_search'), |
|
488 | + array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'balance[balance-integer]', '', '', '', 'search_int_type', ''), |
|
489 | 489 | |
490 | - array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit[credit_limit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit_limit[credit_limit-integer]', '', '', '', 'search_int_type', ''), |
|
491 | - array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
492 | - array(gettext('Created Date'), 'INPUT', array('name' => 'creation[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'creation'), '', 'tOOL TIP', '', 'creation[creation-date]'), |
|
493 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
494 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
495 | - ); |
|
496 | - |
|
497 | - $form['button_search'] = array('name' => 'action', 'id' => "account_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
498 | - $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'); |
|
499 | - |
|
500 | - return $form; |
|
501 | - } |
|
502 | - |
|
503 | - function get_admin_search_form() { |
|
504 | - $form['forms'] = array("", array('id' => "account_search")); |
|
505 | - $form['Search'] = array( |
|
506 | - array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
507 | - array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
508 | - array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
509 | - array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
510 | - array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
511 | - array(gettext('Entity Type'), 'type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_entity_type_admin'), |
|
512 | - array(gettext('Phone'), 'INPUT', array('name' => 'telephone_1[telephone_1]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'telephone_1[telephone_1-integer]', '', '', '', 'search_int_type', ''), |
|
513 | - array(gettext('Country'), 'country_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
514 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
515 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
516 | - ); |
|
517 | - |
|
518 | - $form['button_search'] = array('name' => 'action', 'id' => "account_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
519 | - $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'); |
|
520 | - |
|
521 | - return $form; |
|
522 | - } |
|
523 | - |
|
524 | - |
|
525 | - function build_account_list_for_admin() { |
|
526 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
527 | - $grid_field_arr = json_encode(array( |
|
528 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
529 | - array(gettext("Account"), "135", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"), |
|
530 | - array(gettext("First Name"), "150", "first_name", "", "", "","","true","center"), |
|
531 | - array(gettext("Last Name"), "150", "last_name", "", "", "","","true","center"), |
|
532 | - array(gettext("Company"), "150", "company_name", "", "", "","","true","center"), |
|
533 | - array(gettext("Email"), "170", "email", "", "", "","","true","center"), |
|
534 | - array(gettext("Phone"), "150", "telephone_1", "", "", "","","true","center"), |
|
535 | - array(gettext("Country"), "110", "country_id", "country", "countrycode", "get_field_name","","true","center"), |
|
536 | - array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"), |
|
537 | - /*******************************************************************/ |
|
538 | - array("Action", "100", "", "", "", array( |
|
539 | - "EDIT" => array("url" => "accounts/admin_edit/", "mode" => "single"), |
|
540 | - "DELETE" => array("url" => "accounts/admin_delete/", "mode" => "single") |
|
541 | - )) |
|
542 | - )); |
|
543 | - return $grid_field_arr; |
|
544 | - } |
|
545 | - |
|
546 | - function build_account_list_for_customer() { |
|
547 | - $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
548 | - $currency_id=$account_info['currency_id']; |
|
549 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
490 | + array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit[credit_limit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit_limit[credit_limit-integer]', '', '', '', 'search_int_type', ''), |
|
491 | + array(gettext('Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
492 | + array(gettext('Created Date'), 'INPUT', array('name' => 'creation[0]', '', 'size' => '20', 'class' => "text field", 'id' => 'creation'), '', 'tOOL TIP', '', 'creation[creation-date]'), |
|
493 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
494 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
495 | + ); |
|
496 | + |
|
497 | + $form['button_search'] = array('name' => 'action', 'id' => "account_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
498 | + $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'); |
|
499 | + |
|
500 | + return $form; |
|
501 | + } |
|
502 | + |
|
503 | + function get_admin_search_form() { |
|
504 | + $form['forms'] = array("", array('id' => "account_search")); |
|
505 | + $form['Search'] = array( |
|
506 | + array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
507 | + array(gettext('First Name'), 'INPUT', array('name' => 'first_name[first_name]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'first_name[first_name-string]', '', '', '', 'search_string_type', ''), |
|
508 | + array(gettext('Last Name'), 'INPUT', array('name' => 'last_name[last_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'last_name[last_name-string]', '', '', '', 'search_string_type', ''), |
|
509 | + array(gettext('Company'), 'INPUT', array('name' => 'company_name[company_name]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'company_name[company_name-string]', '', '', '', 'search_string_type', ''), |
|
510 | + array(gettext('Email'), 'INPUT', array('name' => 'email[email]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'email[email-string]', '', '', '', 'search_string_type', ''), |
|
511 | + array(gettext('Entity Type'), 'type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_entity_type_admin'), |
|
512 | + array(gettext('Phone'), 'INPUT', array('name' => 'telephone_1[telephone_1]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'telephone_1[telephone_1-integer]', '', '', '', 'search_int_type', ''), |
|
513 | + array(gettext('Country'), 'country_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''), array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
514 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
515 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
516 | + ); |
|
517 | + |
|
518 | + $form['button_search'] = array('name' => 'action', 'id' => "account_search_btn", 'content' => gettext('Search'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
519 | + $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'); |
|
520 | + |
|
521 | + return $form; |
|
522 | + } |
|
523 | + |
|
524 | + |
|
525 | + function build_account_list_for_admin() { |
|
526 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
527 | + $grid_field_arr = json_encode(array( |
|
528 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
529 | + array(gettext("Account"), "135", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"), |
|
530 | + array(gettext("First Name"), "150", "first_name", "", "", "","","true","center"), |
|
531 | + array(gettext("Last Name"), "150", "last_name", "", "", "","","true","center"), |
|
532 | + array(gettext("Company"), "150", "company_name", "", "", "","","true","center"), |
|
533 | + array(gettext("Email"), "170", "email", "", "", "","","true","center"), |
|
534 | + array(gettext("Phone"), "150", "telephone_1", "", "", "","","true","center"), |
|
535 | + array(gettext("Country"), "110", "country_id", "country", "countrycode", "get_field_name","","true","center"), |
|
536 | + array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"), |
|
537 | + /*******************************************************************/ |
|
538 | + array("Action", "100", "", "", "", array( |
|
539 | + "EDIT" => array("url" => "accounts/admin_edit/", "mode" => "single"), |
|
540 | + "DELETE" => array("url" => "accounts/admin_delete/", "mode" => "single") |
|
541 | + )) |
|
542 | + )); |
|
543 | + return $grid_field_arr; |
|
544 | + } |
|
545 | + |
|
546 | + function build_account_list_for_customer() { |
|
547 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
548 | + $currency_id=$account_info['currency_id']; |
|
549 | + $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
550 | 550 | |
551 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
552 | - $grid_field_arr = json_encode(array( |
|
553 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "","","","","false","center"), |
|
554 | - array(gettext("Account"), "125", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"), |
|
555 | - array(gettext("First Name"), "95", "first_name", "", "", "","","true","center"), |
|
556 | - array(gettext("Last Name"), "95", "last_name", "", "", "","","true","center"), |
|
557 | - array(gettext("Company"), "85", "company_name", "", "", "","","true","center"), |
|
558 | - array(gettext("Rate Group"), "85", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
559 | - array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency_account","","true","right"), |
|
560 | - array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency_account","","true","right"), |
|
561 | - array(gettext("First Used"), "80", "first_used", "", "", "","","true","center"), |
|
562 | - array(gettext("Expiry Date"), "80", "expiry", "", "", "","","true","center"), |
|
563 | - array("CC", "45", "maxchannels", "", "", "","","true","center"), |
|
564 | - array(gettext("Status"), "90", "status", "status", "accounts", "get_status","","true","center"), |
|
565 | - array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"), |
|
566 | - /************************************************************************/ |
|
567 | - array(gettext("Action"), "140", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"), |
|
568 | - "CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => "popup"), |
|
569 | - "EDIT" => array("url" => "accounts/customer_edit/", "mode" => "single"), |
|
570 | - "DELETE" => array("url" => "accounts/customer_delete/", "mode" => "single"))) |
|
571 | - )); |
|
572 | - return $grid_field_arr; |
|
573 | - } |
|
574 | - |
|
575 | - function build_account_list_for_reseller() { |
|
551 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
552 | + $grid_field_arr = json_encode(array( |
|
553 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "","","","","false","center"), |
|
554 | + array(gettext("Account"), "125", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"), |
|
555 | + array(gettext("First Name"), "95", "first_name", "", "", "","","true","center"), |
|
556 | + array(gettext("Last Name"), "95", "last_name", "", "", "","","true","center"), |
|
557 | + array(gettext("Company"), "85", "company_name", "", "", "","","true","center"), |
|
558 | + array(gettext("Rate Group"), "85", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
559 | + array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency_account","","true","right"), |
|
560 | + array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency_account","","true","right"), |
|
561 | + array(gettext("First Used"), "80", "first_used", "", "", "","","true","center"), |
|
562 | + array(gettext("Expiry Date"), "80", "expiry", "", "", "","","true","center"), |
|
563 | + array("CC", "45", "maxchannels", "", "", "","","true","center"), |
|
564 | + array(gettext("Status"), "90", "status", "status", "accounts", "get_status","","true","center"), |
|
565 | + array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"), |
|
566 | + /************************************************************************/ |
|
567 | + array(gettext("Action"), "140", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"), |
|
568 | + "CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => "popup"), |
|
569 | + "EDIT" => array("url" => "accounts/customer_edit/", "mode" => "single"), |
|
570 | + "DELETE" => array("url" => "accounts/customer_delete/", "mode" => "single"))) |
|
571 | + )); |
|
572 | + return $grid_field_arr; |
|
573 | + } |
|
574 | + |
|
575 | + function build_account_list_for_reseller() { |
|
576 | 576 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
577 | 577 | $currency_id=$account_info['currency_id']; |
578 | 578 | $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
579 | 579 | |
580 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
581 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
582 | - array(gettext("Account"), "105", "number", "", "", "", "EDITABLE","true","center"), |
|
583 | - array(gettext("First Name"), "120", "first_name", "", "", "","","true","center"), |
|
584 | - array(gettext("Last Name"), "115", "last_name", "", "", "","","true","center"), |
|
585 | - array(gettext("Company"), "130", "company_name", "", "", "","","true","center"), |
|
586 | - array(gettext("Rate Group"), "95", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
587 | - array(gettext("Account Type"), "107", "posttoexternal", "posttoexternal", "posttoexternal", "get_account_type","","true","center"), |
|
588 | - array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency","","true","right"), |
|
589 | - array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency","","true","right"), |
|
590 | - array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"), |
|
591 | - array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"), |
|
592 | - /**************************************************************/ |
|
593 | - array("Action", "139", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"), |
|
594 | - "CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => 'popup'), |
|
595 | - "EDIT" => array("url" => "accounts/reseller_edit/", "mode" => "single"), |
|
596 | - "DELETE" => array("url" => "accounts/reseller_delete/", "mode" => "single") |
|
597 | - )) |
|
598 | - )); |
|
599 | - return $grid_field_arr; |
|
600 | - } |
|
601 | - |
|
602 | - |
|
603 | - function build_grid_buttons_customer() { |
|
604 | - $logintype = $this->CI->session->userdata('userlevel_logintype'); |
|
605 | - $provider = null; |
|
606 | - if ($logintype != 1) |
|
607 | - $provider = array(gettext("Create Provider"), "btn btn-line-blue btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/provider_add/"); |
|
608 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
609 | - $buttons_json = json_encode(array( |
|
610 | - array(gettext("Create Customer"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add/"), |
|
611 | - array(gettext("Mass Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_bulk_creation/", "popup","medium"), |
|
612 | - $provider, |
|
613 | - array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/accounts/customer_export_cdr_xls/", 'single'), |
|
614 | - array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/customer_selected_delete/") |
|
615 | - )); |
|
616 | - return $buttons_json; |
|
617 | - } |
|
618 | - |
|
619 | - function build_grid_buttons_admin() { |
|
620 | - $buttons_json = json_encode(array( |
|
621 | - array(gettext("Create Admin"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/admin_add/"), |
|
622 | - array(gettext("Create Subadmin"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/subadmin_add/4"), |
|
623 | - array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/admin_selected_delete/") |
|
624 | - )); |
|
625 | - return $buttons_json; |
|
626 | - } |
|
627 | - |
|
628 | - function build_grid_buttons_reseller() { |
|
629 | - $buttons_json = json_encode(array( |
|
630 | - array(gettext("Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/reseller_add/"), |
|
631 | - array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/accounts/reseller_export_cdr_xls", 'single'), |
|
632 | - array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/reseller_selected_delete/") |
|
633 | - )); |
|
634 | - return $buttons_json; |
|
635 | - } |
|
636 | - |
|
637 | - function build_ip_list_for_customer($accountid, $accountype) { |
|
638 | - $grid_field_arr = json_encode(array( |
|
639 | - array(gettext('Name'), "180", "name", "", "", "","","true","center"), |
|
640 | - array(gettext('IP'), "180", "ip", "", "", "","","true","center"), |
|
641 | - array(gettext('Prefix'), "180", "prefix", "", "", "","","true","center"), |
|
642 | - array(gettext('Created Date'), "174", "created_date", "created_date", "created_date", "convert_GMT_to","","true","center"), |
|
643 | - array(gettext('Modified Date'), "160", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
644 | - array(gettext('Action'), "150", "", "", "", array("DELETE" => array("url" => "accounts/" . $accountype . "_ipmap_action/delete/$accountid/$accountype/", "mode" => "single"))) |
|
645 | - )); |
|
646 | - return $grid_field_arr; |
|
647 | - } |
|
648 | - |
|
649 | - function build_animap_list_for_customer($accountid, $accounttype) { |
|
650 | - $grid_field_arr = json_encode(array( |
|
651 | - array(gettext("Caller ID"), "200", "number", "", "", "","","true","center"), |
|
652 | - array(gettext("Status"), "180", "status", "status", "ani_map", "get_status_new","","true","center"), |
|
653 | - array(gettext("Created Date"), "200", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
654 | - array(gettext("Modified Date"), "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
655 | - array(gettext("Action"), "200", "", "", "", array("DELETE" => array("url" => "accounts/" . $accounttype . "_animap_action/delete/$accountid/", "mode" => "single"))) |
|
656 | - )); |
|
657 | - return $grid_field_arr; |
|
658 | - } |
|
659 | - |
|
660 | - function build_sipiax_list_for_customer() { |
|
661 | - $grid_field_arr = json_encode(array(array("Tech", "150", "tech", "", "", ""), |
|
662 | - array(gettext("Type"), "150", "type", "", "", ""), |
|
663 | - array(gettext("User Name"), "150", "username", "sweep", "sweeplist", "get_field_name"), |
|
664 | - array(gettext("Password"), "150", "secret", "", "", ""), |
|
665 | - array(gettext("Context"), "150", "context", "", "", ""))); |
|
666 | - return $grid_field_arr; |
|
667 | - } |
|
668 | - |
|
669 | - function set_block_pattern_action_buttons($id) { |
|
670 | - $ret_url = ''; |
|
671 | - $ret_url .= '<a href="/did/delete/' . $id . '/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();"> </a>'; |
|
672 | - return $ret_url; |
|
673 | - } |
|
674 | - |
|
675 | - function build_animap_list() { |
|
676 | - $grid_field_arr = json_encode(array(array("Caller ID", "180", "number", "", "", ""), |
|
677 | - array(gettext("status"),"180","status","status","animap","get_status"), |
|
678 | - array(gettext("Action"), "130", "", "", "", |
|
679 | - array( |
|
680 | - "EDIT_ANIMAP" => array("url" => "accounts/callingcards_animap_list_edit/", "mode" => "single"), |
|
681 | - "DELETE_ANIMAP" => array("url" => "accounts/callingcards_animap_list_remove/", "mode" => "single") |
|
682 | - ) |
|
683 | - ))); |
|
684 | - return $grid_field_arr; |
|
685 | - } |
|
686 | - |
|
687 | - function build_grid_buttons_destination() { |
|
688 | - $buttons_json = json_encode(array( |
|
689 | - )); |
|
690 | - return $buttons_json; |
|
691 | - } |
|
580 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
581 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
582 | + array(gettext("Account"), "105", "number", "", "", "", "EDITABLE","true","center"), |
|
583 | + array(gettext("First Name"), "120", "first_name", "", "", "","","true","center"), |
|
584 | + array(gettext("Last Name"), "115", "last_name", "", "", "","","true","center"), |
|
585 | + array(gettext("Company"), "130", "company_name", "", "", "","","true","center"), |
|
586 | + array(gettext("Rate Group"), "95", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
587 | + array(gettext("Account Type"), "107", "posttoexternal", "posttoexternal", "posttoexternal", "get_account_type","","true","center"), |
|
588 | + array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency","","true","right"), |
|
589 | + array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency","","true","right"), |
|
590 | + array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"), |
|
591 | + array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"), |
|
592 | + /**************************************************************/ |
|
593 | + array("Action", "139", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"), |
|
594 | + "CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => 'popup'), |
|
595 | + "EDIT" => array("url" => "accounts/reseller_edit/", "mode" => "single"), |
|
596 | + "DELETE" => array("url" => "accounts/reseller_delete/", "mode" => "single") |
|
597 | + )) |
|
598 | + )); |
|
599 | + return $grid_field_arr; |
|
600 | + } |
|
601 | + |
|
602 | + |
|
603 | + function build_grid_buttons_customer() { |
|
604 | + $logintype = $this->CI->session->userdata('userlevel_logintype'); |
|
605 | + $provider = null; |
|
606 | + if ($logintype != 1) |
|
607 | + $provider = array(gettext("Create Provider"), "btn btn-line-blue btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/provider_add/"); |
|
608 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
609 | + $buttons_json = json_encode(array( |
|
610 | + array(gettext("Create Customer"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add/"), |
|
611 | + array(gettext("Mass Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_bulk_creation/", "popup","medium"), |
|
612 | + $provider, |
|
613 | + array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/accounts/customer_export_cdr_xls/", 'single'), |
|
614 | + array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/customer_selected_delete/") |
|
615 | + )); |
|
616 | + return $buttons_json; |
|
617 | + } |
|
618 | + |
|
619 | + function build_grid_buttons_admin() { |
|
620 | + $buttons_json = json_encode(array( |
|
621 | + array(gettext("Create Admin"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/admin_add/"), |
|
622 | + array(gettext("Create Subadmin"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/subadmin_add/4"), |
|
623 | + array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/admin_selected_delete/") |
|
624 | + )); |
|
625 | + return $buttons_json; |
|
626 | + } |
|
627 | + |
|
628 | + function build_grid_buttons_reseller() { |
|
629 | + $buttons_json = json_encode(array( |
|
630 | + array(gettext("Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/reseller_add/"), |
|
631 | + array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/accounts/reseller_export_cdr_xls", 'single'), |
|
632 | + array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/reseller_selected_delete/") |
|
633 | + )); |
|
634 | + return $buttons_json; |
|
635 | + } |
|
636 | + |
|
637 | + function build_ip_list_for_customer($accountid, $accountype) { |
|
638 | + $grid_field_arr = json_encode(array( |
|
639 | + array(gettext('Name'), "180", "name", "", "", "","","true","center"), |
|
640 | + array(gettext('IP'), "180", "ip", "", "", "","","true","center"), |
|
641 | + array(gettext('Prefix'), "180", "prefix", "", "", "","","true","center"), |
|
642 | + array(gettext('Created Date'), "174", "created_date", "created_date", "created_date", "convert_GMT_to","","true","center"), |
|
643 | + array(gettext('Modified Date'), "160", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
644 | + array(gettext('Action'), "150", "", "", "", array("DELETE" => array("url" => "accounts/" . $accountype . "_ipmap_action/delete/$accountid/$accountype/", "mode" => "single"))) |
|
645 | + )); |
|
646 | + return $grid_field_arr; |
|
647 | + } |
|
648 | + |
|
649 | + function build_animap_list_for_customer($accountid, $accounttype) { |
|
650 | + $grid_field_arr = json_encode(array( |
|
651 | + array(gettext("Caller ID"), "200", "number", "", "", "","","true","center"), |
|
652 | + array(gettext("Status"), "180", "status", "status", "ani_map", "get_status_new","","true","center"), |
|
653 | + array(gettext("Created Date"), "200", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
654 | + array(gettext("Modified Date"), "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
655 | + array(gettext("Action"), "200", "", "", "", array("DELETE" => array("url" => "accounts/" . $accounttype . "_animap_action/delete/$accountid/", "mode" => "single"))) |
|
656 | + )); |
|
657 | + return $grid_field_arr; |
|
658 | + } |
|
659 | + |
|
660 | + function build_sipiax_list_for_customer() { |
|
661 | + $grid_field_arr = json_encode(array(array("Tech", "150", "tech", "", "", ""), |
|
662 | + array(gettext("Type"), "150", "type", "", "", ""), |
|
663 | + array(gettext("User Name"), "150", "username", "sweep", "sweeplist", "get_field_name"), |
|
664 | + array(gettext("Password"), "150", "secret", "", "", ""), |
|
665 | + array(gettext("Context"), "150", "context", "", "", ""))); |
|
666 | + return $grid_field_arr; |
|
667 | + } |
|
668 | + |
|
669 | + function set_block_pattern_action_buttons($id) { |
|
670 | + $ret_url = ''; |
|
671 | + $ret_url .= '<a href="/did/delete/' . $id . '/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();"> </a>'; |
|
672 | + return $ret_url; |
|
673 | + } |
|
674 | + |
|
675 | + function build_animap_list() { |
|
676 | + $grid_field_arr = json_encode(array(array("Caller ID", "180", "number", "", "", ""), |
|
677 | + array(gettext("status"),"180","status","status","animap","get_status"), |
|
678 | + array(gettext("Action"), "130", "", "", "", |
|
679 | + array( |
|
680 | + "EDIT_ANIMAP" => array("url" => "accounts/callingcards_animap_list_edit/", "mode" => "single"), |
|
681 | + "DELETE_ANIMAP" => array("url" => "accounts/callingcards_animap_list_remove/", "mode" => "single") |
|
682 | + ) |
|
683 | + ))); |
|
684 | + return $grid_field_arr; |
|
685 | + } |
|
686 | + |
|
687 | + function build_grid_buttons_destination() { |
|
688 | + $buttons_json = json_encode(array( |
|
689 | + )); |
|
690 | + return $buttons_json; |
|
691 | + } |
|
692 | 692 | |
693 | 693 | } |
694 | 694 |
@@ -54,30 +54,30 @@ |
||
54 | 54 | <div style="float:left; width:275px; margin-left:6px;"> |
55 | 55 | <li> |
56 | 56 | <?php |
57 | - $i = 1; |
|
57 | + $i = 1; |
|
58 | 58 | |
59 | - if (isset($taxesList) && is_array($taxesList) && count($taxesList) > 0) { |
|
60 | - echo "<table>"; |
|
61 | - foreach ($taxesList as $values) { |
|
62 | - if ($i == 1) |
|
63 | - echo"<tr>"; |
|
64 | - ?> |
|
59 | + if (isset($taxesList) && is_array($taxesList) && count($taxesList) > 0) { |
|
60 | + echo "<table>"; |
|
61 | + foreach ($taxesList as $values) { |
|
62 | + if ($i == 1) |
|
63 | + echo"<tr>"; |
|
64 | + ?> |
|
65 | 65 | <td style="padding-left: 10px;"> |
66 | 66 | <input type="checkbox" id="tax_<?= $values->id; ?>"name="tax_<?= $values->id; ?>" value="<?= $values->id; ?>" <? if (in_array($values->id, $tax_ids)) { |
67 | - echo "checked"; |
|
68 | - } ?>/> <?= $values->taxes_description; ?></label><br /> |
|
67 | + echo "checked"; |
|
68 | + } ?>/> <?= $values->taxes_description; ?></label><br /> |
|
69 | 69 | </td> |
70 | 70 | <?php |
71 | - if ($i % 3 == 0) { |
|
72 | - echo"</tr>"; |
|
73 | - $i = 1; |
|
74 | - } else { |
|
75 | - $i++; |
|
76 | - } |
|
77 | - } |
|
78 | - echo "</table>"; |
|
79 | - } |
|
80 | - ?> |
|
71 | + if ($i % 3 == 0) { |
|
72 | + echo"</tr>"; |
|
73 | + $i = 1; |
|
74 | + } else { |
|
75 | + $i++; |
|
76 | + } |
|
77 | + } |
|
78 | + echo "</table>"; |
|
79 | + } |
|
80 | + ?> |
|
81 | 81 | </li> |
82 | 82 | </div> |
83 | 83 | </fieldset> |
@@ -26,11 +26,11 @@ |
||
26 | 26 | <? } ?> |
27 | 27 | |
28 | 28 | <!-- <?php |
29 | - $data_errrors = json_decode($validation_errors); |
|
30 | - foreach ($data_errrors as $key => $value) { |
|
31 | - echo $value . "<br/>"; |
|
32 | - } |
|
33 | - ?> |
|
29 | + $data_errrors = json_decode($validation_errors); |
|
30 | + foreach ($data_errrors as $key => $value) { |
|
31 | + echo $value . "<br/>"; |
|
32 | + } |
|
33 | + ?> |
|
34 | 34 | </div> |
35 | 35 | <?php echo $form; ?> --> |
36 | 36 | </div> |
@@ -207,12 +207,12 @@ |
||
207 | 207 | </div> |
208 | 208 | <?php |
209 | 209 | if($account_data['logo'] != ''){ |
210 | - $logo=$account_data['file']; |
|
210 | + $logo=$account_data['file']; |
|
211 | 211 | }else{ |
212 | - $logo=$account_data['logo']; |
|
212 | + $logo=$account_data['logo']; |
|
213 | 213 | } |
214 | - if($logo != ''){ |
|
215 | - $file_name= base_url()."upload/$logo"; |
|
214 | + if($logo != ''){ |
|
215 | + $file_name= base_url()."upload/$logo"; |
|
216 | 216 | ?> |
217 | 217 | |
218 | 218 | <div class='col-md-12 no-padding'> |
@@ -48,12 +48,12 @@ |
||
48 | 48 | print_error(ERR_STR); |
49 | 49 | </script> |
50 | 50 | <?php |
51 | - } |
|
52 | - $data_errrors = json_decode($validation_errors); |
|
53 | - foreach ($data_errrors as $key => $value) { |
|
54 | - echo $value . "<br/>"; |
|
55 | - } |
|
56 | - ?> |
|
51 | + } |
|
52 | + $data_errrors = json_decode($validation_errors); |
|
53 | + foreach ($data_errrors as $key => $value) { |
|
54 | + echo $value . "<br/>"; |
|
55 | + } |
|
56 | + ?> |
|
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | </div> |
@@ -56,18 +56,18 @@ |
||
56 | 56 | <div class="w-section inverse no-padding"> |
57 | 57 | <div style="color:red;margin-left: 60px;"> |
58 | 58 | <?php |
59 | - if (isset($validation_errors)) { |
|
60 | - $validation_array=json_decode($validation_errors); |
|
61 | - if(is_object($validation_array)){ |
|
62 | - $validation_array = get_object_vars($validation_array); |
|
63 | - foreach($validation_array as $key=>$value) |
|
64 | - echo $value."<br/>"; |
|
65 | - } |
|
66 | - else |
|
67 | - echo $validation_errors; |
|
59 | + if (isset($validation_errors)) { |
|
60 | + $validation_array=json_decode($validation_errors); |
|
61 | + if(is_object($validation_array)){ |
|
62 | + $validation_array = get_object_vars($validation_array); |
|
63 | + foreach($validation_array as $key=>$value) |
|
64 | + echo $value."<br/>"; |
|
65 | + } |
|
66 | + else |
|
67 | + echo $validation_errors; |
|
68 | 68 | |
69 | - } |
|
70 | - ?> |
|
69 | + } |
|
70 | + ?> |
|
71 | 71 | </div> |
72 | 72 | <?php echo $form; ?> |
73 | 73 | </div> |