Passed
Pull Request — v3.0 (#146)
by
unknown
11:54
created
web_interface/astpp/application/modules/rates/libraries/rates_form.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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 rates_form {
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
 		$this->CI = & get_instance();
29 29
 	}
30 30
 	function get_termination_rate_form_fields() {
31
-		$form['forms'] = array(base_url() . 'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
31
+		$form['forms'] = array(base_url().'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
32 32
 		$form['Rate Information'] = array(
33 33
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
34 34
 			array('Trunk', 'trunk_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),     
35
-			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
-			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20',  'class' => "text field medium"), 'tOOL TIP', ''),            
37
-			array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
38
-			array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
35
+			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
+			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),            
37
+			array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
38
+			array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
39 39
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
40 40
             
41 41
         
42 42
 );
43 43
 		$form['Billing Information'] = array(
44
-			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
44
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
45 45
 			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
46 46
 			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
47 47
 /**
48 48
 ASTPP  3.0 
49 49
 For Add Initial Increment field
50 50
 **/
51
-		array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
51
+		array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
52 52
 /*******************************************************/
53
-			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
53
+			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
54 54
 			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''));
55 55
 	
56 56
 		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	function get_origination_rate_form_fields() {
63
-	 $logintype=$this->CI->session->userdata('userlevel_logintype');
64
-		$trunk=null;
65
-		if($logintype !=1)
63
+	 $logintype = $this->CI->session->userdata('userlevel_logintype');
64
+		$trunk = null;
65
+		if ($logintype != 1)
66 66
 	  $trunk = array('Force Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"));
67
-		$form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
67
+		$form['forms'] = array(base_url().'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68 68
 		$form['Rate Information'] = array(
69 69
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
70
-			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)),        
70
+			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)),        
71 71
 			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
72 72
 			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),
73 73
 			//array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         
76 76
 );
77 77
 		$form['Billing Information'] = array(
78
-			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
-			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
-			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
78
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
+			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
81 81
 /**
82 82
 ASTPP  3.0 
83 83
 For Add Initial Increment field
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 /***************************************************************/
114 114
 		array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
115 115
 				array('Priority', 'INPUT', array('name' => 'prepend[prepend]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'prepend[prepend-string]', '', '', '', 'search_string_type', ''),
116
-			array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
116
+			array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")), array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117 117
 		   array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
118 118
  /******
119 119
 ASTPP  3.0 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 ASTPP  3.0 
130 130
 Batch Delete
131 131
 ******/
132
-		$form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
132
+		$form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt", 'onclick'=>"check_btn();", 'content' => 'Delete Search Record', 'style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
133 133
 
134 134
 /***********************/
135 135
 /******
136 136
 ASTPP  3.0 
137 137
 Batch Delete
138 138
 ******/
139
-		$form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
139
+		$form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn", 'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
140 140
 /***********************/
141 141
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
142 142
 
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 	function termination_rate_batch_update_form() {
148 148
 		$form['forms'] = array("rates/termination_rate_batch_update/", array('id' => "termination_rate_batch_update"));
149 149
 		$form['Batch Update'] = array(
150
-		array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
-		array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
-		array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]','id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
150
+		array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
+		array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
+		array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
153 153
             
154
-		array('Increment', 'INPUT', array('name' => 'inc[inc]','id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
-		array('Priority', 'INPUT', array('name' => 'precedence[precedence]','id'=>'precedence', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
-		array('Prepand', 'INPUT', array('name' => 'prepend[prepend]','id'=>'prepend', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
-			array('Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type'),
154
+		array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
+		array('Priority', 'INPUT', array('name' => 'precedence[precedence]', 'id'=>'precedence', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]', 'class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
+		array('Prepand', 'INPUT', array('name' => 'prepend[prepend]', 'id'=>'prepend', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]', 'class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
+			array('Trunk', array('name'=> 'trunk_id[trunk_id]', 'id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"), array('name'=>'trunk_id[operator]', 'class'=>'update_drp'), 'update_drp_type'),
158 158
 		);
159 159
 
160 160
 		$form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' =>'btn btn-line-parrot pull-right');
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
 		return $form;
164 164
 	}
165 165
 	function origination_rate_batch_update_form() {
166
-	$logintype=$this->CI->session->userdata('userlevel_logintype');
167
-			$trunk=null;
168
-		if($logintype !=1)
169
-	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type');
170
-		$form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
166
+	$logintype = $this->CI->session->userdata('userlevel_logintype');
167
+			$trunk = null;
168
+		if ($logintype != 1)
169
+	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]', 'id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"), array('name'=>'trunk_id[operator]', 'class'=>'update_drp'), 'update_drp_type');
170
+		$form['forms'] = array("rates/origination_rate_batch_update/", array('id' => "origination_rate_batch_update"));        
171 171
 		$form['Batch Update'] = array(
172
-			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
-			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
-			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
-			array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
-			array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]','id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0"),array('name'=>'pricelist_id[operator]','class'=>'update_drp'), 'update_drp_type'),
172
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
+			array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
+			array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]', 'id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name'=>'pricelist_id[operator]', 'class'=>'update_drp'), 'update_drp_type'),
177 177
 		   $trunk,
178 178
 		);
179 179
 
@@ -186,21 +186,21 @@  discard block
 block discarded – undo
186 186
 		 function build_rates_list_for_reseller() {
187 187
 			 
188 188
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
189
-$currency_id=$account_info['currency_id'];
190
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);			 
189
+$currency_id = $account_info['currency_id'];
190
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);			 
191 191
 			 
192
-		$grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
192
+		$grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val", "", "true", "center"),
193 193
 			array('Destination', "240", "comment", "", "", ""),
194
-			array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
195
-			array('Included Seconds', "180", "includedseconds", "", "", "","","true","center"),
196
-			array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency","","true","right"),
197
-			array('Increment', "140", "inc", "", "", "","","true","center"),
198
-			array('Priority', "155", "precedence", "", "", "","","true","center"),
194
+			array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency", "", "true", "right"),
195
+			array('Included Seconds', "180", "includedseconds", "", "", "", "", "true", "center"),
196
+			array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
197
+			array('Increment', "140", "inc", "", "", "", "", "true", "center"),
198
+			array('Priority', "155", "precedence", "", "", "", "", "true", "center"),
199 199
 				));
200 200
 		return $grid_field_arr;
201 201
 	}
202 202
 	function get_reseller_origination_rate_search_form() {
203
-	$accountinfo=$this->CI->session->userdata('accountinfo');
203
+	$accountinfo = $this->CI->session->userdata('accountinfo');
204 204
 	
205 205
 		$form['forms'] = array("", array('id' => "resellerrates_list_search"));
206 206
 		$form['Search My Rates'] = array(
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			array('Initial Increment', 'INPUT', array('name' => 'init_inc[init_inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'init_inc[init_inc-integer]', '', '', '', 'search_int_type', ''),
237 237
 /**************************************************************/
238 238
 			array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
239
-			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")),
239
+			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")),
240 240
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
241 241
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
242 242
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 ASTPP  3.0 
246 246
 Batch Delete
247 247
 ******/
248
-		$form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
248
+		$form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt", 'onclick'=>"check_btn();", 'content' => 'Delete Search Record', 'style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
249 249
 
250 250
 /***********************/
251 251
 /******** 
252 252
 ASTPP  3.0 
253 253
 Batch delete
254 254
 *********/
255
-		$form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
255
+		$form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn", 'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
256 256
 /**************************/
257 257
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
258 258
 
@@ -268,34 +268,34 @@  discard block
 block discarded – undo
268 268
 
269 269
 	function build_termination_rate_for_admin() {
270 270
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
271
-$currency_id=$account_info['currency_id'];
272
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
271
+$currency_id = $account_info['currency_id'];
272
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
273 273
 		
274 274
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
275
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
275
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
276 276
 /**
277 277
 ASTPP  3.0
278 278
 For Termination Rate edit on Code
279 279
 **/
280
-			array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
280
+			array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val", "EDITABLE", "true", "center"),
281 281
 /*********************************/
282
-			array("Destination", "80", "comment", "", "", "","","true","center"),
283
-			array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
284
-			array("Included<br/> Seconds", "70", "includedseconds", "", "", "","","true","center"),
285
-			array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency","","true","right"),
286
-  		array("Initial <br/> Increment", "95", "init_inc", "", "", "","","true","center"),
287
-			array("Increment", "75", "inc", "", "", "","","true","center"),
288
-			array("Priority", "70", "precedence", "", "", "","","true","center"),
289
-			array("Strip","60", "strip", "", "", "","","true","center"),
290
-			array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val","","true","center"),
291
-			array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
282
+			array("Destination", "80", "comment", "", "", "", "", "true", "center"),
283
+			array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency", "", "true", "right"),
284
+			array("Included<br/> Seconds", "70", "includedseconds", "", "", "", "", "true", "center"),
285
+			array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
286
+  		array("Initial <br/> Increment", "95", "init_inc", "", "", "", "", "true", "center"),
287
+			array("Increment", "75", "inc", "", "", "", "", "true", "center"),
288
+			array("Priority", "70", "precedence", "", "", "", "", "true", "center"),
289
+			array("Strip", "60", "strip", "", "", "", "", "true", "center"),
290
+			array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val", "", "true", "center"),
291
+			array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name", "", "true", "center"),
292 292
 		   /*
293 293
             ASTPP  3.0 
294 294
             creation field show in grid
295 295
             */
296
-			array("Status", "100", "status", "status", "outbound_routes", "get_status","","true","center"),
296
+			array("Status", "100", "status", "status", "outbound_routes", "get_status", "", "true", "center"),
297 297
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
298
-			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
298
+			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
299 299
 			/********************************************************************/
300 300
 			 /*
301 301
             ASTPP  3.0
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
        
305 305
 			/***********************************************************************/
306 306
 //             array("Reseller", "103", "reseller_id", "number", "accounts", "get_field_name"),
307
-			array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup","layout"=>"medium"),
307
+			array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup", "layout"=>"medium"),
308 308
 					"DELETE" => array("url" => "rates/termination_rate_delete/", "mode" => "single")))
309 309
 				));
310 310
 		return $grid_field_arr;
@@ -317,36 +317,36 @@  discard block
 block discarded – undo
317 317
    */
318 318
 	function build_origination_rate_list_for_admin() {
319 319
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
320
-$currency_id=$account_info['currency_id'];
321
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
320
+$currency_id = $account_info['currency_id'];
321
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
322 322
 		
323 323
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
324
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
324
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
325 325
 /**
326 326
 ASTPP  3.0 
327 327
 For Origination rate edit on code
328 328
 **/
329
-			array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
329
+			array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val", "EDITABLE", "true", "center"),
330 330
 /************************************/
331
-			array("Destination", "100", "comment", "", "", "","","true","center"),
332
-			array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
333
-			array("Included Seconds", "120", "includedseconds", "", "", "","","true","center"),
334
-			array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
331
+			array("Destination", "100", "comment", "", "", "", "", "true", "center"),
332
+			array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency", "", "true", "right"),
333
+			array("Included Seconds", "120", "includedseconds", "", "", "", "", "true", "center"),
334
+			array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
335 335
 /**
336 336
 ASTPP  3.0 
337 337
 For Add Initial Increment field
338 338
 **/
339
-			array("Initial Increment", "130", "init_inc", "", "", "","","true","center"),
339
+			array("Initial Increment", "130", "init_inc", "", "", "", "", "true", "center"),
340 340
 /*******************************************************************/
341
-			array("Increment", "90", "inc", "", "", "","","true","center"),
341
+			array("Increment", "90", "inc", "", "", "", "", "true", "center"),
342 342
 			//array("Priority", "72", "precedence", "", "", "","","true","center"),
343
-			array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
343
+			array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
344 344
 			/*
345 345
             ASTPP  3.0  creation field show in grid
346 346
             */
347
-			array("Status", "100", "status", "status", "routes", "get_status","","true","center"),
347
+			array("Status", "100", "status", "status", "routes", "get_status", "", "true", "center"),
348 348
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
349
-			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
349
+			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
350 350
 
351 351
 			/********************************************************************/
352 352
 			/*
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             chnage in status active or inactive
355 355
             */
356 356
             
357
-			array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup","layout"=>"medium"),
357
+			array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup", "layout"=>"medium"),
358 358
 					"DELETE" => array("url" => "/rates/origination_rate_delete/", "mode" => "single")))
359 359
 				));
360 360
 		return $grid_field_arr;
@@ -362,21 +362,21 @@  discard block
 block discarded – undo
362 362
 	/****************************************************************************************/
363 363
 
364 364
 	function build_grid_buttons() {
365
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup","medium"),
366
-			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
-			array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
-			array("Import with field map","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import_mapper/", 'single'),
369
-			array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
365
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup", "medium"),
366
+			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
+			array("import", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
+			array("Import with field map", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import_mapper/", 'single'),
369
+			array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
370 370
 			));
371 371
 		return $buttons_json;
372 372
 	}
373 373
 
374 374
 	function build_grid_buttons_origination_rate() {
375
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup","medium"),
376
-			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
377
-			array("import", "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
375
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup", "medium"),
376
+			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
377
+			array("import", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
378 378
 
379
-			array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
379
+			array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
380 380
             
381 381
 			));
382 382
 		return $buttons_json;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	function build_termination_rate_list_for_customer() {
386 386
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
387 387
 		$grid_field_arr = json_encode(array(
388
-			array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
388
+			array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
389 389
 			array("Code", "70", "pattern", "pattern", "", "get_only_numeric_val"),
390 390
 			array("Increment", "75", "inc", "", "", ""),
391 391
 			array("Connect <br> Charge", "100", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 	function build_block_pattern_list_for_customer() {
401 401
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
402 402
 		$grid_field_arr = json_encode(array(
403
-			array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "","","false","center","PatternChkBox"),
403
+			array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center", "PatternChkBox"),
404 404
 			array("Code", "350", "pattern", "pattern", "", "get_only_numeric_val"),
405 405
 			array("Destination", "350", "comment", "", "", ""),
406 406
 				));
407 407
 		return $grid_field_arr;
408 408
 	}
409
-	function build_pattern_list_for_customer($accountid,$accounttype) {
409
+	function build_pattern_list_for_customer($accountid, $accounttype) {
410 410
 
411 411
 		$grid_field_arr = json_encode(array(
412
-			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
412
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
413 413
 			array("Code", "450", "blocked_patterns", "blocked_patterns", "", "get_only_numeric_val"),
414 414
 			array("Destination", "450", "destination", "", "", ""),
415 415
 			array("Action", "100", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/", "mode" => "single")))
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	}
419 419
 
420 420
 	function set_pattern_grid_buttons($accountid) {
421
-		$buttons_json = json_encode(array(array("Add Prefixes","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
421
+		$buttons_json = json_encode(array(array("Add Prefixes", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
422 422
 		return $buttons_json;
423 423
 	}
424 424
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
 
438 438
 function build_grid_buttons_rates() {
439
-		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
439
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
440 440
 		return $buttons_json;
441 441
 	}
442 442
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/controllers/rates.php 3 patches
Braces   +46 added lines, -64 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 		ini_set("memory_limit", "2048M");
38 38
 		ini_set("max_execution_time", "259200");
39 39
 		ini_set("upload_max_filesize", "200M");
40
-		if ($this->session->userdata('user_login') == FALSE) redirect(base_url() . '/astpp/login');
40
+		if ($this->session->userdata('user_login') == FALSE) {
41
+			redirect(base_url() . '/astpp/login');
42
+		}
41 43
 	}
42 44
 
43 45
 	function termination_rates_list()
@@ -125,24 +127,20 @@  discard block
 block discarded – undo
125 127
 							$data['check_header'] = $check_header;
126 128
 							$data['page_title'] = 'Termination Rates Preview';
127 129
 							$this->session->set_userdata('import_termination_rate_csv', $actual_file_name);
128
-						}
129
-						else
130
+						} else
130 131
 						{
131 132
 							$data['error'] = "File Uploading Fail Please Try Again";
132 133
 						}
133 134
 					}
134
-				}
135
-				else
135
+				} else
136 136
 				{
137 137
 					$data['error'] == "File Uploading Fail Please Try Again";
138 138
 				}
139
-			}
140
-			else
139
+			} else
141 140
 			{
142 141
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
143 142
 			}
144
-		}
145
-		else
143
+		} else
146 144
 		{
147 145
 			$invalid_flag = true;
148 146
 		}
@@ -200,8 +198,7 @@  discard block
 block discarded – undo
200 198
 				{
201 199
 					$invalid_array[$i] = $csv_data;
202 200
 					$invalid_array[$i]['error'] = $str;
203
-				}
204
-				else
201
+				} else
205 202
 				{
206 203
 					$csv_data['trunk_id'] = $trunkID;
207 204
 					$csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
@@ -243,8 +240,7 @@  discard block
 block discarded – undo
243 240
 			$data['failure_count'] = count($invalid_array) - 1;
244 241
 			$data['page_title'] = 'Termination Rates Import Error';
245 242
 			$this->load->view('view_import_error', $data);
246
-		}
247
-		else
243
+		} else
248 244
 		{
249 245
 			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!');
250 246
 			redirect(base_url() . "rates/termination_rates_list/");
@@ -316,24 +312,20 @@  discard block
 block discarded – undo
316 312
 							$data['page_title'] = "Origination Rates Preview";
317 313
 							$data['check_header'] = $check_header;
318 314
 							$this->session->set_userdata('import_origination_rate_csv', $actual_file_name);
319
-						}
320
-						else
315
+						} else
321 316
 						{
322 317
 							$data['error'] = "File Uploading Fail Please Try Again";
323 318
 						}
324 319
 					}
325
-				}
326
-				else
320
+				} else
327 321
 				{
328 322
 					$data['error'] == "File Uploading Fail Please Try Again";
329 323
 				}
330
-			}
331
-			else
324
+			} else
332 325
 			{
333 326
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
334 327
 			}
335
-		}
336
-		else
328
+		} else
337 329
 		{
338 330
 			$invalid_flag = true;
339 331
 		}
