Passed
Pull Request — v3.0 (#189)
by
unknown
10:51
created
application/modules/rates/views/view_import_termination_rate_mapper.php 2 patches
Indentation   +55 added lines, -55 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
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
                   <div class="w-box">
51 51
                      <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
52 52
                      <?php
53
-                        if (isset($error) && !empty($error)) {
54
-                        	echo $error;
55
-                        } ?>
53
+						if (isset($error) && !empty($error)) {
54
+							echo $error;
55
+						} ?>
56 56
                      </span>
57 57
                      <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>
58 58
                      <p>Code,Destination,Connect Cost,Included Seconds,Per Minute Cost,Increment,Precedence,Strip,Prepend.</p>
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
                            <label class="col-md-3">Trunk List:</label>
67 67
                            <div class="col-md-8">
68 68
                               <?php
69
-                                 $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array(
70
-                                 	"status " => "0"
71
-                                 )) , '');
72
-                                 echo $trunklist; ?>
69
+								 $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array(
70
+								 	"status " => "0"
71
+								 )) , '');
72
+								 echo $trunklist; ?>
73 73
                            </div>
74 74
                         </div>
75 75
 
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
                   </thead>
135 135
                   <tbody>
136 136
                      <?php
137
-                        foreach($mapto_fields as $csv_key => $csv_value) {
137
+						foreach($mapto_fields as $csv_key => $csv_value) {
138 138
 
139
-                        		echo "<tr>";
140
-                        		echo "<td>" . $csv_key . '(' . $csv_value . ")</td>";
141
-                        		echo "<td><input type='text' name='".$csv_value ."-prefix' id='".$csv_value ."-prefix'></td>";
142
-                        		echo "<td>";
143
-                        		echo "<select name='".$csv_value ."-select' id='".$csv_value ."-select'>";
144
-                        		?>
139
+								echo "<tr>";
140
+								echo "<td>" . $csv_key . '(' . $csv_value . ")</td>";
141
+								echo "<td><input type='text' name='".$csv_value ."-prefix' id='".$csv_value ."-prefix'></td>";
142
+								echo "<td>";
143
+								echo "<select name='".$csv_value ."-select' id='".$csv_value ."-select'>";
144
+								?>
145 145
                      <option value=""></option>
146 146
                      <?php
147
-                        $keys = array_keys($file_data);
148
-                        for ($i = 0; $i < count($file_data); $i++) { ?>
147
+						$keys = array_keys($file_data);
148
+						for ($i = 0; $i < count($file_data); $i++) { ?>
149 149
                      <option value="<?php
150
-                        echo $file_data[$i]; ?>"><?php
151
-                        echo $file_data[$i]; ?></option>
150
+						echo $file_data[$i]; ?>"><?php
151
+						echo $file_data[$i]; ?></option>
152 152
                      <?php
153
-                        }
154
-                        echo "</td>";
155
-                        echo "<td><input type='text' name='".$csv_value ."-display' id='".$csv_value ."-display'></td>";
156
-                        echo "</tr>";
153
+						}
154
+						echo "</td>";
155
+						echo "<td><input type='text' name='".$csv_value ."-display' id='".$csv_value ."-display'></td>";
156
+						echo "</tr>";
157 157
 
158
-                        } ?>
158
+						} ?>
159 159
                   </tbody>
160 160
                </table>
161 161
                <input type="hidden" name="trunkid" value="<?php echo $trunkid ?>" />
@@ -167,30 +167,30 @@  discard block
 block discarded – undo
167 167
                <H2> Import File Data..</H2>
168 168
                <table width="100%" border="1"  class="details_table">
169 169
                   <?php
170
-                     $cnt = 1;
171
-                     foreach($csv_tmp_data as $csv_key => $csv_value) {
172
-                     	if ($csv_key < 15) {
173
-                     		echo "<tr>";
174
-                     		foreach($csv_value as $field_name => $field_val) {
175
-                     			if ($csv_key == 0) {
170
+					 $cnt = 1;
171
+					 foreach($csv_tmp_data as $csv_key => $csv_value) {
172
+					 	if ($csv_key < 15) {
173
+					 		echo "<tr>";
174
+					 		foreach($csv_value as $field_name => $field_val) {
175
+					 			if ($csv_key == 0) {
176 176
 
177
-                     				 echo "<th>".ucfirst($field_val)."</th>";
177
+					 				 echo "<th>".ucfirst($field_val)."</th>";
178 178
 
179
-                     			}
180
-                     			else {
181
-                     				echo "<td class='portlet-content'>" . $field_val . "</td>";
182
-                     				$cnt++;
183
-                     			}
184
-                     		}
179
+					 			}
180
+					 			else {
181
+					 				echo "<td class='portlet-content'>" . $field_val . "</td>";
182
+					 				$cnt++;
183
+					 			}
184
+					 		}
185 185
 
186
-                     		echo "</tr>";
187
-                     	}
188
-                     }
186
+					 		echo "</tr>";
187
+					 	}
188
+					 }
189 189
 
