@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->load->model('taxes_model'); |
| 34 | 34 | |
| 35 | 35 | if ($this->session->userdata('user_login') == FALSE) |
| 36 | - redirect(base_url() . '/astpp/login'); |
|
| 36 | + redirect(base_url().'/astpp/login'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | function taxes_add() { |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | function taxes_delete($id) { |
| 91 | 91 | $this->db->select('taxes_description'); |
| 92 | - $this->db->where('id',$id); |
|
| 93 | - $taxes_name=(array)$this->db->get('taxes')->first_row(); |
|
| 92 | + $this->db->where('id', $id); |
|
| 93 | + $taxes_name = (array)$this->db->get('taxes')->first_row(); |
|
| 94 | 94 | $this->taxes_model->remove_taxes($id); |
| 95 | 95 | $this->session->set_flashdata('astpp_notification', $taxes_name["taxes_description"].' Tax removed successfully!'); |
| 96 | - redirect(base_url() . 'taxes/taxes_list/'); |
|
| 96 | + redirect(base_url().'taxes/taxes_list/'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | function taxes_list() { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | function taxes_list_json() { |
| 110 | 110 | $json_data = array(); |
| 111 | 111 | $count_all = $this->taxes_model->get_taxes_list(false); |
| 112 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
| 112 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
| 113 | 113 | $json_data = $paging_data["json_paging"]; |
| 114 | 114 | |
| 115 | 115 | $query = $this->taxes_model->get_taxes_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $this->session->set_userdata('taxes_list_search', $this->input->post()); |
| 132 | 132 | } |
| 133 | 133 | if (@$ajax_search != 1) { |
| 134 | - redirect(base_url() . 'taxes/taxes_list/'); |
|
| 134 | + redirect(base_url().'taxes/taxes_list/'); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | function taxes_delete_multiple() { |
| 144 | 144 | $ids = $this->input->post("selected_ids", true); |
| 145 | 145 | $where = "id IN ($ids)"; |
| 146 | - $taxes_where="taxes_id IN(".$ids.")"; |
|
| 146 | + $taxes_where = "taxes_id IN(".$ids.")"; |
|
| 147 | 147 | $this->db->where($taxes_where); |
| 148 | 148 | $this->db->delete('taxes_to_accounts'); |
| 149 | 149 | $this->db->where($where); |
@@ -32,8 +32,9 @@ |
||
| 32 | 32 | $this->load->library('astpp/form'); |
| 33 | 33 | $this->load->model('taxes_model'); |
| 34 | 34 | |
| 35 | - if ($this->session->userdata('user_login') == FALSE) |
|
| 36 | - redirect(base_url() . '/astpp/login'); |
|
| 35 | + if ($this->session->userdata('user_login') == FALSE) { |
|
| 36 | + redirect(base_url() . '/astpp/login'); |
|
| 37 | + } |
|
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | function taxes_add() { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | # You should have received a copy of the GNU Affero General Public License |
| 21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ############################################################################### |
| 23 | -if (!defined('BASEPATH'))
|
|
| 23 | +if ( ! defined('BASEPATH'))
|
|
| 24 | 24 | exit('No direct script access allowed');
|
| 25 | 25 | |
| 26 | 26 | class Taxes_form {
|
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | $this->CI = & get_instance(); |
| 29 | 29 | } |
| 30 | 30 | function get_taxes_form_fields() {
|
| 31 | - $form['forms'] = array(base_url() . 'taxes/taxes_save/', array('id' => 'taxes_form', 'method' => 'POST', 'name' => 'taxes_form'));
|
|
| 31 | + $form['forms'] = array(base_url().'taxes/taxes_save/', array('id' => 'taxes_form', 'method' => 'POST', 'name' => 'taxes_form'));
|
|
| 32 | 32 | $form['Tax Information'] = array( |
| 33 | 33 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
|
| 34 | - array('Name', 'INPUT', array('name' => 'taxes_description', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
|
|
| 34 | + array('Name', 'INPUT', array('name' => 'taxes_description', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
|
|
| 35 | 35 | array('Priority', 'INPUT', array('name' => 'taxes_priority', 'size' => '20', 'maxlength' => '5', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', ''),
|
| 36 | 36 | array('Amount', 'INPUT', array('name' => 'taxes_amount', 'size' => '20', 'maxlength' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
|
| 37 | - array('Rate(%)', 'INPUT', array('name' => 'taxes_rate', 'size' => '20','maxlength' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
|
|
| 37 | + array('Rate(%)', 'INPUT', array('name' => 'taxes_rate', 'size' => '20', 'maxlength' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
|
|
| 38 | 38 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
|
| 39 | 39 | |
| 40 | 40 | ); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $form['Search'] = array( |
| 49 | 49 | array('Name', 'INPUT', array('name' => 'taxes_description[taxes_description]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'taxes_description[taxes_description-string]', '', '', '', 'search_string_type', ''),
|
| 50 | 50 | array('Amount', 'INPUT', array('name' => 'taxes_amount[taxes_amount]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'taxes_amount[taxes_amount-integer]', '', '', '', 'search_int_type', ''),
|
| 51 | - array('Rate(%)', 'INPUT', array('name' => 'taxes_rate[taxes_rate]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'taxes_rate[taxes_rate-integer]', '', '', '', 'search_int_type', ''), array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
|
|
| 51 | + array('Rate(%)', 'INPUT', array('name' => 'taxes_rate[taxes_rate]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'taxes_rate[taxes_rate-integer]', '', '', '', 'search_int_type', ''), array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
|
|
| 52 | 52 | array('', 'HIDDEN', 'advance_search', '1', '', '', '')
|
| 53 | 53 | ); |
| 54 | 54 | $form['button_search'] = array('name' => 'action', 'id' => "taxes_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
|
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | function build_taxes_list_for_admin() {
|
| 60 | 60 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
|
| 61 | - $currency_id=$account_info['currency_id']; |
|
| 62 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
|
|
| 63 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
|
|
| 64 | - array("Name", "270", "taxes_description", "", "", "","","true","center"),
|
|
| 65 | - array("Priority", "145", "taxes_priority", "", "", "","","true","center"),
|
|
| 66 | - array("Amount($currency)", "260", "taxes_amount", "taxes_amount", "taxes_amount", "convert_to_currency","","true","right"),
|
|
| 67 | - array("Rate(%)", "230", "taxes_rate", "", "", "","","true","right"),
|
|
| 68 | - array("Status", "160", "status", "status", "taxes", "get_status","","true","center"),
|
|
| 61 | + $currency_id = $account_info['currency_id']; |
|
| 62 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
|
|
| 63 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
|
|
| 64 | + array("Name", "270", "taxes_description", "", "", "", "", "true", "center"),
|
|
| 65 | + array("Priority", "145", "taxes_priority", "", "", "", "", "true", "center"),
|
|
| 66 | + array("Amount($currency)", "260", "taxes_amount", "taxes_amount", "taxes_amount", "convert_to_currency", "", "true", "right"),
|
|
| 67 | + array("Rate(%)", "230", "taxes_rate", "", "", "", "", "true", "right"),
|
|
| 68 | + array("Status", "160", "status", "status", "taxes", "get_status", "", "true", "center"),
|
|
| 69 | 69 | array("Action", "175", "", "", "", array("EDIT" => array("url" => "taxes/taxes_edit/", "mode" => "popup"),
|
| 70 | 70 | "DELETE" => array("url" => "taxes/taxes_delete/", "mode" => "single")))
|
| 71 | 71 | )); |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | function build_grid_buttons() {
|
| 76 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/taxes/taxes_add/", "popup"),
|
|
| 77 | - array("Delete","btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/taxes/taxes_delete_multiple/")));
|
|
| 76 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/taxes/taxes_add/", "popup"),
|
|
| 77 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/taxes/taxes_delete_multiple/")));
|
|
| 78 | 78 | return $buttons_json; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -20,8 +20,9 @@ |
||
| 20 | 20 | # You should have received a copy of the GNU Affero General Public License |
| 21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ############################################################################### |
| 23 | -if (!defined('BASEPATH'))
|
|
| 24 | - exit('No direct script access allowed');
|
|
| 23 | +if (!defined('BASEPATH')) { |
|
| 24 | + exit('No direct script access allowed'); |
|
| 25 | +} |
|
| 25 | 26 | |
| 26 | 27 | class Taxes_form {
|
| 27 | 28 | function __construct() {
|
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | return $query; |
| 43 | 43 | } |
| 44 | - function get_reseller_package_list($flag,$accountid,$accounttype,$start = 0, $limit = 0){ |
|
| 45 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
| 44 | + function get_reseller_package_list($flag, $accountid, $accounttype, $start = 0, $limit = 0) { |
|
| 45 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
| 46 | 46 | $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
| 47 | - $like_str=!empty($instant_search) ? "(package_name like '%$instant_search%' |
|
| 48 | - OR includedseconds like '%$instant_search%')":null; |
|
| 49 | - $this->db->where('id',$accountid); |
|
| 47 | + $like_str = ! empty($instant_search) ? "(package_name like '%$instant_search%' |
|
| 48 | + OR includedseconds like '%$instant_search%')" : null; |
|
| 49 | + $this->db->where('id', $accountid); |
|
| 50 | 50 | $this->db->select('pricelist_id'); |
| 51 | - $account_info=(array)$this->db->get('accounts')->first_row(); |
|
| 52 | - $where=array('pricelist_id'=>$account_info['pricelist_id']); |
|
| 53 | - if(!empty($like_str)) |
|
| 51 | + $account_info = (array)$this->db->get('accounts')->first_row(); |
|
| 52 | + $where = array('pricelist_id'=>$account_info['pricelist_id']); |
|
| 53 | + if ( ! empty($like_str)) |
|
| 54 | 54 | $this->db->where($like_str); |
| 55 | 55 | if ($flag) { |
| 56 | 56 | $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
| 57 | - }else { |
|
| 57 | + } else { |
|
| 58 | 58 | $query = $this->db_model->countQuery("*", "packages", $where); |
| 59 | 59 | } |
| 60 | 60 | return $query; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /* |
| 69 | 69 | ASTPP 3.0 Add creation date |
| 70 | 70 | */ |
| 71 | - $add_array['creation_date']=gmdate('Y-m-d H:i:s'); |
|
| 71 | + $add_array['creation_date'] = gmdate('Y-m-d H:i:s'); |
|
| 72 | 72 | /*******************************************/ |
| 73 | 73 | $this->db->insert("packages", $add_array); |
| 74 | 74 | return true; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /* |
| 80 | 80 | ASTPP 3.0 add last modified field. |
| 81 | 81 | */ |
| 82 | - $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
| 82 | + $data['last_modified_date'] = gmdate('Y-m-d H:i:s'); |
|
| 83 | 83 | /********************************************/ |
| 84 | 84 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
| 85 | 85 | $account_data = $this->session->userdata("accountinfo"); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | /* ASTPP 3.0 |
| 95 | 95 | * Remove Package information from table package_patterns as well. |
| 96 | 96 | */ |
| 97 | - $this->db->where('package_id',$id); |
|
| 97 | + $this->db->where('package_id', $id); |
|
| 98 | 98 | $this->db->delete('package_patterns'); |
| 99 | 99 | /***************************************/ |
| 100 | 100 | $this->db->where("id", $id); |
@@ -105,89 +105,89 @@ discard block |
||
| 105 | 105 | function getpackage_counter_list($flag, $start = 0, $limit = 0) { |
| 106 | 106 | $where = array(); |
| 107 | 107 | $accountinfo = $this->session->userdata('accountinfo'); |
| 108 | - $reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id']; |
|
| 109 | - $this->db->where('reseller_id',$reseller_id); |
|
| 108 | + $reseller_id = $accountinfo['type'] == -1 ? 0 : $accountinfo['id']; |
|
| 109 | + $this->db->where('reseller_id', $reseller_id); |
|
| 110 | 110 | $this->db->select('id'); |
| 111 | - $result=$this->db->get('accounts'); |
|
| 111 | + $result = $this->db->get('accounts'); |
|
| 112 | 112 | $this->db_model->build_search('package_list_search'); |
| 113 | - if($this->session->userdata('advance_search')!= 1){ |
|
| 114 | - if($result->num_rows() >0){ |
|
| 115 | - $acc_arr=array(); |
|
| 116 | - $result=$result->result_array(); |
|
| 117 | - foreach($result as $data){ |
|
| 118 | - $acc_arr[]=$data['id']; |
|
| 113 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 114 | + if ($result->num_rows() > 0) { |
|
| 115 | + $acc_arr = array(); |
|
| 116 | + $result = $result->result_array(); |
|
| 117 | + foreach ($result as $data) { |
|
| 118 | + $acc_arr[] = $data['id']; |
|
| 119 | 119 | } |
| 120 | - $this->db->where_in('accountid',$acc_arr); |
|
| 121 | - if($flag){ |
|
| 120 | + $this->db->where_in('accountid', $acc_arr); |
|
| 121 | + if ($flag) { |
|
| 122 | 122 | $this->db->select('*'); |
| 123 | 123 | } |
| 124 | - else{ |
|
| 124 | + else { |
|
| 125 | 125 | $this->db->select('count(id) as count'); |
| 126 | 126 | } |
| 127 | - if($flag){ |
|
| 127 | + if ($flag) { |
|
| 128 | 128 | $this->db->limit($limit, $start); |
| 129 | 129 | } |
| 130 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 131 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 132 | - }else{ |
|
| 133 | - $this->db->order_by('seconds','desc'); |
|
| 130 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') { |
|
| 131 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']); |
|
| 132 | + } else { |
|
| 133 | + $this->db->order_by('seconds', 'desc'); |
|
| 134 | 134 | } |
| 135 | - $result=$this->db->get('counters'); |
|
| 135 | + $result = $this->db->get('counters'); |
|
| 136 | 136 | // echo $this->db->last_query();exit; |
| 137 | - if($flag){ |
|
| 137 | + if ($flag) { |
|
| 138 | 138 | return $result; |
| 139 | - }else{ |
|
| 140 | - $result=$result->result_array(); |
|
| 139 | + } else { |
|
| 140 | + $result = $result->result_array(); |
|
| 141 | 141 | return $result[0]['count']; |
| 142 | 142 | } |
| 143 | - }else{ |
|
| 144 | - if($flag){ |
|
| 145 | - $query=(object)array('num_rows'=>0); |
|
| 143 | + } else { |
|
| 144 | + if ($flag) { |
|
| 145 | + $query = (object)array('num_rows'=>0); |
|
| 146 | 146 | } |
| 147 | - else{ |
|
| 148 | - $query=0; |
|
| 147 | + else { |
|
| 148 | + $query = 0; |
|
| 149 | 149 | } |
| 150 | 150 | return $query; |
| 151 | 151 | } |
| 152 | - }else{ |
|
| 152 | + } else { |
|
| 153 | 153 | |
| 154 | - if($result->num_rows() >0){ |
|
| 155 | - $acc_arr=array(); |
|
| 156 | - $result=$result->result_array(); |
|
| 157 | - foreach($result as $data){ |
|
| 158 | - $acc_arr[]=$data['id']; |
|
| 154 | + if ($result->num_rows() > 0) { |
|
| 155 | + $acc_arr = array(); |
|
| 156 | + $result = $result->result_array(); |
|
| 157 | + foreach ($result as $data) { |
|
| 158 | + $acc_arr[] = $data['id']; |
|
| 159 | 159 | } |
| 160 | - $this->db->where_in('accountid',$acc_arr); |
|
| 160 | + $this->db->where_in('accountid', $acc_arr); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if($flag){ |
|
| 163 | + if ($flag) { |
|
| 164 | 164 | $this->db->select('*'); |
| 165 | 165 | } |
| 166 | - else{ |
|
| 166 | + else { |
|
| 167 | 167 | $this->db->select('count(id) as count'); |
| 168 | 168 | } |
| 169 | - if($flag){ |
|
| 170 | - $this->db->order_by('seconds','desc'); |
|
| 169 | + if ($flag) { |
|
| 170 | + $this->db->order_by('seconds', 'desc'); |
|
| 171 | 171 | $this->db->limit($limit, $start); |
| 172 | 172 | } |
| 173 | - $result=$this->db->get('counters'); |
|
| 173 | + $result = $this->db->get('counters'); |
|
| 174 | 174 | // echo $this->db->last_query();exit; |
| 175 | - if($result->num_rows() > 0){ |
|
| 176 | - if($flag){ |
|
| 175 | + if ($result->num_rows() > 0) { |
|
| 176 | + if ($flag) { |
|
| 177 | 177 | |
| 178 | 178 | return $result; |
| 179 | - }else{ |
|
| 180 | - $result=$result->result_array(); |
|
| 179 | + } else { |
|
| 180 | + $result = $result->result_array(); |
|
| 181 | 181 | |
| 182 | 182 | return $result[0]['count']; |
| 183 | 183 | } |
| 184 | - }else{ |
|
| 185 | - if($flag){ |
|
| 184 | + } else { |
|
| 185 | + if ($flag) { |
|
| 186 | 186 | |
| 187 | - $query=(object)array('num_rows'=>0); |
|
| 187 | + $query = (object)array('num_rows'=>0); |
|
| 188 | 188 | } |
| 189 | - else{ |
|
| 190 | - $query=0; |
|
| 189 | + else { |
|
| 190 | + $query = 0; |
|
| 191 | 191 | } |
| 192 | 192 | // echo $this->db->last_query();exit; |
| 193 | 193 | return $query; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | //echo "<pre>"; prit_r($data); exit; |
| 200 | 200 | $this->db->select("pattern,comment"); |
| 201 | 201 | $this->db->where("id IN (".$data.")"); |
| 202 | - $result=$this->db->get("routes")->result_array(); |
|
| 202 | + $result = $this->db->get("routes")->result_array(); |
|
| 203 | 203 | |
| 204 | 204 | $tmp = array(); |
| 205 | 205 | foreach ($result as $key => $data_value) { |
@@ -50,11 +50,12 @@ discard block |
||
| 50 | 50 | $this->db->select('pricelist_id'); |
| 51 | 51 | $account_info=(array)$this->db->get('accounts')->first_row(); |
| 52 | 52 | $where=array('pricelist_id'=>$account_info['pricelist_id']); |
| 53 | - if(!empty($like_str)) |
|
| 54 | - $this->db->where($like_str); |
|
| 53 | + if(!empty($like_str)) { |
|
| 54 | + $this->db->where($like_str); |
|
| 55 | + } |
|
| 55 | 56 | if ($flag) { |
| 56 | 57 | $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
| 57 | - }else { |
|
| 58 | + } else { |
|
| 58 | 59 | $query = $this->db_model->countQuery("*", "packages", $where); |
| 59 | 60 | } |
| 60 | 61 | return $query; |
@@ -120,8 +121,7 @@ discard block |
||
| 120 | 121 | $this->db->where_in('accountid',$acc_arr); |
| 121 | 122 | if($flag){ |
| 122 | 123 | $this->db->select('*'); |
| 123 | - } |
|
| 124 | - else{ |
|
| 124 | + } else{ |
|
| 125 | 125 | $this->db->select('count(id) as count'); |
| 126 | 126 | } |
| 127 | 127 | if($flag){ |
@@ -129,27 +129,26 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
| 131 | 131 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
| 132 | - }else{ |
|
| 132 | + } else{ |
|
| 133 | 133 | $this->db->order_by('seconds','desc'); |
| 134 | 134 | } |
| 135 | 135 | $result=$this->db->get('counters'); |
| 136 | 136 | // echo $this->db->last_query();exit; |
| 137 | 137 | if($flag){ |
| 138 | 138 | return $result; |
| 139 | - }else{ |
|
| 139 | + } else{ |
|
| 140 | 140 | $result=$result->result_array(); |
| 141 | 141 | return $result[0]['count']; |
| 142 | 142 | } |
| 143 | - }else{ |
|
| 143 | + } else{ |
|
| 144 | 144 | if($flag){ |
| 145 | 145 | $query=(object)array('num_rows'=>0); |
| 146 | - } |
|
| 147 | - else{ |
|
| 146 | + } else{ |
|
| 148 | 147 | $query=0; |
| 149 | 148 | } |
| 150 | 149 | return $query; |
| 151 | 150 | } |
| 152 | - }else{ |
|
| 151 | + } else{ |
|
| 153 | 152 | |
| 154 | 153 | if($result->num_rows() >0){ |
| 155 | 154 | $acc_arr=array(); |
@@ -162,8 +161,7 @@ discard block |
||
| 162 | 161 | |
| 163 | 162 | if($flag){ |
| 164 | 163 | $this->db->select('*'); |
| 165 | - } |
|
| 166 | - else{ |
|
| 164 | + } else{ |
|
| 167 | 165 | $this->db->select('count(id) as count'); |
| 168 | 166 | } |
| 169 | 167 | if($flag){ |
@@ -176,17 +174,16 @@ discard block |
||
| 176 | 174 | if($flag){ |
| 177 | 175 | |
| 178 | 176 | return $result; |
| 179 | - }else{ |
|
| 177 | + } else{ |
|
| 180 | 178 | $result=$result->result_array(); |
| 181 | 179 | |
| 182 | 180 | return $result[0]['count']; |
| 183 | 181 | } |
| 184 | - }else{ |
|
| 182 | + } else{ |
|
| 185 | 183 | if($flag){ |
| 186 | 184 | |
| 187 | 185 | $query=(object)array('num_rows'=>0); |
| 188 | - } |
|
| 189 | - else{ |
|
| 186 | + } else{ |
|
| 190 | 187 | $query=0; |
| 191 | 188 | } |
| 192 | 189 | // echo $this->db->last_query();exit; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->load->library('csvreader'); |
| 36 | 36 | |
| 37 | 37 | if ($this->session->userdata('user_login') == FALSE) |
| 38 | - redirect(base_url() . '/astpp/login'); |
|
| 38 | + redirect(base_url().'/astpp/login'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | echo json_encode($json_data); |
| 68 | 68 | } |
| 69 | - function package_list_reseller($accountid,$accounttype){ |
|
| 69 | + function package_list_reseller($accountid, $accounttype) { |
|
| 70 | 70 | $json_data = array(); |
| 71 | - $count_all = $this->package_model->get_reseller_package_list(false,$accountid,$accounttype); |
|
| 71 | + $count_all = $this->package_model->get_reseller_package_list(false, $accountid, $accounttype); |
|
| 72 | 72 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
| 73 | 73 | $json_data = $paging_data["json_paging"]; |
| 74 | - $query = $this->package_model->get_reseller_package_list(true,$accountid,$accounttype,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
| 74 | + $query = $this->package_model->get_reseller_package_list(true, $accountid, $accounttype, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
| 75 | 75 | $grid_fields = json_decode($this->package_form->build_package_list_for_reseller()); |
| 76 | 76 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
| 77 | 77 | echo json_encode($json_data); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $this->session->set_userdata('package_list_search', $action); |
| 88 | 88 | } |
| 89 | 89 | if (@$ajax_search != 1) { |
| 90 | - redirect(base_url() . 'package/package_list/'); |
|
| 90 | + redirect(base_url().'package/package_list/'); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -105,30 +105,30 @@ discard block |
||
| 105 | 105 | function package_edit($edit_id = '') { |
| 106 | 106 | $data['page_title'] = 'Package Details'; |
| 107 | 107 | $accountinfo = $this->session->userdata("accountinfo"); |
| 108 | - $reseller_id=$accountinfo['type'] == 1 ? $accountinfo['id']:0; |
|
| 109 | - $package_result = $this->db_model->getSelect("*", " packages", array('id' => $edit_id,"reseller_id"=>$reseller_id)); |
|
| 108 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
| 109 | + $package_result = $this->db_model->getSelect("*", " packages", array('id' => $edit_id, "reseller_id"=>$reseller_id)); |
|
| 110 | 110 | if ($package_result->num_rows > 0) { |
| 111 | - $package_info=(array)$package_result->first_row(); |
|
| 111 | + $package_info = (array)$package_result->first_row(); |
|
| 112 | 112 | $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields($package_info['id']), $package_info); |
| 113 | - $data['edit_id']=$package_info['id']; |
|
| 113 | + $data['edit_id'] = $package_info['id']; |
|
| 114 | 114 | $this->load->view('view_packages_edit', $data); |
| 115 | 115 | } else { |
| 116 | - redirect(base_url() . 'package/package_list/'); |
|
| 116 | + redirect(base_url().'package/package_list/'); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - function package_save($id="") { |
|
| 120 | + function package_save($id = "") { |
|
| 121 | 121 | $add_array = $this->input->post(); |
| 122 | 122 | $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields($add_array['id']), $add_array); |
| 123 | 123 | if ($add_array['id'] != '') { |
| 124 | 124 | if ($this->form_validation->run() == FALSE) { |
| 125 | - $data['edit_id']= $add_array['id']; |
|
| 125 | + $data['edit_id'] = $add_array['id']; |
|
| 126 | 126 | $data['validation_errors'] = validation_errors(); |
| 127 | 127 | $this->load->view('view_packages_edit', $data); |
| 128 | 128 | } else { |
| 129 | 129 | $this->package_model->edit_package($add_array, $add_array['id']); |
| 130 | 130 | $this->session->set_flashdata('astpp_errormsg', 'Package updated successfully!'); |
| 131 | - redirect(base_url() . 'package/package_list/'); |
|
| 131 | + redirect(base_url().'package/package_list/'); |
|
| 132 | 132 | exit; |
| 133 | 133 | } |
| 134 | 134 | } else { |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | ASTPP 3.0 |
| 144 | 144 | For Email Broadcast when package is add |
| 145 | 145 | **/ |
| 146 | - $accountinfo = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $add_array['pricelist_id'],"status"=>0, "deleted"=>0)); |
|
| 146 | + $accountinfo = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $add_array['pricelist_id'], "status"=>0, "deleted"=>0)); |
|
| 147 | 147 | $accountinfo = $accountinfo->result_array(); |
| 148 | 148 | $this->session->set_flashdata('astpp_errormsg', 'Package added successfully!'); |
| 149 | - foreach($accountinfo as $key => $value){ |
|
| 149 | + foreach ($accountinfo as $key => $value) { |
|
| 150 | 150 | $this->common->mail_to_users('add_package', $value); |
| 151 | 151 | } |
| 152 | 152 | /**************************************/ |
| 153 | - redirect(base_url() . 'package/package_list/'); |
|
| 153 | + redirect(base_url().'package/package_list/'); |
|
| 154 | 154 | exit; |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | $package_detail = $this->db_model->getSelect("*", "packages", array("id"=>$id)); |
| 167 | 167 | $package_detail = $package_detail->result_array(); |
| 168 | 168 | $package_detail = $package_detail[0]; |
| 169 | - $accountinfo = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $package_detail['pricelist_id'],"status"=>0, "deleted"=>0)); |
|
| 169 | + $accountinfo = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $package_detail['pricelist_id'], "status"=>0, "deleted"=>0)); |
|
| 170 | 170 | $this->package_model->remove_package($id); |
| 171 | 171 | $this->session->set_flashdata('astpp_notification', 'Package removed successfully!'); |
| 172 | - foreach($accountinfo->result_array() as $key => $value){ |
|
| 172 | + foreach ($accountinfo->result_array() as $key => $value) { |
|
| 173 | 173 | $this->common->mail_to_users('remove_package', $value); |
| 174 | 174 | } |
| 175 | 175 | /******************************************/ |
| 176 | - redirect(base_url() . 'package/package_list/'); |
|
| 176 | + redirect(base_url().'package/package_list/'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | function package_delete_multiple() { |
@@ -183,28 +183,28 @@ discard block |
||
| 183 | 183 | echo $this->db->delete("packages"); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - function package_pattern_list($package_id){ |
|
| 186 | + function package_pattern_list($package_id) { |
|
| 187 | 187 | $data['page_title'] = 'Package Codes'; |
| 188 | - if(!empty($package_id)){ |
|
| 188 | + if ( ! empty($package_id)) { |
|
| 189 | 189 | $data['grid_fields'] = $this->package_form->build_pattern_list_for_customer($package_id); |
| 190 | 190 | $data['grid_buttons'] = $this->package_form->set_pattern_grid_buttons($package_id); |
| 191 | 191 | $data["edit_id"] = $package_id; |
| 192 | - $this->load->view("view_package_pattern_list",$data); |
|
| 193 | - }else{ |
|
| 192 | + $this->load->view("view_package_pattern_list", $data); |
|
| 193 | + } else { |
|
| 194 | 194 | redirect(base_url()."package/package_list/"); |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | - function package_pattern_list_json($package_id){ |
|
| 197 | + function package_pattern_list_json($package_id) { |
|
| 198 | 198 | $json_data = array(); |
| 199 | - $instant_search=$this->session->userdata('left_panel_search_package_pattern'); |
|
| 200 | - $like_str=!empty($instant_search) ? "(patterns like '%$instant_search%' OR destination like '%$instant_search%' )" :null; |
|
| 201 | - if(!empty($like_str)) |
|
| 199 | + $instant_search = $this->session->userdata('left_panel_search_package_pattern'); |
|
| 200 | + $like_str = ! empty($instant_search) ? "(patterns like '%$instant_search%' OR destination like '%$instant_search%' )" : null; |
|
| 201 | + if ( ! empty($like_str)) |
|
| 202 | 202 | $this->db->where($like_str); |
| 203 | 203 | $where = array('package_id' => $package_id); |
| 204 | 204 | $count_all = $this->db_model->countQuery("*", "package_patterns", $where); |
| 205 | 205 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
| 206 | 206 | $json_data = $paging_data["json_paging"]; |
| 207 | - if(!empty($like_str)) |
|
| 207 | + if ( ! empty($like_str)) |
|
| 208 | 208 | $this->db->where($like_str); |
| 209 | 209 | $pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
| 210 | 210 | |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | echo json_encode($json_data); |
| 239 | 239 | } |
| 240 | - function package_counter_report_export(){ |
|
| 240 | + function package_counter_report_export() { |
|
| 241 | 241 | $query = $this->db_model->getSelect("*", "counters", ''); |
| 242 | 242 | $outbound_array = array(); |
| 243 | 243 | ob_clean(); |
| 244 | - $outbound_array[] = array("Package Name", "Account", "Used Seconds"); |
|
| 244 | + $outbound_array[] = array("Package Name", "Account", "Used Seconds"); |
|
| 245 | 245 | if ($query->num_rows() > 0) { |
| 246 | 246 | |
| 247 | 247 | foreach ($query->result_array() as $row) { |
@@ -253,10 +253,10 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | $this->load->helper('csv'); |
| 256 | - array_to_csv($outbound_array, 'Usage_Report_' . date("Y-m-d") . '.csv'); |
|
| 256 | + array_to_csv($outbound_array, 'Usage_Report_'.date("Y-m-d").'.csv'); |
|
| 257 | 257 | |
| 258 | 258 | } |
| 259 | - function package_pattern_json($package_id){ |
|
| 259 | + function package_pattern_json($package_id) { |
|
| 260 | 260 | $json_data = array(); |
| 261 | 261 | $where = array('package_id' => $package_id); |
| 262 | 262 | |
@@ -283,37 +283,37 @@ discard block |
||
| 283 | 283 | function package_patterns_add_json($accountid) { |
| 284 | 284 | $this->load->module('rates/rates'); |
| 285 | 285 | $json_data = array(); |
| 286 | - $count_all = $this->rates_model->getunblocked_package_pattern($accountid,false); |
|
| 286 | + $count_all = $this->rates_model->getunblocked_package_pattern($accountid, false); |
|
| 287 | 287 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
| 288 | 288 | $json_data = $paging_data["json_paging"]; |
| 289 | 289 | |
| 290 | - $query = $this->rates->rates_model->getunblocked_package_pattern($accountid,true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
| 290 | + $query = $this->rates->rates_model->getunblocked_package_pattern($accountid, true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
| 291 | 291 | $grid_fields = json_decode($this->rates->rates_form->build_block_pattern_list_for_customer()); |
| 292 | 292 | $json_data['rows'] = $this->rates->form->build_grid($query, $grid_fields); |
| 293 | 293 | |
| 294 | 294 | echo json_encode($json_data); |
| 295 | 295 | } |
| 296 | 296 | function package_patterns_add_info($packageid) { |
| 297 | - $result = $this->package_model->insert_package_pattern($this->input->post('prefixies', true),$packageid); |
|
| 297 | + $result = $this->package_model->insert_package_pattern($this->input->post('prefixies', true), $packageid); |
|
| 298 | 298 | unset($_POST); |
| 299 | 299 | echo $result; |
| 300 | 300 | exit; |
| 301 | 301 | } |
| 302 | 302 | function package_patterns_delete($packageid, $patternid) { |
| 303 | 303 | $this->db->delete("package_patterns", array("id" => $patternid)); |
| 304 | - redirect(base_url() . "package/package_pattern_list/$packageid"); |
|
| 304 | + redirect(base_url()."package/package_pattern_list/$packageid"); |
|
| 305 | 305 | } |
| 306 | - function package_patterns_selected_delete(){ |
|
| 306 | + function package_patterns_selected_delete() { |
|
| 307 | 307 | $ids = $this->input->post("selected_ids", true); |
| 308 | 308 | $where = "id IN ($ids)"; |
| 309 | 309 | unset($_POST); |
| 310 | - echo $this->db->delete("package_patterns",$where); |
|
| 310 | + echo $this->db->delete("package_patterns", $where); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - function package_quick_search($module_name){ |
|
| 313 | + function package_quick_search($module_name) { |
|
| 314 | 314 | $action = $this->input->post(); |
| 315 | - $this->session->set_userdata('left_panel_search_package_pattern',""); |
|
| 316 | - if(!empty($action['left_panel_search'])){ |
|
| 315 | + $this->session->set_userdata('left_panel_search_package_pattern', ""); |
|
| 316 | + if ( ! empty($action['left_panel_search'])) { |
|
| 317 | 317 | $this->session->set_userdata('left_panel_search_package_pattern', $action['left_panel_search']); |
| 318 | 318 | } |
| 319 | 319 | } |
@@ -322,22 +322,22 @@ discard block |
||
| 322 | 322 | function package_patterns_import($edit_id) { |
| 323 | 323 | //echo "nick";exit; |
| 324 | 324 | $data['page_title'] = 'Import Package Patterns'; |
| 325 | - $this->session->set_userdata('import_package_code_csv',""); |
|
| 326 | - $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
| 325 | + $this->session->set_userdata('import_package_code_csv', ""); |
|
| 326 | + $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
| 327 | 327 | $full_path = $this->config->item('rates-file-path'); |
| 328 | - if(file_exists($full_path.$error_data) && $error_data != ""){ |
|
| 328 | + if (file_exists($full_path.$error_data) && $error_data != "") { |
|
| 329 | 329 | unlink($full_path.$error_data); |
| 330 | - $this->session->set_userdata('import_package_code_csv_error',""); |
|
| 330 | + $this->session->set_userdata('import_package_code_csv_error', ""); |
|
| 331 | 331 | } |
| 332 | 332 | $data['edit_id'] = $edit_id; |
| 333 | 333 | $this->load->view('view_import_package_code', $data); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | |
| 337 | - function package_patterns_download_sample_file($file_name){ |
|
| 337 | + function package_patterns_download_sample_file($file_name) { |
|
| 338 | 338 | $this->load->helper('download'); |
| 339 | 339 | $full_path = base_url()."assets/Rates_File/".$file_name.".csv"; |
| 340 | - $arrContextOptions=array( |
|
| 340 | + $arrContextOptions = array( |
|
| 341 | 341 | "ssl"=>array( |
| 342 | 342 | "verify_peer"=>false, |
| 343 | 343 | "verify_peer_name"=>false, |
@@ -348,75 +348,75 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| 351 | - function package_patterns_preview_file($edit_id){ |
|
| 352 | - $invalid_flag= false; |
|
| 353 | - $data=array(); |
|
| 351 | + function package_patterns_preview_file($edit_id) { |
|
| 352 | + $invalid_flag = false; |
|
| 353 | + $data = array(); |
|
| 354 | 354 | $data['page_title'] = 'Import Package Patterns'; |
| 355 | - $check_header=$this->input->post('check_header',true); |
|
| 356 | - if(empty($_FILES) || !isset($_FILES)){ |
|
| 355 | + $check_header = $this->input->post('check_header', true); |
|
| 356 | + if (empty($_FILES) || ! isset($_FILES)) { |
|
| 357 | 357 | redirect(base_url()."package/package_pattern_list/"); |
| 358 | 358 | } |
| 359 | - $get_extension=strpos($_FILES['package_code_import']['name'],'.'); |
|
| 359 | + $get_extension = strpos($_FILES['package_code_import']['name'], '.'); |
|
| 360 | 360 | $new_final_arr_key = $this->config->item('package-code-field'); |
| 361 | - if(!$get_extension){ |
|
| 362 | - $data['error']= "Please Upload File Atleast"; |
|
| 361 | + if ( ! $get_extension) { |
|
| 362 | + $data['error'] = "Please Upload File Atleast"; |
|
| 363 | 363 | } |
| 364 | 364 | //echo "<pre>";print_r($_FILES);exit; |
| 365 | - if (isset($_FILES['package_code_import']['name']) && $_FILES['package_code_import']['name'] != "" ) { |
|
| 366 | - list($txt,$ext) = explode(".", $_FILES['package_code_import']['name']); |
|
| 365 | + if (isset($_FILES['package_code_import']['name']) && $_FILES['package_code_import']['name'] != "") { |
|
| 366 | + list($txt, $ext) = explode(".", $_FILES['package_code_import']['name']); |
|
| 367 | 367 | |
| 368 | - if($ext == "csv" && $_FILES['package_code_import']['size'] > 0){ |
|
| 368 | + if ($ext == "csv" && $_FILES['package_code_import']['size'] > 0) { |
|
| 369 | 369 | $error = $_FILES['package_code_import']['error']; |
| 370 | 370 | if ($error == 0) { |
| 371 | 371 | $uploadedFile = $_FILES["package_code_import"]["tmp_name"]; |
| 372 | - $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header); |
|
| 373 | - if(!empty($csv_data)){ |
|
| 372 | + $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header); |
|
| 373 | + if ( ! empty($csv_data)) { |
|
| 374 | 374 | $full_path = $this->config->item('rates-file-path'); |
| 375 | 375 | //echo "<pre>";print_r($full_path);exit; |
| 376 | - $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext; |
|
| 376 | + $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s").".".$ext; |
|
| 377 | 377 | //echo "<pre>";print_r($actual_file_name);exit; |
| 378 | - if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) { |
|
| 379 | - $flag=false; |
|
| 378 | + if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) { |
|
| 379 | + $flag = false; |
|
| 380 | 380 | //$data['trunkid']=isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0; |
| 381 | 381 | $data['csv_tmp_data'] = $csv_data; |
| 382 | 382 | //$data['pricelistid'] = $_POST['pricelist_id']; |
| 383 | 383 | $data['page_title'] = "Package Patterns Preview"; |
| 384 | - $data['check_header']=$check_header; |
|
| 385 | - $this->session->set_userdata('import_package_code_csv',$actual_file_name); |
|
| 386 | - }else{ |
|
| 384 | + $data['check_header'] = $check_header; |
|
| 385 | + $this->session->set_userdata('import_package_code_csv', $actual_file_name); |
|
| 386 | + } else { |
|
| 387 | 387 | $data['error'] = "File Uploading Fail Please Try Again"; |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | - else{ |
|
| 392 | - $data['error']=="File Uploading Fail Please Try Again"; |
|
| 391 | + else { |
|
| 392 | + $data['error'] == "File Uploading Fail Please Try Again"; |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | else { |
| 396 | 396 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
| 397 | 397 | } |
| 398 | - }else{ |
|
| 399 | - $invalid_flag=true; |
|
| 398 | + } else { |
|
| 399 | + $invalid_flag = true; |
|
| 400 | 400 | } |
| 401 | 401 | if ($invalid_flag) { |
| 402 | 402 | $str = ''; |
| 403 | 403 | if (empty($_FILES['package_code_import']['name'])) { |
| 404 | - $str.= '<br/>Please Select File.'; |
|
| 404 | + $str .= '<br/>Please Select File.'; |
|
| 405 | 405 | } |
| 406 | - $data['error']=$str; |
|
| 406 | + $data['error'] = $str; |
|
| 407 | 407 | } |
| 408 | 408 | $data['edit_id'] = $edit_id; |
| 409 | 409 | $this->load->view('view_import_package_code', $data); |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | |
| 413 | - function package_patterns_import_file($edit_id,$check_header=false) { |
|
| 413 | + function package_patterns_import_file($edit_id, $check_header = false) { |
|
| 414 | 414 | //echo $edit_id."===="; exit; |
| 415 | 415 | $new_final_arr = array(); |
| 416 | 416 | $invalid_array = array(); |
| 417 | 417 | $new_final_arr_key = $this->config->item('package-code-field'); |
| 418 | 418 | $screen_path = $this->config->item('screen_path'); |
| 419 | - $reseller_id=0; |
|
| 419 | + $reseller_id = 0; |
|
| 420 | 420 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
| 421 | 421 | $reseller_id = $this->session->userdata["accountinfo"]['id']; |
| 422 | 422 | } |
@@ -424,113 +424,113 @@ discard block |
||
| 424 | 424 | $full_path = $this->config->item('rates-file-path'); |
| 425 | 425 | //echo "<pre>";print_r($full_path);exit; |
| 426 | 426 | $originationrate_file_name = $this->session->userdata('import_package_code_csv'); |
| 427 | - $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); |
|
| 427 | + $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name, $new_final_arr_key, $check_header); |
|
| 428 | 428 | //echo "<pre>";print_r($csv_tmp_data);exit; |
| 429 | - $i=0; |
|
| 430 | - $pattern_arr=array(); |
|
| 429 | + $i = 0; |
|
| 430 | + $pattern_arr = array(); |
|
| 431 | 431 | foreach ($csv_tmp_data as $key => $csv_data) { |
| 432 | - if(isset($csv_data['patterns']) && $csv_data['patterns']!= '' && $i != 0){ |
|
| 433 | - $str=null; |
|
| 434 | - $pattern=$csv_data['patterns']; |
|
| 435 | - if(!in_array($csv_data['patterns'],$pattern_arr)){ |
|
| 432 | + if (isset($csv_data['patterns']) && $csv_data['patterns'] != '' && $i != 0) { |
|
| 433 | + $str = null; |
|
| 434 | + $pattern = $csv_data['patterns']; |
|
| 435 | + if ( ! in_array($csv_data['patterns'], $pattern_arr)) { |
|
| 436 | 436 | $this->db->select('count(id) as count'); |
| 437 | - $this->db->where('patterns',"^".$csv_data['patterns'].".*"); |
|
| 438 | - $this->db->where('package_id',$edit_id); |
|
| 439 | - $pattern_res=(array)$this->db->get('package_patterns')->first_row(); |
|
| 440 | - if($pattern_res['count'] ==0){ |
|
| 441 | - $csv_data['destination']= isset($csv_data['destination'])? $csv_data['destination'] :''; |
|
| 442 | - $str=$this->data_validate($csv_data); |
|
| 443 | - if($str != ""){ |
|
| 444 | - $invalid_array[$i]=$csv_data; |
|
| 437 | + $this->db->where('patterns', "^".$csv_data['patterns'].".*"); |
|
| 438 | + $this->db->where('package_id', $edit_id); |
|
| 439 | + $pattern_res = (array)$this->db->get('package_patterns')->first_row(); |
|
| 440 | + if ($pattern_res['count'] == 0) { |
|
| 441 | + $csv_data['destination'] = isset($csv_data['destination']) ? $csv_data['destination'] : ''; |
|
| 442 | + $str = $this->data_validate($csv_data); |
|
| 443 | + if ($str != "") { |
|
| 444 | + $invalid_array[$i] = $csv_data; |
|
| 445 | 445 | $invalid_array[$i]['error'] = $str; |
| 446 | 446 | } |
| 447 | - else{ |
|
| 448 | - $csv_data['patterns'] = "^" . $csv_data['patterns'] . ".*"; |
|
| 447 | + else { |
|
| 448 | + $csv_data['patterns'] = "^".$csv_data['patterns'].".*"; |
|
| 449 | 449 | $csv_data['package_id'] = $edit_id; |
| 450 | - $new_final_arr[$i]=$csv_data; |
|
| 451 | - $pattern_arr[$csv_data['patterns']]=$csv_data['patterns']; |
|
| 450 | + $new_final_arr[$i] = $csv_data; |
|
| 451 | + $pattern_arr[$csv_data['patterns']] = $csv_data['patterns']; |
|
| 452 | 452 | } |
| 453 | - }else{ |
|
| 454 | - $invalid_array[$i]=$csv_data; |
|
| 453 | + } else { |
|
| 454 | + $invalid_array[$i] = $csv_data; |
|
| 455 | 455 | $invalid_array[$i]['error'] = "Duplicate pattern found from database."; |
| 456 | 456 | } |
| 457 | - }else{ |
|
| 458 | - $invalid_array[$i]=$csv_data; |
|
| 457 | + } else { |
|
| 458 | + $invalid_array[$i] = $csv_data; |
|
| 459 | 459 | $invalid_array[$i]['error'] = "Duplicate pattern found from import file"; |
| 460 | 460 | } |
| 461 | - $pattern_arr[$csv_data['patterns']]=$pattern; |
|
| 461 | + $pattern_arr[$csv_data['patterns']] = $pattern; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | $i++; |
| 465 | 465 | } |
| 466 | - if(!empty($new_final_arr)){ |
|
| 466 | + if ( ! empty($new_final_arr)) { |
|
| 467 | 467 | $result = $this->package_model->bulk_insert_package_pattern($new_final_arr); |
| 468 | 468 | } |
| 469 | 469 | //unlink($full_path.$originationrate_file_name); |
| 470 | - $count=count($invalid_array); |
|
| 470 | + $count = count($invalid_array); |
|
| 471 | 471 | //echo "<pre>";print_r($count);exit; |
| 472 | - if($count >0){ |
|
| 472 | + if ($count > 0) { |
|
| 473 | 473 | $session_id = "-1"; |
| 474 | 474 | $fp = fopen($full_path.$session_id.'.csv', 'w'); |
| 475 | - foreach($new_final_arr_key as $key=>$value){ |
|
| 476 | - $custom_array[0][$key]=ucfirst($key); |
|
| 475 | + foreach ($new_final_arr_key as $key=>$value) { |
|
| 476 | + $custom_array[0][$key] = ucfirst($key); |
|
| 477 | 477 | } |
| 478 | - $custom_array[0]['error']= "Error"; |
|
| 479 | - $invalid_array =array_merge($custom_array,$invalid_array); |
|
| 480 | - foreach($invalid_array as $err_data){ |
|
| 481 | - fputcsv($fp,$err_data); |
|
| 478 | + $custom_array[0]['error'] = "Error"; |
|
| 479 | + $invalid_array = array_merge($custom_array, $invalid_array); |
|
| 480 | + foreach ($invalid_array as $err_data) { |
|
| 481 | + fputcsv($fp, $err_data); |
|
| 482 | 482 | } |
| 483 | 483 | fclose($fp); |
| 484 | 484 | $this->session->set_userdata('import_package_code_csv_error', $session_id.".csv"); |
| 485 | 485 | $data["error"] = $invalid_array; |
| 486 | 486 | $data['packageid'] = $edit_id; |
| 487 | 487 | $data['impoted_count'] = count($new_final_arr); |
| 488 | - $data['failure_count'] = count($invalid_array)-1; |
|
| 488 | + $data['failure_count'] = count($invalid_array) - 1; |
|
| 489 | 489 | $data['page_title'] = 'Package Patterns Import Error'; |
| 490 | 490 | //print_r($data) ;exit; |
| 491 | - $this->load->view('view_import_error',$data); |
|
| 492 | - } else{ |
|
| 491 | + $this->load->view('view_import_error', $data); |
|
| 492 | + } else { |
|
| 493 | 493 | $this->session->set_flashdata('astpp_errormsg', 'Package patterns imported successfully!'); |
| 494 | 494 | //echo base_url()."package/package_pattern_list/" . $edit_id . "/";exit; |
| 495 | - redirect(base_url()."package/package_pattern_list/" . $edit_id . "/"); |
|
| 495 | + redirect(base_url()."package/package_pattern_list/".$edit_id."/"); |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - function data_validate($csvdata){ |
|
| 500 | - $str=null; |
|
| 499 | + function data_validate($csvdata) { |
|
| 500 | + $str = null; |
|
| 501 | 501 | $alpha_regex = "/^[a-z ,.'-]+$/i"; |
| 502 | 502 | $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i"; |
| 503 | 503 | $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; |
| 504 | - $str.= $csvdata['patterns']!= '' ? null : 'Code,'; |
|
| 505 | - $str=rtrim($str,','); |
|
| 506 | - if(!$str){ |
|
| 507 | - $str.= is_numeric($csvdata['patterns']) ? null : 'Code,'; |
|
| 504 | + $str .= $csvdata['patterns'] != '' ? null : 'Code,'; |
|
| 505 | + $str = rtrim($str, ','); |
|
| 506 | + if ( ! $str) { |
|
| 507 | + $str .= is_numeric($csvdata['patterns']) ? null : 'Code,'; |
|
| 508 | 508 | |
| 509 | - $str.= preg_match( $alpha_numeric_regex, $csvdata['destination'] ) ? null :'Destination,'; |
|
| 509 | + $str .= preg_match($alpha_numeric_regex, $csvdata['destination']) ? null : 'Destination,'; |
|
| 510 | 510 | |
| 511 | - if($str){ |
|
| 512 | - $str=rtrim($str,','); |
|
| 513 | - $error_field=explode(',',$str); |
|
| 511 | + if ($str) { |
|
| 512 | + $str = rtrim($str, ','); |
|
| 513 | + $error_field = explode(',', $str); |
|
| 514 | 514 | $count = count($error_field); |
| 515 | - $str.= $count > 1 ? ' are not valid' : ' is not Valid'; |
|
| 515 | + $str .= $count > 1 ? ' are not valid' : ' is not Valid'; |
|
| 516 | 516 | return $str; |
| 517 | 517 | } |
| 518 | - else{ |
|
| 518 | + else { |
|
| 519 | 519 | return false; |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | - else{ |
|
| 523 | - $str=rtrim($str,','); |
|
| 524 | - $error_field=explode(',',$str); |
|
| 522 | + else { |
|
| 523 | + $str = rtrim($str, ','); |
|
| 524 | + $error_field = explode(',', $str); |
|
| 525 | 525 | $count = count($error_field); |
| 526 | - $str.= $count > 1 ? ' are required' : ' is Required'; |
|
| 526 | + $str .= $count > 1 ? ' are required' : ' is Required'; |
|
| 527 | 527 | return $str; |
| 528 | 528 | } |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - function package_patterns_error_download(){ |
|
| 531 | + function package_patterns_error_download() { |
|
| 532 | 532 | $this->load->helper('download'); |
| 533 | - $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
| 533 | + $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
| 534 | 534 | $full_path = $this->config->item('rates-file-path'); |
| 535 | 535 | $data = file_get_contents($full_path.$error_data); |
| 536 | 536 | force_download("Package_Code_error.csv", $data); |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | $this->load->model('package_model'); |
| 35 | 35 | $this->load->library('csvreader'); |
| 36 | 36 | |
| 37 | - if ($this->session->userdata('user_login') == FALSE) |
|
| 38 | - redirect(base_url() . '/astpp/login'); |
|
| 37 | + if ($this->session->userdata('user_login') == FALSE) { |
|
| 38 | + redirect(base_url() . '/astpp/login'); |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | |
@@ -190,7 +191,7 @@ discard block |
||
| 190 | 191 | $data['grid_buttons'] = $this->package_form->set_pattern_grid_buttons($package_id); |
| 191 | 192 | $data["edit_id"] = $package_id; |
| 192 | 193 | $this->load->view("view_package_pattern_list",$data); |
| 193 | - }else{ |
|
| 194 | + } else{ |
|
| 194 | 195 | redirect(base_url()."package/package_list/"); |
| 195 | 196 | } |
| 196 | 197 | } |
@@ -198,14 +199,16 @@ discard block |
||
| 198 | 199 | $json_data = array(); |
| 199 | 200 | $instant_search=$this->session->userdata('left_panel_search_package_pattern'); |
| 200 | 201 | $like_str=!empty($instant_search) ? "(patterns like '%$instant_search%' OR destination like '%$instant_search%' )" :null; |
| 201 | - if(!empty($like_str)) |
|
| 202 | - $this->db->where($like_str); |
|
| 202 | + if(!empty($like_str)) { |
|
| 203 | + $this->db->where($like_str); |
|
| 204 | + } |
|
| 203 | 205 | $where = array('package_id' => $package_id); |
| 204 | 206 | $count_all = $this->db_model->countQuery("*", "package_patterns", $where); |
| 205 | 207 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
| 206 | 208 | $json_data = $paging_data["json_paging"]; |
| 207 | - if(!empty($like_str)) |
|
| 208 | - $this->db->where($like_str); |
|
| 209 | + if(!empty($like_str)) { |
|
| 210 | + $this->db->where($like_str); |
|
| 211 | + } |
|
| 209 | 212 | $pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
| 210 | 213 | |
| 211 | 214 | $grid_fields = json_decode($this->package_form->build_pattern_list_for_customer($package_id)); |
@@ -383,19 +386,17 @@ discard block |
||
| 383 | 386 | $data['page_title'] = "Package Patterns Preview"; |
| 384 | 387 | $data['check_header']=$check_header; |
| 385 | 388 | $this->session->set_userdata('import_package_code_csv',$actual_file_name); |
| 386 | - }else{ |
|
| 389 | + } else{ |
|
| 387 | 390 | $data['error'] = "File Uploading Fail Please Try Again"; |
| 388 | 391 | } |
| 389 | 392 | } |
| 390 | - } |
|
| 391 | - else{ |
|
| 393 | + } else{ |
|
| 392 | 394 | $data['error']=="File Uploading Fail Please Try Again"; |
| 393 | 395 | } |
| 394 | - } |
|
| 395 | - else { |
|
| 396 | + } else { |
|
| 396 | 397 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
| 397 | 398 | } |
| 398 | - }else{ |
|
| 399 | + } else{ |
|
| 399 | 400 | $invalid_flag=true; |
| 400 | 401 | } |
| 401 | 402 | if ($invalid_flag) { |
@@ -443,18 +444,17 @@ discard block |
||
| 443 | 444 | if($str != ""){ |
| 444 | 445 | $invalid_array[$i]=$csv_data; |
| 445 | 446 | $invalid_array[$i]['error'] = $str; |
| 446 | - } |
|
| 447 | - else{ |
|
| 447 | + } else{ |
|
| 448 | 448 | $csv_data['patterns'] = "^" . $csv_data['patterns'] . ".*"; |
| 449 | 449 | $csv_data['package_id'] = $edit_id; |
| 450 | 450 | $new_final_arr[$i]=$csv_data; |
| 451 | 451 | $pattern_arr[$csv_data['patterns']]=$csv_data['patterns']; |
| 452 | 452 | } |
| 453 | - }else{ |
|
| 453 | + } else{ |
|
| 454 | 454 | $invalid_array[$i]=$csv_data; |
| 455 | 455 | $invalid_array[$i]['error'] = "Duplicate pattern found from database."; |
| 456 | 456 | } |
| 457 | - }else{ |
|
| 457 | + } else{ |
|
| 458 | 458 | $invalid_array[$i]=$csv_data; |
| 459 | 459 | $invalid_array[$i]['error'] = "Duplicate pattern found from import file"; |
| 460 | 460 | } |
@@ -514,12 +514,10 @@ discard block |
||
| 514 | 514 | $count = count($error_field); |
| 515 | 515 | $str.= $count > 1 ? ' are not valid' : ' is not Valid'; |
| 516 | 516 | return $str; |
| 517 | - } |
|
| 518 | - else{ |
|
| 517 | + } else{ |
|
| 519 | 518 | return false; |
| 520 | 519 | } |
| 521 | - } |
|
| 522 | - else{ |
|
| 520 | + } else{ |
|
| 523 | 521 | $str=rtrim($str,','); |
| 524 | 522 | $error_field=explode(',',$str); |
| 525 | 523 | $count = count($error_field); |
@@ -22,19 +22,19 @@ discard block |
||
| 22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | -if (!defined('BASEPATH'))
|
|
| 25 | +if ( ! defined('BASEPATH'))
|
|
| 26 | 26 | exit('No direct script access allowed');
|
| 27 | 27 | |
| 28 | 28 | class Package_form {
|
| 29 | 29 | |
| 30 | - function get_package_form_fields($id='') {
|
|
| 31 | - $form['forms'] = array(base_url() . 'package/package_save/'.$id."/",array('id'=>'packeage_form','method'=>'POST','name'=>'packeage_form'));
|
|
| 30 | + function get_package_form_fields($id = '') {
|
|
| 31 | + $form['forms'] = array(base_url().'package/package_save/'.$id."/", array('id'=>'packeage_form', 'method'=>'POST', 'name'=>'packeage_form'));
|
|
| 32 | 32 | $form['Package Information'] = array( |
| 33 | 33 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
|
| 34 | 34 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''),
|
| 35 | - array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
|
|
| 36 | - array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")),
|
|
| 37 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''),
|
|
| 35 | + array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
|
|
| 36 | + array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")),
|
|
| 37 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''),
|
|
| 38 | 38 | /** |
| 39 | 39 | ASTPP 3.0 |
| 40 | 40 | Add For Package Inbound or Outbound or both? |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | $form['forms'] = array("", array('id' => "package_search"));
|
| 54 | 54 | $form['Search'] = array( |
| 55 | 55 | array('Name', 'INPUT', array('name' => 'package_name[package_name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'package_name[package_name-string]', '', '', '', 'search_string_type', ''),
|
| 56 | - array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")),
|
|
| 56 | + array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")),
|
|
| 57 | 57 | array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
|
| 58 | 58 | /** |
| 59 | 59 | ASTPP 3.0 |
| 60 | 60 | Add For Package Inbound or Outbound or both? |
| 61 | 61 | **/ |
| 62 | - array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '',''),
|
|
| 62 | + array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '', ''),
|
|
| 63 | 63 | /*********************************************/ |
| 64 | 64 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
|
| 65 | 65 | |
@@ -75,28 +75,28 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | function build_package_list_for_admin() {
|
| 77 | 77 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 78 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
|
|
| 78 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
|
|
| 79 | 79 | /** |
| 80 | 80 | ASTPP 3.0 |
| 81 | 81 | For Package edit on Name |
| 82 | 82 | **/ |
| 83 | - array("Name", "170", "package_name", "", "", "","EDITABLE","true","center"),
|
|
| 83 | + array("Name", "170", "package_name", "", "", "", "EDITABLE", "true", "center"),
|
|
| 84 | 84 | /***********************************/ |
| 85 | - array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
|
|
| 86 | - array("Included Seconds", "160", "includedseconds", "", "", "","","true","center"),
|
|
| 85 | + array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
|
|
| 86 | + array("Included Seconds", "160", "includedseconds", "", "", "", "", "true", "center"),
|
|
| 87 | 87 | /** |
| 88 | 88 | ASTPP 3.0 |
| 89 | 89 | Add For Package Inbound or Outbound or both? |
| 90 | 90 | **/ |
| 91 | - array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type","","true","center"),
|
|
| 91 | + array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type", "", "true", "center"),
|
|
| 92 | 92 | /****************************************************/ |
| 93 | 93 | /* |
| 94 | 94 | ASTPP 3.0 |
| 95 | 95 | Creation date,last modified date show in grid |
| 96 | 96 | */ |
| 97 | - array("Status", "140", "status", "status", "packages", "get_status","","true","center"),
|
|
| 98 | - array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
|
|
| 99 | - array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
|
|
| 97 | + array("Status", "140", "status", "status", "packages", "get_status", "", "true", "center"),
|
|
| 98 | + array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
|
|
| 99 | + array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
|
|
| 100 | 100 | /***************************************************************/ |
| 101 | 101 | /* |
| 102 | 102 | ASTPP 3.0 |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | function build_grid_buttons() {
|
| 114 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"),
|
|
| 114 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"),
|
|
| 115 | 115 | array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/package/package_delete_multiple/")
|
| 116 | 116 | )); |
| 117 | 117 | return $buttons_json; |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | function build_package_counter_list_for_admin() {
|
| 123 | 123 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 124 | - $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name","","true","center"),
|
|
| 125 | - array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"),
|
|
| 126 | - array("Used Seconds", "420", "seconds", "", "", "","","true","center"),
|
|
| 124 | + $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name", "", "true", "center"),
|
|
| 125 | + array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"),
|
|
| 126 | + array("Used Seconds", "420", "seconds", "", "", "", "", "true", "center"),
|
|
| 127 | 127 | )); |
| 128 | 128 | return $grid_field_arr; |
| 129 | 129 | } |
| 130 | 130 | function build_pattern_list_for_customer($packageid) {
|
| 131 | 131 | $grid_field_arr = json_encode(array( |
| 132 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
|
|
| 132 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
|
|
| 133 | 133 | array("Code", "450", "patterns", "patterns", "", "get_only_numeric_val"),
|
| 134 | 134 | array("Destination", "450", "destination", "", "", ""),
|
| 135 | 135 | array("Action", "100", "", "", "", array("DELETE" => array("url" => "package/package_patterns_delete/$packageid/", "mode" => "single")))
|
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | return $grid_field_arr; |
| 138 | 138 | } |
| 139 | 139 | function set_pattern_grid_buttons($packageid) {
|
| 140 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup")));
|
|
| 140 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup")));
|
|
| 141 | 141 | return $buttons_json; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -145,17 +145,17 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | function build_package_counter_report() {
|
| 147 | 147 | $buttons_json = json_encode(array( |
| 148 | - array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single')
|
|
| 148 | + array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single')
|
|
| 149 | 149 | |
| 150 | 150 | )); |
| 151 | 151 | return $buttons_json; |
| 152 | 152 | } |
| 153 | - function build_package_list_for_reseller(){
|
|
| 153 | + function build_package_list_for_reseller() {
|
|
| 154 | 154 | $grid_field_arr = json_encode(array( |
| 155 | - array("Name", "310", "package_name", "", "", "","","true","center"),
|
|
| 156 | - array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
|
|
| 157 | - array("Included Seconds", "260", "includedseconds", "", "", "","","true","center"),
|
|
| 158 | - array("Status", "160", "status", "status", "status", "get_status","","true","center"),
|
|
| 155 | + array("Name", "310", "package_name", "", "", "", "", "true", "center"),
|
|
| 156 | + array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
|
|
| 157 | + array("Included Seconds", "260", "includedseconds", "", "", "", "", "true", "center"),
|
|
| 158 | + array("Status", "160", "status", "status", "status", "get_status", "", "true", "center"),
|
|
| 159 | 159 | )); |
| 160 | 160 | return $grid_field_arr; |
| 161 | 161 | } |
@@ -22,8 +22,9 @@ |
||
| 22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | -if (!defined('BASEPATH'))
|
|
| 26 | - exit('No direct script access allowed');
|
|
| 25 | +if (!defined('BASEPATH')) { |
|
| 26 | + exit('No direct script access allowed'); |
|
| 27 | +} |
|
| 27 | 28 | |
| 28 | 29 | class Package_form {
|
| 29 | 30 | |
@@ -2,20 +2,20 @@ discard block |
||
| 2 | 2 | <? startblock('extra_head') ?> |
| 3 | 3 | <? endblock() ?> |
| 4 | 4 | <? startblock('page-title') ?> |
| 5 | -<?= $page_title;?> |
|
| 5 | +<?= $page_title; ?> |
|
| 6 | 6 | <? endblock() ?> |
| 7 | 7 | <? startblock('content') ?> |
| 8 | - <?php if(!isset($csv_tmp_data)){ ?> |
|
| 8 | + <?php if ( ! isset($csv_tmp_data)) { ?> |
|
| 9 | 9 | |
| 10 | 10 | <section class="slice color-three padding-t-20"> |
| 11 | 11 | <div class="w-section inverse no-padding"> |
| 12 | 12 | <div class="container"> |
| 13 | - <form method="post" action="<?= base_url().'package/package_patterns_preview_file/'.$edit_id . "/"?>" enctype="multipart/form-data" id="package_code"> |
|
| 13 | + <form method="post" action="<?= base_url().'package/package_patterns_preview_file/'.$edit_id."/"?>" enctype="multipart/form-data" id="package_code"> |
|
| 14 | 14 | <div class="row"> |
| 15 | 15 | <div class="col-md-12"> |
| 16 | 16 | <div class="w-box"> |
| 17 | 17 | <span style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;"> |
| 18 | - <? if(isset($error) && !empty($error)) { |
|
| 18 | + <? if (isset($error) && ! empty($error)) { |
|
| 19 | 19 | echo $error; |
| 20 | 20 | }?> |
| 21 | 21 | </span> |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | </div> |
| 36 | 36 | </div> |
| 37 | 37 | <? |
| 38 | - $logintype=$this->session->userdata('userlevel_logintype'); |
|
| 38 | + $logintype = $this->session->userdata('userlevel_logintype'); |
|
| 39 | 39 | // $trunk=null; |
| 40 | - if($logintype !=1) { ?> |
|
| 40 | + if ($logintype != 1) { ?> |
|
| 41 | 41 | <div class="col-md-12 no-padding"> |
| 42 | 42 | |
| 43 | 43 | <div> |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | <?}?> |
| 98 | 98 | |
| 99 | 99 | <?php |
| 100 | - if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
| 100 | + if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?> |
|
| 101 | 101 | |
| 102 | 102 | <section class="slice color-three"> |
| 103 | 103 | <div class="w-section inverse no-padding"> |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | <div class="col-md-12 margin-t-10"> |
| 107 | 107 | <form id="import_form" name="import_form" action="<?=base_url()?>package/package_patterns_import_file/<?=$edit_id?>/<?=$check_header?>/" method="POST"> |
| 108 | 108 | <table width="100%" border="1" class="details_table table"> |
| 109 | - <? $cnt =7; |
|
| 110 | - foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
| 111 | - if($csv_key < 15){ |
|
| 109 | + <? $cnt = 7; |
|
| 110 | + foreach ($csv_tmp_data as $csv_key => $csv_value) { |
|
| 111 | + if ($csv_key < 15) { |
|
| 112 | 112 | echo "<tr>"; |
| 113 | - foreach($csv_value as $field_name => $field_val){ |
|
| 114 | - if($csv_key == 0){ |
|
| 113 | + foreach ($csv_value as $field_name => $field_val) { |
|
| 114 | + if ($csv_key == 0) { |
|
| 115 | 115 | echo "<th>".ucfirst($field_name)."</th>"; |
| 116 | - }else{ |
|
| 116 | + } else { |
|
| 117 | 117 | echo "<td class='portlet-content'>".$field_val."</td>"; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | foreach($csv_value as $field_name => $field_val){ |
| 105 | 105 | if($csv_key == 0){ |
| 106 | 106 | echo "<th>".ucfirst($field_name)."</th>"; |
| 107 | - }else{ |
|
| 107 | + } else{ |
|
| 108 | 108 | echo "<td class='portlet-content'>".$field_val."</td>"; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <div class="w-section inverse no-padding"> |
| 13 | 13 | <?php echo $form; ?> |
| 14 | 14 | <?php |
| 15 | - if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
| 15 | + if (isset($validation_errors) && $validation_errors != '') { ?> |
|
| 16 | 16 | <script> |
| 17 | 17 | var ERR_STR = '<?php echo $validation_errors; ?>'; |
| 18 | 18 | print_error(ERR_STR); |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | function user_model() { |
| 28 | 28 | parent::__construct(); |
| 29 | - if(Common_model::$global_config['system_config']['opensips']==0){ |
|
| 29 | + if (Common_model::$global_config['system_config']['opensips'] == 0) { |
|
| 30 | 30 | $db_config = Common_model::$global_config['system_config']; |
| 31 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
| 31 | + $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
| 32 | 32 | $this->opensips_db = $this->load->database($opensipdsn, true); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | $this->db->select('count(id) as count'); |
| 92 | 92 | } |
| 93 | 93 | if ($flag) { |
| 94 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 95 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 96 | - }else{ |
|
| 94 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') { |
|
| 95 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']); |
|
| 96 | + } else { |
|
| 97 | 97 | $this->db->order_by('invoice_date', 'desc'); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | 109 | if ($flag) { |
| 110 | - $query = (object) array('num_rows' => 0); |
|
| 110 | + $query = (object)array('num_rows' => 0); |
|
| 111 | 111 | } else { |
| 112 | 112 | $query = 0; |
| 113 | 113 | } |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | function get_user_charge_history($flag, $start = 0, $limit = 0) { |
| 119 | 119 | $this->db_model->build_search('user_charge_history_search'); |
| 120 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
| 121 | - $where['accountid']=$accountinfo['id']; |
|
| 122 | - if($this->session->userdata('advance_search') != 1){ |
|
| 123 | - $where['created_date >=']=gmdate("Y-m-1 00:00:00"); |
|
| 124 | - $where['created_date <=']=gmdate("Y-m-d 23:59:59"); |
|
| 120 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 121 | + $where['accountid'] = $accountinfo['id']; |
|
| 122 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 123 | + $where['created_date >='] = gmdate("Y-m-1 00:00:00"); |
|
| 124 | + $where['created_date <='] = gmdate("Y-m-d 23:59:59"); |
|
| 125 | 125 | } |
| 126 | - $where['item_type <>']='STANDARD'; |
|
| 126 | + $where['item_type <>'] = 'STANDARD'; |
|
| 127 | 127 | if ($flag) { |
| 128 | 128 | $query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start); |
| 129 | 129 | } else { |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | return true; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - function user_ipmap_list($flag,$limit='',$start=''){ |
|
| 178 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
| 179 | - $where['accountid']=$accountinfo['id']; |
|
| 177 | + function user_ipmap_list($flag, $limit = '', $start = '') { |
|
| 178 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 179 | + $where['accountid'] = $accountinfo['id']; |
|
| 180 | 180 | $this->db_model->build_search('user_ipmap_search'); |
| 181 | 181 | if ($flag) { |
| 182 | 182 | $query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | return $query; |
| 187 | 187 | } |
| 188 | - function user_sipdevices_list($flag, $accountid = "",$start = "", $limit = "") { |
|
| 188 | + function user_sipdevices_list($flag, $accountid = "", $start = "", $limit = "") { |
|
| 189 | 189 | $where = array("accountid" => $accountid); |
| 190 | 190 | $this->db_model->build_search('user_sipdevices_search'); |
| 191 | 191 | $query = array(); |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | return $query; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - function user_sipdevice_info($edit_id){ |
|
| 223 | + function user_sipdevice_info($edit_id) { |
|
| 224 | 224 | $sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array('id' => $edit_id)); |
| 225 | 225 | $sipdevice_arr = (array)$sipdevice_info->first_row(); |
| 226 | 226 | $vars = (array)json_decode($sipdevice_arr['dir_vars']); |
| 227 | - $params = (array)json_decode($sipdevice_arr['dir_params'],true); |
|
| 227 | + $params = (array)json_decode($sipdevice_arr['dir_params'], true); |
|
| 228 | 228 | $query = array('id' => $sipdevice_arr['id'], |
| 229 | 229 | 'fs_username' => $sipdevice_arr['username'], |
| 230 | 230 | 'accountcode' => $sipdevice_arr['accountid'], |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | 'fs_password' => $params['password']); |
| 241 | 241 | return $query; |
| 242 | 242 | } |
| 243 | - function user_sipdevice_add($add_array){ |
|
| 243 | + function user_sipdevice_add($add_array) { |
|
| 244 | 244 | $account_data = $this->session->userdata("accountinfo"); |
| 245 | 245 | $parms_array = array('password' => $add_array['fs_password'], |
| 246 | 246 | 'vm-enabled' => $add_array['voicemail_enabled'], |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | 'status' => $add_array['status'], |
| 261 | 261 | 'dir_params' => json_encode($parms_array), |
| 262 | 262 | 'dir_vars' => json_encode($parms_array_vars), |
| 263 | - 'sip_profile_id' => $this->common->get_field_name('id','sip_profiles',array('name'=>'default'))); |
|
| 263 | + 'sip_profile_id' => $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default'))); |
|
| 264 | 264 | $this->db->insert('sip_devices', $new_array); |
| 265 | 265 | $this->common->mail_to_users('add_sip_device', $account_data); |
| 266 | 266 | return true; |
| 267 | 267 | } |
| 268 | - function user_sipdevice_edit($add_array){ |
|
| 268 | + function user_sipdevice_edit($add_array) { |
|
| 269 | 269 | $parms_array = array('password' => $add_array['fs_password'], |
| 270 | 270 | 'vm-enabled' => $add_array['voicemail_enabled'], |
| 271 | 271 | 'vm-password' => $add_array['voicemail_password'], |
@@ -277,62 +277,62 @@ discard block |
||
| 277 | 277 | $parms_array_vars = array('effective_caller_id_name' => $add_array['effective_caller_id_name'], |
| 278 | 278 | 'effective_caller_id_number' => $add_array['effective_caller_id_number'],); |
| 279 | 279 | $log_type = $this->session->userdata("logintype"); |
| 280 | - if($log_type == 0 || $log_type == 3 || $log_type == 1){ |
|
| 281 | - $add_array['sip_profile_id']=$this->common->get_field_name('id','sip_profiles',array('name'=>'default')); |
|
| 280 | + if ($log_type == 0 || $log_type == 3 || $log_type == 1) { |
|
| 281 | + $add_array['sip_profile_id'] = $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default')); |
|
| 282 | 282 | } |
| 283 | - $add_array['status'] = isset($add_array['status'])?$add_array['status']:"0"; |
|
| 284 | - $new_array = array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'username' => $add_array['fs_username'],'status' => $add_array['status'], |
|
| 283 | + $add_array['status'] = isset($add_array['status']) ? $add_array['status'] : "0"; |
|
| 284 | + $new_array = array('last_modified_date'=>gmdate('Y-m-d H:i:s'), 'username' => $add_array['fs_username'], 'status' => $add_array['status'], |
|
| 285 | 285 | 'dir_params' => json_encode($parms_array), |
| 286 | 286 | 'dir_vars' => json_encode($parms_array_vars), 'sip_profile_id' => $add_array['sip_profile_id']); |
| 287 | - $this->db->update('sip_devices', $new_array,array('id'=>$add_array['id'])); |
|
| 287 | + $this->db->update('sip_devices', $new_array, array('id'=>$add_array['id'])); |
|
| 288 | 288 | return true; |
| 289 | 289 | } |
| 290 | - function getuser_cdrs_list($flag, $start, $limit,$export=true) { |
|
| 290 | + function getuser_cdrs_list($flag, $start, $limit, $export = true) { |
|
| 291 | 291 | $this->db_model->build_search('user_cdrs_report_search'); |
| 292 | 292 | $account_data = $this->session->userdata("accountinfo"); |
| 293 | - $field_name='debit'; |
|
| 294 | - if($account_data['type']==0 || $account_data['type']==1){ |
|
| 295 | - $where['accountid']=$account_data['id']; |
|
| 293 | + $field_name = 'debit'; |
|
| 294 | + if ($account_data['type'] == 0 || $account_data['type'] == 1) { |
|
| 295 | + $where['accountid'] = $account_data['id']; |
|
| 296 | 296 | |
| 297 | 297 | } |
| 298 | - if($account_data['type']==3){ |
|
| 299 | - $where['provider_id']=$account_data['id']; |
|
| 300 | - $field_name='cost'; |
|
| 298 | + if ($account_data['type'] == 3) { |
|
| 299 | + $where['provider_id'] = $account_data['id']; |
|
| 300 | + $field_name = 'cost'; |
|
| 301 | 301 | } |
| 302 | - $table_name=$account_data['type'] !=1 ? 'cdrs': 'reseller_cdrs'; |
|
| 303 | - if($this->session->userdata('advance_search') != 1){ |
|
| 304 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
| 305 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
| 302 | + $table_name = $account_data['type'] != 1 ? 'cdrs' : 'reseller_cdrs'; |
|
| 303 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 304 | + $where['callstart >= '] = date("Y-m-d")." 00:00:00"; |
|
| 305 | + $where['callstart <='] = date("Y-m-d")." 23:59:59"; |
|
| 306 | 306 | } |
| 307 | 307 | $this->db->where($where); |
| 308 | 308 | $this->db->order_by("callstart desc"); |
| 309 | 309 | if ($flag) { |
| 310 | - if (!$export) |
|
| 310 | + if ( ! $export) |
|
| 311 | 311 | $this->db->limit($limit, $start); |
| 312 | 312 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
| 313 | - }else { |
|
| 313 | + } else { |
|
| 314 | 314 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
| 315 | 315 | } |
| 316 | 316 | $result = $this->db->get($table_name); |
| 317 | 317 | return $result; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - function user_fund_transfer($data){ |
|
| 320 | + function user_fund_transfer($data) { |
|
| 321 | 321 | $accountinfo = $this->session->userdata['accountinfo']; |
| 322 | - $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ; |
|
| 322 | + $data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1; |
|
| 323 | 323 | $data['accountid'] = $data['id']; |
| 324 | 324 | $data['payment_mode'] = $data['payment_type']; |
| 325 | - unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
| 325 | + unset($data['action'], $data['id'], $data['account_currency'], $data['payment_type']); |
|
| 326 | 326 | if (isset($data)) { |
| 327 | - $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
| 327 | + $data['credit'] = $data['credit'] == '' ? 0 : $data['credit']; |
|
| 328 | 328 | $date = gmdate('Y-m-d H:i:s'); |
| 329 | - $accountid=$data['accountid']; |
|
| 330 | - while($accountid > 0 ){ |
|
| 331 | - $customer_id=$accountid; |
|
| 332 | - $accountid=$this->common_model->get_parent_info($accountid); |
|
| 333 | - $parent_id=$accountid > 0 ? $accountid : -1; |
|
| 334 | - $balance = $this->db_model->update_balance($data['credit'], $customer_id,$data['payment_mode']); |
|
| 335 | - if($data['payment_mode'] == 0){ |
|
| 329 | + $accountid = $data['accountid']; |
|
| 330 | + while ($accountid > 0) { |
|
| 331 | + $customer_id = $accountid; |
|
| 332 | + $accountid = $this->common_model->get_parent_info($accountid); |
|
| 333 | + $parent_id = $accountid > 0 ? $accountid : -1; |
|
| 334 | + $balance = $this->db_model->update_balance($data['credit'], $customer_id, $data['payment_mode']); |
|
| 335 | + if ($data['payment_mode'] == 0) { |
|
| 336 | 336 | $insert_arr = array("accountid" => $customer_id, |
| 337 | 337 | "credit" => $data['credit'], |
| 338 | 338 | 'payment_mode'=>$data['payment_mode'], |
@@ -348,28 +348,28 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | function user_dashboard_recent_recharge_info() |
| 350 | 350 | { |
| 351 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
| 352 | - $userlevel_logintype=$this->session->userdata('userlevel_logintype'); |
|
| 351 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 352 | + $userlevel_logintype = $this->session->userdata('userlevel_logintype'); |
|
| 353 | 353 | |
| 354 | - $where_arr=array('payment_by'=>-1); |
|
| 355 | - if($userlevel_logintype == 1){ |
|
| 356 | - $where_arr=array('payment_by'=>$accountinfo['id']); |
|
| 354 | + $where_arr = array('payment_by'=>-1); |
|
| 355 | + if ($userlevel_logintype == 1) { |
|
| 356 | + $where_arr = array('payment_by'=>$accountinfo['id']); |
|
| 357 | 357 | } |
| 358 | - if($userlevel_logintype == 0 || $userlevel_logintype == 3){ |
|
| 359 | - $where_arr=array('accountid'=>$accountinfo['id']); |
|
| 358 | + if ($userlevel_logintype == 0 || $userlevel_logintype == 3) { |
|
| 359 | + $where_arr = array('accountid'=>$accountinfo['id']); |
|
| 360 | 360 | } |
| 361 | 361 | $this->db->where($where_arr); |
| 362 | 362 | $this->db->select('id,accountid,credit,payment_date,notes'); |
| 363 | 363 | $this->db->from('payments'); |
| 364 | 364 | $this->db->limit(10); |
| 365 | - $this->db->order_by('payment_date','desc'); |
|
| 365 | + $this->db->order_by('payment_date', 'desc'); |
|
| 366 | 366 | return $this->db->get(); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | function get_user_rates_list($flag, $start = 0, $limit = 0) { |
| 370 | 370 | $this->db_model->build_search('user_rates_list_search'); |
| 371 | 371 | $account_data = $this->session->userdata("accountinfo"); |
| 372 | - $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0'); |
|
| 372 | + $where = array("pricelist_id" => $account_data["pricelist_id"], "status" => '0'); |
|
| 373 | 373 | if ($flag) { |
| 374 | 374 | $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
| 375 | 375 | } else { |
@@ -378,42 +378,42 @@ discard block |
||
| 378 | 378 | return $query; |
| 379 | 379 | } |
| 380 | 380 | function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") { |
| 381 | - $this->db_model->build_search_opensips($this->opensips_db,'user_opensips_search'); |
|
| 382 | - $this->opensips_db->where('accountcode',$account_number); |
|
| 381 | + $this->db_model->build_search_opensips($this->opensips_db, 'user_opensips_search'); |
|
| 382 | + $this->opensips_db->where('accountcode', $account_number); |
|
| 383 | 383 | if ($flag) { |
| 384 | - $this->opensips_db->limit($limit,$start); |
|
| 384 | + $this->opensips_db->limit($limit, $start); |
|
| 385 | 385 | } |
| 386 | 386 | $result = $this->opensips_db->get("subscriber"); |
| 387 | - if($result->num_rows() > 0){ |
|
| 388 | - if($flag){ |
|
| 387 | + if ($result->num_rows() > 0) { |
|
| 388 | + if ($flag) { |
|
| 389 | 389 | return $result; |
| 390 | 390 | } |
| 391 | - else{ |
|
| 391 | + else { |
|
| 392 | 392 | return $result->num_rows(); |
| 393 | 393 | } |
| 394 | - }else{ |
|
| 395 | - if($flag){ |
|
| 396 | - $result=(object)array('num_rows'=>0); |
|
| 394 | + } else { |
|
| 395 | + if ($flag) { |
|
| 396 | + $result = (object)array('num_rows'=>0); |
|
| 397 | 397 | } |
| 398 | - else{ |
|
| 399 | - $result=0; |
|
| 398 | + else { |
|
| 399 | + $result = 0; |
|
| 400 | 400 | } |
| 401 | 401 | return $result; |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | function user_opensips_add($data) { |
| 405 | 405 | unset($data["action"]); |
| 406 | - $data['creation_date']=gmdate("Y-m-d H:i:s"); |
|
| 407 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
| 408 | - $data['reseller_id']=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
| 406 | + $data['creation_date'] = gmdate("Y-m-d H:i:s"); |
|
| 407 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 408 | + $data['reseller_id'] = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
| 409 | 409 | $this->opensips_db->insert("subscriber", $data); |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | function user_opensips_edit($data, $id) { |
| 413 | 413 | unset($data["action"]); |
| 414 | - $data=array("username"=>$data['username'],"password"=>$data['password'],"accountcode"=>$data['accountcode'],"domain"=>$data['domain']); |
|
| 414 | + $data = array("username"=>$data['username'], "password"=>$data['password'], "accountcode"=>$data['accountcode'], "domain"=>$data['domain']); |
|
| 415 | 415 | $this->opensips_db->where("id", $id); |
| 416 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
| 416 | + $data['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
| 417 | 417 | $this->opensips_db->update("subscriber", $data); |
| 418 | 418 | } |
| 419 | 419 | function user_opensips_delete($id) { |
@@ -421,12 +421,12 @@ discard block |
||
| 421 | 421 | $this->opensips_db->delete("subscriber"); |
| 422 | 422 | return true; |
| 423 | 423 | } |
| 424 | - function get_user_invoice_list($flag, $start = 0, $limit = 0){ |
|
| 424 | + function get_user_invoice_list($flag, $start = 0, $limit = 0) { |
|
| 425 | 425 | $this->db_model->build_search('user_invoice_list_search'); |
| 426 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
| 427 | - $where = array("accountid" => $accountinfo['id'],'confirm'=>1); |
|
| 426 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 427 | + $where = array("accountid" => $accountinfo['id'], 'confirm'=>1); |
|
| 428 | 428 | $this->db->where($where); |
| 429 | - $or_where= "(type='I' OR type='R')"; |
|
| 429 | + $or_where = "(type='I' OR type='R')"; |
|
| 430 | 430 | $this->db->where($or_where); |
| 431 | 431 | if ($flag) { |
| 432 | 432 | $query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | return $query; |
| 439 | 439 | } |
| 440 | - function get_user_cdrs_info($flag,$accountid,$start = 0, $limit = 0){ |
|
| 440 | + function get_user_cdrs_info($flag, $accountid, $start = 0, $limit = 0) { |
|
| 441 | 441 | if ($flag) { |
| 442 | 442 | $query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start); |
| 443 | 443 | |
@@ -447,38 +447,38 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | } |
| 449 | 449 | function get_invoiceconf($accountid) { |
| 450 | - $return_array=array(); |
|
| 450 | + $return_array = array(); |
|
| 451 | 451 | $logintype = $this->session->userdata('logintype'); |
| 452 | 452 | if ($logintype == 1 || $logintype == 5) { |
| 453 | 453 | |
| 454 | 454 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
| 455 | - }else{ |
|
| 456 | - $where=array('id'=> $accountid); |
|
| 455 | + } else { |
|
| 456 | + $where = array('id'=> $accountid); |
|
| 457 | 457 | } |
| 458 | - $query = $this->db_model->getSelect("*","invoice_conf",$where); |
|
| 459 | - foreach($query->result_array() as $key => $value) |
|
| 458 | + $query = $this->db_model->getSelect("*", "invoice_conf", $where); |
|
| 459 | + foreach ($query->result_array() as $key => $value) |
|
| 460 | 460 | { |
| 461 | - $return_array=$value; |
|
| 461 | + $return_array = $value; |
|
| 462 | 462 | } |
| 463 | 463 | return $return_array; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
| 467 | - function getprovider_cdrs_list($flag, $start, $limit,$export=true) { |
|
| 467 | + function getprovider_cdrs_list($flag, $start, $limit, $export = true) { |
|
| 468 | 468 | $this->db_model->build_search('user_provider_cdrs_report_search'); |
| 469 | 469 | $account_data = $this->session->userdata("accountinfo"); |
| 470 | - $where['provider_id']=$account_data['id']; |
|
| 471 | - if($this->session->userdata('advance_search') != 1){ |
|
| 472 | - $where['callstart >= ']=date("Y-m-d")." 00:00:00"; |
|
| 473 | - $where['callstart <=']=date("Y-m-d")." 23:59:59"; |
|
| 470 | + $where['provider_id'] = $account_data['id']; |
|
| 471 | + if ($this->session->userdata('advance_search') != 1) { |
|
| 472 | + $where['callstart >= '] = date("Y-m-d")." 00:00:00"; |
|
| 473 | + $where['callstart <='] = date("Y-m-d")." 23:59:59"; |
|
| 474 | 474 | } |
| 475 | 475 | $this->db->where($where); |
| 476 | - $this->db->order_by("callstart","desc"); |
|
| 476 | + $this->db->order_by("callstart", "desc"); |
|
| 477 | 477 | if ($flag) { |
| 478 | - if (!$export) |
|
| 478 | + if ( ! $export) |
|
| 479 | 479 | $this->db->limit($limit, $start); |
| 480 | 480 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
| 481 | - }else { |
|
| 481 | + } else { |
|
| 482 | 482 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
| 483 | 483 | } |
| 484 | 484 | $result = $this->db->get('cdrs'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if ($flag) { |
| 94 | 94 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
| 95 | 95 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
| 96 | - }else{ |
|
| 96 | + } else{ |
|
| 97 | 97 | $this->db->order_by('invoice_date', 'desc'); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -307,10 +307,11 @@ discard block |
||
| 307 | 307 | $this->db->where($where); |
| 308 | 308 | $this->db->order_by("callstart desc"); |
| 309 | 309 | if ($flag) { |
| 310 | - if (!$export) |
|
| 311 | - $this->db->limit($limit, $start); |
|
| 310 | + if (!$export) { |
|
| 311 | + $this->db->limit($limit, $start); |
|
| 312 | + } |
|
| 312 | 313 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
| 313 | - }else { |
|
| 314 | + } else { |
|
| 314 | 315 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids'); |
| 315 | 316 | } |
| 316 | 317 | $result = $this->db->get($table_name); |
@@ -387,15 +388,13 @@ discard block |
||
| 387 | 388 | if($result->num_rows() > 0){ |
| 388 | 389 | if($flag){ |
| 389 | 390 | return $result; |
| 390 | - } |
|
| 391 | - else{ |
|
| 391 | + } else{ |
|
| 392 | 392 | return $result->num_rows(); |
| 393 | 393 | } |
| 394 | - }else{ |
|
| 394 | + } else{ |
|
| 395 | 395 | if($flag){ |
| 396 | 396 | $result=(object)array('num_rows'=>0); |
| 397 | - } |
|
| 398 | - else{ |
|
| 397 | + } else{ |
|
| 399 | 398 | $result=0; |
| 400 | 399 | } |
| 401 | 400 | return $result; |
@@ -452,7 +451,7 @@ discard block |
||
| 452 | 451 | if ($logintype == 1 || $logintype == 5) { |
| 453 | 452 | |
| 454 | 453 | $where = array("accountid" => $this->session->userdata["accountinfo"]['id']); |
| 455 | - }else{ |
|
| 454 | + } else{ |
|
| 456 | 455 | $where=array('id'=> $accountid); |
| 457 | 456 | } |
| 458 | 457 | $query = $this->db_model->getSelect("*","invoice_conf",$where); |
@@ -475,10 +474,11 @@ discard block |
||
| 475 | 474 | $this->db->where($where); |
| 476 | 475 | $this->db->order_by("callstart","desc"); |
| 477 | 476 | if ($flag) { |
| 478 | - if (!$export) |
|
| 479 | - $this->db->limit($limit, $start); |
|
| 477 | + if (!$export) { |
|
| 478 | + $this->db->limit($limit, $start); |
|
| 479 | + } |
|
| 480 | 480 | $this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid'); |
| 481 | - }else { |
|
| 481 | + } else { |
|
| 482 | 482 | $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids'); |
| 483 | 483 | } |
| 484 | 484 | $result = $this->db->get('cdrs'); |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - function index(){ |
|
| 34 | + function index() { |
|
| 35 | 35 | $account_data = $this->session->userdata("accountinfo"); |
| 36 | 36 | $data["accountid"] = $account_data["id"]; |
| 37 | 37 | $data["accountid"] = $account_data["id"]; |
| 38 | 38 | $data["page_title"] = "Recharge"; |
| 39 | 39 | |
| 40 | 40 | $system_config = common_model::$global_config['system_config']; |
| 41 | - if($system_config["paypal_mode"]==0){ |
|
| 41 | + if ($system_config["paypal_mode"] == 0) { |
|
| 42 | 42 | $data["paypal_url"] = $system_config["paypal_url"]; |
| 43 | 43 | $data["paypal_email_id"] = $system_config["paypal_id"]; |
| 44 | - }else{ |
|
| 44 | + } else { |
|
| 45 | 45 | $data["paypal_url"] = $system_config["paypal_sandbox_url"]; |
| 46 | 46 | $data["paypal_email_id"] = $system_config["paypal_sandbox_id"]; |
| 47 | 47 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $data["from_currency"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]); |
| 51 | 51 | $data["to_currency"] = Common_model::$global_config['system_config']['base_currency']; |
| 52 | - $this->load->view("user_payment",$data); |
|
| 52 | + $this->load->view("user_payment", $data); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - function convert_amount($amount){ |
|
| 56 | - $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
| 57 | - echo number_format((float)$amount,2); |
|
| 55 | + function convert_amount($amount) { |
|
| 56 | + $amount = $this->common_model->add_calculate_currency($amount, "", "", true, false); |
|
| 57 | + echo number_format((float)$amount, 2); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | ?> |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | if($system_config["paypal_mode"]==0){ |
| 42 | 42 | $data["paypal_url"] = $system_config["paypal_url"]; |
| 43 | 43 | $data["paypal_email_id"] = $system_config["paypal_id"]; |
| 44 | - }else{ |
|
| 44 | + } else{ |
|
| 45 | 45 | $data["paypal_url"] = $system_config["paypal_sandbox_url"]; |
| 46 | 46 | $data["paypal_email_id"] = $system_config["paypal_sandbox_id"]; |
| 47 | 47 | } |