@@ -393,8 +385,7 @@  discard block
 block discarded – undo
393 385
 				{
394 386
 					$invalid_array[$i] = $csv_data;
395 387
 					$invalid_array[$i]['error'] = $str;
396
-				}
397
-				else
388
+				} else
398 389
 				{
399 390
 					$csv_data['pricelist_id'] = $pricelistID;
400 391
 					$csv_data['trunk_id'] = $trunkid;
@@ -439,8 +430,7 @@  discard block
 block discarded – undo
439 430
 			$data['failure_count'] = count($invalid_array) - 1;
440 431
 			$data['page_title'] = 'Origination Rates Import Error';
441 432
 			$this->load->view('view_import_error', $data);
442
-		}
443
-		else
433
+		} else
444 434
 		{
445 435
 			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Origination rates imported successfully!');
446 436
 			redirect(base_url() . "rates/origination_rates_list/");
@@ -470,13 +460,11 @@  discard block
 block discarded – undo
470 460
 				$count = count($error_field);
471 461
 				$str.= $count > 1 ? ' are not valid' : ' is not Valid';
472 462
 				return $str;
473
-			}
474
-			else
463
+			} else
475 464
 			{
476 465
 				return false;
477 466
 			}
478
-		}
479
-		else
467
+		} else
480 468
 		{
481 469
 			$str = rtrim($str, ',');
482 470
 			$error_field = explode(',', $str);
@@ -515,8 +503,7 @@  discard block
 block discarded – undo
515 503
 				'id' => $edit_id,
516 504
 				"reseller_id" => $reseller
517 505
 			);
518
-		}
519
-		else
506
+		} else
520 507
 		{
521 508
 			$where = array(
522 509
 				'id' => $edit_id
@@ -536,8 +523,7 @@  discard block
 block discarded – undo
536 523
 			$edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
537 524
 			$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields() , $edit_data);
538 525
 			$this->load->view('view_origination_rate_add_edit', $data);
539
-		}
540
-		else
526
+		} else
541 527
 		{
542 528
 			redirect(base_url() . 'rates/origination_rate_list/');
543 529
 		}
@@ -555,8 +541,7 @@  discard block
 block discarded – undo
555 541
 				$data['validation_errors'] = validation_errors();
556 542
 				echo $data['validation_errors'];
557 543
 				exit;
558
-			}
559
-			else
544
+			} else
560 545
 			{
561 546
 				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
562 547
 				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
@@ -566,8 +551,7 @@  discard block
 block discarded – undo
566 551
 				));
567 552
 				exit;
568 553
 			}
569
-		}
570
-		else
554
+		} else
571 555
 		{
572 556
 			$data['page_title'] = 'Add Origination Rate';
573 557
 			if ($this->form_validation->run() == FALSE)
@@ -575,8 +559,7 @@  discard block
 block discarded – undo
575 559
 				$data['validation_errors'] = validation_errors();
576 560
 				echo $data['validation_errors'];
577 561
 				exit;
578
-			}
579
-			else
562
+			} else
580 563
 			{
581 564
 				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
582 565
 				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
@@ -715,8 +698,7 @@  discard block
 block discarded – undo
715 698
 				$data['validation_errors'] = validation_errors();
716 699
 				echo $data['validation_errors'];
717 700
 				exit;
718
-			}
719
-			else
701
+			} else
720 702
 			{
721 703
 				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
722 704
 				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
@@ -726,8 +708,7 @@  discard block
 block discarded – undo
726 708
 				));
727 709
 				exit;
728 710
 			}
729
-		}
730
-		else
711
+		} else
731 712
 		{
732 713
 			$data['page_title'] = 'Add Termination Rate';
733 714
 			if ($this->form_validation->run() == FALSE)
@@ -735,8 +716,7 @@  discard block
 block discarded – undo
735 716
 				$data['validation_errors'] = validation_errors();
736 717
 				echo $data['validation_errors'];
737 718
 				exit;
738
-			}
739
-			else
719
+			} else
740 720
 			{
741 721
 				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
742 722
 				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
@@ -783,11 +763,15 @@  discard block
 block discarded – undo
783 763
 		);
784 764
 		$instant_search = $this->session->userdata('left_panel_search_' . $accounttype . '_pattern');
785 765
 		$like_str = !empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
786
-		if (!empty($like_str)) $this->db->where($like_str);
766
+		if (!empty($like_str)) {
767
+			$this->db->where($like_str);
768
+		}
787 769
 		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
788 770
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
789 771
 		$json_data = $paging_data["json_paging"];
790
-		if (!empty($like_str)) $this->db->where($like_str);
772
+		if (!empty($like_str)) {
773
+			$this->db->where($like_str);
774
+		}
791 775
 		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
792 776
 		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype));
793 777
 		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
@@ -1371,15 +1355,20 @@  discard block
 block discarded – undo