190
-                     echo "<tr><td colspan='" . $cnt . "'>
190
+					 echo "<tr><td colspan='" . $cnt . "'>
191 191
                                             <a href='" . base_url() . "rates/termination_rate_list/'><input type='button' class='btn btn-line-sky pull-right  margin-x-10' value='Back'/></a>
192 192
                                             <input type='submit' class='btn btn-line-parrot pull-right'' id='Process' value='Process Records'/></td></tr>";
193
-                     ?>
193
+					 ?>
194 194
                </table>
195 195
             </form>
196 196
          </div>
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,8 +176,7 @@
 block discarded – undo
176 176
 
177 177
                      				 echo "<th>".ucfirst($field_val)."</th>";
178 178
 
179
-                     			}
180
-                     			else {
179
+                     			} else {
181 180
                      				echo "<td class='portlet-content'>" . $field_val . "</td>";
182 181
                      				$cnt++;
183 182
                      			}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/controllers/rates.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1253,11 +1253,11 @@
 block discarded – undo
1253 1253
 		{
1254 1254
 			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
1255 1255
 		}
1256
-        		else
1257
-        {
1256
+				else
1257
+		{
1258 1258
 
1259
-           $this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
1260
-           redirect(base_url() . 'rates/termination_rates_list/');
1259
+		   $this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
1260
+		   redirect(base_url() . 'rates/termination_rates_list/');
1261 1261
 		}
1262 1262
 
1263 1263
 		unlink($full_path . $terminationrate_file_name);
Please login to merge, or discard this patch.
Braces   +36 added lines, -42 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
35 35
 		ini_set("memory_limit", "2048M");
36 36
 		ini_set("max_execution_time", "259200");
37 37
 		ini_set("upload_max_filesize", "200M");
38
-		if ($this->session->userdata('user_login') == FALSE)
39
-			redirect(base_url() . '/astpp/login');
38
+		if ($this->session->userdata('user_login') == FALSE) {
39
+					redirect(base_url() . '/astpp/login');
40
+		}
40 41
 	}
41 42
 
42 43
 	function termination_rates_list() {
@@ -110,18 +111,17 @@  discard block
 block discarded – undo
110 111
 			  $data['check_header']=$check_header;
111 112
 			  $data['page_title'] = 'Termination Rates Preview';
112 113
 			  $this->session->set_userdata('import_termination_rate_csv',$actual_file_name);
113
-			}else{
114
+			} else{
114 115
 			  $data['error'] = "File Uploading Fail Please Try Again";
115 116
 			}
116 117
 					}
117
-				}
118
-				else{
118
+				} else{
119 119
 					$data['error']=="File Uploading Fail Please Try Again";
120 120
 				}
121
-			}else {
121
+			} else {
122 122
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
123 123
 			}
124
-		}else{
124
+		} else{
125 125
 		$invalid_flag=true;
126 126
 		}
127 127
 		if ($invalid_flag) {
@@ -164,8 +164,7 @@  discard block
 block discarded – undo
164 164
 		if($str != ""){
165 165
 		  $invalid_array[$i]=$csv_data;
166 166
 		  $invalid_array[$i]['error'] = $str;
167
-		}
168
-		else{
167
+		} else{
169 168
 		  $csv_data['trunk_id']=$trunkID;
170 169
 		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
171 170
 		  $new_final_arr[$i]=$csv_data;
@@ -253,19 +252,17 @@  discard block
 block discarded – undo
253 252
 						$data['page_title'] = "Origination Rates Preview";
254 253
 						$data['check_header']=$check_header;
255 254
 						$this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
256
-					}else{
255
+					} else{
257 256
 						$data['error'] = "File Uploading Fail Please Try Again";
258 257
 					}
259 258
 				}
260
-			 }   
261
-			else{
259
+			 } else{
262 260
 					$data['error']=="File Uploading Fail Please Try Again";
263 261
 				}
264
-		   }
265
-		   else {
262
+		   } else {
266 263
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
267 264
 			}
268
-			}else{
265
+			} else{
269 266
 		$invalid_flag=true;
270 267
 			}
