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