1371 1355
 
1372 1356
 	function csv_to_array($filename = '', $delimiter = ',')
1373 1357
 	{
1374
-		if (!file_exists($filename) || !is_readable($filename)) return FALSE;
1358
+		if (!file_exists($filename) || !is_readable($filename)) {
1359
+			return FALSE;
1360
+		}
1375 1361
 		$header = NULL;
1376 1362
 		$data = array();
1377 1363
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1378 1364
 		{
1379 1365
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1380 1366
 			{
1381
-				if (!$header) $header = $row;
1382
-				else $data[] = array_combine($header, $row);
1367
+				if (!$header) {
1368
+					$header = $row;
1369
+				} else {
1370
+					$data[] = array_combine($header, $row);
1371
+				}
1383 1372
 			}
1384 1373
 
1385 1374
 			fclose($handle);
@@ -1449,25 +1438,21 @@  discard block
 block discarded – undo
1449 1438
 							$data['check_header'] = $check_header;
1450 1439
 							$data['page_title'] = 'Map CSV to Termination Rates';
1451 1440
 							$this->session->set_userdata('import_termination_rate_mapper_csv', $actual_file_name);
1452
-						}
1453
-						else
1441
+						} else
1454 1442
 						{   print_r(error_get_last());
1455 1443
 							$data['error'] = "File Uploading Fail Please Try Again";
1456 1444
 						}
1457 1445
 					}
1458
-				}
1459
-				else
1446
+				} else
1460 1447
 				{
1461 1448
 					$data['error'] == "File Uploading Fail Please Try Again";
1462 1449
 				}
1463
-			}
1464
-			else
1450
+			} else
1465 1451
 			{
1466 1452
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
1467 1453
 
1468 1454
 			}
1469
-		}
1470
-		else
1455
+		} else
1471 1456
 		{
1472 1457
 			$invalid_flag = true;
1473 1458
 		}
@@ -1548,8 +1533,7 @@  discard block
 block discarded – undo
1548 1533
 				{
1549 1534
 					$invalid_array[$i] = $csv_data;
1550 1535
 					$invalid_array[$i]['error'] = $str;
1551
-				}
1552
-				else
1536
+				} else
1553 1537
 				{
1554 1538
 					$new_final_arr[$i]['trunk_id'] = $trunkID;
1555 1539
 					$new_final_arr[$i]['pattern'] = "^" . $csv_data['pattern'] . ".*";
@@ -1571,8 +1555,7 @@  discard block
 block discarded – undo
1571 1555
 		if (!empty($new_final_arr))
1572 1556
 		{
1573 1557
 			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
1574
-		}
1575
-        		else
1558
+		} else
1576 1559
         		{
1577 1560
 		    echo "Nothing Selected!";
1578 1561
 		    exit;
@@ -1604,8 +1587,7 @@  discard block
 block discarded – undo
1604 1587
 			$data['failure_count'] = count($invalid_array) - 1;
1605 1588
 			$data['page_title'] = 'Termination Rates Import Error';
1606 1589
 			$this->load->view('view_import_error', $data);
1607
-		}
1608
-		else
1590
+		} else
1609 1591
 		{
1610 1592
 			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!');
1611 1593
 			redirect(base_url() . "rates/termination_rate_list/");
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
 					// $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
1430 1430
 
1431 1431
 					$csv_data = $this->utf8_converter($this->csvreader->parse_file($uploadedFile, $field_select, $check_header));
1432
-        			if (!empty($csv_data))
1432
+					if (!empty($csv_data))
1433 1433
 					{
1434 1434
 						$full_path = $this->config->item('rates-file-path');
1435 1435
 						$actual_file_name = "ASTPP-TERMINATION-RATES-" . date("Y-m-d H:i:s") . "." . $ext;
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
 		{
1567 1567
 			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
1568 1568
 		}
1569
-        		else
1570
-        {
1569
+				else
1570
+		{
1571 1571
 
1572
-           $this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
1573
-           redirect(base_url() . 'rates/termination_rates_list/');
1572
+		   $this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
1573
+		   redirect(base_url() . 'rates/termination_rates_list/');
1574 1574
 		}
1575 1575
 
1576 1576
 		unlink($full_path . $terminationrate_file_name);
Please login to merge, or discard this patch.
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		ini_set("memory_limit", "2048M");
38 38
 		ini_set("max_execution_time", "259200");
39 39
 		ini_set("upload_max_filesize", "200M");
40
-		if ($this->session->userdata('user_login') == FALSE) redirect(base_url() . '/astpp/login');
40
+		if ($this->session->userdata('user_login') == FALSE) redirect(base_url().'/astpp/login');
41 41
 	}
42 42
 
43 43
 	function termination_rates_list()
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 		$check_header = $this->input->post('check_header', true);
100 100
 		$data['page_title'] = 'Import Termination Rates';
101 101
 		$new_final_arr_key = $this->config->item('Termination-rates-field');
102
-		if (empty($_FILES) || !isset($_FILES))
102
+		if (empty($_FILES) || ! isset($_FILES))
103 103
 		{
104
-			redirect(base_url() . "rates/termination_rates_list/");
104
+			redirect(base_url()."rates/termination_rates_list/");
105 105
 		}
106 106
 
107 107
 		if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" && isset($_POST['trunk_id']) && $_POST['trunk_id'] != '')
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 				{
115 115
 					$uploadedFile = $_FILES["termination_rate_import"]["tmp_name"];
116 116
 					$csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
117
-					if (!empty($csv_data))
117
+					if ( ! empty($csv_data))
118 118
 					{
119 119
 						$full_path = $this->config->item('rates-file-path');
120
-						$actual_file_name = "ASTPP-TERMINATION-RATES-" . date("Y-m-d-H:i:s") . "." . $ext;
121
-						if (move_uploaded_file($uploadedFile, $full_path . $actual_file_name))
120
+						$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d-H:i:s").".".$ext;
121
+						if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name))
122 122
 						{
123 123
 							$data['csv_tmp_data'] = $csv_data;
124 124
 							$data['trunkid'] = $_POST['trunk_id'];
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 		if ($invalid_flag)
151 151
 		{
152 152
 			$str = '';
153
-			if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id']))
153
+			if ( ! isset($_POST['trunk_id']) || empty($_POST['trunk_id']))
154 154
 			{
155
-				$str.= '<br/>Please Create Trunk.';
155
+				$str .= '<br/>Please Create Trunk.';
156 156
 			}
157 157
 
158 158
 			if (empty($_FILES['termination_rate_import']['name']))
159 159
 			{
160
-				$str.= '<br/>Please Select  File.';
160
+				$str .= '<br/>Please Select  File.';
161 161
 			}
162 162
 
163 163
 			$data['error'] = $str;
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 
180 180
 		$full_path = $this->config->item('rates-file-path');
181 181
 		$terminationrate_file_name = $this->session->userdata('import_termination_rate_csv');
182
-		$csv_tmp_data = $this->csvreader->parse_file($full_path . $terminationrate_file_name, $new_final_arr_key, $check_header);
182
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header);
183 183
 		$i = 0;
184
-		foreach($csv_tmp_data as $key => $csv_data)
184
+		foreach ($csv_tmp_data as $key => $csv_data)
185 185
 		{
186 186
 			if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0)
187 187
 			{
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				$csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : '';
191 191
 				$csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0;
192 192
 				$csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
193
-				$csv_data['cost'] = !empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
193
+				$csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
194 194
 				$csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
195 195
 				$csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
196 196
 				$csv_data['strip'] = isset($csv_data['strip']) ? $csv_data['strip'] : '';
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 				else
205 205
 				{
206 206
 					$csv_data['trunk_id'] = $trunkID;
207
-					$csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
207
+					$csv_data['pattern'] = "^".$csv_data['pattern'].".*";
208 208
 					$new_final_arr[$i] = $csv_data;
209 209
 				}
210 210
 			}
@@ -212,31 +212,31 @@  discard block
 block discarded – undo
212 212
 			$i++;
213 213
 		}
214 214
 
215
-		if (!empty($new_final_arr))
215
+		if ( ! empty($new_final_arr))
216 216
 		{
217 217
 			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
218 218
 		}
219 219
 
220
-		unlink($full_path . $terminationrate_file_name);
220
+		unlink($full_path.$terminationrate_file_name);
221 221
 		$count = count($invalid_array);
222 222
 		if ($count > 0)
223 223
 		{
224 224
 			$session_id = "-1";
225
-			$fp = fopen($full_path . $session_id . '.csv', 'w');
226
-			foreach($new_final_arr_key as $key => $value)
225
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
226
+			foreach ($new_final_arr_key as $key => $value)
227 227
 			{
228 228
 				$custom_array[0][$key] = ucfirst($key);
229 229
 			}
230 230
 
231 231
 			$custom_array[0]['error'] = "Error";
232 232
 			$invalid_array = array_merge($custom_array, $invalid_array);
233
-			foreach($invalid_array as $err_data)
233
+			foreach ($invalid_array as $err_data)
234 234
 			{
235 235
 				fputcsv($fp, $err_data);
236 236
 			}
237 237
 
238 238
 			fclose($fp);
239
-			$this->session->set_userdata('import_termination_rate_csv_error', $session_id . ".csv");
239
+			$this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv");
240 240
 			$data["error"] = $invalid_array;
241 241
 			$data['trunkid'] = $trunkID;
242 242
 			$data['impoted_count'] = count($new_final_arr);
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 		}
247 247
 		else
248 248
 		{
249
-			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!');
250
-			redirect(base_url() . "rates/termination_rates_list/");
249
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
250
+			redirect(base_url()."rates/termination_rates_list/");
251 251
 		}
252 252
 	}
253 253
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		$this->load->helper('download');
257 257
 		$error_data = $this->session->userdata('import_termination_rate_csv_error');
258 258
 		$full_path = $this->config->item('rates-file-path');
259
-		$data = file_get_contents($full_path . $error_data);
259
+		$data = file_get_contents($full_path.$error_data);
260 260
 		force_download("Termination_rate_error.csv", $data);
261 261
 	}
262 262
 
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 		$this->session->set_userdata('import_origination_rate_csv', "");
267 267
 		$error_data = $this->session->userdata('import_origination_rate_csv_error');
268 268
 		$full_path = $this->config->item('rates-file-path');
269
-		if (file_exists($full_path . $error_data) && $error_data != "")
269
+		if (file_exists($full_path.$error_data) && $error_data != "")
270 270
 		{
271
-			unlink($full_path . $error_data);
271
+			unlink($full_path.$error_data);
272 272
 			$this->session->set_userdata('import_origination_rate_csv_error', "");
273 273
 		}
274 274
 
@@ -281,14 +281,14 @@  discard block
 block discarded – undo
281 281
 		$data = array();
282 282
 		$data['page_title'] = 'Import Origination Rates';
283 283
 		$check_header = $this->input->post('check_header', true);
284
-		if (empty($_FILES) || !isset($_FILES))
284
+		if (empty($_FILES) || ! isset($_FILES))
285 285
 		{
286
-			redirect(base_url() . "rates/origination_rate_list/");
286
+			redirect(base_url()."rates/origination_rate_list/");
287 287
 		}
288 288
 
289 289
 		$get_extension = strpos($_FILES['origination_rate_import']['name'], '.');
290 290
 		$new_final_arr_key = $this->config->item('Origination-rates-field');