271 268
 		if ($invalid_flag) {
@@ -309,8 +306,7 @@  discard block
 block discarded – undo
309 306
 		if($str != ""){
310 307
 		  $invalid_array[$i]=$csv_data;
311 308
 		  $invalid_array[$i]['error'] = $str;
312
-		}
313
-		else{
309
+		} else{
314 310
 		  $csv_data['pricelist_id']=$pricelistID;
315 311
 		  $csv_data['trunk_id']=$trunkid;
316 312
 		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
@@ -372,12 +368,10 @@  discard block
 block discarded – undo
372 368
 		$count = count($error_field);
373 369
 		$str.= $count > 1 ? ' are not valid' : ' is not Valid';
374 370
 		return $str;
375
-		  }
376
-		  else{
371
+		  } else{
377 372
 		  return false;
378 373
 		  }
379
-	  }
380
-	  else{
374
+	  } else{
381 375
 	  $str=rtrim($str,',');
382 376
 		$error_field=explode(',',$str);
383 377
 		$count = count($error_field);
@@ -618,13 +612,15 @@  discard block
 block discarded – undo
618 612
 		$where = array('accountid' => $accountid);
619 613
 		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
620 614
 		$like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
621
-		if(!empty($like_str))
622
-		$this->db->where($like_str);
615
+		if(!empty($like_str)) {
616
+				$this->db->where($like_str);
617
+		}
623 618
 		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
624 619
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
625 620
 		$json_data = $paging_data["json_paging"];
626
-		if(!empty($like_str))
627
-		$this->db->where($like_str);
621
+		if(!empty($like_str)) {
622
+				$this->db->where($like_str);
623
+		}
628 624
 		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
629 625
 		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
630 626
 		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
@@ -1059,15 +1055,20 @@  discard block
 block discarded – undo
1059 1055
 
1060 1056
 	function csv_to_array($filename = '', $delimiter = ',')
1061 1057
 	{
1062
-		if (!file_exists($filename) || !is_readable($filename)) return FALSE;
1058
+		if (!file_exists($filename) || !is_readable($filename)) {
1059
+			return FALSE;
1060
+		}
1063 1061
 		$header = NULL;
1064 1062
 		$data = array();
1065 1063
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1066 1064
 		{
1067 1065
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1068 1066
 			{
1069
-				if (!$header) $header = $row;
1070
-				else $data[] = array_combine($header, $row);
1067
+				if (!$header) {
1068
+					$header = $row;
1069
+				} else {
1070
+					$data[] = array_combine($header, $row);
1071
+				}
1071 1072
 			}
1072 1073
 
1073 1074
 			fclose($handle);
@@ -1131,25 +1132,21 @@  discard block
 block discarded – undo
1131 1132
 							$data['check_header'] = $check_header;
1132 1133
 							$data['page_title'] = 'Map CSV to Termination Rates';
1133 1134
 							$this->session->set_userdata('import_termination_rate_mapper_csv', $actual_file_name);
1134
-						}
1135
-						else
1135
+						} else
1136 1136
 						{
1137 1137
 							$data['error'] = "File Uploading Fail Please Try Again";
1138 1138
 						}
1139 1139
 					}
1140
-				}
1141
-				else
1140
+				} else
1142 1141
 				{
1143 1142
 					$data['error'] == "File Uploading Fail Please Try Again";
1144 1143
 				}
1145
-			}
1146
-			else
1144
+			} else
1147 1145
 			{
1148 1146
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
1149 1147
 				$data['error'] = var_dump($_FILES);
1150 1148
 			}
1151
-		}
1152
-		else
1149
+		} else
1153 1150
 		{
1154 1151
 			$invalid_flag = true;
1155 1152
 		}
@@ -1229,8 +1226,7 @@  discard block
 block discarded – undo
1229 1226
 				{
1230 1227
 					$invalid_array[$i] = $csv_data;
1231 1228
 					$invalid_array[$i]['error'] = $str;
1232
-				}
1233
-				else
1229
+				} else
1234 1230
 				{
1235 1231
 					$new_final_arr[$i]['trunk_id'] = $trunkID;
1236 1232
 					$new_final_arr[$i]['pattern'] = "^" . $csv_data['pattern'] . ".*";
@@ -1252,8 +1248,7 @@  discard block
 block discarded – undo
1252 1248
 		if (!empty($new_final_arr))
1253 1249
 		{
1254 1250
 			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
1255
-		}
1256
-        		else
1251
+		} else
1257 1252
         {
1258 1253
 
1259 1254
            $this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
@@ -1286,8 +1281,7 @@  discard block
 block discarded – undo
1286 1281
 			$data['failure_count'] = count($invalid_array) - 1;
1287 1282
 			$data['page_title'] = 'Termination Rates Import Error';
1288 1283
 			$this->load->view('view_import_error', $data);
1289
-		}
1290
-		else
1284
+		} else
1291 1285
 		{
1292 1286
 			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!');
1293 1287
 			redirect(base_url() . "rates/termination_rate_list/");
Please login to merge, or discard this patch.