@@ -23,56 +23,56 @@ discard block |
||
| 23 | 23 | // ############################################################################## |
| 24 | 24 | class DID_model extends CI_Model { |
| 25 | 25 | function DID_model() { |
| 26 | - parent::__construct (); |
|
| 26 | + parent::__construct(); |
|
| 27 | 27 | } |
| 28 | 28 | function add_did($add_array) { |
| 29 | 29 | if ($add_array ['accountid'] > 0) { |
| 30 | - $add_array ['assign_date'] = gmdate ( 'Y-m-d H:i:s' ); |
|
| 30 | + $add_array ['assign_date'] = gmdate('Y-m-d H:i:s'); |
|
| 31 | 31 | } |
| 32 | - unset ( $add_array ["action"] ); |
|
| 33 | - $this->db->insert ( "dids", $add_array ); |
|
| 34 | - $last_id = $this->db->insert_id (); |
|
| 32 | + unset ($add_array ["action"]); |
|
| 33 | + $this->db->insert("dids", $add_array); |
|
| 34 | + $last_id = $this->db->insert_id(); |
|
| 35 | 35 | if ($add_array ['accountid'] > 0) { |
| 36 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 36 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
| 37 | 37 | "id" => $add_array ['accountid'] |
| 38 | - ) )->first_row (); |
|
| 39 | - $currency_name = $this->common->get_field_name ( 'currency', "currency", array ( |
|
| 38 | + ))->first_row(); |
|
| 39 | + $currency_name = $this->common->get_field_name('currency', "currency", array( |
|
| 40 | 40 | 'id' => $accountinfo ['currency_id'] |
| 41 | - ) ); |
|
| 42 | - $available_bal = $this->db_model->update_balance ( $add_array ["setup"], $add_array ['accountid'], "debit" ); |
|
| 43 | - $this->common->add_invoice_details ( $accountinfo, "DIDCHRG", $add_array ["setup"], $add_array ['number'] ); |
|
| 41 | + )); |
|
| 42 | + $available_bal = $this->db_model->update_balance($add_array ["setup"], $add_array ['accountid'], "debit"); |
|
| 43 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $add_array ["setup"], $add_array ['number']); |
|
| 44 | 44 | |
| 45 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
| 46 | - $ProcessCharges = new ProcessCharges (); |
|
| 47 | - $Params = array ( |
|
| 45 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
| 46 | + $ProcessCharges = new ProcessCharges(); |
|
| 47 | + $Params = array( |
|
| 48 | 48 | "DIDid" => $last_id |
| 49 | 49 | ); |
| 50 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
| 50 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
| 51 | 51 | |
| 52 | 52 | $accountinfo ['did_number'] = $add_array ['number']; |
| 53 | - $country_id = $this->common->get_field_name ( 'country', 'countrycode', $add_array ['country_id'] ); |
|
| 53 | + $country_id = $this->common->get_field_name('country', 'countrycode', $add_array ['country_id']); |
|
| 54 | 54 | $accountinfo ['did_country_id'] = $country_id; |
| 55 | - $accountinfo ['did_setup'] = $this->common_model->calculate_currency ( $add_array ['setup'], '', $currency_name, true, true ); |
|
| 56 | - $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency ( $add_array ['monthlycost'], '', $currency_name, true, true ); |
|
| 55 | + $accountinfo ['did_setup'] = $this->common_model->calculate_currency($add_array ['setup'], '', $currency_name, true, true); |
|
| 56 | + $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency($add_array ['monthlycost'], '', $currency_name, true, true); |
|
| 57 | 57 | $accountinfo ['did_maxchannels'] = $add_array ['maxchannels']; |
| 58 | - $this->common->mail_to_users ( 'email_add_did', $accountinfo ); |
|
| 58 | + $this->common->mail_to_users('email_add_did', $accountinfo); |
|
| 59 | 59 | } |
| 60 | 60 | return true; |
| 61 | 61 | } |
| 62 | 62 | function insert_pricelist() { |
| 63 | - $insert_array = array ( |
|
| 63 | + $insert_array = array( |
|
| 64 | 64 | 'name' => 'default', |
| 65 | 65 | 'markup' => '', |
| 66 | 66 | 'inc' => '' |
| 67 | 67 | ); |
| 68 | - return $this->db->insert_id (); |
|
| 68 | + return $this->db->insert_id(); |
|
| 69 | 69 | } |
| 70 | 70 | function edit_did($data, $id, $number) { |
| 71 | - unset ( $data ["action"] ); |
|
| 72 | - $this->db->where ( 'number', $number ); |
|
| 73 | - $this->db->select ( 'parent_id,accountid' ); |
|
| 74 | - $did_result = $this->db->get ( 'dids' ); |
|
| 75 | - $did_result = ( array ) $did_result->first_row (); |
|
| 71 | + unset ($data ["action"]); |
|
| 72 | + $this->db->where('number', $number); |
|
| 73 | + $this->db->select('parent_id,accountid'); |
|
| 74 | + $did_result = $this->db->get('dids'); |
|
| 75 | + $did_result = (array)$did_result->first_row(); |
|
| 76 | 76 | if ($did_result ['accountid'] > 0 || $did_result ['parent_id'] > 0) { |
| 77 | 77 | $data ['accountid'] = $did_result ['accountid']; |
| 78 | 78 | $data ['parent_id'] = $did_result ['parent_id']; |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | * ASTPP 3.0 |
| 82 | 82 | * In did edit last modified date and assign date update |
| 83 | 83 | */ |
| 84 | - $data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
| 84 | + $data ['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
| 85 | 85 | if ($did_result ['accountid'] == 0 && $data ['accountid'] > 0) { |
| 86 | - $data ['assign_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
| 86 | + $data ['assign_date'] = gmdate("Y-m-d H:i:s"); |
|
| 87 | 87 | } |
| 88 | - $this->db->where ( "number", $number ); |
|
| 89 | - $this->db->where ( "id", $id ); |
|
| 90 | - $this->db->update ( "dids", $data ); |
|
| 88 | + $this->db->where("number", $number); |
|
| 89 | + $this->db->where("id", $id); |
|
| 90 | + $this->db->update("dids", $data); |
|
| 91 | 91 | /** |
| 92 | 92 | * *********************************** |
| 93 | 93 | */ |
@@ -95,77 +95,77 @@ discard block |
||
| 95 | 95 | $update_array ['call_type'] = $data ['call_type']; |
| 96 | 96 | $update_array ['extensions'] = $data ['extensions']; |
| 97 | 97 | $update_array ['note'] = $data ['number']; |
| 98 | - $this->db->where ( "note", $number ); |
|
| 99 | - $this->db->update ( "reseller_pricing", $update_array ); |
|
| 98 | + $this->db->where("note", $number); |
|
| 99 | + $this->db->update("reseller_pricing", $update_array); |
|
| 100 | 100 | } |
| 101 | 101 | if ($did_result ['accountid'] == 0 && $data ['accountid'] > 0) { |
| 102 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 102 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
| 103 | 103 | "id" => $data ['accountid'] |
| 104 | - ) )->first_row (); |
|
| 105 | - $currency_name = $this->common->get_field_name ( 'currency', "currency", array ( |
|
| 104 | + ))->first_row(); |
|
| 105 | + $currency_name = $this->common->get_field_name('currency', "currency", array( |
|
| 106 | 106 | 'id' => $accountinfo ['currency_id'] |
| 107 | - ) ); |
|
| 108 | - $available_bal = $this->db_model->update_balance ( $data ["setup"], $data ['accountid'], "debit" ); |
|
| 109 | - $this->common->add_invoice_details ( $accountinfo, "DIDCHRG", $data ["setup"], $number ); |
|
| 110 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
| 111 | - $ProcessCharges = new ProcessCharges (); |
|
| 112 | - $Params = array ( |
|
| 107 | + )); |
|
| 108 | + $available_bal = $this->db_model->update_balance($data ["setup"], $data ['accountid'], "debit"); |
|
| 109 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $data ["setup"], $number); |
|
| 110 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
| 111 | + $ProcessCharges = new ProcessCharges(); |
|
| 112 | + $Params = array( |
|
| 113 | 113 | "DIDid" => $id |
| 114 | 114 | ); |
| 115 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
| 115 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
| 116 | 116 | |
| 117 | 117 | $accountinfo ['did_number'] = $number; |
| 118 | - $country_id = $this->common->get_field_name ( 'country', 'countrycode', $data ['country_id'] ); |
|
| 118 | + $country_id = $this->common->get_field_name('country', 'countrycode', $data ['country_id']); |
|
| 119 | 119 | $accountinfo ['did_country_id'] = $country_id; |
| 120 | - $accountinfo ['did_setup'] = $this->common_model->calculate_currency ( $data ['setup'], '', $currency_name, true, true ); |
|
| 121 | - $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency ( $data ['monthlycost'], '', $currency_name, true, true ); |
|
| 120 | + $accountinfo ['did_setup'] = $this->common_model->calculate_currency($data ['setup'], '', $currency_name, true, true); |
|
| 121 | + $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency($data ['monthlycost'], '', $currency_name, true, true); |
|
| 122 | 122 | $accountinfo ['did_maxchannels'] = $data ['maxchannels']; |
| 123 | - $this->common->mail_to_users ( 'email_add_did', $accountinfo ); |
|
| 123 | + $this->common->mail_to_users('email_add_did', $accountinfo); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | function getdid_list($flag, $start = 0, $limit = 0) { |
| 127 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 127 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 128 | 128 | $parent_id = $accountinfo ['type'] == 1 ? $accountinfo ['reseller_id'] : 0; |
| 129 | 129 | |
| 130 | 130 | if ($accountinfo ['type'] == 1) { |
| 131 | - $where = array ( |
|
| 131 | + $where = array( |
|
| 132 | 132 | 'reseller_id' => $accountinfo ['id'], |
| 133 | 133 | "parent_id" => $parent_id |
| 134 | 134 | ); |
| 135 | 135 | if ($flag) { |
| 136 | 136 | if ($accountinfo ['reseller_id'] > 0) { |
| 137 | - $search_string = $this->db_model->build_search_string ( 'did_list_search' ); |
|
| 138 | - $search_string = ! empty ( $search_string ) ? " AND " . $search_string : null; |
|
| 139 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
| 140 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
| 137 | + $search_string = $this->db_model->build_search_string('did_list_search'); |
|
| 138 | + $search_string = ! empty ($search_string) ? " AND ".$search_string : null; |
|
| 139 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
| 140 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
| 141 | 141 | } |
| 142 | - $this->db->limit ( $limit, $start ); |
|
| 143 | - $query = $this->db->query ( "SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =" . $accountinfo ['id'] . " AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =" . $accountinfo ['id'] . "), (SELECT accountid from dids as d where d.parent_id = " . $accountinfo ['id'] . " AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=" . $accountinfo ['id'] . " AND a.parent_id =" . $accountinfo ['reseller_id'] . $search_string ); |
|
| 142 | + $this->db->limit($limit, $start); |
|
| 143 | + $query = $this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo ['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo ['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo ['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo ['id']." AND a.parent_id =".$accountinfo ['reseller_id'].$search_string); |
|
| 144 | 144 | } else { |
| 145 | - $this->db_model->build_search ( 'did_list_search' ); |
|
| 146 | - $query = $this->db_model->select ( "*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =" . $accountinfo ['id'] . " AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =" . $accountinfo ['id'] . "), (SELECT accountid from dids as d where d.parent_id = " . $accountinfo ['id'] . " AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start ); |
|
| 145 | + $this->db_model->build_search('did_list_search'); |
|
| 146 | + $query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo ['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo ['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo ['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start); |
|
| 147 | 147 | } |
| 148 | 148 | } else { |
| 149 | - $this->db_model->build_search ( 'did_list_search' ); |
|
| 150 | - $query = $this->db_model->countQuery ( "*", "reseller_pricing", $where ); |
|
| 149 | + $this->db_model->build_search('did_list_search'); |
|
| 150 | + $query = $this->db_model->countQuery("*", "reseller_pricing", $where); |
|
| 151 | 151 | } |
| 152 | 152 | } else { |
| 153 | - $this->db_model->build_search ( 'did_list_search' ); |
|
| 153 | + $this->db_model->build_search('did_list_search'); |
|
| 154 | 154 | if ($flag) { |
| 155 | 155 | /* |
| 156 | 156 | * ASTPP 3.0 last_modified_date,assign_date put in query. |
| 157 | 157 | */ |
| 158 | - $this->db->select ( 'dids.id,dids.connectcost,dids.includedseconds,dids.last_modified_date,dids.assign_date,dids.number,dids.extensions,dids.call_type,dids.country_id,dids.init_inc,dids.inc,dids.cost,dids.setup,dids.monthlycost,dids.status,(CASE when parent_id > 0 THEN (SELECT reseller_id as accountid from reseller_pricing where dids.number=reseller_pricing.note AND reseller_pricing.parent_id=0) ELSE dids.accountid END ) as accountid' ); |
|
| 159 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
| 160 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
| 158 | + $this->db->select('dids.id,dids.connectcost,dids.includedseconds,dids.last_modified_date,dids.assign_date,dids.number,dids.extensions,dids.call_type,dids.country_id,dids.init_inc,dids.inc,dids.cost,dids.setup,dids.monthlycost,dids.status,(CASE when parent_id > 0 THEN (SELECT reseller_id as accountid from reseller_pricing where dids.number=reseller_pricing.note AND reseller_pricing.parent_id=0) ELSE dids.accountid END ) as accountid'); |
|
| 159 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
| 160 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
| 161 | 161 | } |
| 162 | 162 | /** |
| 163 | 163 | * *******************************************************88 |
| 164 | 164 | */ |
| 165 | - $this->db->limit ( $limit, $start ); |
|
| 166 | - $query = $this->db->get ( 'dids' ); |
|
| 165 | + $this->db->limit($limit, $start); |
|
| 166 | + $query = $this->db->get('dids'); |
|
| 167 | 167 | } else { |
| 168 | - $query = $this->db_model->countQuery ( "*", "dids" ); |
|
| 168 | + $query = $this->db_model->countQuery("*", "dids"); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | return $query; |
@@ -176,117 +176,117 @@ discard block |
||
| 176 | 176 | * For Email broadcast |
| 177 | 177 | * * |
| 178 | 178 | */ |
| 179 | - $where = array ( |
|
| 179 | + $where = array( |
|
| 180 | 180 | 'id' => $id |
| 181 | 181 | ); |
| 182 | - $this->db->where ( $where ); |
|
| 183 | - $this->db->select ( 'accountid,number,parent_id' ); |
|
| 184 | - $did_info = ( array ) $this->db->get ( 'dids' )->first_row (); |
|
| 185 | - $this->db->where ( "id", $id ); |
|
| 186 | - $this->db->delete ( "dids" ); |
|
| 187 | - $this->db->where ( "note", $did_info ['number'] ); |
|
| 188 | - $this->db->delete ( "reseller_pricing" ); |
|
| 182 | + $this->db->where($where); |
|
| 183 | + $this->db->select('accountid,number,parent_id'); |
|
| 184 | + $did_info = (array)$this->db->get('dids')->first_row(); |
|
| 185 | + $this->db->where("id", $id); |
|
| 186 | + $this->db->delete("dids"); |
|
| 187 | + $this->db->where("note", $did_info ['number']); |
|
| 188 | + $this->db->delete("reseller_pricing"); |
|
| 189 | 189 | if ($did_info ['accountid'] == 0 && $did_info ['parent_id'] > 0) { |
| 190 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 190 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 191 | 191 | $did_info ['accountid'] = $accouninfo ['id']; |
| 192 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 192 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
| 193 | 193 | "id" => $did_info ['parent_id'] |
| 194 | - ) )->first_row (); |
|
| 194 | + ))->first_row(); |
|
| 195 | 195 | $accountinfo ['did_number'] = $accountinfo ['number']; |
| 196 | - $this->common->mail_to_users ( 'email_remove_did', $accountinfo ); |
|
| 196 | + $this->common->mail_to_users('email_remove_did', $accountinfo); |
|
| 197 | 197 | } elseif ($did_info ['accountid'] > 0) { |
| 198 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 198 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
| 199 | 199 | "id" => $did_info ['accountid'] |
| 200 | - ) )->first_row (); |
|
| 200 | + ))->first_row(); |
|
| 201 | 201 | $accountinfo ['did_number'] = $did_info ['number']; |
| 202 | - $this->common->mail_to_users ( 'email_remove_did', $accountinfo ); |
|
| 202 | + $this->common->mail_to_users('email_remove_did', $accountinfo); |
|
| 203 | 203 | } |
| 204 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | function get_coutry_id_by_name($field_value) { |
| 207 | - $this->db->where ( "country", ucfirst ( $field_value ) ); |
|
| 208 | - $query = $this->db->get ( 'countrycode' ); |
|
| 209 | - $data = $query->result (); |
|
| 207 | + $this->db->where("country", ucfirst($field_value)); |
|
| 208 | + $query = $this->db->get('countrycode'); |
|
| 209 | + $data = $query->result(); |
|
| 210 | 210 | if ($query->num_rows > 0) |
| 211 | 211 | return $data [0]->id; |
| 212 | 212 | else |
| 213 | 213 | return ''; |
| 214 | 214 | } |
| 215 | 215 | function bulk_insert_dids($field_value) { |
| 216 | - $this->db->insert_batch ( 'dids', $field_value ); |
|
| 217 | - $affected_row = $this->db->affected_rows (); |
|
| 216 | + $this->db->insert_batch('dids', $field_value); |
|
| 217 | + $affected_row = $this->db->affected_rows(); |
|
| 218 | 218 | return $affected_row; |
| 219 | 219 | } |
| 220 | 220 | function get_account($accountdata) { |
| 221 | - $q = "SELECT * FROM accounts WHERE number = '" . $this->db->escape_str ( $accountdata ) . "' AND status = 0"; |
|
| 222 | - $query = $this->db->query ( $q ); |
|
| 223 | - if ($query->num_rows () > 0) { |
|
| 224 | - $row = $query->row_array (); |
|
| 221 | + $q = "SELECT * FROM accounts WHERE number = '".$this->db->escape_str($accountdata)."' AND status = 0"; |
|
| 222 | + $query = $this->db->query($q); |
|
| 223 | + if ($query->num_rows() > 0) { |
|
| 224 | + $row = $query->row_array(); |
|
| 225 | 225 | return $row; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $q = "SELECT * FROM accounts WHERE cc = '" . $this->db->escape_str ( $accountdata ) . "' AND status = 0"; |
|
| 229 | - $query = $this->db->query ( $q ); |
|
| 230 | - if ($query->num_rows () > 0) { |
|
| 231 | - $row = $query->row_array (); |
|
| 228 | + $q = "SELECT * FROM accounts WHERE cc = '".$this->db->escape_str($accountdata)."' AND status = 0"; |
|
| 229 | + $query = $this->db->query($q); |
|
| 230 | + if ($query->num_rows() > 0) { |
|
| 231 | + $row = $query->row_array(); |
|
| 232 | 232 | return $row; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $q = "SELECT * FROM accounts WHERE accountid = '" . $this->db->escape_str ( $accountdata ) . "' AND status = 0"; |
|
| 236 | - $query = $this->db->query ( $q ); |
|
| 237 | - if ($query->num_rows () > 0) { |
|
| 238 | - $row = $query->row_array (); |
|
| 235 | + $q = "SELECT * FROM accounts WHERE accountid = '".$this->db->escape_str($accountdata)."' AND status = 0"; |
|
| 236 | + $query = $this->db->query($q); |
|
| 237 | + if ($query->num_rows() > 0) { |
|
| 238 | + $row = $query->row_array(); |
|
| 239 | 239 | return $row; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | return NULL; |
| 243 | 243 | } |
| 244 | 244 | function get_did_reseller_new($did, $reseller_id = "") { |
| 245 | - $sql = "SELECT dids.number AS number, " . "reseller_pricing.monthlycost AS monthlycost, " . "reseller_pricing.prorate AS prorate, " . "reseller_pricing.setup AS setup, " . "reseller_pricing.cost AS cost, " . "reseller_pricing.connectcost AS connectcost, " . "reseller_pricing.includedseconds AS includedseconds, " . "reseller_pricing.inc AS inc, " . "reseller_pricing.disconnectionfee AS disconnectionfee, " . "dids.provider_id AS provider_id, " . "dids.country_id AS country_id, " . "dids.city AS city, " . "dids.province AS province, " . "dids.extensions AS extensions, " . "dids.accountid AS account, " . "dids.variables AS variables, " . "dids.options AS options, " . "dids.maxchannels AS maxchannels, " . "dids.chargeonallocation AS chargeonallocation, " . "dids.allocation_bill_status AS allocation_bill_status, " . "dids.limittime AS limittime, " . "dids.dial_as AS dial_as, " . "dids.status AS status " . "FROM dids, reseller_pricing " . "WHERE dids.id = " . $did . " AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = " . $reseller_id; |
|
| 246 | - $query = $this->db->query ( $sql ); |
|
| 247 | - if ($query->num_rows () > 0) { |
|
| 248 | - return $query->row_array (); |
|
| 245 | + $sql = "SELECT dids.number AS number, "."reseller_pricing.monthlycost AS monthlycost, "."reseller_pricing.prorate AS prorate, "."reseller_pricing.setup AS setup, "."reseller_pricing.cost AS cost, "."reseller_pricing.connectcost AS connectcost, "."reseller_pricing.includedseconds AS includedseconds, "."reseller_pricing.inc AS inc, "."reseller_pricing.disconnectionfee AS disconnectionfee, "."dids.provider_id AS provider_id, "."dids.country_id AS country_id, "."dids.city AS city, "."dids.province AS province, "."dids.extensions AS extensions, "."dids.accountid AS account, "."dids.variables AS variables, "."dids.options AS options, "."dids.maxchannels AS maxchannels, "."dids.chargeonallocation AS chargeonallocation, "."dids.allocation_bill_status AS allocation_bill_status, "."dids.limittime AS limittime, "."dids.dial_as AS dial_as, "."dids.status AS status "."FROM dids, reseller_pricing "."WHERE dids.id = ".$did." AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = ".$reseller_id; |
|
| 246 | + $query = $this->db->query($sql); |
|
| 247 | + if ($query->num_rows() > 0) { |
|
| 248 | + return $query->row_array(); |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | function get_did_by_number($number) { |
| 252 | - $this->db->where ( "id", $number ); |
|
| 253 | - $this->db->or_where ( "number", $number ); |
|
| 254 | - $query = $this->db->get ( "dids" ); |
|
| 255 | - if ($query->num_rows () > 0) |
|
| 256 | - return $query->row_array (); |
|
| 252 | + $this->db->where("id", $number); |
|
| 253 | + $this->db->or_where("number", $number); |
|
| 254 | + $query = $this->db->get("dids"); |
|
| 255 | + if ($query->num_rows() > 0) |
|
| 256 | + return $query->row_array(); |
|
| 257 | 257 | else |
| 258 | 258 | return false; |
| 259 | 259 | } |
| 260 | 260 | function edit_did_reseller($did_id, $post) { |
| 261 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 261 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 262 | 262 | |
| 263 | - $where_array = array ( |
|
| 263 | + $where_array = array( |
|
| 264 | 264 | 'reseller_id' => $accountinfo ['id'], |
| 265 | 265 | 'note' => $post ['number'], |
| 266 | 266 | 'type' => '1' |
| 267 | 267 | ); |
| 268 | - $this->db->where ( $where_array ); |
|
| 268 | + $this->db->where($where_array); |
|
| 269 | 269 | $flag = '0'; |
| 270 | - $query = $this->db->get ( 'reseller_pricing' ); |
|
| 271 | - if ($query->num_rows () > 0) { |
|
| 270 | + $query = $this->db->get('reseller_pricing'); |
|
| 271 | + if ($query->num_rows() > 0) { |
|
| 272 | 272 | $flag = '1'; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $this->insert_reseller_pricing ( $accountinfo, $post ); |
|
| 275 | + $this->insert_reseller_pricing($accountinfo, $post); |
|
| 276 | 276 | return $flag; |
| 277 | 277 | } |
| 278 | 278 | function delete_pricing_reseller($username, $number) { |
| 279 | - $where = array ( |
|
| 279 | + $where = array( |
|
| 280 | 280 | 'reseller_id' => $username, |
| 281 | 281 | 'note' => $number, |
| 282 | 282 | 'type' => '1' |
| 283 | 283 | ); |
| 284 | - $this->db->where ( $where ); |
|
| 285 | - $this->db->delete ( 'reseller_pricing' ); |
|
| 284 | + $this->db->where($where); |
|
| 285 | + $this->db->delete('reseller_pricing'); |
|
| 286 | 286 | return true; |
| 287 | 287 | } |
| 288 | 288 | function insert_reseller_pricing($accountinfo, $post) { |
| 289 | - $insert_array = array ( |
|
| 289 | + $insert_array = array( |
|
| 290 | 290 | 'reseller_id' => $accountinfo ['id'], |
| 291 | 291 | 'type' => '1', |
| 292 | 292 | 'did_id' => $post ['id'], |
@@ -303,36 +303,36 @@ discard block |
||
| 303 | 303 | 'connectcost' => $post ['connectcost'], |
| 304 | 304 | 'includedseconds' => $post ['includedseconds'], |
| 305 | 305 | 'status' => '0', |
| 306 | - 'assign_date' => gmdate ( 'Y-m-d H:i:s' ) |
|
| 306 | + 'assign_date' => gmdate('Y-m-d H:i:s') |
|
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | - $this->db->insert ( 'reseller_pricing', $insert_array ); |
|
| 309 | + $this->db->insert('reseller_pricing', $insert_array); |
|
| 310 | 310 | return true; |
| 311 | 311 | } |
| 312 | 312 | function update_dids_reseller($post) { |
| 313 | - $where = array ( |
|
| 313 | + $where = array( |
|
| 314 | 314 | 'id' => $post ['did_id'] |
| 315 | 315 | ); |
| 316 | - $update_array = array ( |
|
| 316 | + $update_array = array( |
|
| 317 | 317 | 'dial_as' => $post ['dial_as'], |
| 318 | 318 | 'extensions' => $post ['extension'] |
| 319 | 319 | ); |
| 320 | - $this->db->where ( $where ); |
|
| 321 | - $this->db->update ( 'dids', $update_array ); |
|
| 320 | + $this->db->where($where); |
|
| 321 | + $this->db->update('dids', $update_array); |
|
| 322 | 322 | } |
| 323 | 323 | function delete_routes($id, $number, $pricelist_id) { |
| 324 | - $number = "^" . $number . ".*"; |
|
| 325 | - $where = array ( |
|
| 324 | + $number = "^".$number.".*"; |
|
| 325 | + $where = array( |
|
| 326 | 326 | 'pricelist_id' => $pricelist_id, |
| 327 | 327 | 'pattern' => $number |
| 328 | 328 | ); |
| 329 | - $this->db->where ( $where ); |
|
| 330 | - $this->db->delete ( 'routes' ); |
|
| 329 | + $this->db->where($where); |
|
| 330 | + $this->db->delete('routes'); |
|
| 331 | 331 | } |
| 332 | 332 | function insert_routes($post, $pricelist_id) { |
| 333 | - $commment = "DID:" . $post ['country'] . "," . $post ['province'] . "," . $post ['city']; |
|
| 334 | - $insert_array = array ( |
|
| 335 | - 'pattern' => "^" . $post ['number'] . ".*", |
|
| 333 | + $commment = "DID:".$post ['country'].",".$post ['province'].",".$post ['city']; |
|
| 334 | + $insert_array = array( |
|
| 335 | + 'pattern' => "^".$post ['number'].".*", |
|
| 336 | 336 | 'comment' => $commment, |
| 337 | 337 | 'pricelist_id' => $pricelist_id, |
| 338 | 338 | 'connectcost' => $post ['connectcost'], |
@@ -340,11 +340,11 @@ discard block |
||
| 340 | 340 | 'cost' => $post ['cost'], |
| 341 | 341 | 'inc' => $post ['inc'] |
| 342 | 342 | ); |
| 343 | - $this->db->insert ( 'routes', $insert_array ); |
|
| 343 | + $this->db->insert('routes', $insert_array); |
|
| 344 | 344 | return true; |
| 345 | 345 | } |
| 346 | 346 | function add_invoice_data($accountid, $charge_type, $description, $credit) { |
| 347 | - $insert_array = array ( |
|
| 347 | + $insert_array = array( |
|
| 348 | 348 | 'accountid' => $accountid, |
| 349 | 349 | 'charge_type' => $charge_type, |
| 350 | 350 | 'description' => $description, |
@@ -353,14 +353,14 @@ discard block |
||
| 353 | 353 | 'package_id' => '0' |
| 354 | 354 | ); |
| 355 | 355 | |
| 356 | - $this->db->insert ( 'invoice_item', $insert_array ); |
|
| 356 | + $this->db->insert('invoice_item', $insert_array); |
|
| 357 | 357 | return true; |
| 358 | 358 | } |
| 359 | 359 | function check_unique_did($number) { |
| 360 | - $where = array ( |
|
| 360 | + $where = array( |
|
| 361 | 361 | 'number' => $number |
| 362 | 362 | ); |
| 363 | - $query = $this->db_model->countQuery ( "*", "dids", $where ); |
|
| 363 | + $query = $this->db_model->countQuery("*", "dids", $where); |
|
| 364 | 364 | return $query; |
| 365 | 365 | } |
| 366 | 366 | } |
@@ -23,38 +23,38 @@ discard block |
||
| 23 | 23 | // ############################################################################## |
| 24 | 24 | class DID extends MX_Controller { |
| 25 | 25 | function DID() { |
| 26 | - parent::__construct (); |
|
| 26 | + parent::__construct(); |
|
| 27 | 27 | |
| 28 | - $this->load->helper ( 'template_inheritance' ); |
|
| 29 | - $this->load->library ( 'session' ); |
|
| 30 | - $this->load->library ( 'did_form' ); |
|
| 31 | - $this->load->library ( 'astpp/form' ); |
|
| 32 | - $this->load->model ( 'did_model' ); |
|
| 33 | - $this->load->library ( 'csvreader' ); |
|
| 28 | + $this->load->helper('template_inheritance'); |
|
| 29 | + $this->load->library('session'); |
|
| 30 | + $this->load->library('did_form'); |
|
| 31 | + $this->load->library('astpp/form'); |
|
| 32 | + $this->load->model('did_model'); |
|
| 33 | + $this->load->library('csvreader'); |
|
| 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 | function did_add() { |
| 39 | 39 | $data ['country_id'] = Common_model::$global_config ['system_config'] ['country']; |
| 40 | - $data ['page_title'] = gettext ( 'Create' ) . ' DID'; |
|
| 41 | - $data ['form'] = $this->form->build_form ( $this->did_form->get_dids_form_fields (), '' ); |
|
| 40 | + $data ['page_title'] = gettext('Create').' DID'; |
|
| 41 | + $data ['form'] = $this->form->build_form($this->did_form->get_dids_form_fields(), ''); |
|
| 42 | 42 | $data ['country_id'] = Common_model::$global_config ['system_config'] ['country']; |
| 43 | 43 | |
| 44 | - if (! $data ['country_id']) { |
|
| 44 | + if ( ! $data ['country_id']) { |
|
| 45 | 45 | $data ['country_id'] = 1; |
| 46 | 46 | } |
| 47 | - $data ['form'] = $this->form->build_form ( $this->did_form->get_dids_form_fields ( '', '', '', $data ['country_id'] ), '' ); |
|
| 47 | + $data ['form'] = $this->form->build_form($this->did_form->get_dids_form_fields('', '', '', $data ['country_id']), ''); |
|
| 48 | 48 | |
| 49 | - $this->load->view ( 'view_did_add_edit', $data ); |
|
| 49 | + $this->load->view('view_did_add_edit', $data); |
|
| 50 | 50 | } |
| 51 | 51 | function did_edit($edit_id = '') { |
| 52 | - $data ['page_title'] = gettext ( 'Edit DID' ); |
|
| 53 | - $where = array ( |
|
| 52 | + $data ['page_title'] = gettext('Edit DID'); |
|
| 53 | + $where = array( |
|
| 54 | 54 | 'id' => $edit_id |
| 55 | 55 | ); |
| 56 | - $account = $this->db_model->getSelect ( "*", "dids", $where ); |
|
| 57 | - foreach ( $account->result_array () as $value ) { |
|
| 56 | + $account = $this->db_model->getSelect("*", "dids", $where); |
|
| 57 | + foreach ($account->result_array() as $value) { |
|
| 58 | 58 | $edit_data = $value; |
| 59 | 59 | } |
| 60 | 60 | /** |
@@ -66,73 +66,73 @@ discard block |
||
| 66 | 66 | $data ['country_id'] = Common_model::$global_config ['system_config'] ['country']; |
| 67 | 67 | } |
| 68 | 68 | /* * ************************************************* */ |
| 69 | - if (! $data ['country_id']) { |
|
| 69 | + if ( ! $data ['country_id']) { |
|
| 70 | 70 | $data ['country_id'] = 1; |
| 71 | 71 | } |
| 72 | - $edit_data ['setup'] = $this->common_model->to_calculate_currency ( $edit_data ['setup'], '', '', false, false ); |
|
| 73 | - $edit_data ['monthlycost'] = $this->common_model->to_calculate_currency ( $edit_data ['monthlycost'], '', '', false, false ); |
|
| 74 | - $edit_data ['connectcost'] = $this->common_model->to_calculate_currency ( $edit_data ['connectcost'], '', '', false, false ); |
|
| 75 | - $edit_data ['cost'] = $this->common_model->to_calculate_currency ( $edit_data ['cost'], '', '', false, false ); |
|
| 72 | + $edit_data ['setup'] = $this->common_model->to_calculate_currency($edit_data ['setup'], '', '', false, false); |
|
| 73 | + $edit_data ['monthlycost'] = $this->common_model->to_calculate_currency($edit_data ['monthlycost'], '', '', false, false); |
|
| 74 | + $edit_data ['connectcost'] = $this->common_model->to_calculate_currency($edit_data ['connectcost'], '', '', false, false); |
|
| 75 | + $edit_data ['cost'] = $this->common_model->to_calculate_currency($edit_data ['cost'], '', '', false, false); |
|
| 76 | 76 | $parent_id = $edit_data ['parent_id']; |
| 77 | 77 | $account_id = $edit_data ['accountid']; |
| 78 | 78 | if ($parent_id > 0) { |
| 79 | - $data ['form'] = $this->form->build_form ( $this->did_form->get_dids_form_fields ( $edit_id, $parent_id, $account_id ), $edit_data ); |
|
| 79 | + $data ['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($edit_id, $parent_id, $account_id), $edit_data); |
|
| 80 | 80 | } else { |
| 81 | - $data ['form'] = $this->form->build_form ( $this->did_form->get_dids_form_fields ( $edit_id, '', $account_id ), $edit_data ); |
|
| 81 | + $data ['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($edit_id, '', $account_id), $edit_data); |
|
| 82 | 82 | } |
| 83 | - $this->load->view ( 'view_did_add_edit', $data ); |
|
| 83 | + $this->load->view('view_did_add_edit', $data); |
|
| 84 | 84 | } |
| 85 | 85 | function did_save() { |
| 86 | - $add_array = $this->input->post (); |
|
| 87 | - $parent_id = isset ( $add_array ['parent_id'] ) && $add_array ['parent_id'] > 0 ? $add_array ['parent_id'] : ''; |
|
| 88 | - $accountid = isset ( $add_array ['accountid'] ) && $add_array ['accountid'] > 0 ? $add_array ['accountid'] : ''; |
|
| 89 | - $data ['form'] = $this->form->build_form ( $this->did_form->get_dids_form_fields ( $add_array ['id'], $parent_id, $accountid ), $add_array ); |
|
| 86 | + $add_array = $this->input->post(); |
|
| 87 | + $parent_id = isset ($add_array ['parent_id']) && $add_array ['parent_id'] > 0 ? $add_array ['parent_id'] : ''; |
|
| 88 | + $accountid = isset ($add_array ['accountid']) && $add_array ['accountid'] > 0 ? $add_array ['accountid'] : ''; |
|
| 89 | + $data ['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($add_array ['id'], $parent_id, $accountid), $add_array); |
|
| 90 | 90 | if ($add_array ['id'] != '') { |
| 91 | - $data ['page_title'] = gettext ( 'Edit DID' ); |
|
| 92 | - if ($this->form_validation->run () == FALSE) { |
|
| 93 | - $data ['validation_errors'] = validation_errors (); |
|
| 91 | + $data ['page_title'] = gettext('Edit DID'); |
|
| 92 | + if ($this->form_validation->run() == FALSE) { |
|
| 93 | + $data ['validation_errors'] = validation_errors(); |
|
| 94 | 94 | echo $data ['validation_errors']; |
| 95 | 95 | exit (); |
| 96 | 96 | } else { |
| 97 | - $this->db->where ( 'id', $add_array ['id'] ); |
|
| 98 | - $this->db->select ( 'number' ); |
|
| 99 | - $did_info = ( array ) $this->db->get ( 'dids' )->first_row (); |
|
| 97 | + $this->db->where('id', $add_array ['id']); |
|
| 98 | + $this->db->select('number'); |
|
| 99 | + $did_info = (array)$this->db->get('dids')->first_row(); |
|
| 100 | 100 | $number = $did_info ['number']; |
| 101 | 101 | // unset($add_array['number']); |
| 102 | - $add_array ['accountid'] = isset ( $add_array ['accountid'] ) ? $add_array ['accountid'] : 0; |
|
| 103 | - $add_array ['setup'] = $this->common_model->add_calculate_currency ( $add_array ['setup'], '', '', false, false ); |
|
| 104 | - $add_array ['monthlycost'] = $this->common_model->add_calculate_currency ( $add_array ['monthlycost'], '', '', false, false ); |
|
| 105 | - $add_array ['connectcost'] = $this->common_model->add_calculate_currency ( $add_array ['connectcost'], '', '', false, false ); |
|
| 106 | - $add_array ['cost'] = $this->common_model->add_calculate_currency ( $add_array ['cost'], '', '', false, false ); |
|
| 107 | - $this->did_model->edit_did ( $add_array, $add_array ['id'], $number ); |
|
| 108 | - echo json_encode ( array ( |
|
| 109 | - "SUCCESS" => $number . " DID Updated Successfully!" |
|
| 110 | - ) ); |
|
| 102 | + $add_array ['accountid'] = isset ($add_array ['accountid']) ? $add_array ['accountid'] : 0; |
|
| 103 | + $add_array ['setup'] = $this->common_model->add_calculate_currency($add_array ['setup'], '', '', false, false); |
|
| 104 | + $add_array ['monthlycost'] = $this->common_model->add_calculate_currency($add_array ['monthlycost'], '', '', false, false); |
|
| 105 | + $add_array ['connectcost'] = $this->common_model->add_calculate_currency($add_array ['connectcost'], '', '', false, false); |
|
| 106 | + $add_array ['cost'] = $this->common_model->add_calculate_currency($add_array ['cost'], '', '', false, false); |
|
| 107 | + $this->did_model->edit_did($add_array, $add_array ['id'], $number); |
|
| 108 | + echo json_encode(array( |
|
| 109 | + "SUCCESS" => $number." DID Updated Successfully!" |
|
| 110 | + )); |
|
| 111 | 111 | exit (); |
| 112 | 112 | } |
| 113 | 113 | } else { |
| 114 | - $data ['page_title'] = gettext ( 'Add DID' ); |
|
| 115 | - if ($this->form_validation->run () == FALSE) { |
|
| 116 | - $data ['validation_errors'] = validation_errors (); |
|
| 114 | + $data ['page_title'] = gettext('Add DID'); |
|
| 115 | + if ($this->form_validation->run() == FALSE) { |
|
| 116 | + $data ['validation_errors'] = validation_errors(); |
|
| 117 | 117 | echo $data ['validation_errors']; |
| 118 | 118 | exit (); |
| 119 | 119 | } else { |
| 120 | - $check_did_number = $this->did_model->check_unique_did ( $add_array ['number'] ); |
|
| 120 | + $check_did_number = $this->did_model->check_unique_did($add_array ['number']); |
|
| 121 | 121 | if ($check_did_number > 0) { |
| 122 | - echo json_encode ( array ( |
|
| 122 | + echo json_encode(array( |
|
| 123 | 123 | "number_error" => "Number already exist in system." |
| 124 | - ) ); |
|
| 124 | + )); |
|
| 125 | 125 | exit (); |
| 126 | 126 | } |
| 127 | - $add_array ['setup'] = $this->common_model->add_calculate_currency ( $add_array ['setup'], '', '', false, false ); |
|
| 128 | - $add_array ['monthlycost'] = $this->common_model->add_calculate_currency ( $add_array ['monthlycost'], '', '', false, false ); |
|
| 129 | - $add_array ['connectcost'] = $this->common_model->add_calculate_currency ( $add_array ['connectcost'], '', '', false, false ); |
|
| 130 | - $add_array ['cost'] = $this->common_model->add_calculate_currency ( $add_array ['cost'], '', '', false, false ); |
|
| 131 | - $add_array ['accountid'] = isset ( $add_array ['accountid'] ) ? $add_array ['accountid'] : 0; |
|
| 132 | - $this->did_model->add_did ( $add_array ); |
|
| 133 | - echo json_encode ( array ( |
|
| 134 | - "SUCCESS" => $add_array ["number"] . " DID Added Successfully!" |
|
| 135 | - ) ); |
|
| 127 | + $add_array ['setup'] = $this->common_model->add_calculate_currency($add_array ['setup'], '', '', false, false); |
|
| 128 | + $add_array ['monthlycost'] = $this->common_model->add_calculate_currency($add_array ['monthlycost'], '', '', false, false); |
|
| 129 | + $add_array ['connectcost'] = $this->common_model->add_calculate_currency($add_array ['connectcost'], '', '', false, false); |
|
| 130 | + $add_array ['cost'] = $this->common_model->add_calculate_currency($add_array ['cost'], '', '', false, false); |
|
| 131 | + $add_array ['accountid'] = isset ($add_array ['accountid']) ? $add_array ['accountid'] : 0; |
|
| 132 | + $this->did_model->add_did($add_array); |
|
| 133 | + echo json_encode(array( |
|
| 134 | + "SUCCESS" => $add_array ["number"]." DID Added Successfully!" |
|
| 135 | + )); |
|
| 136 | 136 | exit (); |
| 137 | 137 | exit (); |
| 138 | 138 | } |
@@ -140,16 +140,16 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | // /*ASTPP_invoice_changes_05_05_start*/ |
| 142 | 142 | function did_remove($id) { |
| 143 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
| 144 | - $ProcessCharges = new ProcessCharges (); |
|
| 145 | - $Params = array ( |
|
| 143 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
| 144 | + $ProcessCharges = new ProcessCharges(); |
|
| 145 | + $Params = array( |
|
| 146 | 146 | "DIDid" => $id |
| 147 | 147 | ); |
| 148 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
| 148 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
| 149 | 149 | |
| 150 | - $this->did_model->remove_did ( $id ); |
|
| 151 | - $this->session->set_flashdata ( 'astpp_notification', 'DID Removed Successfully!' ); |
|
| 152 | - redirect ( base_url () . 'did/did_list/' ); |
|
| 150 | + $this->did_model->remove_did($id); |
|
| 151 | + $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully!'); |
|
| 152 | + redirect(base_url().'did/did_list/'); |
|
| 153 | 153 | } |
| 154 | 154 | // end |
| 155 | 155 | |
@@ -158,150 +158,150 @@ discard block |
||
| 158 | 158 | * function Spelling change. |
| 159 | 159 | */ |
| 160 | 160 | function did_list_release($id) { |
| 161 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 162 | - $this->db->where ( 'id', $id ); |
|
| 163 | - $this->db->select ( 'parent_id,accountid,number' ); |
|
| 164 | - $did_info = ( array ) $this->db->get ( 'dids' )->first_row (); |
|
| 161 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 162 | + $this->db->where('id', $id); |
|
| 163 | + $this->db->select('parent_id,accountid,number'); |
|
| 164 | + $did_info = (array)$this->db->get('dids')->first_row(); |
|
| 165 | 165 | if ($did_info ['parent_id'] > 0) { |
| 166 | - $str = $this->common->get_parent_info ( $did_info ['parent_id'], $accountinfo ['id'] ); |
|
| 167 | - $str = rtrim ( $str, "," ); |
|
| 168 | - $account_result = ( array ) $this->db->get_where ( 'accounts', "id IN (" . $str . ")" )->result_array (); |
|
| 169 | - foreach ( $account_result as $key => $acc_row ) { |
|
| 166 | + $str = $this->common->get_parent_info($did_info ['parent_id'], $accountinfo ['id']); |
|
| 167 | + $str = rtrim($str, ","); |
|
| 168 | + $account_result = (array)$this->db->get_where('accounts', "id IN (".$str.")")->result_array(); |
|
| 169 | + foreach ($account_result as $key => $acc_row) { |
|
| 170 | 170 | $acc_row ['did_number'] = $did_info ['number']; |
| 171 | - $this->common->mail_to_users ( 'email_remove_did', $acc_row ); |
|
| 171 | + $this->common->mail_to_users('email_remove_did', $acc_row); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | if ($accountinfo ['type'] == - 1) { |
| 175 | 175 | // /*ASTPP_invoice_changes_05_05_start*/ |
| 176 | - $update_array = array ( |
|
| 176 | + $update_array = array( |
|
| 177 | 177 | 'parent_id' => 0, |
| 178 | 178 | 'accountid' => 0, |
| 179 | 179 | 'assign_date' => '0000-00-00 00:00:00', |
| 180 | 180 | "charge_upto" => "0000-00-00 00:00:00", |
| 181 | - "last_modified_date" => gmdate ( "Y-m-d H:i:s" ), |
|
| 181 | + "last_modified_date" => gmdate("Y-m-d H:i:s"), |
|
| 182 | 182 | 'call_type' => '-1', |
| 183 | 183 | 'extensions' => '' |
| 184 | 184 | ); |
| 185 | 185 | // end |
| 186 | - $where = array ( |
|
| 186 | + $where = array( |
|
| 187 | 187 | 'id' => $id |
| 188 | 188 | ); |
| 189 | - $this->db->where ( $where ); |
|
| 190 | - $this->db->update ( 'dids', $update_array ); |
|
| 189 | + $this->db->where($where); |
|
| 190 | + $this->db->update('dids', $update_array); |
|
| 191 | 191 | if ($did_info ['parent_id'] > 0) { |
| 192 | - $this->db->where ( 'note', $did_info ['number'] ); |
|
| 193 | - $this->db->delete ( "reseller_pricing" ); |
|
| 192 | + $this->db->where('note', $did_info ['number']); |
|
| 193 | + $this->db->delete("reseller_pricing"); |
|
| 194 | 194 | } |
| 195 | 195 | } else { |
| 196 | - $reseller_ids = $this->common->get_subreseller_info ( $accountinfo ['id'] ); |
|
| 197 | - $reseller_ids = rtrim ( $reseller_ids, "," ); |
|
| 196 | + $reseller_ids = $this->common->get_subreseller_info($accountinfo ['id']); |
|
| 197 | + $reseller_ids = rtrim($reseller_ids, ","); |
|
| 198 | 198 | $where = "parent_id IN ($reseller_ids)"; |
| 199 | - $this->db->where ( 'note', $did_info ['number'] ); |
|
| 200 | - $this->db->delete ( 'reseller_pricing', $where ); |
|
| 199 | + $this->db->where('note', $did_info ['number']); |
|
| 200 | + $this->db->delete('reseller_pricing', $where); |
|
| 201 | 201 | } |
| 202 | 202 | // /*ASTPP_invoice_changes_05_05_start*/ |
| 203 | 203 | if ($accountinfo ['type'] == 1) { |
| 204 | - $update_array = array ( |
|
| 204 | + $update_array = array( |
|
| 205 | 205 | 'parent_id' => $accountinfo ['id'], |
| 206 | 206 | 'accountid' => 0, |
| 207 | 207 | 'assign_date' => '0000-00-00 00:00:00', |
| 208 | 208 | "charge_upto" => "0000-00-00 00:00:00", |
| 209 | - "last_modified_date" => gmdate ( "Y-m-d H:i:s" ), |
|
| 209 | + "last_modified_date" => gmdate("Y-m-d H:i:s"), |
|
| 210 | 210 | 'call_type' => '-1', |
| 211 | 211 | 'extensions' => '' |
| 212 | 212 | ); |
| 213 | 213 | } else { |
| 214 | - $update_array = array ( |
|
| 214 | + $update_array = array( |
|
| 215 | 215 | 'parent_id' => 0, |
| 216 | 216 | 'accountid' => 0, |
| 217 | 217 | 'assign_date' => '0000-00-00 00:00:00', |
| 218 | 218 | "charge_upto" => "0000-00-00 00:00:00", |
| 219 | - "last_modified_date" => gmdate ( "Y-m-d H:i:s" ), |
|
| 219 | + "last_modified_date" => gmdate("Y-m-d H:i:s"), |
|
| 220 | 220 | 'call_type' => '-1', |
| 221 | 221 | 'extensions' => '' |
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | // end |
| 225 | - $where = array ( |
|
| 225 | + $where = array( |
|
| 226 | 226 | 'id' => $id |
| 227 | 227 | ); |
| 228 | - $this->db->where ( $where ); |
|
| 229 | - $this->db->update ( 'dids', $update_array ); |
|
| 228 | + $this->db->where($where); |
|
| 229 | + $this->db->update('dids', $update_array); |
|
| 230 | 230 | $accountid = $did_info ['accountid'] > 0 ? $did_info ['accountid'] : 0; |
| 231 | 231 | if ($did_info ['accountid'] > 0) { |
| 232 | 232 | $email_user_id = $did_info ['accountid']; |
| 233 | 233 | } elseif ($did_info ['parent_id'] > 0) { |
| 234 | 234 | $email_user_id = $did_info ['parent_id']; |
| 235 | 235 | } |
| 236 | - $accountinfo = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 236 | + $accountinfo = (array)$this->db->get_where('accounts', array( |
|
| 237 | 237 | "id" => $email_user_id |
| 238 | - ) )->first_row (); |
|
| 238 | + ))->first_row(); |
|
| 239 | 239 | $accountinfo ['did_number'] = $did_info ['number']; |
| 240 | 240 | // /*ASTPP_invoice_changes_05_05_start*/ |
| 241 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
| 242 | - $ProcessCharges = new ProcessCharges (); |
|
| 243 | - $Params = array ( |
|
| 241 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
| 242 | + $ProcessCharges = new ProcessCharges(); |
|
| 243 | + $Params = array( |
|
| 244 | 244 | "DIDid" => $id |
| 245 | 245 | ); |
| 246 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
| 246 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
| 247 | 247 | // end |
| 248 | - $this->common->mail_to_users ( 'email_remove_did', $accountinfo ); |
|
| 249 | - $this->session->set_flashdata ( 'astpp_errormsg', 'DID Released Successfully!' ); |
|
| 250 | - redirect ( base_url () . 'did/did_list/' ); |
|
| 248 | + $this->common->mail_to_users('email_remove_did', $accountinfo); |
|
| 249 | + $this->session->set_flashdata('astpp_errormsg', 'DID Released Successfully!'); |
|
| 250 | + redirect(base_url().'did/did_list/'); |
|
| 251 | 251 | } |
| 252 | 252 | function did_list() { |
| 253 | 253 | $data ['app_name'] = 'ASTPP - Open Source Billing Solution | Manage DIDs | DIDS'; |
| 254 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 255 | - $data ['page_title'] = gettext ( 'DIDs' ); |
|
| 254 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 255 | + $data ['page_title'] = gettext('DIDs'); |
|
| 256 | 256 | $data ['search_flag'] = true; |
| 257 | - $this->session->set_userdata ( 'did_search', 0 ); |
|
| 258 | - if ($this->session->userdata ( 'logintype' ) == 2) { |
|
| 259 | - $data ["grid_buttons"] = $this->did_form->build_grid_buttons (); |
|
| 257 | + $this->session->set_userdata('did_search', 0); |
|
| 258 | + if ($this->session->userdata('logintype') == 2) { |
|
| 259 | + $data ["grid_buttons"] = $this->did_form->build_grid_buttons(); |
|
| 260 | 260 | } else { |
| 261 | - $data ["grid_buttons"] = json_encode ( array () ); |
|
| 261 | + $data ["grid_buttons"] = json_encode(array()); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if ($this->session->userdata ['userlevel_logintype'] == '1') { |
| 265 | - $drp_list = array (); |
|
| 266 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 265 | + $drp_list = array(); |
|
| 266 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 267 | 267 | if ($accountinfo ['reseller_id'] > 0) { |
| 268 | - $dids_array = $this->db->query ( "SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = " . $accountinfo ['reseller_id'] . " AND a.parent_id =" . $accountinfo ['reseller_id'] )->result_array (); |
|
| 268 | + $dids_array = $this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo ['reseller_id']." AND a.parent_id =".$accountinfo ['reseller_id'])->result_array(); |
|
| 269 | 269 | } else { |
| 270 | - $this->db->select ( 'id,monthlycost,setup,number' ); |
|
| 271 | - $this->db->where ( 'accountid', 0 ); |
|
| 272 | - $this->db->where ( 'parent_id', 0 ); |
|
| 273 | - $dids_array = $this->db->get ( 'dids' )->result_array (); |
|
| 270 | + $this->db->select('id,monthlycost,setup,number'); |
|
| 271 | + $this->db->where('accountid', 0); |
|
| 272 | + $this->db->where('parent_id', 0); |
|
| 273 | + $dids_array = $this->db->get('dids')->result_array(); |
|
| 274 | 274 | } |
| 275 | - if (! empty ( $dids_array )) { |
|
| 276 | - foreach ( $dids_array as $drp_value ) { |
|
| 277 | - if (! empty ( $drp_value ['monthlycost'] ) && $drp_value ['monthlycost'] != 0) { |
|
| 278 | - $did_cost = $this->common_model->to_calculate_currency ( $drp_value ['monthlycost'], '', '', true, false ); |
|
| 275 | + if ( ! empty ($dids_array)) { |
|
| 276 | + foreach ($dids_array as $drp_value) { |
|
| 277 | + if ( ! empty ($drp_value ['monthlycost']) && $drp_value ['monthlycost'] != 0) { |
|
| 278 | + $did_cost = $this->common_model->to_calculate_currency($drp_value ['monthlycost'], '', '', true, false); |
|
| 279 | 279 | } else { |
| 280 | 280 | $did_cost = 0; |
| 281 | 281 | } |
| 282 | - if (! empty ( $drp_value ['setup'] ) && $drp_value ['setup'] != 0) { |
|
| 283 | - $did_setup = $this->common_model->to_calculate_currency ( $drp_value ['setup'], '', '', true, false ); |
|
| 282 | + if ( ! empty ($drp_value ['setup']) && $drp_value ['setup'] != 0) { |
|
| 283 | + $did_setup = $this->common_model->to_calculate_currency($drp_value ['setup'], '', '', true, false); |
|
| 284 | 284 | } else { |
| 285 | 285 | $did_setup = 0; |
| 286 | 286 | } |
| 287 | - $drp_list [$drp_value ['id']] = $drp_value ['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
| 287 | + $drp_list [$drp_value ['id']] = $drp_value ['number'].' ( Setup : '.$did_setup.')'.'( Monthly : '.$did_cost.' )'; |
|
| 288 | 288 | /* * ********************************************************************************************* */ |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | - $data ['didlist'] = form_dropdown_all ( array ( |
|
| 291 | + $data ['didlist'] = form_dropdown_all(array( |
|
| 292 | 292 | "name" => "free_did_list", |
| 293 | 293 | "id" => "free_did_list", |
| 294 | 294 | "class" => "did_dropdown" |
| 295 | - ), $drp_list, '' ); |
|
| 295 | + ), $drp_list, ''); |
|
| 296 | 296 | } |
| 297 | 297 | if ($this->session->userdata ['userlevel_logintype'] == '1') { |
| 298 | - $data ['grid_fields'] = $this->did_form->build_did_list_for_reseller_login (); |
|
| 299 | - $data ['form_search'] = $this->form->build_serach_form ( $this->did_form->get_search_did_form_for_reseller () ); |
|
| 298 | + $data ['grid_fields'] = $this->did_form->build_did_list_for_reseller_login(); |
|
| 299 | + $data ['form_search'] = $this->form->build_serach_form($this->did_form->get_search_did_form_for_reseller()); |
|
| 300 | 300 | } else { |
| 301 | - $data ['grid_fields'] = $this->did_form->build_did_list_for_admin (); |
|
| 302 | - $data ['form_search'] = $this->form->build_serach_form ( $this->did_form->get_search_did_form () ); |
|
| 301 | + $data ['grid_fields'] = $this->did_form->build_did_list_for_admin(); |
|
| 302 | + $data ['form_search'] = $this->form->build_serach_form($this->did_form->get_search_did_form()); |
|
| 303 | 303 | } |
| 304 | - $this->load->view ( 'view_did_list', $data ); |
|
| 304 | + $this->load->view('view_did_list', $data); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -309,67 +309,67 @@ discard block |
||
| 309 | 309 | * Listing of Accounts table data through php function json_encode |
| 310 | 310 | */ |
| 311 | 311 | function did_list_json() { |
| 312 | - $json_data = array (); |
|
| 312 | + $json_data = array(); |
|
| 313 | 313 | |
| 314 | - $count_all = $this->did_model->getdid_list ( false ); |
|
| 315 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 314 | + $count_all = $this->did_model->getdid_list(false); |
|
| 315 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 316 | 316 | $json_data = $paging_data ["json_paging"]; |
| 317 | - $list = $this->session->userdata ['userlevel_logintype'] == 1 ? $this->did_form->build_did_list_for_reseller_login () : $this->did_form->build_did_list_for_admin (); |
|
| 318 | - $query = $this->did_model->getdid_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 319 | - $grid_fields = json_decode ( $list ); |
|
| 320 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 317 | + $list = $this->session->userdata ['userlevel_logintype'] == 1 ? $this->did_form->build_did_list_for_reseller_login() : $this->did_form->build_did_list_for_admin(); |
|
| 318 | + $query = $this->did_model->getdid_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 319 | + $grid_fields = json_decode($list); |
|
| 320 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 321 | 321 | |
| 322 | - echo json_encode ( $json_data ); |
|
| 322 | + echo json_encode($json_data); |
|
| 323 | 323 | } |
| 324 | 324 | function did_list_search() { |
| 325 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 326 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 327 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 328 | - $action = $this->input->post (); |
|
| 329 | - unset ( $action ['action'] ); |
|
| 330 | - unset ( $action ['advance_search'] ); |
|
| 331 | - $this->session->set_userdata ( 'did_list_search', $action ); |
|
| 325 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 326 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 327 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 328 | + $action = $this->input->post(); |
|
| 329 | + unset ($action ['action']); |
|
| 330 | + unset ($action ['advance_search']); |
|
| 331 | + $this->session->set_userdata('did_list_search', $action); |
|
| 332 | 332 | } |
| 333 | 333 | if (@$ajax_search != 1) { |
| 334 | - redirect ( base_url () . 'did/did_list/' ); |
|
| 334 | + redirect(base_url().'did/did_list/'); |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | function did_list_clearsearchfilter() { |
| 338 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 339 | - $this->session->set_userdata ( 'did_search', "" ); |
|
| 338 | + $this->session->set_userdata('advance_search', 0); |
|
| 339 | + $this->session->set_userdata('did_search', ""); |
|
| 340 | 340 | } |
| 341 | 341 | function reseller_did($accountid, $accounttype) { |
| 342 | - $json_data = array (); |
|
| 343 | - $account_query = $this->db_model->getSelect ( "*", "accounts", array ( |
|
| 342 | + $json_data = array(); |
|
| 343 | + $account_query = $this->db_model->getSelect("*", "accounts", array( |
|
| 344 | 344 | "id" => $accountid |
| 345 | - ) ); |
|
| 346 | - $account_arr = $account_query->result_array (); |
|
| 345 | + )); |
|
| 346 | + $account_arr = $account_query->result_array(); |
|
| 347 | 347 | |
| 348 | - $this->db->where ( "reseller_id", $accountid ); |
|
| 349 | - $this->db->select ( 'id' ); |
|
| 350 | - $query = $this->db->get ( 'accounts' ); |
|
| 351 | - $data = $query->result_array (); |
|
| 348 | + $this->db->where("reseller_id", $accountid); |
|
| 349 | + $this->db->select('id'); |
|
| 350 | + $query = $this->db->get('accounts'); |
|
| 351 | + $data = $query->result_array(); |
|
| 352 | 352 | |
| 353 | - $count_all = $this->db_model->countQuery ( "*", "reseller_pricing", array ( |
|
| 353 | + $count_all = $this->db_model->countQuery("*", "reseller_pricing", array( |
|
| 354 | 354 | "reseller_id" => $accountid |
| 355 | - ) ); |
|
| 356 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 355 | + )); |
|
| 356 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 357 | 357 | $json_data = $paging_data ["json_paging"]; |
| 358 | - $this->db->select ( '*,note as number', false ); |
|
| 358 | + $this->db->select('*,note as number', false); |
|
| 359 | 359 | |
| 360 | - $this->db->where ( "reseller_id", $accountid ); |
|
| 360 | + $this->db->where("reseller_id", $accountid); |
|
| 361 | 361 | |
| 362 | 362 | if (@$flag) { |
| 363 | - $this->db->order_by ( 'id', 'ASC' ); |
|
| 364 | - $this->db->limit ( $limit, $start ); |
|
| 363 | + $this->db->order_by('id', 'ASC'); |
|
| 364 | + $this->db->limit($limit, $start); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $query = $this->db->get ( 'reseller_pricing' ); |
|
| 367 | + $query = $this->db->get('reseller_pricing'); |
|
| 368 | 368 | // echo $this->db->last_query();exit; |
| 369 | - $did_grid_fields = json_decode ( $this->did_form->build_did_list_for_reseller ( $accountid, $accounttype ) ); |
|
| 370 | - $json_data ['rows'] = $this->form->build_grid ( $query, $did_grid_fields ); |
|
| 369 | + $did_grid_fields = json_decode($this->did_form->build_did_list_for_reseller($accountid, $accounttype)); |
|
| 370 | + $json_data ['rows'] = $this->form->build_grid($query, $did_grid_fields); |
|
| 371 | 371 | |
| 372 | - echo json_encode ( $json_data ); |
|
| 372 | + echo json_encode($json_data); |
|
| 373 | 373 | } |
| 374 | 374 | /* |
| 375 | 375 | * ASTPP 3.0 |
@@ -377,13 +377,13 @@ discard block |
||
| 377 | 377 | * |
| 378 | 378 | */ |
| 379 | 379 | function customer_did($accountid, $accounttype) { |
| 380 | - $json_data = array (); |
|
| 381 | - $instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_did' ); |
|
| 382 | - $account_arr = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 380 | + $json_data = array(); |
|
| 381 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_did'); |
|
| 382 | + $account_arr = (array)$this->db->get_where('accounts', array( |
|
| 383 | 383 | "id" => $accountid |
| 384 | - ) )->first_row (); |
|
| 384 | + ))->first_row(); |
|
| 385 | 385 | $field_name = $accounttype == "reseller" ? "parent_id" : 'accountid'; |
| 386 | - $like_str = ! empty ( $instant_search ) ? "(a.note like '%$instant_search%' |
|
| 386 | + $like_str = ! empty ($instant_search) ? "(a.note like '%$instant_search%' |
|
| 387 | 387 | OR a.init_inc like '%$instant_search%' |
| 388 | 388 | OR a.inc like '%$instant_search%' |
| 389 | 389 | OR a.cost like '%$instant_search%' |
@@ -393,30 +393,30 @@ discard block |
||
| 393 | 393 | OR a.connectcost like '%$instant_search%' |
| 394 | 394 | )" : null; |
| 395 | 395 | if ($account_arr ['reseller_id'] != 0) { |
| 396 | - if (! empty ( $like_str )) |
|
| 397 | - $this->db->where ( $like_str ); |
|
| 396 | + if ( ! empty ($like_str)) |
|
| 397 | + $this->db->where($like_str); |
|
| 398 | 398 | if ($accounttype == 'reseller') { |
| 399 | - $this->db->where ( 'a.note', 'b.number', false ); |
|
| 400 | - $this->db->where ( 'a.reseller_id', $account_arr ['id'] ); |
|
| 401 | - $this->db->where ( 'a.parent_id', $account_arr ['reseller_id'] ); |
|
| 402 | - $this->db->select ( 'count(a.id) as count' ); |
|
| 403 | - $count_result = ( array ) $this->db->get ( 'reseller_pricing as a,dids as b' )->first_row (); |
|
| 404 | - $paging_data = $this->form->load_grid_config ( $count_result ['count'], $_GET ['rp'], $_GET ['page'] ); |
|
| 399 | + $this->db->where('a.note', 'b.number', false); |
|
| 400 | + $this->db->where('a.reseller_id', $account_arr ['id']); |
|
| 401 | + $this->db->where('a.parent_id', $account_arr ['reseller_id']); |
|
| 402 | + $this->db->select('count(a.id) as count'); |
|
| 403 | + $count_result = (array)$this->db->get('reseller_pricing as a,dids as b')->first_row(); |
|
| 404 | + $paging_data = $this->form->load_grid_config($count_result ['count'], $_GET ['rp'], $_GET ['page']); |
|
| 405 | 405 | $json_data = $paging_data ["json_paging"]; |
| 406 | - $this->db->where ( 'a.note', 'b.number', false ); |
|
| 407 | - $this->db->where ( 'a.reseller_id', $account_arr ['id'] ); |
|
| 408 | - $this->db->where ( 'a.parent_id', $account_arr ['reseller_id'] ); |
|
| 409 | - $this->db->select ( 'a . * , b.id, a.reseller_id AS accountid,a.note as number,b.country_id as country_id' ); |
|
| 410 | - $this->db->limit ( $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] ); |
|
| 411 | - $query = $this->db->get ( 'reseller_pricing as a,dids as b' ); |
|
| 406 | + $this->db->where('a.note', 'b.number', false); |
|
| 407 | + $this->db->where('a.reseller_id', $account_arr ['id']); |
|
| 408 | + $this->db->where('a.parent_id', $account_arr ['reseller_id']); |
|
| 409 | + $this->db->select('a . * , b.id, a.reseller_id AS accountid,a.note as number,b.country_id as country_id'); |
|
| 410 | + $this->db->limit($paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"]); |
|
| 411 | + $query = $this->db->get('reseller_pricing as a,dids as b'); |
|
| 412 | 412 | } else { |
| 413 | - $count_result = ( array ) $this->db->query ( 'select count(id) as count from dids where accountid=' . $accountid . " AND parent_id =" . $account_arr ['reseller_id'] )->first_row (); |
|
| 414 | - $paging_data = $this->form->load_grid_config ( $count_result ['count'], $_GET ['rp'], $_GET ['page'] ); |
|
| 413 | + $count_result = (array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr ['reseller_id'])->first_row(); |
|
| 414 | + $paging_data = $this->form->load_grid_config($count_result ['count'], $_GET ['rp'], $_GET ['page']); |
|
| 415 | 415 | $json_data = $paging_data ["json_paging"]; |
| 416 | - $query = $this->db->query ( "SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =" . $account_arr ['id'] . " AND a.note = b.number AND a.reseller_id =" . $account_arr ['reseller_id'] ); |
|
| 416 | + $query = $this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr ['id']." AND a.note = b.number AND a.reseller_id =".$account_arr ['reseller_id']); |
|
| 417 | 417 | } |
| 418 | 418 | } else { |
| 419 | - $like_str = ! empty ( $instant_search ) ? "(dids.number like '%$instant_search%' |
|
| 419 | + $like_str = ! empty ($instant_search) ? "(dids.number like '%$instant_search%' |
|
| 420 | 420 | OR dids.inc like '%$instant_search%' |
| 421 | 421 | OR dids.cost like '%$instant_search%' |
| 422 | 422 | OR dids.includedseconds like '%$instant_search%' |
@@ -424,34 +424,34 @@ discard block |
||
| 424 | 424 | OR dids.monthlycost like '%$instant_search%' |
| 425 | 425 | OR dids.connectcost like '%$instant_search%' |
| 426 | 426 | )" : null; |
| 427 | - if (! empty ( $like_str )) |
|
| 428 | - $this->db->where ( $like_str ); |
|
| 429 | - $where = array ( |
|
| 427 | + if ( ! empty ($like_str)) |
|
| 428 | + $this->db->where($like_str); |
|
| 429 | + $where = array( |
|
| 430 | 430 | $field_name => $accountid |
| 431 | 431 | ); |
| 432 | - $count_all = $this->db_model->countQuery ( "*", "dids", $where ); |
|
| 433 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 432 | + $count_all = $this->db_model->countQuery("*", "dids", $where); |
|
| 433 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 434 | 434 | $json_data = $paging_data ["json_paging"]; |
| 435 | - if (! empty ( $like_str )) |
|
| 436 | - $this->db->where ( $like_str ); |
|
| 437 | - $query = $this->db_model->select ( "*", "dids", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] ); |
|
| 435 | + if ( ! empty ($like_str)) |
|
| 436 | + $this->db->where($like_str); |
|
| 437 | + $query = $this->db_model->select("*", "dids", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"]); |
|
| 438 | 438 | } |
| 439 | - $did_grid_fields = json_decode ( $this->did_form->build_did_list_for_customer ( $accountid, $accounttype ) ); |
|
| 440 | - $json_data ['rows'] = $this->form->build_grid ( $query, $did_grid_fields ); |
|
| 441 | - echo json_encode ( $json_data ); |
|
| 439 | + $did_grid_fields = json_decode($this->did_form->build_did_list_for_customer($accountid, $accounttype)); |
|
| 440 | + $json_data ['rows'] = $this->form->build_grid($query, $did_grid_fields); |
|
| 441 | + echo json_encode($json_data); |
|
| 442 | 442 | } |
| 443 | 443 | function did_delete_multiple() { |
| 444 | - $ids = $this->input->post ( "selected_ids", true ); |
|
| 444 | + $ids = $this->input->post("selected_ids", true); |
|
| 445 | 445 | $where = "id IN ($ids)"; |
| 446 | - $this->db->where ( $where ); |
|
| 447 | - $this->db->select ( "group_concat(concat('''',number,'''')) as number", false ); |
|
| 448 | - $dids_result = ( array ) $this->db->get ( 'dids' )->first_row (); |
|
| 449 | - $notes_where = "note IN (" . $dids_result ['number'] . ")"; |
|
| 450 | - $this->db->where ( $notes_where ); |
|
| 451 | - $this->db->delete ( 'reseller_pricing' ); |
|
| 446 | + $this->db->where($where); |
|
| 447 | + $this->db->select("group_concat(concat('''',number,'''')) as number", false); |
|
| 448 | + $dids_result = (array)$this->db->get('dids')->first_row(); |
|
| 449 | + $notes_where = "note IN (".$dids_result ['number'].")"; |
|
| 450 | + $this->db->where($notes_where); |
|
| 451 | + $this->db->delete('reseller_pricing'); |
|
| 452 | 452 | // /*ASTPP_invoice_changes_05_05_start*/ |
| 453 | - $this->db->where ( $where ); |
|
| 454 | - $this->db->delete ( 'dids' ); |
|
| 453 | + $this->db->where($where); |
|
| 454 | + $this->db->delete('dids'); |
|
| 455 | 455 | echo "DIDs"; |
| 456 | 456 | // end |
| 457 | 457 | } |
@@ -462,134 +462,134 @@ discard block |
||
| 462 | 462 | * @id: DID number |
| 463 | 463 | */ |
| 464 | 464 | function did_reseller_edit($action = false, $id = false) { |
| 465 | - $data ['page_title'] = gettext ( 'Edit DID ' ); |
|
| 466 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 465 | + $data ['page_title'] = gettext('Edit DID '); |
|
| 466 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 467 | 467 | if ($action == 'edit') { |
| 468 | - if (($this->input->post ())) { |
|
| 469 | - $post = $this->input->post (); |
|
| 468 | + if (($this->input->post())) { |
|
| 469 | + $post = $this->input->post(); |
|
| 470 | 470 | /* |
| 471 | 471 | * ASTPP 3.0 last modified date update |
| 472 | 472 | */ |
| 473 | - $post ['last_modified_date'] = gmdate ( 'Y-m-d H:i:s' ); |
|
| 473 | + $post ['last_modified_date'] = gmdate('Y-m-d H:i:s'); |
|
| 474 | 474 | /* * ***************************************************** */ |
| 475 | - unset ( $post ['action'] ); |
|
| 476 | - $post ['setup'] = $this->common_model->add_calculate_currency ( $post ['setup'], '', '', false, false ); |
|
| 477 | - $post ['monthlycost'] = $this->common_model->add_calculate_currency ( $post ['monthlycost'], '', '', false, false ); |
|
| 478 | - $post ['connectcost'] = $this->common_model->add_calculate_currency ( $post ['connectcost'], '', '', false, false ); |
|
| 479 | - $post ['cost'] = $this->common_model->add_calculate_currency ( $post ['cost'], '', '', false, false ); |
|
| 480 | - $this->db->where ( array ( |
|
| 475 | + unset ($post ['action']); |
|
| 476 | + $post ['setup'] = $this->common_model->add_calculate_currency($post ['setup'], '', '', false, false); |
|
| 477 | + $post ['monthlycost'] = $this->common_model->add_calculate_currency($post ['monthlycost'], '', '', false, false); |
|
| 478 | + $post ['connectcost'] = $this->common_model->add_calculate_currency($post ['connectcost'], '', '', false, false); |
|
| 479 | + $post ['cost'] = $this->common_model->add_calculate_currency($post ['cost'], '', '', false, false); |
|
| 480 | + $this->db->where(array( |
|
| 481 | 481 | 'note' => $post ['note'], |
| 482 | 482 | "reseller_id" => $accountinfo ['id'] |
| 483 | - ) ); |
|
| 484 | - $this->db->update ( "reseller_pricing", $post ); |
|
| 485 | - $where_update_did = array ( |
|
| 483 | + )); |
|
| 484 | + $this->db->update("reseller_pricing", $post); |
|
| 485 | + $where_update_did = array( |
|
| 486 | 486 | 'extensions' => $post ['extensions'], |
| 487 | 487 | 'call_type' => $post ['call_type'] |
| 488 | 488 | ); |
| 489 | - $this->db->where ( array ( |
|
| 489 | + $this->db->where(array( |
|
| 490 | 490 | 'note' => $post ['note'] |
| 491 | - ) ); |
|
| 492 | - $this->db->update ( "reseller_pricing", $where_update_did ); |
|
| 493 | - $where = array ( |
|
| 491 | + )); |
|
| 492 | + $this->db->update("reseller_pricing", $where_update_did); |
|
| 493 | + $where = array( |
|
| 494 | 494 | 'number' => $post ['note'] |
| 495 | 495 | ); |
| 496 | - $this->db->where ( $where ); |
|
| 497 | - $this->db->update ( "dids", $where_update_did ); |
|
| 498 | - echo json_encode ( array ( |
|
| 496 | + $this->db->where($where); |
|
| 497 | + $this->db->update("dids", $where_update_did); |
|
| 498 | + echo json_encode(array( |
|
| 499 | 499 | "SUCCESS" => " DID Updated Successfully!!" |
| 500 | - ) ); |
|
| 500 | + )); |
|
| 501 | 501 | exit (); |
| 502 | 502 | } else { |
| 503 | - if ($this->session->userdata ( 'logintype' ) == 1) { |
|
| 504 | - $accountinfo = $this->did_model->get_account ( $accountinfo ['number'] ); |
|
| 505 | - $reseller_did = $this->db_model->getSelect ( "*", "reseller_pricing", array ( |
|
| 503 | + if ($this->session->userdata('logintype') == 1) { |
|
| 504 | + $accountinfo = $this->did_model->get_account($accountinfo ['number']); |
|
| 505 | + $reseller_did = $this->db_model->getSelect("*", "reseller_pricing", array( |
|
| 506 | 506 | 'id' => $id |
| 507 | - ) ); |
|
| 508 | - $reseller_didinfo = ( array ) $reseller_did->first_row (); |
|
| 509 | - if (! empty ( $reseller_didinfo )) { |
|
| 510 | - $reseller_didinfo ['setup'] = $this->common_model->to_calculate_currency ( $reseller_didinfo ['setup'], '', '', true, false ); |
|
| 511 | - $reseller_didinfo ['monthlycost'] = $this->common_model->to_calculate_currency ( $reseller_didinfo ['monthlycost'], '', '', true, false ); |
|
| 512 | - $reseller_didinfo ['connectcost'] = $this->common_model->to_calculate_currency ( $reseller_didinfo ['connectcost'], '', '', true, false ); |
|
| 513 | - $reseller_didinfo ['cost'] = $this->common_model->to_calculate_currency ( $reseller_didinfo ['cost'], '', '', true, false ); |
|
| 507 | + )); |
|
| 508 | + $reseller_didinfo = (array)$reseller_did->first_row(); |
|
| 509 | + if ( ! empty ($reseller_didinfo)) { |
|
| 510 | + $reseller_didinfo ['setup'] = $this->common_model->to_calculate_currency($reseller_didinfo ['setup'], '', '', true, false); |
|
| 511 | + $reseller_didinfo ['monthlycost'] = $this->common_model->to_calculate_currency($reseller_didinfo ['monthlycost'], '', '', true, false); |
|
| 512 | + $reseller_didinfo ['connectcost'] = $this->common_model->to_calculate_currency($reseller_didinfo ['connectcost'], '', '', true, false); |
|
| 513 | + $reseller_didinfo ['cost'] = $this->common_model->to_calculate_currency($reseller_didinfo ['cost'], '', '', true, false); |
|
| 514 | 514 | $data ['did'] = $reseller_didinfo ['note']; |
| 515 | 515 | } |
| 516 | 516 | $data ['reseller_didinfo'] = $reseller_didinfo; |
| 517 | 517 | $data ['accountinfo'] = $accountinfo; |
| 518 | - $this->load->view ( 'view_did_manage_reseller_add', $data ); |
|
| 518 | + $this->load->view('view_did_manage_reseller_add', $data); |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | if ($action == 'delete') { |
| 523 | - $this->db->where ( 'id', $id ); |
|
| 524 | - $this->db->select ( 'note' ); |
|
| 525 | - $reseller_pricing = ( array ) $this->db->get ( 'reseller_pricing' )->first_row (); |
|
| 523 | + $this->db->where('id', $id); |
|
| 524 | + $this->db->select('note'); |
|
| 525 | + $reseller_pricing = (array)$this->db->get('reseller_pricing')->first_row(); |
|
| 526 | 526 | $did_number = $reseller_pricing ['note']; |
| 527 | - $did_info = ( array ) $this->db->get_where ( 'dids', array ( |
|
| 527 | + $did_info = (array)$this->db->get_where('dids', array( |
|
| 528 | 528 | 'number' => $did_number |
| 529 | - ) )->first_row (); |
|
| 530 | - $query = "select count(id) as count from reseller_pricing where id >= (select id from reseller_pricing where note =$did_number AND parent_id =" . $accountinfo ['reseller_id'] . " AND reseller_id =" . $accountinfo ['id'] . ") AND note= $did_number order by id desc"; |
|
| 531 | - $result = ( array ) $this->db->query ( $query )->first_row (); |
|
| 529 | + ))->first_row(); |
|
| 530 | + $query = "select count(id) as count from reseller_pricing where id >= (select id from reseller_pricing where note =$did_number AND parent_id =".$accountinfo ['reseller_id']." AND reseller_id =".$accountinfo ['id'].") AND note= $did_number order by id desc"; |
|
| 531 | + $result = (array)$this->db->query($query)->first_row(); |
|
| 532 | 532 | if ($result ['count'] > 0) { |
| 533 | - $str = $this->common->get_parent_info ( $did_info ['parent_id'], $accountinfo ['id'] ); |
|
| 534 | - $str = rtrim ( $str, "," ); |
|
| 535 | - $account_result = ( array ) $this->db->get_where ( 'accounts', "id IN (" . $str . ")" )->result_array (); |
|
| 536 | - foreach ( $account_result as $key => $acc_row ) { |
|
| 533 | + $str = $this->common->get_parent_info($did_info ['parent_id'], $accountinfo ['id']); |
|
| 534 | + $str = rtrim($str, ","); |
|
| 535 | + $account_result = (array)$this->db->get_where('accounts', "id IN (".$str.")")->result_array(); |
|
| 536 | + foreach ($account_result as $key => $acc_row) { |
|
| 537 | 537 | $acc_row ['did_number'] = $did_info ['number']; |
| 538 | - $this->common->mail_to_users ( 'email_remove_did', $acc_row ); |
|
| 538 | + $this->common->mail_to_users('email_remove_did', $acc_row); |
|
| 539 | 539 | } |
| 540 | - $reseller_ids = $this->common->get_subreseller_info ( $accountinfo ['id'] ); |
|
| 541 | - $reseller_ids = rtrim ( $reseller_ids, "," ); |
|
| 540 | + $reseller_ids = $this->common->get_subreseller_info($accountinfo ['id']); |
|
| 541 | + $reseller_ids = rtrim($reseller_ids, ","); |
|
| 542 | 542 | $where = "parent_id IN ($reseller_ids)"; |
| 543 | - $this->db->where ( 'note', $did_info ['number'] ); |
|
| 544 | - $this->db->delete ( 'reseller_pricing', $where ); |
|
| 545 | - $this->db->where ( 'reseller_id', $accountinfo ['id'] ); |
|
| 546 | - $this->db->where ( 'note', $did_info ['number'] ); |
|
| 547 | - $this->db->delete ( 'reseller_pricing' ); |
|
| 543 | + $this->db->where('note', $did_info ['number']); |
|
| 544 | + $this->db->delete('reseller_pricing', $where); |
|
| 545 | + $this->db->where('reseller_id', $accountinfo ['id']); |
|
| 546 | + $this->db->where('note', $did_info ['number']); |
|
| 547 | + $this->db->delete('reseller_pricing'); |
|
| 548 | 548 | } |
| 549 | - $this->db->where ( 'number', $did_number ); |
|
| 550 | - $this->db->select ( 'accountid' ); |
|
| 551 | - $did_array = ( array ) $this->db->get ( 'dids' )->first_row (); |
|
| 549 | + $this->db->where('number', $did_number); |
|
| 550 | + $this->db->select('accountid'); |
|
| 551 | + $did_array = (array)$this->db->get('dids')->first_row(); |
|
| 552 | 552 | if ($did_array ['accountid'] > 0) { |
| 553 | - $customer_info = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 553 | + $customer_info = (array)$this->db->get_where('accounts', array( |
|
| 554 | 554 | 'id' => $did_array ['accountid'] |
| 555 | - ) )->first_row (); |
|
| 555 | + ))->first_row(); |
|
| 556 | 556 | $customer_info ['did_number'] = $did_number; |
| 557 | - $this->common->mail_to_users ( 'email_remove_did', $customer_info ); |
|
| 557 | + $this->common->mail_to_users('email_remove_did', $customer_info); |
|
| 558 | 558 | } |
| 559 | - $did_array = array ( |
|
| 559 | + $did_array = array( |
|
| 560 | 560 | "accountid" => 0, |
| 561 | 561 | "parent_id" => $accountinfo ['reseller_id'], |
| 562 | 562 | "assign_date" => "0000-00-00 00:00:00", |
| 563 | 563 | "charge_upto" => "0000-00-00 00:00:00" |
| 564 | 564 | ); |
| 565 | - $this->db->where ( 'number', $did_number ); |
|
| 566 | - $this->db->update ( 'dids', $did_array ); |
|
| 567 | - $this->session->set_flashdata ( 'astpp_notification', 'DID Removed Successfully!' ); |
|
| 568 | - redirect ( base_url () . 'did/did_list/' ); |
|
| 565 | + $this->db->where('number', $did_number); |
|
| 566 | + $this->db->update('dids', $did_array); |
|
| 567 | + $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully!'); |
|
| 568 | + redirect(base_url().'did/did_list/'); |
|
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | function did_reseller_purchase() { |
| 572 | 572 | // Get account information from session. |
| 573 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 574 | - $where = array ( |
|
| 573 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 574 | + $where = array( |
|
| 575 | 575 | 'id' => $accountinfo ['id'] |
| 576 | 576 | ); |
| 577 | - $account = $this->db_model->getSelect ( "*", "accounts", $where ); |
|
| 578 | - $currency_name = $this->common->get_field_name ( 'currency', "currency", array ( |
|
| 577 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
| 578 | + $currency_name = $this->common->get_field_name('currency', "currency", array( |
|
| 579 | 579 | 'id' => $accountinfo ['currency_id'] |
| 580 | - ) ); |
|
| 581 | - $accountinfo = ( array ) $account->first_row (); |
|
| 582 | - if (($this->input->post ())) { |
|
| 583 | - $post = $this->input->post (); |
|
| 584 | - if (isset ( $post ['free_did_list'] ) && $post ['free_did_list'] != '') { |
|
| 580 | + )); |
|
| 581 | + $accountinfo = (array)$account->first_row(); |
|
| 582 | + if (($this->input->post())) { |
|
| 583 | + $post = $this->input->post(); |
|
| 584 | + if (isset ($post ['free_did_list']) && $post ['free_did_list'] != '') { |
|
| 585 | 585 | // For deduction of admin price to reseller |
| 586 | - $didinfo = $this->did_model->get_did_by_number ( $post ['free_did_list'] ); |
|
| 586 | + $didinfo = $this->did_model->get_did_by_number($post ['free_did_list']); |
|
| 587 | 587 | if ($accountinfo ['reseller_id'] > 0) { |
| 588 | - $reseller_pricing_query = $this->db_model->getSelect ( "call_type,setup,extensions,monthlycost,connectcost,includedseconds,cost,inc", "reseller_pricing", array ( |
|
| 588 | + $reseller_pricing_query = $this->db_model->getSelect("call_type,setup,extensions,monthlycost,connectcost,includedseconds,cost,inc", "reseller_pricing", array( |
|
| 589 | 589 | "note" => $didinfo ['number'], |
| 590 | 590 | 'reseller_id' => $accountinfo ['reseller_id'] |
| 591 | - ) ); |
|
| 592 | - $reseller_pricing_result = ( array ) $reseller_pricing_query->first_row (); |
|
| 591 | + )); |
|
| 592 | + $reseller_pricing_result = (array)$reseller_pricing_query->first_row(); |
|
| 593 | 593 | $didinfo ['call_type'] = $reseller_pricing_result ['call_type']; |
| 594 | 594 | $didinfo ['extensions'] = $reseller_pricing_result ['extensions']; |
| 595 | 595 | $didinfo ['setup'] = $reseller_pricing_result ['setup']; |
@@ -599,43 +599,43 @@ discard block |
||
| 599 | 599 | $didinfo ['cost'] = $reseller_pricing_result ['cost']; |
| 600 | 600 | $didinfo ['inc'] = $reseller_pricing_result ['inc']; |
| 601 | 601 | } |
| 602 | - $available_bal = $this->db_model->get_available_bal ( $accountinfo ); |
|
| 602 | + $available_bal = $this->db_model->get_available_bal($accountinfo); |
|
| 603 | 603 | $accountinfo ['did_number'] = $didinfo ['number']; |
| 604 | 604 | $accountinfo ['did_country_id'] = $didinfo ['country_id']; |
| 605 | - $accountinfo ['did_setup'] = $this->common_model->calculate_currency ( $didinfo ['setup'], '', $currency_name, true, true ); |
|
| 606 | - $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency ( $didinfo ['monthlycost'], '', $currency_name, true, true ); |
|
| 605 | + $accountinfo ['did_setup'] = $this->common_model->calculate_currency($didinfo ['setup'], '', $currency_name, true, true); |
|
| 606 | + $accountinfo ['did_monthlycost'] = $this->common_model->calculate_currency($didinfo ['monthlycost'], '', $currency_name, true, true); |
|
| 607 | 607 | $accountinfo ['did_maxchannels'] = $didinfo ['maxchannels']; |
| 608 | 608 | if ($available_bal >= $didinfo ["setup"]) { |
| 609 | - $available_bal = $this->db_model->update_balance ( $didinfo ['setup'], $accountinfo ['id'], "debit" ); |
|
| 610 | - $this->db_model->update ( "dids", array ( |
|
| 609 | + $available_bal = $this->db_model->update_balance($didinfo ['setup'], $accountinfo ['id'], "debit"); |
|
| 610 | + $this->db_model->update("dids", array( |
|
| 611 | 611 | 'parent_id' => $accountinfo ['id'], |
| 612 | - "assign_date" => gmdate ( "Y-m-d H:i:s" ) |
|
| 613 | - ), array ( |
|
| 612 | + "assign_date" => gmdate("Y-m-d H:i:s") |
|
| 613 | + ), array( |
|
| 614 | 614 | "id" => $didinfo ['id'] |
| 615 | - ) ); |
|
| 616 | - $this->did_model->insert_reseller_pricing ( $accountinfo, $didinfo ); |
|
| 617 | - $this->common->add_invoice_details ( $accountinfo, "DIDCHRG", $didinfo ['setup'], $didinfo ['number'] ); |
|
| 618 | - require_once (APPPATH . 'controllers/ProcessCharges.php'); |
|
| 619 | - $ProcessCharges = new ProcessCharges (); |
|
| 620 | - $Params = array ( |
|
| 615 | + )); |
|
| 616 | + $this->did_model->insert_reseller_pricing($accountinfo, $didinfo); |
|
| 617 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $didinfo ['setup'], $didinfo ['number']); |
|
| 618 | + require_once (APPPATH.'controllers/ProcessCharges.php'); |
|
| 619 | + $ProcessCharges = new ProcessCharges(); |
|
| 620 | + $Params = array( |
|
| 621 | 621 | "DIDid" => $didinfo ['id'] |
| 622 | 622 | ); |
| 623 | - $ProcessCharges->BillAccountCharges ( "DIDs", $Params ); |
|
| 623 | + $ProcessCharges->BillAccountCharges("DIDs", $Params); |
|
| 624 | 624 | |
| 625 | - $this->common->mail_to_users ( 'email_add_did', $accountinfo, "", $didinfo ['number'] ); |
|
| 626 | - $this->session->set_flashdata ( 'astpp_errormsg', 'DID Purchased Successfully.' ); |
|
| 625 | + $this->common->mail_to_users('email_add_did', $accountinfo, "", $didinfo ['number']); |
|
| 626 | + $this->session->set_flashdata('astpp_errormsg', 'DID Purchased Successfully.'); |
|
| 627 | 627 | } else { |
| 628 | - $this->session->set_flashdata ( 'astpp_notification', 'Insuffiecient fund to purchase this did' ); |
|
| 628 | + $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
|
| 629 | 629 | } |
| 630 | 630 | } else { |
| 631 | - $this->session->set_flashdata ( 'astpp_notification', 'Please Select DID.' ); |
|
| 631 | + $this->session->set_flashdata('astpp_notification', 'Please Select DID.'); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | - redirect ( base_url () . 'did/did_list/' ); |
|
| 634 | + redirect(base_url().'did/did_list/'); |
|
| 635 | 635 | exit (); |
| 636 | 636 | } |
| 637 | 637 | function add_invoice_data_user($accountid, $charge_type, $description, $credit) { |
| 638 | - $insert_array = array ( |
|
| 638 | + $insert_array = array( |
|
| 639 | 639 | 'accountid' => $accountid, |
| 640 | 640 | 'charge_type' => $charge_type, |
| 641 | 641 | 'description' => $description, |
@@ -644,23 +644,23 @@ discard block |
||
| 644 | 644 | 'package_id' => '0' |
| 645 | 645 | ); |
| 646 | 646 | |
| 647 | - $this->db->insert ( 'invoice_item', $insert_array ); |
|
| 648 | - $this->load->module ( 'invoices/invoices' ); |
|
| 649 | - $this->invoices->invoices->generate_receipt ( $accountid, $credit ); |
|
| 647 | + $this->db->insert('invoice_item', $insert_array); |
|
| 648 | + $this->load->module('invoices/invoices'); |
|
| 649 | + $this->invoices->invoices->generate_receipt($accountid, $credit); |
|
| 650 | 650 | |
| 651 | 651 | return true; |
| 652 | 652 | } |
| 653 | 653 | function did_download_sample_file($file_name) { |
| 654 | - $this->load->helper ( 'download' ); |
|
| 655 | - $full_path = base_url () . "assets/Rates_File/" . $file_name . ".csv"; |
|
| 656 | - $arrContextOptions = array ( |
|
| 657 | - "ssl" => array ( |
|
| 654 | + $this->load->helper('download'); |
|
| 655 | + $full_path = base_url()."assets/Rates_File/".$file_name.".csv"; |
|
| 656 | + $arrContextOptions = array( |
|
| 657 | + "ssl" => array( |
|
| 658 | 658 | "verify_peer" => false, |
| 659 | 659 | "verify_peer_name" => false |
| 660 | 660 | ) |
| 661 | 661 | ); |
| 662 | - $file = file_get_contents ( $full_path, false, stream_context_create ( $arrContextOptions ) ); |
|
| 663 | - force_download ( "samplefile.csv", $file ); |
|
| 662 | + $file = file_get_contents($full_path, false, stream_context_create($arrContextOptions)); |
|
| 663 | + force_download("samplefile.csv", $file); |
|
| 664 | 664 | } |
| 665 | 665 | /* |
| 666 | 666 | * -------Here we write code for controller did functions did_import------ |
@@ -669,48 +669,48 @@ discard block |
||
| 669 | 669 | * @return Return Appropreate message If Account Delete or not. |
| 670 | 670 | */ |
| 671 | 671 | function did_import() { |
| 672 | - $data ['page_title'] = gettext ( 'Import DIDs' ); |
|
| 673 | - $this->session->set_userdata ( 'import_did_rate_csv', "" ); |
|
| 674 | - $error_data = $this->session->userdata ( 'import_did_csv_error' ); |
|
| 675 | - $full_path = $this->config->item ( 'rates-file-path' ); |
|
| 676 | - if (file_exists ( $full_path . $error_data ) && $error_data != "") { |
|
| 677 | - unlink ( $full_path . $error_data ); |
|
| 678 | - $this->session->set_userdata ( 'import_did_csv_error', "" ); |
|
| 672 | + $data ['page_title'] = gettext('Import DIDs'); |
|
| 673 | + $this->session->set_userdata('import_did_rate_csv', ""); |
|
| 674 | + $error_data = $this->session->userdata('import_did_csv_error'); |
|
| 675 | + $full_path = $this->config->item('rates-file-path'); |
|
| 676 | + if (file_exists($full_path.$error_data) && $error_data != "") { |
|
| 677 | + unlink($full_path.$error_data); |
|
| 678 | + $this->session->set_userdata('import_did_csv_error', ""); |
|
| 679 | 679 | } |
| 680 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 681 | - $this->db->where ( 'id', $accountinfo ['currency_id'] ); |
|
| 682 | - $this->db->select ( 'currency' ); |
|
| 683 | - $currency_info = ( array ) $this->db->get ( 'currency' )->first_row (); |
|
| 684 | - $data ['fields'] = "DID,Country,Account,Per Minute Cost(" . $currency_info ['currency'] . "),Initial Increment,Increment,Setup Fee(" . $currency_info ['currency'] . "),Monthly Fee(" . $currency_info ['currency'] . "),Call Type,Destination,Status"; |
|
| 685 | - $this->load->view ( 'view_import_did', $data ); |
|
| 680 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 681 | + $this->db->where('id', $accountinfo ['currency_id']); |
|
| 682 | + $this->db->select('currency'); |
|
| 683 | + $currency_info = (array)$this->db->get('currency')->first_row(); |
|
| 684 | + $data ['fields'] = "DID,Country,Account,Per Minute Cost(".$currency_info ['currency']."),Initial Increment,Increment,Setup Fee(".$currency_info ['currency']."),Monthly Fee(".$currency_info ['currency']."),Call Type,Destination,Status"; |
|
| 685 | + $this->load->view('view_import_did', $data); |
|
| 686 | 686 | } |
| 687 | 687 | function did_preview_file() { |
| 688 | - $data ['page_title'] = gettext ( 'Import DIDs' ); |
|
| 689 | - $config_did_array = $this->config->item ( 'DID-rates-field' ); |
|
| 690 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 691 | - $this->db->where ( 'id', $accountinfo ['currency_id'] ); |
|
| 692 | - $this->db->select ( 'currency' ); |
|
| 693 | - $currency_info = ( array ) $this->db->get ( 'currency' )->first_row (); |
|
| 694 | - foreach ( $config_did_array as $key => $value ) { |
|
| 695 | - $key = str_replace ( 'CURRENCY', $currency_info ['currency'], $key ); |
|
| 688 | + $data ['page_title'] = gettext('Import DIDs'); |
|
| 689 | + $config_did_array = $this->config->item('DID-rates-field'); |
|
| 690 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 691 | + $this->db->where('id', $accountinfo ['currency_id']); |
|
| 692 | + $this->db->select('currency'); |
|
| 693 | + $currency_info = (array)$this->db->get('currency')->first_row(); |
|
| 694 | + foreach ($config_did_array as $key => $value) { |
|
| 695 | + $key = str_replace('CURRENCY', $currency_info ['currency'], $key); |
|
| 696 | 696 | $did_fields_array [$key] = $value; |
| 697 | 697 | } |
| 698 | - $check_header = $this->input->post ( 'check_header', true ); |
|
| 698 | + $check_header = $this->input->post('check_header', true); |
|
| 699 | 699 | $invalid_flag = false; |
| 700 | - if (isset ( $_FILES ['didimport'] ['name'] ) && $_FILES ['didimport'] ['name'] != "") { |
|
| 701 | - list ( $txt, $ext ) = explode ( ".", $_FILES ['didimport'] ['name'] ); |
|
| 700 | + if (isset ($_FILES ['didimport'] ['name']) && $_FILES ['didimport'] ['name'] != "") { |
|
| 701 | + list ($txt, $ext) = explode(".", $_FILES ['didimport'] ['name']); |
|
| 702 | 702 | if ($ext == "csv" && $_FILES ["didimport"] ['size'] > 0) { |
| 703 | 703 | $error = $_FILES ['didimport'] ['error']; |
| 704 | 704 | if ($error == 0) { |
| 705 | 705 | $uploadedFile = $_FILES ["didimport"] ["tmp_name"]; |
| 706 | - $full_path = $this->config->item ( 'rates-file-path' ); |
|
| 707 | - $actual_file_name = "ASTPP-DIDs-" . date ( "Y-m-d H:i:s" ) . "." . $ext; |
|
| 708 | - if (move_uploaded_file ( $uploadedFile, $full_path . $actual_file_name )) { |
|
| 709 | - $data ['page_title'] = gettext ( 'Import DIDs Preview' ); |
|
| 710 | - $data ['csv_tmp_data'] = $this->csvreader->parse_file ( $full_path . $actual_file_name, $did_fields_array, $check_header ); |
|
| 706 | + $full_path = $this->config->item('rates-file-path'); |
|
| 707 | + $actual_file_name = "ASTPP-DIDs-".date("Y-m-d H:i:s").".".$ext; |
|
| 708 | + if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) { |
|
| 709 | + $data ['page_title'] = gettext('Import DIDs Preview'); |
|
| 710 | + $data ['csv_tmp_data'] = $this->csvreader->parse_file($full_path.$actual_file_name, $did_fields_array, $check_header); |
|
| 711 | 711 | $data ['provider_id'] = $_POST ['provider_id']; |
| 712 | 712 | $data ['check_header'] = $check_header; |
| 713 | - $this->session->set_userdata ( 'import_did_rate_csv', $actual_file_name ); |
|
| 713 | + $this->session->set_userdata('import_did_rate_csv', $actual_file_name); |
|
| 714 | 714 | } else { |
| 715 | 715 | $data ['error'] = "File Uploading Fail Please Try Again"; |
| 716 | 716 | } |
@@ -722,40 +722,40 @@ discard block |
||
| 722 | 722 | $invalid_flag = true; |
| 723 | 723 | } |
| 724 | 724 | if ($invalid_flag) { |
| 725 | - $data ['fields'] = "DID,Country,Account,Per Minute Cost(" . $currency_info ['currency'] . "),Initial Increment,Increment,Setup Fee(" . $currency_info ['currency'] . "),Monthly Fee(" . $currency_info ['currency'] . "),Call Type,Destination,Status"; |
|
| 725 | + $data ['fields'] = "DID,Country,Account,Per Minute Cost(".$currency_info ['currency']."),Initial Increment,Increment,Setup Fee(".$currency_info ['currency']."),Monthly Fee(".$currency_info ['currency']."),Call Type,Destination,Status"; |
|
| 726 | 726 | $str = ''; |
| 727 | - if (empty ( $_FILES ['didimport'] ['name'] )) { |
|
| 727 | + if (empty ($_FILES ['didimport'] ['name'])) { |
|
| 728 | 728 | $str .= '<br/>Please Select File.'; |
| 729 | 729 | } |
| 730 | 730 | $data ['error'] = $str; |
| 731 | 731 | } |
| 732 | - $this->load->view ( 'view_import_did', $data ); |
|
| 732 | + $this->load->view('view_import_did', $data); |
|
| 733 | 733 | } |
| 734 | 734 | function did_import_file($provider_id, $check_header = false) { |
| 735 | - $new_final_arr = array (); |
|
| 736 | - $invalid_array = array (); |
|
| 737 | - $new_final_arr_key = $this->config->item ( 'DID-rates-field' ); |
|
| 738 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 735 | + $new_final_arr = array(); |
|
| 736 | + $invalid_array = array(); |
|
| 737 | + $new_final_arr_key = $this->config->item('DID-rates-field'); |
|
| 738 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 739 | 739 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 740 | 740 | |
| 741 | - $full_path = $this->config->item ( 'rates-file-path' ); |
|
| 742 | - $did_file_name = $this->session->userdata ( 'import_did_rate_csv' ); |
|
| 743 | - $csv_tmp_data = $this->csvreader->parse_file ( $full_path . $did_file_name, $new_final_arr_key, $check_header ); |
|
| 741 | + $full_path = $this->config->item('rates-file-path'); |
|
| 742 | + $did_file_name = $this->session->userdata('import_did_rate_csv'); |
|
| 743 | + $csv_tmp_data = $this->csvreader->parse_file($full_path.$did_file_name, $new_final_arr_key, $check_header); |
|
| 744 | 744 | $flag = false; |
| 745 | 745 | $i = 0; |
| 746 | - $number_arr = array (); |
|
| 747 | - $reseller_array = array (); |
|
| 748 | - $final_reseller_array = array (); |
|
| 749 | - foreach ( $csv_tmp_data as $key => $csv_data ) { |
|
| 746 | + $number_arr = array(); |
|
| 747 | + $reseller_array = array(); |
|
| 748 | + $final_reseller_array = array(); |
|
| 749 | + foreach ($csv_tmp_data as $key => $csv_data) { |
|
| 750 | 750 | |
| 751 | - if (isset ( $csv_data ['number'] ) && $csv_data ['number'] != '' && $i != 0) { |
|
| 751 | + if (isset ($csv_data ['number']) && $csv_data ['number'] != '' && $i != 0) { |
|
| 752 | 752 | $str = null; |
| 753 | - if (isset ( $csv_data ['call_type'] )) { |
|
| 754 | - if (strtolower ( $csv_data ['call_type'] ) == 'sip-did') { |
|
| 753 | + if (isset ($csv_data ['call_type'])) { |
|
| 754 | + if (strtolower($csv_data ['call_type']) == 'sip-did') { |
|
| 755 | 755 | $call_type = '3'; |
| 756 | - } else if (strtolower ( $csv_data ['call_type'] ) == 'did-local') { |
|
| 756 | + } else if (strtolower($csv_data ['call_type']) == 'did-local') { |
|
| 757 | 757 | $call_type = '1'; |
| 758 | - } else if (strtolower ( $csv_data ['call_type'] ) == 'other') { |
|
| 758 | + } else if (strtolower($csv_data ['call_type']) == 'other') { |
|
| 759 | 759 | $call_type = '2'; |
| 760 | 760 | } else { |
| 761 | 761 | $call_type = '0'; |
@@ -763,76 +763,76 @@ discard block |
||
| 763 | 763 | } else { |
| 764 | 764 | $call_type = '0'; |
| 765 | 765 | } |
| 766 | - $csv_data ['accountid'] = isset ( $csv_data ['accountid'] ) ? $csv_data ['accountid'] : 0; |
|
| 767 | - $csv_data ['country_id'] = isset ( $csv_data ['country_id'] ) ? $csv_data ['country_id'] : 0; |
|
| 766 | + $csv_data ['accountid'] = isset ($csv_data ['accountid']) ? $csv_data ['accountid'] : 0; |
|
| 767 | + $csv_data ['country_id'] = isset ($csv_data ['country_id']) ? $csv_data ['country_id'] : 0; |
|
| 768 | 768 | // $csv_data['call_type'] = isset($csv_data['call_type']) && (strtolower($csv_data['call_type']) == 'local' || strtolower($csv_data['call_type']) == 'pstn' || strtolower($csv_data['call_type']) == 'other' ) ? $this->common->get_custom_call_type(strtoupper($csv_data['call_type'])) : 0; |
| 769 | 769 | $csv_data ['call_type'] = $call_type; |
| 770 | - $csv_data ['extensions'] = isset ( $csv_data ['extensions'] ) ? $csv_data ['extensions'] : ''; |
|
| 771 | - $csv_data ['includedseconds'] = isset ( $csv_data ['includedseconds'] ) ? $csv_data ['includedseconds'] : 0; |
|
| 772 | - $csv_data ['cost'] = ! empty ( $csv_data ['cost'] ) && is_numeric ( $csv_data ['cost'] ) && $csv_data ['cost'] ? $csv_data ['cost'] : 0; |
|
| 773 | - $csv_data ['setup'] = ! empty ( $csv_data ['setup'] ) && is_numeric ( $csv_data ['setup'] ) && $csv_data ['setup'] > 0 ? $csv_data ['setup'] : 0; |
|
| 774 | - $csv_data ['monthlycost'] = ! empty ( $csv_data ['monthlycost'] ) && is_numeric ( $csv_data ['monthlycost'] ) && $csv_data ['monthlycost'] > 0 ? $csv_data ['monthlycost'] : 0; |
|
| 775 | - $csv_data ['connectcost'] = ! empty ( $csv_data ['connectcost'] ) && is_numeric ( $csv_data ['connectcost'] ) && $csv_data ['connectcost'] > 0 ? $csv_data ['connectcost'] : 0; |
|
| 776 | - $csv_data ['inc'] = isset ( $csv_data ['inc'] ) ? $csv_data ['inc'] : 0; |
|
| 777 | - $str = $this->data_validate ( $csv_data ); |
|
| 770 | + $csv_data ['extensions'] = isset ($csv_data ['extensions']) ? $csv_data ['extensions'] : ''; |
|
| 771 | + $csv_data ['includedseconds'] = isset ($csv_data ['includedseconds']) ? $csv_data ['includedseconds'] : 0; |
|
| 772 | + $csv_data ['cost'] = ! empty ($csv_data ['cost']) && is_numeric($csv_data ['cost']) && $csv_data ['cost'] ? $csv_data ['cost'] : 0; |
|
| 773 | + $csv_data ['setup'] = ! empty ($csv_data ['setup']) && is_numeric($csv_data ['setup']) && $csv_data ['setup'] > 0 ? $csv_data ['setup'] : 0; |
|
| 774 | + $csv_data ['monthlycost'] = ! empty ($csv_data ['monthlycost']) && is_numeric($csv_data ['monthlycost']) && $csv_data ['monthlycost'] > 0 ? $csv_data ['monthlycost'] : 0; |
|
| 775 | + $csv_data ['connectcost'] = ! empty ($csv_data ['connectcost']) && is_numeric($csv_data ['connectcost']) && $csv_data ['connectcost'] > 0 ? $csv_data ['connectcost'] : 0; |
|
| 776 | + $csv_data ['inc'] = isset ($csv_data ['inc']) ? $csv_data ['inc'] : 0; |
|
| 777 | + $str = $this->data_validate($csv_data); |
|
| 778 | 778 | if ($str != "") { |
| 779 | 779 | $invalid_array [$i] = $csv_data; |
| 780 | 780 | $invalid_array [$i] ['error'] = $str; |
| 781 | 781 | } else { |
| 782 | - if (! in_array ( $csv_data ['number'], $number_arr )) { |
|
| 783 | - $number_count = $this->db_model->countQuery ( 'id', 'dids', array ( |
|
| 782 | + if ( ! in_array($csv_data ['number'], $number_arr)) { |
|
| 783 | + $number_count = $this->db_model->countQuery('id', 'dids', array( |
|
| 784 | 784 | 'number' => $csv_data ['number'] |
| 785 | - ) ); |
|
| 785 | + )); |
|
| 786 | 786 | if ($number_count > 0) { |
| 787 | 787 | $invalid_array [$i] = $csv_data; |
| 788 | 788 | $invalid_array [$i] ['error'] = 'Duplicate DID found from database'; |
| 789 | 789 | } else { |
| 790 | 790 | if ($csv_data ['accountid'] > 0 && $csv_data ['setup'] > 0) { |
| 791 | - $this->db->where ( 'type IN(0,1,3)' ); |
|
| 792 | - $this->db->where ( 'reseller_id', 0 ); |
|
| 793 | - $this->db->where ( 'deleted', 0 ); |
|
| 794 | - $this->db->where ( 'status', 0 ); |
|
| 795 | - $account_info = ( array ) $this->db->get_where ( 'accounts', array ( |
|
| 791 | + $this->db->where('type IN(0,1,3)'); |
|
| 792 | + $this->db->where('reseller_id', 0); |
|
| 793 | + $this->db->where('deleted', 0); |
|
| 794 | + $this->db->where('status', 0); |
|
| 795 | + $account_info = (array)$this->db->get_where('accounts', array( |
|
| 796 | 796 | "number" => $csv_data ['accountid'] |
| 797 | - ) )->first_row (); |
|
| 797 | + ))->first_row(); |
|
| 798 | 798 | if ($account_info) { |
| 799 | - $account_balance = $this->db_model->get_available_bal ( $account_info ); |
|
| 800 | - $setup = $this->common_model->add_calculate_currency ( $csv_data ['setup'], '', '', false, false ); |
|
| 799 | + $account_balance = $this->db_model->get_available_bal($account_info); |
|
| 800 | + $setup = $this->common_model->add_calculate_currency($csv_data ['setup'], '', '', false, false); |
|
| 801 | 801 | if ($account_balance >= $setup) { |
| 802 | 802 | $field_name = $account_info ['type'] == 1 ? 'parent_id' : 'accountid'; |
| 803 | - $currency_name = $this->common->get_field_name ( 'currency', "currency", array ( |
|
| 803 | + $currency_name = $this->common->get_field_name('currency', "currency", array( |
|
| 804 | 804 | 'id' => $account_info ['currency_id'] |
| 805 | - ) ); |
|
| 806 | - $csv_data ['monthlycost'] = $this->common_model->add_calculate_currency ( $csv_data ['monthlycost'], '', '', false, false ); |
|
| 807 | - $csv_data ['cost'] = $this->common_model->add_calculate_currency ( $csv_data ['cost'], '', '', false, false ); |
|
| 808 | - $csv_data ['connectcost'] = $this->common_model->add_calculate_currency ( $csv_data ['connectcost'], '', '', false, false ); |
|
| 805 | + )); |
|
| 806 | + $csv_data ['monthlycost'] = $this->common_model->add_calculate_currency($csv_data ['monthlycost'], '', '', false, false); |
|
| 807 | + $csv_data ['cost'] = $this->common_model->add_calculate_currency($csv_data ['cost'], '', '', false, false); |
|
| 808 | + $csv_data ['connectcost'] = $this->common_model->add_calculate_currency($csv_data ['connectcost'], '', '', false, false); |
|
| 809 | 809 | $csv_data ['setup'] = $setup; |
| 810 | 810 | $csv_data [$field_name] = $account_info ['id']; |
| 811 | - $csv_data ['status'] = $this->common->get_import_status ( $csv_data ['status'] ); |
|
| 812 | - $available_bal = $this->db_model->update_balance ( $csv_data ["setup"], $account_info ['id'], "debit" ); |
|
| 811 | + $csv_data ['status'] = $this->common->get_import_status($csv_data ['status']); |
|
| 812 | + $available_bal = $this->db_model->update_balance($csv_data ["setup"], $account_info ['id'], "debit"); |
|
| 813 | 813 | $account_info ['did_number'] = $csv_data ['number']; |
| 814 | 814 | $account_info ['did_country_id'] = $csv_data ['country_id']; |
| 815 | - $account_info ['did_setup'] = $this->common_model->calculate_currency ( $csv_data ['setup'], '', $currency_name, true, true ); |
|
| 816 | - $account_info ['did_monthlycost'] = $this->common_model->calculate_currency ( $csv_data ['monthlycost'], '', $currency_name, true, true ); |
|
| 815 | + $account_info ['did_setup'] = $this->common_model->calculate_currency($csv_data ['setup'], '', $currency_name, true, true); |
|
| 816 | + $account_info ['did_monthlycost'] = $this->common_model->calculate_currency($csv_data ['monthlycost'], '', $currency_name, true, true); |
|
| 817 | 817 | $account_info ['did_maxchannels'] = "0"; |
| 818 | - $csv_data ['country_id'] = $this->common->get_field_name ( 'id', 'countrycode', array ( |
|
| 818 | + $csv_data ['country_id'] = $this->common->get_field_name('id', 'countrycode', array( |
|
| 819 | 819 | "country" => $csv_data ['country_id'] |
| 820 | - ) ); |
|
| 820 | + )); |
|
| 821 | 821 | if ($account_info ['type'] == 1) { |
| 822 | 822 | $reseller_array = $csv_data; |
| 823 | 823 | $reseller_array ['note'] = $csv_data ['number']; |
| 824 | 824 | $reseller_array ['reseller_id'] = $account_info ['id']; |
| 825 | 825 | $reseller_array ['parent_id'] = $account_info ['reseller_id']; |
| 826 | - $reseller_array ['assign_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
| 827 | - unset ( $reseller_array ['number'], $csv_data ['accountid'], $reseller_array ['accountid'], $reseller_array ['country_id'], $reseller_array ['init_inc'] ); |
|
| 826 | + $reseller_array ['assign_date'] = gmdate("Y-m-d H:i:s"); |
|
| 827 | + unset ($reseller_array ['number'], $csv_data ['accountid'], $reseller_array ['accountid'], $reseller_array ['country_id'], $reseller_array ['init_inc']); |
|
| 828 | 828 | $csv_data ['accountid'] = 0; |
| 829 | 829 | $final_reseller_array [$i] = $reseller_array; |
| 830 | 830 | } else { |
| 831 | 831 | $csv_data ['parent_id'] = 0; |
| 832 | 832 | } |
| 833 | - $csv_data ['assign_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
| 833 | + $csv_data ['assign_date'] = gmdate("Y-m-d H:i:s"); |
|
| 834 | 834 | $new_final_arr [$i] = $csv_data; |
| 835 | - $this->common->mail_to_users ( 'email_add_did', $account_info ); |
|
| 835 | + $this->common->mail_to_users('email_add_did', $account_info); |
|
| 836 | 836 | } else { |
| 837 | 837 | $invalid_array [$i] = $csv_data; |
| 838 | 838 | $invalid_array [$i] ['error'] = 'Account have not sufficient amount to purchase this DID.'; |
@@ -842,14 +842,14 @@ discard block |
||
| 842 | 842 | $invalid_array [$i] ['error'] = 'Account not found or assign to invalid account'; |
| 843 | 843 | } |
| 844 | 844 | } else { |
| 845 | - $csv_data ['setup'] = $this->common_model->add_calculate_currency ( $csv_data ['setup'], '', '', false, false ); |
|
| 846 | - $csv_data ['monthlycost'] = $this->common_model->add_calculate_currency ( $csv_data ['monthlycost'], '', '', false, false ); |
|
| 847 | - $csv_data ['cost'] = $this->common_model->add_calculate_currency ( $csv_data ['cost'], '', '', false, false ); |
|
| 848 | - $csv_data ['connectcost'] = $this->common_model->add_calculate_currency ( $csv_data ['connectcost'], '', '', false, false ); |
|
| 845 | + $csv_data ['setup'] = $this->common_model->add_calculate_currency($csv_data ['setup'], '', '', false, false); |
|
| 846 | + $csv_data ['monthlycost'] = $this->common_model->add_calculate_currency($csv_data ['monthlycost'], '', '', false, false); |
|
| 847 | + $csv_data ['cost'] = $this->common_model->add_calculate_currency($csv_data ['cost'], '', '', false, false); |
|
| 848 | + $csv_data ['connectcost'] = $this->common_model->add_calculate_currency($csv_data ['connectcost'], '', '', false, false); |
|
| 849 | 849 | $csv_data ['accountid'] = 0; |
| 850 | - $csv_data ['country_id'] = $this->common->get_field_name ( 'id', 'countrycode', array ( |
|
| 850 | + $csv_data ['country_id'] = $this->common->get_field_name('id', 'countrycode', array( |
|
| 851 | 851 | "country" => $csv_data ['country_id'] |
| 852 | - ) ); |
|
| 852 | + )); |
|
| 853 | 853 | $new_final_arr [$i] = $csv_data; |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -860,38 +860,38 @@ discard block |
||
| 860 | 860 | } |
| 861 | 861 | $number_arr [] = $csv_data ['number']; |
| 862 | 862 | } |
| 863 | - $i ++; |
|
| 863 | + $i++; |
|
| 864 | 864 | } |
| 865 | - if (! empty ( $new_final_arr )) { |
|
| 866 | - $result = $this->did_model->bulk_insert_dids ( $new_final_arr ); |
|
| 865 | + if ( ! empty ($new_final_arr)) { |
|
| 866 | + $result = $this->did_model->bulk_insert_dids($new_final_arr); |
|
| 867 | 867 | } |
| 868 | - if (! empty ( $final_reseller_array )) { |
|
| 869 | - $this->db->insert_batch ( 'reseller_pricing', $final_reseller_array ); |
|
| 868 | + if ( ! empty ($final_reseller_array)) { |
|
| 869 | + $this->db->insert_batch('reseller_pricing', $final_reseller_array); |
|
| 870 | 870 | } |
| 871 | - unlink ( $full_path . $did_file_name ); |
|
| 872 | - $count = count ( $invalid_array ); |
|
| 871 | + unlink($full_path.$did_file_name); |
|
| 872 | + $count = count($invalid_array); |
|
| 873 | 873 | if ($count > 0) { |
| 874 | 874 | $session_id = "-1"; |
| 875 | - $fp = fopen ( $full_path . $session_id . '.csv', 'w' ); |
|
| 876 | - foreach ( $new_final_arr_key as $key => $value ) { |
|
| 877 | - $custom_array [0] [$key] = ucfirst ( $key ); |
|
| 875 | + $fp = fopen($full_path.$session_id.'.csv', 'w'); |
|
| 876 | + foreach ($new_final_arr_key as $key => $value) { |
|
| 877 | + $custom_array [0] [$key] = ucfirst($key); |
|
| 878 | 878 | } |
| 879 | 879 | $custom_array [0] ['error'] = "Error"; |
| 880 | - $invalid_array = array_merge ( $custom_array, $invalid_array ); |
|
| 881 | - foreach ( $invalid_array as $err_data ) { |
|
| 882 | - fputcsv ( $fp, $err_data ); |
|
| 880 | + $invalid_array = array_merge($custom_array, $invalid_array); |
|
| 881 | + foreach ($invalid_array as $err_data) { |
|
| 882 | + fputcsv($fp, $err_data); |
|
| 883 | 883 | } |
| 884 | - fclose ( $fp ); |
|
| 885 | - $this->session->set_userdata ( 'import_did_csv_error', $session_id . ".csv" ); |
|
| 884 | + fclose($fp); |
|
| 885 | + $this->session->set_userdata('import_did_csv_error', $session_id.".csv"); |
|
| 886 | 886 | $data ["error"] = $invalid_array; |
| 887 | 887 | $data ['provider_id'] = $provider_id; |
| 888 | - $data ['import_record_count'] = count ( $new_final_arr ) + count ( $reseller_array ); |
|
| 889 | - $data ['failure_count'] = count ( $invalid_array ) - 1; |
|
| 890 | - $data ['page_title'] = gettext ( 'DID Import Error' ); |
|
| 891 | - $this->load->view ( 'view_import_error', $data ); |
|
| 888 | + $data ['import_record_count'] = count($new_final_arr) + count($reseller_array); |
|
| 889 | + $data ['failure_count'] = count($invalid_array) - 1; |
|
| 890 | + $data ['page_title'] = gettext('DID Import Error'); |
|
| 891 | + $this->load->view('view_import_error', $data); |
|
| 892 | 892 | } else { |
| 893 | - $this->session->set_flashdata ( 'astpp_errormsg', 'Total ' . count ( $new_final_arr ) . ' DIDs Imported Successfully!' ); |
|
| 894 | - redirect ( base_url () . "did/did_list/" ); |
|
| 893 | + $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' DIDs Imported Successfully!'); |
|
| 894 | + redirect(base_url()."did/did_list/"); |
|
| 895 | 895 | } |
| 896 | 896 | } |
| 897 | 897 | function data_validate($csvdata) { |
@@ -900,77 +900,77 @@ discard block |
||
| 900 | 900 | $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i"; |
| 901 | 901 | $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; |
| 902 | 902 | $str .= $csvdata ['number'] != '' ? null : 'Number,'; |
| 903 | - $str = rtrim ( $str, ',' ); |
|
| 904 | - if (! $str) { |
|
| 905 | - $str .= is_numeric ( $csvdata ['number'] ) ? null : 'Number,'; |
|
| 906 | - $str .= ! empty ( $csvdata ['connectcost'] ) && is_numeric ( $csvdata ['connectcost'] ) ? null : (empty ( $csvdata ['connectcost'] ) ? null : 'Connect Cost,'); |
|
| 907 | - $str .= ! empty ( $csvdata ['includedseconds'] ) && is_numeric ( $csvdata ['includedseconds'] ) ? null : (empty ( $csvdata ['includedseconds'] ) ? null : 'Included Seconds,'); |
|
| 903 | + $str = rtrim($str, ','); |
|
| 904 | + if ( ! $str) { |
|
| 905 | + $str .= is_numeric($csvdata ['number']) ? null : 'Number,'; |
|
| 906 | + $str .= ! empty ($csvdata ['connectcost']) && is_numeric($csvdata ['connectcost']) ? null : (empty ($csvdata ['connectcost']) ? null : 'Connect Cost,'); |
|
| 907 | + $str .= ! empty ($csvdata ['includedseconds']) && is_numeric($csvdata ['includedseconds']) ? null : (empty ($csvdata ['includedseconds']) ? null : 'Included Seconds,'); |
|
| 908 | 908 | if ($str) { |
| 909 | - $str = rtrim ( $str, ',' ); |
|
| 910 | - $error_field = explode ( ',', $str ); |
|
| 911 | - $count = count ( $error_field ); |
|
| 909 | + $str = rtrim($str, ','); |
|
| 910 | + $error_field = explode(',', $str); |
|
| 911 | + $count = count($error_field); |
|
| 912 | 912 | $str .= $count > 1 ? ' are not valid' : ' is not Valid'; |
| 913 | 913 | return $str; |
| 914 | 914 | } else { |
| 915 | 915 | return false; |
| 916 | 916 | } |
| 917 | 917 | } else { |
| 918 | - $str = rtrim ( $str, ',' ); |
|
| 919 | - $error_field = explode ( ',', $str ); |
|
| 920 | - $count = count ( $error_field ); |
|
| 918 | + $str = rtrim($str, ','); |
|
| 919 | + $error_field = explode(',', $str); |
|
| 920 | + $count = count($error_field); |
|
| 921 | 921 | $str .= $count > 1 ? ' are required' : ' is Required'; |
| 922 | 922 | return $str; |
| 923 | 923 | } |
| 924 | 924 | } |
| 925 | 925 | function did_error_download() { |
| 926 | - $this->load->helper ( 'download' ); |
|
| 927 | - $error_data = $this->session->userdata ( 'import_did_csv_error' ); |
|
| 928 | - $full_path = $this->config->item ( 'rates-file-path' ); |
|
| 929 | - $data = file_get_contents ( $full_path . $error_data ); |
|
| 930 | - force_download ( "error_did_rates.csv", $data ); |
|
| 926 | + $this->load->helper('download'); |
|
| 927 | + $error_data = $this->session->userdata('import_did_csv_error'); |
|
| 928 | + $full_path = $this->config->item('rates-file-path'); |
|
| 929 | + $data = file_get_contents($full_path.$error_data); |
|
| 930 | + force_download("error_did_rates.csv", $data); |
|
| 931 | 931 | } |
| 932 | 932 | function did_export_data_xls() { |
| 933 | - $account_info = $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 933 | + $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
|
| 934 | 934 | $currency_id = $account_info ['currency_id']; |
| 935 | - $currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 936 | - $query = $this->did_model->getdid_list ( true, '0', '10000000' ); |
|
| 937 | - ob_clean (); |
|
| 938 | - $outbound_array [] = array ( |
|
| 939 | - gettext ( "DID" ), |
|
| 940 | - gettext ( "Country" ), |
|
| 941 | - gettext ( "Account" ), |
|
| 942 | - gettext ( "Per Minute Cost" ) . "(" . $currency . ")", |
|
| 943 | - gettext ( "Initial Increment" ), |
|
| 944 | - gettext ( "Increment" ), |
|
| 945 | - gettext ( "Setup Fee" ) . "(" . $currency . ")", |
|
| 946 | - gettext ( "Monthly Fee" ) . "(" . $currency . ")", |
|
| 947 | - gettext ( "Call Type" ), |
|
| 948 | - gettext ( "Destination" ), |
|
| 949 | - gettext ( "Status" ), |
|
| 950 | - gettext ( "Modified Date" ), |
|
| 951 | - gettext ( "Is Purchased?" ) |
|
| 935 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
| 936 | + $query = $this->did_model->getdid_list(true, '0', '10000000'); |
|
| 937 | + ob_clean(); |
|
| 938 | + $outbound_array [] = array( |
|
| 939 | + gettext("DID"), |
|
| 940 | + gettext("Country"), |
|
| 941 | + gettext("Account"), |
|
| 942 | + gettext("Per Minute Cost")."(".$currency.")", |
|
| 943 | + gettext("Initial Increment"), |
|
| 944 | + gettext("Increment"), |
|
| 945 | + gettext("Setup Fee")."(".$currency.")", |
|
| 946 | + gettext("Monthly Fee")."(".$currency.")", |
|
| 947 | + gettext("Call Type"), |
|
| 948 | + gettext("Destination"), |
|
| 949 | + gettext("Status"), |
|
| 950 | + gettext("Modified Date"), |
|
| 951 | + gettext("Is Purchased?") |
|
| 952 | 952 | ); |
| 953 | - if ($query->num_rows () > 0) { |
|
| 954 | - foreach ( $query->result_array () as $row ) { |
|
| 955 | - $outbound_array [] = array ( |
|
| 953 | + if ($query->num_rows() > 0) { |
|
| 954 | + foreach ($query->result_array() as $row) { |
|
| 955 | + $outbound_array [] = array( |
|
| 956 | 956 | $row ['number'], |
| 957 | - $this->common->get_field_name ( "country", "countrycode", $row ['country_id'] ), |
|
| 958 | - $this->common->get_field_name ( "number", "accounts", $row ['accountid'] ), |
|
| 959 | - $this->common_model->calculate_currency ( $row ['cost'], '', '', true, false ), |
|
| 957 | + $this->common->get_field_name("country", "countrycode", $row ['country_id']), |
|
| 958 | + $this->common->get_field_name("number", "accounts", $row ['accountid']), |
|
| 959 | + $this->common_model->calculate_currency($row ['cost'], '', '', true, false), |
|
| 960 | 960 | $row ['init_inc'], |
| 961 | 961 | $row ['inc'], |
| 962 | - $this->common_model->calculate_currency ( $row ['setup'], '', '', true, false ), |
|
| 963 | - $this->common_model->calculate_currency ( $row ['monthlycost'], '', '', true, false ), |
|
| 964 | - $this->common->get_call_type ( "", "", $row ['call_type'] ), |
|
| 962 | + $this->common_model->calculate_currency($row ['setup'], '', '', true, false), |
|
| 963 | + $this->common_model->calculate_currency($row ['monthlycost'], '', '', true, false), |
|
| 964 | + $this->common->get_call_type("", "", $row ['call_type']), |
|
| 965 | 965 | $row ['extensions'], |
| 966 | - $this->common->get_status ( 'export', '', $row ['status'] ), |
|
| 966 | + $this->common->get_status('export', '', $row ['status']), |
|
| 967 | 967 | $row ['last_modified_date'], |
| 968 | - $this->common->check_did_avl_export ( $row ['number'] ) |
|
| 968 | + $this->common->check_did_avl_export($row ['number']) |
|
| 969 | 969 | ); |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | - $this->load->helper ( 'csv' ); |
|
| 973 | - array_to_csv ( $outbound_array, 'DIDs_' . date ( "Y-m-d" ) . '.csv' ); |
|
| 972 | + $this->load->helper('csv'); |
|
| 973 | + array_to_csv($outbound_array, 'DIDs_'.date("Y-m-d").'.csv'); |
|
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | 976 | ?> |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | // You should have received a copy of the GNU Affero General Public License |
| 22 | 22 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | 23 | // ############################################################################## |
| 24 | -if (! defined ( 'BASEPATH' )) |
|
| 25 | - exit ( 'No direct script access allowed' ); |
|
| 24 | +if ( ! defined('BASEPATH')) |
|
| 25 | + exit ('No direct script access allowed'); |
|
| 26 | 26 | class did_form { |
| 27 | 27 | function __construct() { |
| 28 | - $this->CI = & get_instance (); |
|
| 28 | + $this->CI = & get_instance(); |
|
| 29 | 29 | } |
| 30 | 30 | function get_dids_form_fields($id = false, $parent_id = '0', $account_id = '0', $country_id = false) { |
| 31 | 31 | if ($id != 0) { |
| 32 | 32 | if ($parent_id > 0) { |
| 33 | - $account_dropdown = array ( |
|
| 33 | + $account_dropdown = array( |
|
| 34 | 34 | 'Reseller', |
| 35 | - array ( |
|
| 35 | + array( |
|
| 36 | 36 | 'name' => 'parent_id', |
| 37 | 37 | 'disabled' => 'disabled', |
| 38 | 38 | 'class' => 'accountid', |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'accounts', |
| 49 | 49 | 'build_concat_dropdown', |
| 50 | 50 | 'where_arr', |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | "reseller_id" => "0", |
| 53 | 53 | "type" => "1", |
| 54 | 54 | "deleted" => "0", |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | ); |
| 58 | 58 | } else { |
| 59 | 59 | if ($account_id > 0) { |
| 60 | - $account_dropdown = array ( |
|
| 60 | + $account_dropdown = array( |
|
| 61 | 61 | 'Account ', |
| 62 | - array ( |
|
| 62 | + array( |
|
| 63 | 63 | 'name' => 'accountid', |
| 64 | 64 | 'disabled' => 'disabled', |
| 65 | 65 | 'class' => 'accountid', |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'accounts', |
| 76 | 76 | 'build_concat_dropdown', |
| 77 | 77 | 'where_arr', |
| 78 | - array ( |
|
| 78 | + array( |
|
| 79 | 79 | "reseller_id" => "0", |
| 80 | 80 | "type" => "0,3", |
| 81 | 81 | "deleted" => "0", |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | ) |
| 84 | 84 | ); |
| 85 | 85 | } else { |
| 86 | - $account_dropdown = array ( |
|
| 86 | + $account_dropdown = array( |
|
| 87 | 87 | 'Account', |
| 88 | 88 | 'accountid', |
| 89 | 89 | 'SELECT', |
| 90 | 90 | '', |
| 91 | - array ( |
|
| 91 | + array( |
|
| 92 | 92 | "name" => "accountid", |
| 93 | 93 | "rules" => "did_account_checking" |
| 94 | 94 | ), |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | 'accounts', |
| 100 | 100 | 'build_concat_dropdown', |
| 101 | 101 | 'where_arr', |
| 102 | - array ( |
|
| 102 | + array( |
|
| 103 | 103 | "reseller_id" => "0", |
| 104 | 104 | "type" => "0,3", |
| 105 | 105 | "deleted" => "0", |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } else { |
| 112 | - $account_dropdown = array ( |
|
| 112 | + $account_dropdown = array( |
|
| 113 | 113 | 'Account', |
| 114 | 114 | 'accountid', |
| 115 | 115 | 'SELECT', |
| 116 | 116 | '', |
| 117 | - array ( |
|
| 117 | + array( |
|
| 118 | 118 | "name" => "accountid", |
| 119 | 119 | "rules" => "did_account_checking" |
| 120 | 120 | ), |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'accounts', |
| 126 | 126 | 'build_concat_dropdown', |
| 127 | 127 | 'where_arr', |
| 128 | - array ( |
|
| 128 | + array( |
|
| 129 | 129 | "reseller_id" => "0", |
| 130 | 130 | "type" => "0,3", |
| 131 | 131 | "deleted" => "0", |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | ) |
| 134 | 134 | ); |
| 135 | 135 | } |
| 136 | - if (! $country_id) { |
|
| 136 | + if ( ! $country_id) { |
|
| 137 | 137 | |
| 138 | - $country = array ( |
|
| 138 | + $country = array( |
|
| 139 | 139 | 'Country', |
| 140 | - array ( |
|
| 140 | + array( |
|
| 141 | 141 | 'name' => 'country_id', |
| 142 | 142 | 'class' => 'country_id' |
| 143 | 143 | ), |
| 144 | 144 | 'SELECT', |
| 145 | 145 | '', |
| 146 | - array ( |
|
| 146 | + array( |
|
| 147 | 147 | "name" => "country_id", |
| 148 | 148 | "rules" => "required" |
| 149 | 149 | ), |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | '' |
| 158 | 158 | ); |
| 159 | 159 | } else { |
| 160 | - $country = array ( |
|
| 160 | + $country = array( |
|
| 161 | 161 | 'Country', |
| 162 | - array ( |
|
| 162 | + array( |
|
| 163 | 163 | 'name' => 'country_id', |
| 164 | 164 | 'class' => 'country_id', |
| 165 | 165 | 'vlaue' => $country_id |
| 166 | 166 | ), |
| 167 | 167 | 'SELECT', |
| 168 | 168 | '', |
| 169 | - array ( |
|
| 169 | + array( |
|
| 170 | 170 | "name" => "country_id", |
| 171 | 171 | "rules" => "required", |
| 172 | 172 | 'selected' => 'selected' |
@@ -182,20 +182,20 @@ discard block |
||
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $val = $id > 0 ? 'dids.number.' . $id : 'dids.number'; |
|
| 186 | - $form ['forms'] = array ( |
|
| 187 | - base_url () . '/did/did_save/', |
|
| 188 | - array ( |
|
| 185 | + $val = $id > 0 ? 'dids.number.'.$id : 'dids.number'; |
|
| 186 | + $form ['forms'] = array( |
|
| 187 | + base_url().'/did/did_save/', |
|
| 188 | + array( |
|
| 189 | 189 | 'id' => 'did_form', |
| 190 | 190 | 'method' => 'POST', |
| 191 | 191 | 'name' => 'did_form' |
| 192 | 192 | ) |
| 193 | 193 | ); |
| 194 | - $form ['DID Information'] = array ( |
|
| 195 | - array ( |
|
| 194 | + $form ['DID Information'] = array( |
|
| 195 | + array( |
|
| 196 | 196 | '', |
| 197 | 197 | 'HIDDEN', |
| 198 | - array ( |
|
| 198 | + array( |
|
| 199 | 199 | 'name' => 'id' |
| 200 | 200 | ), |
| 201 | 201 | '', |
@@ -203,24 +203,24 @@ discard block |
||
| 203 | 203 | '', |
| 204 | 204 | '' |
| 205 | 205 | ), |
| 206 | - array ( |
|
| 207 | - gettext ( 'DID' ), |
|
| 206 | + array( |
|
| 207 | + gettext('DID'), |
|
| 208 | 208 | 'INPUT', |
| 209 | - array ( |
|
| 209 | + array( |
|
| 210 | 210 | 'name' => 'number', |
| 211 | 211 | 'size' => '20', |
| 212 | 212 | 'class' => "text field medium" |
| 213 | 213 | ), |
| 214 | - 'trim|required|is_numeric|xss_clean|integer|is_unique[' . $val . ']', |
|
| 214 | + 'trim|required|is_numeric|xss_clean|integer|is_unique['.$val.']', |
|
| 215 | 215 | 'tOOL TIP', |
| 216 | 216 | 'Please Enter account number' |
| 217 | 217 | ), |
| 218 | 218 | $country, |
| 219 | 219 | |
| 220 | - array ( |
|
| 221 | - gettext ( 'City' ), |
|
| 220 | + array( |
|
| 221 | + gettext('City'), |
|
| 222 | 222 | 'INPUT', |
| 223 | - array ( |
|
| 223 | + array( |
|
| 224 | 224 | 'name' => 'city', |
| 225 | 225 | 'size' => '20', |
| 226 | 226 | 'class' => "text field medium" |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | 'tOOL TIP', |
| 230 | 230 | 'Please Enter Password' |
| 231 | 231 | ), |
| 232 | - array ( |
|
| 233 | - gettext ( 'Province' ), |
|
| 232 | + array( |
|
| 233 | + gettext('Province'), |
|
| 234 | 234 | 'INPUT', |
| 235 | - array ( |
|
| 235 | + array( |
|
| 236 | 236 | 'name' => 'province', |
| 237 | 237 | 'size' => '15', |
| 238 | 238 | 'class' => "text field medium" |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | 'tOOL TIP', |
| 242 | 242 | 'Please Enter Password' |
| 243 | 243 | ), |
| 244 | - array ( |
|
| 245 | - gettext ( 'Provider' ), |
|
| 244 | + array( |
|
| 245 | + gettext('Provider'), |
|
| 246 | 246 | 'provider_id', |
| 247 | 247 | 'SELECT', |
| 248 | 248 | '', |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | 'accounts', |
| 255 | 255 | 'build_concat_dropdown', |
| 256 | 256 | 'where_arr', |
| 257 | - array ( |
|
| 257 | + array( |
|
| 258 | 258 | "type" => "3", |
| 259 | 259 | "deleted" => "0", |
| 260 | 260 | "status" => "0" |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | ) |
| 263 | 263 | ); |
| 264 | 264 | |
| 265 | - $form ['Billing Information'] = array ( |
|
| 265 | + $form ['Billing Information'] = array( |
|
| 266 | 266 | $account_dropdown, |
| 267 | - array ( |
|
| 268 | - gettext ( 'Connection Cost' ), |
|
| 267 | + array( |
|
| 268 | + gettext('Connection Cost'), |
|
| 269 | 269 | 'INPUT', |
| 270 | - array ( |
|
| 270 | + array( |
|
| 271 | 271 | 'name' => 'connectcost', |
| 272 | 272 | 'size' => '15', |
| 273 | 273 | 'class' => "text field medium" |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | 'tOOL TIP', |
| 277 | 277 | 'Please Enter Password' |
| 278 | 278 | ), |
| 279 | - array ( |
|
| 280 | - gettext ( 'Included Seconds' ), |
|
| 279 | + array( |
|
| 280 | + gettext('Included Seconds'), |
|
| 281 | 281 | 'INPUT', |
| 282 | - array ( |
|
| 282 | + array( |
|
| 283 | 283 | 'name' => 'includedseconds', |
| 284 | 284 | 'size' => '50', |
| 285 | 285 | 'class' => "text field medium" |
@@ -288,10 +288,10 @@ discard block |
||
| 288 | 288 | 'tOOL TIP', |
| 289 | 289 | 'Please Enter Password' |
| 290 | 290 | ), |
| 291 | - array ( |
|
| 292 | - gettext ( 'Per Minute Cost' ), |
|
| 291 | + array( |
|
| 292 | + gettext('Per Minute Cost'), |
|
| 293 | 293 | 'INPUT', |
| 294 | - array ( |
|
| 294 | + array( |
|
| 295 | 295 | 'name' => 'cost', |
| 296 | 296 | 'size' => '15', |
| 297 | 297 | 'class' => "text field medium" |
@@ -300,10 +300,10 @@ discard block |
||
| 300 | 300 | 'tOOL TIP', |
| 301 | 301 | 'Please Enter Password' |
| 302 | 302 | ), |
| 303 | - array ( |
|
| 304 | - gettext ( 'Initial Increment' ), |
|
| 303 | + array( |
|
| 304 | + gettext('Initial Increment'), |
|
| 305 | 305 | 'INPUT', |
| 306 | - array ( |
|
| 306 | + array( |
|
| 307 | 307 | 'name' => 'init_inc', |
| 308 | 308 | 'size' => '20', |
| 309 | 309 | 'class' => "text field medium" |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | 'tOOL TIP', |
| 313 | 313 | 'Please Enter Initial Increment' |
| 314 | 314 | ), |
| 315 | - array ( |
|
| 316 | - gettext ( 'Increment' ), |
|
| 315 | + array( |
|
| 316 | + gettext('Increment'), |
|
| 317 | 317 | 'INPUT', |
| 318 | - array ( |
|
| 318 | + array( |
|
| 319 | 319 | 'name' => 'inc', |
| 320 | 320 | 'size' => '20', |
| 321 | 321 | 'class' => "text field medium" |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | 'tOOL TIP', |
| 325 | 325 | 'Please Enter Increment' |
| 326 | 326 | ), |
| 327 | - array ( |
|
| 328 | - gettext ( 'Setup Fee' ), |
|
| 327 | + array( |
|
| 328 | + gettext('Setup Fee'), |
|
| 329 | 329 | 'INPUT', |
| 330 | - array ( |
|
| 330 | + array( |
|
| 331 | 331 | 'name' => 'setup', |
| 332 | 332 | 'size' => '15', |
| 333 | 333 | 'class' => 'text field medium' |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | 'tOOL TIP', |
| 337 | 337 | '' |
| 338 | 338 | ), |
| 339 | - array ( |
|
| 340 | - gettext ( 'Monthly<br>Fee' ), |
|
| 339 | + array( |
|
| 340 | + gettext('Monthly<br>Fee'), |
|
| 341 | 341 | 'INPUT', |
| 342 | - array ( |
|
| 342 | + array( |
|
| 343 | 343 | 'name' => 'monthlycost', |
| 344 | 344 | 'size' => '15', |
| 345 | 345 | 'class' => "text field medium" |
@@ -349,10 +349,10 @@ discard block |
||
| 349 | 349 | 'Please Enter Password' |
| 350 | 350 | ), |
| 351 | 351 | // Added call leg_timeout parameter to timeout the calls. |
| 352 | - array ( |
|
| 352 | + array( |
|
| 353 | 353 | 'Call Timeout (Sec.)', |
| 354 | 354 | 'INPUT', |
| 355 | - array ( |
|
| 355 | + array( |
|
| 356 | 356 | 'name' => 'leg_timeout', |
| 357 | 357 | 'size' => '4', |
| 358 | 358 | 'class' => "text field medium" |
@@ -363,9 +363,9 @@ discard block |
||
| 363 | 363 | ) |
| 364 | 364 | ); |
| 365 | 365 | |
| 366 | - $form ['DID Setting'] = array ( |
|
| 367 | - array ( |
|
| 368 | - gettext ( 'Call Type' ), |
|
| 366 | + $form ['DID Setting'] = array( |
|
| 367 | + array( |
|
| 368 | + gettext('Call Type'), |
|
| 369 | 369 | 'call_type', |
| 370 | 370 | 'SELECT', |
| 371 | 371 | '', |
@@ -378,10 +378,10 @@ discard block |
||
| 378 | 378 | 'set_call_type', |
| 379 | 379 | '' |
| 380 | 380 | ), |
| 381 | - array ( |
|
| 382 | - gettext ( 'Destination' ), |
|
| 381 | + array( |
|
| 382 | + gettext('Destination'), |
|
| 383 | 383 | 'INPUT', |
| 384 | - array ( |
|
| 384 | + array( |
|
| 385 | 385 | 'name' => 'extensions', |
| 386 | 386 | 'size' => '20', |
| 387 | 387 | 'class' => "text field medium" |
@@ -390,10 +390,10 @@ discard block |
||
| 390 | 390 | 'tOOL TIP', |
| 391 | 391 | 'Please Enter Password' |
| 392 | 392 | ), |
| 393 | - array ( |
|
| 394 | - gettext ( 'Concurrent Calls' ), |
|
| 393 | + array( |
|
| 394 | + gettext('Concurrent Calls'), |
|
| 395 | 395 | 'INPUT', |
| 396 | - array ( |
|
| 396 | + array( |
|
| 397 | 397 | 'name' => 'maxchannels', |
| 398 | 398 | 'size' => '20', |
| 399 | 399 | 'class' => "text field medium" |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | 'tOOL TIP', |
| 403 | 403 | 'Please Enter account number' |
| 404 | 404 | ), |
| 405 | - array ( |
|
| 406 | - gettext ( 'Status' ), |
|
| 405 | + array( |
|
| 406 | + gettext('Status'), |
|
| 407 | 407 | 'status', |
| 408 | 408 | 'SELECT', |
| 409 | 409 | '', |
@@ -418,18 +418,18 @@ discard block |
||
| 418 | 418 | ) |
| 419 | 419 | ; |
| 420 | 420 | |
| 421 | - $form ['button_save'] = array ( |
|
| 421 | + $form ['button_save'] = array( |
|
| 422 | 422 | 'name' => 'action', |
| 423 | - 'content' => gettext ( 'Save' ), |
|
| 423 | + 'content' => gettext('Save'), |
|
| 424 | 424 | 'value' => 'save', |
| 425 | 425 | 'id' => 'submit', |
| 426 | 426 | 'type' => 'button', |
| 427 | 427 | 'class' => 'btn btn-line-parrot' |
| 428 | 428 | ); |
| 429 | - $form ['button_cancel'] = array ( |
|
| 429 | + $form ['button_cancel'] = array( |
|
| 430 | 430 | 'name' => 'action', |
| 431 | 431 | 'content' => 'Close', |
| 432 | - gettext ( 'value' ) => 'cancel', |
|
| 432 | + gettext('value') => 'cancel', |
|
| 433 | 433 | 'type' => 'button', |
| 434 | 434 | 'class' => 'btn btn-line-sky margin-x-10', |
| 435 | 435 | 'onclick' => 'return redirect_page(\'NULL\')' |
@@ -441,17 +441,17 @@ discard block |
||
| 441 | 441 | * ************************************************************************ |
| 442 | 442 | */ |
| 443 | 443 | function get_search_did_form() { |
| 444 | - $form ['forms'] = array ( |
|
| 444 | + $form ['forms'] = array( |
|
| 445 | 445 | "", |
| 446 | - array ( |
|
| 446 | + array( |
|
| 447 | 447 | 'id' => "did_search" |
| 448 | 448 | ) |
| 449 | 449 | ); |
| 450 | - $form ['Search'] = array ( |
|
| 451 | - array ( |
|
| 452 | - gettext ( 'DID' ), |
|
| 450 | + $form ['Search'] = array( |
|
| 451 | + array( |
|
| 452 | + gettext('DID'), |
|
| 453 | 453 | 'INPUT', |
| 454 | - array ( |
|
| 454 | + array( |
|
| 455 | 455 | 'name' => 'number[number]', |
| 456 | 456 | '', |
| 457 | 457 | 'size' => '20', |
@@ -467,8 +467,8 @@ discard block |
||
| 467 | 467 | 'search_string_type', |
| 468 | 468 | '' |
| 469 | 469 | ), |
| 470 | - array ( |
|
| 471 | - gettext ( 'Country' ), |
|
| 470 | + array( |
|
| 471 | + gettext('Country'), |
|
| 472 | 472 | 'country_id', |
| 473 | 473 | 'SELECT', |
| 474 | 474 | '', |
@@ -482,8 +482,8 @@ discard block |
||
| 482 | 482 | '', |
| 483 | 483 | '' |
| 484 | 484 | ), |
| 485 | - array ( |
|
| 486 | - gettext ( 'Account' ), |
|
| 485 | + array( |
|
| 486 | + gettext('Account'), |
|
| 487 | 487 | 'accountid', |
| 488 | 488 | 'SELECT', |
| 489 | 489 | '', |
@@ -495,16 +495,16 @@ discard block |
||
| 495 | 495 | 'accounts', |
| 496 | 496 | 'build_concat_dropdown', |
| 497 | 497 | 'where_arr', |
| 498 | - array ( |
|
| 498 | + array( |
|
| 499 | 499 | "reseller_id" => "0", |
| 500 | 500 | "type" => "0", |
| 501 | 501 | "deleted" => "0" |
| 502 | 502 | ) |
| 503 | 503 | ), |
| 504 | - array ( |
|
| 505 | - gettext ( 'Initial Increment' ), |
|
| 504 | + array( |
|
| 505 | + gettext('Initial Increment'), |
|
| 506 | 506 | 'INPUT', |
| 507 | - array ( |
|
| 507 | + array( |
|
| 508 | 508 | 'name' => 'init_inc[init_inc]', |
| 509 | 509 | '', |
| 510 | 510 | 'size' => '20', |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | 'search_int_type', |
| 521 | 521 | '' |
| 522 | 522 | ), |
| 523 | - array ( |
|
| 524 | - gettext ( 'Call Type' ), |
|
| 523 | + array( |
|
| 524 | + gettext('Call Type'), |
|
| 525 | 525 | 'call_type', |
| 526 | 526 | 'SELECT', |
| 527 | 527 | '', |
@@ -535,10 +535,10 @@ discard block |
||
| 535 | 535 | '', |
| 536 | 536 | '' |
| 537 | 537 | ), |
| 538 | - array ( |
|
| 539 | - gettext ( 'Destination' ), |
|
| 538 | + array( |
|
| 539 | + gettext('Destination'), |
|
| 540 | 540 | 'INPUT', |
| 541 | - array ( |
|
| 541 | + array( |
|
| 542 | 542 | 'name' => 'extensions[extensions]', |
| 543 | 543 | '', |
| 544 | 544 | 'size' => '20', |
@@ -554,8 +554,8 @@ discard block |
||
| 554 | 554 | 'search_string_type', |
| 555 | 555 | '' |
| 556 | 556 | ), |
| 557 | - array ( |
|
| 558 | - gettext ( 'Status' ), |
|
| 557 | + array( |
|
| 558 | + gettext('Status'), |
|
| 559 | 559 | 'status', |
| 560 | 560 | 'SELECT', |
| 561 | 561 | '', |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | '' |
| 571 | 571 | ), |
| 572 | 572 | |
| 573 | - array ( |
|
| 573 | + array( |
|
| 574 | 574 | '', |
| 575 | 575 | 'HIDDEN', |
| 576 | 576 | 'ajax_search', |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | '', |
| 580 | 580 | '' |
| 581 | 581 | ), |
| 582 | - array ( |
|
| 582 | + array( |
|
| 583 | 583 | '', |
| 584 | 584 | 'HIDDEN', |
| 585 | 585 | 'advance_search', |
@@ -590,18 +590,18 @@ discard block |
||
| 590 | 590 | ) |
| 591 | 591 | ); |
| 592 | 592 | |
| 593 | - $form ['button_search'] = array ( |
|
| 593 | + $form ['button_search'] = array( |
|
| 594 | 594 | 'name' => 'action', |
| 595 | 595 | 'id' => "did_search_btn", |
| 596 | - 'content' => gettext ( 'Search' ), |
|
| 596 | + 'content' => gettext('Search'), |
|
| 597 | 597 | 'value' => 'save', |
| 598 | 598 | 'type' => 'button', |
| 599 | 599 | 'class' => 'btn btn-line-parrot pull-right' |
| 600 | 600 | ); |
| 601 | - $form ['button_reset'] = array ( |
|
| 601 | + $form ['button_reset'] = array( |
|
| 602 | 602 | 'name' => 'action', |
| 603 | 603 | 'id' => "id_reset", |
| 604 | - 'content' => gettext ( 'Clear' ), |
|
| 604 | + 'content' => gettext('Clear'), |
|
| 605 | 605 | 'value' => 'cancel', |
| 606 | 606 | 'type' => 'reset', |
| 607 | 607 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -610,17 +610,17 @@ discard block |
||
| 610 | 610 | return $form; |
| 611 | 611 | } |
| 612 | 612 | function get_search_did_form_for_reseller() { |
| 613 | - $form ['forms'] = array ( |
|
| 613 | + $form ['forms'] = array( |
|
| 614 | 614 | "", |
| 615 | - array ( |
|
| 615 | + array( |
|
| 616 | 616 | 'id' => "did_search" |
| 617 | 617 | ) |
| 618 | 618 | ); |
| 619 | - $form ['Search'] = array ( |
|
| 620 | - array ( |
|
| 621 | - gettext ( 'DID' ), |
|
| 619 | + $form ['Search'] = array( |
|
| 620 | + array( |
|
| 621 | + gettext('DID'), |
|
| 622 | 622 | 'INPUT', |
| 623 | - array ( |
|
| 623 | + array( |
|
| 624 | 624 | 'name' => 'note[note]', |
| 625 | 625 | '', |
| 626 | 626 | 'size' => '20', |
@@ -636,8 +636,8 @@ discard block |
||
| 636 | 636 | 'search_string_type', |
| 637 | 637 | '' |
| 638 | 638 | ), |
| 639 | - array ( |
|
| 640 | - gettext ( 'Account' ), |
|
| 639 | + array( |
|
| 640 | + gettext('Account'), |
|
| 641 | 641 | 'accountid', |
| 642 | 642 | 'SELECT', |
| 643 | 643 | '', |
@@ -649,14 +649,14 @@ discard block |
||
| 649 | 649 | 'accounts', |
| 650 | 650 | 'build_concat_dropdown', |
| 651 | 651 | 'where_arr', |
| 652 | - array ( |
|
| 652 | + array( |
|
| 653 | 653 | "reseller_id" => "0", |
| 654 | 654 | "type" => "0", |
| 655 | 655 | "deleted" => "0" |
| 656 | 656 | ) |
| 657 | 657 | ), |
| 658 | - array ( |
|
| 659 | - gettext ( 'Call Type' ), |
|
| 658 | + array( |
|
| 659 | + gettext('Call Type'), |
|
| 660 | 660 | 'call_type', |
| 661 | 661 | 'SELECT', |
| 662 | 662 | '', |
@@ -670,10 +670,10 @@ discard block |
||
| 670 | 670 | '', |
| 671 | 671 | '' |
| 672 | 672 | ), |
| 673 | - array ( |
|
| 674 | - gettext ( 'Destination' ), |
|
| 673 | + array( |
|
| 674 | + gettext('Destination'), |
|
| 675 | 675 | 'INPUT', |
| 676 | - array ( |
|
| 676 | + array( |
|
| 677 | 677 | 'name' => 'extensions[extensions]', |
| 678 | 678 | '', |
| 679 | 679 | 'size' => '20', |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | 'search_string_type', |
| 690 | 690 | '' |
| 691 | 691 | ), |
| 692 | - array ( |
|
| 693 | - gettext ( 'Status' ), |
|
| 692 | + array( |
|
| 693 | + gettext('Status'), |
|
| 694 | 694 | 'status', |
| 695 | 695 | 'SELECT', |
| 696 | 696 | '', |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | '', |
| 705 | 705 | '' |
| 706 | 706 | ), |
| 707 | - array ( |
|
| 707 | + array( |
|
| 708 | 708 | '', |
| 709 | 709 | 'HIDDEN', |
| 710 | 710 | 'ajax_search', |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | '', |
| 714 | 714 | '' |
| 715 | 715 | ), |
| 716 | - array ( |
|
| 716 | + array( |
|
| 717 | 717 | '', |
| 718 | 718 | 'HIDDEN', |
| 719 | 719 | 'advance_search', |
@@ -724,18 +724,18 @@ discard block |
||
| 724 | 724 | ) |
| 725 | 725 | ); |
| 726 | 726 | |
| 727 | - $form ['button_search'] = array ( |
|
| 727 | + $form ['button_search'] = array( |
|
| 728 | 728 | 'name' => 'action', |
| 729 | 729 | 'id' => "did_search_btn", |
| 730 | - 'content' => gettext ( 'Search' ), |
|
| 730 | + 'content' => gettext('Search'), |
|
| 731 | 731 | 'value' => 'save', |
| 732 | 732 | 'type' => 'button', |
| 733 | 733 | 'class' => 'btn btn-line-parrot pull-right' |
| 734 | 734 | ); |
| 735 | - $form ['button_reset'] = array ( |
|
| 735 | + $form ['button_reset'] = array( |
|
| 736 | 736 | 'name' => 'action', |
| 737 | 737 | 'id' => "id_reset", |
| 738 | - 'content' => gettext ( 'Clear' ), |
|
| 738 | + 'content' => gettext('Clear'), |
|
| 739 | 739 | 'value' => 'cancel', |
| 740 | 740 | 'type' => 'reset', |
| 741 | 741 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
@@ -748,13 +748,13 @@ discard block |
||
| 748 | 748 | * ASTPP 3.0 grid size is change. |
| 749 | 749 | */ |
| 750 | 750 | function build_did_list_for_admin() { |
| 751 | - $account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
| 751 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
| 752 | 752 | $currency_id = $account_info ['currency_id']; |
| 753 | - $currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 753 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
| 754 | 754 | |
| 755 | 755 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 756 | - $grid_field_arr = json_encode ( array ( |
|
| 757 | - array ( |
|
| 756 | + $grid_field_arr = json_encode(array( |
|
| 757 | + array( |
|
| 758 | 758 | "<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", |
| 759 | 759 | "30", |
| 760 | 760 | "", |
@@ -771,8 +771,8 @@ discard block |
||
| 771 | 771 | * For DID edit on DID number |
| 772 | 772 | * * |
| 773 | 773 | */ |
| 774 | - array ( |
|
| 775 | - gettext ( "DID" ), |
|
| 774 | + array( |
|
| 775 | + gettext("DID"), |
|
| 776 | 776 | "80", |
| 777 | 777 | "number", |
| 778 | 778 | "", |
@@ -782,8 +782,8 @@ discard block |
||
| 782 | 782 | "true", |
| 783 | 783 | "center" |
| 784 | 784 | ), |
| 785 | - array ( |
|
| 786 | - gettext ( "Country" ), |
|
| 785 | + array( |
|
| 786 | + gettext("Country"), |
|
| 787 | 787 | "60", |
| 788 | 788 | "country_id", |
| 789 | 789 | "country", |
@@ -793,16 +793,16 @@ discard block |
||
| 793 | 793 | "true", |
| 794 | 794 | "center" |
| 795 | 795 | ), |
| 796 | - array ( |
|
| 797 | - gettext ( "Account" ), |
|
| 796 | + array( |
|
| 797 | + gettext("Account"), |
|
| 798 | 798 | "95", |
| 799 | 799 | "accountid", |
| 800 | 800 | "first_name,last_name,number", |
| 801 | 801 | "accounts", |
| 802 | 802 | "get_field_name_coma_new" |
| 803 | 803 | ), |
| 804 | - array ( |
|
| 805 | - gettext ( "Per Minute <br>Cost($currency)" ), |
|
| 804 | + array( |
|
| 805 | + gettext("Per Minute <br>Cost($currency)"), |
|
| 806 | 806 | "85", |
| 807 | 807 | "cost", |
| 808 | 808 | "cost", |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | "true", |
| 813 | 813 | "right" |
| 814 | 814 | ), |
| 815 | - array ( |
|
| 816 | - gettext ( "Initial <br>Increment" ), |
|
| 815 | + array( |
|
| 816 | + gettext("Initial <br>Increment"), |
|
| 817 | 817 | "80", |
| 818 | 818 | "init_inc", |
| 819 | 819 | "", |
@@ -823,8 +823,8 @@ discard block |
||
| 823 | 823 | "true", |
| 824 | 824 | "center" |
| 825 | 825 | ), |
| 826 | - array ( |
|
| 827 | - gettext ( "Increment" ), |
|
| 826 | + array( |
|
| 827 | + gettext("Increment"), |
|
| 828 | 828 | "90", |
| 829 | 829 | "inc", |
| 830 | 830 | "", |
@@ -834,8 +834,8 @@ discard block |
||
| 834 | 834 | "true", |
| 835 | 835 | "center" |
| 836 | 836 | ), |
| 837 | - array ( |
|
| 838 | - gettext ( "Setup <br>Fee($currency)" ), |
|
| 837 | + array( |
|
| 838 | + gettext("Setup <br>Fee($currency)"), |
|
| 839 | 839 | "70", |
| 840 | 840 | "setup", |
| 841 | 841 | "setup", |
@@ -845,8 +845,8 @@ discard block |
||
| 845 | 845 | "true", |
| 846 | 846 | "right" |
| 847 | 847 | ), |
| 848 | - array ( |
|
| 849 | - gettext ( "Monthly<br>Fee($currency)" ), |
|
| 848 | + array( |
|
| 849 | + gettext("Monthly<br>Fee($currency)"), |
|
| 850 | 850 | "90", |
| 851 | 851 | "monthlycost", |
| 852 | 852 | "monthlycost", |
@@ -856,8 +856,8 @@ discard block |
||
| 856 | 856 | "true", |
| 857 | 857 | "right" |
| 858 | 858 | ), |
| 859 | - array ( |
|
| 860 | - gettext ( "Call Type" ), |
|
| 859 | + array( |
|
| 860 | + gettext("Call Type"), |
|
| 861 | 861 | "90", |
| 862 | 862 | "call_type", |
| 863 | 863 | "call_type", |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | "true", |
| 868 | 868 | "center" |
| 869 | 869 | ), |
| 870 | - array ( |
|
| 871 | - gettext ( "Destination" ), |
|
| 870 | + array( |
|
| 871 | + gettext("Destination"), |
|
| 872 | 872 | "80", |
| 873 | 873 | "extensions", |
| 874 | 874 | "", |
@@ -878,8 +878,8 @@ discard block |
||
| 878 | 878 | "true", |
| 879 | 879 | "center" |
| 880 | 880 | ), |
| 881 | - array ( |
|
| 882 | - gettext ( "Status" ), |
|
| 881 | + array( |
|
| 882 | + gettext("Status"), |
|
| 883 | 883 | "90", |
| 884 | 884 | "status", |
| 885 | 885 | "status", |
@@ -889,8 +889,8 @@ discard block |
||
| 889 | 889 | "true", |
| 890 | 890 | "center" |
| 891 | 891 | ), |
| 892 | - array ( |
|
| 893 | - gettext ( "Modified <br/>Date" ), |
|
| 892 | + array( |
|
| 893 | + gettext("Modified <br/>Date"), |
|
| 894 | 894 | "90", |
| 895 | 895 | "last_modified_date", |
| 896 | 896 | "last_modified_date", |
@@ -900,8 +900,8 @@ discard block |
||
| 900 | 900 | "true", |
| 901 | 901 | "center" |
| 902 | 902 | ), |
| 903 | - array ( |
|
| 904 | - gettext ( "Is Purchased?" ), |
|
| 903 | + array( |
|
| 904 | + gettext("Is Purchased?"), |
|
| 905 | 905 | "110", |
| 906 | 906 | "number", |
| 907 | 907 | "number", |
@@ -911,25 +911,25 @@ discard block |
||
| 911 | 911 | "true", |
| 912 | 912 | "center" |
| 913 | 913 | ), |
| 914 | - array ( |
|
| 915 | - gettext ( "Action" ), |
|
| 914 | + array( |
|
| 915 | + gettext("Action"), |
|
| 916 | 916 | "100", |
| 917 | 917 | "", |
| 918 | 918 | "", |
| 919 | 919 | "", |
| 920 | - array ( |
|
| 921 | - "EDIT" => array ( |
|
| 920 | + array( |
|
| 921 | + "EDIT" => array( |
|
| 922 | 922 | "url" => "did/did_edit/", |
| 923 | 923 | "mode" => "popup", |
| 924 | 924 | "layout" => "medium" |
| 925 | 925 | ), |
| 926 | - "DELETE" => array ( |
|
| 926 | + "DELETE" => array( |
|
| 927 | 927 | "url" => "did/did_remove/", |
| 928 | 928 | "mode" => "single" |
| 929 | 929 | ) |
| 930 | 930 | ) |
| 931 | 931 | ) |
| 932 | - ) ); |
|
| 932 | + )); |
|
| 933 | 933 | return $grid_field_arr; |
| 934 | 934 | } |
| 935 | 935 | /** |
@@ -940,13 +940,13 @@ discard block |
||
| 940 | 940 | * change in grid size |
| 941 | 941 | */ |
| 942 | 942 | function build_did_list_for_reseller_login() { |
| 943 | - $account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
| 943 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
| 944 | 944 | $currency_id = $account_info ['currency_id']; |
| 945 | - $currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 945 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
| 946 | 946 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 947 | - $grid_field_arr = json_encode ( array ( |
|
| 948 | - array ( |
|
| 949 | - gettext ( "DID" ), |
|
| 947 | + $grid_field_arr = json_encode(array( |
|
| 948 | + array( |
|
| 949 | + gettext("DID"), |
|
| 950 | 950 | "90", |
| 951 | 951 | "number", |
| 952 | 952 | "", |
@@ -957,8 +957,8 @@ discard block |
||
| 957 | 957 | "true", |
| 958 | 958 | "center" |
| 959 | 959 | ), |
| 960 | - array ( |
|
| 961 | - gettext ( "Account" ), |
|
| 960 | + array( |
|
| 961 | + gettext("Account"), |
|
| 962 | 962 | "100", |
| 963 | 963 | "accountid", |
| 964 | 964 | "first_name,last_name,number", |
@@ -968,8 +968,8 @@ discard block |
||
| 968 | 968 | "true", |
| 969 | 969 | "center" |
| 970 | 970 | ), |
| 971 | - array ( |
|
| 972 | - gettext ( "Per Minute<br>Cost($currency)" ), |
|
| 971 | + array( |
|
| 972 | + gettext("Per Minute<br>Cost($currency)"), |
|
| 973 | 973 | "80", |
| 974 | 974 | "cost", |
| 975 | 975 | "cost", |
@@ -979,8 +979,8 @@ discard block |
||
| 979 | 979 | "true", |
| 980 | 980 | "right" |
| 981 | 981 | ), |
| 982 | - array ( |
|
| 983 | - gettext ( "Initial <br>Increment" ), |
|
| 982 | + array( |
|
| 983 | + gettext("Initial <br>Increment"), |
|
| 984 | 984 | "100", |
| 985 | 985 | "init_inc", |
| 986 | 986 | "", |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | "true", |
| 991 | 991 | "center" |
| 992 | 992 | ), |
| 993 | - array ( |
|
| 994 | - gettext ( "Increment" ), |
|
| 993 | + array( |
|
| 994 | + gettext("Increment"), |
|
| 995 | 995 | "95", |
| 996 | 996 | "inc", |
| 997 | 997 | "", |
@@ -1001,8 +1001,8 @@ discard block |
||
| 1001 | 1001 | "true", |
| 1002 | 1002 | "center" |
| 1003 | 1003 | ), |
| 1004 | - array ( |
|
| 1005 | - gettext ( "Setup <br> Fee($currency)" ), |
|
| 1004 | + array( |
|
| 1005 | + gettext("Setup <br> Fee($currency)"), |
|
| 1006 | 1006 | "90", |
| 1007 | 1007 | "setup", |
| 1008 | 1008 | "setup", |
@@ -1012,8 +1012,8 @@ discard block |
||
| 1012 | 1012 | "true", |
| 1013 | 1013 | "right" |
| 1014 | 1014 | ), |
| 1015 | - array ( |
|
| 1016 | - gettext ( "Monthly<br> fee($currency)" ), |
|
| 1015 | + array( |
|
| 1016 | + gettext("Monthly<br> fee($currency)"), |
|
| 1017 | 1017 | "90", |
| 1018 | 1018 | "monthlycost", |
| 1019 | 1019 | "monthlycost", |
@@ -1023,8 +1023,8 @@ discard block |
||
| 1023 | 1023 | "true", |
| 1024 | 1024 | "right" |
| 1025 | 1025 | ), |
| 1026 | - array ( |
|
| 1027 | - gettext ( "Call Type" ), |
|
| 1026 | + array( |
|
| 1027 | + gettext("Call Type"), |
|
| 1028 | 1028 | "80", |
| 1029 | 1029 | "call_type", |
| 1030 | 1030 | "call_type", |
@@ -1034,8 +1034,8 @@ discard block |
||
| 1034 | 1034 | "true", |
| 1035 | 1035 | "center" |
| 1036 | 1036 | ), |
| 1037 | - array ( |
|
| 1038 | - gettext ( "Destination" ), |
|
| 1037 | + array( |
|
| 1038 | + gettext("Destination"), |
|
| 1039 | 1039 | "95", |
| 1040 | 1040 | "extensions", |
| 1041 | 1041 | "", |
@@ -1045,8 +1045,8 @@ discard block |
||
| 1045 | 1045 | "true", |
| 1046 | 1046 | "center" |
| 1047 | 1047 | ), |
| 1048 | - array ( |
|
| 1049 | - gettext ( "Status" ), |
|
| 1048 | + array( |
|
| 1049 | + gettext("Status"), |
|
| 1050 | 1050 | "90", |
| 1051 | 1051 | "status", |
| 1052 | 1052 | "status", |
@@ -1056,8 +1056,8 @@ discard block |
||
| 1056 | 1056 | "true", |
| 1057 | 1057 | "center" |
| 1058 | 1058 | ), |
| 1059 | - array ( |
|
| 1060 | - gettext ( "Modified Date" ), |
|
| 1059 | + array( |
|
| 1060 | + gettext("Modified Date"), |
|
| 1061 | 1061 | "130", |
| 1062 | 1062 | "last_modified_date", |
| 1063 | 1063 | "last_modified_date", |
@@ -1067,8 +1067,8 @@ discard block |
||
| 1067 | 1067 | "true", |
| 1068 | 1068 | "center" |
| 1069 | 1069 | ), |
| 1070 | - array ( |
|
| 1071 | - gettext ( "Is purchased?" ), |
|
| 1070 | + array( |
|
| 1071 | + gettext("Is purchased?"), |
|
| 1072 | 1072 | "100", |
| 1073 | 1073 | "number", |
| 1074 | 1074 | "number", |
@@ -1078,33 +1078,33 @@ discard block |
||
| 1078 | 1078 | "true", |
| 1079 | 1079 | "center" |
| 1080 | 1080 | ), |
| 1081 | - array ( |
|
| 1082 | - gettext ( "Action" ), |
|
| 1081 | + array( |
|
| 1082 | + gettext("Action"), |
|
| 1083 | 1083 | "90", |
| 1084 | 1084 | "", |
| 1085 | 1085 | "", |
| 1086 | 1086 | "", |
| 1087 | - array ( |
|
| 1088 | - "EDIT" => array ( |
|
| 1087 | + array( |
|
| 1088 | + "EDIT" => array( |
|
| 1089 | 1089 | "url" => "did/did_reseller_edit/edit/", |
| 1090 | 1090 | "mode" => "popup" |
| 1091 | 1091 | ), |
| 1092 | - "DELETE" => array ( |
|
| 1092 | + "DELETE" => array( |
|
| 1093 | 1093 | "url" => "did/did_reseller_edit/delete/", |
| 1094 | 1094 | "mode" => "single" |
| 1095 | 1095 | ) |
| 1096 | 1096 | ) |
| 1097 | 1097 | ) |
| 1098 | - ) ); |
|
| 1098 | + )); |
|
| 1099 | 1099 | return $grid_field_arr; |
| 1100 | 1100 | } |
| 1101 | 1101 | /** |
| 1102 | 1102 | * ********************************************************************* |
| 1103 | 1103 | */ |
| 1104 | 1104 | function build_grid_buttons() { |
| 1105 | - $buttons_json = json_encode ( array ( |
|
| 1106 | - array ( |
|
| 1107 | - gettext ( "Create" ), |
|
| 1105 | + $buttons_json = json_encode(array( |
|
| 1106 | + array( |
|
| 1107 | + gettext("Create"), |
|
| 1108 | 1108 | "btn btn-line-warning btn", |
| 1109 | 1109 | "fa fa-plus-circle fa-lg", |
| 1110 | 1110 | "button_action", |
@@ -1112,15 +1112,15 @@ discard block |
||
| 1112 | 1112 | "popup", |
| 1113 | 1113 | "medium" |
| 1114 | 1114 | ), |
| 1115 | - array ( |
|
| 1116 | - gettext ( "Delete" ), |
|
| 1115 | + array( |
|
| 1116 | + gettext("Delete"), |
|
| 1117 | 1117 | "btn btn-line-danger", |
| 1118 | 1118 | "fa fa-times-circle fa-lg", |
| 1119 | 1119 | "button_action", |
| 1120 | 1120 | "/did/did_delete_multiple/" |
| 1121 | 1121 | ), |
| 1122 | - array ( |
|
| 1123 | - gettext ( "Import" ), |
|
| 1122 | + array( |
|
| 1123 | + gettext("Import"), |
|
| 1124 | 1124 | "btn btn-line-blue", |
| 1125 | 1125 | "fa fa-upload fa-lg", |
| 1126 | 1126 | "button_action", |
@@ -1128,25 +1128,25 @@ discard block |
||
| 1128 | 1128 | '', |
| 1129 | 1129 | "small" |
| 1130 | 1130 | ), |
| 1131 | - array ( |
|
| 1132 | - gettext ( "Export" ), |
|
| 1131 | + array( |
|
| 1132 | + gettext("Export"), |
|
| 1133 | 1133 | "btn btn-xing", |
| 1134 | 1134 | "fa fa-download fa-lg", |
| 1135 | 1135 | "button_action", |
| 1136 | 1136 | "/did/did_export_data_xls", |
| 1137 | 1137 | 'single' |
| 1138 | 1138 | ) |
| 1139 | - ) ); |
|
| 1139 | + )); |
|
| 1140 | 1140 | return $buttons_json; |
| 1141 | 1141 | } |
| 1142 | 1142 | function build_did_list_for_customer($accountid, $accounttype) { |
| 1143 | - $account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
| 1143 | + $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
| 1144 | 1144 | $currency_id = $account_info ['currency_id']; |
| 1145 | - $currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id ); |
|
| 1145 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
| 1146 | 1146 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 1147 | - $grid_field_arr = json_encode ( array ( |
|
| 1148 | - array ( |
|
| 1149 | - gettext ( "DID" ), |
|
| 1147 | + $grid_field_arr = json_encode(array( |
|
| 1148 | + array( |
|
| 1149 | + gettext("DID"), |
|
| 1150 | 1150 | "110", |
| 1151 | 1151 | "number", |
| 1152 | 1152 | "", |
@@ -1156,8 +1156,8 @@ discard block |
||
| 1156 | 1156 | "true", |
| 1157 | 1157 | "center" |
| 1158 | 1158 | ), |
| 1159 | - array ( |
|
| 1160 | - gettext ( "Country" ), |
|
| 1159 | + array( |
|
| 1160 | + gettext("Country"), |
|
| 1161 | 1161 | "110", |
| 1162 | 1162 | "country_id", |
| 1163 | 1163 | "country", |
@@ -1167,8 +1167,8 @@ discard block |
||
| 1167 | 1167 | "true", |
| 1168 | 1168 | "center" |
| 1169 | 1169 | ), |
| 1170 | - array ( |
|
| 1171 | - gettext ( "Per Minute Cost($currency)" ), |
|
| 1170 | + array( |
|
| 1171 | + gettext("Per Minute Cost($currency)"), |
|
| 1172 | 1172 | "150", |
| 1173 | 1173 | "cost", |
| 1174 | 1174 | "cost", |
@@ -1178,8 +1178,8 @@ discard block |
||
| 1178 | 1178 | "true", |
| 1179 | 1179 | "right" |
| 1180 | 1180 | ), |
| 1181 | - array ( |
|
| 1182 | - gettext ( "Initial Increment" ), |
|
| 1181 | + array( |
|
| 1182 | + gettext("Initial Increment"), |
|
| 1183 | 1183 | "140", |
| 1184 | 1184 | "init_inc", |
| 1185 | 1185 | "", |
@@ -1189,8 +1189,8 @@ discard block |
||
| 1189 | 1189 | "true", |
| 1190 | 1190 | "center" |
| 1191 | 1191 | ), |
| 1192 | - array ( |
|
| 1193 | - gettext ( "Increment" ), |
|
| 1192 | + array( |
|
| 1193 | + gettext("Increment"), |
|
| 1194 | 1194 | "120", |
| 1195 | 1195 | "inc", |
| 1196 | 1196 | "", |
@@ -1200,8 +1200,8 @@ discard block |
||
| 1200 | 1200 | "true", |
| 1201 | 1201 | "center" |
| 1202 | 1202 | ), |
| 1203 | - array ( |
|
| 1204 | - gettext ( "Setup Fee($currency)" ), |
|
| 1203 | + array( |
|
| 1204 | + gettext("Setup Fee($currency)"), |
|
| 1205 | 1205 | "140", |
| 1206 | 1206 | "setup", |
| 1207 | 1207 | "setup", |
@@ -1211,8 +1211,8 @@ discard block |
||
| 1211 | 1211 | "true", |
| 1212 | 1212 | "right" |
| 1213 | 1213 | ), |
| 1214 | - array ( |
|
| 1215 | - gettext ( "Monthly Fee($currency)" ), |
|
| 1214 | + array( |
|
| 1215 | + gettext("Monthly Fee($currency)"), |
|
| 1216 | 1216 | "140", |
| 1217 | 1217 | "monthlycost", |
| 1218 | 1218 | "monthlycost", |
@@ -1222,26 +1222,26 @@ discard block |
||
| 1222 | 1222 | "true", |
| 1223 | 1223 | "right" |
| 1224 | 1224 | ), |
| 1225 | - array ( |
|
| 1226 | - gettext ( "Action" ), |
|
| 1225 | + array( |
|
| 1226 | + gettext("Action"), |
|
| 1227 | 1227 | "110", |
| 1228 | 1228 | "", |
| 1229 | 1229 | "", |
| 1230 | 1230 | "", |
| 1231 | - array ( |
|
| 1232 | - "DELETE" => array ( |
|
| 1233 | - "url" => "accounts/" . $accounttype . "_dids_action/delete/$accountid/$accounttype/", |
|
| 1231 | + array( |
|
| 1232 | + "DELETE" => array( |
|
| 1233 | + "url" => "accounts/".$accounttype."_dids_action/delete/$accountid/$accounttype/", |
|
| 1234 | 1234 | "mode" => "single" |
| 1235 | 1235 | ) |
| 1236 | 1236 | ) |
| 1237 | 1237 | ) |
| 1238 | - ) ); |
|
| 1238 | + )); |
|
| 1239 | 1239 | return $grid_field_arr; |
| 1240 | 1240 | } |
| 1241 | 1241 | function build_did_list_for_reseller($accountid, $accounttype) { |
| 1242 | 1242 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 1243 | - $grid_field_arr = json_encode ( array ( |
|
| 1244 | - array ( |
|
| 1243 | + $grid_field_arr = json_encode(array( |
|
| 1244 | + array( |
|
| 1245 | 1245 | "DID Number", |
| 1246 | 1246 | "120", |
| 1247 | 1247 | "number", |
@@ -1249,84 +1249,84 @@ discard block |
||
| 1249 | 1249 | "", |
| 1250 | 1250 | "" |
| 1251 | 1251 | ), |
| 1252 | - array ( |
|
| 1253 | - gettext ( "Increment" ), |
|
| 1252 | + array( |
|
| 1253 | + gettext("Increment"), |
|
| 1254 | 1254 | "120", |
| 1255 | 1255 | "inc", |
| 1256 | 1256 | "", |
| 1257 | 1257 | "", |
| 1258 | 1258 | "" |
| 1259 | 1259 | ), |
| 1260 | - array ( |
|
| 1261 | - gettext ( "Is purchased?" ), |
|
| 1260 | + array( |
|
| 1261 | + gettext("Is purchased?"), |
|
| 1262 | 1262 | "120", |
| 1263 | 1263 | "number", |
| 1264 | 1264 | "number", |
| 1265 | 1265 | "number", |
| 1266 | 1266 | "check_did_avl_reseller" |
| 1267 | 1267 | ), |
| 1268 | - array ( |
|
| 1269 | - gettext ( "Per Minute Cost" ), |
|
| 1268 | + array( |
|
| 1269 | + gettext("Per Minute Cost"), |
|
| 1270 | 1270 | "120", |
| 1271 | 1271 | "cost", |
| 1272 | 1272 | "cost", |
| 1273 | 1273 | "cost", |
| 1274 | 1274 | "convert_to_currency" |
| 1275 | 1275 | ), |
| 1276 | - array ( |
|
| 1277 | - gettext ( "Included<br> Seconds" ), |
|
| 1276 | + array( |
|
| 1277 | + gettext("Included<br> Seconds"), |
|
| 1278 | 1278 | "100", |
| 1279 | 1279 | "includedseconds", |
| 1280 | 1280 | "", |
| 1281 | 1281 | "", |
| 1282 | 1282 | "" |
| 1283 | 1283 | ), |
| 1284 | - array ( |
|
| 1285 | - gettext ( "Setup <br> Fee" ), |
|
| 1284 | + array( |
|
| 1285 | + gettext("Setup <br> Fee"), |
|
| 1286 | 1286 | "109", |
| 1287 | 1287 | "setup", |
| 1288 | 1288 | "setup", |
| 1289 | 1289 | "setup", |
| 1290 | 1290 | "convert_to_currency" |
| 1291 | 1291 | ), |
| 1292 | - array ( |
|
| 1293 | - gettext ( "Monthly<br> Fee" ), |
|
| 1292 | + array( |
|
| 1293 | + gettext("Monthly<br> Fee"), |
|
| 1294 | 1294 | "140", |
| 1295 | 1295 | "monthlycost", |
| 1296 | 1296 | "monthlycost", |
| 1297 | 1297 | "monthlycost", |
| 1298 | 1298 | "convert_to_currency" |
| 1299 | 1299 | ), |
| 1300 | - array ( |
|
| 1301 | - gettext ( "Connection Cost" ), |
|
| 1300 | + array( |
|
| 1301 | + gettext("Connection Cost"), |
|
| 1302 | 1302 | "149", |
| 1303 | 1303 | "connectcost", |
| 1304 | 1304 | "connectcost", |
| 1305 | 1305 | "connectcost", |
| 1306 | 1306 | "convert_to_currency" |
| 1307 | 1307 | ), |
| 1308 | - array ( |
|
| 1309 | - gettext ( "Disconnection <br> Fee" ), |
|
| 1308 | + array( |
|
| 1309 | + gettext("Disconnection <br> Fee"), |
|
| 1310 | 1310 | "140", |
| 1311 | 1311 | "disconnectionfee", |
| 1312 | 1312 | "disconnectionfee", |
| 1313 | 1313 | "disconnectionfee", |
| 1314 | 1314 | "convert_to_currency" |
| 1315 | 1315 | ), |
| 1316 | - array ( |
|
| 1317 | - gettext ( "Action" ), |
|
| 1316 | + array( |
|
| 1317 | + gettext("Action"), |
|
| 1318 | 1318 | "100", |
| 1319 | 1319 | "", |
| 1320 | 1320 | "", |
| 1321 | 1321 | "", |
| 1322 | - array ( |
|
| 1323 | - "DELETE" => array ( |
|
| 1322 | + array( |
|
| 1323 | + "DELETE" => array( |
|
| 1324 | 1324 | "url" => "/accounts/reseller_did_action/delete/$accountid/$accounttype/", |
| 1325 | 1325 | "mode" => "single" |
| 1326 | 1326 | ) |
| 1327 | 1327 | ) |
| 1328 | 1328 | ) |
| 1329 | - ) ); |
|
| 1329 | + )); |
|
| 1330 | 1330 | return $grid_field_arr; |
| 1331 | 1331 | } |
| 1332 | 1332 | } |
@@ -22,243 +22,243 @@ discard block |
||
| 22 | 22 | // ############################################################################## |
| 23 | 23 | class Login extends MX_Controller { |
| 24 | 24 | function Login() { |
| 25 | - parent::__construct (); |
|
| 26 | - $this->load->helper ( 'form' ); |
|
| 27 | - $this->load->library ( 'astpp/permission' ); |
|
| 28 | - $this->load->library ( 'encrypt' ); |
|
| 29 | - $this->load->model ( 'Auth_model' ); |
|
| 30 | - $this->load->model ( 'db_model' ); |
|
| 25 | + parent::__construct(); |
|
| 26 | + $this->load->helper('form'); |
|
| 27 | + $this->load->library('astpp/permission'); |
|
| 28 | + $this->load->library('encrypt'); |
|
| 29 | + $this->load->model('Auth_model'); |
|
| 30 | + $this->load->model('db_model'); |
|
| 31 | 31 | } |
| 32 | 32 | function set_lang_global($post = false) { |
| 33 | - if (! is_array ( $post )) { |
|
| 34 | - $str = trim ( $post ); |
|
| 33 | + if ( ! is_array($post)) { |
|
| 34 | + $str = trim($post); |
|
| 35 | 35 | $new_arr [$str] = $str; |
| 36 | 36 | $post = $new_arr; |
| 37 | 37 | } |
| 38 | - if (isset ( $post ['fr_FR'] )) { |
|
| 38 | + if (isset ($post ['fr_FR'])) { |
|
| 39 | 39 | $language = $post ['fr_FR']; |
| 40 | - $this->session->set_userdata ( 'user_language', $language ); |
|
| 40 | + $this->session->set_userdata('user_language', $language); |
|
| 41 | 41 | } |
| 42 | - if (isset ( $post ['es_ES'] )) { |
|
| 42 | + if (isset ($post ['es_ES'])) { |
|
| 43 | 43 | $language = $post ['es_ES']; |
| 44 | - $this->session->set_userdata ( 'user_language', $language ); |
|
| 44 | + $this->session->set_userdata('user_language', $language); |
|
| 45 | 45 | } |
| 46 | - if (isset ( $post ['en_EN'] )) { |
|
| 46 | + if (isset ($post ['en_EN'])) { |
|
| 47 | 47 | $language = $post ['en_EN']; |
| 48 | - $this->session->unset_userdata ( 'user_language', $language ); |
|
| 48 | + $this->session->unset_userdata('user_language', $language); |
|
| 49 | 49 | } |
| 50 | - $this->locale->set_lang (); |
|
| 50 | + $this->locale->set_lang(); |
|
| 51 | 51 | return true; |
| 52 | 52 | } |
| 53 | 53 | function index() { |
| 54 | - if ($this->session->userdata ( 'user_login' ) == FALSE) { |
|
| 55 | - if (! empty ( $_POST ) && trim ( $_POST ['username'] ) != '' && trim ( $_POST ['password'] ) != '') { |
|
| 56 | - $_POST ['password'] = $this->common->encode ( $_POST ['password'] ); |
|
| 57 | - $user_valid = $this->Auth_model->verify_login ( $_POST ['username'], $_POST ['password'] ); |
|
| 54 | + if ($this->session->userdata('user_login') == FALSE) { |
|
| 55 | + if ( ! empty ($_POST) && trim($_POST ['username']) != '' && trim($_POST ['password']) != '') { |
|
| 56 | + $_POST ['password'] = $this->common->encode($_POST ['password']); |
|
| 57 | + $user_valid = $this->Auth_model->verify_login($_POST ['username'], $_POST ['password']); |
|
| 58 | 58 | |
| 59 | 59 | if ($user_valid == 1) { |
| 60 | - $this->session->set_userdata ( 'user_login', TRUE ); |
|
| 61 | - $where = "number = '" . $this->db->escape_str ( $_POST ['username'] ) . "' OR email = '" . $this->db->escape_str ( $_POST ['username'] ) . "'"; |
|
| 62 | - $result = $this->db_model->getSelect ( "*", "accounts", $where ); |
|
| 63 | - $result = $result->result_array (); |
|
| 60 | + $this->session->set_userdata('user_login', TRUE); |
|
| 61 | + $where = "number = '".$this->db->escape_str($_POST ['username'])."' OR email = '".$this->db->escape_str($_POST ['username'])."'"; |
|
| 62 | + $result = $this->db_model->getSelect("*", "accounts", $where); |
|
| 63 | + $result = $result->result_array(); |
|
| 64 | 64 | $result = $result [0]; |
| 65 | 65 | $logintype = $result ['type'] == - 1 ? 2 : $result ['type']; |
| 66 | - $this->session->set_userdata ( 'logintype', $logintype ); |
|
| 67 | - $this->session->set_userdata ( 'userlevel_logintype', $result ['type'] ); |
|
| 68 | - $this->session->set_userdata ( 'username', $_POST ['username'] ); |
|
| 69 | - $this->session->set_userdata ( 'accountinfo', $result ); |
|
| 66 | + $this->session->set_userdata('logintype', $logintype); |
|
| 67 | + $this->session->set_userdata('userlevel_logintype', $result ['type']); |
|
| 68 | + $this->session->set_userdata('username', $_POST ['username']); |
|
| 69 | + $this->session->set_userdata('accountinfo', $result); |
|
| 70 | 70 | /* |
| 71 | 71 | * |
| 72 | 72 | * Purpose : Display logo based on domain name |
| 73 | 73 | * |
| 74 | 74 | */ |
| 75 | - $this->db->select ( "*" ); |
|
| 75 | + $this->db->select("*"); |
|
| 76 | 76 | if ($result ['type'] == '2' || $result ['type'] == '-1') { |
| 77 | - $this->db->where ( array ( |
|
| 77 | + $this->db->where(array( |
|
| 78 | 78 | "accountid" => "1" |
| 79 | - ) ); |
|
| 79 | + )); |
|
| 80 | 80 | } else if ($result ['type'] == '0') { |
| 81 | 81 | if ($result ['reseller_id'] == 0) { |
| 82 | - $this->db->where ( array ( |
|
| 82 | + $this->db->where(array( |
|
| 83 | 83 | "accountid" => "1" |
| 84 | - ) ); |
|
| 84 | + )); |
|
| 85 | 85 | } else { |
| 86 | - $this->db->where ( array ( |
|
| 86 | + $this->db->where(array( |
|
| 87 | 87 | "accountid" => $result ["reseller_id"] |
| 88 | - ) ); |
|
| 88 | + )); |
|
| 89 | 89 | } |
| 90 | 90 | } else if ($result ['type'] == '1') { |
| 91 | 91 | if ($result ['reseller_id'] == 0) { |
| 92 | - $result_invoice = $this->common->get_field_name ( 'id', 'invoice_conf', array ( |
|
| 92 | + $result_invoice = $this->common->get_field_name('id', 'invoice_conf', array( |
|
| 93 | 93 | "accountid" => $result ['id'] |
| 94 | - ) ); |
|
| 94 | + )); |
|
| 95 | 95 | |
| 96 | 96 | if ($result_invoice) { |
| 97 | - $this->db->where ( array ( |
|
| 97 | + $this->db->where(array( |
|
| 98 | 98 | "accountid" => $result ["id"] |
| 99 | - ) ); |
|
| 99 | + )); |
|
| 100 | 100 | } else { |
| 101 | - $this->db->where ( array ( |
|
| 101 | + $this->db->where(array( |
|
| 102 | 102 | "accountid" => "1" |
| 103 | - ) ); |
|
| 103 | + )); |
|
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | - $result_invoice = $this->common->get_field_name ( 'id', 'invoice_conf', array ( |
|
| 106 | + $result_invoice = $this->common->get_field_name('id', 'invoice_conf', array( |
|
| 107 | 107 | "accountid" => $result ['reseller_id'] |
| 108 | - ) ); |
|
| 108 | + )); |
|
| 109 | 109 | if ($result_invoice) { |
| 110 | - $this->db->where ( array ( |
|
| 110 | + $this->db->where(array( |
|
| 111 | 111 | "accountid" => $result ["reseller_id"] |
| 112 | - ) ); |
|
| 112 | + )); |
|
| 113 | 113 | } else { |
| 114 | - $this->db->where ( array ( |
|
| 114 | + $this->db->where(array( |
|
| 115 | 115 | "accountid" => "1" |
| 116 | - ) ); |
|
| 116 | + )); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } else { |
| 120 | - $this->db->where ( array ( |
|
| 120 | + $this->db->where(array( |
|
| 121 | 121 | "accountid" => "1" |
| 122 | - ) ); |
|
| 122 | + )); |
|
| 123 | 123 | } |
| 124 | - $res = $this->db->get ( "invoice_conf" ); |
|
| 125 | - $logo_arr = $res->result (); |
|
| 126 | - $data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png"; |
|
| 127 | - $data ['user_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution"; |
|
| 128 | - $data ['user_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved."; |
|
| 129 | - $data ['user_favicon'] = (isset ( $logo_arr [0]->favicon ) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid . "_" .$logo_arr [0]->favicon : "favicon.ico"; |
|
| 130 | - $this->session->set_userdata ( 'user_logo', $data ['user_logo'] ); |
|
| 131 | - $this->session->set_userdata ( 'user_header', $data ['user_header'] ); |
|
| 132 | - $this->session->set_userdata ( 'user_footer', $data ['user_footer'] ); |
|
| 133 | - $this->session->set_userdata ( 'user_favicon', $data ['user_favicon'] ); |
|
| 124 | + $res = $this->db->get("invoice_conf"); |
|
| 125 | + $logo_arr = $res->result(); |
|
| 126 | + $data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png"; |
|
| 127 | + $data ['user_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution"; |
|
| 128 | + $data ['user_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved."; |
|
| 129 | + $data ['user_favicon'] = (isset ($logo_arr [0]->favicon) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->favicon : "favicon.ico"; |
|
| 130 | + $this->session->set_userdata('user_logo', $data ['user_logo']); |
|
| 131 | + $this->session->set_userdata('user_header', $data ['user_header']); |
|
| 132 | + $this->session->set_userdata('user_footer', $data ['user_footer']); |
|
| 133 | + $this->session->set_userdata('user_favicon', $data ['user_favicon']); |
|
| 134 | 134 | // echo $data['user_header'];exit; |
| 135 | 135 | /** |
| 136 | 136 | * ************************************************************************************ |
| 137 | 137 | */ |
| 138 | 138 | if ($result ['type'] == 0 || $result ['type'] == 1) { |
| 139 | - $menu_list = $this->permission->get_module_access ( $result ['type'] ); |
|
| 140 | - $this->session->set_userdata ( 'mode_cur', 'user' ); |
|
| 139 | + $menu_list = $this->permission->get_module_access($result ['type']); |
|
| 140 | + $this->session->set_userdata('mode_cur', 'user'); |
|
| 141 | 141 | if ($result ['type'] == 1) { |
| 142 | - redirect ( base_url () . 'dashboard/' ); |
|
| 142 | + redirect(base_url().'dashboard/'); |
|
| 143 | 143 | } else { |
| 144 | - redirect ( base_url () . 'user/user/' ); |
|
| 144 | + redirect(base_url().'user/user/'); |
|
| 145 | 145 | } |
| 146 | 146 | } else { |
| 147 | - $menu_list = $this->permission->get_module_access ( $result ['type'] ); |
|
| 148 | - $this->session->set_userdata ( 'mode_cur', 'admin' ); |
|
| 149 | - redirect ( base_url () . 'dashboard/' ); |
|
| 147 | + $menu_list = $this->permission->get_module_access($result ['type']); |
|
| 148 | + $this->session->set_userdata('mode_cur', 'admin'); |
|
| 149 | + redirect(base_url().'dashboard/'); |
|
| 150 | 150 | } |
| 151 | 151 | } else { |
| 152 | 152 | $data ['astpp_notification'] = "Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active"; |
| 153 | 153 | } |
| 154 | 154 | } else { |
| 155 | - if (! empty ( $_POST ) && ($_POST ['password'] == '' || $_POST ['username'] == '')) { |
|
| 155 | + if ( ! empty ($_POST) && ($_POST ['password'] == '' || $_POST ['username'] == '')) { |
|
| 156 | 156 | $data ['astpp_notification'] = "Please enter Username/email and Password."; |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | /* |
| 160 | 160 | * Purpose : Display logo based on domain name |
| 161 | 161 | */ |
| 162 | - $this->db->select ( "*" ); |
|
| 163 | - $this->db->where ( array ( |
|
| 162 | + $this->db->select("*"); |
|
| 163 | + $this->db->where(array( |
|
| 164 | 164 | "domain" => $_SERVER ["HTTP_HOST"] |
| 165 | - ) ); |
|
| 166 | - $res = $this->db->get ( "invoice_conf" ); |
|
| 167 | - $logo_arr = $res->result (); |
|
| 168 | - $data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png"; |
|
| 169 | - $data ['website_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution"; |
|
| 170 | - $data ['website_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved."; |
|
| 171 | - $data ['user_favicon'] = (isset ( $logo_arr [0]->favicon ) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid . "_" .$logo_arr [0]->favicon : "favicon.ico"; |
|
| 172 | - $this->session->set_userdata ( 'user_logo', $data ['user_logo'] ); |
|
| 173 | - $this->session->set_userdata ( 'user_header', $data ['website_header'] ); |
|
| 174 | - $this->session->set_userdata ( 'user_footer', $data ['website_footer'] ); |
|
| 175 | - $this->session->set_userdata ( 'user_favicon', $data ['user_favicon'] ); |
|
| 165 | + )); |
|
| 166 | + $res = $this->db->get("invoice_conf"); |
|
| 167 | + $logo_arr = $res->result(); |
|
| 168 | + $data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png"; |
|
| 169 | + $data ['website_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution"; |
|
| 170 | + $data ['website_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved."; |
|
| 171 | + $data ['user_favicon'] = (isset ($logo_arr [0]->favicon) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->favicon : "favicon.ico"; |
|
| 172 | + $this->session->set_userdata('user_logo', $data ['user_logo']); |
|
| 173 | + $this->session->set_userdata('user_header', $data ['website_header']); |
|
| 174 | + $this->session->set_userdata('user_footer', $data ['website_footer']); |
|
| 175 | + $this->session->set_userdata('user_favicon', $data ['user_favicon']); |
|
| 176 | 176 | |
| 177 | 177 | // echo $data['user_logo'];exit; |
| 178 | 178 | /** |
| 179 | 179 | * ************************************************************************************ |
| 180 | 180 | */ |
| 181 | - $this->session->set_userdata ( 'user_login', FALSE ); |
|
| 181 | + $this->session->set_userdata('user_login', FALSE); |
|
| 182 | 182 | $data ['app_name'] = 'ASTPP - Open Source Billing Solution'; |
| 183 | - $this->load->view ( 'view_login', $data ); |
|
| 183 | + $this->load->view('view_login', $data); |
|
| 184 | 184 | } else { |
| 185 | 185 | /* |
| 186 | 186 | * |
| 187 | 187 | * Purpose : Display logo based on domain name |
| 188 | 188 | * |
| 189 | 189 | */ |
| 190 | - $this->db->select ( "*" ); |
|
| 191 | - $this->db->where ( array ( |
|
| 190 | + $this->db->select("*"); |
|
| 191 | + $this->db->where(array( |
|
| 192 | 192 | "domain" => $_SERVER ["HTTP_HOST"] |
| 193 | - ) ); |
|
| 194 | - $res = $this->db->get ( "invoice_conf" ); |
|
| 195 | - $logo_arr = $res->result (); |
|
| 193 | + )); |
|
| 194 | + $res = $this->db->get("invoice_conf"); |
|
| 195 | + $logo_arr = $res->result(); |
|
| 196 | 196 | // print_r( $logo_arr );exit; |
| 197 | 197 | |
| 198 | - $data ['user_logo'] = (isset ( $logo_arr [0]->logo ) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid . "_" . $logo_arr [0]->logo : "logo.png"; |
|
| 199 | - $data ['user_header'] = (isset ( $logo_arr [0]->website_title ) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution"; |
|
| 200 | - $data ['user_footer'] = (isset ( $logo_arr [0]->website_footer ) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved."; |
|
| 201 | - $data ['user_favicon'] = (isset ( $logo_arr [0]->favicon ) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid . "_" .$logo_arr [0]->favicon : "favicon.ico"; |
|
| 198 | + $data ['user_logo'] = (isset ($logo_arr [0]->logo) && $logo_arr [0]->logo != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->logo : "logo.png"; |
|
| 199 | + $data ['user_header'] = (isset ($logo_arr [0]->website_title) && $logo_arr [0]->website_title != "") ? $logo_arr [0]->website_title : "ASTPP - Open Source Voip Billing Solution"; |
|
| 200 | + $data ['user_footer'] = (isset ($logo_arr [0]->website_footer) && $logo_arr [0]->website_footer != "") ? $logo_arr [0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved."; |
|
| 201 | + $data ['user_favicon'] = (isset ($logo_arr [0]->favicon) && $logo_arr [0]->favicon != "") ? $logo_arr [0]->accountid."_".$logo_arr [0]->favicon : "favicon.ico"; |
|
| 202 | 202 | |
| 203 | - $this->session->set_userdata ( 'user_logo', $data ['user_logo'] ); |
|
| 204 | - $this->session->set_userdata ( 'user_header', $data ['user_header'] ); |
|
| 205 | - $this->session->set_userdata ( 'user_footer', $data ['user_footer'] ); |
|
| 206 | - $this->session->set_userdata ( 'user_favicon', $data ['user_favicon'] ); |
|
| 203 | + $this->session->set_userdata('user_logo', $data ['user_logo']); |
|
| 204 | + $this->session->set_userdata('user_header', $data ['user_header']); |
|
| 205 | + $this->session->set_userdata('user_footer', $data ['user_footer']); |
|
| 206 | + $this->session->set_userdata('user_favicon', $data ['user_favicon']); |
|
| 207 | 207 | // echo $data['user_logo'];exit; |
| 208 | 208 | /** |
| 209 | 209 | * ************************************************************************************ |
| 210 | 210 | */ |
| 211 | - if ($this->session->userdata ( 'logintype' ) == '2') { |
|
| 212 | - redirect ( base_url () . 'dashboard/' ); |
|
| 211 | + if ($this->session->userdata('logintype') == '2') { |
|
| 212 | + redirect(base_url().'dashboard/'); |
|
| 213 | 213 | } else { |
| 214 | - redirect ( base_url () . 'user/user/' ); |
|
| 214 | + redirect(base_url().'user/user/'); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | function logout() { |
| 219 | - $this->session->sess_destroy (); |
|
| 220 | - redirect ( base_url () ); |
|
| 219 | + $this->session->sess_destroy(); |
|
| 220 | + redirect(base_url()); |
|
| 221 | 221 | } |
| 222 | 222 | function paypal_response() { |
| 223 | - if (count ( $_POST ) > 0) { |
|
| 223 | + if (count($_POST) > 0) { |
|
| 224 | 224 | $response_arr = $_POST; |
| 225 | 225 | |
| 226 | - $logger = ( array ) $this->db->get_where ( "system", array ( |
|
| 226 | + $logger = (array)$this->db->get_where("system", array( |
|
| 227 | 227 | "name" => "log_path", |
| 228 | 228 | "group_title" => "global" |
| 229 | - ) )->first_row (); |
|
| 229 | + ))->first_row(); |
|
| 230 | 230 | $logger_path = $logger ['value']; |
| 231 | - $fp = fopen ( $logger_path . "astpp_payment.log", "a+" ); |
|
| 232 | - $date = date ( "Y-m-d H:i:s" ); |
|
| 233 | - fwrite ( $fp, "====================" . $date . "===============================\n" ); |
|
| 234 | - foreach ( $response_arr as $key => $value ) { |
|
| 235 | - fwrite ( $fp, $key . ":::>" . $value . "\n" ); |
|
| 231 | + $fp = fopen($logger_path."astpp_payment.log", "a+"); |
|
| 232 | + $date = date("Y-m-d H:i:s"); |
|
| 233 | + fwrite($fp, "====================".$date."===============================\n"); |
|
| 234 | + foreach ($response_arr as $key => $value) { |
|
| 235 | + fwrite($fp, $key.":::>".$value."\n"); |
|
| 236 | 236 | } |
| 237 | - $payment_check = $this->db_model->countQuery ( "txn_id", "payments", array ( |
|
| 237 | + $payment_check = $this->db_model->countQuery("txn_id", "payments", array( |
|
| 238 | 238 | "txn_id" => $response_arr ['txn_id'] |
| 239 | - ) ); |
|
| 239 | + )); |
|
| 240 | 240 | if (($response_arr ["payment_status"] == "Pending" || $response_arr ["payment_status"] == "Complete" || $response_arr ["payment_status"] == "Completed") && $payment_check == 0) { |
| 241 | 241 | |
| 242 | - $paypal_tax = ( array ) $this->db->get_where ( "system", array ( |
|
| 242 | + $paypal_tax = (array)$this->db->get_where("system", array( |
|
| 243 | 243 | "name" => "paypal_tax", |
| 244 | 244 | "group_title" => "paypal" |
| 245 | - ) )->first_row (); |
|
| 245 | + ))->first_row(); |
|
| 246 | 246 | $paypal_tax = $paypal_tax ['value']; |
| 247 | 247 | $balance_amt = $actual_amount = $response_arr ["custom"]; |
| 248 | - $paypal_fee = ( array ) $this->db->get_where ( "system", array ( |
|
| 248 | + $paypal_fee = (array)$this->db->get_where("system", array( |
|
| 249 | 249 | "name" => "paypal_fee", |
| 250 | 250 | "group_title" => "paypal" |
| 251 | - ) )->first_row (); |
|
| 251 | + ))->first_row(); |
|
| 252 | 252 | $paypal_fee = $paypal_fee ['value']; |
| 253 | 253 | $paypalfee = ($paypal_fee == 0) ? '0' : $response_arr ["mc_gross"]; |
| 254 | - $account_data = ( array ) $this->db->get_where ( "accounts", array ( |
|
| 254 | + $account_data = (array)$this->db->get_where("accounts", array( |
|
| 255 | 255 | "id" => $response_arr ["item_number"] |
| 256 | - ) )->first_row (); |
|
| 257 | - $currency = ( array ) $this->db->get_where ( 'currency', array ( |
|
| 256 | + ))->first_row(); |
|
| 257 | + $currency = (array)$this->db->get_where('currency', array( |
|
| 258 | 258 | "id" => $account_data ["currency_id"] |
| 259 | - ) )->first_row (); |
|
| 260 | - $date = date ( 'Y-m-d H:i:s' ); |
|
| 261 | - $payment_trans_array = array ( |
|
| 259 | + ))->first_row(); |
|
| 260 | + $date = date('Y-m-d H:i:s'); |
|
| 261 | + $payment_trans_array = array( |
|
| 262 | 262 | "accountid" => $response_arr ["item_number"], |
| 263 | 263 | "amount" => $response_arr ["payment_gross"], |
| 264 | 264 | "tax" => "1", |
@@ -267,54 +267,54 @@ discard block |
||
| 267 | 267 | "paypal_fee" => $paypalfee, |
| 268 | 268 | "user_currency" => $currency ["currency"], |
| 269 | 269 | "currency_rate" => $currency ["currencyrate"], |
| 270 | - "transaction_details" => json_encode ( $response_arr ), |
|
| 270 | + "transaction_details" => json_encode($response_arr), |
|
| 271 | 271 | "date" => $date |
| 272 | 272 | ); |
| 273 | - $paymentid = $this->db->insert ( 'payment_transaction', $payment_trans_array ); |
|
| 273 | + $paymentid = $this->db->insert('payment_transaction', $payment_trans_array); |
|
| 274 | 274 | $parent_id = $account_data ['reseller_id'] > 0 ? $account_data ['reseller_id'] : '-1'; |
| 275 | - $payment_arr = array ( |
|
| 275 | + $payment_arr = array( |
|
| 276 | 276 | "accountid" => $response_arr ["item_number"], |
| 277 | 277 | "payment_mode" => "1", |
| 278 | 278 | "credit" => $balance_amt, |
| 279 | 279 | "type" => "PAYPAL", |
| 280 | 280 | "payment_by" => $parent_id, |
| 281 | - "notes" => "Payment Made by Paypal on date:-" . $date, |
|
| 281 | + "notes" => "Payment Made by Paypal on date:-".$date, |
|
| 282 | 282 | "paypalid" => $paymentid, |
| 283 | 283 | "txn_id" => $response_arr ["txn_id"], |
| 284 | - 'payment_date' => gmdate ( 'Y-m-d H:i:s', strtotime ( $response_arr ['payment_date'] ) ) |
|
| 284 | + 'payment_date' => gmdate('Y-m-d H:i:s', strtotime($response_arr ['payment_date'])) |
|
| 285 | 285 | ); |
| 286 | - $this->db->insert ( 'payments', $payment_arr ); |
|
| 287 | - $this->db->select ( 'invoiceid' ); |
|
| 288 | - $this->db->order_by ( 'id', 'desc' ); |
|
| 289 | - $this->db->limit ( 1 ); |
|
| 290 | - $last_invoice_result = ( array ) $this->db->get ( 'invoices' )->first_row (); |
|
| 291 | - $last_invoice_ID = isset ( $last_invoice_result ['invoiceid'] ) && $last_invoice_result ['invoiceid'] > 0 ? $last_invoice_result ['invoiceid'] : 1; |
|
| 286 | + $this->db->insert('payments', $payment_arr); |
|
| 287 | + $this->db->select('invoiceid'); |
|
| 288 | + $this->db->order_by('id', 'desc'); |
|
| 289 | + $this->db->limit(1); |
|
| 290 | + $last_invoice_result = (array)$this->db->get('invoices')->first_row(); |
|
| 291 | + $last_invoice_ID = isset ($last_invoice_result ['invoiceid']) && $last_invoice_result ['invoiceid'] > 0 ? $last_invoice_result ['invoiceid'] : 1; |
|
| 292 | 292 | $reseller_id = $account_data ['reseller_id'] > 0 ? $account_data ['reseller_id'] : 0; |
| 293 | - $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
| 294 | - $this->db->where ( $where ); |
|
| 295 | - $this->db->select ( '*' ); |
|
| 296 | - $this->db->order_by ( 'accountid', 'desc' ); |
|
| 297 | - $this->db->limit ( 1 ); |
|
| 298 | - $invoiceconf = $this->db->get ( 'invoice_conf' ); |
|
| 299 | - $invoiceconf = ( array ) $invoiceconf->first_row (); |
|
| 293 | + $where = "accountid IN ('".$reseller_id."','1')"; |
|
| 294 | + $this->db->where($where); |
|
| 295 | + $this->db->select('*'); |
|
| 296 | + $this->db->order_by('accountid', 'desc'); |
|
| 297 | + $this->db->limit(1); |
|
| 298 | + $invoiceconf = $this->db->get('invoice_conf'); |
|
| 299 | + $invoiceconf = (array)$invoiceconf->first_row(); |
|
| 300 | 300 | $invoice_prefix = $invoiceconf ['invoice_prefix']; |
| 301 | 301 | |
| 302 | - $due_date = gmdate ( "Y-m-d H:i:s", strtotime ( gmdate ( "Y-m-d H:i:s" ) . " +" . $invoiceconf ['interval'] . " days" ) ); |
|
| 303 | - $invoice_id = $this->generate_receipt ( $account_data ['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date ); |
|
| 304 | - $details_insert = array ( |
|
| 302 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf ['interval']." days")); |
|
| 303 | + $invoice_id = $this->generate_receipt($account_data ['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date); |
|
| 304 | + $details_insert = array( |
|
| 305 | 305 | 'created_date' => $date, |
| 306 | 306 | 'credit' => $balance_amt, |
| 307 | 307 | 'debit' => '-', |
| 308 | 308 | 'accountid' => $account_data ["id"], |
| 309 | 309 | 'reseller_id' => $account_data ['reseller_id'], |
| 310 | 310 | 'invoiceid' => $invoice_id, |
| 311 | - 'description' => "Payment Made by Paypal on date:-" . $date, |
|
| 311 | + 'description' => "Payment Made by Paypal on date:-".$date, |
|
| 312 | 312 | 'item_type' => 'PAYMENT', |
| 313 | 313 | 'before_balance' => $account_data ['balance'], |
| 314 | 314 | 'after_balance' => $account_data ['balance'] + $balance_amt |
| 315 | 315 | ); |
| 316 | - $this->db->insert ( "invoice_details", $details_insert ); |
|
| 317 | - $this->db_model->update_balance ( $balance_amt, $account_data ["id"], "credit" ); |
|
| 316 | + $this->db->insert("invoice_details", $details_insert); |
|
| 317 | + $this->db_model->update_balance($balance_amt, $account_data ["id"], "credit"); |
|
| 318 | 318 | /* |
| 319 | 319 | * if($parent_id > 0){ |
| 320 | 320 | * $reseller_ids=$this->common->get_parent_info($parent_id,0); |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | * } |
| 369 | 369 | * } |
| 370 | 370 | */ |
| 371 | - redirect ( base_url () . 'user/user/' ); |
|
| 371 | + redirect(base_url().'user/user/'); |
|
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | - redirect ( base_url () . 'user/user/' ); |
|
| 374 | + redirect(base_url().'user/user/'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -380,14 +380,14 @@ discard block |
||
| 380 | 380 | * @param string $due_date |
| 381 | 381 | */ |
| 382 | 382 | function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) { |
| 383 | - $invoice_data = array ( |
|
| 383 | + $invoice_data = array( |
|
| 384 | 384 | "accountid" => $accountid, |
| 385 | 385 | "invoice_prefix" => $invoice_prefix, |
| 386 | - "invoiceid" => '0000' . $last_invoice_ID, |
|
| 386 | + "invoiceid" => '0000'.$last_invoice_ID, |
|
| 387 | 387 | "reseller_id" => $accountinfo ['reseller_id'], |
| 388 | - "invoice_date" => gmdate ( "Y-m-d H:i:s" ), |
|
| 389 | - "from_date" => gmdate ( "Y-m-d H:i:s" ), |
|
| 390 | - "to_date" => gmdate ( "Y-m-d H:i:s" ), |
|
| 388 | + "invoice_date" => gmdate("Y-m-d H:i:s"), |
|
| 389 | + "from_date" => gmdate("Y-m-d H:i:s"), |
|
| 390 | + "to_date" => gmdate("Y-m-d H:i:s"), |
|
| 391 | 391 | "due_date" => $due_date, |
| 392 | 392 | "status" => 1, |
| 393 | 393 | "balance" => $accountinfo ['balance'], |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | "type" => 'R', |
| 396 | 396 | "confirm" => '1' |
| 397 | 397 | ); |
| 398 | - $this->db->insert ( "invoices", $invoice_data ); |
|
| 399 | - $invoiceid = $this->db->insert_id (); |
|
| 398 | + $this->db->insert("invoices", $invoice_data); |
|
| 399 | + $invoiceid = $this->db->insert_id(); |
|
| 400 | 400 | return $invoiceid; |
| 401 | 401 | } |
| 402 | 402 | function get_language_text() { |
| 403 | 403 | // echo '<pre>'; print_r($_POST); exit; |
| 404 | - echo gettext ( $_POST ['display'] ); |
|
| 404 | + echo gettext($_POST ['display']); |
|
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
@@ -6,17 +6,17 @@ discard block |
||
| 6 | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 7 | 7 | <title> |
| 8 | 8 | <?php |
| 9 | - $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
| 9 | + $this->db->where('domain', $_SERVER['HTTP_HOST']); |
|
| 10 | 10 | $this->db->select('*'); |
| 11 | 11 | $this->db->order_by('accountid', 'desc'); |
| 12 | 12 | $this->db->limit(1); |
| 13 | 13 | $invoiceconf = $this->db->get('invoice_conf'); |
| 14 | 14 | $invoiceconf = (array)$invoiceconf->first_row(); |
| 15 | - if(isset($invoiceconf['website_title']) && $invoiceconf['website_title']!='') { |
|
| 15 | + if (isset($invoiceconf['website_title']) && $invoiceconf['website_title'] != '') { |
|
| 16 | 16 | ?> |
| 17 | 17 | Log In | <?php echo $invoiceconf['website_title']; ?> |
| 18 | 18 | <?php |
| 19 | - }else{ |
|
| 19 | + } else { |
|
| 20 | 20 | ?> |
| 21 | 21 | Log In | ASTPP - Open Source Voip Billing Solution |
| 22 | 22 | <?php |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | <div class="row"> |
| 92 | 92 | |
| 93 | 93 | <div class="col-md-4 col-md-offset-4"> <span class="login_error" style="color:white !important;"> |
| 94 | - <?php if (isset($astpp_notification)){ |
|
| 94 | + <?php if (isset($astpp_notification)) { |
|
| 95 | 95 | echo $astpp_notification; |
| 96 | - }else{ |
|
| 96 | + } else { |
|
| 97 | 97 | echo " "; |
| 98 | 98 | } ?> |
| 99 | 99 | </span></div> <br/> |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | <h2 class="text-center"> |
| 108 | 108 | |
| 109 | 109 | <?php |
| 110 | - if(isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != ""){ |
|
| 110 | + if (isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != "") { |
|
| 111 | 111 | $logo = $this->session->userdata['user_logo']; |
| 112 | - }else{ |
|
| 112 | + } else { |
|
| 113 | 113 | $logo = 'logo.png'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if ($this->session->userdata('userlevel_logintype') != '0') {?> |
| 117 | - <img style="height:53px;width:216px;" id="logo" alt="login" src="<?php echo base_url(); ?>upload/<?php echo $logo;?>"> |
|
| 117 | + <img style="height:53px;width:216px;" id="logo" alt="login" src="<?php echo base_url(); ?>upload/<?php echo $logo; ?>"> |
|
| 118 | 118 | <? } else {?> |
| 119 | - <img style="height:53px;width:216px;" id="logo" alt='login' src="<?php echo base_url(); ?>upload/<?php echo $logo;?>"> |
|
| 119 | + <img style="height:53px;width:216px;" id="logo" alt='login' src="<?php echo base_url(); ?>upload/<?php echo $logo; ?>"> |
|
| 120 | 120 | <? }?> |
| 121 | 121 | <div class="clear"></div> |
| 122 | 122 | |
@@ -22,61 +22,61 @@ discard block |
||
| 22 | 22 | // ############################################################################## |
| 23 | 23 | class Opensips_model extends CI_Model { |
| 24 | 24 | function Opensips_model() { |
| 25 | - parent::__construct (); |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | $db_config = Common_model::$global_config ['system_config']; |
| 27 | - $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="; |
|
| 28 | - $this->opensips_db = $this->load->database ( $opensipdsn, true ); |
|
| 27 | + $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="; |
|
| 28 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
| 29 | 29 | } |
| 30 | 30 | function getopensipsdevice_list($flag, $start = 0, $limit = 0) { |
| 31 | - $this->db_model->build_search_opensips ( $this->opensips_db, 'opensipsdevice_list_search' ); |
|
| 32 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 31 | + $this->db_model->build_search_opensips($this->opensips_db, 'opensipsdevice_list_search'); |
|
| 32 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 33 | 33 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 34 | - $this->opensips_db->where ( 'reseller_id', $reseller_id ); |
|
| 34 | + $this->opensips_db->where('reseller_id', $reseller_id); |
|
| 35 | 35 | if ($flag) { |
| 36 | - $this->opensips_db->limit ( $limit, $start ); |
|
| 37 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
| 38 | - $this->opensips_db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
| 36 | + $this->opensips_db->limit($limit, $start); |
|
| 37 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
| 38 | + $this->opensips_db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
| 39 | 39 | } else { |
| 40 | - $this->opensips_db->order_by ( 'username', 'asc' ); |
|
| 40 | + $this->opensips_db->order_by('username', 'asc'); |
|
| 41 | 41 | } |
| 42 | - $query = $this->opensips_db->get ( "subscriber" ); |
|
| 42 | + $query = $this->opensips_db->get("subscriber"); |
|
| 43 | 43 | } else { |
| 44 | - $query = $this->opensips_db->get ( "subscriber" ); |
|
| 45 | - $query = $query->num_rows (); |
|
| 44 | + $query = $this->opensips_db->get("subscriber"); |
|
| 45 | + $query = $query->num_rows(); |
|
| 46 | 46 | } |
| 47 | 47 | return $query; |
| 48 | 48 | } |
| 49 | 49 | function getopensipsdevice_customer_list($flag, $accountid = "", $accounttype, $start = "0", $limit = "0") { |
| 50 | 50 | if ($accountid != "") { |
| 51 | - $where = array ( |
|
| 52 | - "accountcode" => $this->common->get_field_name ( 'number', 'accounts', array ( |
|
| 51 | + $where = array( |
|
| 52 | + "accountcode" => $this->common->get_field_name('number', 'accounts', array( |
|
| 53 | 53 | 'id' => $accountid |
| 54 | - ) ) |
|
| 54 | + )) |
|
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | - $instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_opensips' ); |
|
| 58 | - $like_str = ! empty ( $instant_search ) ? "(username like '%$instant_search%' |
|
| 57 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_opensips'); |
|
| 58 | + $like_str = ! empty ($instant_search) ? "(username like '%$instant_search%' |
|
| 59 | 59 | OR password like '%$instant_search%' |
| 60 | 60 | OR domain like '%$instant_search%' |
| 61 | 61 | OR effective_caller_id_name like '%$instant_search%' |
| 62 | 62 | OR effective_caller_id_number like '%$instant_search%' |
| 63 | 63 | )" : null; |
| 64 | - if (! empty ( $like_str )) |
|
| 65 | - $this->opensips_db->where ( $like_str ); |
|
| 66 | - $this->opensips_db->where ( $where ); |
|
| 64 | + if ( ! empty ($like_str)) |
|
| 65 | + $this->opensips_db->where($like_str); |
|
| 66 | + $this->opensips_db->where($where); |
|
| 67 | 67 | if ($flag) { |
| 68 | - $this->opensips_db->limit ( $limit, $start ); |
|
| 68 | + $this->opensips_db->limit($limit, $start); |
|
| 69 | 69 | } |
| 70 | - $result = $this->opensips_db->get ( "subscriber" ); |
|
| 71 | - if ($result->num_rows () > 0) { |
|
| 70 | + $result = $this->opensips_db->get("subscriber"); |
|
| 71 | + if ($result->num_rows() > 0) { |
|
| 72 | 72 | if ($flag) { |
| 73 | 73 | return $result; |
| 74 | 74 | } else { |
| 75 | - return $result->num_rows (); |
|
| 75 | + return $result->num_rows(); |
|
| 76 | 76 | } |
| 77 | 77 | } else { |
| 78 | 78 | if ($flag) { |
| 79 | - $result = ( object ) array ( |
|
| 79 | + $result = (object)array( |
|
| 80 | 80 | 'num_rows' => 0 |
| 81 | 81 | ); |
| 82 | 82 | } else { |
@@ -86,32 +86,32 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | function getopensipsdispatcher_list($flag, $start = '', $limit = '') { |
| 89 | - $this->db_model->build_search_opensips ( $this->opensips_db, 'opensipsdispatcher_list_search' ); |
|
| 89 | + $this->db_model->build_search_opensips($this->opensips_db, 'opensipsdispatcher_list_search'); |
|
| 90 | 90 | if ($flag) { |
| 91 | - $this->opensips_db->limit ( $limit, $start ); |
|
| 92 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
| 93 | - $this->opensips_db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
| 91 | + $this->opensips_db->limit($limit, $start); |
|
| 92 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
| 93 | + $this->opensips_db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
| 94 | 94 | } else { |
| 95 | - $this->opensips_db->order_by ( 'setid', 'asc' ); |
|
| 95 | + $this->opensips_db->order_by('setid', 'asc'); |
|
| 96 | 96 | } |
| 97 | - $query = $this->opensips_db->get ( "dispatcher" ); |
|
| 97 | + $query = $this->opensips_db->get("dispatcher"); |
|
| 98 | 98 | } else { |
| 99 | - $query = $this->opensips_db->get ( "dispatcher" ); |
|
| 100 | - $query = $query->num_rows (); |
|
| 99 | + $query = $this->opensips_db->get("dispatcher"); |
|
| 100 | + $query = $query->num_rows(); |
|
| 101 | 101 | } |
| 102 | 102 | return $query; |
| 103 | 103 | } |
| 104 | 104 | function add_opensipsdevices($data) { |
| 105 | - unset ( $data ["action"] ); |
|
| 106 | - $data ['creation_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
| 107 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
| 105 | + unset ($data ["action"]); |
|
| 106 | + $data ['creation_date'] = gmdate("Y-m-d H:i:s"); |
|
| 107 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 108 | 108 | $data ['reseller_id'] = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
| 109 | - unset ( $data ["id"] ); |
|
| 110 | - $this->opensips_db->insert ( "subscriber", $data ); |
|
| 109 | + unset ($data ["id"]); |
|
| 110 | + $this->opensips_db->insert("subscriber", $data); |
|
| 111 | 111 | } |
| 112 | 112 | function edit_opensipsdevices($data, $id) { |
| 113 | - unset ( $data ["action"] ); |
|
| 114 | - $data = array ( |
|
| 113 | + unset ($data ["action"]); |
|
| 114 | + $data = array( |
|
| 115 | 115 | "username" => $data ['username'], |
| 116 | 116 | "password" => $data ['password'], |
| 117 | 117 | "accountcode" => $data ['accountcode'], |
@@ -120,50 +120,50 @@ discard block |
||
| 120 | 120 | "effective_caller_id_number" => $data ['effective_caller_id_number'], |
| 121 | 121 | "status" => $data ['status'] |
| 122 | 122 | ); |
| 123 | - $this->opensips_db->where ( "id", $id ); |
|
| 124 | - $data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" ); |
|
| 125 | - $this->opensips_db->update ( "subscriber", $data ); |
|
| 123 | + $this->opensips_db->where("id", $id); |
|
| 124 | + $data ['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
| 125 | + $this->opensips_db->update("subscriber", $data); |
|
| 126 | 126 | } |
| 127 | 127 | function delete_opensips_devices($id) { |
| 128 | - $this->opensips_db->where ( "id", $id ); |
|
| 129 | - $this->opensips_db->delete ( "subscriber" ); |
|
| 128 | + $this->opensips_db->where("id", $id); |
|
| 129 | + $this->opensips_db->delete("subscriber"); |
|
| 130 | 130 | return true; |
| 131 | 131 | } |
| 132 | 132 | function remove_opensips($id) { |
| 133 | - $this->opensips_db->where ( "id", $id ); |
|
| 134 | - $this->opensips_db->delete ( "subscriber" ); |
|
| 133 | + $this->opensips_db->where("id", $id); |
|
| 134 | + $this->opensips_db->delete("subscriber"); |
|
| 135 | 135 | return true; |
| 136 | 136 | } |
| 137 | 137 | function add_opensipsdispatcher($data) { |
| 138 | - unset ( $data ["action"] ); |
|
| 139 | - $this->opensips_db->insert ( "dispatcher", $data ); |
|
| 138 | + unset ($data ["action"]); |
|
| 139 | + $this->opensips_db->insert("dispatcher", $data); |
|
| 140 | 140 | } |
| 141 | 141 | function edit_opensipsdispatcher($data, $id) { |
| 142 | - unset ( $data ["action"] ); |
|
| 143 | - $this->opensips_db->where ( "id", $id ); |
|
| 144 | - $this->opensips_db->update ( "dispatcher", $data ); |
|
| 142 | + unset ($data ["action"]); |
|
| 143 | + $this->opensips_db->where("id", $id); |
|
| 144 | + $this->opensips_db->update("dispatcher", $data); |
|
| 145 | 145 | } |
| 146 | 146 | function remove_dispatcher($id) { |
| 147 | - $this->opensips_db->where ( "id", $id ); |
|
| 148 | - $this->opensips_db->delete ( "dispatcher" ); |
|
| 147 | + $this->opensips_db->where("id", $id); |
|
| 148 | + $this->opensips_db->delete("dispatcher"); |
|
| 149 | 149 | return true; |
| 150 | 150 | } |
| 151 | 151 | function build_search_opensips($accounts_list_search) { |
| 152 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
| 153 | - $account_search = $this->session->userdata ( $accounts_list_search ); |
|
| 154 | - unset ( $account_search ["ajax_search"] ); |
|
| 155 | - unset ( $account_search ["advance_search"] ); |
|
| 156 | - foreach ( $account_search as $key => $value ) { |
|
| 152 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 153 | + $account_search = $this->session->userdata($accounts_list_search); |
|
| 154 | + unset ($account_search ["ajax_search"]); |
|
| 155 | + unset ($account_search ["advance_search"]); |
|
| 156 | + foreach ($account_search as $key => $value) { |
|
| 157 | 157 | if ($value != "") { |
| 158 | - if (is_array ( $value )) { |
|
| 159 | - if (array_key_exists ( $key . "-integer", $value )) { |
|
| 160 | - $this->get_interger_array ( $key, $value [$key . "-integer"], $value [$key] ); |
|
| 158 | + if (is_array($value)) { |
|
| 159 | + if (array_key_exists($key."-integer", $value)) { |
|
| 160 | + $this->get_interger_array($key, $value [$key."-integer"], $value [$key]); |
|
| 161 | 161 | } |
| 162 | - if (array_key_exists ( $key . "-string", $value )) { |
|
| 163 | - $this->get_string_array ( $key, $value [$key . "-string"], $value [$key] ); |
|
| 162 | + if (array_key_exists($key."-string", $value)) { |
|
| 163 | + $this->get_string_array($key, $value [$key."-string"], $value [$key]); |
|
| 164 | 164 | } |
| 165 | 165 | } else { |
| 166 | - $this->opensips_db->where ( $key, $value ); |
|
| 166 | + $this->opensips_db->where($key, $value); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -173,22 +173,22 @@ discard block |
||
| 173 | 173 | if ($search_array != '') { |
| 174 | 174 | switch ($value) { |
| 175 | 175 | case "1" : |
| 176 | - $this->opensips_db->where ( $field, $search_array ); |
|
| 176 | + $this->opensips_db->where($field, $search_array); |
|
| 177 | 177 | break; |
| 178 | 178 | case "2" : |
| 179 | - $this->opensips_db->where ( $field . ' <>', $search_array ); |
|
| 179 | + $this->opensips_db->where($field.' <>', $search_array); |
|
| 180 | 180 | break; |
| 181 | 181 | case "3" : |
| 182 | - $this->opensips_db->where ( $field . ' > ', $search_array ); |
|
| 182 | + $this->opensips_db->where($field.' > ', $search_array); |
|
| 183 | 183 | break; |
| 184 | 184 | case "4" : |
| 185 | - $this->opensips_db->where ( $field . ' < ', $search_array ); |
|
| 185 | + $this->opensips_db->where($field.' < ', $search_array); |
|
| 186 | 186 | break; |
| 187 | 187 | case "5" : |
| 188 | - $this->opensips_db->where ( $field . ' >= ', $search_array ); |
|
| 188 | + $this->opensips_db->where($field.' >= ', $search_array); |
|
| 189 | 189 | break; |
| 190 | 190 | case "6" : |
| 191 | - $this->opensips_db->where ( $field . ' <= ', $search_array ); |
|
| 191 | + $this->opensips_db->where($field.' <= ', $search_array); |
|
| 192 | 192 | break; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -197,16 +197,16 @@ discard block |
||
| 197 | 197 | if ($search_array != '') { |
| 198 | 198 | switch ($value) { |
| 199 | 199 | case "1" : |
| 200 | - $this->opensips_db->like ( $field, $search_array ); |
|
| 200 | + $this->opensips_db->like($field, $search_array); |
|
| 201 | 201 | break; |
| 202 | 202 | case "2" : |
| 203 | - $this->opensips_db->not_like ( $field, $search_array ); |
|
| 203 | + $this->opensips_db->not_like($field, $search_array); |
|
| 204 | 204 | break; |
| 205 | 205 | case "3" : |
| 206 | - $this->opensips_db->where ( $field, $search_array ); |
|
| 206 | + $this->opensips_db->where($field, $search_array); |
|
| 207 | 207 | break; |
| 208 | 208 | case "4" : |
| 209 | - $this->opensips_db->where ( $field . ' <>', $search_array ); |
|
| 209 | + $this->opensips_db->where($field.' <>', $search_array); |
|
| 210 | 210 | break; |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -22,223 +22,223 @@ discard block |
||
| 22 | 22 | // ############################################################################## |
| 23 | 23 | class Opensips extends MX_Controller { |
| 24 | 24 | function Opensips() { |
| 25 | - parent::__construct (); |
|
| 25 | + parent::__construct(); |
|
| 26 | 26 | |
| 27 | - $this->load->helper ( 'template_inheritance' ); |
|
| 28 | - $this->load->library ( 'session' ); |
|
| 29 | - $this->load->library ( "opensips_form" ); |
|
| 30 | - $this->load->library ( 'astpp/form' ); |
|
| 31 | - $this->load->model ( 'opensips_model' ); |
|
| 27 | + $this->load->helper('template_inheritance'); |
|
| 28 | + $this->load->library('session'); |
|
| 29 | + $this->load->library("opensips_form"); |
|
| 30 | + $this->load->library('astpp/form'); |
|
| 31 | + $this->load->model('opensips_model'); |
|
| 32 | 32 | $db_config = Common_model::$global_config ['system_config']; |
| 33 | - $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="; |
|
| 34 | - $this->opensips_db = $this->load->database ( $opensipdsn, true ); |
|
| 35 | - if ($this->session->userdata ( 'user_login' ) == FALSE) |
|
| 36 | - redirect ( base_url () . '/astpp/login' ); |
|
| 33 | + $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="; |
|
| 34 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
| 35 | + if ($this->session->userdata('user_login') == FALSE) |
|
| 36 | + redirect(base_url().'/astpp/login'); |
|
| 37 | 37 | } |
| 38 | 38 | function opensips_add() { |
| 39 | 39 | // echo 'dd'; |
| 40 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 40 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 41 | 41 | $data ['flag'] = 'create'; |
| 42 | - $data ['page_title'] = gettext ( 'Add Opensips' ); |
|
| 43 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields (), '' ); |
|
| 44 | - $this->load->view ( 'view_opensips_add_edit', $data ); |
|
| 42 | + $data ['page_title'] = gettext('Add Opensips'); |
|
| 43 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields(), ''); |
|
| 44 | + $this->load->view('view_opensips_add_edit', $data); |
|
| 45 | 45 | } |
| 46 | 46 | function opensips_edit($edit_id = '') { |
| 47 | - $data ['page_title'] = gettext ( 'Edit Opensips' ); |
|
| 48 | - $this->opensips_db->where ( 'id', $edit_id ); |
|
| 49 | - $account = $this->opensips_db->get ( "subscriber" ); |
|
| 50 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 47 | + $data ['page_title'] = gettext('Edit Opensips'); |
|
| 48 | + $this->opensips_db->where('id', $edit_id); |
|
| 49 | + $account = $this->opensips_db->get("subscriber"); |
|
| 50 | + foreach ($account->result_array() as $key => $value) { |
|
| 51 | 51 | $edit_data = $value; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields ( $edit_id ), $edit_data ); |
|
| 55 | - $this->load->view ( 'view_opensips_add_edit', $data ); |
|
| 54 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($edit_id), $edit_data); |
|
| 55 | + $this->load->view('view_opensips_add_edit', $data); |
|
| 56 | 56 | } |
| 57 | 57 | function customer_opensips_edit($accountid, $edit_id) { |
| 58 | - $data ['page_title'] = gettext ( 'Edit Opensips' ); |
|
| 59 | - $where = array ( |
|
| 58 | + $data ['page_title'] = gettext('Edit Opensips'); |
|
| 59 | + $where = array( |
|
| 60 | 60 | 'id' => $edit_id |
| 61 | 61 | ); |
| 62 | - $this->opensips_db->where ( $where ); |
|
| 63 | - $account = $this->opensips_db->get ( "subscriber" ); |
|
| 64 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 62 | + $this->opensips_db->where($where); |
|
| 63 | + $account = $this->opensips_db->get("subscriber"); |
|
| 64 | + foreach ($account->result_array() as $key => $value) { |
|
| 65 | 65 | $edit_data = $value; |
| 66 | 66 | } |
| 67 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $accountid ), $edit_data ); |
|
| 68 | - $this->load->view ( 'view_opensips_add_edit', $data ); |
|
| 67 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), $edit_data); |
|
| 68 | + $this->load->view('view_opensips_add_edit', $data); |
|
| 69 | 69 | } |
| 70 | 70 | function customer_opensips_add($accountid = '') { |
| 71 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 71 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 72 | 72 | $data ['flag'] = 'create'; |
| 73 | - $data ['page_title'] = gettext ( 'Create Opensips' ); |
|
| 74 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $accountid ), '' ); |
|
| 73 | + $data ['page_title'] = gettext('Create Opensips'); |
|
| 74 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($accountid), ''); |
|
| 75 | 75 | |
| 76 | - $this->load->view ( 'view_opensips_add_edit', $data ); |
|
| 76 | + $this->load->view('view_opensips_add_edit', $data); |
|
| 77 | 77 | } |
| 78 | 78 | function opensips_save() { |
| 79 | - $add_array = $this->input->post (); |
|
| 80 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields ( $add_array ['id'] ), $add_array ); |
|
| 79 | + $add_array = $this->input->post(); |
|
| 80 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields($add_array ['id']), $add_array); |
|
| 81 | 81 | if ($add_array ['id'] != '') { |
| 82 | - $data ['page_title'] = gettext ( 'Edit Opensips' ); |
|
| 83 | - if ($this->form_validation->run () == FALSE) { |
|
| 84 | - $data ['validation_errors'] = validation_errors (); |
|
| 82 | + $data ['page_title'] = gettext('Edit Opensips'); |
|
| 83 | + if ($this->form_validation->run() == FALSE) { |
|
| 84 | + $data ['validation_errors'] = validation_errors(); |
|
| 85 | 85 | echo $data ['validation_errors']; |
| 86 | 86 | exit (); |
| 87 | 87 | } else { |
| 88 | - $auth_flag = $this->validate_device_data ( $add_array ); |
|
| 88 | + $auth_flag = $this->validate_device_data($add_array); |
|
| 89 | 89 | if ($auth_flag == "TRUE") { |
| 90 | - $this->opensips_model->edit_opensipsdevices ( $add_array, $add_array ['id'] ); |
|
| 91 | - echo json_encode ( array ( |
|
| 90 | + $this->opensips_model->edit_opensipsdevices($add_array, $add_array ['id']); |
|
| 91 | + echo json_encode(array( |
|
| 92 | 92 | "SUCCESS" => " OpenSips updated successfully!" |
| 93 | - ) ); |
|
| 93 | + )); |
|
| 94 | 94 | exit (); |
| 95 | 95 | } else { |
| 96 | - echo json_encode ( $auth_flag ); |
|
| 96 | + echo json_encode($auth_flag); |
|
| 97 | 97 | exit (); |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } else { |
| 101 | - $data ['page_title'] = gettext ( 'Add Opensips' ); |
|
| 102 | - if ($this->form_validation->run () == FALSE) { |
|
| 103 | - $data ['validation_errors'] = validation_errors (); |
|
| 101 | + $data ['page_title'] = gettext('Add Opensips'); |
|
| 102 | + if ($this->form_validation->run() == FALSE) { |
|
| 103 | + $data ['validation_errors'] = validation_errors(); |
|
| 104 | 104 | echo $data ['validation_errors']; |
| 105 | 105 | exit (); |
| 106 | 106 | } else { |
| 107 | - $auth_flag = $this->validate_device_data ( $add_array ); |
|
| 107 | + $auth_flag = $this->validate_device_data($add_array); |
|
| 108 | 108 | if ($auth_flag == "TRUE") { |
| 109 | - $this->opensips_model->add_opensipsdevices ( $add_array ); |
|
| 110 | - echo json_encode ( array ( |
|
| 109 | + $this->opensips_model->add_opensipsdevices($add_array); |
|
| 110 | + echo json_encode(array( |
|
| 111 | 111 | "SUCCESS" => "OpenSips added successfully!" |
| 112 | - ) ); |
|
| 112 | + )); |
|
| 113 | 113 | exit (); |
| 114 | 114 | } else { |
| 115 | - echo json_encode ( $auth_flag ); |
|
| 115 | + echo json_encode($auth_flag); |
|
| 116 | 116 | exit (); |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | function validate_device_data($data) { |
| 122 | - if (isset ( $data ["username"] ) && $data ["username"] != "") { |
|
| 122 | + if (isset ($data ["username"]) && $data ["username"] != "") { |
|
| 123 | 123 | $db_config = Common_model::$global_config ['system_config']; |
| 124 | - $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="; |
|
| 125 | - $this->opensips_db = $this->load->database ( $opensipdsn, true ); |
|
| 126 | - $where = array ( |
|
| 124 | + $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="; |
|
| 125 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
| 126 | + $where = array( |
|
| 127 | 127 | "username" => $data ["username"] |
| 128 | 128 | ); |
| 129 | 129 | if ($data ['id'] != "") { |
| 130 | - $this->opensips_db->where ( "id <>", $data ['id'] ); |
|
| 130 | + $this->opensips_db->where("id <>", $data ['id']); |
|
| 131 | 131 | } |
| 132 | - $this->opensips_db->where ( $where ); |
|
| 133 | - $auth_flag = $this->opensips_db->get ( "subscriber" ); |
|
| 134 | - $auth_flag = $auth_flag->num_rows (); |
|
| 132 | + $this->opensips_db->where($where); |
|
| 133 | + $auth_flag = $this->opensips_db->get("subscriber"); |
|
| 134 | + $auth_flag = $auth_flag->num_rows(); |
|
| 135 | 135 | if ($auth_flag == 0) { |
| 136 | 136 | return "TRUE"; |
| 137 | 137 | } else { |
| 138 | - return array ( |
|
| 138 | + return array( |
|
| 139 | 139 | "username_error" => "Duplicate Email Address Found Email Must Be Unique." |
| 140 | 140 | ); |
| 141 | 141 | } |
| 142 | 142 | } else { |
| 143 | - return array ( |
|
| 143 | + return array( |
|
| 144 | 144 | "username_error" => "User name is required field." |
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | return "0"; |
| 148 | 148 | } |
| 149 | 149 | function user_opensips_save($user_flg = false) { |
| 150 | - $array_add = $this->input->post (); |
|
| 150 | + $array_add = $this->input->post(); |
|
| 151 | 151 | // |
| 152 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $array_add ["accountcode"] ), $array_add ); |
|
| 152 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($array_add ["accountcode"]), $array_add); |
|
| 153 | 153 | if ($array_add ['id'] != '') { |
| 154 | - $data ['page_title'] = gettext ( 'Edit Opensips' ); |
|
| 155 | - if ($this->form_validation->run () == FALSE) { |
|
| 156 | - $data ['validation_errors'] = validation_errors (); |
|
| 154 | + $data ['page_title'] = gettext('Edit Opensips'); |
|
| 155 | + if ($this->form_validation->run() == FALSE) { |
|
| 156 | + $data ['validation_errors'] = validation_errors(); |
|
| 157 | 157 | echo $data ['validation_errors']; |
| 158 | 158 | exit (); |
| 159 | 159 | } else { |
| 160 | - $this->opensips_model->edit_opensipsdevices ( $array_add, $array_add ['id'] ); |
|
| 161 | - echo json_encode ( array ( |
|
| 160 | + $this->opensips_model->edit_opensipsdevices($array_add, $array_add ['id']); |
|
| 161 | + echo json_encode(array( |
|
| 162 | 162 | "SUCCESS" => "Opensips Updated Successfully!" |
| 163 | - ) ); |
|
| 163 | + )); |
|
| 164 | 164 | exit (); |
| 165 | 165 | } |
| 166 | 166 | } else { |
| 167 | - $data ['page_title'] = gettext ( 'Add Opensips' ); |
|
| 168 | - if ($this->form_validation->run () == FALSE) { |
|
| 169 | - $data ['validation_errors'] = validation_errors (); |
|
| 167 | + $data ['page_title'] = gettext('Add Opensips'); |
|
| 168 | + if ($this->form_validation->run() == FALSE) { |
|
| 169 | + $data ['validation_errors'] = validation_errors(); |
|
| 170 | 170 | echo $data ['validation_errors']; |
| 171 | 171 | exit (); |
| 172 | 172 | } else { |
| 173 | - $this->opensips_model->add_opensipsdevices ( $array_add ); |
|
| 174 | - echo json_encode ( array ( |
|
| 173 | + $this->opensips_model->add_opensipsdevices($array_add); |
|
| 174 | + echo json_encode(array( |
|
| 175 | 175 | "SUCCESS" => "Opensips Added Successfully!" |
| 176 | - ) ); |
|
| 176 | + )); |
|
| 177 | 177 | exit (); |
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | function customer_opensips_save($user_flg = false) { |
| 182 | - $add_array = $this->input->post (); |
|
| 182 | + $add_array = $this->input->post(); |
|
| 183 | 183 | // print_r($array_add);exit; |
| 184 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_opensips_form_fields_for_customer ( $add_array ["accountcode"] ), $add_array ); |
|
| 184 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_opensips_form_fields_for_customer($add_array ["accountcode"]), $add_array); |
|
| 185 | 185 | if ($add_array ['id'] != '') { |
| 186 | - $data ['page_title'] = gettext ( 'Edit Opensips' ); |
|
| 187 | - if ($this->form_validation->run () == FALSE) { |
|
| 188 | - $data ['validation_errors'] = validation_errors (); |
|
| 186 | + $data ['page_title'] = gettext('Edit Opensips'); |
|
| 187 | + if ($this->form_validation->run() == FALSE) { |
|
| 188 | + $data ['validation_errors'] = validation_errors(); |
|
| 189 | 189 | echo $data ['validation_errors']; |
| 190 | 190 | exit (); |
| 191 | 191 | } else { |
| 192 | - $this->opensips_model->edit_opensipsdevices ( $add_array, $add_array ['id'] ); |
|
| 193 | - echo json_encode ( array ( |
|
| 192 | + $this->opensips_model->edit_opensipsdevices($add_array, $add_array ['id']); |
|
| 193 | + echo json_encode(array( |
|
| 194 | 194 | "SUCCESS" => "OpenSips Updated Successfully!" |
| 195 | - ) ); |
|
| 195 | + )); |
|
| 196 | 196 | exit (); |
| 197 | 197 | } |
| 198 | 198 | } else { |
| 199 | - $data ['page_title'] = gettext ( 'Add Opensips' ); |
|
| 200 | - if ($this->form_validation->run () == FALSE) { |
|
| 201 | - $data ['validation_errors'] = validation_errors (); |
|
| 199 | + $data ['page_title'] = gettext('Add Opensips'); |
|
| 200 | + if ($this->form_validation->run() == FALSE) { |
|
| 201 | + $data ['validation_errors'] = validation_errors(); |
|
| 202 | 202 | echo $data ['validation_errors']; |
| 203 | 203 | exit (); |
| 204 | 204 | } else { |
| 205 | - $this->opensips_model->add_opensipsdevices ( $add_array ); |
|
| 206 | - echo json_encode ( array ( |
|
| 205 | + $this->opensips_model->add_opensipsdevices($add_array); |
|
| 206 | + echo json_encode(array( |
|
| 207 | 207 | "SUCCESS" => "OpenSips Added Successfully!" |
| 208 | - ) ); |
|
| 208 | + )); |
|
| 209 | 209 | exit (); |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | function customer_opensips_json($accountid, $accounttype) { |
| 214 | - $json_data = array (); |
|
| 215 | - $count_all = $this->opensips_model->getopensipsdevice_customer_list ( false, $accountid, $accounttype ); |
|
| 216 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 214 | + $json_data = array(); |
|
| 215 | + $count_all = $this->opensips_model->getopensipsdevice_customer_list(false, $accountid, $accounttype); |
|
| 216 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 217 | 217 | $json_data = $paging_data ["json_paging"]; |
| 218 | 218 | |
| 219 | - $query = $this->opensips_model->getopensipsdevice_customer_list ( true, $accountid, $accounttype, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 220 | - $grid_fields = json_decode ( $this->opensips_form->opensips_customer_build_opensips_list ( $accountid ) ); |
|
| 221 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 219 | + $query = $this->opensips_model->getopensipsdevice_customer_list(true, $accountid, $accounttype, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 220 | + $grid_fields = json_decode($this->opensips_form->opensips_customer_build_opensips_list($accountid)); |
|
| 221 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 222 | 222 | |
| 223 | - echo json_encode ( $json_data ); |
|
| 223 | + echo json_encode($json_data); |
|
| 224 | 224 | } |
| 225 | 225 | function opensips_add_customer($add_data) { |
| 226 | - $this->opensips_model->add_opensipsdevices ( $add_array ); |
|
| 226 | + $this->opensips_model->add_opensipsdevices($add_array); |
|
| 227 | 227 | } |
| 228 | 228 | function opensips_remove($id) { |
| 229 | - $this->opensips_model->remove_opensips ( $id ); |
|
| 230 | - $this->session->set_flashdata ( 'astpp_notification', 'OpenSips Removed Successfully!' ); |
|
| 231 | - redirect ( base_url () . 'opensips/opensips_list/' ); |
|
| 229 | + $this->opensips_model->remove_opensips($id); |
|
| 230 | + $this->session->set_flashdata('astpp_notification', 'OpenSips Removed Successfully!'); |
|
| 231 | + redirect(base_url().'opensips/opensips_list/'); |
|
| 232 | 232 | } |
| 233 | 233 | function opensips_list() { |
| 234 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 235 | - $data ['page_title'] = gettext ( 'Opensips Devices List' ); |
|
| 234 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 235 | + $data ['page_title'] = gettext('Opensips Devices List'); |
|
| 236 | 236 | $data ['search_flag'] = true; |
| 237 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 238 | - $data ['grid_fields'] = $this->opensips_form->build_opensips_list (); |
|
| 239 | - $data ["grid_buttons"] = $this->opensips_form->build_grid_buttons (); |
|
| 240 | - $data ['form_search'] = $this->form->build_serach_form ( $this->opensips_form->get_search_opensips_form () ); |
|
| 241 | - $this->load->view ( 'view_opensips_list', $data ); |
|
| 237 | + $this->session->set_userdata('advance_search', 0); |
|
| 238 | + $data ['grid_fields'] = $this->opensips_form->build_opensips_list(); |
|
| 239 | + $data ["grid_buttons"] = $this->opensips_form->build_grid_buttons(); |
|
| 240 | + $data ['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_opensips_form()); |
|
| 241 | + $this->load->view('view_opensips_list', $data); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -246,105 +246,105 @@ discard block |
||
| 246 | 246 | * Listing of Accounts table data through php function json_encode |
| 247 | 247 | */ |
| 248 | 248 | function opensips_list_json() { |
| 249 | - $json_data = array (); |
|
| 250 | - $count_all = $this->opensips_model->getopensipsdevice_list ( false ); |
|
| 251 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 249 | + $json_data = array(); |
|
| 250 | + $count_all = $this->opensips_model->getopensipsdevice_list(false); |
|
| 251 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 252 | 252 | $json_data = $paging_data ["json_paging"]; |
| 253 | - $query = $this->opensips_model->getopensipsdevice_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 254 | - $grid_fields = json_decode ( $this->opensips_form->build_opensips_list () ); |
|
| 255 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 256 | - $result = $this->opensips_db->get ( "subscriber" ); |
|
| 257 | - if ($result->num_rows () <= 0) { |
|
| 253 | + $query = $this->opensips_model->getopensipsdevice_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 254 | + $grid_fields = json_decode($this->opensips_form->build_opensips_list()); |
|
| 255 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 256 | + $result = $this->opensips_db->get("subscriber"); |
|
| 257 | + if ($result->num_rows() <= 0) { |
|
| 258 | 258 | $json_data ['page'] = 0; |
| 259 | 259 | $json_data ['total'] = 0; |
| 260 | 260 | } |
| 261 | - echo json_encode ( $json_data ); |
|
| 261 | + echo json_encode($json_data); |
|
| 262 | 262 | } |
| 263 | 263 | function opensips_list_search() { |
| 264 | 264 | // alert('hgjgh'); |
| 265 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 265 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 266 | 266 | // alert(); |
| 267 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 268 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 269 | - $action = $this->input->post (); |
|
| 270 | - unset ( $action ['action'] ); |
|
| 271 | - unset ( $action ['advance_search'] ); |
|
| 272 | - $this->session->set_userdata ( 'opensipsdevice_list_search', $action ); |
|
| 267 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 268 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 269 | + $action = $this->input->post(); |
|
| 270 | + unset ($action ['action']); |
|
| 271 | + unset ($action ['advance_search']); |
|
| 272 | + $this->session->set_userdata('opensipsdevice_list_search', $action); |
|
| 273 | 273 | } |
| 274 | 274 | if (@$ajax_search != 1) { |
| 275 | - redirect ( base_url () . 'opensips/opensips_list/' ); |
|
| 275 | + redirect(base_url().'opensips/opensips_list/'); |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | function opensips_list_clearsearchfilter() { |
| 279 | - $this->session->set_userdata ( 'advance_search', '' ); |
|
| 280 | - $this->session->set_userdata ( 'opensipsdevice_list_search', '' ); |
|
| 279 | + $this->session->set_userdata('advance_search', ''); |
|
| 280 | + $this->session->set_userdata('opensipsdevice_list_search', ''); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | // dispather List add edit delete |
| 284 | 284 | function dispatcher_add() { |
| 285 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 285 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 286 | 286 | $data ['flag'] = 'create'; |
| 287 | - $data ['page_title'] = gettext ( 'Dispatcher' ); |
|
| 288 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_dispatcher_form_fields (), '' ); |
|
| 287 | + $data ['page_title'] = gettext('Dispatcher'); |
|
| 288 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), ''); |
|
| 289 | 289 | |
| 290 | - $this->load->view ( 'view_dispatcher_add_edit', $data ); |
|
| 290 | + $this->load->view('view_dispatcher_add_edit', $data); |
|
| 291 | 291 | } |
| 292 | 292 | function dispatcher_edit($edit_id = '') { |
| 293 | - $data ['page_title'] = gettext ( 'Dispatcher' ); |
|
| 294 | - $this->opensips_db->where ( 'id', $edit_id ); |
|
| 295 | - $account = $this->opensips_db->get ( "dispatcher" ); |
|
| 296 | - foreach ( $account->result_array () as $key => $value ) { |
|
| 293 | + $data ['page_title'] = gettext('Dispatcher'); |
|
| 294 | + $this->opensips_db->where('id', $edit_id); |
|
| 295 | + $account = $this->opensips_db->get("dispatcher"); |
|
| 296 | + foreach ($account->result_array() as $key => $value) { |
|
| 297 | 297 | $edit_data = $value; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_dispatcher_form_fields (), $edit_data ); |
|
| 301 | - $this->load->view ( 'view_dispatcher_add_edit', $data ); |
|
| 300 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $edit_data); |
|
| 301 | + $this->load->view('view_dispatcher_add_edit', $data); |
|
| 302 | 302 | } |
| 303 | 303 | function dispatcher_save() { |
| 304 | - $add_array = $this->input->post (); |
|
| 305 | - $data ['form'] = $this->form->build_form ( $this->opensips_form->get_dispatcher_form_fields (), $add_array ); |
|
| 304 | + $add_array = $this->input->post(); |
|
| 305 | + $data ['form'] = $this->form->build_form($this->opensips_form->get_dispatcher_form_fields(), $add_array); |
|
| 306 | 306 | if ($add_array ['id'] != '') { |
| 307 | - $data ['page_title'] = gettext ( 'Edit Dispatcher' ); |
|
| 308 | - if ($this->form_validation->run () == FALSE) { |
|
| 309 | - $data ['validation_errors'] = validation_errors (); |
|
| 307 | + $data ['page_title'] = gettext('Edit Dispatcher'); |
|
| 308 | + if ($this->form_validation->run() == FALSE) { |
|
| 309 | + $data ['validation_errors'] = validation_errors(); |
|
| 310 | 310 | echo $data ['validation_errors']; |
| 311 | 311 | exit (); |
| 312 | 312 | } else { |
| 313 | - $this->opensips_model->edit_opensipsdispatcher ( $add_array, $add_array ['id'] ); |
|
| 314 | - echo json_encode ( array ( |
|
| 313 | + $this->opensips_model->edit_opensipsdispatcher($add_array, $add_array ['id']); |
|
| 314 | + echo json_encode(array( |
|
| 315 | 315 | "SUCCESS" => "Dispatcher Updated Successfully!" |
| 316 | - ) ); |
|
| 316 | + )); |
|
| 317 | 317 | exit (); |
| 318 | 318 | } |
| 319 | 319 | } else { |
| 320 | - $data ['page_title'] = gettext ( 'Add Dispatcher' ); |
|
| 321 | - if ($this->form_validation->run () == FALSE) { |
|
| 322 | - $data ['validation_errors'] = validation_errors (); |
|
| 320 | + $data ['page_title'] = gettext('Add Dispatcher'); |
|
| 321 | + if ($this->form_validation->run() == FALSE) { |
|
| 322 | + $data ['validation_errors'] = validation_errors(); |
|
| 323 | 323 | echo $data ['validation_errors']; |
| 324 | 324 | exit (); |
| 325 | 325 | } else { |
| 326 | - $this->opensips_model->add_opensipsdispatcher ( $add_array ); |
|
| 327 | - echo json_encode ( array ( |
|
| 326 | + $this->opensips_model->add_opensipsdispatcher($add_array); |
|
| 327 | + echo json_encode(array( |
|
| 328 | 328 | "SUCCESS" => "Dispatcher Added Successfully!" |
| 329 | - ) ); |
|
| 329 | + )); |
|
| 330 | 330 | exit (); |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | function dispatcher_remove($id) { |
| 335 | - $this->opensips_model->remove_dispatcher ( $id ); |
|
| 336 | - $this->session->set_flashdata ( 'astpp_notification', 'Dispatcher Removed Successfully!' ); |
|
| 337 | - redirect ( base_url () . 'opensips/dispatcher_list/' ); |
|
| 335 | + $this->opensips_model->remove_dispatcher($id); |
|
| 336 | + $this->session->set_flashdata('astpp_notification', 'Dispatcher Removed Successfully!'); |
|
| 337 | + redirect(base_url().'opensips/dispatcher_list/'); |
|
| 338 | 338 | } |
| 339 | 339 | function dispatcher_list() { |
| 340 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
| 341 | - $data ['page_title'] = gettext ( 'Opensips Dispatcher List' ); |
|
| 340 | + $data ['username'] = $this->session->userdata('user_name'); |
|
| 341 | + $data ['page_title'] = gettext('Opensips Dispatcher List'); |
|
| 342 | 342 | $data ['search_flag'] = true; |
| 343 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 344 | - $data ['grid_fields'] = $this->opensips_form->build_opensipsdispatcher_list (); |
|
| 345 | - $data ["grid_buttons"] = $this->opensips_form->build_grid_dispatcherbuttons (); |
|
| 346 | - $data ['form_search'] = $this->form->build_serach_form ( $this->opensips_form->get_search_dispatcher_form () ); |
|
| 347 | - $this->load->view ( 'view_dispatcher_list', $data ); |
|
| 343 | + $this->session->set_userdata('advance_search', 0); |
|
| 344 | + $data ['grid_fields'] = $this->opensips_form->build_opensipsdispatcher_list(); |
|
| 345 | + $data ["grid_buttons"] = $this->opensips_form->build_grid_dispatcherbuttons(); |
|
| 346 | + $data ['form_search'] = $this->form->build_serach_form($this->opensips_form->get_search_dispatcher_form()); |
|
| 347 | + $this->load->view('view_dispatcher_list', $data); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | * Listing of Accounts table data through php function json_encode |
| 353 | 353 | */ |
| 354 | 354 | function dispatcher_list_json() { |
| 355 | - $json_data = array (); |
|
| 356 | - $count_all = $this->opensips_model->getopensipsdispatcher_list ( false ); |
|
| 357 | - $paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] ); |
|
| 355 | + $json_data = array(); |
|
| 356 | + $count_all = $this->opensips_model->getopensipsdispatcher_list(false); |
|
| 357 | + $paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']); |
|
| 358 | 358 | $json_data = $paging_data ["json_paging"]; |
| 359 | 359 | |
| 360 | - $query = $this->opensips_model->getopensipsdispatcher_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] ); |
|
| 361 | - $grid_fields = json_decode ( $this->opensips_form->build_opensipsdispatcher_list () ); |
|
| 362 | - $json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields ); |
|
| 360 | + $query = $this->opensips_model->getopensipsdispatcher_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]); |
|
| 361 | + $grid_fields = json_decode($this->opensips_form->build_opensipsdispatcher_list()); |
|
| 362 | + $json_data ['rows'] = $this->form->build_grid($query, $grid_fields); |
|
| 363 | 363 | /* |
| 364 | 364 | * $result = $this->opensips_db->get("subscriber"); |
| 365 | 365 | * if($result->num_rows() <= 0){ |
@@ -367,23 +367,23 @@ discard block |
||
| 367 | 367 | * $json_data['total'] = 0; |
| 368 | 368 | * } |
| 369 | 369 | */ |
| 370 | - echo json_encode ( $json_data ); |
|
| 370 | + echo json_encode($json_data); |
|
| 371 | 371 | } |
| 372 | 372 | function dispatcher_list_search() { |
| 373 | - $ajax_search = $this->input->post ( 'ajax_search', 0 ); |
|
| 374 | - if ($this->input->post ( 'advance_search', TRUE ) == 1) { |
|
| 375 | - $this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) ); |
|
| 376 | - unset ( $_POST ['action'] ); |
|
| 377 | - unset ( $_POST ['advance_search'] ); |
|
| 378 | - $this->session->set_userdata ( 'opensipsdispatcher_list_search', $this->input->post () ); |
|
| 373 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
| 374 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
| 375 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
| 376 | + unset ($_POST ['action']); |
|
| 377 | + unset ($_POST ['advance_search']); |
|
| 378 | + $this->session->set_userdata('opensipsdispatcher_list_search', $this->input->post()); |
|
| 379 | 379 | } |
| 380 | 380 | if (@$ajax_search != 1) { |
| 381 | - redirect ( base_url () . 'opensips/dispatcher_list/' ); |
|
| 381 | + redirect(base_url().'opensips/dispatcher_list/'); |
|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | function dispatcher_list_clearsearchfilter() { |
| 385 | - $this->session->set_userdata ( 'advance_search', 0 ); |
|
| 386 | - $this->session->set_userdata ( 'opensipsdispatcher_list_search', "" ); |
|
| 385 | + $this->session->set_userdata('advance_search', 0); |
|
| 386 | + $this->session->set_userdata('opensipsdispatcher_list_search', ""); |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -20,33 +20,33 @@ 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' )) |
|
| 24 | - exit ( 'No direct script access allowed' ); |
|
| 23 | +if ( ! defined('BASEPATH')) |
|
| 24 | + exit ('No direct script access allowed'); |
|
| 25 | 25 | class Opensips_form { |
| 26 | 26 | function __construct() { |
| 27 | - $this->CI = & get_instance (); |
|
| 27 | + $this->CI = & get_instance(); |
|
| 28 | 28 | } |
| 29 | 29 | function get_opensips_form_fields($id = false) { |
| 30 | - $accountinfo = $this->CI->session->userdata ( "accountinfo" ); |
|
| 30 | + $accountinfo = $this->CI->session->userdata("accountinfo"); |
|
| 31 | 31 | |
| 32 | - $uname_user = $this->CI->common->find_uniq_rendno ( '10', '', '' ); |
|
| 33 | - $password = $this->CI->common->generate_password (); |
|
| 34 | - $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username'; |
|
| 32 | + $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
|
| 33 | + $password = $this->CI->common->generate_password(); |
|
| 34 | + $val = $id > 0 ? 'subscriber.username.'.$id : 'subscriber.username'; |
|
| 35 | 35 | |
| 36 | 36 | // echo '<pre>'; print_r($val); exit; |
| 37 | - $loginid = $this->CI->session->userdata ( 'logintype' ) == 2 ? 0 : $accountinfo ['id']; |
|
| 38 | - $form ['forms'] = array ( |
|
| 39 | - base_url () . 'opensips/opensips_save/', |
|
| 40 | - array ( |
|
| 37 | + $loginid = $this->CI->session->userdata('logintype') == 2 ? 0 : $accountinfo ['id']; |
|
| 38 | + $form ['forms'] = array( |
|
| 39 | + base_url().'opensips/opensips_save/', |
|
| 40 | + array( |
|
| 41 | 41 | "id" => "opensips_form", |
| 42 | 42 | "name" => "opensips_form" |
| 43 | 43 | ) |
| 44 | 44 | ); |
| 45 | - $form ['Opensips Device'] = array ( |
|
| 46 | - array ( |
|
| 45 | + $form ['Opensips Device'] = array( |
|
| 46 | + array( |
|
| 47 | 47 | '', |
| 48 | 48 | 'HIDDEN', |
| 49 | - array ( |
|
| 49 | + array( |
|
| 50 | 50 | 'name' => 'id' |
| 51 | 51 | ), |
| 52 | 52 | '', |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | '', |
| 55 | 55 | '' |
| 56 | 56 | ), |
| 57 | - array ( |
|
| 58 | - gettext ( 'Username' ), |
|
| 57 | + array( |
|
| 58 | + gettext('Username'), |
|
| 59 | 59 | 'INPUT', |
| 60 | - array ( |
|
| 60 | + array( |
|
| 61 | 61 | 'name' => 'username', |
| 62 | 62 | 'size' => '30', |
| 63 | 63 | 'value' => $uname_user, |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | 'Please Enter account number', |
| 70 | 70 | '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>' |
| 71 | 71 | ), |
| 72 | - array ( |
|
| 73 | - gettext ( 'Password' ), |
|
| 72 | + array( |
|
| 73 | + gettext('Password'), |
|
| 74 | 74 | 'INPUT', |
| 75 | - array ( |
|
| 75 | + array( |
|
| 76 | 76 | 'name' => 'password', |
| 77 | 77 | 'size' => '30', |
| 78 | 78 | 'value' => $password, |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | 'Please Enter Password', |
| 85 | 85 | '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>' |
| 86 | 86 | ), |
| 87 | - array ( |
|
| 88 | - gettext ( 'Account' ), |
|
| 87 | + array( |
|
| 88 | + gettext('Account'), |
|
| 89 | 89 | 'accountcode', |
| 90 | 90 | 'SELECT', |
| 91 | 91 | '', |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | 'accounts', |
| 98 | 98 | 'build_dropdown', |
| 99 | 99 | 'where_arr', |
| 100 | - array ( |
|
| 100 | + array( |
|
| 101 | 101 | "reseller_id" => $loginid, |
| 102 | 102 | "type" => "GLOBAL", |
| 103 | 103 | "deleted" => "0" |
| 104 | 104 | ) |
| 105 | 105 | ), |
| 106 | - array ( |
|
| 107 | - gettext ( 'Domain' ), |
|
| 106 | + array( |
|
| 107 | + gettext('Domain'), |
|
| 108 | 108 | 'INPUT', |
| 109 | - array ( |
|
| 109 | + array( |
|
| 110 | 110 | 'name' => 'domain', |
| 111 | 111 | 'size' => '20', |
| 112 | 112 | 'class' => "text field medium" |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | 'tOOL TIP', |
| 116 | 116 | '' |
| 117 | 117 | ), |
| 118 | - array ( |
|
| 119 | - gettext ( 'Caller Name' ), |
|
| 118 | + array( |
|
| 119 | + gettext('Caller Name'), |
|
| 120 | 120 | 'INPUT', |
| 121 | - array ( |
|
| 121 | + array( |
|
| 122 | 122 | 'name' => 'effective_caller_id_name', |
| 123 | 123 | 'size' => '20', |
| 124 | 124 | 'class' => "text field medium" |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | 'tOOL TIP', |
| 128 | 128 | 'Please Enter account number' |
| 129 | 129 | ), |
| 130 | - array ( |
|
| 131 | - gettext ( 'Caller Number' ), |
|
| 130 | + array( |
|
| 131 | + gettext('Caller Number'), |
|
| 132 | 132 | 'INPUT', |
| 133 | - array ( |
|
| 133 | + array( |
|
| 134 | 134 | 'name' => 'effective_caller_id_number', |
| 135 | 135 | 'size' => '20', |
| 136 | 136 | 'class' => "text field medium" |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | 'tOOL TIP', |
| 140 | 140 | 'Please Enter account number' |
| 141 | 141 | ), |
| 142 | - array ( |
|
| 143 | - gettext ( 'Status' ), |
|
| 142 | + array( |
|
| 143 | + gettext('Status'), |
|
| 144 | 144 | 'status', |
| 145 | 145 | 'SELECT', |
| 146 | 146 | '', |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | 'set_status' |
| 154 | 154 | ) |
| 155 | 155 | ); |
| 156 | - $form ['button_save'] = array ( |
|
| 156 | + $form ['button_save'] = array( |
|
| 157 | 157 | 'name' => 'action', |
| 158 | - 'content' => gettext ( 'Save' ), |
|
| 158 | + 'content' => gettext('Save'), |
|
| 159 | 159 | 'value' => 'save', |
| 160 | 160 | 'type' => 'button', |
| 161 | 161 | 'id' => 'submit', |
| 162 | 162 | 'class' => 'btn btn-line-parrot' |
| 163 | 163 | ); |
| 164 | - $form ['button_cancel'] = array ( |
|
| 164 | + $form ['button_cancel'] = array( |
|
| 165 | 165 | 'name' => 'action', |
| 166 | - 'content' => gettext ( 'Close' ), |
|
| 166 | + 'content' => gettext('Close'), |
|
| 167 | 167 | 'value' => 'cancel', |
| 168 | 168 | 'type' => 'button', |
| 169 | 169 | 'class' => 'btn btn-line-sky margin-x-10', |
@@ -173,18 +173,18 @@ discard block |
||
| 173 | 173 | return $form; |
| 174 | 174 | } |
| 175 | 175 | function get_dispatcher_form_fields() { |
| 176 | - $form ['forms'] = array ( |
|
| 177 | - base_url () . 'opensips/dispatcher_save/', |
|
| 178 | - array ( |
|
| 176 | + $form ['forms'] = array( |
|
| 177 | + base_url().'opensips/dispatcher_save/', |
|
| 178 | + array( |
|
| 179 | 179 | "id" => "opensips_dispatcher_form", |
| 180 | 180 | "name" => "opensips_dispatcher_form" |
| 181 | 181 | ) |
| 182 | 182 | ); |
| 183 | - $form ['Dispatcher Information'] = array ( |
|
| 184 | - array ( |
|
| 183 | + $form ['Dispatcher Information'] = array( |
|
| 184 | + array( |
|
| 185 | 185 | '', |
| 186 | 186 | 'HIDDEN', |
| 187 | - array ( |
|
| 187 | + array( |
|
| 188 | 188 | 'name' => 'id' |
| 189 | 189 | ), |
| 190 | 190 | '', |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | '', |
| 193 | 193 | '' |
| 194 | 194 | ), |
| 195 | - array ( |
|
| 196 | - gettext ( 'Setid' ), |
|
| 195 | + array( |
|
| 196 | + gettext('Setid'), |
|
| 197 | 197 | 'INPUT', |
| 198 | - array ( |
|
| 198 | + array( |
|
| 199 | 199 | 'name' => 'setid', |
| 200 | 200 | 'size' => '20', |
| 201 | 201 | 'class' => "text field medium" |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | 'tOOL TIP', |
| 205 | 205 | '' |
| 206 | 206 | ), |
| 207 | - array ( |
|
| 208 | - gettext ( 'Destination' ), |
|
| 207 | + array( |
|
| 208 | + gettext('Destination'), |
|
| 209 | 209 | 'INPUT', |
| 210 | - array ( |
|
| 210 | + array( |
|
| 211 | 211 | 'name' => 'destination', |
| 212 | 212 | 'size' => '20', |
| 213 | 213 | 'class' => "text field medium" |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | 'tOOL TIP', |
| 217 | 217 | '' |
| 218 | 218 | ), |
| 219 | - array ( |
|
| 220 | - gettext ( 'Weight' ), |
|
| 219 | + array( |
|
| 220 | + gettext('Weight'), |
|
| 221 | 221 | 'INPUT', |
| 222 | - array ( |
|
| 222 | + array( |
|
| 223 | 223 | 'name' => 'weight', |
| 224 | 224 | 'size' => '20', |
| 225 | 225 | 'class' => "text field medium" |
@@ -228,10 +228,10 @@ discard block |
||
| 228 | 228 | 'tOOL TIP', |
| 229 | 229 | '' |
| 230 | 230 | ), |
| 231 | - array ( |
|
| 232 | - gettext ( 'Attrs' ), |
|
| 231 | + array( |
|
| 232 | + gettext('Attrs'), |
|
| 233 | 233 | 'INPUT', |
| 234 | - array ( |
|
| 234 | + array( |
|
| 235 | 235 | 'name' => 'attrs', |
| 236 | 236 | 'size' => '20', |
| 237 | 237 | 'class' => "text field medium" |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | 'tOOL TIP', |
| 241 | 241 | '' |
| 242 | 242 | ), |
| 243 | - array ( |
|
| 244 | - gettext ( 'Description' ), |
|
| 243 | + array( |
|
| 244 | + gettext('Description'), |
|
| 245 | 245 | 'INPUT', |
| 246 | - array ( |
|
| 246 | + array( |
|
| 247 | 247 | 'name' => 'description', |
| 248 | 248 | 'size' => '100', |
| 249 | 249 | 'class' => "text field medium" |
@@ -253,17 +253,17 @@ discard block |
||
| 253 | 253 | '' |
| 254 | 254 | ) |
| 255 | 255 | ); |
| 256 | - $form ['button_save'] = array ( |
|
| 256 | + $form ['button_save'] = array( |
|
| 257 | 257 | 'name' => 'action', |
| 258 | - 'content' => gettext ( 'Save' ), |
|
| 258 | + 'content' => gettext('Save'), |
|
| 259 | 259 | 'value' => 'save', |
| 260 | 260 | 'type' => 'button', |
| 261 | 261 | 'id' => 'submit', |
| 262 | 262 | 'class' => 'btn btn-line-parrot' |
| 263 | 263 | ); |
| 264 | - $form ['button_cancel'] = array ( |
|
| 264 | + $form ['button_cancel'] = array( |
|
| 265 | 265 | 'name' => 'action', |
| 266 | - 'content' => gettext ( 'Close' ), |
|
| 266 | + 'content' => gettext('Close'), |
|
| 267 | 267 | 'value' => 'cancel', |
| 268 | 268 | 'type' => 'button', |
| 269 | 269 | 'class' => 'btn btn-line-sky margin-x-10', |
@@ -272,17 +272,17 @@ discard block |
||
| 272 | 272 | return $form; |
| 273 | 273 | } |
| 274 | 274 | function get_search_dispatcher_form() { |
| 275 | - $form ['forms'] = array ( |
|
| 275 | + $form ['forms'] = array( |
|
| 276 | 276 | "", |
| 277 | - array ( |
|
| 277 | + array( |
|
| 278 | 278 | 'id' => "dispatcher_search" |
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | - $form ['Search'] = array ( |
|
| 282 | - array ( |
|
| 283 | - gettext ( 'Description' ), |
|
| 281 | + $form ['Search'] = array( |
|
| 282 | + array( |
|
| 283 | + gettext('Description'), |
|
| 284 | 284 | 'INPUT', |
| 285 | - array ( |
|
| 285 | + array( |
|
| 286 | 286 | 'name' => 'description[description]', |
| 287 | 287 | '', |
| 288 | 288 | 'size' => '20', |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | 'search_string_type', |
| 299 | 299 | '' |
| 300 | 300 | ), |
| 301 | - array ( |
|
| 301 | + array( |
|
| 302 | 302 | '', |
| 303 | 303 | 'HIDDEN', |
| 304 | 304 | 'ajax_search', |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | '', |
| 308 | 308 | '' |
| 309 | 309 | ), |
| 310 | - array ( |
|
| 310 | + array( |
|
| 311 | 311 | '', |
| 312 | 312 | 'HIDDEN', |
| 313 | 313 | 'advance_search', |
@@ -318,19 +318,19 @@ discard block |
||
| 318 | 318 | ) |
| 319 | 319 | ); |
| 320 | 320 | |
| 321 | - $form ['button_search'] = array ( |
|
| 321 | + $form ['button_search'] = array( |
|
| 322 | 322 | 'name' => 'action', |
| 323 | 323 | 'id' => "opensipsdispatcher_search_btn", |
| 324 | - 'content' => gettext ( 'Search' ), |
|
| 324 | + 'content' => gettext('Search'), |
|
| 325 | 325 | 'value' => 'save', |
| 326 | 326 | 'type' => 'button', |
| 327 | 327 | 'class' => 'btn btn-line-parrot pull-right' |
| 328 | 328 | ); |
| 329 | - $form ['button_reset'] = array ( |
|
| 329 | + $form ['button_reset'] = array( |
|
| 330 | 330 | 'name' => 'action', |
| 331 | 331 | 'id' => "id_reset", |
| 332 | 332 | 'content' => 'Clear', |
| 333 | - 'value' => gettext ( 'cancel' ), |
|
| 333 | + 'value' => gettext('cancel'), |
|
| 334 | 334 | 'type' => 'reset', |
| 335 | 335 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
| 336 | 336 | ); |
@@ -338,17 +338,17 @@ discard block |
||
| 338 | 338 | return $form; |
| 339 | 339 | } |
| 340 | 340 | function get_search_opensips_form() { |
| 341 | - $form ['forms'] = array ( |
|
| 341 | + $form ['forms'] = array( |
|
| 342 | 342 | "", |
| 343 | - array ( |
|
| 343 | + array( |
|
| 344 | 344 | 'id' => "opensips_list_search" |
| 345 | 345 | ) |
| 346 | 346 | ); |
| 347 | - $form ['Search'] = array ( |
|
| 348 | - array ( |
|
| 349 | - gettext ( 'Username' ), |
|
| 347 | + $form ['Search'] = array( |
|
| 348 | + array( |
|
| 349 | + gettext('Username'), |
|
| 350 | 350 | 'INPUT', |
| 351 | - array ( |
|
| 351 | + array( |
|
| 352 | 352 | 'name' => 'username[username]', |
| 353 | 353 | '', |
| 354 | 354 | 'size' => '20', |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | 'search_string_type', |
| 365 | 365 | '' |
| 366 | 366 | ), |
| 367 | - array ( |
|
| 367 | + array( |
|
| 368 | 368 | '', |
| 369 | 369 | 'HIDDEN', |
| 370 | 370 | 'ajax_search', |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | '', |
| 374 | 374 | '' |
| 375 | 375 | ), |
| 376 | - array ( |
|
| 376 | + array( |
|
| 377 | 377 | '', |
| 378 | 378 | 'HIDDEN', |
| 379 | 379 | 'advance_search', |
@@ -384,19 +384,19 @@ discard block |
||
| 384 | 384 | ) |
| 385 | 385 | ); |
| 386 | 386 | |
| 387 | - $form ['button_search'] = array ( |
|
| 387 | + $form ['button_search'] = array( |
|
| 388 | 388 | 'name' => 'action', |
| 389 | 389 | 'id' => "opensipsdevice_search_btn", |
| 390 | - 'content' => gettext ( 'Search' ), |
|
| 390 | + 'content' => gettext('Search'), |
|
| 391 | 391 | 'value' => 'save', |
| 392 | 392 | 'type' => 'button', |
| 393 | 393 | 'class' => 'btn btn-line-parrot pull-right' |
| 394 | 394 | ); |
| 395 | - $form ['button_reset'] = array ( |
|
| 395 | + $form ['button_reset'] = array( |
|
| 396 | 396 | 'name' => 'action', |
| 397 | 397 | 'id' => "id_reset", |
| 398 | 398 | 'content' => 'Clear', |
| 399 | - 'value' => gettext ( 'cancel' ), |
|
| 399 | + 'value' => gettext('cancel'), |
|
| 400 | 400 | 'type' => 'reset', |
| 401 | 401 | 'class' => 'btn btn-line-sky pull-right margin-x-10' |
| 402 | 402 | ); |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | function build_opensips_list() { |
| 407 | 407 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 408 | - $grid_field_arr = json_encode ( array ( |
|
| 409 | - array ( |
|
| 410 | - gettext ( "Username" ), |
|
| 408 | + $grid_field_arr = json_encode(array( |
|
| 409 | + array( |
|
| 410 | + gettext("Username"), |
|
| 411 | 411 | "150", |
| 412 | 412 | "username", |
| 413 | 413 | "", |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | "true", |
| 418 | 418 | "center" |
| 419 | 419 | ), |
| 420 | - array ( |
|
| 421 | - gettext ( "Password" ), |
|
| 420 | + array( |
|
| 421 | + gettext("Password"), |
|
| 422 | 422 | "150", |
| 423 | 423 | "password", |
| 424 | 424 | "", |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | "true", |
| 429 | 429 | "center" |
| 430 | 430 | ), |
| 431 | - array ( |
|
| 432 | - gettext ( "Account" ), |
|
| 431 | + array( |
|
| 432 | + gettext("Account"), |
|
| 433 | 433 | "150", |
| 434 | 434 | "accountcode", |
| 435 | 435 | "", |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | "true", |
| 440 | 440 | "center" |
| 441 | 441 | ), |
| 442 | - array ( |
|
| 443 | - gettext ( "Domain" ), |
|
| 442 | + array( |
|
| 443 | + gettext("Domain"), |
|
| 444 | 444 | "317", |
| 445 | 445 | "domain", |
| 446 | 446 | "", |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | "true", |
| 451 | 451 | "center" |
| 452 | 452 | ), |
| 453 | - array ( |
|
| 454 | - gettext ( "Caller Name" ), |
|
| 453 | + array( |
|
| 454 | + gettext("Caller Name"), |
|
| 455 | 455 | "200", |
| 456 | 456 | "effective_caller_id_name", |
| 457 | 457 | "", |
@@ -461,8 +461,8 @@ discard block |
||
| 461 | 461 | "true", |
| 462 | 462 | "center" |
| 463 | 463 | ), |
| 464 | - array ( |
|
| 465 | - gettext ( "Caller Number" ), |
|
| 464 | + array( |
|
| 465 | + gettext("Caller Number"), |
|
| 466 | 466 | "200", |
| 467 | 467 | "effective_caller_id_number", |
| 468 | 468 | "", |
@@ -472,31 +472,31 @@ discard block |
||
| 472 | 472 | "true", |
| 473 | 473 | "center" |
| 474 | 474 | ), |
| 475 | - array ( |
|
| 476 | - gettext ( "Action" ), |
|
| 475 | + array( |
|
| 476 | + gettext("Action"), |
|
| 477 | 477 | "100", |
| 478 | 478 | "", |
| 479 | 479 | "", |
| 480 | 480 | "", |
| 481 | - array ( |
|
| 482 | - "EDIT" => array ( |
|
| 481 | + array( |
|
| 482 | + "EDIT" => array( |
|
| 483 | 483 | "url" => "/opensips/opensips_edit/", |
| 484 | 484 | "mode" => "popup" |
| 485 | 485 | ), |
| 486 | - "DELETE" => array ( |
|
| 486 | + "DELETE" => array( |
|
| 487 | 487 | "url" => "/opensips/opensips_remove/", |
| 488 | 488 | "mode" => "single" |
| 489 | 489 | ) |
| 490 | 490 | ) |
| 491 | 491 | ) |
| 492 | - ) ); |
|
| 492 | + )); |
|
| 493 | 493 | return $grid_field_arr; |
| 494 | 494 | } |
| 495 | 495 | function build_opensipsdispatcher_list() { |
| 496 | 496 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 497 | - $grid_field_arr = json_encode ( array ( |
|
| 498 | - array ( |
|
| 499 | - gettext ( "Set Id" ), |
|
| 497 | + $grid_field_arr = json_encode(array( |
|
| 498 | + array( |
|
| 499 | + gettext("Set Id"), |
|
| 500 | 500 | "160", |
| 501 | 501 | "setid", |
| 502 | 502 | "", |
@@ -506,8 +506,8 @@ discard block |
||
| 506 | 506 | "true", |
| 507 | 507 | "center" |
| 508 | 508 | ), |
| 509 | - array ( |
|
| 510 | - gettext ( "Destination" ), |
|
| 509 | + array( |
|
| 510 | + gettext("Destination"), |
|
| 511 | 511 | "160", |
| 512 | 512 | "destination", |
| 513 | 513 | "", |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | "true", |
| 518 | 518 | "center" |
| 519 | 519 | ), |
| 520 | - array ( |
|
| 521 | - gettext ( "Weight" ), |
|
| 520 | + array( |
|
| 521 | + gettext("Weight"), |
|
| 522 | 522 | "190", |
| 523 | 523 | "weight", |
| 524 | 524 | "", |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | "true", |
| 529 | 529 | "center" |
| 530 | 530 | ), |
| 531 | - array ( |
|
| 532 | - gettext ( "Attrs" ), |
|
| 531 | + array( |
|
| 532 | + gettext("Attrs"), |
|
| 533 | 533 | "180", |
| 534 | 534 | "attrs", |
| 535 | 535 | "", |
@@ -539,8 +539,8 @@ discard block |
||
| 539 | 539 | "true", |
| 540 | 540 | "center" |
| 541 | 541 | ), |
| 542 | - array ( |
|
| 543 | - gettext ( "Description" ), |
|
| 542 | + array( |
|
| 543 | + gettext("Description"), |
|
| 544 | 544 | "190", |
| 545 | 545 | "description", |
| 546 | 546 | "", |
@@ -550,29 +550,29 @@ discard block |
||
| 550 | 550 | "true", |
| 551 | 551 | "center" |
| 552 | 552 | ), |
| 553 | - array ( |
|
| 554 | - gettext ( "Action" ), |
|
| 553 | + array( |
|
| 554 | + gettext("Action"), |
|
| 555 | 555 | "170", |
| 556 | 556 | "", |
| 557 | 557 | "", |
| 558 | 558 | "", |
| 559 | - array ( |
|
| 560 | - "EDIT" => array ( |
|
| 559 | + array( |
|
| 560 | + "EDIT" => array( |
|
| 561 | 561 | "url" => "/opensips/dispatcher_edit/", |
| 562 | 562 | "mode" => "popup" |
| 563 | 563 | ), |
| 564 | - "DELETE" => array ( |
|
| 564 | + "DELETE" => array( |
|
| 565 | 565 | "url" => "/opensips/dispatcher_remove/", |
| 566 | 566 | "mode" => "single" |
| 567 | 567 | ) |
| 568 | 568 | ) |
| 569 | 569 | ) |
| 570 | - ) ); |
|
| 570 | + )); |
|
| 571 | 571 | return $grid_field_arr; |
| 572 | 572 | } |
| 573 | 573 | function build_grid_buttons() { |
| 574 | - $buttons_json = json_encode ( array ( |
|
| 575 | - array ( |
|
| 574 | + $buttons_json = json_encode(array( |
|
| 575 | + array( |
|
| 576 | 576 | "Create", |
| 577 | 577 | "btn btn-line-warning btn", |
| 578 | 578 | "fa fa-plus-circle fa-lg", |
@@ -586,8 +586,8 @@ discard block |
||
| 586 | 586 | return $buttons_json; |
| 587 | 587 | } |
| 588 | 588 | function build_grid_dispatcherbuttons() { |
| 589 | - $buttons_json = json_encode ( array ( |
|
| 590 | - array ( |
|
| 589 | + $buttons_json = json_encode(array( |
|
| 590 | + array( |
|
| 591 | 591 | "Create", |
| 592 | 592 | "btn btn-line-warning btn", |
| 593 | 593 | "fa fa-plus-circle fa-lg", |
@@ -601,23 +601,23 @@ discard block |
||
| 601 | 601 | return $buttons_json; |
| 602 | 602 | } |
| 603 | 603 | function get_opensips_form_fields_for_customer($accountid, $id = false) { |
| 604 | - $val = $id > 0 ? 'subscriber.username.' . $id : 'subscriber.username'; |
|
| 605 | - $uname_user = $this->CI->common->find_uniq_rendno ( '10', '', '' ); |
|
| 606 | - $password = $this->CI->common->generate_password (); |
|
| 607 | - $accountinfo = $this->CI->session->userdata ( 'accountinfo' ); |
|
| 608 | - $link = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 3) ? base_url () . 'opensips/user_opensips_save/true/' : base_url () . 'opensips/customer_opensips_save/true/'; |
|
| 609 | - $form ['forms'] = array ( |
|
| 604 | + $val = $id > 0 ? 'subscriber.username.'.$id : 'subscriber.username'; |
|
| 605 | + $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
|
| 606 | + $password = $this->CI->common->generate_password(); |
|
| 607 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
| 608 | + $link = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 3) ? base_url ().'opensips/user_opensips_save/true/' : base_url().'opensips/customer_opensips_save/true/'; |
|
| 609 | + $form ['forms'] = array( |
|
| 610 | 610 | $link, |
| 611 | - array ( |
|
| 611 | + array( |
|
| 612 | 612 | "id" => "opensips_form", |
| 613 | 613 | "name" => "opensips_form" |
| 614 | 614 | ) |
| 615 | 615 | ); |
| 616 | - $form ['Opensips Device'] = array ( |
|
| 617 | - array ( |
|
| 616 | + $form ['Opensips Device'] = array( |
|
| 617 | + array( |
|
| 618 | 618 | '', |
| 619 | 619 | 'HIDDEN', |
| 620 | - array ( |
|
| 620 | + array( |
|
| 621 | 621 | 'name' => 'id' |
| 622 | 622 | ), |
| 623 | 623 | '', |
@@ -625,24 +625,24 @@ discard block |
||
| 625 | 625 | '', |
| 626 | 626 | '' |
| 627 | 627 | ), |
| 628 | - array ( |
|
| 628 | + array( |
|
| 629 | 629 | '', |
| 630 | 630 | 'HIDDEN', |
| 631 | - array ( |
|
| 631 | + array( |
|
| 632 | 632 | 'name' => 'accountcode', |
| 633 | - 'value' => $this->CI->common->get_field_name ( 'number', 'accounts', array ( |
|
| 633 | + 'value' => $this->CI->common->get_field_name('number', 'accounts', array( |
|
| 634 | 634 | 'id' => $accountid |
| 635 | - ) ) |
|
| 635 | + )) |
|
| 636 | 636 | ), |
| 637 | 637 | '', |
| 638 | 638 | '', |
| 639 | 639 | '', |
| 640 | 640 | '' |
| 641 | 641 | ), |
| 642 | - array ( |
|
| 643 | - gettext ( 'Username' ), |
|
| 642 | + array( |
|
| 643 | + gettext('Username'), |
|
| 644 | 644 | 'INPUT', |
| 645 | - array ( |
|
| 645 | + array( |
|
| 646 | 646 | 'name' => 'username', |
| 647 | 647 | 'size' => '20', |
| 648 | 648 | 'id' => 'username', |
@@ -654,10 +654,10 @@ discard block |
||
| 654 | 654 | 'Please Enter account number', |
| 655 | 655 | '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_number fa fa-refresh"></i>' |
| 656 | 656 | ), |
| 657 | - array ( |
|
| 658 | - gettext ( 'Password' ), |
|
| 657 | + array( |
|
| 658 | + gettext('Password'), |
|
| 659 | 659 | 'PASSWORD', |
| 660 | - array ( |
|
| 660 | + array( |
|
| 661 | 661 | 'name' => 'password', |
| 662 | 662 | 'size' => '20', |
| 663 | 663 | 'id' => 'password1', |
@@ -669,10 +669,10 @@ discard block |
||
| 669 | 669 | 'Please Enter Password', |
| 670 | 670 | '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;" title="Reset Password" class="change_pass fa fa-refresh"></i>' |
| 671 | 671 | ), |
| 672 | - array ( |
|
| 673 | - gettext ( 'Domain' ), |
|
| 672 | + array( |
|
| 673 | + gettext('Domain'), |
|
| 674 | 674 | 'INPUT', |
| 675 | - array ( |
|
| 675 | + array( |
|
| 676 | 676 | 'name' => 'domain', |
| 677 | 677 | 'size' => '20', |
| 678 | 678 | 'class' => "text field medium" |
@@ -681,10 +681,10 @@ discard block |
||
| 681 | 681 | 'tOOL TIP', |
| 682 | 682 | 'Please Enter account number' |
| 683 | 683 | ), |
| 684 | - array ( |
|
| 685 | - gettext ( 'Caller Name' ), |
|
| 684 | + array( |
|
| 685 | + gettext('Caller Name'), |
|
| 686 | 686 | 'INPUT', |
| 687 | - array ( |
|
| 687 | + array( |
|
| 688 | 688 | 'name' => 'effective_caller_id_name', |
| 689 | 689 | 'size' => '20', |
| 690 | 690 | 'class' => "text field medium" |
@@ -693,10 +693,10 @@ discard block |
||
| 693 | 693 | 'tOOL TIP', |
| 694 | 694 | 'Please Enter account number' |
| 695 | 695 | ), |
| 696 | - array ( |
|
| 697 | - gettext ( 'Caller Number' ), |
|
| 696 | + array( |
|
| 697 | + gettext('Caller Number'), |
|
| 698 | 698 | 'INPUT', |
| 699 | - array ( |
|
| 699 | + array( |
|
| 700 | 700 | 'name' => 'effective_caller_id_number', |
| 701 | 701 | 'size' => '20', |
| 702 | 702 | 'class' => "text field medium" |
@@ -705,8 +705,8 @@ discard block |
||
| 705 | 705 | 'tOOL TIP', |
| 706 | 706 | 'Please Enter account number' |
| 707 | 707 | ), |
| 708 | - array ( |
|
| 709 | - gettext ( 'Status' ), |
|
| 708 | + array( |
|
| 709 | + gettext('Status'), |
|
| 710 | 710 | 'status', |
| 711 | 711 | 'SELECT', |
| 712 | 712 | '', |
@@ -719,18 +719,18 @@ discard block |
||
| 719 | 719 | 'set_status' |
| 720 | 720 | ) |
| 721 | 721 | ); |
| 722 | - $form ['button_save'] = array ( |
|
| 722 | + $form ['button_save'] = array( |
|
| 723 | 723 | 'name' => 'action', |
| 724 | - 'content' => gettext ( 'Save' ), |
|
| 724 | + 'content' => gettext('Save'), |
|
| 725 | 725 | 'value' => 'save', |
| 726 | 726 | 'type' => 'button', |
| 727 | 727 | 'id' => 'submit', |
| 728 | 728 | 'class' => 'btn btn-line-parrot' |
| 729 | 729 | ); |
| 730 | - $form ['button_cancel'] = array ( |
|
| 730 | + $form ['button_cancel'] = array( |
|
| 731 | 731 | 'name' => 'action', |
| 732 | 732 | 'content' => 'Close', |
| 733 | - gettext ( 'value' ) => 'cancel', |
|
| 733 | + gettext('value') => 'cancel', |
|
| 734 | 734 | 'type' => 'button', |
| 735 | 735 | 'class' => 'btn btn-line-sky margin-x-10', |
| 736 | 736 | 'onclick' => 'return redirect_page(\'NULL\')' |
@@ -739,54 +739,54 @@ discard block |
||
| 739 | 739 | } |
| 740 | 740 | function user_opensips() { |
| 741 | 741 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 742 | - $grid_field_arr = json_encode ( array ( |
|
| 743 | - array ( |
|
| 744 | - gettext ( "Username" ), |
|
| 742 | + $grid_field_arr = json_encode(array( |
|
| 743 | + array( |
|
| 744 | + gettext("Username"), |
|
| 745 | 745 | "130", |
| 746 | 746 | "username", |
| 747 | 747 | "", |
| 748 | 748 | "", |
| 749 | 749 | "" |
| 750 | 750 | ), |
| 751 | - array ( |
|
| 752 | - gettext ( "Password" ), |
|
| 751 | + array( |
|
| 752 | + gettext("Password"), |
|
| 753 | 753 | "130", |
| 754 | 754 | "password", |
| 755 | 755 | "", |
| 756 | 756 | "", |
| 757 | 757 | "" |
| 758 | 758 | ), |
| 759 | - array ( |
|
| 760 | - gettext ( "Domain" ), |
|
| 759 | + array( |
|
| 760 | + gettext("Domain"), |
|
| 761 | 761 | "130", |
| 762 | 762 | "domain", |
| 763 | 763 | "", |
| 764 | 764 | "", |
| 765 | 765 | "" |
| 766 | 766 | ), |
| 767 | - array ( |
|
| 768 | - gettext ( "Action" ), |
|
| 767 | + array( |
|
| 768 | + gettext("Action"), |
|
| 769 | 769 | "120", |
| 770 | 770 | "", |
| 771 | 771 | "", |
| 772 | 772 | "", |
| 773 | - array ( |
|
| 774 | - "EDIT" => array ( |
|
| 773 | + array( |
|
| 774 | + "EDIT" => array( |
|
| 775 | 775 | "url" => 'user/user_opensips_action/edit/', |
| 776 | 776 | "mode" => "popup" |
| 777 | 777 | ), |
| 778 | - "DELETE" => array ( |
|
| 778 | + "DELETE" => array( |
|
| 779 | 779 | "url" => 'user/user_opensips_action/delete/', |
| 780 | 780 | "mode" => "popup" |
| 781 | 781 | ) |
| 782 | 782 | ) |
| 783 | 783 | ) |
| 784 | - ) ); |
|
| 784 | + )); |
|
| 785 | 785 | return $grid_field_arr; |
| 786 | 786 | } |
| 787 | 787 | function opensips_customer_build_grid_buttons($accountid) { |
| 788 | - $buttons_json = json_encode ( array ( |
|
| 789 | - array ( |
|
| 788 | + $buttons_json = json_encode(array( |
|
| 789 | + array( |
|
| 790 | 790 | "Add Devices", |
| 791 | 791 | "btn btn-line-warning btn", |
| 792 | 792 | "fa fa-plus-circle fa-lg", |
@@ -802,33 +802,33 @@ discard block |
||
| 802 | 802 | function opensips_customer_build_opensips_list($accountid) { |
| 803 | 803 | // echo $accountid; |
| 804 | 804 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
| 805 | - $grid_field_arr = json_encode ( array ( |
|
| 806 | - array ( |
|
| 807 | - gettext ( "Username" ), |
|
| 805 | + $grid_field_arr = json_encode(array( |
|
| 806 | + array( |
|
| 807 | + gettext("Username"), |
|
| 808 | 808 | "200", |
| 809 | 809 | "username", |
| 810 | 810 | "", |
| 811 | 811 | "", |
| 812 | 812 | "" |
| 813 | 813 | ), |
| 814 | - array ( |
|
| 815 | - gettext ( "Password" ), |
|
| 814 | + array( |
|
| 815 | + gettext("Password"), |
|
| 816 | 816 | "200", |
| 817 | 817 | "password", |
| 818 | 818 | "", |
| 819 | 819 | "", |
| 820 | 820 | "" |
| 821 | 821 | ), |
| 822 | - array ( |
|
| 823 | - gettext ( "Domain" ), |
|
| 822 | + array( |
|
| 823 | + gettext("Domain"), |
|
| 824 | 824 | "200", |
| 825 | 825 | "domain", |
| 826 | 826 | "", |
| 827 | 827 | "", |
| 828 | 828 | "" |
| 829 | 829 | ), |
| 830 | - array ( |
|
| 831 | - gettext ( "Caller Name" ), |
|
| 830 | + array( |
|
| 831 | + gettext("Caller Name"), |
|
| 832 | 832 | "150", |
| 833 | 833 | "effective_caller_id_name", |
| 834 | 834 | "", |
@@ -838,8 +838,8 @@ discard block |
||
| 838 | 838 | "true", |
| 839 | 839 | "center" |
| 840 | 840 | ), |
| 841 | - array ( |
|
| 842 | - gettext ( "Caller Number" ), |
|
| 841 | + array( |
|
| 842 | + gettext("Caller Number"), |
|
| 843 | 843 | "150", |
| 844 | 844 | "effective_caller_id_number", |
| 845 | 845 | "", |
@@ -849,24 +849,24 @@ discard block |
||
| 849 | 849 | "true", |
| 850 | 850 | "center" |
| 851 | 851 | ), |
| 852 | - array ( |
|
| 853 | - gettext ( "Action" ), |
|
| 852 | + array( |
|
| 853 | + gettext("Action"), |
|
| 854 | 854 | "100", |
| 855 | 855 | "", |
| 856 | 856 | "", |
| 857 | 857 | "", |
| 858 | - array ( |
|
| 859 | - "EDIT" => array ( |
|
| 860 | - "url" => 'accounts/customer_opensips_action/edit/' . $accountid . '/', |
|
| 858 | + array( |
|
| 859 | + "EDIT" => array( |
|
| 860 | + "url" => 'accounts/customer_opensips_action/edit/'.$accountid.'/', |
|
| 861 | 861 | "mode" => "popup" |
| 862 | 862 | ), |
| 863 | - "DELETE" => array ( |
|
| 864 | - "url" => 'accounts/customer_opensips_action/delete/' . $accountid . "/", |
|
| 863 | + "DELETE" => array( |
|
| 864 | + "url" => 'accounts/customer_opensips_action/delete/'.$accountid."/", |
|
| 865 | 865 | "mode" => "popup" |
| 866 | 866 | ) |
| 867 | 867 | ) |
| 868 | 868 | ) |
| 869 | - ) ); |
|
| 869 | + )); |
|
| 870 | 870 | |
| 871 | 871 | return $grid_field_arr; |
| 872 | 872 | } |
@@ -23,74 +23,74 @@ |
||
| 23 | 23 | // ############################################################################## |
| 24 | 24 | class Signup_model extends CI_Model { |
| 25 | 25 | function Signup_model() { |
| 26 | - parent::__construct (); |
|
| 26 | + parent::__construct(); |
|
| 27 | 27 | |
| 28 | - $this->load->model ( 'Astpp_common' ); |
|
| 29 | - $this->load->helper ( 'form' ); |
|
| 30 | - $this->load->model ( 'common_model' ); |
|
| 31 | - $this->load->library ( 'session' ); |
|
| 28 | + $this->load->model('Astpp_common'); |
|
| 29 | + $this->load->helper('form'); |
|
| 30 | + $this->load->model('common_model'); |
|
| 31 | + $this->load->library('session'); |
|
| 32 | 32 | } |
| 33 | 33 | function get_rate() { |
| 34 | - $data = array (); |
|
| 35 | - $this->load->database (); |
|
| 34 | + $data = array(); |
|
| 35 | + $this->load->database(); |
|
| 36 | 36 | |
| 37 | - $this->db->select ( "id,name" ); |
|
| 38 | - $this->db->from ( 'pricelists' ); |
|
| 39 | - $this->db->where ( "status", "0" ); |
|
| 40 | - $query = $this->db->get (); |
|
| 41 | - return $query->row (); |
|
| 37 | + $this->db->select("id,name"); |
|
| 38 | + $this->db->from('pricelists'); |
|
| 39 | + $this->db->where("status", "0"); |
|
| 40 | + $query = $this->db->get(); |
|
| 41 | + return $query->row(); |
|
| 42 | 42 | } |
| 43 | 43 | function add_user($data) { |
| 44 | 44 | $data ['reseller_id'] = $data ['key_unique']; |
| 45 | - unset ( $data ['agreeCheck'] ); |
|
| 46 | - unset ( $data ['key_unique'] ); |
|
| 47 | - $data ['creation'] = gmdate ( 'Y-m-d H:i:s' ); |
|
| 48 | - $data ['expiry'] = date ( 'Y-m-d H:i:s', strtotime ( '+10 years' ) ); |
|
| 49 | - $this->db->insert ( "accounts", $data ); |
|
| 50 | - return $this->db->insert_id (); |
|
| 45 | + unset ($data ['agreeCheck']); |
|
| 46 | + unset ($data ['key_unique']); |
|
| 47 | + $data ['creation'] = gmdate('Y-m-d H:i:s'); |
|
| 48 | + $data ['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years')); |
|
| 49 | + $this->db->insert("accounts", $data); |
|
| 50 | + return $this->db->insert_id(); |
|
| 51 | 51 | } |
| 52 | 52 | function check_user($accno, $email, $balance) { |
| 53 | - $info = array ( |
|
| 53 | + $info = array( |
|
| 54 | 54 | "number" => $accno, |
| 55 | 55 | "email" => $email, |
| 56 | 56 | "status" => 1 |
| 57 | 57 | ); |
| 58 | - $this->db->where ( $info ); |
|
| 59 | - $this->db->select ( '*' ); |
|
| 60 | - $acc_res = $this->db->get ( 'accounts' ); |
|
| 61 | - if ($acc_res->num_rows () > 0) { |
|
| 62 | - $acc_res = $acc_res->result_array (); |
|
| 58 | + $this->db->where($info); |
|
| 59 | + $this->db->select('*'); |
|
| 60 | + $acc_res = $this->db->get('accounts'); |
|
| 61 | + if ($acc_res->num_rows() > 0) { |
|
| 62 | + $acc_res = $acc_res->result_array(); |
|
| 63 | 63 | $acc_res = $acc_res [0]; |
| 64 | - $this->db->where ( 'pricelist_id', $acc_res ['pricelist_id'] ); |
|
| 65 | - $this->db->select ( "*" ); |
|
| 66 | - $charge_res = $this->db->get ( 'charges' ); |
|
| 64 | + $this->db->where('pricelist_id', $acc_res ['pricelist_id']); |
|
| 65 | + $this->db->select("*"); |
|
| 66 | + $charge_res = $this->db->get('charges'); |
|
| 67 | 67 | |
| 68 | - if ($charge_res->num_rows () > 0) { |
|
| 69 | - $charge_res = $charge_res->result_array (); |
|
| 68 | + if ($charge_res->num_rows() > 0) { |
|
| 69 | + $charge_res = $charge_res->result_array(); |
|
| 70 | 70 | $charge_res = $charge_res [0]; |
| 71 | - $charge_acc_arr = array ( |
|
| 71 | + $charge_acc_arr = array( |
|
| 72 | 72 | "charge_id" => $charge_res ['id'], |
| 73 | 73 | "accountid" => $acc_res ['id'], |
| 74 | 74 | "status" => 0, |
| 75 | - "assign_date" => date ( 'Y-m-d H:i:s' ) |
|
| 75 | + "assign_date" => date('Y-m-d H:i:s') |
|
| 76 | 76 | ); |
| 77 | 77 | } else { |
| 78 | - $charge_res = $charge_res->result_array (); |
|
| 78 | + $charge_res = $charge_res->result_array(); |
|
| 79 | 79 | // echo "<pre>"; print_r($charge_res); exit; |
| 80 | - $charge_acc_arr = array ( |
|
| 80 | + $charge_acc_arr = array( |
|
| 81 | 81 | "charge_id" => 'id', |
| 82 | 82 | "accountid" => $acc_res ['id'], |
| 83 | - "assign_date" => date ( 'Y-m-d H:i:s' ) |
|
| 83 | + "assign_date" => date('Y-m-d H:i:s') |
|
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | - $result = $this->db->insert ( "charge_to_account", $charge_acc_arr ); |
|
| 87 | - $update = array ( |
|
| 86 | + $result = $this->db->insert("charge_to_account", $charge_acc_arr); |
|
| 87 | + $update = array( |
|
| 88 | 88 | "status" => 0, |
| 89 | 89 | "balance" => $balance |
| 90 | 90 | ); |
| 91 | - $this->db->where ( $info ); |
|
| 92 | - $result = $this->db->update ( 'accounts', $update ); |
|
| 93 | - $sip_device_update = array ( |
|
| 91 | + $this->db->where($info); |
|
| 92 | + $result = $this->db->update('accounts', $update); |
|
| 93 | + $sip_device_update = array( |
|
| 94 | 94 | 'username' => $accno, |
| 95 | 95 | "status" => 1 |
| 96 | 96 | ); |