291
-		if (!$get_extension)
291
+		if ( ! $get_extension)
292 292
 		{
293 293
 			$data['error'] = "Please Upload File Atleast";
294 294
 		}
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 				{
304 304
 					$uploadedFile = $_FILES["origination_rate_import"]["tmp_name"];
305 305
 					$csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
306
-					if (!empty($csv_data))
306
+					if ( ! empty($csv_data))
307 307
 					{
308 308
 						$full_path = $this->config->item('rates-file-path');
309
-						$actual_file_name = "ASTPP-ORIGIN-RATES-" . date("Y-m-d H:i:s") . "." . $ext;
310
-						if (move_uploaded_file($uploadedFile, $full_path . $actual_file_name))
309
+						$actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s").".".$ext;
310
+						if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name))
311 311
 						{
312 312
 							$flag = false;
313 313
 							$data['trunkid'] = isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0;
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 		if ($invalid_flag)
342 342
 		{
343 343
 			$str = '';
344
-			if (!isset($_POST['pricelist_id']) || empty($_POST['pricelist_id']))
344
+			if ( ! isset($_POST['pricelist_id']) || empty($_POST['pricelist_id']))
345 345
 			{
346
-				$str.= '<br/>Please Create Rate Group.';
346
+				$str .= '<br/>Please Create Rate Group.';
347 347
 			}
348 348
 
349 349
 			if (empty($_FILES['origination_rate_import']['name']))
350 350
 			{
351
-				$str.= '<br/>Please Select File.';
351
+				$str .= '<br/>Please Select File.';
352 352
 			}
353 353
 
354 354
 			$data['error'] = $str;
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 
372 372
 		$full_path = $this->config->item('rates-file-path');
373 373
 		$originationrate_file_name = $this->session->userdata('import_origination_rate_csv');
374
-		$csv_tmp_data = $this->csvreader->parse_file($full_path . $originationrate_file_name, $new_final_arr_key, $check_header);
374
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name, $new_final_arr_key, $check_header);
375 375
 
376 376
 		// echo "<pre>";print_r($csv_tmp_data);exit;
377 377
 
378 378
 		$i = 0;
379
-		foreach($csv_tmp_data as $key => $csv_data)
379
+		foreach ($csv_tmp_data as $key => $csv_data)
380 380
 		{
381 381
 			if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0)
382 382
 			{
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 				$csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : '';
385 385
 				$csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0;
386 386
 				$csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
387
-				$csv_data['cost'] = !empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
387
+				$csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
388 388
 				$csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
389 389
 				$csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
390 390
 				$csv_data['last_modified_date'] = date("Y-m-d H:i:s");
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 				{
399 399
 					$csv_data['pricelist_id'] = $pricelistID;
400 400
 					$csv_data['trunk_id'] = $trunkid;
401
-					$csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
401
+					$csv_data['pattern'] = "^".$csv_data['pattern'].".*";
402 402
 					$csv_data['reseller_id'] = $reseller_id;
403 403
 					$csv_data['creation_date'] = gmdate('Y-m-d H:i:s');
404 404
 					$new_final_arr[$i] = $csv_data;
@@ -408,31 +408,31 @@  discard block
 block discarded – undo
408 408
 			$i++;
409 409
 		}
410 410
 
411
-		if (!empty($new_final_arr))
411
+		if ( ! empty($new_final_arr))
412 412
 		{
413 413
 			$result = $this->rates_model->bulk_insert_origination_rate($new_final_arr);
414 414
 		}
415 415
 
416
-		unlink($full_path . $originationrate_file_name);
416
+		unlink($full_path.$originationrate_file_name);
417 417
 		$count = count($invalid_array);
418 418
 		if ($count > 0)
419 419
 		{
420 420
 			$session_id = "-1";
421
-			$fp = fopen($full_path . $session_id . '.csv', 'w');
422
-			foreach($new_final_arr_key as $key => $value)
421
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
422
+			foreach ($new_final_arr_key as $key => $value)
423 423
 			{
424 424
 				$custom_array[0][$key] = ucfirst($key);
425 425
 			}
426 426
 
427 427
 			$custom_array[0]['error'] = "Error";
428 428
 			$invalid_array = array_merge($custom_array, $invalid_array);
429
-			foreach($invalid_array as $err_data)
429
+			foreach ($invalid_array as $err_data)
430 430
 			{
431 431
 				fputcsv($fp, $err_data);
432 432
 			}
433 433
 
434 434
 			fclose($fp);
435
-			$this->session->set_userdata('import_origination_rate_csv_error', $session_id . ".csv");
435
+			$this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv");
436 436
 			$data["error"] = $invalid_array;
437 437
 			$data['pricelistid'] = $pricelistID;
438 438
 			$data['impoted_count'] = count($new_final_arr);
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 		}
443 443
 		else
444 444
 		{
445
-			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Origination rates imported successfully!');
446
-			redirect(base_url() . "rates/origination_rates_list/");
445
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Origination rates imported successfully!');
446
+			redirect(base_url()."rates/origination_rates_list/");
447 447
 		}
448 448
 	}
449 449
 
@@ -453,22 +453,22 @@  discard block
 block discarded – undo
453 453
 		$alpha_regex = "/^[a-z ,.'-]+$/i";
454 454
 		$alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i";
455 455
 		$email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/";
456
-		$str.= $csvdata['pattern'] != '' ? null : 'Code,';
456
+		$str .= $csvdata['pattern'] != '' ? null : 'Code,';
457 457
 		$str = rtrim($str, ',');
458
-		if (!$str)
458
+		if ( ! $str)
459 459
 		{
460
-			$str.= is_numeric($csvdata['pattern']) ? null : 'Code,';
461
-			$str.= !empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,');
462
-			$str.= !empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
463
-			$str.= !empty($csvdata['inc']) && is_numeric($csvdata['inc']) ? null : (empty($csvdata['inc']) ? null : 'Increment,');
464
-			$str.= !empty($csvdata['precedence']) && is_numeric($csvdata['precedence']) ? null : (empty($csvdata['precedence']) ? null : 'Precedence,');
465
-			$str.= (isset($csvdata['strip']) && !empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null : 'Strip,') : null;
460
+			$str .= is_numeric($csvdata['pattern']) ? null : 'Code,';
461
+			$str .= ! empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,');
462
+			$str .= ! empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
463
+			$str .= ! empty($csvdata['inc']) && is_numeric($csvdata['inc']) ? null : (empty($csvdata['inc']) ? null : 'Increment,');
464
+			$str .= ! empty($csvdata['precedence']) && is_numeric($csvdata['precedence']) ? null : (empty($csvdata['precedence']) ? null : 'Precedence,');
465
+			$str .= (isset($csvdata['strip']) && ! empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null : 'Strip,') : null;
466 466
 			if ($str)
467 467
 			{
468 468
 				$str = rtrim($str, ',');
469 469
 				$error_field = explode(',', $str);
470 470
 				$count = count($error_field);
471
-				$str.= $count > 1 ? ' are not valid' : ' is not Valid';
471
+				$str .= $count > 1 ? ' are not valid' : ' is not Valid';
472 472
 				return $str;
473 473
 			}
474 474
 			else
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			$str = rtrim($str, ',');
482 482
 			$error_field = explode(',', $str);
483 483
 			$count = count($error_field);
484
-			$str.= $count > 1 ? ' are required' : ' is Required';
484
+			$str .= $count > 1 ? ' are required' : ' is Required';
485 485
 			return $str;
486 486
 		}
487 487
 	}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 		$this->load->helper('download');
492 492
 		$error_data = $this->session->userdata('import_origination_rate_csv_error');
493 493
 		$full_path = $this->config->item('rates-file-path');
494
-		$data = file_get_contents($full_path . $error_data);
494
+		$data = file_get_contents($full_path.$error_data);
495 495
 		force_download("Origination_rate_error.csv", $data);
496 496
 	}
497 497
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		$data['username'] = $this->session->userdata('user_name');
501 501
 		$data['flag'] = 'create';
502 502
 		$data['page_title'] = 'Create Origination Rate';
503
-		$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields() , '');
503
+		$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), '');
504 504
 		$this->load->view('view_origination_rate_add_edit', $data);
505 505
 	}
506 506
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		$account = $this->db_model->getSelect("*", "routes", $where);
527 527
 		if ($account->num_rows > 0)
528 528
 		{
529
-			foreach($account->result_array() as $key => $value)
529
+			foreach ($account->result_array() as $key => $value)
530 530
 			{
531 531
 				$edit_data = $value;
532 532
 			}
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
 			$edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', true, false);
535 535
 			$edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '', true, false);
536 536
 			$edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
537
-			$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields() , $edit_data);
537
+			$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data);
538 538
 			$this->load->view('view_origination_rate_add_edit', $data);
539 539
 		}
540 540
 		else
541 541
 		{
542
-			redirect(base_url() . 'rates/origination_rate_list/');
542
+			redirect(base_url().'rates/origination_rate_list/');
543 543
 		}
544 544
 	}
545 545
 
546 546
 	function origination_rate_save()
547 547
 	{
548 548
 		$add_array = $this->input->post();
549
-		$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields() , $add_array);
549
+		$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $add_array);
550 550
 		if ($add_array['id'] != '')
551 551
 		{
552 552
 			$data['page_title'] = 'Edit Origination Rate';
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		if (@$ajax_search != 1)
605 605
 		{
606
-			redirect(base_url() . 'rates/origination_rates_list/');
606
+			redirect(base_url().'rates/origination_rates_list/');
607 607
 		}
608 608
 	}
609 609
 
@@ -617,14 +617,14 @@  discard block
 block discarded – undo
617 617
 	{
618 618
 		$this->rates_model->remove_termination_rate($id);
619 619
 		$this->session->set_flashdata('astpp_notification', 'Termination removed successfully!');
620
-		redirect(base_url() . '/rates/termination_rates_list/');
620
+		redirect(base_url().'/rates/termination_rates_list/');
621 621
 	}
622 622
 
623 623
 	function origination_rate_delete($id)
624 624
 	{
625 625
 		$this->rates_model->remove_origination_rate($id);
626 626
 		$this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!');
627
-		redirect(base_url() . 'rates/origination_rates_list/');
627
+		redirect(base_url().'rates/origination_rates_list/');
628 628
 	}
629 629
 
630 630
 	function origination_rates_list()
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		$data['username'] = $this->session->userdata('user_name');
681 681
 		$data['flag'] = 'create';
682 682
 		$data['page_title'] = 'Create Termination Rate';
683
-		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields() , '');
683
+		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), '');
684 684
 		$this->load->view('view_termination_rate_add_edit', $data);
685 685
 	}
686 686
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 			'id' => $edit_id
692 692
 		);
693 693
 		$account = $this->db_model->getSelect("*", "outbound_routes", $where);
694
-		foreach($account->result_array() as $key => $value)
694
+		foreach ($account->result_array() as $key => $value)
695 695
 		{
696 696
 			$edit_data = $value;
697 697
 		}
@@ -699,14 +699,14 @@  discard block
 block discarded – undo
699 699
 		$edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', false, false);
700 700
 		$edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '', false, false);
701 701
 		$edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
702
-		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields() , $edit_data);
702
+		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $edit_data);
703 703
 		$this->load->view('view_termination_rate_add_edit', $data);
704 704
 	}
705 705
 
706 706
 	function termination_rate_save()
707 707
 	{
708 708
 		$add_array = $this->input->post();
709
-		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields() , $add_array);
709
+		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $add_array);
710 710
 		if ($add_array['id'] != '')
