@@ -176,35 +176,35 @@ |
||
176 | 176 | <fieldset> |
177 | 177 | <legend> <?=ucfirst($group_title)?></legend> |
178 | 178 | <div style="width:50%;float:left;"> |
179 | - <?php $currency = Common_model::$global_config['system_config']['base_currency'];?> |
|
180 | - <?php $count=ceil(sizeof($details)/2); $i=0; $class="tleft";?> |
|
181 | - <?php foreach($details as$key=>$val){ ?> |
|
182 | - <?php if($count==$i){ |
|
179 | + <?php $currency = Common_model::$global_config['system_config']['base_currency']; ?> |
|
180 | + <?php $count = ceil(sizeof($details) / 2); $i = 0; $class = "tleft"; ?> |
|
181 | + <?php foreach ($details as$key=>$val) { ?> |
|
182 | + <?php if ($count == $i) { |
|
183 | 183 | echo '</div><div style="width:50%;float:left;">'; |
184 | - $class="tright"; |
|
184 | + $class = "tright"; |
|
185 | 185 | } ?> |
186 | 186 | <div class="col-md-12"> |
187 | 187 | <div class="<?=$class?>" href='#'> |
188 | - <label class="col-md-5 no-padding"><?php echo $val['display_name'];?> * </label> |
|
189 | - <?php if(method_exists($this->common,$val['field_type'])){ |
|
190 | - $option_array = $this->common->$val['field_type'](); |
|
188 | + <label class="col-md-5 no-padding"><?php echo $val['display_name']; ?> * </label> |
|
189 | + <?php if (method_exists($this->common, $val['field_type'])) { |
|
190 | + $option_array = $this->common->$val['field_type'](); |
|
191 | 191 | $drpstr = '<select name="'.$val['name'].'" class="col-md-5 form-control selectpicker" data-live-search="true">'; |
192 | - foreach($option_array as $option_key=>$option_val){ |
|
193 | - $selected = ($val['value'] == $option_key)? "selected='selected'":""; |
|
192 | + foreach ($option_array as $option_key=>$option_val) { |
|
193 | + $selected = ($val['value'] == $option_key) ? "selected='selected'" : ""; |
|
194 | 194 | $drpstr .= '<option value="'.$option_key.'"'.$selected.'>'.$option_val.'</option>'; |
195 | 195 | } |
196 | 196 | $drpstr .= '</select>'; |
197 | 197 | echo $drpstr; |
198 | 198 | unset($drpstr); |
199 | - } else{ |
|
199 | + } else { |
|
200 | 200 | echo '<input name="'.$val["name"].'" value="'.$val['value'].'" size="20" maxlength="100" class="col-md-5 form-control" type="text">'; |
201 | 201 | }?> |
202 | - <span class="demo"><?php echo str_replace('smtp',"SMTP",$val['comment']);?></span> |
|
202 | + <span class="demo"><?php echo str_replace('smtp', "SMTP", $val['comment']); ?></span> |
|
203 | 203 | |
204 | 204 | </div> |
205 | 205 | </div> |
206 | 206 | |
207 | - <?php $i++;?> |
|
207 | + <?php $i++; ?> |
|
208 | 208 | <?php }?> |
209 | 209 | </div> |
210 | 210 | </fieldset> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /* |
50 | 50 | ASTPP 3.0 Add Rategroup add creation date. |
51 | 51 | */ |
52 | - $add_array['creation_date']=gmdate("Y-m-d H:i:s"); |
|
52 | + $add_array['creation_date'] = gmdate("Y-m-d H:i:s"); |
|
53 | 53 | /************************************/ |
54 | 54 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
55 | 55 | $account_data = $this->session->userdata("accountinfo"); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /* |
68 | 68 | ASTPP 3.0 Edit Rategroup time update last mofied date. |
69 | 69 | */ |
70 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
70 | + $data['last_modified_date'] = gmdate("Y-m-d H:i:s"); |
|
71 | 71 | /*********************************************************/ |
72 | 72 | $this->db->where("id", $id); |
73 | 73 | $this->db->update("pricelists", $data); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->load->model('pricing_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 price_add($type = "") { |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | foreach ($account->result_array() as $key => $value) { |
53 | 53 | $edit_data = $value; |
54 | 54 | } |
55 | - $routing_data = $this->db_model->getSelect("trunk_id", "routing",array("pricelist_id"=>$edit_id)); |
|
56 | - if($routing_data->num_rows > 0){ |
|
57 | - foreach($routing_data->result_array() as $trunkid){ |
|
55 | + $routing_data = $this->db_model->getSelect("trunk_id", "routing", array("pricelist_id"=>$edit_id)); |
|
56 | + if ($routing_data->num_rows > 0) { |
|
57 | + foreach ($routing_data->result_array() as $trunkid) { |
|
58 | 58 | $edit_data["trunk_id"][] = $trunkid["trunk_id"]; |
59 | 59 | } |
60 | 60 | } |
@@ -84,30 +84,30 @@ discard block |
||
84 | 84 | exit; |
85 | 85 | } |
86 | 86 | $this->load->view('view_price_add_edit', $data); |
87 | - }else { |
|
87 | + } else { |
|
88 | 88 | $data['page_title'] = 'Create Price Details'; |
89 | 89 | if ($this->form_validation->run() == FALSE) { |
90 | 90 | $data['validation_errors'] = validation_errors(); |
91 | 91 | echo $data['validation_errors']; |
92 | 92 | exit; |
93 | 93 | } else { |
94 | - if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id'])) |
|
95 | - $trunk_id=$add_array['trunk_id']; |
|
94 | + if (isset($add_array['trunk_id']) && ! empty($add_array['trunk_id'])) |
|
95 | + $trunk_id = $add_array['trunk_id']; |
|
96 | 96 | unset($add_array['trunk_id']); |
97 | - $priceid=$this->pricing_model->add_price($add_array); |
|
98 | - if(isset($trunk_id) && $trunk_id != ''){ |
|
99 | - $this->set_force_routing($priceid,$trunk_id); |
|
97 | + $priceid = $this->pricing_model->add_price($add_array); |
|
98 | + if (isset($trunk_id) && $trunk_id != '') { |
|
99 | + $this->set_force_routing($priceid, $trunk_id); |
|
100 | 100 | } |
101 | 101 | echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group added successfully!")); |
102 | 102 | exit; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | - function set_force_routing($priceid,$trunkid){ |
|
106 | + function set_force_routing($priceid, $trunkid) { |
|
107 | 107 | // echo "<pre>".$priceid; print_r($trunkid); |
108 | - foreach($trunkid as $id){ |
|
108 | + foreach ($trunkid as $id) { |
|
109 | 109 | $routing_arr = array("trunk_id" => $id, "pricelist_id"=>$priceid); |
110 | - $this->db->insert("routing",$routing_arr); |
|
110 | + $this->db->insert("routing", $routing_arr); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | function price_list_search() { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->session->set_userdata('price_list_search', $action); |
122 | 122 | } |
123 | 123 | if (@$ajax_search != 1) { |
124 | - redirect(base_url() . 'accounts/customer_list/'); |
|
124 | + redirect(base_url().'accounts/customer_list/'); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | function price_delete($pricelist_id) { |
162 | 162 | $where = array("id" => $pricelist_id); |
163 | 163 | $this->db_model->update("pricelists", array("status" => "2"), $where); |
164 | - $this->db->delete("routing",array("pricelist_id"=>$pricelist_id)); |
|
164 | + $this->db->delete("routing", array("pricelist_id"=>$pricelist_id)); |
|
165 | 165 | $this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!'); |
166 | - redirect(base_url() . 'pricing/price_list/'); |
|
166 | + redirect(base_url().'pricing/price_list/'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | function price_delete_multiple() { |
@@ -173,59 +173,59 @@ discard block |
||
173 | 173 | $update_data = array('status' => '2'); |
174 | 174 | $this->db->where('pricelist_id '.$where); |
175 | 175 | $this->db->delete('routes'); |
176 | - $this->db->delete("routing",array("pricelist_id"=>$where)); |
|
176 | + $this->db->delete("routing", array("pricelist_id"=>$where)); |
|
177 | 177 | $this->db->where('id '.$where); |
178 | 178 | echo $this->db->update('pricelists', $update_data); |
179 | 179 | } else { |
180 | - $pricelist_arr=array(); |
|
180 | + $pricelist_arr = array(); |
|
181 | 181 | //Get selected Rategroup Name from database. |
182 | 182 | $this->db->select('id,name'); |
183 | 183 | $this->db->where('id '.$where); |
184 | - $pricelist_res=$this->db->get('pricelists'); |
|
185 | - $pricelist_res=$pricelist_res->result_array(); |
|
186 | - foreach($pricelist_res as $value){ |
|
187 | - $pricelist_arr[$value['id']]['name']=$value['name']; |
|
184 | + $pricelist_res = $this->db->get('pricelists'); |
|
185 | + $pricelist_res = $pricelist_res->result_array(); |
|
186 | + foreach ($pricelist_res as $value) { |
|
187 | + $pricelist_arr[$value['id']]['name'] = $value['name']; |
|
188 | 188 | } |
189 | 189 | //Get count of accounts which are using selected rategroups. |
190 | 190 | $this->db->where('pricelist_id '.$where); |
191 | - $this->db->where('deleted',0); |
|
191 | + $this->db->where('deleted', 0); |
|
192 | 192 | $this->db->select('count(id) as cnt,pricelist_id'); |
193 | 193 | $this->db->group_by('pricelist_id'); |
194 | - $account_res=$this->db->get('accounts'); |
|
195 | - if($account_res->num_rows() > 0){ |
|
196 | - $account_res=$account_res->result_array(); |
|
197 | - foreach($account_res as $key=>$value){ |
|
198 | - $pricelist_arr[$value['pricelist_id']]['account']=$value['cnt']; |
|
194 | + $account_res = $this->db->get('accounts'); |
|
195 | + if ($account_res->num_rows() > 0) { |
|
196 | + $account_res = $account_res->result_array(); |
|
197 | + foreach ($account_res as $key=>$value) { |
|
198 | + $pricelist_arr[$value['pricelist_id']]['account'] = $value['cnt']; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | //Get count of routes which are using selected rategroups. |
202 | 202 | $this->db->where('pricelist_id '.$where); |
203 | 203 | $this->db->select('count(id) as cnt,pricelist_id'); |
204 | 204 | $this->db->group_by('pricelist_id'); |
205 | - $routes_res=$this->db->get('routes'); |
|
206 | - if($routes_res->num_rows() > 0){ |
|
207 | - $routes_res=$routes_res->result_array(); |
|
208 | - foreach($routes_res as $key=>$value){ |
|
209 | - $pricelist_arr[$value['pricelist_id']]['routes']=$value['cnt']; |
|
205 | + $routes_res = $this->db->get('routes'); |
|
206 | + if ($routes_res->num_rows() > 0) { |
|
207 | + $routes_res = $routes_res->result_array(); |
|
208 | + foreach ($routes_res as $key=>$value) { |
|
209 | + $pricelist_arr[$value['pricelist_id']]['routes'] = $value['cnt']; |
|
210 | 210 | } |
211 | 211 | } |
212 | - $str=null; |
|
213 | - foreach($pricelist_arr as $key=>$value){ |
|
214 | - $custom_str=null; |
|
215 | - if(isset($value['account']) || isset($value['routes'])){ |
|
216 | - if(isset($value['account'])){ |
|
217 | - $custom_str.= $value['account']." accounts and "; |
|
212 | + $str = null; |
|
213 | + foreach ($pricelist_arr as $key=>$value) { |
|
214 | + $custom_str = null; |
|
215 | + if (isset($value['account']) || isset($value['routes'])) { |
|
216 | + if (isset($value['account'])) { |
|
217 | + $custom_str .= $value['account']." accounts and "; |
|
218 | 218 | } |
219 | - if(isset($value['routes'])){ |
|
220 | - $custom_str.= $value['routes']." origination rates and "; |
|
219 | + if (isset($value['routes'])) { |
|
220 | + $custom_str .= $value['routes']." origination rates and "; |
|
221 | 221 | } |
222 | - $str.=" Rate group Name : ".$value['name']." using by ".rtrim($custom_str," and ")."\n"; |
|
222 | + $str .= " Rate group Name : ".$value['name']." using by ".rtrim($custom_str, " and ")."\n"; |
|
223 | 223 | } |
224 | 224 | } |
225 | - if(!empty($str)){ |
|
226 | - $data['str']=$str; |
|
225 | + if ( ! empty($str)) { |
|
226 | + $data['str'] = $str; |
|
227 | 227 | } |
228 | - $data['selected_ids']=$add_array['selected_ids']; |
|
228 | + $data['selected_ids'] = $add_array['selected_ids']; |
|
229 | 229 | echo json_encode($data); |
230 | 230 | } |
231 | 231 | } |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | $this->load->library('astpp/form'); |
33 | 33 | $this->load->model('pricing_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 price_add($type = "") { |
@@ -84,15 +85,16 @@ discard block |
||
84 | 85 | exit; |
85 | 86 | } |
86 | 87 | $this->load->view('view_price_add_edit', $data); |
87 | - }else { |
|
88 | + } else { |
|
88 | 89 | $data['page_title'] = 'Create Price Details'; |
89 | 90 | if ($this->form_validation->run() == FALSE) { |
90 | 91 | $data['validation_errors'] = validation_errors(); |
91 | 92 | echo $data['validation_errors']; |
92 | 93 | exit; |
93 | 94 | } else { |
94 | - if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id'])) |
|
95 | - $trunk_id=$add_array['trunk_id']; |
|
95 | + if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id'])) { |
|
96 | + $trunk_id=$add_array['trunk_id']; |
|
97 | + } |
|
96 | 98 | unset($add_array['trunk_id']); |
97 | 99 | $priceid=$this->pricing_model->add_price($add_array); |
98 | 100 | if(isset($trunk_id) && $trunk_id != ''){ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | class pricing_form { |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | $this->CI = & get_instance(); |
30 | 30 | } |
31 | 31 | function get_pricing_form_fields() { |
32 | - $form['forms'] = array(base_url() . 'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form')); |
|
32 | + $form['forms'] = array(base_url().'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form')); |
|
33 | 33 | if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) { |
34 | 34 | $form['Rate Group Information'] = array( |
35 | 35 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
36 | 36 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
37 | - array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
37 | + array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
38 | 38 | array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_routetype'), |
39 | 39 | array('Initial Increment', 'INPUT', array('name' => 'initially_increment', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
40 | - array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
41 | - array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" , 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
40 | + array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
41 | + array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0", 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
42 | 42 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
43 | 43 | ); |
44 | 44 | } |
45 | - else{ |
|
45 | + else { |
|
46 | 46 | $form['Rate Group Information'] = array( |
47 | 47 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
48 | 48 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
@@ -87,21 +87,21 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function build_pricing_list_for_admin() { |
89 | 89 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
90 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
90 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
91 | 91 | /** |
92 | 92 | ASTPP 3.0 |
93 | 93 | For Rategroup edit on Name |
94 | 94 | **/ |
95 | - array(gettext("Name"), "110", "name", "", "", "","EDITABLE","true","center"), |
|
95 | + array(gettext("Name"), "110", "name", "", "", "", "EDITABLE", "true", "center"), |
|
96 | 96 | /***************************************/ |
97 | 97 | array(gettext("Routing Type"), "120", "routing_type", "routing_type", "routing_type", "get_routetype"), |
98 | - array(gettext("Initial Increment"), "140", "initially_increment", "", "", "","","true","center"), |
|
99 | - array("Default Increment", "140", "inc", "", "", "","","true","center"), |
|
100 | - array(gettext("Markup(%)"), "100", "markup", "", "", "","","true","center"), |
|
101 | - array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count","","true","center"), |
|
102 | - array(gettext("Status"), "110", "status", "id", "pricelists", "get_status","","true","center"), |
|
103 | - array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
104 | - array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
98 | + array(gettext("Initial Increment"), "140", "initially_increment", "", "", "", "", "true", "center"), |
|
99 | + array("Default Increment", "140", "inc", "", "", "", "", "true", "center"), |
|
100 | + array(gettext("Markup(%)"), "100", "markup", "", "", "", "", "true", "center"), |
|
101 | + array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count", "", "true", "center"), |
|
102 | + array(gettext("Status"), "110", "status", "id", "pricelists", "get_status", "", "true", "center"), |
|
103 | + array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"), |
|
104 | + array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"), |
|
105 | 105 | array("Action", "150", "", "", "", array("EDIT" => array("url" => "pricing/price_edit/", "mode" => "popup"), |
106 | 106 | |
107 | 107 | "DELETE" => array("url" => "pricing/price_delete/", "mode" => "single"))) |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | function build_grid_buttons() { |
113 | - $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn" ,"fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"), |
|
114 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/") |
|
113 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"), |
|
114 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/") |
|
115 | 115 | )); |
116 | 116 | return $buttons_json; |
117 | 117 | } |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
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 | 27 | |
27 | 28 | class pricing_form { |
28 | 29 | function __construct($library_name = '') { |
@@ -41,8 +42,7 @@ discard block |
||
41 | 42 | array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" , 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
42 | 43 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
43 | 44 | ); |
44 | - } |
|
45 | - else{ |
|
45 | + } else{ |
|
46 | 46 | $form['Rate Group Information'] = array( |
47 | 47 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
48 | 48 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
@@ -27,80 +27,80 @@ |
||
27 | 27 | function refill_coupon_model() { |
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | - function get_refill_coupon_list($flag,$start = 0, $limit = 0,$export=false){ |
|
30 | + function get_refill_coupon_list($flag, $start = 0, $limit = 0, $export = false) { |
|
31 | 31 | $this->db_model->build_search('refill_coupon_list_search'); |
32 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
33 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
34 | - $where=array('reseller_id'=>$reseller_id); |
|
32 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
33 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
34 | + $where = array('reseller_id'=>$reseller_id); |
|
35 | 35 | if ($flag) { |
36 | - if($export) |
|
37 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'',''); |
|
36 | + if ($export) |
|
37 | + $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", '', ''); |
|
38 | 38 | else |
39 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
39 | + $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start); |
|
40 | 40 | } else { |
41 | - $query = $this->db_model->countQuery("*", "refill_coupon",$where); |
|
41 | + $query = $this->db_model->countQuery("*", "refill_coupon", $where); |
|
42 | 42 | } |
43 | 43 | return $query; |
44 | 44 | } |
45 | - function get_customer_refill_coupon_list($flag,$start = 0, $limit = 0,$accountid){ |
|
45 | + function get_customer_refill_coupon_list($flag, $start = 0, $limit = 0, $accountid) { |
|
46 | 46 | $this->db_model->build_search('refill_coupon_list_search'); |
47 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
48 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : ($accountinfo['type']== 0 ? $accountinfo['reseller_id']: 0 ); |
|
49 | - $where=array('reseller_id'=>$reseller_id,"account_id"=>$accountid); |
|
47 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
48 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : ($accountinfo['type'] == 0 ? $accountinfo['reseller_id'] : 0); |
|
49 | + $where = array('reseller_id'=>$reseller_id, "account_id"=>$accountid); |
|
50 | 50 | if ($flag) { |
51 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
51 | + $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start); |
|
52 | 52 | } else { |
53 | - $query = $this->db_model->countQuery("*", "refill_coupon",$where); |
|
53 | + $query = $this->db_model->countQuery("*", "refill_coupon", $where); |
|
54 | 54 | } |
55 | 55 | return $query; |
56 | 56 | } |
57 | - function add_refill_coupon($add_array){ |
|
57 | + function add_refill_coupon($add_array) { |
|
58 | 58 | $count = $add_array['count']; |
59 | 59 | unset($add_array['action']); |
60 | 60 | unset($add_array['count']); |
61 | - $prefix=$add_array['prefix']; |
|
61 | + $prefix = $add_array['prefix']; |
|
62 | 62 | unset($add_array['prefix']); |
63 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
64 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id']:0; |
|
65 | - $insert_arr=array(); |
|
66 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
67 | - $length=strlen($prefix); |
|
68 | - if($length !=0){ |
|
69 | - $number_length=$account_length-$length; |
|
70 | - } else{ |
|
71 | - $number_length=$account_length; |
|
63 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
64 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
65 | + $insert_arr = array(); |
|
66 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
67 | + $length = strlen($prefix); |
|
68 | + if ($length != 0) { |
|
69 | + $number_length = $account_length - $length; |
|
70 | + } else { |
|
71 | + $number_length = $account_length; |
|
72 | 72 | } |
73 | 73 | $add_array['amount'] = $this->common_model->add_calculate_currency($add_array['amount'], '', '', false, false); |
74 | - $number=$this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon',$prefix,$count); |
|
75 | - $date=gmdate('Y-m-d H:i:s'); |
|
74 | + $number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon', $prefix, $count); |
|
75 | + $date = gmdate('Y-m-d H:i:s'); |
|
76 | 76 | for ($i = 0; $i < $count; $i++) { |
77 | 77 | $add_array['number'] = trim($number[$i]); |
78 | - $add_array['currency_id']=$accountinfo['currency_id']; |
|
79 | - $add_array['reseller_id']=$reseller_id; |
|
80 | - $add_array['creation_date']=$date; |
|
81 | - $insert_arr[$i]=$add_array; |
|
78 | + $add_array['currency_id'] = $accountinfo['currency_id']; |
|
79 | + $add_array['reseller_id'] = $reseller_id; |
|
80 | + $add_array['creation_date'] = $date; |
|
81 | + $insert_arr[$i] = $add_array; |
|
82 | 82 | } |
83 | - $this->db->insert_batch("refill_coupon",$insert_arr); |
|
83 | + $this->db->insert_batch("refill_coupon", $insert_arr); |
|
84 | 84 | return true; |
85 | 85 | } |
86 | - function remove_refill_coupon($id){ |
|
86 | + function remove_refill_coupon($id) { |
|
87 | 87 | $this->db->where("id", $id); |
88 | 88 | $this->db->delete("refill_coupon"); |
89 | 89 | return true; |
90 | 90 | } |
91 | - function get_refill_coupon_details($id){ |
|
91 | + function get_refill_coupon_details($id) { |
|
92 | 92 | $this->db->where("id", $id); |
93 | - $result=$this->db->get('refill_coupon'); |
|
93 | + $result = $this->db->get('refill_coupon'); |
|
94 | 94 | return $result; |
95 | 95 | } |
96 | - function refill_coupon_count($add_array){ |
|
97 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
98 | - $this->db->where("length(number)",$account_length); |
|
99 | - $this->db->like('number',$add_array['prefix'],'after'); |
|
96 | + function refill_coupon_count($add_array) { |
|
97 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
98 | + $this->db->where("length(number)", $account_length); |
|
99 | + $this->db->like('number', $add_array['prefix'], 'after'); |
|
100 | 100 | $this->db->select("count(id) as count"); |
101 | 101 | $this->db->from('refill_coupon'); |
102 | - $result=$this->db->get(); |
|
103 | - $result=$result->result_array(); |
|
102 | + $result = $this->db->get(); |
|
103 | + $result = $result->result_array(); |
|
104 | 104 | return $result; |
105 | 105 | } |
106 | 106 | } |
@@ -33,10 +33,11 @@ |
||
33 | 33 | $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
34 | 34 | $where=array('reseller_id'=>$reseller_id); |
35 | 35 | if ($flag) { |
36 | - if($export) |
|
37 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'',''); |
|
38 | - else |
|
39 | - $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
36 | + if($export) { |
|
37 | + $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'',''); |
|
38 | + } else { |
|
39 | + $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start); |
|
40 | + } |
|
40 | 41 | } else { |
41 | 42 | $query = $this->db_model->countQuery("*", "refill_coupon",$where); |
42 | 43 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | class Refill_coupon extends MX_Controller { |
26 | 26 | |
27 | - function Refill_coupon(){ |
|
27 | + function Refill_coupon() { |
|
28 | 28 | parent::__construct(); |
29 | 29 | $this->load->helper('template_inheritance'); |
30 | 30 | $this->load->helper('form'); |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | $this->load->library("astpp/form"); |
34 | 34 | $this->load->library("session"); |
35 | 35 | if ($this->session->userdata('user_login') == FALSE) |
36 | - redirect(base_url() . 'login/login'); |
|
36 | + redirect(base_url().'login/login'); |
|
37 | 37 | } |
38 | - function refill_coupon_list(){ |
|
39 | - if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
|
40 | - redirect(base_url() . 'user/user/'); |
|
38 | + function refill_coupon_list() { |
|
39 | + if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) { |
|
40 | + redirect(base_url().'user/user/'); |
|
41 | 41 | } |
42 | 42 | $data['username'] = $this->session->userdata('user_name'); |
43 | 43 | $data['page_title'] = gettext('Refill Coupon'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
50 | 50 | $this->load->view('view_refill_coupon_list', $data); |
51 | 51 | } |
52 | - function refill_coupon_list_json(){ |
|
52 | + function refill_coupon_list_json() { |
|
53 | 53 | $json_data = array(); |
54 | 54 | $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
55 | 55 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
60 | 60 | echo json_encode($json_data); |
61 | 61 | } |
62 | - function refill_coupon_list_search(){ |
|
62 | + function refill_coupon_list_search() { |
|
63 | 63 | $ajax_search = $this->input->post('ajax_search', 0); |
64 | 64 | if ($this->input->post('advance_search', TRUE) == 1) { |
65 | 65 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
@@ -72,21 +72,21 @@ discard block |
||
72 | 72 | $this->session->set_userdata('refill_coupon_list_search', $action); |
73 | 73 | } |
74 | 74 | if (@$ajax_search != 1) { |
75 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
75 | + redirect(base_url().'refill_coupon/refill_coupon_list/'); |
|
76 | 76 | } |
77 | 77 | } |
78 | - function refill_coupon_clearsearchfilter(){ |
|
78 | + function refill_coupon_clearsearchfilter() { |
|
79 | 79 | $this->session->set_userdata('advance_search', 0); |
80 | 80 | $this->session->set_userdata('refill_coupon_list_search', ""); |
81 | 81 | } |
82 | - function refill_coupon_list_view($id){ |
|
82 | + function refill_coupon_list_view($id) { |
|
83 | 83 | $data['username'] = $this->session->userdata('user_name'); |
84 | 84 | $data['page_title'] = 'View Refill Coupon'; |
85 | 85 | if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
86 | - $refill_coupon_details=$cc->result_array(); |
|
87 | - $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | - $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | - $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
86 | + $refill_coupon_details = $cc->result_array(); |
|
87 | + $data['refill_coupon_details'] = $refill_coupon_details[0]; |
|
88 | + $data['refill_coupon_details']['callingcard'] = $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | + $data['refill_coupon_details']['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | 90 | } else { |
91 | 91 | echo "This card is not available."; |
92 | 92 | return; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | } |
97 | 97 | function refill_coupon_add() { |
98 | - if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
|
99 | - redirect(base_url() . 'user/user/'); |
|
98 | + if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) { |
|
99 | + redirect(base_url().'user/user/'); |
|
100 | 100 | } |
101 | 101 | $data['username'] = $this->session->userdata('user_name'); |
102 | 102 | $data['flag'] = 'create'; |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | $this->load->view('view_refill_coupon_add', $data); |
106 | 106 | } |
107 | 107 | function refill_coupon_save() { |
108 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
108 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | 109 | $add_array = $this->input->post(); |
110 | - $add_array['status']=0; |
|
110 | + $add_array['status'] = 0; |
|
111 | 111 | $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
112 | - $result=$this->refill_coupon_model->refill_coupon_count($add_array); |
|
113 | - $count=$result[0]['count']; |
|
114 | - $remaining_length =0; |
|
115 | - $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | - $currentlength =pow(5,$remaining_length); |
|
117 | - $currentlength=$currentlength-$count; |
|
112 | + $result = $this->refill_coupon_model->refill_coupon_count($add_array); |
|
113 | + $count = $result[0]['count']; |
|
114 | + $remaining_length = 0; |
|
115 | + $remaining_length = $account_length - strlen($add_array['prefix']); |
|
116 | + $currentlength = pow(5, $remaining_length); |
|
117 | + $currentlength = $currentlength - $count; |
|
118 | 118 | $data['page_title'] = 'Add Refill Coupon'; |
119 | 119 | if ($this->form_validation->run() == FALSE) { |
120 | 120 | $data['validation_errors'] = validation_errors(); |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | exit; |
123 | 123 | } |
124 | 124 | else { |
125 | - if($account_length<=strlen($add_array['prefix'])){ |
|
125 | + if ($account_length <= strlen($add_array['prefix'])) { |
|
126 | 126 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
127 | 127 | exit; |
128 | 128 | } |
129 | - if($currentlength <= 0){ |
|
129 | + if ($currentlength <= 0) { |
|
130 | 130 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
131 | 131 | exit; |
132 | 132 | } |
133 | - if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
133 | + if ($currentlength > 0 && $add_array['count'] > $currentlength) { |
|
134 | 134 | echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
135 | 135 | exit; |
136 | - }else{ |
|
136 | + } else { |
|
137 | 137 | $this->refill_coupon_model->add_refill_coupon($add_array); |
138 | 138 | echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
139 | 139 | exit; |
@@ -143,26 +143,26 @@ discard block |
||
143 | 143 | function refill_coupon_list_delete($id) { |
144 | 144 | $this->refill_coupon_model->remove_refill_coupon($id); |
145 | 145 | $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
146 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
146 | + redirect(base_url().'refill_coupon/refill_coupon_list/'); |
|
147 | 147 | } |
148 | - function refill_coupon_export(){ |
|
148 | + function refill_coupon_export() { |
|
149 | 149 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
150 | - $currency_id=$account_info['currency_id']; |
|
151 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
152 | - $query = $this->refill_coupon_model->get_refill_coupon_list(true,'','',true); |
|
150 | + $currency_id = $account_info['currency_id']; |
|
151 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
152 | + $query = $this->refill_coupon_model->get_refill_coupon_list(true, '', '', true); |
|
153 | 153 | $cc_array = array(); |
154 | 154 | ob_clean(); |
155 | - $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
155 | + $cc_array[] = array('Coupon No.', 'Description', 'Account', 'Amount('.$currency.')', 'Created Date', "Used?", 'Used Date'); |
|
156 | 156 | if ($query->num_rows() > 0) { |
157 | 157 | foreach ($query->result_array() as $row) { |
158 | 158 | $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
159 | 159 | $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
160 | - $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
160 | + $row['status'] = $this->common->get_refill_coupon_status('', '', $row['status']); |
|
161 | 161 | $cc_array[] = array( |
162 | 162 | $row['number'], |
163 | 163 | $row['description'], |
164 | 164 | $row['acc_name'], |
165 | - $this->common->convert_to_currency('','',$row['amount']), |
|
165 | + $this->common->convert_to_currency('', '', $row['amount']), |
|
166 | 166 | $row['creation_date'], |
167 | 167 | $row['status'], |
168 | 168 | $row['firstused'] |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | $this->load->helper('csv'); |
173 | - array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
173 | + array_to_csv($cc_array, 'refill_coupon_'.date("Y-m-d").'.csv'); |
|
174 | 174 | } |
175 | - function refill_coupon_customer_json($accountid){ |
|
175 | + function refill_coupon_customer_json($accountid) { |
|
176 | 176 | $json_data = array(); |
177 | - $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
177 | + $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "", $accountid); |
|
178 | 178 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
179 | 179 | $json_data = $paging_data["json_paging"]; |
180 | - $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
180 | + $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $accountid); |
|
181 | 181 | $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
182 | 182 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
183 | 183 | echo json_encode($json_data); |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | $this->load->library("refill_coupon_form"); |
33 | 33 | $this->load->library("astpp/form"); |
34 | 34 | $this->load->library("session"); |
35 | - if ($this->session->userdata('user_login') == FALSE) |
|
36 | - redirect(base_url() . 'login/login'); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) { |
|
36 | + redirect(base_url() . 'login/login'); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | function refill_coupon_list(){ |
39 | 40 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
@@ -120,8 +121,7 @@ discard block |
||
120 | 121 | $data['validation_errors'] = validation_errors(); |
121 | 122 | echo $data['validation_errors']; |
122 | 123 | exit; |
123 | - } |
|
124 | - else { |
|
124 | + } else { |
|
125 | 125 | if($account_length<=strlen($add_array['prefix'])){ |
126 | 126 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
127 | 127 | exit; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if($currentlength > 0 && $add_array['count'] > $currentlength){ |
134 | 134 | echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
135 | 135 | exit; |
136 | - }else{ |
|
136 | + } else{ |
|
137 | 137 | $this->refill_coupon_model->add_refill_coupon($add_array); |
138 | 138 | echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
139 | 139 | exit; |
@@ -20,18 +20,18 @@ 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 Refill_coupon_form { |
27 | 27 | function __construct($library_name = '') { |
28 | 28 | $this->CI = & get_instance(); |
29 | 29 | } |
30 | - function get_refill_coupon_form_fields(){ |
|
31 | - $form['forms'] = array(base_url() . 'refill_coupon/refill_coupon_save/',array("id" => "refill_coupon_form", "name" => "refill_coupon_form")); |
|
30 | + function get_refill_coupon_form_fields() { |
|
31 | + $form['forms'] = array(base_url().'refill_coupon/refill_coupon_save/', array("id" => "refill_coupon_form", "name" => "refill_coupon_form")); |
|
32 | 32 | $form['Coupon Information'] = array( |
33 | - array('Description', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
34 | - array('Start prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
33 | + array('Description', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
34 | + array('Start prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
35 | 35 | array('Quantity', 'INPUT', array('name' => 'count', 'size' => '20', 'maxlength' => '5', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
36 | 36 | array('Amount', 'INPUT', array('name' => 'amount', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
37 | 37 | ); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | } |
43 | 43 | function build_grid_buttons_refill_coupon() { |
44 | 44 | $buttons_json = json_encode(array( |
45 | - array(gettext("Create"),"btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/refill_coupon/refill_coupon_add/","popup"), |
|
46 | - array(gettext("Export"),"btn btn-xing" ," fa fa-download fa-lg", "button_action", "/refill_coupon/refill_coupon_export/", 'single'), |
|
45 | + array(gettext("Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/refill_coupon/refill_coupon_add/", "popup"), |
|
46 | + array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/refill_coupon/refill_coupon_export/", 'single'), |
|
47 | 47 | )); |
48 | 48 | return $buttons_json; |
49 | 49 | } |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | return $buttons_json; |
54 | 54 | } |
55 | 55 | function get_refill_coupon_search_form() { |
56 | - $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
57 | - $reseller_id=$accountinfo['type']== 1 ?$accountinfo['id'] : 0 ; |
|
56 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
57 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
58 | 58 | $form['forms'] = array("", array('id' => "refill_coupon_list_search")); |
59 | 59 | $form['Search'] = array( |
60 | 60 | array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
61 | - array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15','class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
62 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"GLOBAL")), |
|
63 | - array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
61 | + array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
62 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id, "type"=>"GLOBAL")), |
|
63 | + array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
64 | 64 | array('Used?', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''), |
65 | 65 | |
66 | 66 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $form['Search Refill Coupon'] = array( |
78 | 78 | array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
79 | 79 | array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
80 | - array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
80 | + array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
81 | 81 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''), |
82 | 82 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
83 | 83 | array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | function build_refill_coupon_grid() { |
90 | 90 | |
91 | 91 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
92 | - $currency_id=$account_info['currency_id']; |
|
93 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
92 | + $currency_id = $account_info['currency_id']; |
|
93 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
94 | 94 | |
95 | 95 | $grid_field_arr = json_encode(array( |
96 | - array(gettext("Coupon Number"), "150", "number", "", "", "","","true","center"), |
|
97 | - array(gettext("Description"), "165", "description", "", "", "","","true","center"), |
|
98 | - array(gettext("Account"), "165", "account_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"), |
|
99 | - array("Amount($currency)", "150", "amount", "amount", "amount", "convert_to_currency","","true","right"), |
|
100 | - array(gettext("Created Date"), "200", "creation_date", "", "", "","","true","center"), |
|
101 | - array(gettext("Used?"),"135","status",'status','status','get_refill_coupon_used',"","true","center"), |
|
102 | - array(gettext("Used Date"), "180", "firstused", "firstused", "firstused", "firstused_check","","true","center"), |
|
96 | + array(gettext("Coupon Number"), "150", "number", "", "", "", "", "true", "center"), |
|
97 | + array(gettext("Description"), "165", "description", "", "", "", "", "true", "center"), |
|
98 | + array(gettext("Account"), "165", "account_id", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"), |
|
99 | + array("Amount($currency)", "150", "amount", "amount", "amount", "convert_to_currency", "", "true", "right"), |
|
100 | + array(gettext("Created Date"), "200", "creation_date", "", "", "", "", "true", "center"), |
|
101 | + array(gettext("Used?"), "135", "status", 'status', 'status', 'get_refill_coupon_used', "", "true", "center"), |
|
102 | + array(gettext("Used Date"), "180", "firstused", "firstused", "firstused", "firstused_check", "", "true", "center"), |
|
103 | 103 | array("Action", "120", "", "", "", array( |
104 | 104 | "DELETE" => array("url" => "refill_coupon/refill_coupon_list_delete/", "mode" => "single") |
105 | 105 | )) |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | } |
109 | 109 | function build_user_refill_coupon_grid() { |
110 | 110 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
111 | - $currency_id=$account_info['currency_id']; |
|
112 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
111 | + $currency_id = $account_info['currency_id']; |
|
112 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
113 | 113 | $grid_field_arr = json_encode(array( |
114 | - array("Coupon Number", "230", "number", "", "", "","","true","center"), |
|
115 | - array("Description", "210", "description", "", "", "","","true","center"), |
|
116 | - array("Amount($currency)", "190", "amount", "amount", "amount", "convert_to_currency","","true","right"), |
|
117 | - array("Created Date", "250", "creation_date", "", "", "","","true","center"), |
|
118 | - array("Used Date", "250", "firstused", "firstused", "firstused", "firstused_check","","true","center"), |
|
114 | + array("Coupon Number", "230", "number", "", "", "", "", "true", "center"), |
|
115 | + array("Description", "210", "description", "", "", "", "", "true", "center"), |
|
116 | + array("Amount($currency)", "190", "amount", "amount", "amount", "convert_to_currency", "", "true", "right"), |
|
117 | + array("Created Date", "250", "creation_date", "", "", "", "", "true", "center"), |
|
118 | + array("Used Date", "250", "firstused", "firstused", "firstused", "firstused_check", "", "true", "center"), |
|
119 | 119 | )); |
120 | 120 | return $grid_field_arr; |
121 | 121 | } |
@@ -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')) |
|
23 | +if (!defined('BASEPATH')) { |
|
24 | 24 | exit('No direct script access allowed'); |
25 | +} |
|
25 | 26 | |
26 | 27 | class Refill_coupon_form { |
27 | 28 | function __construct($library_name = '') { |
@@ -48,10 +48,10 @@ |
||
48 | 48 | <th>Length in Seconds</th> |
49 | 49 | <th>Cost(CAD)</th> |
50 | 50 | </tr> |
51 | - <?php foreach($cdrs as $cdr){ |
|
52 | - $debit= ''; |
|
53 | - $debit =($cdr['debit']/10000); |
|
54 | - $debit=$debit+0; |
|
51 | + <?php foreach ($cdrs as $cdr) { |
|
52 | + $debit = ''; |
|
53 | + $debit = ($cdr['debit'] / 10000); |
|
54 | + $debit = $debit + 0; |
|
55 | 55 | ?> |
56 | 56 | <tr> |
57 | 57 | <td><?=$cdr['destination']?></td> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | $this->db_model->build_search('animap_list_search'); |
55 | 55 | if ($flag) { |
56 | - $query = $this->db_model->select("*", "ani_map", "", "id", "ASC", $limit, $start); |
|
56 | + $query = $this->db_model->select("*", "ani_map", "", "id", "ASC", $limit, $start); |
|
57 | 57 | } else { |
58 | 58 | $query = $this->db_model->countQuery("*", "ani_map", ""); |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ASTPP 3.0 |
66 | 66 | Add creation date |
67 | 67 | */ |
68 | - $data=array('creation_date'=>gmdate('Y-m-d H:i:s'),'number'=>$add_array['number'],'accountid'=>$add_array['accountid'],'status'=>$add_array['status'],'context'=>'default'); |
|
68 | + $data = array('creation_date'=>gmdate('Y-m-d H:i:s'), 'number'=>$add_array['number'], 'accountid'=>$add_array['accountid'], 'status'=>$add_array['status'], 'context'=>'default'); |
|
69 | 69 | $this->db->insert("ani_map", $data); |
70 | 70 | return $this->db->insert_id(); |
71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ASTPP 3.0 |
76 | 76 | last modify date update |
77 | 77 | */ |
78 | - $data=array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'number'=>$add_array['number'],'accountid'=>$add_array['accountid'],'status'=>$add_array['status'],'context'=>'default'); |
|
78 | + $data = array('last_modified_date'=>gmdate('Y-m-d H:i:s'), 'number'=>$add_array['number'], 'accountid'=>$add_array['accountid'], 'status'=>$add_array['status'], 'context'=>'default'); |
|
79 | 79 | /*********************************************************/ |
80 | 80 | $this->db->where("id", $id); |
81 | 81 | return $this->db->update("ani_map", $data); |