711 711
 		{
712 712
 			$data['page_title'] = 'Edit Termination Rate';
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 
766 766
 		if (@$ajax_search != 1)
767 767
 		{
768
-			redirect(base_url() . 'rates/termination_rates_list/');
768
+			redirect(base_url().'rates/termination_rates_list/');
769 769
 		}
770 770
 	}
771 771
 
@@ -781,13 +781,13 @@  discard block
 block discarded – undo
781 781
 		$where = array(
782 782
 			'accountid' => $accountid
783 783
 		);
784
-		$instant_search = $this->session->userdata('left_panel_search_' . $accounttype . '_pattern');
785
-		$like_str = !empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
786
-		if (!empty($like_str)) $this->db->where($like_str);
784
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_pattern');
785
+		$like_str = ! empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
786
+		if ( ! empty($like_str)) $this->db->where($like_str);
787 787
 		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
788 788
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
789 789
 		$json_data = $paging_data["json_paging"];
790
-		if (!empty($like_str)) $this->db->where($like_str);
790
+		if ( ! empty($like_str)) $this->db->where($like_str);
791 791
 		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
792 792
 		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype));
793 793
 		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
@@ -823,15 +823,15 @@  discard block
 block discarded – undo
823 823
 		$json_data = $paging_data["json_paging"];
824 824
 		$query = $this->rates_model->get_origination_rate_list_for_user(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
825 825
 		$grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user());
826
-		foreach($query->result_array() as $key => $value)
826
+		foreach ($query->result_array() as $key => $value)
827 827
 		{
828 828
 			$json_data['rows'][] = array(
829 829
 				'cell' => array(
830
-					$this->common->get_only_numeric_val("", "", $value["pattern"]) ,
830
+					$this->common->get_only_numeric_val("", "", $value["pattern"]),
831 831
 					$value['comment'],
832 832
 					$value['inc'],
833
-					$this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100) , '', '', '', true) ,
834
-					$this->common_model->calculate_currency($value['connectcost'], '', '', '', true) ,
833
+					$this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', '', true),
834
+					$this->common_model->calculate_currency($value['connectcost'], '', '', '', true),
835 835
 					$value['includedseconds']
836 836
 				)
837 837
 			);
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 		if (@$ajax_search != 1)
858 858
 		{
859
-			redirect(base_url() . 'user/user_rates_list/');
859
+			redirect(base_url().'user/user_rates_list/');
860 860
 		}
861 861
 	}
862 862
 
@@ -869,12 +869,12 @@  discard block
 block discarded – undo
869 869
 	function customer_rates_download_sample_file($file_name)
870 870
 	{
871 871
 		$this->load->helper('download');
872
-		$full_path = base_url() . "assets/Rates_File/" . $file_name . ".csv";
872
+		$full_path = base_url()."assets/Rates_File/".$file_name.".csv";
873 873
 		$arrContextOptions = array(
874 874
 			"ssl" => array(
875 875
 				"verify_peer" => false,
876 876
 				"verify_peer_name" => false,
877
-			) ,
877
+			),
878 878
 		);
879 879
 		$file = file_get_contents($full_path, false, stream_context_create($arrContextOptions));
880 880
 		force_download("samplefile.csv", $file);
@@ -934,17 +934,17 @@  discard block
 block discarded – undo
934 934
 		);
935 935
 		if ($query->num_rows() > 0)
936 936
 		{
937
-			foreach($query->result_array() as $row)
937
+			foreach ($query->result_array() as $row)
938 938
 			{
939 939
 
940 940
 				// echo"<pre>";print_r($row);exit;
941 941
 
942 942
 				$outbound_array[] = array(
943
-					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]) ,
943
+					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
944 944
 					$row['comment'],
945
-					$this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false) ,
945
+					$this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false),
946 946
 					$row['includedseconds'],
947
-					$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false) ,
947
+					$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false),
948 948
 					/**
949 949
 					 ASTPP  3.0
950 950
 					 For Add Initial Increment field
@@ -959,15 +959,15 @@  discard block
 block discarded – undo
959 959
 
960 960
 					// $row['trunk_id'],
961 961
 
962
-					$this->common->get_field_name('name', 'trunks', $row["trunk_id"]) ,
963
-					$this->common->get_status('export', '', $row['status']) ,
962
+					$this->common->get_field_name('name', 'trunks', $row["trunk_id"]),
963
+					$this->common->get_status('export', '', $row['status']),
964 964
 					$row['creation_date'],
965 965
 				);
966 966
 			}
967 967
 		}
968 968
 
969 969
 		$this->load->helper('csv');
970
-		array_to_csv($outbound_array, 'Termination_Rates_' . date("Y-m-d") . '.csv');
970
+		array_to_csv($outbound_array, 'Termination_Rates_'.date("Y-m-d").'.csv');
971 971
 	}
972 972
 
973 973
 	function termination_rate_export_cdr_pdf()
@@ -1003,14 +1003,14 @@  discard block
 block discarded – undo
1003 1003
 		);
1004 1004
 		if ($query->num_rows() > 0)
1005 1005
 		{
1006
-			foreach($query->result_array() as $row)
1006
+			foreach ($query->result_array() as $row)
1007 1007
 			{
1008 1008
 				$outbound_array[] = array(
1009
-					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]) ,
1009
+					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1010 1010
 					$row['comment'],
1011 1011
 					$row['connectcost'],
1012 1012
 					$row['includedseconds'],
1013
-					$this->common_model->calculate_currency($row['cost']) ,
1013
+					$this->common_model->calculate_currency($row['cost']),
1014 1014
 					/**
1015 1015
 					 ASTPP  3.0
1016 1016
 					 For Add Initial Increment field
@@ -1030,13 +1030,13 @@  discard block
 block discarded – undo
1030 1030
 		$this->fpdf->AddPage();
1031 1031
 		$this->fpdf->SetFont('Arial', '', 15);
1032 1032
 		$this->fpdf->SetXY(60, 5);
1033
-		$this->fpdf->Cell(100, 10, "Outbound Rates Report " . date('Y-m-d'));
1033
+		$this->fpdf->Cell(100, 10, "Outbound Rates Report ".date('Y-m-d'));
1034 1034
 		$this->fpdf->SetY(20);
1035 1035
 		$this->fpdf->SetFont('Arial', '', 7);
1036 1036
 		$this->fpdf->SetFillColor(255, 255, 255);
1037 1037
 		$this->fpdf->lMargin = 2;
1038 1038
 		$dimensions = $this->fpdf->export_pdf($outbound_array, "7");
1039
-		$this->fpdf->Output('Termination_Rate_' . date("Y-m-d") . '.pdf', "D");
1039
+		$this->fpdf->Output('Termination_Rate_'.date("Y-m-d").'.pdf', "D");
1040 1040
 	}
1041 1041
 
1042 1042
 	function origination_rate_export_cdr_xls()
@@ -1064,17 +1064,17 @@  discard block
 block discarded – undo
1064 1064
 		);
1065 1065
 		if ($query->num_rows() > 0)
1066 1066
 		{
1067
-			foreach($query->result_array() as $row)
1067
+			foreach ($query->result_array() as $row)
1068 1068
 			{
1069 1069
 
1070 1070
 				// echo"<pre>";print_r($row);exit;
1071 1071
 
1072 1072
 				$inbound_array[] = array(
1073
-					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]) ,
1073
+					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1074 1074
 					$row['comment'],
1075
-					$this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false) ,
1075
+					$this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false),
1076 1076
 					$row['includedseconds'],
1077
-					$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false) ,
1077
+					$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false),
1078 1078
 					/**
1079 1079
 					 ASTPP  3.0
1080 1080
 					 For Add Initial Increment field
@@ -1086,15 +1086,15 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 					// $row['precedence'],
1088 1088
 
1089
-					$this->common->get_field_name('name', 'pricelists', $row['pricelist_id']) ,
1090
-					$this->common->get_status('export', '', $row['status']) ,
1089
+					$this->common->get_field_name('name', 'pricelists', $row['pricelist_id']),
1090
+					$this->common->get_status('export', '', $row['status']),
1091 1091
 					$row['creation_date'],
1092 1092
 				);
1093 1093
 			}
1094 1094
 		}
1095 1095
 
1096 1096
 		$this->load->helper('csv');
1097
-		array_to_csv($inbound_array, 'Origination_Rates_' . date("Y-m-d") . '.csv');
1097
+		array_to_csv($inbound_array, 'Origination_Rates_'.date("Y-m-d").'.csv');
1098 1098
 	}
1099 1099
 
1100 1100
 	function origination_rate_export_cdr_pdf()
@@ -1124,14 +1124,14 @@  discard block
 block discarded – undo
1124 1124
 		);
1125 1125
 		if ($query->num_rows() > 0)
1126 1126
 		{
1127
-			foreach($query->result_array() as $row)
1127
+			foreach ($query->result_array() as $row)
1128 1128
 			{
1129 1129
 				$inbound_array[] = array(
1130
-					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]) ,
1130
+					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1131 1131
 					$row['comment'],
1132 1132
 					$row['connectcost'],
1133 1133
 					$row['includedseconds'],
1134
-					$this->common_model->calculate_currency($row['cost'], '', '', '', false) ,
1134
+					$this->common_model->calculate_currency($row['cost'], '', '', '', false),
1135 1135
 					/**
1136 1136
 					 ASTPP  3.0
1137 1137
 					 For Add Initial Increment field
@@ -1148,13 +1148,13 @@  discard block
 block discarded – undo
1148 1148
 		$this->fpdf->AddPage();
1149 1149
 		$this->fpdf->SetFont('Arial', '', 15);
1150 1150
 		$this->fpdf->SetXY(60, 5);
1151
-		$this->fpdf->Cell(100, 10, "Origination Rates Report " . date('Y-m-d'));
1151
+		$this->fpdf->Cell(100, 10, "Origination Rates Report ".date('Y-m-d'));
1152 1152
 		$this->fpdf->SetY(20);
1153 1153
 		$this->fpdf->SetFont('Arial', '', 7);
1154 1154
 		$this->fpdf->SetFillColor(255, 255, 255);
1155 1155
 		$this->fpdf->lMargin = 2;
1156 1156
 		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
1157
-		$this->fpdf->Output('Origination_Rate_' . date("Y-m-d") . '.pdf', "D");
1157
+		$this->fpdf->Output('Origination_Rate_'.date("Y-m-d").'.pdf', "D");
1158 1158
 	}
1159 1159
 
1160 1160
 	function user_origination_rate_cdr_pdf()
@@ -1183,13 +1183,13 @@  discard block
 block discarded – undo
1183 1183
 		);
1184 1184
 		if ($query->num_rows() > 0)
1185 1185
 		{
1186
-			foreach($query->result_array() as $row)
1186
+			foreach ($query->result_array() as $row)
1187 1187
 			{
1188 1188
 				$inbound_array[] = array(
1189
-					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]) ,
1189
+					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1190 1190
 					$row['comment'],
1191 1191
 					$row['inc'],
1192
-					$this->common_model->calculate_currency($row['cost'], '', '', '', false) ,
1192
+					$this->common_model->calculate_currency($row['cost'], '', '', '', false),
1193 1193
 					$row['connectcost'],
1194 1194
 					$row['includedseconds']
1195 1195
 				);
@@ -1200,13 +1200,13 @@  discard block
 block discarded – undo
1200 1200
 		$this->fpdf->AddPage();
1201 1201
 		$this->fpdf->SetFont('Arial', '', 15);
1202 1202
 		$this->fpdf->SetXY(60, 5);
1203
-		$this->fpdf->Cell(100, 10, "Rates Report " . date('Y-m-d'));
1203
+		$this->fpdf->Cell(100, 10, "Rates Report ".date('Y-m-d'));
1204 1204
 		$this->fpdf->SetY(20);
1205 1205
 		$this->fpdf->SetFont('Arial', '', 7);
1206 1206
 		$this->fpdf->SetFillColor(255, 255, 255);
1207 1207
 		$this->fpdf->lMargin = 2;
1208 1208
 		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
1209
-		$this->fpdf->Output('Rates_' . date("Y-m-d") . '.pdf', "D");
1209
+		$this->fpdf->Output('Rates_'.date("Y-m-d").'.pdf', "D");
1210 1210
 	}
1211 1211
 
1212 1212
 	function resellersrates_list()
@@ -1237,15 +1237,15 @@  discard block
 block discarded – undo
1237 1237
 		$json_data = $paging_data["json_paging"];
1238 1238
 		$query = $this->rates_model->getreseller_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
1239 1239
 		$grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller());
1240
-		foreach($query->result_array() as $key => $value)
1240
+		foreach ($query->result_array() as $key => $value)
1241 1241
 		{
1242 1242
 			$json_data['rows'][] = array(
1243 1243
 				'cell' => array(
1244
-					$this->common->get_only_numeric_val("", "", $value["pattern"]) ,
1244
+					$this->common->get_only_numeric_val("", "", $value["pattern"]),
1245 1245
 					$value['comment'],
1246
-					$this->common_model->calculate_currency($value['connectcost'], '', '', 'true', true) ,
1246
+					$this->common_model->calculate_currency($value['connectcost'], '', '', 'true', true),
1247 1247
 					$value['includedseconds'],
1248
-					$this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100) , '', '', 'true', true) ,
1248
+					$this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', 'true', true),
1249 1249
 					$value['inc'],
1250 1250
 					$value['precedence'],
1251 1251
 				)
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 
1272 1272
 		if (@$ajax_search != 1)
1273 1273
 		{
1274
-			redirect(base_url() . 'rates/resellersrates_list/');
1274
+			redirect(base_url().'rates/resellersrates_list/');
1275 1275
 		}
1276 1276
 	}
1277 1277
 
@@ -1300,14 +1300,14 @@  discard block
 block discarded – undo
1300 1300
 		);
1301 1301
 		if ($query->num_rows() > 0)
1302 1302
 		{
1303
-			foreach($query->result_array() as $row)
1303
+			foreach ($query->result_array() as $row)
1304 1304
 			{
1305 1305
 				$customer_array[] = array(
1306
-					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]) ,
1306
+					$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1307 1307
 					$row['comment'],
1308 1308
 					$row['connectcost'],
1309 1309
 					$row['includedseconds'],
1310
-					$this->common_model->calculate_currency($row['cost']) ,
1310
+					$this->common_model->calculate_currency($row['cost']),
1311 1311
 					$row['inc'],
1312 1312
 					$row['precedence']
1313 1313
 				);
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 		}
1316 1316
 
1317 1317
 		$this->load->helper('csv');
1318
-		array_to_csv($customer_array, 'My_Own_Rate_' . date("Y-m-d") . '.csv');
1318
+		array_to_csv($customer_array, 'My_Own_Rate_'.date("Y-m-d").'.csv');
1319 1319
 		exit;
1320 1320
 	}
1321 1321
 
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
 		if (@$ajax_search != 1)
1339 1339
 		{
1340
-			redirect(base_url() . 'rates/termination_rates_list/');
1340
+			redirect(base_url().'rates/termination_rates_list/');
1341 1341
 		}
1342 1342
 	}
1343 1343
 
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
 		if (@$ajax_search != 1)
1357 1357
 		{
1358
-			redirect(base_url() . 'rates/origination_rates_list/');
1358
+			redirect(base_url().'rates/origination_rates_list/');
1359 1359
 		}
1360 1360
 	}
1361 1361
 
@@ -1371,14 +1371,14 @@  discard block
 block discarded – undo
1371 1371
 
1372 1372
 	function csv_to_array($filename = '', $delimiter = ',')
1373 1373
 	{
1374
-		if (!file_exists($filename) || !is_readable($filename)) return FALSE;
1374
+		if ( ! file_exists($filename) || ! is_readable($filename)) return FALSE;
1375 1375
 		$header = NULL;
1376 1376
 		$data = array();
1377 1377
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1378 1378
 		{
1379 1379
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1380 1380
 			{
1381
-				if (!$header) $header = $row;
1381
+				if ( ! $header) $header = $row;
1382 1382
 				else $data[] = array_combine($header, $row);
1383 1383
 			}
1384 1384
 
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
 	function utf8_converter($array)
1392 1392
 	{
1393 1393
 		array_walk_recursive($array,
1394
-		function (&$item, $key)
1394
+		function(&$item, $key)
1395 1395
 		{
1396
-			if (!mb_detect_encoding($item, 'utf-8', true))
1396
+			if ( ! mb_detect_encoding($item, 'utf-8', true))
1397 1397
 			{
1398 1398
 				$item = utf8_encode($item);
1399 1399
 			}
@@ -1407,9 +1407,9 @@  discard block
 block discarded – undo
1407 1407
 		$check_header = $this->input->post('check_header', true);
1408 1408
 		$data['page_title'] = 'Import Termination Rates using field mapper';
1409 1409
 		$new_final_arr_key = $this->config->item('Termination-rates-field');
1410
-		if (empty($_FILES) || !isset($_FILES))
1410
+		if (empty($_FILES) || ! isset($_FILES))
1411 1411
 		{
1412
-			redirect(base_url() . "rates/termination_rates_list/");
1412
+			redirect(base_url()."rates/termination_rates_list/");
1413 1413
 		}
1414 1414
 
1415 1415
 		$data['mapto_fields'] = $new_final_arr_key;
@@ -1429,13 +1429,13 @@  discard block
 block discarded – undo
1429 1429
 					// $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
1430 1430
 
1431 1431
 					$csv_data = $this->utf8_converter($this->csvreader->parse_file($uploadedFile, $field_select, $check_header));
1432
-        			if (!empty($csv_data))
1432
+        			if ( ! empty($csv_data))
1433 1433
 					{
1434 1434
 						$full_path = $this->config->item('rates-file-path');
1435
-						$actual_file_name = "ASTPP-TERMINATION-RATES-" . date("Y-m-d H:i:s") . "." . $ext;
1435
+						$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s").".".$ext;
1436 1436
 						$actual_file_name = str_replace(' ', '-', $actual_file_name);
1437 1437
 						$actual_file_name = str_replace(':', '-', $actual_file_name);
1438
-						if (move_uploaded_file($uploadedFile, $full_path . $actual_file_name))
1438
+						if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name))
1439 1439
 						{
1440 1440
 							$data['field_select'] = serialize($field_select);
1441 1441
 							$data['csv_tmp_data'] = $csv_data;
@@ -1470,14 +1470,14 @@  discard block
 block discarded – undo
1470 1470
 		{
1471 1471
 
1472 1472
 			$str = '';
1473
-			if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id']))
1473
+			if ( ! isset($_POST['trunk_id']) || empty($_POST['trunk_id']))
1474 1474
 			{
1475
-				$str.= '<br/>Please Create Trunk.';
1475
+				$str .= '<br/>Please Create Trunk.';
1476 1476
 			}
1477 1477
 
1478 1478
 			if (empty($_FILES['termination_rate_import_mapper']['name']))
1479 1479
 			{
1480
-				$str.= '<br/>Please Select File.';
1480
+				$str .= '<br/>Please Select File.';
1481 1481
 			}
1482 1482
 
1483 1483
 			$data['error'] = $str;
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 		$new_final_arr = array();
1499 1499
 		$invalid_array = array();
1500 1500
 		$new_final_arr_key = array();
1501
-		foreach($filefields as $item)
1501
+		foreach ($filefields as $item)
1502 1502
 		{
1503 1503
 			$new_final_arr_key[$item] = $item;
1504 1504
 		}
@@ -1512,30 +1512,30 @@  discard block
 block discarded – undo
1512 1512
 
1513 1513
 		$full_path = $this->config->item('rates-file-path');
1514 1514
 		$terminationrate_file_name = $this->session->userdata('import_termination_rate_mapper_csv');
1515
-		$csv_tmp_data = $this->csvreader->parse_file($full_path . $terminationrate_file_name, $new_final_arr_key, $check_header);
1515
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header);
1516 1516
 		$i = 0;
1517
-		foreach($csv_tmp_data as $key => $csv_data)
1517
+		foreach ($csv_tmp_data as $key => $csv_data)
1518 1518
 		{
1519
-			if (isset($csv_data[$this->input->post("pattern-select") ]) && $csv_data[$this->input->post("pattern-select") ] != '' && $i != 0)
1519
+			if (isset($csv_data[$this->input->post("pattern-select")]) && $csv_data[$this->input->post("pattern-select")] != '' && $i != 0)
1520 1520
 			{
1521 1521
 				$str = null;
1522
-				$csv_data['pattern'] = ($this->input->post("pattern-prefix")) ? $this->input->post("pattern-prefix") . $csv_data[$this->input->post("pattern-select") ] : $csv_data[$this->input->post("pattern-select") ];
1523
-				$csv_data['cost'] = ($this->input->post("cost-select")) ? $csv_data[$this->input->post("cost-select") ] : "";
1524
-				$csv_data['cost'] = ($this->input->post("cost-prefix")) ? $this->input->post("cost-prefix") . $csv_data['cost'] : $csv_data['cost'];
1525
-				$csv_data['prepend'] = ($this->input->post("prepend-select")) ? $csv_data[$this->input->post("prepend-select") ] : "";
1526
-				$csv_data['prepend'] = ($this->input->post("prepend-prefix")) ? $this->input->post("prepend-prefix") . $csv_data['prepend'] : $csv_data['prepend'];
1527
-				$csv_data['comment'] = ($this->input->post("comment-select")) ? $csv_data[$this->input->post("comment-select") ] : "";
1528
-				$csv_data['comment'] = ($this->input->post("comment-prefix")) ? $this->input->post("comment-prefix") . $csv_data['comment'] : $csv_data['comment'];
1529
-				$csv_data['connectcost'] = ($this->input->post("connectcost-select")) ? $csv_data[$this->input->post("connectcost-select") ] : "0";
1530
-				$csv_data['connectcost'] = ($this->input->post("connectcost-prefix")) ? $this->input->post("connectcost-prefix") . $csv_data['connectcost'] : $csv_data['connectcost'];
1531
-				$csv_data['includedseconds'] = ($this->input->post("includedseconds-select")) ? $csv_data[$this->input->post("includedseconds-select") ] : "0";
1532
-				$csv_data['includedseconds'] = ($this->input->post("includedseconds-prefix")) ? $this->input->post("includedseconds-prefix") . $csv_data['includedseconds'] : $csv_data['includedseconds'];
1533
-				$csv_data['inc'] = ($this->input->post("inc-select")) ? $csv_data[$this->input->post("inc-select") ] : "0";
1534
-				$csv_data['inc'] = ($this->input->post("inc-prefix")) ? $this->input->post("inc-prefix") . $csv_data['inc'] : $csv_data['inc'];
1535
-				$csv_data['precedence'] = ($this->input->post("precedence-select")) ? $csv_data[$this->input->post("precedence-select") ] : "";
1536
-				$csv_data['precedence'] = ($this->input->post("precedence-prefix")) ? $this->input->post("precedence-prefix") . $csv_data['precedence'] : $csv_data['precedence'];
1537
-				$csv_data['strip'] = ($this->input->post("strip-select")) ? $csv_data[$this->input->post("strip-select") ] : "";
1538
-				$csv_data['strip'] = ($this->input->post("strip-prefix")) ? $this->input->post("strip-prefix") . $csv_data['strip'] : $csv_data['strip'];
1522
+				$csv_data['pattern'] = ($this->input->post("pattern-prefix")) ? $this->input->post("pattern-prefix").$csv_data[$this->input->post("pattern-select")] : $csv_data[$this->input->post("pattern-select")];
1523
+				$csv_data['cost'] = ($this->input->post("cost-select")) ? $csv_data[$this->input->post("cost-select")] : "";
1524
+				$csv_data['cost'] = ($this->input->post("cost-prefix")) ? $this->input->post("cost-prefix").$csv_data['cost'] : $csv_data['cost'];
1525
+				$csv_data['prepend'] = ($this->input->post("prepend-select")) ? $csv_data[$this->input->post("prepend-select")] : "";
1526
+				$csv_data['prepend'] = ($this->input->post("prepend-prefix")) ? $this->input->post("prepend-prefix").$csv_data['prepend'] : $csv_data['prepend'];
1527
+				$csv_data['comment'] = ($this->input->post("comment-select")) ? $csv_data[$this->input->post("comment-select")] : "";
1528
+				$csv_data['comment'] = ($this->input->post("comment-prefix")) ? $this->input->post("comment-prefix").$csv_data['comment'] : $csv_data['comment'];
1529
+				$csv_data['connectcost'] = ($this->input->post("connectcost-select")) ? $csv_data[$this->input->post("connectcost-select")] : "0";
1530
+				$csv_data['connectcost'] = ($this->input->post("connectcost-prefix")) ? $this->input->post("connectcost-prefix").$csv_data['connectcost'] : $csv_data['connectcost'];
1531
+				$csv_data['includedseconds'] = ($this->input->post("includedseconds-select")) ? $csv_data[$this->input->post("includedseconds-select")] : "0";
1532
+				$csv_data['includedseconds'] = ($this->input->post("includedseconds-prefix")) ? $this->input->post("includedseconds-prefix").$csv_data['includedseconds'] : $csv_data['includedseconds'];
1533
+				$csv_data['inc'] = ($this->input->post("inc-select")) ? $csv_data[$this->input->post("inc-select")] : "0";
1534
+				$csv_data['inc'] = ($this->input->post("inc-prefix")) ? $this->input->post("inc-prefix").$csv_data['inc'] : $csv_data['inc'];
1535
+				$csv_data['precedence'] = ($this->input->post("precedence-select")) ? $csv_data[$this->input->post("precedence-select")] : "";
1536
+				$csv_data['precedence'] = ($this->input->post("precedence-prefix")) ? $this->input->post("precedence-prefix").$csv_data['precedence'] : $csv_data['precedence'];
1537
+				$csv_data['strip'] = ($this->input->post("strip-select")) ? $csv_data[$this->input->post("strip-select")] : "";
1538
+				$csv_data['strip'] = ($this->input->post("strip-prefix")) ? $this->input->post("strip-prefix").$csv_data['strip'] : $csv_data['strip'];
1539 1539
 				$csv_data['last_modified_date'] = date("Y-m-d H:i:s");
1540 1540
 				$str = $this->data_validate($csv_data);
1541 1541
 				if ($str != "")
@@ -1546,13 +1546,13 @@  discard block
 block discarded – undo
1546 1546
 				else
1547 1547
 				{
1548 1548
 					$new_final_arr[$i]['trunk_id'] = $trunkID;
1549
-					$new_final_arr[$i]['pattern'] = "^" . $csv_data['pattern'] . ".*";
1549
+					$new_final_arr[$i]['pattern'] = "^".$csv_data['pattern'].".*";
1550 1550
 					$new_final_arr[$i]['prepend'] = $csv_data['prepend'];
1551 1551
 					$new_final_arr[$i]['last_modified_date'] = $csv_data['last_modified_date'];
1552 1552
 					$new_final_arr[$i]['comment'] = $csv_data['comment'];
1553 1553
 					$new_final_arr[$i]['connectcost'] = $csv_data['connectcost'];
1554 1554
 					$new_final_arr[$i]['includedseconds'] = $csv_data['includedseconds'];
1555
-					$new_final_arr[$i]['cost'] = !empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
1555
+					$new_final_arr[$i]['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
1556 1556
 					$new_final_arr[$i]['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
1557 1557
 					$new_final_arr[$i]['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
1558 1558
 					$new_final_arr[$i]['strip'] = isset($csv_data['strip']) ? $csv_data['strip'] : '';
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 			$i++;
1563 1563
 		}
1564 1564
 
1565
-		if (!empty($new_final_arr))
1565
+		if ( ! empty($new_final_arr))
1566 1566
 		{
1567 1567
 			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
1568 1568
 		}
@@ -1570,29 +1570,29 @@  discard block
 block discarded – undo
1570 1570
         {
1571 1571
 
1572 1572
            $this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
1573
-           redirect(base_url() . 'rates/termination_rates_list/');
1573
+           redirect(base_url().'rates/termination_rates_list/');
1574 1574
 		}
1575 1575
 
1576
-		unlink($full_path . $terminationrate_file_name);
1576
+		unlink($full_path.$terminationrate_file_name);
1577 1577
 		$count = count($invalid_array);
1578 1578
 		if ($count > 0)
1579 1579
 		{
1580 1580
 			$session_id = "-1";
1581
-			$fp = fopen($full_path . $session_id . '.csv', 'w');
1582
-			foreach($new_final_arr_key as $key => $value)
1581
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
1582
+			foreach ($new_final_arr_key as $key => $value)
1583 1583
 			{
1584 1584
 				$custom_array[0][$key] = ucfirst($key);
1585 1585
 			}
1586 1586
 
1587 1587
 			$custom_array[0]['error'] = "Error";
1588 1588
 			$invalid_array = array_merge($custom_array, $invalid_array);
1589
-			foreach($invalid_array as $err_data)
1589
+			foreach ($invalid_array as $err_data)
1590 1590
 			{
1591 1591
 				fputcsv($fp, $err_data);
1592 1592
 			}
1593 1593
 
1594 1594
 			fclose($fp);
1595
-			$this->session->set_userdata('import_termination_rate_mapper_csv_error', $session_id . ".csv");
1595
+			$this->session->set_userdata('import_termination_rate_mapper_csv_error', $session_id.".csv");
1596 1596
 			$data["error"] = $invalid_array;
1597 1597
 			$data['trunkid'] = $trunkID;
1598 1598
 			$data['impoted_count'] = count($new_final_arr);
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 		else
1604 1604
 		{
1605 1605
 
1606
-			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!');
1607
-			redirect(base_url() . 'rates/termination_rates_list/');
1606
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
1607
+			redirect(base_url().'rates/termination_rates_list/');
1608 1608
 		}
1609 1609
 	}
1610 1610
 
Please login to merge, or discard this patch.
application/modules/rates/views/view_import_termination_rate_mapper.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
                							foreach($csv_value as $field_name => $field_val){
180 180
                								if($csv_key == 0){
181 181
                									echo "<th>".ucfirst($field_name)."</th>";
182
-               								}else{
182
+               								} else{
183 183
                									echo "<td class='portlet-content'>".$field_val."</td>";
184 184
                								}
185 185
                							}
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,19 +7,19 @@  discard block
 block discarded – undo
7 7
    });
8 8
 </script> <script type="text/javascript" language="javascript"><?
9 9
    if (isset($mapto_fields) && !empty($mapto_fields)) {
10
-    foreach($mapto_fields as $csv_key => $csv_value) {
11
-    echo '$("#'.$csv_value .'-prefix").live("change", function () {';
12
-    echo 'var select = document.getElementById("'.$csv_value .'-select");';
13
-    echo 'var answer = select.options[select.selectedIndex].value;';
14
-    echo 'document.getElementById("'.$csv_value .'-display").value =  (!answer) ? document.getElementById("'.$csv_value .'-prefix").value : document.getElementById("'.$csv_value .'-prefix").value + csv_tmp_data[2][answer];';
15
-    echo '});';
16
-    echo '$("#'.$csv_value .'-select").live("change", function () {';
17
-    echo 'var select = document.getElementById("'.$csv_value .'-select");';
18
-    echo 'var answer = select.options[select.selectedIndex].value;';
19
-    echo 'document.getElementById("'.$csv_value .'-display").value = (!answer) ? document.getElementById("'.$csv_value .'-prefix").value : document.getElementById("'.$csv_value .'-prefix").value + csv_tmp_data[2][answer];';
20
-    echo '});';
21
-    }
22
-    }
10
+	foreach($mapto_fields as $csv_key => $csv_value) {
11
+	echo '$("#'.$csv_value .'-prefix").live("change", function () {';
12
+	echo 'var select = document.getElementById("'.$csv_value .'-select");';
13
+	echo 'var answer = select.options[select.selectedIndex].value;';
14
+	echo 'document.getElementById("'.$csv_value .'-display").value =  (!answer) ? document.getElementById("'.$csv_value .'-prefix").value : document.getElementById("'.$csv_value .'-prefix").value + csv_tmp_data[2][answer];';
15
+	echo '});';
16
+	echo '$("#'.$csv_value .'-select").live("change", function () {';
17
+	echo 'var select = document.getElementById("'.$csv_value .'-select");';
18
+	echo 'var answer = select.options[select.selectedIndex].value;';
19
+	echo 'document.getElementById("'.$csv_value .'-display").value = (!answer) ? document.getElementById("'.$csv_value .'-prefix").value : document.getElementById("'.$csv_value .'-prefix").value + csv_tmp_data[2][answer];';
20
+	echo '});';
21
+	}
22
+	}
23 23
    ?></script>
24 24
 <?
25 25
    if (isset($csv_tmp_data) && !empty($csv_tmp_data)) {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
    echo 'var csv_tmp_data = ' . json_encode($csv_tmp_data) . ';';
28 28
    echo '</script>';
29 29
    }
30
-    ?>
30
+	?>
31 31
 <?php
32 32
    endblock() ?>
33 33
 <?php
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
                   <div class="w-box">
52 52
                      <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
53 53
                      <?php
54
-                        if (isset($error) && !empty($error)) {
55
-                        	echo $error;
56
-                        } ?>
54
+						if (isset($error) && !empty($error)) {
55
+							echo $error;
56
+						} ?>
57 57
                      </span>
58 58
                      <h3 class="padding-t-10 padding-l-16">You must either select a field from your file OR provide a default value for the following fields:</h3>
59 59
                      <p>Code,Destination,Connect Cost,Included Seconds,Per Minute Cost,Increment,Precedence,Strip,Prepend.</p>
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
                            <label class="col-md-3">Trunk List:</label>
68 68
                            <div class="col-md-8">
69 69
                               <?php
70
-                                 $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array(
71
-                                 	"status " => "0"
72
-                                 )) , '');
73
-                                 echo $trunklist; ?>
70
+								 $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array(
71
+								 	"status " => "0"
72
+								 )) , '');
73
+								 echo $trunklist; ?>
74 74
                            </div>
75 75
                         </div>
76 76
 
@@ -135,28 +135,28 @@  discard block
 block discarded – undo
135 135
                   </thead>
136 136
                   <tbody>
137 137
                      <?php
138
-                        foreach($mapto_fields as $csv_key => $csv_value) {
138
+						foreach($mapto_fields as $csv_key => $csv_value) {
139 139
 
140
-                        		echo "<tr>";
141
-                        		echo "<td>" . $csv_key . '(' . $csv_value . ")</td>";
142
-                        		echo "<td><input type='text' name='".$csv_value ."-prefix' id='".$csv_value ."-prefix'></td>";
143
-                        		echo "<td>";
144
-                        		echo "<select name='".$csv_value ."-select' id='".$csv_value ."-select'>";
145
-                        		?>
140
+								echo "<tr>";
141
+								echo "<td>" . $csv_key . '(' . $csv_value . ")</td>";
142
+								echo "<td><input type='text' name='".$csv_value ."-prefix' id='".$csv_value ."-prefix'></td>";
143
+								echo "<td>";
144
+								echo "<select name='".$csv_value ."-select' id='".$csv_value ."-select'>";
145
+								?>
146 146
                      <option value=""></option>
147 147
                      <?php
148
-                        $keys = array_keys($file_data);
149
-                        for ($i = 0; $i < count($file_data); $i++) { ?>
148
+						$keys = array_keys($file_data);
149
+						for ($i = 0; $i < count($file_data); $i++) { ?>
150 150
                      <option value="<?php
151
-                        echo $file_data[$i]; ?>"><?php
152
-                        echo $file_data[$i]; ?></option>
151
+						echo $file_data[$i]; ?>"><?php
152
+						echo $file_data[$i]; ?></option>
153 153
                      <?php
154
-                        }
155
-                        echo "</td>";
156
-                        echo "<td><input type='text' name='".$csv_value ."-display' id='".$csv_value ."-display'></td>";
157
-                        echo "</tr>";
154
+						}
155
+						echo "</td>";
156
+						echo "<td><input type='text' name='".$csv_value ."-display' id='".$csv_value ."-display'></td>";
157
+						echo "</tr>";
158 158
 
159
-                        } ?>
159
+						} ?>
160 160
                   </tbody>
161 161
                </table>
162 162
                <input type="hidden" name="trunkid" value="<?php echo $trunkid ?>" />
@@ -174,25 +174,25 @@  discard block
 block discarded – undo
174 174
                            <form id="import_form" name="import_form" action="<?=base_url()?>rates/termination_rate_rates_import/<?= $trunkid?>/<?=$check_header?>/" method="POST">
175 175
                            <table width="100%" border="1"  class="details_table table">
176 176
                                <?  $cnt =1;
177
-               					foreach($csv_tmp_data as $csv_key => $csv_value){
178
-               						if($csv_key <  15){
179
-               							echo "<tr>";
180
-               							foreach($csv_value as $field_name => $field_val){
181
-               								if($csv_key == 0){
182
-               									echo "<th>".ucfirst($field_val)."</th>";
183
-               								}else{
184
-               									echo "<td class='portlet-content'>".$field_val."</td>";
185
-               									$cnt++;
186
-               								}
187
-               							}
188
-               							echo "</tr>";
189
-               						}
190
-               					}
177
+			   					foreach($csv_tmp_data as $csv_key => $csv_value){
178
+			   						if($csv_key <  15){
179
+			   							echo "<tr>";
180
+			   							foreach($csv_value as $field_name => $field_val){
181
+			   								if($csv_key == 0){
182
+			   									echo "<th>".ucfirst($field_val)."</th>";
183
+			   								}else{
184
+			   									echo "<td class='portlet-content'>".$field_val."</td>";
185
+			   									$cnt++;
186
+			   								}
187
+			   							}
188
+			   							echo "</tr>";
189
+			   						}
190
+			   					}
191 191
 
192
-               					echo "<tr><td colspan='".$cnt."'>
192
+			   					echo "<tr><td colspan='".$cnt."'>
193 193
                                        <a href='".base_url()."rates/termination_rates_list/'><input type='button' class='btn btn-line-sky pull-right  margin-x-10' value='Back'/></a>
194 194
                                        <input type='submit' class='btn btn-line-parrot pull-right'' id='Process' value='Process'/></td></tr>";
195
-               		?> </table></form>
195
+			   		?> </table></form>
196 196
                     </div>
197 197
                            </div>
198 198
                        </div>
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@  discard block
 block discarded – undo
6 6
    $(document).ready(function() {
7 7
    });
8 8
 </script> <script type="text/javascript" language="javascript"><?
9
-   if (isset($mapto_fields) && !empty($mapto_fields)) {
10
-    foreach($mapto_fields as $csv_key => $csv_value) {
11
-    echo '$("#'.$csv_value .'-prefix").live("change", function () {';
12
-    echo 'var select = document.getElementById("'.$csv_value .'-select");';
9
+   if (isset($mapto_fields) && ! empty($mapto_fields)) {
10
+    foreach ($mapto_fields as $csv_key => $csv_value) {
11
+    echo '$("#'.$csv_value.'-prefix").live("change", function () {';
12
+    echo 'var select = document.getElementById("'.$csv_value.'-select");';
13 13
     echo 'var answer = select.options[select.selectedIndex].value;';
14
-    echo 'document.getElementById("'.$csv_value .'-display").value =  (!answer) ? document.getElementById("'.$csv_value .'-prefix").value : document.getElementById("'.$csv_value .'-prefix").value + csv_tmp_data[2][answer];';
14
+    echo 'document.getElementById("'.$csv_value.'-display").value =  (!answer) ? document.getElementById("'.$csv_value.'-prefix").value : document.getElementById("'.$csv_value.'-prefix").value + csv_tmp_data[2][answer];';
15 15
     echo '});';
16
-    echo '$("#'.$csv_value .'-select").live("change", function () {';
17
-    echo 'var select = document.getElementById("'.$csv_value .'-select");';
16
+    echo '$("#'.$csv_value.'-select").live("change", function () {';
17
+    echo 'var select = document.getElementById("'.$csv_value.'-select");';
18 18
     echo 'var answer = select.options[select.selectedIndex].value;';
19
-    echo 'document.getElementById("'.$csv_value .'-display").value = (!answer) ? document.getElementById("'.$csv_value .'-prefix").value : document.getElementById("'.$csv_value .'-prefix").value + csv_tmp_data[2][answer];';
19
+    echo 'document.getElementById("'.$csv_value.'-display").value = (!answer) ? document.getElementById("'.$csv_value.'-prefix").value : document.getElementById("'.$csv_value.'-prefix").value + csv_tmp_data[2][answer];';
20 20
     echo '});';
21 21
     }
22 22
     }
23 23
    ?></script>
24 24
 <?
25
-   if (isset($csv_tmp_data) && !empty($csv_tmp_data)) {
25
+   if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) {
26 26
    echo '<script>';
27
-   echo 'var csv_tmp_data = ' . json_encode($csv_tmp_data) . ';';
27
+   echo 'var csv_tmp_data = '.json_encode($csv_tmp_data).';';
28 28
    echo '</script>';
29 29
    }
30 30
     ?>
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 <?php
41 41
    startblock('content') ?>
42 42
 <?php
43
-   if (!isset($csv_tmp_data)) { ?>
43
+   if ( ! isset($csv_tmp_data)) { ?>
44 44
 <section class="slice color-three padding-t-20">
45 45
    <div class="w-section inverse no-padding">
46 46
       <div class="container">
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                   <div class="w-box">
52 52
                      <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
53 53
                      <?php
54
-                        if (isset($error) && !empty($error)) {
54
+                        if (isset($error) && ! empty($error)) {
55 55
                         	echo $error;
56 56
                         } ?>
57 57
                      </span>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                               <?php
70 70
                                  $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array(
71 71
                                  	"status " => "0"
72
-                                 )) , '');
72
+                                 )), '');
73 73
                                  echo $trunklist; ?>
74 74
                            </div>
75 75
                         </div>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             <div class="col-md-12 padding-b-10">
102 102
                <div class="pull-right">
103 103
                   <input class="btn btn-line-parrot" id="import_terminationrate" type="submit" name="action" value="Import" />
104
-                  <a href="<?php echo base_url() . 'rates/termination_rate_list/' ?>" >
104
+                  <a href="<?php echo base_url().'rates/termination_rate_list/' ?>" >
105 105
                   <input class="btn btn-line-sky margin-x-10" id="ok" type="button" name="action" value="Cancel"/>
106 106
                   </a>
107 107
                </div>
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 <?php
115 115
    } ?>
116 116
 <?php
117
-   if (isset($csv_tmp_data) && !empty($csv_tmp_data)) { ?>
117
+   if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?>
118 118
 <section class="slice color-three padding-b-20">
119 119
    <div class="w-section inverse no-padding">
120 120
       <div class="container">
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
                   </thead>
136 136
                   <tbody>
137 137
                      <?php
138
-                        foreach($mapto_fields as $csv_key => $csv_value) {
138
+                        foreach ($mapto_fields as $csv_key => $csv_value) {
139 139
 
140 140
                         		echo "<tr>";
141
-                        		echo "<td>" . $csv_key . '(' . $csv_value . ")</td>";
142
-                        		echo "<td><input type='text' name='".$csv_value ."-prefix' id='".$csv_value ."-prefix'></td>";
141
+                        		echo "<td>".$csv_key.'('.$csv_value.")</td>";
142
+                        		echo "<td><input type='text' name='".$csv_value."-prefix' id='".$csv_value."-prefix'></td>";
143 143
                         		echo "<td>";
144
-                        		echo "<select name='".$csv_value ."-select' id='".$csv_value ."-select'>";
144
+                        		echo "<select name='".$csv_value."-select' id='".$csv_value."-select'>";
145 145
                         		?>
146 146
                      <option value=""></option>
147 147
                      <?php
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                      <?php
154 154
                         }
155 155
                         echo "</td>";
156
-                        echo "<td><input type='text' name='".$csv_value ."-display' id='".$csv_value ."-display'></td>";
156
+                        echo "<td><input type='text' name='".$csv_value."-display' id='".$csv_value."-display'></td>";
157 157
                         echo "</tr>";
158 158
 
159 159
                         } ?>
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
                                <div class="col-md-12 margin-t-10">
174 174
                            <form id="import_form" name="import_form" action="<?=base_url()?>rates/termination_rate_rates_import/<?= $trunkid?>/<?=$check_header?>/" method="POST">
175 175
                            <table width="100%" border="1"  class="details_table table">
176
-                               <?  $cnt =1;
177
-               					foreach($csv_tmp_data as $csv_key => $csv_value){
178
-               						if($csv_key <  15){
176
+                               <?  $cnt = 1;
177
+               					foreach ($csv_tmp_data as $csv_key => $csv_value) {
178
+               						if ($csv_key < 15) {
179 179
                							echo "<tr>";
180
-               							foreach($csv_value as $field_name => $field_val){
181
-               								if($csv_key == 0){
180
+               							foreach ($csv_value as $field_name => $field_val) {
181
+               								if ($csv_key == 0) {
182 182
                									echo "<th>".ucfirst($field_val)."</th>";
183
-               								}else{
183
+               								} else {
184 184
                									echo "<td class='portlet-content'>".$field_val."</td>";
185 185
                									$cnt++;
186 186
                								}
Please login to merge, or discard this patch.