Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
web_interface/astpp/application/modules/reports/libraries/reports_form.php 1 patch
Spacing   +662 added lines, -662 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  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' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class Reports_form {
26 26
 	function __construct() {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	function get_customer_cdr_form() {
30
-		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
30
+		$logintype = $this->CI->session->userdata('userlevel_logintype');
31 31
 		if ($logintype != 1) {
32
-			if ($this->CI->session->userdata ( 'logintype' ) == 1 || $this->CI->session->userdata ( 'logintype' ) == 5) {
32
+			if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
33 33
 				$accountinfo = $this->CI->session->userdata ['accountinfo'];
34 34
 				$reseller_id = $accountinfo ["id"];
35 35
 			} else {
36 36
 				$reseller_id = "0";
37 37
 			}
38
-			$form ['forms'] = array (
38
+			$form ['forms'] = array(
39 39
 					"",
40
-					array (
40
+					array(
41 41
 							'id' => "cdr_customer_search" 
42 42
 					) 
43 43
 			);
44
-			$form [gettext ( 'Search' )] = array (
45
-					array (
46
-							gettext ( 'From Date' ),
44
+			$form [gettext('Search')] = array(
45
+					array(
46
+							gettext('From Date'),
47 47
 							'INPUT',
48
-							array (
48
+							array(
49 49
 									'name' => 'callstart[]',
50 50
 									'id' => 'customer_cdr_from_date',
51 51
 									'size' => '20',
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 							'',
57 57
 							'start_date[start_date-date]' 
58 58
 					),
59
-					array (
60
-							gettext ( 'To Date' ),
59
+					array(
60
+							gettext('To Date'),
61 61
 							'INPUT',
62
-							array (
62
+							array(
63 63
 									'name' => 'callstart[]',
64 64
 									'id' => 'customer_cdr_to_date',
65 65
 									'size' => '20',
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 							'',
71 71
 							'end_date[end_date-date]' 
72 72
 					),
73
-					array (
74
-							gettext ( 'Caller ID' ),
73
+					array(
74
+							gettext('Caller ID'),
75 75
 							'INPUT',
76
-							array (
76
+							array(
77 77
 									'name' => 'callerid[callerid]',
78 78
 									'',
79 79
 									'id' => 'first_name',
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 							'search_string_type',
91 91
 							'' 
92 92
 					),
93
-					array (
94
-							gettext ( 'Called Number' ),
93
+					array(
94
+							gettext('Called Number'),
95 95
 							'INPUT',
96
-							array (
96
+							array(
97 97
 									'name' => 'callednum[callednum]',
98 98
 									'value' => '',
99 99
 									'size' => '20',
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 							'search_string_type',
110 110
 							'' 
111 111
 					),
112
-					array (
113
-							gettext ( 'Code' ),
112
+					array(
113
+							gettext('Code'),
114 114
 							'INPUT',
115
-							array (
115
+							array(
116 116
 									'name' => 'pattern[pattern]',
117 117
 									'value' => '',
118 118
 									'size' => '20',
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 							'search_string_type',
129 129
 							'' 
130 130
 					),
131
-					array (
132
-							gettext ( 'Destination' ),
131
+					array(
132
+							gettext('Destination'),
133 133
 							'INPUT',
134
-							array (
134
+							array(
135 135
 									'name' => 'notes[notes]',
136 136
 									'value' => '',
137 137
 									'size' => '20',
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 							'search_string_type',
148 148
 							'' 
149 149
 					),
150
-					array (
151
-							gettext ( 'Duration' ),
150
+					array(
151
+							gettext('Duration'),
152 152
 							'INPUT',
153
-							array (
153
+							array(
154 154
 									'name' => 'billseconds[billseconds]',
155 155
 									'value' => '',
156 156
 									'size' => '20',
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 							'search_int_type',
167 167
 							'' 
168 168
 					),
169
-					array (
170
-							gettext ( 'Debit' ),
169
+					array(
170
+							gettext('Debit'),
171 171
 							'INPUT',
172
-							array (
172
+							array(
173 173
 									'name' => 'debit[debit]',
174 174
 									'value' => '',
175 175
 									'size' => '20',
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 							'search_int_type',
186 186
 							'' 
187 187
 					),
188
-					array (
189
-							gettext ( 'Cost' ),
188
+					array(
189
+							gettext('Cost'),
190 190
 							'INPUT',
191
-							array (
191
+							array(
192 192
 									'name' => 'cost[cost]',
193 193
 									'value' => '',
194 194
 									'size' => '20',
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 							'search_int_type',
205 205
 							'' 
206 206
 					),
207
-					array (
208
-							gettext ( 'Disposition' ),
207
+					array(
208
+							gettext('Disposition'),
209 209
 							'disposition',
210 210
 							'SELECT',
211 211
 							'',
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 							'',
218 218
 							'set_despostion' 
219 219
 					),
220
-					array (
221
-							gettext ( 'Account' ),
220
+					array(
221
+							gettext('Account'),
222 222
 							'accountid',
223 223
 							'SELECT',
224 224
 							'',
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
 							'accounts',
231 231
 							'build_dropdown_deleted',
232 232
 							'where_arr',
233
-							array (
233
+							array(
234 234
 									"reseller_id" => "0",
235 235
 									"type" => "GLOBAL" 
236 236
 							) 
237 237
 					),
238 238
 					
239
-					array (
240
-							gettext ( 'Trunk' ),
239
+					array(
240
+							gettext('Trunk'),
241 241
 							'trunk_id',
242 242
 							'SELECT',
243 243
 							'',
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 							'trunks',
250 250
 							'build_dropdown_deleted',
251 251
 							'',
252
-							array (
252
+							array(
253 253
 									"status" => "1" 
254 254
 							) 
255 255
 					),
256 256
 					
257
-					array (
258
-							gettext ( 'Rate Group' ),
257
+					array(
258
+							gettext('Rate Group'),
259 259
 							'pricelist_id',
260 260
 							'SELECT',
261 261
 							'',
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 							'pricelists',
268 268
 							'build_dropdown_deleted',
269 269
 							'where_arr',
270
-							array (
270
+							array(
271 271
 									"reseller_id" => "0" 
272 272
 							) 
273 273
 					),
274
-					array (
275
-							gettext ( 'Call Type' ),
274
+					array(
275
+							gettext('Call Type'),
276 276
 							'calltype',
277 277
 							'SELECT',
278 278
 							'',
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 							'',
285 285
 							'set_calltype' 
286 286
 					),
287
-					array (
287
+					array(
288 288
 							'',
289 289
 							'HIDDEN',
290 290
 							'ajax_search',
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 							'',
294 294
 							'' 
295 295
 					),
296
-					array (
296
+					array(
297 297
 							'',
298 298
 							'HIDDEN',
299 299
 							'advance_search',
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 					) 
305 305
 			);
306 306
 		} else {
307
-			$form ['forms'] = array (
307
+			$form ['forms'] = array(
308 308
 					"",
309
-					array (
309
+					array(
310 310
 							'id' => "cdr_customer_search" 
311 311
 					) 
312 312
 			);
313
-			$form [gettext ( 'Search' )] = array (
314
-					array (
315
-							gettext ( 'From Date' ),
313
+			$form [gettext('Search')] = array(
314
+					array(
315
+							gettext('From Date'),
316 316
 							'INPUT',
317
-							array (
317
+							array(
318 318
 									'name' => 'callstart[]',
319 319
 									'id' => 'customer_cdr_from_date',
320 320
 									'size' => '20',
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 							'',
326 326
 							'start_date[start_date-date]' 
327 327
 					),
328
-					array (
329
-							gettext ( 'To Date' ),
328
+					array(
329
+							gettext('To Date'),
330 330
 							'INPUT',
331
-							array (
331
+							array(
332 332
 									'name' => 'callstart[]',
333 333
 									'id' => 'customer_cdr_to_date',
334 334
 									'size' => '20',
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 							'',
340 340
 							'end_date[end_date-date]' 
341 341
 					),
342
-					array (
343
-							gettext ( 'Caller ID' ),
342
+					array(
343
+							gettext('Caller ID'),
344 344
 							'INPUT',
345
-							array (
345
+							array(
346 346
 									'name' => 'callerid[callerid]',
347 347
 									'',
348 348
 									'id' => 'first_name',
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 							'search_string_type',
360 360
 							'' 
361 361
 					),
362
-					array (
363
-							gettext ( 'Called Number' ),
362
+					array(
363
+							gettext('Called Number'),
364 364
 							'INPUT',
365
-							array (
365
+							array(
366 366
 									'name' => 'callednum[callednum]',
367 367
 									'value' => '',
368 368
 									'size' => '20',
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 							'search_string_type',
379 379
 							'' 
380 380
 					),
381
-					array (
382
-							gettext ( 'Code' ),
381
+					array(
382
+							gettext('Code'),
383 383
 							'INPUT',
384
-							array (
384
+							array(
385 385
 									'name' => 'pattern[pattern]',
386 386
 									'value' => '',
387 387
 									'size' => '20',
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 							'search_string_type',
398 398
 							'' 
399 399
 					),
400
-					array (
401
-							gettext ( 'Destination' ),
400
+					array(
401
+							gettext('Destination'),
402 402
 							'INPUT',
403
-							array (
403
+							array(
404 404
 									'name' => 'notes[notes]',
405 405
 									'value' => '',
406 406
 									'size' => '20',
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
 							'search_string_type',
417 417
 							'' 
418 418
 					),
419
-					array (
420
-							gettext ( 'Duration' ),
419
+					array(
420
+							gettext('Duration'),
421 421
 							'INPUT',
422
-							array (
422
+							array(
423 423
 									'name' => 'billseconds[billseconds]',
424 424
 									'value' => '',
425 425
 									'size' => '20',
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
 							'search_int_type',
436 436
 							'' 
437 437
 					),
438
-					array (
439
-							gettext ( 'Debit' ),
438
+					array(
439
+							gettext('Debit'),
440 440
 							'INPUT',
441
-							array (
441
+							array(
442 442
 									'name' => 'debit[debit]',
443 443
 									'value' => '',
444 444
 									'size' => '20',
@@ -454,10 +454,10 @@  discard block
 block discarded – undo
454 454
 							'search_int_type',
455 455
 							'' 
456 456
 					),
457
-					array (
458
-							gettext ( 'Cost' ),
457
+					array(
458
+							gettext('Cost'),
459 459
 							'INPUT',
460
-							array (
460
+							array(
461 461
 									'name' => 'cost[cost]',
462 462
 									'value' => '',
463 463
 									'size' => '20',
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 							'search_int_type',
474 474
 							'' 
475 475
 					),
476
-					array (
477
-							gettext ( 'Disposition' ),
476
+					array(
477
+							gettext('Disposition'),
478 478
 							'disposition',
479 479
 							'SELECT',
480 480
 							'',
@@ -486,8 +486,8 @@  discard block
 block discarded – undo
486 486
 							'',
487 487
 							'set_despostion' 
488 488
 					),
489
-					array (
490
-							gettext ( 'Account' ),
489
+					array(
490
+							gettext('Account'),
491 491
 							'accountid',
492 492
 							'SELECT',
493 493
 							'',
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 							'accounts',
500 500
 							'build_dropdown_deleted',
501 501
 							'where_arr',
502
-							array (
502
+							array(
503 503
 									"reseller_id" => "0",
504 504
 									"type" => "GLOBAL" 
505 505
 							) 
@@ -507,8 +507,8 @@  discard block
 block discarded – undo
507 507
 					
508 508
 					// array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`status`=2, concat(name,"","^"),name) as name', 'trunks', 'build_dropdown_deleted', '', array("status" => "1")),
509 509
 					
510
-					array (
511
-							gettext ( 'Rate Group' ),
510
+					array(
511
+							gettext('Rate Group'),
512 512
 							'pricelist_id',
513 513
 							'SELECT',
514 514
 							'',
@@ -520,12 +520,12 @@  discard block
 block discarded – undo
520 520
 							'pricelists',
521 521
 							'build_dropdown_deleted',
522 522
 							'where_arr',
523
-							array (
523
+							array(
524 524
 									"reseller_id" => "0" 
525 525
 							) 
526 526
 					),
527
-					array (
528
-							gettext ( 'Call Type' ),
527
+					array(
528
+							gettext('Call Type'),
529 529
 							'calltype',
530 530
 							'SELECT',
531 531
 							'',
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 							'',
538 538
 							'set_calltype' 
539 539
 					),
540
-					array (
540
+					array(
541 541
 							'',
542 542
 							'HIDDEN',
543 543
 							'ajax_search',
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 							'',
547 547
 							'' 
548 548
 					),
549
-					array (
549
+					array(
550 550
 							'',
551 551
 							'HIDDEN',
552 552
 							'advance_search',
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 			);
559 559
 		}
560 560
 		
561
-		$form ['display_in'] = array (
561
+		$form ['display_in'] = array(
562 562
 				'name' => 'search_in',
563 563
 				"id" => "search_in",
564 564
 				"function" => "search_report_in",
@@ -572,19 +572,19 @@  discard block
 block discarded – undo
572 572
 		/**
573 573
 		 * *************************************
574 574
 		 */
575
-		$form ['button_search'] = array (
575
+		$form ['button_search'] = array(
576 576
 				'name' => 'action',
577 577
 				'id' => "cusotmer_cdr_search_btn",
578
-				'content' => gettext ( 'Search' ),
578
+				'content' => gettext('Search'),
579 579
 				'value' => 'save',
580 580
 				'type' => 'button',
581 581
 				'class' => 'btn btn-line-parrot pull-right' 
582 582
 		);
583
-		$form ['button_reset'] = array (
583
+		$form ['button_reset'] = array(
584 584
 				'name' => 'action',
585 585
 				'id' => "id_reset",
586 586
 				'content' => 'Clear',
587
-				'value' => gettext ( 'Cancel' ),
587
+				'value' => gettext('Cancel'),
588 588
 				'type' => 'reset',
589 589
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
590 590
 		);
@@ -592,17 +592,17 @@  discard block
 block discarded – undo
592 592
 		return $form;
593 593
 	}
594 594
 	function get_reseller_cdr_form() {
595
-		$form ['forms'] = array (
595
+		$form ['forms'] = array(
596 596
 				"",
597
-				array (
597
+				array(
598 598
 						'id' => "cdr_reseller_search" 
599 599
 				) 
600 600
 		);
601
-		$form [gettext ( 'Search' )] = array (
602
-				array (
603
-						gettext ( 'From Date' ),
601
+		$form [gettext('Search')] = array(
602
+				array(
603
+						gettext('From Date'),
604 604
 						'INPUT',
605
-						array (
605
+						array(
606 606
 								'name' => 'callstart[]',
607 607
 								'id' => 'customer_cdr_from_date',
608 608
 								'size' => '20',
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
 						'',
614 614
 						'number[number-string]' 
615 615
 				),
616
-				array (
617
-						gettext ( 'To Date' ),
616
+				array(
617
+						gettext('To Date'),
618 618
 						'INPUT',
619
-						array (
619
+						array(
620 620
 								'name' => 'callstart[]',
621 621
 								'id' => 'customer_cdr_to_date',
622 622
 								'size' => '20',
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 						'',
628 628
 						'number[number-string]' 
629 629
 				),
630
-				array (
631
-						gettext ( 'Caller ID' ),
630
+				array(
631
+						gettext('Caller ID'),
632 632
 						'INPUT',
633
-						array (
633
+						array(
634 634
 								'name' => 'callerid[callerid]',
635 635
 								'',
636 636
 								'id' => 'first_name',
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 						'search_string_type',
648 648
 						'' 
649 649
 				),
650
-				array (
651
-						gettext ( 'Called Number' ),
650
+				array(
651
+						gettext('Called Number'),
652 652
 						'INPUT',
653
-						array (
653
+						array(
654 654
 								'name' => 'callednum[callednum]',
655 655
 								'value' => '',
656 656
 								'size' => '20',
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
 						'' 
668 668
 				),
669 669
 				
670
-				array (
671
-						gettext ( 'Code' ),
670
+				array(
671
+						gettext('Code'),
672 672
 						'INPUT',
673
-						array (
673
+						array(
674 674
 								'name' => 'pattern[pattern]',
675 675
 								'value' => '',
676 676
 								'size' => '20',
@@ -686,10 +686,10 @@  discard block
 block discarded – undo
686 686
 						'search_string_type',
687 687
 						'' 
688 688
 				),
689
-				array (
690
-						gettext ( 'Destination' ),
689
+				array(
690
+						gettext('Destination'),
691 691
 						'INPUT',
692
-						array (
692
+						array(
693 693
 								'name' => 'notes[notes]',
694 694
 								'value' => '',
695 695
 								'size' => '20',
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 						'' 
707 707
 				),
708 708
 				
709
-				array (
710
-						gettext ( 'Duration' ),
709
+				array(
710
+						gettext('Duration'),
711 711
 						'INPUT',
712
-						array (
712
+						array(
713 713
 								'name' => 'billseconds[billseconds]',
714 714
 								'value' => '',
715 715
 								'size' => '20',
@@ -725,10 +725,10 @@  discard block
 block discarded – undo
725 725
 						'search_int_type',
726 726
 						'' 
727 727
 				),
728
-				array (
729
-						gettext ( 'Debit' ),
728
+				array(
729
+						gettext('Debit'),
730 730
 						'INPUT',
731
-						array (
731
+						array(
732 732
 								'name' => 'debit[debit]',
733 733
 								'value' => '',
734 734
 								'size' => '20',
@@ -744,10 +744,10 @@  discard block
 block discarded – undo
744 744
 						'search_int_type',
745 745
 						'' 
746 746
 				),
747
-				array (
748
-						gettext ( 'Cost' ),
747
+				array(
748
+						gettext('Cost'),
749 749
 						'INPUT',
750
-						array (
750
+						array(
751 751
 								'name' => 'cost[cost]',
752 752
 								'value' => '',
753 753
 								'size' => '20',
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 						'' 
765 765
 				),
766 766
 				
767
-				array (
768
-						gettext ( 'Disposition' ),
767
+				array(
768
+						gettext('Disposition'),
769 769
 						'disposition',
770 770
 						'SELECT',
771 771
 						'',
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 						'',
778 778
 						'set_despostion' 
779 779
 				),
780
-				array (
781
-						gettext ( 'Account' ),
780
+				array(
781
+						gettext('Account'),
782 782
 						'accountid',
783 783
 						'SELECT',
784 784
 						'',
@@ -790,13 +790,13 @@  discard block
 block discarded – undo
790 790
 						'accounts',
791 791
 						'build_dropdown_deleted',
792 792
 						'where_arr',
793
-						array (
793
+						array(
794 794
 								"reseller_id" => "0",
795 795
 								"type" => "1" 
796 796
 						) 
797 797
 				),
798
-				array (
799
-						gettext ( 'Rate Group' ),
798
+				array(
799
+						gettext('Rate Group'),
800 800
 						'pricelist_id',
801 801
 						'SELECT',
802 802
 						'',
@@ -808,12 +808,12 @@  discard block
 block discarded – undo
808 808
 						'pricelists',
809 809
 						'build_dropdown_deleted',
810 810
 						'where_arr',
811
-						array (
811
+						array(
812 812
 								"reseller_id" => "0" 
813 813
 						) 
814 814
 				),
815
-				array (
816
-						gettext ( 'Call Type' ),
815
+				array(
816
+						gettext('Call Type'),
817 817
 						'calltype',
818 818
 						'SELECT',
819 819
 						'',
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 						'set_calltype' 
827 827
 				),
828 828
 				
829
-				array (
829
+				array(
830 830
 						'',
831 831
 						'HIDDEN',
832 832
 						'ajax_search',
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 						'',
836 836
 						'' 
837 837
 				),
838
-				array (
838
+				array(
839 839
 						'',
840 840
 						'HIDDEN',
841 841
 						'advance_search',
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 						'' 
846 846
 				) 
847 847
 		);
848
-		if ($this->CI->session->userdata ( 'logintype' ) != 1 && $this->CI->session->userdata ( 'logintype' ) != 5) {
849
-			$new_Array = array (
848
+		if ($this->CI->session->userdata('logintype') != 1 && $this->CI->session->userdata('logintype') != 5) {
849
+			$new_Array = array(
850 850
 					'Trunk',
851 851
 					'trunk_id',
852 852
 					'SELECT',
@@ -859,13 +859,13 @@  discard block
 block discarded – undo
859 859
 					'trunks',
860 860
 					'build_dropdown',
861 861
 					'where_arr',
862
-					array (
862
+					array(
863 863
 							"status" => "1" 
864 864
 					) 
865 865
 			);
866 866
 		}
867 867
 		
868
-		$form ['display_in'] = array (
868
+		$form ['display_in'] = array(
869 869
 				'name' => 'search_in',
870 870
 				"id" => "search_in",
871 871
 				"function" => "search_report_in",
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 		/**
880 880
 		 * *************************************
881 881
 		 */
882
-		$form ['button_search'] = array (
882
+		$form ['button_search'] = array(
883 883
 				'name' => 'action',
884 884
 				'id' => "reseller_cdr_search_btn",
885
-				'content' => gettext ( 'Search' ),
885
+				'content' => gettext('Search'),
886 886
 				'value' => 'save',
887 887
 				'type' => 'button',
888 888
 				'class' => 'btn btn-line-parrot pull-right' 
889 889
 		);
890
-		$form ['button_reset'] = array (
890
+		$form ['button_reset'] = array(
891 891
 				'name' => 'action',
892 892
 				'id' => "id_reset",
893 893
 				'content' => 'Clear',
894
-				'value' => gettext ( 'Cancel' ),
894
+				'value' => gettext('Cancel'),
895 895
 				'type' => 'reset',
896 896
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
897 897
 		);
@@ -899,17 +899,17 @@  discard block
 block discarded – undo
899 899
 		return $form;
900 900
 	}
901 901
 	function get_provider_cdr_form() {
902
-		$form ['forms'] = array (
902
+		$form ['forms'] = array(
903 903
 				"",
904
-				array (
904
+				array(
905 905
 						'id' => "cdr_provider_search" 
906 906
 				) 
907 907
 		);
908
-		$form [gettext ( 'Search' )] = array (
909
-				array (
910
-						gettext ( 'From Date' ),
908
+		$form [gettext('Search')] = array(
909
+				array(
910
+						gettext('From Date'),
911 911
 						'INPUT',
912
-						array (
912
+						array(
913 913
 								'name' => 'callstart[]',
914 914
 								'id' => 'customer_cdr_from_date',
915 915
 								'size' => '20',
@@ -920,10 +920,10 @@  discard block
 block discarded – undo
920 920
 						'',
921 921
 						'number[number-string]' 
922 922
 				),
923
-				array (
924
-						gettext ( 'To Date' ),
923
+				array(
924
+						gettext('To Date'),
925 925
 						'INPUT',
926
-						array (
926
+						array(
927 927
 								'name' => 'callstart[]',
928 928
 								'id' => 'customer_cdr_to_date',
929 929
 								'size' => '20',
@@ -934,10 +934,10 @@  discard block
 block discarded – undo
934 934
 						'',
935 935
 						'number[number-string]' 
936 936
 				),
937
-				array (
938
-						gettext ( 'Caller ID' ),
937
+				array(
938
+						gettext('Caller ID'),
939 939
 						'INPUT',
940
-						array (
940
+						array(
941 941
 								'name' => 'callerid[callerid]',
942 942
 								'',
943 943
 								'id' => 'first_name',
@@ -954,10 +954,10 @@  discard block
 block discarded – undo
954 954
 						'search_string_type',
955 955
 						'' 
956 956
 				),
957
-				array (
958
-						gettext ( 'Called Number' ),
957
+				array(
958
+						gettext('Called Number'),
959 959
 						'INPUT',
960
-						array (
960
+						array(
961 961
 								'name' => 'callednum[callednum]',
962 962
 								'value' => '',
963 963
 								'size' => '20',
@@ -973,10 +973,10 @@  discard block
 block discarded – undo
973 973
 						'search_string_type',
974 974
 						'' 
975 975
 				),
976
-				array (
977
-						gettext ( 'Code' ),
976
+				array(
977
+						gettext('Code'),
978 978
 						'INPUT',
979
-						array (
979
+						array(
980 980
 								'name' => 'pattern[pattern]',
981 981
 								'value' => '',
982 982
 								'size' => '20',
@@ -992,10 +992,10 @@  discard block
 block discarded – undo
992 992
 						'search_string_type',
993 993
 						'' 
994 994
 				),
995
-				array (
996
-						gettext ( 'Destination' ),
995
+				array(
996
+						gettext('Destination'),
997 997
 						'INPUT',
998
-						array (
998
+						array(
999 999
 								'name' => 'notes[notes]',
1000 1000
 								'value' => '',
1001 1001
 								'size' => '20',
@@ -1011,10 +1011,10 @@  discard block
 block discarded – undo
1011 1011
 						'search_string_type',
1012 1012
 						'' 
1013 1013
 				),
1014
-				array (
1015
-						gettext ( 'Duration' ),
1014
+				array(
1015
+						gettext('Duration'),
1016 1016
 						'INPUT',
1017
-						array (
1017
+						array(
1018 1018
 								'name' => 'billseconds[billseconds]',
1019 1019
 								'value' => '',
1020 1020
 								'size' => '20',
@@ -1030,10 +1030,10 @@  discard block
 block discarded – undo
1030 1030
 						'search_int_type',
1031 1031
 						'' 
1032 1032
 				),
1033
-				array (
1034
-						gettext ( 'Cost' ),
1033
+				array(
1034
+						gettext('Cost'),
1035 1035
 						'INPUT',
1036
-						array (
1036
+						array(
1037 1037
 								'name' => 'provider_call_cost[provider_call_cost]',
1038 1038
 								'value' => '',
1039 1039
 								'size' => '20',
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 						'' 
1051 1051
 				),
1052 1052
 				// array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
1053
-				array (
1054
-						gettext ( 'Disposition' ),
1053
+				array(
1054
+						gettext('Disposition'),
1055 1055
 						'disposition',
1056 1056
 						'SELECT',
1057 1057
 						'',
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 						'',
1064 1064
 						'set_despostion' 
1065 1065
 				),
1066
-				array (
1067
-						gettext ( 'Account' ),
1066
+				array(
1067
+						gettext('Account'),
1068 1068
 						'provider_id',
1069 1069
 						'SELECT',
1070 1070
 						'',
@@ -1076,12 +1076,12 @@  discard block
 block discarded – undo
1076 1076
 						'accounts',
1077 1077
 						'build_dropdown_deleted',
1078 1078
 						'where_arr',
1079
-						array (
1079
+						array(
1080 1080
 								"reseller_id" => "0",
1081 1081
 								"type" => "3" 
1082 1082
 						) 
1083 1083
 				),
1084
-				array (
1084
+				array(
1085 1085
 						'',
1086 1086
 						'HIDDEN',
1087 1087
 						'ajax_search',
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 						'',
1091 1091
 						'' 
1092 1092
 				),
1093
-				array (
1093
+				array(
1094 1094
 						'',
1095 1095
 						'HIDDEN',
1096 1096
 						'advance_search',
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 		// array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', '', ''),
1104 1104
 		
1105 1105
 		;
1106
-		$form ['display_in'] = array (
1106
+		$form ['display_in'] = array(
1107 1107
 				'name' => 'search_in',
1108 1108
 				"id" => "search_in",
1109 1109
 				"function" => "search_report_in",
@@ -1117,18 +1117,18 @@  discard block
 block discarded – undo
1117 1117
 		/**
1118 1118
 		 * *************************************
1119 1119
 		 */
1120
-		$form ['button_search'] = array (
1120
+		$form ['button_search'] = array(
1121 1121
 				'name' => 'action',
1122 1122
 				'id' => "provider_cdr_search_btn",
1123
-				'content' => gettext ( 'Search' ),
1123
+				'content' => gettext('Search'),
1124 1124
 				'value' => 'save',
1125 1125
 				'type' => 'button',
1126 1126
 				'class' => 'btn btn-line-parrot pull-right' 
1127 1127
 		);
1128
-		$form ['button_reset'] = array (
1128
+		$form ['button_reset'] = array(
1129 1129
 				'name' => 'action',
1130 1130
 				'id' => "id_reset",
1131
-				'content' => gettext ( 'Clear' ),
1131
+				'content' => gettext('Clear'),
1132 1132
 				'value' => 'Cancel',
1133 1133
 				'type' => 'reset',
1134 1134
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -1144,20 +1144,20 @@  discard block
 block discarded – undo
1144 1144
 	 * *****
1145 1145
 	 */
1146 1146
 	function build_report_list_for_customer() {
1147
-		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
1147
+		$logintype = $this->CI->session->userdata('userlevel_logintype');
1148 1148
 		if ($logintype != 1) {
1149
-			$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1149
+			$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1150 1150
 			$currency_id = $account_info ['currency_id'];
1151
-			$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1151
+			$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1152 1152
 			
1153 1153
 			// $recording=array();
1154
-			$account_data = $this->CI->session->userdata ( "accountinfo" );
1154
+			$account_data = $this->CI->session->userdata("accountinfo");
1155 1155
 			// if($account_data['type'] == 1){
1156 1156
 			// $recording=array("Recording", "127", "recording", "", "", "");
1157 1157
 			// }
1158
-			$grid_field_arr = json_encode ( array (
1159
-					array (
1160
-							gettext ( "Date" ),
1158
+			$grid_field_arr = json_encode(array(
1159
+					array(
1160
+							gettext("Date"),
1161 1161
 							"100",
1162 1162
 							"callstart",
1163 1163
 							"callstart",
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
 							"true",
1168 1168
 							"center" 
1169 1169
 					),
1170
-					array (
1171
-							gettext ( "Caller ID" ),
1170
+					array(
1171
+							gettext("Caller ID"),
1172 1172
 							"120",
1173 1173
 							"callerid",
1174 1174
 							"",
@@ -1178,8 +1178,8 @@  discard block
 block discarded – undo
1178 1178
 							"true",
1179 1179
 							"center" 
1180 1180
 					),
1181
-					array (
1182
-							gettext ( "Called Number" ),
1181
+					array(
1182
+							gettext("Called Number"),
1183 1183
 							"103",
1184 1184
 							"callednum",
1185 1185
 							"",
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 							"true",
1190 1190
 							"center" 
1191 1191
 					),
1192
-					array (
1193
-							gettext ( "Code" ),
1192
+					array(
1193
+							gettext("Code"),
1194 1194
 							"71",
1195 1195
 							"pattern",
1196 1196
 							"pattern",
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 							"true",
1201 1201
 							"center" 
1202 1202
 					),
1203
-					array (
1204
-							gettext ( "Destination" ),
1203
+					array(
1204
+							gettext("Destination"),
1205 1205
 							"90",
1206 1206
 							"notes",
1207 1207
 							"",
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
 							"true",
1212 1212
 							"center" 
1213 1213
 					),
1214
-					array (
1215
-							gettext ( "Duration" ),
1214
+					array(
1215
+							gettext("Duration"),
1216 1216
 							"80",
1217 1217
 							"billseconds",
1218 1218
 							"customer_cdr_list_search",
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 							"true",
1223 1223
 							"center" 
1224 1224
 					),
1225
-					array (
1226
-							gettext ( "Debit($currency)" ),
1225
+					array(
1226
+							gettext("Debit($currency)"),
1227 1227
 							"75",
1228 1228
 							"debit",
1229 1229
 							"debit",
@@ -1233,8 +1233,8 @@  discard block
 block discarded – undo
1233 1233
 							"true",
1234 1234
 							"right" 
1235 1235
 					),
1236
-					array (
1237
-							gettext ( "Cost($currency)" ),
1236
+					array(
1237
+							gettext("Cost($currency)"),
1238 1238
 							"75",
1239 1239
 							"cost",
1240 1240
 							"cost",
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
 							"true",
1245 1245
 							"right" 
1246 1246
 					),
1247
-					array (
1248
-							gettext ( "Disposition" ),
1247
+					array(
1248
+							gettext("Disposition"),
1249 1249
 							"150",
1250 1250
 							"disposition",
1251 1251
 							"",
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 							"true",
1256 1256
 							"center" 
1257 1257
 					),
1258
-					array (
1259
-							gettext ( "Account" ),
1258
+					array(
1259
+							gettext("Account"),
1260 1260
 							"110",
1261 1261
 							"accountid",
1262 1262
 							"first_name,last_name,number",
@@ -1266,8 +1266,8 @@  discard block
 block discarded – undo
1266 1266
 							"true",
1267 1267
 							"center" 
1268 1268
 					),
1269
-					array (
1270
-							gettext ( "Trunk" ),
1269
+					array(
1270
+							gettext("Trunk"),
1271 1271
 							"90",
1272 1272
 							"trunk_id",
1273 1273
 							"name",
@@ -1277,8 +1277,8 @@  discard block
 block discarded – undo
1277 1277
 							"true",
1278 1278
 							"center" 
1279 1279
 					),
1280
-					array (
1281
-							gettext ( "Rate Group" ),
1280
+					array(
1281
+							gettext("Rate Group"),
1282 1282
 							"90",
1283 1283
 							"pricelist_id",
1284 1284
 							"name",
@@ -1288,8 +1288,8 @@  discard block
 block discarded – undo
1288 1288
 							"true",
1289 1289
 							"center" 
1290 1290
 					),
1291
-					array (
1292
-							gettext ( "Call Type" ),
1291
+					array(
1292
+							gettext("Call Type"),
1293 1293
 							"112",
1294 1294
 							"calltype",
1295 1295
 							"",
@@ -1300,13 +1300,13 @@  discard block
 block discarded – undo
1300 1300
 			// $recording,
1301 1301
 			 );
1302 1302
 		} else {
1303
-			$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1303
+			$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1304 1304
 			$currency_id = $account_info ['currency_id'];
1305
-			$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1305
+			$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1306 1306
 			// $recording=array("Recording", "127", "recording", "", "", "");
1307
-			$grid_field_arr = json_encode ( array (
1308
-					array (
1309
-							gettext ( "Date" ),
1307
+			$grid_field_arr = json_encode(array(
1308
+					array(
1309
+							gettext("Date"),
1310 1310
 							"100",
1311 1311
 							"callstart",
1312 1312
 							"callstart",
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
 							"true",
1317 1317
 							"center" 
1318 1318
 					),
1319
-					array (
1320
-							gettext ( "Caller ID" ),
1319
+					array(
1320
+							gettext("Caller ID"),
1321 1321
 							"100",
1322 1322
 							"callerid",
1323 1323
 							"",
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
 							"true",
1328 1328
 							"center" 
1329 1329
 					),
1330
-					array (
1331
-							gettext ( "Called Number" ),
1330
+					array(
1331
+							gettext("Called Number"),
1332 1332
 							"103",
1333 1333
 							"callednum",
1334 1334
 							"",
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
 							"true",
1339 1339
 							"center" 
1340 1340
 					),
1341
-					array (
1342
-							gettext ( "Code" ),
1341
+					array(
1342
+							gettext("Code"),
1343 1343
 							"71",
1344 1344
 							"pattern",
1345 1345
 							"pattern",
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 							"true",
1350 1350
 							"center" 
1351 1351
 					),
1352
-					array (
1353
-							gettext ( "Destination" ),
1352
+					array(
1353
+							gettext("Destination"),
1354 1354
 							"90",
1355 1355
 							"notes",
1356 1356
 							"",
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
 							"true",
1361 1361
 							"center" 
1362 1362
 					),
1363
-					array (
1364
-							gettext ( "Duration" ),
1363
+					array(
1364
+							gettext("Duration"),
1365 1365
 							"80",
1366 1366
 							"billseconds",
1367 1367
 							"customer_cdr_list_search",
@@ -1371,8 +1371,8 @@  discard block
 block discarded – undo
1371 1371
 							"true",
1372 1372
 							"center" 
1373 1373
 					),
1374
-					array (
1375
-							gettext ( "Debit($currency)" ),
1374
+					array(
1375
+							gettext("Debit($currency)"),
1376 1376
 							"75",
1377 1377
 							"debit",
1378 1378
 							"debit",
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
 							"true",
1383 1383
 							"right" 
1384 1384
 					),
1385
-					array (
1386
-							gettext ( "Cost($currency)" ),
1385
+					array(
1386
+							gettext("Cost($currency)"),
1387 1387
 							"75",
1388 1388
 							"cost",
1389 1389
 							"cost",
@@ -1393,8 +1393,8 @@  discard block
 block discarded – undo
1393 1393
 							"true",
1394 1394
 							"right" 
1395 1395
 					),
1396
-					array (
1397
-							gettext ( "Disposition" ),
1396
+					array(
1397
+							gettext("Disposition"),
1398 1398
 							"130",
1399 1399
 							"disposition",
1400 1400
 							"",
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
 							"true",
1405 1405
 							"center" 
1406 1406
 					),
1407
-					array (
1408
-							gettext ( "Account" ),
1407
+					array(
1408
+							gettext("Account"),
1409 1409
 							"110",
1410 1410
 							"accountid",
1411 1411
 							"first_name,last_name,number",
@@ -1416,8 +1416,8 @@  discard block
 block discarded – undo
1416 1416
 							"center" 
1417 1417
 					),
1418 1418
 					// array("Trunk", "90", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
1419
-					array (
1420
-							gettext ( "Rate Group" ),
1419
+					array(
1420
+							gettext("Rate Group"),
1421 1421
 							"159",
1422 1422
 							"pricelist_id",
1423 1423
 							"name",
@@ -1427,8 +1427,8 @@  discard block
 block discarded – undo
1427 1427
 							"true",
1428 1428
 							"center" 
1429 1429
 					),
1430
-					array (
1431
-							gettext ( "Call Type" ),
1430
+					array(
1431
+							gettext("Call Type"),
1432 1432
 							"112",
1433 1433
 							"calltype",
1434 1434
 							"",
@@ -1446,14 +1446,14 @@  discard block
 block discarded – undo
1446 1446
 	 * ***************************
1447 1447
 	 */
1448 1448
 	function build_report_list_for_reseller() {
1449
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1449
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1450 1450
 		$currency_id = $account_info ['currency_id'];
1451
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1451
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1452 1452
 		
1453 1453
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1454
-		$grid_field_arr = json_encode ( array (
1455
-				array (
1456
-						gettext ( "Date" ),
1454
+		$grid_field_arr = json_encode(array(
1455
+				array(
1456
+						gettext("Date"),
1457 1457
 						"100",
1458 1458
 						"callstart",
1459 1459
 						"callstart",
@@ -1463,8 +1463,8 @@  discard block
 block discarded – undo
1463 1463
 						"true",
1464 1464
 						"center" 
1465 1465
 				),
1466
-				array (
1467
-						gettext ( "Caller ID" ),
1466
+				array(
1467
+						gettext("Caller ID"),
1468 1468
 						"100",
1469 1469
 						"callerid",
1470 1470
 						"",
@@ -1474,8 +1474,8 @@  discard block
 block discarded – undo
1474 1474
 						"true",
1475 1475
 						"center" 
1476 1476
 				),
1477
-				array (
1478
-						gettext ( "Called Number" ),
1477
+				array(
1478
+						gettext("Called Number"),
1479 1479
 						"120",
1480 1480
 						"callednum",
1481 1481
 						"",
@@ -1485,8 +1485,8 @@  discard block
 block discarded – undo
1485 1485
 						"true",
1486 1486
 						"center" 
1487 1487
 				),
1488
-				array (
1489
-						gettext ( "Code" ),
1488
+				array(
1489
+						gettext("Code"),
1490 1490
 						"80",
1491 1491
 						"pattern",
1492 1492
 						"pattern",
@@ -1496,8 +1496,8 @@  discard block
 block discarded – undo
1496 1496
 						"true",
1497 1497
 						"center" 
1498 1498
 				),
1499
-				array (
1500
-						gettext ( "Destination" ),
1499
+				array(
1500
+						gettext("Destination"),
1501 1501
 						"120",
1502 1502
 						"notes",
1503 1503
 						"",
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
 						"true",
1508 1508
 						"center" 
1509 1509
 				),
1510
-				array (
1511
-						gettext ( "Duration" ),
1510
+				array(
1511
+						gettext("Duration"),
1512 1512
 						"107",
1513 1513
 						"billseconds",
1514 1514
 						"reseller_cdr_list_search",
@@ -1518,8 +1518,8 @@  discard block
 block discarded – undo
1518 1518
 						"true",
1519 1519
 						"center" 
1520 1520
 				),
1521
-				array (
1522
-						gettext ( "Debit($currency)" ),
1521
+				array(
1522
+						gettext("Debit($currency)"),
1523 1523
 						"105",
1524 1524
 						"debit",
1525 1525
 						"debit",
@@ -1529,8 +1529,8 @@  discard block
 block discarded – undo
1529 1529
 						"true",
1530 1530
 						"right" 
1531 1531
 				),
1532
-				array (
1533
-						gettext ( "Cost($currency)" ),
1532
+				array(
1533
+						gettext("Cost($currency)"),
1534 1534
 						"104",
1535 1535
 						"cost",
1536 1536
 						"cost",
@@ -1540,8 +1540,8 @@  discard block
 block discarded – undo
1540 1540
 						"true",
1541 1541
 						"right" 
1542 1542
 				),
1543
-				array (
1544
-						gettext ( "Disposition" ),
1543
+				array(
1544
+						gettext("Disposition"),
1545 1545
 						"100",
1546 1546
 						"disposition",
1547 1547
 						"",
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 						"true",
1552 1552
 						"center" 
1553 1553
 				),
1554
-				array (
1555
-						gettext ( "Account" ),
1554
+				array(
1555
+						gettext("Account"),
1556 1556
 						"120",
1557 1557
 						"accountid",
1558 1558
 						"first_name,last_name,number",
@@ -1562,8 +1562,8 @@  discard block
 block discarded – undo
1562 1562
 						"true",
1563 1563
 						"center" 
1564 1564
 				),
1565
-				array (
1566
-						gettext ( "Rate Group" ),
1565
+				array(
1566
+						gettext("Rate Group"),
1567 1567
 						"90",
1568 1568
 						"pricelist_id",
1569 1569
 						"name",
@@ -1573,8 +1573,8 @@  discard block
 block discarded – undo
1573 1573
 						"true",
1574 1574
 						"center" 
1575 1575
 				),
1576
-				array (
1577
-						gettext ( "Call Type" ),
1576
+				array(
1577
+						gettext("Call Type"),
1578 1578
 						"120",
1579 1579
 						"calltype",
1580 1580
 						"",
@@ -1589,13 +1589,13 @@  discard block
 block discarded – undo
1589 1589
 		return $grid_field_arr;
1590 1590
 	}
1591 1591
 	function build_report_list_for_provider() {
1592
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1592
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1593 1593
 		$currency_id = $account_info ['currency_id'];
1594
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1594
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1595 1595
 		
1596 1596
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1597
-		$grid_field_arr = json_encode ( array (
1598
-				array (
1597
+		$grid_field_arr = json_encode(array(
1598
+				array(
1599 1599
 						"Date",
1600 1600
 						"100",
1601 1601
 						"callstart",
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
 						"true",
1607 1607
 						"center" 
1608 1608
 				),
1609
-				array (
1610
-						gettext ( "Caller ID" ),
1609
+				array(
1610
+						gettext("Caller ID"),
1611 1611
 						"120",
1612 1612
 						"callerid",
1613 1613
 						"",
@@ -1617,8 +1617,8 @@  discard block
 block discarded – undo
1617 1617
 						"true",
1618 1618
 						"center" 
1619 1619
 				),
1620
-				array (
1621
-						gettext ( "Called Number" ),
1620
+				array(
1621
+						gettext("Called Number"),
1622 1622
 						"160",
1623 1623
 						"callednum",
1624 1624
 						"",
@@ -1628,8 +1628,8 @@  discard block
 block discarded – undo
1628 1628
 						"true",
1629 1629
 						"center" 
1630 1630
 				),
1631
-				array (
1632
-						gettext ( "Code" ),
1631
+				array(
1632
+						gettext("Code"),
1633 1633
 						"117",
1634 1634
 						"pattern",
1635 1635
 						"pattern",
@@ -1639,8 +1639,8 @@  discard block
 block discarded – undo
1639 1639
 						"true",
1640 1640
 						"center" 
1641 1641
 				),
1642
-				array (
1643
-						gettext ( "Destination" ),
1642
+				array(
1643
+						gettext("Destination"),
1644 1644
 						"130",
1645 1645
 						"notes",
1646 1646
 						"",
@@ -1650,8 +1650,8 @@  discard block
 block discarded – undo
1650 1650
 						"true",
1651 1651
 						"center" 
1652 1652
 				),
1653
-				array (
1654
-						gettext ( "Duration" ),
1653
+				array(
1654
+						gettext("Duration"),
1655 1655
 						"110",
1656 1656
 						"billseconds",
1657 1657
 						"provider_cdr_list_search",
@@ -1661,8 +1661,8 @@  discard block
 block discarded – undo
1661 1661
 						"true",
1662 1662
 						"center" 
1663 1663
 				),
1664
-				array (
1665
-						gettext ( "Cost($currency)" ),
1664
+				array(
1665
+						gettext("Cost($currency)"),
1666 1666
 						"150",
1667 1667
 						"provider_call_cost",
1668 1668
 						"provider_cost",
@@ -1672,8 +1672,8 @@  discard block
 block discarded – undo
1672 1672
 						"true",
1673 1673
 						"right" 
1674 1674
 				),
1675
-				array (
1676
-						gettext ( "Disposition" ),
1675
+				array(
1676
+						gettext("Disposition"),
1677 1677
 						"200",
1678 1678
 						"disposition",
1679 1679
 						"",
@@ -1683,8 +1683,8 @@  discard block
 block discarded – undo
1683 1683
 						"true",
1684 1684
 						"center" 
1685 1685
 				),
1686
-				array (
1687
-						gettext ( "Account" ),
1686
+				array(
1687
+						gettext("Account"),
1688 1688
 						"181",
1689 1689
 						"provider_id",
1690 1690
 						"first_name,last_name,number",
@@ -1694,20 +1694,20 @@  discard block
 block discarded – undo
1694 1694
 						"true",
1695 1695
 						"center" 
1696 1696
 				) 
1697
-		) );
1697
+		));
1698 1698
 		return $grid_field_arr;
1699 1699
 	}
1700 1700
 	function build_grid_customer() {
1701
-		$buttons_json = json_encode ( array (
1702
-				array (
1703
-						gettext ( "Export" ),
1701
+		$buttons_json = json_encode(array(
1702
+				array(
1703
+						gettext("Export"),
1704 1704
 						"btn btn-xing",
1705 1705
 						" fa fa-download fa-lg",
1706 1706
 						"button_action",
1707 1707
 						"/reports/customerReport_export/",
1708 1708
 						'single' 
1709 1709
 				) 
1710
-		) );
1710
+		));
1711 1711
 		return $buttons_json;
1712 1712
 	}
1713 1713
 	/**
@@ -1716,54 +1716,54 @@  discard block
 block discarded – undo
1716 1716
 	 * *
1717 1717
 	 */
1718 1718
 	function build_grid_buttons_user() {
1719
-		$buttons_json = json_encode ( array (
1720
-				array (
1721
-						gettext ( "Export" ),
1719
+		$buttons_json = json_encode(array(
1720
+				array(
1721
+						gettext("Export"),
1722 1722
 						"btn btn-xing",
1723 1723
 						" fa fa-download fa-lg",
1724 1724
 						"button_action",
1725 1725
 						"/user/user_report_export/",
1726 1726
 						'single' 
1727 1727
 				) 
1728
-		) );
1728
+		));
1729 1729
 		return $buttons_json;
1730 1730
 	}
1731 1731
 	/**
1732 1732
 	 * **************************************************************
1733 1733
 	 */
1734 1734
 	function build_grid_buttons_reseller() {
1735
-		$buttons_json = json_encode ( array (
1736
-				array (
1737
-						gettext ( "Export" ),
1735
+		$buttons_json = json_encode(array(
1736
+				array(
1737
+						gettext("Export"),
1738 1738
 						"btn btn-xing",
1739 1739
 						" fa fa-download fa-lg",
1740 1740
 						"button_action",
1741 1741
 						"/reports/resellerReport_export/",
1742 1742
 						'single' 
1743 1743
 				) 
1744
-		) );
1744
+		));
1745 1745
 		return $buttons_json;
1746 1746
 	}
1747 1747
 	function build_grid_buttons_provider() {
1748
-		$buttons_json = json_encode ( array (
1749
-				array (
1750
-						gettext ( "Export" ),
1748
+		$buttons_json = json_encode(array(
1749
+				array(
1750
+						gettext("Export"),
1751 1751
 						"btn btn-xing",
1752 1752
 						" fa fa-download fa-lg",
1753 1753
 						"button_action",
1754 1754
 						"/reports/providerReport_export/",
1755 1755
 						'single' 
1756 1756
 				) 
1757
-		) );
1757
+		));
1758 1758
 		return $buttons_json;
1759 1759
 	}
1760 1760
 	function build_report_list_for_user($accounttype = 'customer') {
1761
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1761
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1762 1762
 		$currency_id = $account_info ['currency_id'];
1763
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1763
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1764 1764
 		
1765 1765
 		if ($accounttype == 'customer' || $accounttype == 'reseller') {
1766
-			$cost_array = array (
1766
+			$cost_array = array(
1767 1767
 					"Debit($currency)",
1768 1768
 					"100",
1769 1769
 					"debit",
@@ -1775,8 +1775,8 @@  discard block
 block discarded – undo
1775 1775
 					"right" 
1776 1776
 			);
1777 1777
 		}
1778
-		if (strtolower ( $accounttype ) == 'provider') {
1779
-			$cost_array = array (
1778
+		if (strtolower($accounttype) == 'provider') {
1779
+			$cost_array = array(
1780 1780
 					"Debit($currency)",
1781 1781
 					"140",
1782 1782
 					"cost",
@@ -1786,9 +1786,9 @@  discard block
 block discarded – undo
1786 1786
 			);
1787 1787
 		}
1788 1788
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1789
-		$grid_field_arr = json_encode ( array (
1790
-				array (
1791
-						gettext ( "Date" ),
1789
+		$grid_field_arr = json_encode(array(
1790
+				array(
1791
+						gettext("Date"),
1792 1792
 						"130",
1793 1793
 						"callstart",
1794 1794
 						"callstart",
@@ -1798,8 +1798,8 @@  discard block
 block discarded – undo
1798 1798
 						"true",
1799 1799
 						"center" 
1800 1800
 				),
1801
-				array (
1802
-						gettext ( "Caller ID" ),
1801
+				array(
1802
+						gettext("Caller ID"),
1803 1803
 						"100",
1804 1804
 						"callerid",
1805 1805
 						"",
@@ -1809,8 +1809,8 @@  discard block
 block discarded – undo
1809 1809
 						"true",
1810 1810
 						"center" 
1811 1811
 				),
1812
-				array (
1813
-						gettext ( "Called Number" ),
1812
+				array(
1813
+						gettext("Called Number"),
1814 1814
 						"120",
1815 1815
 						"callednum",
1816 1816
 						"",
@@ -1820,8 +1820,8 @@  discard block
 block discarded – undo
1820 1820
 						"true",
1821 1821
 						"center" 
1822 1822
 				),
1823
-				array (
1824
-						gettext ( "Destination" ),
1823
+				array(
1824
+						gettext("Destination"),
1825 1825
 						"135",
1826 1826
 						"notes",
1827 1827
 						"",
@@ -1832,8 +1832,8 @@  discard block
 block discarded – undo
1832 1832
 						"center" 
1833 1833
 				),
1834 1834
 				// array("Account Number", "120", "accountid", "number", "accounts", "get_field_name"),
1835
-				array (
1836
-						gettext ( "Duration" ),
1835
+				array(
1836
+						gettext("Duration"),
1837 1837
 						"120",
1838 1838
 						"billseconds",
1839 1839
 						"user_cdrs_report_search",
@@ -1844,8 +1844,8 @@  discard block
 block discarded – undo
1844 1844
 						"center" 
1845 1845
 				),
1846 1846
 				$cost_array,
1847
-				array (
1848
-						gettext ( "Disposition" ),
1847
+				array(
1848
+						gettext("Disposition"),
1849 1849
 						"160",
1850 1850
 						"disposition",
1851 1851
 						"",
@@ -1855,8 +1855,8 @@  discard block
 block discarded – undo
1855 1855
 						"true",
1856 1856
 						"center" 
1857 1857
 				),
1858
-				array (
1859
-						gettext ( "Call Type" ),
1858
+				array(
1859
+						gettext("Call Type"),
1860 1860
 						"140",
1861 1861
 						"calltype",
1862 1862
 						"",
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 						"true",
1867 1867
 						"center" 
1868 1868
 				) 
1869
-		) );
1869
+		));
1870 1870
 		return $grid_field_arr;
1871 1871
 	}
1872 1872
 	
@@ -1877,12 +1877,12 @@  discard block
 block discarded – undo
1877 1877
 	 * *****
1878 1878
 	 */
1879 1879
 	function build_refill_report_for_admin() {
1880
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1880
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1881 1881
 		$currency_id = $account_info ['currency_id'];
1882
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1883
-		$grid_field_arr = json_encode ( array (
1884
-				array (
1885
-						gettext ( "Date" ),
1882
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1883
+		$grid_field_arr = json_encode(array(
1884
+				array(
1885
+						gettext("Date"),
1886 1886
 						"225",
1887 1887
 						"payment_date",
1888 1888
 						"",
@@ -1892,8 +1892,8 @@  discard block
 block discarded – undo
1892 1892
 						"true",
1893 1893
 						"center" 
1894 1894
 				),
1895
-				array (
1896
-						gettext ( "Account" ),
1895
+				array(
1896
+						gettext("Account"),
1897 1897
 						"240",
1898 1898
 						"accountid",
1899 1899
 						"first_name,last_name,number",
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
 						"true",
1904 1904
 						"center" 
1905 1905
 				),
1906
-				array (
1906
+				array(
1907 1907
 						"Amount($currency)",
1908 1908
 						"250",
1909 1909
 						"credit",
@@ -1915,8 +1915,8 @@  discard block
 block discarded – undo
1915 1915
 						"right" 
1916 1916
 				),
1917 1917
 				// array(gettext("Refill By"), "230", "payment_by", "payment_by", "payment_by", "get_refill_by","","true","center"),
1918
-				array (
1919
-						gettext ( "Refill By" ),
1918
+				array(
1919
+						gettext("Refill By"),
1920 1920
 						"230",
1921 1921
 						"payment_by",
1922 1922
 						"first_name,last_name,number",
@@ -1926,8 +1926,8 @@  discard block
 block discarded – undo
1926 1926
 						"true",
1927 1927
 						"center" 
1928 1928
 				),
1929
-				array (
1930
-						gettext ( "Note" ),
1929
+				array(
1930
+						gettext("Note"),
1931 1931
 						"327",
1932 1932
 						"notes",
1933 1933
 						"",
@@ -1937,33 +1937,33 @@  discard block
 block discarded – undo
1937 1937
 						"true",
1938 1938
 						"center" 
1939 1939
 				) 
1940
-		) );
1940
+		));
1941 1941
 		return $grid_field_arr;
1942 1942
 	}
1943 1943
 	function build_refillreport_buttons() {
1944
-		$buttons_json = json_encode ( array (
1945
-				array (
1946
-						gettext ( "Export" ),
1944
+		$buttons_json = json_encode(array(
1945
+				array(
1946
+						gettext("Export"),
1947 1947
 						"btn btn-xing",
1948 1948
 						" fa fa-download fa-lg",
1949 1949
 						"button_action",
1950 1950
 						"/reports/refillreport_export/",
1951 1951
 						'single' 
1952 1952
 				) 
1953
-		) );
1953
+		));
1954 1954
 		return $buttons_json;
1955 1955
 	}
1956 1956
 	function build_search_refill_report_for_admin() {
1957
-		$accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1957
+		$accountinfo = $this->CI->session->userdata('accountinfo');
1958 1958
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
1959
-		$form ['forms'] = array (
1959
+		$form ['forms'] = array(
1960 1960
 				"",
1961
-				array (
1961
+				array(
1962 1962
 						'id' => "cdr_refill_search" 
1963 1963
 				) 
1964 1964
 		);
1965
-		$account_data = $this->CI->session->userdata ( "accountinfo" );
1966
-		$acc_arr = array (
1965
+		$account_data = $this->CI->session->userdata("accountinfo");
1966
+		$acc_arr = array(
1967 1967
 				'Account',
1968 1968
 				'accountid',
1969 1969
 				'SELECT',
@@ -1976,14 +1976,14 @@  discard block
 block discarded – undo
1976 1976
 				'accounts',
1977 1977
 				'build_dropdown_deleted',
1978 1978
 				'where_arr',
1979
-				array (
1979
+				array(
1980 1980
 						"reseller_id" => $reseller_id,
1981 1981
 						"type" => "0,1,3" 
1982 1982
 				) 
1983 1983
 		);
1984
-		$logintype = $this->CI->session->userdata ( 'logintype' );
1984
+		$logintype = $this->CI->session->userdata('logintype');
1985 1985
 		if ($logintype == 1 || $logintype == 5) {
1986
-			$account_data = $this->CI->session->userdata ( "accountinfo" );
1986
+			$account_data = $this->CI->session->userdata("accountinfo");
1987 1987
 			$loginid = $account_data ['id'];
1988 1988
 		} else {
1989 1989
 			$loginid = "0";
@@ -1991,11 +1991,11 @@  discard block
 block discarded – undo
1991 1991
 		if ($logintype == 0 || $logintype == 3) {
1992 1992
 			$acc_arr = null;
1993 1993
 		}
1994
-		$form [gettext ( 'Search' )] = array (
1995
-				array (
1996
-						gettext ( 'From Date' ),
1994
+		$form [gettext('Search')] = array(
1995
+				array(
1996
+						gettext('From Date'),
1997 1997
 						'INPUT',
1998
-						array (
1998
+						array(
1999 1999
 								'name' => 'payment_date[]',
2000 2000
 								'id' => 'refill_from_date',
2001 2001
 								'size' => '20',
@@ -2006,10 +2006,10 @@  discard block
 block discarded – undo
2006 2006
 						'',
2007 2007
 						'payment_date[payment_date-date]' 
2008 2008
 				),
2009
-				array (
2010
-						gettext ( 'To Date' ),
2009
+				array(
2010
+						gettext('To Date'),
2011 2011
 						'INPUT',
2012
-						array (
2012
+						array(
2013 2013
 								'name' => 'payment_date[]',
2014 2014
 								'id' => 'refill_to_date',
2015 2015
 								'size' => '20',
@@ -2022,10 +2022,10 @@  discard block
 block discarded – undo
2022 2022
 				),
2023 2023
 				$acc_arr,
2024 2024
 				// array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0")),
2025
-				array (
2026
-						gettext ( 'Amount' ),
2025
+				array(
2026
+						gettext('Amount'),
2027 2027
 						'INPUT',
2028
-						array (
2028
+						array(
2029 2029
 								'name' => 'credit[credit]',
2030 2030
 								'value' => '',
2031 2031
 								'size' => '20',
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 						'' 
2043 2043
 				),
2044 2044
 				// array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
2045
-				array (
2045
+				array(
2046 2046
 						'',
2047 2047
 						'HIDDEN',
2048 2048
 						'ajax_search',
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 						'',
2052 2052
 						'' 
2053 2053
 				),
2054
-				array (
2054
+				array(
2055 2055
 						'',
2056 2056
 						'HIDDEN',
2057 2057
 						'advance_search',
@@ -2062,18 +2062,18 @@  discard block
 block discarded – undo
2062 2062
 				) 
2063 2063
 		);
2064 2064
 		
2065
-		$form ['button_search'] = array (
2065
+		$form ['button_search'] = array(
2066 2066
 				'name' => 'action',
2067 2067
 				'id' => "cusotmer_cdr_refill_search_btn",
2068
-				'content' => gettext ( 'Search' ),
2068
+				'content' => gettext('Search'),
2069 2069
 				'value' => 'save',
2070 2070
 				'type' => 'button',
2071 2071
 				'class' => 'btn btn-line-parrot pull-right' 
2072 2072
 		);
2073
-		$form ['button_reset'] = array (
2073
+		$form ['button_reset'] = array(
2074 2074
 				'name' => 'action',
2075 2075
 				'id' => "id_reset",
2076
-				'content' => gettext ( 'Clear' ),
2076
+				'content' => gettext('Clear'),
2077 2077
 				'value' => 'Cancel',
2078 2078
 				'type' => 'reset',
2079 2079
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -2085,62 +2085,62 @@  discard block
 block discarded – undo
2085 2085
 	 * ************************
2086 2086
 	 */
2087 2087
 	function build_commission_report_for_admin() {
2088
-		$grid_field_arr = json_encode ( array (
2089
-				array (
2090
-						gettext ( "Account" ),
2088
+		$grid_field_arr = json_encode(array(
2089
+				array(
2090
+						gettext("Account"),
2091 2091
 						"150",
2092 2092
 						"accountid",
2093 2093
 						"first_name,last_name,number",
2094 2094
 						"accounts",
2095 2095
 						"build_concat_string" 
2096 2096
 				),
2097
-				array (
2098
-						gettext ( "Amount" ),
2097
+				array(
2098
+						gettext("Amount"),
2099 2099
 						"150",
2100 2100
 						"amount",
2101 2101
 						"credit",
2102 2102
 						"credit",
2103 2103
 						"convert_to_currency" 
2104 2104
 				),
2105
-				array (
2106
-						gettext ( "Description" ),
2105
+				array(
2106
+						gettext("Description"),
2107 2107
 						"150",
2108 2108
 						"description",
2109 2109
 						"",
2110 2110
 						"",
2111 2111
 						"" 
2112 2112
 				),
2113
-				array (
2114
-						gettext ( "Reseller" ),
2113
+				array(
2114
+						gettext("Reseller"),
2115 2115
 						"150",
2116 2116
 						"reseller_id",
2117 2117
 						"first_name,last_name,number",
2118 2118
 						"accounts",
2119 2119
 						"build_concat_string" 
2120 2120
 				),
2121
-				array (
2122
-						gettext ( "Commission Rate(%)" ),
2121
+				array(
2122
+						gettext("Commission Rate(%)"),
2123 2123
 						"150",
2124 2124
 						"commission_percent",
2125 2125
 						"",
2126 2126
 						"",
2127 2127
 						"" 
2128 2128
 				),
2129
-				array (
2130
-						gettext ( "Date" ),
2129
+				array(
2130
+						gettext("Date"),
2131 2131
 						"150",
2132 2132
 						"date",
2133 2133
 						"",
2134 2134
 						"",
2135 2135
 						"" 
2136 2136
 				) 
2137
-		) );
2137
+		));
2138 2138
 		return $grid_field_arr;
2139 2139
 	}
2140 2140
 	function reseller_commission_search_form() {
2141
-		$form ['forms'] = array (
2141
+		$form ['forms'] = array(
2142 2142
 				"",
2143
-				array (
2143
+				array(
2144 2144
 						'id' => "reseller_commission_search" 
2145 2145
 				) 
2146 2146
 		);
@@ -2150,11 +2150,11 @@  discard block
 block discarded – undo
2150 2150
 		 * Payment to refill
2151 2151
 		 * *****
2152 2152
 		 */
2153
-		$form ['User Refill Report'] = array (
2153
+		$form ['User Refill Report'] = array(
2154 2154
 				/**
2155 2155
 				 * **********************
2156 2156
 				 */
2157
-				array (
2157
+				array(
2158 2158
 						'',
2159 2159
 						'HIDDEN',
2160 2160
 						'ajax_search',
@@ -2163,7 +2163,7 @@  discard block
 block discarded – undo
2163 2163
 						'',
2164 2164
 						'' 
2165 2165
 				),
2166
-				array (
2166
+				array(
2167 2167
 						'',
2168 2168
 						'HIDDEN',
2169 2169
 						'advance_search',
@@ -2172,10 +2172,10 @@  discard block
 block discarded – undo
2172 2172
 						'',
2173 2173
 						'' 
2174 2174
 				),
2175
-				array (
2176
-						gettext ( 'From Date' ),
2175
+				array(
2176
+						gettext('From Date'),
2177 2177
 						'INPUT',
2178
-						array (
2178
+						array(
2179 2179
 								'name' => 'date[]',
2180 2180
 								'id' => 'commission_from_date',
2181 2181
 								'size' => '20',
@@ -2186,10 +2186,10 @@  discard block
 block discarded – undo
2186 2186
 						'',
2187 2187
 						'start_date[start_date-date]' 
2188 2188
 				),
2189
-				array (
2190
-						gettext ( 'To Date' ),
2189
+				array(
2190
+						gettext('To Date'),
2191 2191
 						'INPUT',
2192
-						array (
2192
+						array(
2193 2193
 								'name' => 'date[]',
2194 2194
 								'id' => 'commission_to_date',
2195 2195
 								'size' => '20',
@@ -2200,8 +2200,8 @@  discard block
 block discarded – undo
2200 2200
 						'',
2201 2201
 						'end_date[end_date-date]' 
2202 2202
 				),
2203
-				array (
2204
-						gettext ( 'Account' ),
2203
+				array(
2204
+						gettext('Account'),
2205 2205
 						'accountid',
2206 2206
 						'SELECT',
2207 2207
 						'',
@@ -2213,16 +2213,16 @@  discard block
 block discarded – undo
2213 2213
 						'accounts',
2214 2214
 						'build_concat_dropdown',
2215 2215
 						'where_arr',
2216
-						array (
2216
+						array(
2217 2217
 								"reseller_id" => "0",
2218 2218
 								"type" => "1",
2219 2219
 								"deleted" => "0" 
2220 2220
 						) 
2221 2221
 				),
2222
-				array (
2223
-						gettext ( 'Amount' ),
2222
+				array(
2223
+						gettext('Amount'),
2224 2224
 						'INPUT',
2225
-						array (
2225
+						array(
2226 2226
 								'name' => 'amount[amount]',
2227 2227
 								'value' => '',
2228 2228
 								'size' => '20',
@@ -2240,18 +2240,18 @@  discard block
 block discarded – undo
2240 2240
 				) 
2241 2241
 		);
2242 2242
 		
2243
-		$form ['button_search'] = array (
2243
+		$form ['button_search'] = array(
2244 2244
 				'name' => 'action',
2245 2245
 				'id' => "commission_search_btn",
2246
-				'content' => gettext ( 'Search' ),
2246
+				'content' => gettext('Search'),
2247 2247
 				'value' => 'save',
2248 2248
 				'type' => 'button',
2249 2249
 				'class' => 'ui-state-default float-right ui-corner-all ui-button' 
2250 2250
 		);
2251
-		$form ['button_reset'] = array (
2251
+		$form ['button_reset'] = array(
2252 2252
 				'name' => 'action',
2253 2253
 				'id' => "id_reset",
2254
-				'content' => gettext ( 'Clear Search Filter' ),
2254
+				'content' => gettext('Clear Search Filter'),
2255 2255
 				'value' => 'cancel',
2256 2256
 				'type' => 'reset',
2257 2257
 				'class' => 'ui-state-default float-right ui-corner-all ui-button' 
@@ -2260,17 +2260,17 @@  discard block
 block discarded – undo
2260 2260
 		return $form;
2261 2261
 	}
2262 2262
 	function get_providersummary_search_form() {
2263
-		$form ['forms'] = array (
2263
+		$form ['forms'] = array(
2264 2264
 				'',
2265
-				array (
2265
+				array(
2266 2266
 						'id' => "providersummary_search" 
2267 2267
 				) 
2268 2268
 		);
2269
-		$form [gettext ( 'Search' )] = array (
2270
-				array (
2271
-						gettext ( 'From Date' ),
2269
+		$form [gettext('Search')] = array(
2270
+				array(
2271
+						gettext('From Date'),
2272 2272
 						'INPUT',
2273
-						array (
2273
+						array(
2274 2274
 								'name' => 'callstart[]',
2275 2275
 								'id' => 'customer_from_date',
2276 2276
 								'size' => '20',
@@ -2281,10 +2281,10 @@  discard block
 block discarded – undo
2281 2281
 						'',
2282 2282
 						'start_date[start_date-date]' 
2283 2283
 				),
2284
-				array (
2285
-						gettext ( 'To Date' ),
2284
+				array(
2285
+						gettext('To Date'),
2286 2286
 						'INPUT',
2287
-						array (
2287
+						array(
2288 2288
 								'name' => 'callstart[]',
2289 2289
 								'id' => 'customer_to_date',
2290 2290
 								'size' => '20',
@@ -2295,8 +2295,8 @@  discard block
 block discarded – undo
2295 2295
 						'',
2296 2296
 						'end_date[end_date-date]' 
2297 2297
 				),
2298
-				array (
2299
-						gettext ( 'Account' ),
2298
+				array(
2299
+						gettext('Account'),
2300 2300
 						'provider_id',
2301 2301
 						'SELECT',
2302 2302
 						'',
@@ -2308,15 +2308,15 @@  discard block
 block discarded – undo
2308 2308
 						'accounts',
2309 2309
 						'build_dropdown_deleted',
2310 2310
 						'where_arr',
2311
-						array (
2311
+						array(
2312 2312
 								"reseller_id" => "0",
2313 2313
 								"type" => "3" 
2314 2314
 						) 
2315 2315
 				),
2316
-				array (
2317
-						gettext ( 'Code' ),
2316
+				array(
2317
+						gettext('Code'),
2318 2318
 						'INPUT',
2319
-						array (
2319
+						array(
2320 2320
 								'name' => 'pattern[pattern]',
2321 2321
 								'value' => '',
2322 2322
 								'size' => '20',
@@ -2333,10 +2333,10 @@  discard block
 block discarded – undo
2333 2333
 						'' 
2334 2334
 				),
2335 2335
 				
2336
-				array (
2337
-						gettext ( 'Destination' ),
2336
+				array(
2337
+						gettext('Destination'),
2338 2338
 						'INPUT',
2339
-						array (
2339
+						array(
2340 2340
 								'name' => 'notes[notes]',
2341 2341
 								'value' => '',
2342 2342
 								'size' => '20',
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
 						'' 
2354 2354
 				),
2355 2355
 				// array('Account Number', 'number', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type"=>"3", "deleted" => "0")),
2356
-				array (
2356
+				array(
2357 2357
 						'',
2358 2358
 						'HIDDEN',
2359 2359
 						'ajax_search',
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
 						'',
2363 2363
 						'' 
2364 2364
 				),
2365
-				array (
2365
+				array(
2366 2366
 						'',
2367 2367
 						'HIDDEN',
2368 2368
 						'advance_search',
@@ -2372,18 +2372,18 @@  discard block
 block discarded – undo
2372 2372
 						'' 
2373 2373
 				) 
2374 2374
 		);
2375
-		$form ['button_search'] = array (
2375
+		$form ['button_search'] = array(
2376 2376
 				'name' => 'action',
2377 2377
 				'id' => "providersummary_search_btn",
2378
-				'content' => gettext ( 'Search' ),
2378
+				'content' => gettext('Search'),
2379 2379
 				'value' => 'save',
2380 2380
 				'type' => 'button',
2381 2381
 				'class' => 'btn btn-line-parrot pull-right' 
2382 2382
 		);
2383
-		$form ['button_reset'] = array (
2383
+		$form ['button_reset'] = array(
2384 2384
 				'name' => 'action',
2385 2385
 				'id' => "id_reset",
2386
-				'content' => gettext ( 'Clear' ),
2386
+				'content' => gettext('Clear'),
2387 2387
 				'value' => 'cancel',
2388 2388
 				'type' => 'reset',
2389 2389
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -2392,81 +2392,81 @@  discard block
 block discarded – undo
2392 2392
 		return $form;
2393 2393
 	}
2394 2394
 	function build_providersummary() {
2395
-		$grid_field_arr = json_encode ( array (
2396
-				array (
2397
-						gettext ( "Provider" ),
2395
+		$grid_field_arr = json_encode(array(
2396
+				array(
2397
+						gettext("Provider"),
2398 2398
 						"220",
2399 2399
 						"provider_id",
2400 2400
 						"first_name,last_name,number",
2401 2401
 						"accounts",
2402 2402
 						"build_concat_string" 
2403 2403
 				),
2404
-				array (
2405
-						gettext ( "Code" ),
2404
+				array(
2405
+						gettext("Code"),
2406 2406
 						"120",
2407 2407
 						"pattern",
2408 2408
 						"pattern",
2409 2409
 						"",
2410 2410
 						"get_only_numeric_val" 
2411 2411
 				),
2412
-				array (
2413
-						gettext ( "Destination" ),
2412
+				array(
2413
+						gettext("Destination"),
2414 2414
 						"150",
2415 2415
 						"notes",
2416 2416
 						"",
2417 2417
 						"",
2418 2418
 						"" 
2419 2419
 				),
2420
-				array (
2421
-						gettext ( "Attempted Calls" ),
2420
+				array(
2421
+						gettext("Attempted Calls"),
2422 2422
 						"130",
2423 2423
 						"attempted_calls",
2424 2424
 						"",
2425 2425
 						"",
2426 2426
 						"" 
2427 2427
 				),
2428
-				array (
2429
-						gettext ( "Completed Calls" ),
2428
+				array(
2429
+						gettext("Completed Calls"),
2430 2430
 						"150",
2431 2431
 						"description",
2432 2432
 						"",
2433 2433
 						"",
2434 2434
 						"" 
2435 2435
 				),
2436
-				array (
2437
-						gettext ( "ASR" ),
2436
+				array(
2437
+						gettext("ASR"),
2438 2438
 						"95",
2439 2439
 						"asr",
2440 2440
 						'',
2441 2441
 						'',
2442 2442
 						'' 
2443 2443
 				),
2444
-				array (
2445
-						gettext ( "ACD" ),
2444
+				array(
2445
+						gettext("ACD"),
2446 2446
 						"95",
2447 2447
 						"acd  ",
2448 2448
 						'',
2449 2449
 						'',
2450 2450
 						'' 
2451 2451
 				),
2452
-				array (
2453
-						gettext ( "MCD" ),
2452
+				array(
2453
+						gettext("MCD"),
2454 2454
 						"95",
2455 2455
 						"mcd",
2456 2456
 						'',
2457 2457
 						'',
2458 2458
 						'' 
2459 2459
 				),
2460
-				array (
2461
-						gettext ( "Bilable" ),
2460
+				array(
2461
+						gettext("Bilable"),
2462 2462
 						"100",
2463 2463
 						"billable",
2464 2464
 						'',
2465 2465
 						'',
2466 2466
 						'' 
2467 2467
 				),
2468
-				array (
2469
-						gettext ( "Cost" ),
2468
+				array(
2469
+						gettext("Cost"),
2470 2470
 						"115",
2471 2471
 						"cost",
2472 2472
 						'',
@@ -2479,30 +2479,30 @@  discard block
 block discarded – undo
2479 2479
 		return $grid_field_arr;
2480 2480
 	}
2481 2481
 	function build_grid_buttons_providersummary() {
2482
-		$buttons_json = json_encode ( array (
2483
-				array (
2484
-						gettext ( "Export" ),
2482
+		$buttons_json = json_encode(array(
2483
+				array(
2484
+						gettext("Export"),
2485 2485
 						"btn btn-xing",
2486 2486
 						" fa fa-download fa-lg",
2487 2487
 						"button_action",
2488 2488
 						"/reports/providersummary_export_cdr_xls",
2489 2489
 						'single' 
2490 2490
 				) 
2491
-		) );
2491
+		));
2492 2492
 		return $buttons_json;
2493 2493
 	}
2494 2494
 	function get_resellersummary_search_form() {
2495
-		$form ['forms'] = array (
2495
+		$form ['forms'] = array(
2496 2496
 				"",
2497
-				array (
2497
+				array(
2498 2498
 						'id' => "resellersummary_search" 
2499 2499
 				) 
2500 2500
 		);
2501
-		$form [gettext ( 'Search' )] = array (
2502
-				array (
2503
-						gettext ( 'From Date' ),
2501
+		$form [gettext('Search')] = array(
2502
+				array(
2503
+						gettext('From Date'),
2504 2504
 						'INPUT',
2505
-						array (
2505
+						array(
2506 2506
 								'name' => 'callstart[]',
2507 2507
 								'id' => 'customer_from_date',
2508 2508
 								'size' => '20',
@@ -2513,10 +2513,10 @@  discard block
 block discarded – undo
2513 2513
 						'',
2514 2514
 						'start_date[start_date-date]' 
2515 2515
 				),
2516
-				array (
2517
-						gettext ( 'To Date' ),
2516
+				array(
2517
+						gettext('To Date'),
2518 2518
 						'INPUT',
2519
-						array (
2519
+						array(
2520 2520
 								'name' => 'callstart[]',
2521 2521
 								'id' => 'customer_to_date',
2522 2522
 								'size' => '20',
@@ -2527,8 +2527,8 @@  discard block
 block discarded – undo
2527 2527
 						'',
2528 2528
 						'end_date[end_date-date]' 
2529 2529
 				),
2530
-				array (
2531
-						gettext ( 'Account' ),
2530
+				array(
2531
+						gettext('Account'),
2532 2532
 						'reseller_id',
2533 2533
 						'SELECT',
2534 2534
 						'',
@@ -2540,15 +2540,15 @@  discard block
 block discarded – undo
2540 2540
 						'accounts',
2541 2541
 						'build_dropdown_deleted',
2542 2542
 						'where_arr',
2543
-						array (
2543
+						array(
2544 2544
 								"reseller_id" => "0",
2545 2545
 								"type" => "1" 
2546 2546
 						) 
2547 2547
 				),
2548
-				array (
2549
-						gettext ( 'Code' ),
2548
+				array(
2549
+						gettext('Code'),
2550 2550
 						'INPUT',
2551
-						array (
2551
+						array(
2552 2552
 								'name' => 'pattern[pattern]',
2553 2553
 								'value' => '',
2554 2554
 								'size' => '20',
@@ -2565,10 +2565,10 @@  discard block
 block discarded – undo
2565 2565
 						'' 
2566 2566
 				),
2567 2567
 				
2568
-				array (
2569
-						gettext ( 'Destination' ),
2568
+				array(
2569
+						gettext('Destination'),
2570 2570
 						'INPUT',
2571
-						array (
2571
+						array(
2572 2572
 								'name' => 'notes[notes]',
2573 2573
 								'value' => '',
2574 2574
 								'size' => '20',
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
 						'' 
2586 2586
 				),
2587 2587
 				// array('Account Number', 'number', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type"=>"1", "deleted" => "0")),
2588
-				array (
2588
+				array(
2589 2589
 						'',
2590 2590
 						'HIDDEN',
2591 2591
 						'ajax_search',
@@ -2594,7 +2594,7 @@  discard block
 block discarded – undo
2594 2594
 						'',
2595 2595
 						'' 
2596 2596
 				),
2597
-				array (
2597
+				array(
2598 2598
 						'',
2599 2599
 						'HIDDEN',
2600 2600
 						'advance_search',
@@ -2604,18 +2604,18 @@  discard block
 block discarded – undo
2604 2604
 						'' 
2605 2605
 				) 
2606 2606
 		);
2607
-		$form ['button_search'] = array (
2607
+		$form ['button_search'] = array(
2608 2608
 				'name' => 'action',
2609 2609
 				'id' => "resellersummary_search_btn",
2610
-				'content' => gettext ( 'Search' ),
2610
+				'content' => gettext('Search'),
2611 2611
 				'value' => 'save',
2612 2612
 				'type' => 'button',
2613 2613
 				'class' => 'btn btn-line-parrot pull-right' 
2614 2614
 		);
2615
-		$form ['button_reset'] = array (
2615
+		$form ['button_reset'] = array(
2616 2616
 				'name' => 'action',
2617 2617
 				'id' => "id_reset",
2618
-				'content' => gettext ( 'Clear' ),
2618
+				'content' => gettext('Clear'),
2619 2619
 				'value' => 'cancel',
2620 2620
 				'type' => 'reset',
2621 2621
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -2624,131 +2624,131 @@  discard block
 block discarded – undo
2624 2624
 		return $form;
2625 2625
 	}
2626 2626
 	function build_resellersummary() {
2627
-		$grid_field_arr = json_encode ( array (
2628
-				array (
2629
-						gettext ( "Account" ),
2627
+		$grid_field_arr = json_encode(array(
2628
+				array(
2629
+						gettext("Account"),
2630 2630
 						"148",
2631 2631
 						"accountid",
2632 2632
 						"first_name,last_name,number",
2633 2633
 						"accounts",
2634 2634
 						"build_concat_string" 
2635 2635
 				),
2636
-				array (
2637
-						gettext ( "Code" ),
2636
+				array(
2637
+						gettext("Code"),
2638 2638
 						"120",
2639 2639
 						"pattern",
2640 2640
 						"pattern",
2641 2641
 						"",
2642 2642
 						"get_only_numeric_val" 
2643 2643
 				),
2644
-				array (
2645
-						gettext ( "Destination" ),
2644
+				array(
2645
+						gettext("Destination"),
2646 2646
 						"150",
2647 2647
 						"notes",
2648 2648
 						"",
2649 2649
 						"",
2650 2650
 						"" 
2651 2651
 				),
2652
-				array (
2653
-						gettext ( "Attempted Calls" ),
2652
+				array(
2653
+						gettext("Attempted Calls"),
2654 2654
 						"120",
2655 2655
 						"attempted_calls",
2656 2656
 						"",
2657 2657
 						"",
2658 2658
 						"" 
2659 2659
 				),
2660
-				array (
2661
-						gettext ( "Completed Calls" ),
2660
+				array(
2661
+						gettext("Completed Calls"),
2662 2662
 						"120",
2663 2663
 						"description",
2664 2664
 						"",
2665 2665
 						"",
2666 2666
 						"" 
2667 2667
 				),
2668
-				array (
2669
-						gettext ( "ASR" ),
2668
+				array(
2669
+						gettext("ASR"),
2670 2670
 						"80",
2671 2671
 						"asr",
2672 2672
 						'',
2673 2673
 						'',
2674 2674
 						'' 
2675 2675
 				),
2676
-				array (
2677
-						gettext ( "ACD" ),
2676
+				array(
2677
+						gettext("ACD"),
2678 2678
 						"80",
2679 2679
 						"acd  ",
2680 2680
 						'',
2681 2681
 						'',
2682 2682
 						'' 
2683 2683
 				),
2684
-				array (
2685
-						gettext ( "MCD" ),
2684
+				array(
2685
+						gettext("MCD"),
2686 2686
 						"80",
2687 2687
 						"mcd",
2688 2688
 						'',
2689 2689
 						'',
2690 2690
 						'' 
2691 2691
 				),
2692
-				array (
2693
-						gettext ( "Bilable" ),
2692
+				array(
2693
+						gettext("Bilable"),
2694 2694
 						"90",
2695 2695
 						"billable",
2696 2696
 						'',
2697 2697
 						'',
2698 2698
 						'' 
2699 2699
 				),
2700
-				array (
2701
-						gettext ( "Price" ),
2700
+				array(
2701
+						gettext("Price"),
2702 2702
 						"90",
2703 2703
 						"price",
2704 2704
 						'',
2705 2705
 						'',
2706 2706
 						'' 
2707 2707
 				),
2708
-				array (
2709
-						gettext ( "Cost" ),
2708
+				array(
2709
+						gettext("Cost"),
2710 2710
 						"90",
2711 2711
 						"cost",
2712 2712
 						'',
2713 2713
 						'',
2714 2714
 						'' 
2715 2715
 				),
2716
-				array (
2717
-						gettext ( "Profit" ),
2716
+				array(
2717
+						gettext("Profit"),
2718 2718
 						"100",
2719 2719
 						"profit",
2720 2720
 						"",
2721 2721
 						"",
2722 2722
 						"" 
2723 2723
 				) 
2724
-		) );
2724
+		));
2725 2725
 		return $grid_field_arr;
2726 2726
 	}
2727 2727
 	function build_grid_buttons_resellersummary() {
2728
-		$buttons_json = json_encode ( array (
2729
-				array (
2730
-						gettext ( "Export" ),
2728
+		$buttons_json = json_encode(array(
2729
+				array(
2730
+						gettext("Export"),
2731 2731
 						"btn btn-xing",
2732 2732
 						" fa fa-download fa-lg",
2733 2733
 						"button_action",
2734 2734
 						"/reports/resellersummary_export_cdr_xls",
2735 2735
 						'single' 
2736 2736
 				) 
2737
-		) );
2737
+		));
2738 2738
 		return $buttons_json;
2739 2739
 	}
2740 2740
 	function get_customersummary_search_form() {
2741
-		$form ['forms'] = array (
2741
+		$form ['forms'] = array(
2742 2742
 				"",
2743
-				array (
2743
+				array(
2744 2744
 						'id' => "customersummary_search" 
2745 2745
 				) 
2746 2746
 		);
2747
-		$form [gettext ( 'Search' )] = array (
2748
-				array (
2749
-						gettext ( 'From Date' ),
2747
+		$form [gettext('Search')] = array(
2748
+				array(
2749
+						gettext('From Date'),
2750 2750
 						'INPUT',
2751
-						array (
2751
+						array(
2752 2752
 								'name' => 'callstart[]',
2753 2753
 								'id' => 'customer_from_date',
2754 2754
 								'size' => '20',
@@ -2759,10 +2759,10 @@  discard block
 block discarded – undo
2759 2759
 						'',
2760 2760
 						'start_date[start_date-date]' 
2761 2761
 				),
2762
-				array (
2763
-						gettext ( 'To Date' ),
2762
+				array(
2763
+						gettext('To Date'),
2764 2764
 						'INPUT',
2765
-						array (
2765
+						array(
2766 2766
 								'name' => 'callstart[]',
2767 2767
 								'id' => 'customer_to_date',
2768 2768
 								'size' => '20',
@@ -2773,8 +2773,8 @@  discard block
 block discarded – undo
2773 2773
 						'',
2774 2774
 						'end_date[end_date-date]' 
2775 2775
 				),
2776
-				array (
2777
-						gettext ( 'Account' ),
2776
+				array(
2777
+						gettext('Account'),
2778 2778
 						'accountid',
2779 2779
 						'SELECT',
2780 2780
 						'',
@@ -2786,15 +2786,15 @@  discard block
 block discarded – undo
2786 2786
 						'accounts',
2787 2787
 						'build_dropdown_deleted',
2788 2788
 						'where_arr',
2789
-						array (
2789
+						array(
2790 2790
 								"reseller_id" => "0",
2791 2791
 								"type" => "GLOBAL" 
2792 2792
 						) 
2793 2793
 				),
2794
-				array (
2795
-						gettext ( 'Code' ),
2794
+				array(
2795
+						gettext('Code'),
2796 2796
 						'INPUT',
2797
-						array (
2797
+						array(
2798 2798
 								'name' => 'pattern[pattern]',
2799 2799
 								'value' => '',
2800 2800
 								'size' => '20',
@@ -2811,10 +2811,10 @@  discard block
 block discarded – undo
2811 2811
 						'' 
2812 2812
 				),
2813 2813
 				
2814
-				array (
2815
-						gettext ( 'Destination' ),
2814
+				array(
2815
+						gettext('Destination'),
2816 2816
 						'INPUT',
2817
-						array (
2817
+						array(
2818 2818
 								'name' => 'notes[notes]',
2819 2819
 								'value' => '',
2820 2820
 								'size' => '20',
@@ -2831,7 +2831,7 @@  discard block
 block discarded – undo
2831 2831
 						'' 
2832 2832
 				),
2833 2833
 				// array('Account Number', 'number', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type"=>"0", "deleted" => "0")),
2834
-				array (
2834
+				array(
2835 2835
 						'',
2836 2836
 						'HIDDEN',
2837 2837
 						'ajax_search',
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
 						'',
2841 2841
 						'' 
2842 2842
 				),
2843
-				array (
2843
+				array(
2844 2844
 						'',
2845 2845
 						'HIDDEN',
2846 2846
 						'advance_search',
@@ -2850,18 +2850,18 @@  discard block
 block discarded – undo
2850 2850
 						'' 
2851 2851
 				) 
2852 2852
 		);
2853
-		$form ['button_search'] = array (
2853
+		$form ['button_search'] = array(
2854 2854
 				'name' => 'action',
2855 2855
 				'id' => "customersummary_search_btn",
2856
-				'content' => gettext ( 'Search' ),
2856
+				'content' => gettext('Search'),
2857 2857
 				'value' => 'save',
2858 2858
 				'type' => 'button',
2859 2859
 				'class' => 'btn btn-line-parrot pull-right' 
2860 2860
 		);
2861
-		$form ['button_reset'] = array (
2861
+		$form ['button_reset'] = array(
2862 2862
 				'name' => 'action',
2863 2863
 				'id' => "id_reset",
2864
-				'content' => gettext ( 'Clear' ),
2864
+				'content' => gettext('Clear'),
2865 2865
 				'value' => 'cancel',
2866 2866
 				'type' => 'reset',
2867 2867
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -2870,117 +2870,117 @@  discard block
 block discarded – undo
2870 2870
 		return $form;
2871 2871
 	}
2872 2872
 	function build_customersummary() {
2873
-		$grid_field_arr = json_encode ( array (
2874
-				array (
2875
-						gettext ( "Account" ),
2873
+		$grid_field_arr = json_encode(array(
2874
+				array(
2875
+						gettext("Account"),
2876 2876
 						"190",
2877 2877
 						"accountid",
2878 2878
 						"first_name,last_name,number",
2879 2879
 						"accounts",
2880 2880
 						"build_concat_string" 
2881 2881
 				),
2882
-				array (
2883
-						gettext ( "Code" ),
2882
+				array(
2883
+						gettext("Code"),
2884 2884
 						"80",
2885 2885
 						"pattern",
2886 2886
 						"pattern",
2887 2887
 						"",
2888 2888
 						"get_only_numeric_val" 
2889 2889
 				),
2890
-				array (
2891
-						gettext ( "Destination" ),
2890
+				array(
2891
+						gettext("Destination"),
2892 2892
 						"110",
2893 2893
 						"notes",
2894 2894
 						"",
2895 2895
 						"",
2896 2896
 						"" 
2897 2897
 				),
2898
-				array (
2899
-						gettext ( "Attempted Calls" ),
2898
+				array(
2899
+						gettext("Attempted Calls"),
2900 2900
 						"140",
2901 2901
 						"attempted_calls",
2902 2902
 						"",
2903 2903
 						"",
2904 2904
 						"" 
2905 2905
 				),
2906
-				array (
2907
-						gettext ( "Completed Calls" ),
2906
+				array(
2907
+						gettext("Completed Calls"),
2908 2908
 						"130",
2909 2909
 						"description",
2910 2910
 						"",
2911 2911
 						"",
2912 2912
 						"" 
2913 2913
 				),
2914
-				array (
2915
-						gettext ( "ASR" ),
2914
+				array(
2915
+						gettext("ASR"),
2916 2916
 						"70",
2917 2917
 						"asr",
2918 2918
 						'',
2919 2919
 						'',
2920 2920
 						'' 
2921 2921
 				),
2922
-				array (
2923
-						gettext ( "ACD" ),
2922
+				array(
2923
+						gettext("ACD"),
2924 2924
 						"70",
2925 2925
 						"acd  ",
2926 2926
 						'',
2927 2927
 						'',
2928 2928
 						'' 
2929 2929
 				),
2930
-				array (
2931
-						gettext ( "MCD" ),
2930
+				array(
2931
+						gettext("MCD"),
2932 2932
 						"80",
2933 2933
 						"mcd",
2934 2934
 						'',
2935 2935
 						'',
2936 2936
 						'' 
2937 2937
 				),
2938
-				array (
2939
-						gettext ( "Bilable" ),
2938
+				array(
2939
+						gettext("Bilable"),
2940 2940
 						"80",
2941 2941
 						"billable",
2942 2942
 						'',
2943 2943
 						'',
2944 2944
 						'' 
2945 2945
 				),
2946
-				array (
2947
-						gettext ( "Debit" ),
2946
+				array(
2947
+						gettext("Debit"),
2948 2948
 						"85",
2949 2949
 						"cost",
2950 2950
 						'',
2951 2951
 						'',
2952 2952
 						'' 
2953 2953
 				),
2954
-				array (
2955
-						gettext ( "Cost" ),
2954
+				array(
2955
+						gettext("Cost"),
2956 2956
 						"110",
2957 2957
 						"price",
2958 2958
 						'',
2959 2959
 						'',
2960 2960
 						'' 
2961 2961
 				),
2962
-				array (
2963
-						gettext ( "Profit" ),
2962
+				array(
2963
+						gettext("Profit"),
2964 2964
 						"123",
2965 2965
 						"profit",
2966 2966
 						"",
2967 2967
 						"",
2968 2968
 						"" 
2969 2969
 				) 
2970
-		) );
2970
+		));
2971 2971
 		return $grid_field_arr;
2972 2972
 	}
2973 2973
 	function build_grid_buttons_customersummary() {
2974
-		$buttons_json = json_encode ( array (
2975
-				array (
2976
-						gettext ( "Export" ),
2974
+		$buttons_json = json_encode(array(
2975
+				array(
2976
+						gettext("Export"),
2977 2977
 						"btn btn-xing",
2978 2978
 						" fa fa-download fa-lg",
2979 2979
 						"button_action",
2980 2980
 						"/reports/customersummary_export_cdr_xls",
2981 2981
 						'single' 
2982 2982
 				) 
2983
-		) );
2983
+		));
2984 2984
 		return $buttons_json;
2985 2985
 	}
2986 2986
 	/**
@@ -2990,13 +2990,13 @@  discard block
 block discarded – undo
2990 2990
 	 * ********
2991 2991
 	 */
2992 2992
 	function build_charge_list_for_admin() {
2993
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
2993
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
2994 2994
 		$currency_id = $account_info ['currency_id'];
2995
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
2996
-		if ($this->CI->session->userdata ( "logintype" ) == '1') {
2997
-			$grid_field_arr = json_encode ( array (
2998
-					array (
2999
-							gettext ( "Created Date" ),
2995
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
2996
+		if ($this->CI->session->userdata("logintype") == '1') {
2997
+			$grid_field_arr = json_encode(array(
2998
+					array(
2999
+							gettext("Created Date"),
3000 3000
 							"120",
3001 3001
 							"created_date",
3002 3002
 							"",
@@ -3006,8 +3006,8 @@  discard block
 block discarded – undo
3006 3006
 							"true",
3007 3007
 							"center" 
3008 3008
 					),
3009
-					array (
3010
-							gettext ( "Invoice Number" ),
3009
+					array(
3010
+							gettext("Invoice Number"),
3011 3011
 							"120",
3012 3012
 							"created_date",
3013 3013
 							"",
@@ -3017,8 +3017,8 @@  discard block
 block discarded – undo
3017 3017
 							"true",
3018 3018
 							"center" 
3019 3019
 					),
3020
-					array (
3021
-							gettext ( "Account" ),
3020
+					array(
3021
+							gettext("Account"),
3022 3022
 							"120",
3023 3023
 							"accountid",
3024 3024
 							"first_name,last_name,number",
@@ -3029,8 +3029,8 @@  discard block
 block discarded – undo
3029 3029
 							"center" 
3030 3030
 					),
3031 3031
 					// array("Reseller", "120", "reseller_id", "first_name,last_name,number", "accounts", "reseller_select_value"),
3032
-					array (
3033
-							gettext ( "Charge Type" ),
3032
+					array(
3033
+							gettext("Charge Type"),
3034 3034
 							"120",
3035 3035
 							"item_type",
3036 3036
 							"",
@@ -3040,8 +3040,8 @@  discard block
 block discarded – undo
3040 3040
 							"true",
3041 3041
 							"center" 
3042 3042
 					),
3043
-					array (
3044
-							gettext ( "Before Balance<br/>($currency)" ),
3043
+					array(
3044
+							gettext("Before Balance<br/>($currency)"),
3045 3045
 							"120",
3046 3046
 							"before_balance",
3047 3047
 							"before_balance",
@@ -3051,8 +3051,8 @@  discard block
 block discarded – undo
3051 3051
 							"true",
3052 3052
 							"right" 
3053 3053
 					),
3054
-					array (
3055
-							gettext ( "Debit (-)<br/>($currency)" ),
3054
+					array(
3055
+							gettext("Debit (-)<br/>($currency)"),
3056 3056
 							"110",
3057 3057
 							"debit",
3058 3058
 							"debit",
@@ -3062,8 +3062,8 @@  discard block
 block discarded – undo
3062 3062
 							"true",
3063 3063
 							"right" 
3064 3064
 					),
3065
-					array (
3066
-							gettext ( "Credit (+)<br/>($currency)" ),
3065
+					array(
3066
+							gettext("Credit (+)<br/>($currency)"),
3067 3067
 							"110",
3068 3068
 							"credit",
3069 3069
 							"credit",
@@ -3073,8 +3073,8 @@  discard block
 block discarded – undo
3073 3073
 							"true",
3074 3074
 							"right" 
3075 3075
 					),
3076
-					array (
3077
-							gettext ( "After Balance<br/>($currency)" ),
3076
+					array(
3077
+							gettext("After Balance<br/>($currency)"),
3078 3078
 							"120",
3079 3079
 							"after_balance",
3080 3080
 							"after_balance",
@@ -3084,8 +3084,8 @@  discard block
 block discarded – undo
3084 3084
 							"true",
3085 3085
 							"right" 
3086 3086
 					),
3087
-					array (
3088
-							gettext ( "Description" ),
3087
+					array(
3088
+							gettext("Description"),
3089 3089
 							"300",
3090 3090
 							"description",
3091 3091
 							"",
@@ -3095,11 +3095,11 @@  discard block
 block discarded – undo
3095 3095
 							"true",
3096 3096
 							"center" 
3097 3097
 					) 
3098
-			) );
3098
+			));
3099 3099
 		} else {
3100
-			$grid_field_arr = json_encode ( array (
3101
-					array (
3102
-							gettext ( "Created Date" ),
3100
+			$grid_field_arr = json_encode(array(
3101
+					array(
3102
+							gettext("Created Date"),
3103 3103
 							"120",
3104 3104
 							"created_date",
3105 3105
 							"",
@@ -3109,8 +3109,8 @@  discard block
 block discarded – undo
3109 3109
 							"true",
3110 3110
 							"center" 
3111 3111
 					),
3112
-					array (
3113
-							gettext ( "Invoice Number" ),
3112
+					array(
3113
+							gettext("Invoice Number"),
3114 3114
 							"120",
3115 3115
 							"created_date",
3116 3116
 							"",
@@ -3120,8 +3120,8 @@  discard block
 block discarded – undo
3120 3120
 							"true",
3121 3121
 							"center" 
3122 3122
 					),
3123
-					array (
3124
-							gettext ( "Account" ),
3123
+					array(
3124
+							gettext("Account"),
3125 3125
 							"120",
3126 3126
 							"accountid",
3127 3127
 							"first_name,last_name,number",
@@ -3131,8 +3131,8 @@  discard block
 block discarded – undo
3131 3131
 							"true",
3132 3132
 							"center" 
3133 3133
 					),
3134
-					array (
3135
-							gettext ( "Charge Type" ),
3134
+					array(
3135
+							gettext("Charge Type"),
3136 3136
 							"120",
3137 3137
 							"item_type",
3138 3138
 							"",
@@ -3142,8 +3142,8 @@  discard block
 block discarded – undo
3142 3142
 							"true",
3143 3143
 							"center" 
3144 3144
 					),
3145
-					array (
3146
-							gettext ( "Before Balance<br/>($currency)" ),
3145
+					array(
3146
+							gettext("Before Balance<br/>($currency)"),
3147 3147
 							"120",
3148 3148
 							"before_balance",
3149 3149
 							"before_balance",
@@ -3153,8 +3153,8 @@  discard block
 block discarded – undo
3153 3153
 							"true",
3154 3154
 							"right" 
3155 3155
 					),
3156
-					array (
3157
-							gettext ( "Debit (-)<br/>($currency)" ),
3156
+					array(
3157
+							gettext("Debit (-)<br/>($currency)"),
3158 3158
 							"110",
3159 3159
 							"debit",
3160 3160
 							"debit",
@@ -3164,8 +3164,8 @@  discard block
 block discarded – undo
3164 3164
 							"true",
3165 3165
 							"right" 
3166 3166
 					),
3167
-					array (
3168
-							gettext ( "Credit (+)<br/>($currency)" ),
3167
+					array(
3168
+							gettext("Credit (+)<br/>($currency)"),
3169 3169
 							"110",
3170 3170
 							"credit",
3171 3171
 							"credit",
@@ -3175,8 +3175,8 @@  discard block
 block discarded – undo
3175 3175
 							"true",
3176 3176
 							"right" 
3177 3177
 					),
3178
-					array (
3179
-							gettext ( "After Balance<br/>($currency)" ),
3178
+					array(
3179
+							gettext("After Balance<br/>($currency)"),
3180 3180
 							"120",
3181 3181
 							"after_balance",
3182 3182
 							"after_balance",
@@ -3186,8 +3186,8 @@  discard block
 block discarded – undo
3186 3186
 							"true",
3187 3187
 							"right" 
3188 3188
 					),
3189
-					array (
3190
-							gettext ( "Description" ),
3189
+					array(
3190
+							gettext("Description"),
3191 3191
 							"300",
3192 3192
 							"description",
3193 3193
 							"",
@@ -3197,24 +3197,24 @@  discard block
 block discarded – undo
3197 3197
 							"true",
3198 3198
 							"center" 
3199 3199
 					) 
3200
-			) );
3200
+			));
3201 3201
 		}
3202 3202
 		return $grid_field_arr;
3203 3203
 	}
3204 3204
 	function get_charges_search_form() {
3205
-		$accountinfo = $this->CI->session->userdata ( 'accountinfo' );
3205
+		$accountinfo = $this->CI->session->userdata('accountinfo');
3206 3206
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
3207
-		$form ['forms'] = array (
3207
+		$form ['forms'] = array(
3208 3208
 				"",
3209
-				array (
3209
+				array(
3210 3210
 						'id' => "charges_search" 
3211 3211
 				) 
3212 3212
 		);
3213
-		$form [gettext ( 'Search' )] = array (
3214
-				array (
3215
-						gettext ( 'From Date' ),
3213
+		$form [gettext('Search')] = array(
3214
+				array(
3215
+						gettext('From Date'),
3216 3216
 						'INPUT',
3217
-						array (
3217
+						array(
3218 3218
 								'name' => 'created_date[]',
3219 3219
 								'id' => 'charge_from_date',
3220 3220
 								'size' => '20',
@@ -3225,10 +3225,10 @@  discard block
 block discarded – undo
3225 3225
 						'',
3226 3226
 						'start_date[start_date-date]' 
3227 3227
 				),
3228
-				array (
3229
-						gettext ( 'To Date' ),
3228
+				array(
3229
+						gettext('To Date'),
3230 3230
 						'INPUT',
3231
-						array (
3231
+						array(
3232 3232
 								'name' => 'created_date[]',
3233 3233
 								'id' => 'charge_to_date',
3234 3234
 								'size' => '20',
@@ -3239,8 +3239,8 @@  discard block
 block discarded – undo
3239 3239
 						'',
3240 3240
 						'end_date[end_date-date]' 
3241 3241
 				),
3242
-				array (
3243
-						gettext ( 'Account' ),
3242
+				array(
3243
+						gettext('Account'),
3244 3244
 						'accountid',
3245 3245
 						'SELECT',
3246 3246
 						'',
@@ -3252,15 +3252,15 @@  discard block
 block discarded – undo
3252 3252
 						'accounts',
3253 3253
 						'build_dropdown_deleted',
3254 3254
 						'where_arr',
3255
-						array (
3255
+						array(
3256 3256
 								"reseller_id" => $reseller_id,
3257 3257
 								"type" => "GLOBAL" 
3258 3258
 						) 
3259 3259
 				),
3260
-				array (
3261
-						gettext ( 'Debit' ),
3260
+				array(
3261
+						gettext('Debit'),
3262 3262
 						'INPUT',
3263
-						array (
3263
+						array(
3264 3264
 								'name' => 'debit[debit]',
3265 3265
 								'value' => '',
3266 3266
 								'size' => '20',
@@ -3276,10 +3276,10 @@  discard block
 block discarded – undo
3276 3276
 						'search_int_type',
3277 3277
 						'' 
3278 3278
 				),
3279
-				array (
3280
-						gettext ( 'Credit' ),
3279
+				array(
3280
+						gettext('Credit'),
3281 3281
 						'INPUT',
3282
-						array (
3282
+						array(
3283 3283
 								'name' => 'credit[credit]',
3284 3284
 								'value' => '',
3285 3285
 								'size' => '20',
@@ -3296,7 +3296,7 @@  discard block
 block discarded – undo
3296 3296
 						'' 
3297 3297
 				),
3298 3298
 				
3299
-				array (
3299
+				array(
3300 3300
 						'',
3301 3301
 						'HIDDEN',
3302 3302
 						'ajax_search',
@@ -3305,7 +3305,7 @@  discard block
 block discarded – undo
3305 3305
 						'',
3306 3306
 						'' 
3307 3307
 				),
3308
-				array (
3308
+				array(
3309 3309
 						'',
3310 3310
 						'HIDDEN',
3311 3311
 						'advance_search',
@@ -3315,18 +3315,18 @@  discard block
 block discarded – undo
3315 3315
 						'' 
3316 3316
 				) 
3317 3317
 		);
3318
-		$form ['button_search'] = array (
3318
+		$form ['button_search'] = array(
3319 3319
 				'name' => 'action',
3320 3320
 				'id' => "charges_search_btn",
3321
-				'content' => gettext ( 'Search' ),
3321
+				'content' => gettext('Search'),
3322 3322
 				'value' => 'save',
3323 3323
 				'type' => 'button',
3324 3324
 				'class' => 'btn btn-line-parrot pull-right' 
3325 3325
 		);
3326
-		$form ['button_reset'] = array (
3326
+		$form ['button_reset'] = array(
3327 3327
 				'name' => 'action',
3328 3328
 				'id' => "id_reset",
3329
-				'content' => gettext ( 'Clear' ),
3329
+				'content' => gettext('Clear'),
3330 3330
 				'value' => 'cancel',
3331 3331
 				'type' => 'reset',
3332 3332
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -3344,13 +3344,13 @@  discard block
 block discarded – undo
3344 3344
 	 * *******
3345 3345
 	 */
3346 3346
 	function build_charge_list_for_customer() {
3347
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
3347
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
3348 3348
 		$currency_id = $account_info ['currency_id'];
3349
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
3349
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
3350 3350
 		
3351
-		$grid_field_arr = json_encode ( array (
3352
-				array (
3353
-						gettext ( "Created Date" ),
3351
+		$grid_field_arr = json_encode(array(
3352
+				array(
3353
+						gettext("Created Date"),
3354 3354
 						"100",
3355 3355
 						"created_date",
3356 3356
 						"",
@@ -3360,8 +3360,8 @@  discard block
 block discarded – undo
3360 3360
 						"true",
3361 3361
 						"center" 
3362 3362
 				),
3363
-				array (
3364
-						gettext ( "Invoice Number" ),
3363
+				array(
3364
+						gettext("Invoice Number"),
3365 3365
 						"110",
3366 3366
 						"created_date",
3367 3367
 						"",
@@ -3371,8 +3371,8 @@  discard block
 block discarded – undo
3371 3371
 						"true",
3372 3372
 						"center" 
3373 3373
 				),
3374
-				array (
3375
-						gettext ( "Charge Type" ),
3374
+				array(
3375
+						gettext("Charge Type"),
3376 3376
 						"100",
3377 3377
 						"item_type",
3378 3378
 						"",
@@ -3382,8 +3382,8 @@  discard block
 block discarded – undo
3382 3382
 						"true",
3383 3383
 						"center" 
3384 3384
 				),
3385
-				array (
3386
-						gettext ( "Before Balance<br/>($currency)" ),
3385
+				array(
3386
+						gettext("Before Balance<br/>($currency)"),
3387 3387
 						"120",
3388 3388
 						"before_balance",
3389 3389
 						"before_balance",
@@ -3393,8 +3393,8 @@  discard block
 block discarded – undo
3393 3393
 						"true",
3394 3394
 						"right" 
3395 3395
 				),
3396
-				array (
3397
-						gettext ( "Debit (-)<br/>($currency)" ),
3396
+				array(
3397
+						gettext("Debit (-)<br/>($currency)"),
3398 3398
 						"110",
3399 3399
 						"debit",
3400 3400
 						"debit",
@@ -3404,8 +3404,8 @@  discard block
 block discarded – undo
3404 3404
 						"true",
3405 3405
 						"right" 
3406 3406
 				),
3407
-				array (
3408
-						gettext ( "Credit (+)<br/>($currency)" ),
3407
+				array(
3408
+						gettext("Credit (+)<br/>($currency)"),
3409 3409
 						"110",
3410 3410
 						"credit",
3411 3411
 						"credit",
@@ -3415,8 +3415,8 @@  discard block
 block discarded – undo
3415 3415
 						"true",
3416 3416
 						"right" 
3417 3417
 				),
3418
-				array (
3419
-						gettext ( "After Balance<br/>($currency)" ),
3418
+				array(
3419
+						gettext("After Balance<br/>($currency)"),
3420 3420
 						"120",
3421 3421
 						"after_balance",
3422 3422
 						"after_balance",
@@ -3426,8 +3426,8 @@  discard block
 block discarded – undo
3426 3426
 						"true",
3427 3427
 						"right" 
3428 3428
 				),
3429
-				array (
3430
-						gettext ( "Description" ),
3429
+				array(
3430
+						gettext("Description"),
3431 3431
 						"270",
3432 3432
 						"description",
3433 3433
 						"",
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
 						"true",
3438 3438
 						"center" 
3439 3439
 				) 
3440
-		) );
3440
+		));
3441 3441
 		return $grid_field_arr;
3442 3442
 	}
3443 3443
 	/**
@@ -3447,13 +3447,13 @@  discard block
 block discarded – undo
3447 3447
 	 * *******
3448 3448
 	 */
3449 3449
 	function build_refillreport_for_customer() {
3450
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
3450
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
3451 3451
 		$currency_id = $account_info ['currency_id'];
3452
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
3452
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
3453 3453
 		
3454
-		$grid_field_arr = json_encode ( array (
3455
-				array (
3456
-						gettext ( "Date" ),
3454
+		$grid_field_arr = json_encode(array(
3455
+				array(
3456
+						gettext("Date"),
3457 3457
 						"225",
3458 3458
 						"payment_date",
3459 3459
 						"",
@@ -3463,8 +3463,8 @@  discard block
 block discarded – undo
3463 3463
 						"true",
3464 3464
 						"center" 
3465 3465
 				),
3466
-				array (
3467
-						gettext ( "Amount($currency)" ),
3466
+				array(
3467
+						gettext("Amount($currency)"),
3468 3468
 						"250",
3469 3469
 						"credit",
3470 3470
 						"credit",
@@ -3474,8 +3474,8 @@  discard block
 block discarded – undo
3474 3474
 						"true",
3475 3475
 						"right" 
3476 3476
 				),
3477
-				array (
3478
-						gettext ( "Refill By" ),
3477
+				array(
3478
+						gettext("Refill By"),
3479 3479
 						"230",
3480 3480
 						"payment_by",
3481 3481
 						"payment_by",
@@ -3485,8 +3485,8 @@  discard block
 block discarded – undo
3485 3485
 						"true",
3486 3486
 						"center" 
3487 3487
 				),
3488
-				array (
3489
-						gettext ( "Note" ),
3488
+				array(
3489
+						gettext("Note"),
3490 3490
 						"325",
3491 3491
 						"notes",
3492 3492
 						"",
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
 						"true",
3497 3497
 						"center" 
3498 3498
 				) 
3499
-		) );
3499
+		));
3500 3500
 		return $grid_field_arr;
3501 3501
 	}
3502 3502
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/models/pricing_model.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,77 +22,77 @@
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class pricing_model extends CI_Model {
24 24
 	function pricing_model() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 	}
27 27
 	function getpricing_list($flag, $start = 0, $limit = 0) {
28
-		$this->db_model->build_search ( 'price_list_search' );
29
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
30
-			$account_data = $this->session->userdata ( "accountinfo" );
28
+		$this->db_model->build_search('price_list_search');
29
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
30
+			$account_data = $this->session->userdata("accountinfo");
31 31
 			$reseller = $account_data ['id'];
32 32
 			// $where = array("reseller_id" => $reseller, "status" => "0");
33
-			$where = array (
33
+			$where = array(
34 34
 					"reseller_id" => $reseller,
35 35
 					"status != " => "2" 
36 36
 			);
37 37
 		} else {
38
-			$where = array (
38
+			$where = array(
39 39
 					"reseller_id" => "0",
40 40
 					"status != " => "2" 
41 41
 			);
42 42
 		}
43 43
 		if ($flag) {
44
-			$query = $this->db_model->Select ( "*", "pricelists", $where, "id", "ASC", $limit, $start );
44
+			$query = $this->db_model->Select("*", "pricelists", $where, "id", "ASC", $limit, $start);
45 45
 		} else {
46
-			$query = $this->db_model->countQuery ( "*", "pricelists", $where );
46
+			$query = $this->db_model->countQuery("*", "pricelists", $where);
47 47
 		}
48 48
 		return $query;
49 49
 	}
50 50
 	function add_price($add_array) {
51
-		unset ( $add_array ["action"] );
51
+		unset ($add_array ["action"]);
52 52
 		/*
53 53
 		 * ASTPP 3.0 Add Rategroup add creation date.
54 54
 		 */
55
-		$add_array ['creation_date'] = gmdate ( "Y-m-d H:i:s" );
55
+		$add_array ['creation_date'] = gmdate("Y-m-d H:i:s");
56 56
 		/**
57 57
 		 * *********************************
58 58
 		 */
59
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
60
-			$account_data = $this->session->userdata ( "accountinfo" );
59
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
60
+			$account_data = $this->session->userdata("accountinfo");
61 61
 			$add_array ["reseller_id"] = $account_data ['id'];
62 62
 		} else {
63 63
 			$add_array ["reseller_id"] = "0";
64 64
 		}
65
-		$this->db->insert ( "pricelists", $add_array );
65
+		$this->db->insert("pricelists", $add_array);
66 66
 		
67
-		return $this->db->insert_id ();
67
+		return $this->db->insert_id();
68 68
 	}
69 69
 	function edit_price($data, $id) {
70
-		unset ( $data ["action"] );
70
+		unset ($data ["action"]);
71 71
 		/*
72 72
 		 * ASTPP 3.0 Edit Rategroup time update last mofied date.
73 73
 		 */
74
-		$data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" );
74
+		$data ['last_modified_date'] = gmdate("Y-m-d H:i:s");
75 75
 		/**
76 76
 		 * ******************************************************
77 77
 		 */
78
-		$this->db->where ( "id", $id );
79
-		$this->db->update ( "pricelists", $data );
78
+		$this->db->where("id", $id);
79
+		$this->db->update("pricelists", $data);
80 80
 		return true;
81 81
 	}
82 82
 	function get_price_list_for_cdrs() {
83
-		if ($this->session->userdata ( 'username' ) != "" && $this->session->userdata ( 'logintype' ) != 2) {
84
-			$this->db->where ( 'reseller', $this->session->userdata ( 'username' ) );
83
+		if ($this->session->userdata('username') != "" && $this->session->userdata('logintype') != 2) {
84
+			$this->db->where('reseller', $this->session->userdata('username'));
85 85
 		} else {
86
-			$this->db->where ( array (
86
+			$this->db->where(array(
87 87
 					'reseller' => "0" 
88
-			) );
88
+			));
89 89
 		}
90
-		$this->db->where ( 'status <', 2 );
91
-		$this->db->order_by ( 'name', 'desc' );
92
-		$query = $this->db->get ( "pricelists" );
93
-		$price_list = array ();
94
-		$result = $query->result_array ();
95
-		foreach ( $result as $row ) {
90
+		$this->db->where('status <', 2);
91
+		$this->db->order_by('name', 'desc');
92
+		$query = $this->db->get("pricelists");
93
+		$price_list = array();
94
+		$result = $query->result_array();
95
+		foreach ($result as $row) {
96 96
 			$price_list [$row ['name']] = $row ['name'];
97 97
 		}
98 98
 		return $price_list;
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/controllers/pricing.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -22,130 +22,130 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class pricing extends CI_Controller {
24 24
 	function pricing() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 		
27
-		$this->load->helper ( 'template_inheritance' );
27
+		$this->load->helper('template_inheritance');
28 28
 		
29
-		$this->load->library ( 'session' );
30
-		$this->load->library ( "pricing_form" );
31
-		$this->load->library ( 'astpp/form' );
32
-		$this->load->model ( 'pricing_model' );
29
+		$this->load->library('session');
30
+		$this->load->library("pricing_form");
31
+		$this->load->library('astpp/form');
32
+		$this->load->model('pricing_model');
33 33
 		
34
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
35
-			redirect ( base_url () . '/astpp/login' );
34
+		if ($this->session->userdata('user_login') == FALSE)
35
+			redirect(base_url().'/astpp/login');
36 36
 	}
37 37
 	function price_add($type = "") {
38
-		$data ['username'] = $this->session->userdata ( 'user_name' );
38
+		$data ['username'] = $this->session->userdata('user_name');
39 39
 		$data ['flag'] = 'Create Rate Group';
40
-		$data ['page_title'] = gettext ( 'Create Rate Group' );
41
-		$data ['form'] = $this->form->build_form ( $this->pricing_form->get_pricing_form_fields (), '' );
40
+		$data ['page_title'] = gettext('Create Rate Group');
41
+		$data ['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), '');
42 42
 		
43
-		$this->load->view ( 'view_price_add_edit', $data );
43
+		$this->load->view('view_price_add_edit', $data);
44 44
 	}
45 45
 	function price_edit($edit_id = '') {
46
-		$data ['page_title'] = gettext ( 'Edit Rate Group' );
47
-		$where = array (
46
+		$data ['page_title'] = gettext('Edit Rate Group');
47
+		$where = array(
48 48
 				'id' => $edit_id 
49 49
 		);
50
-		$account = $this->db_model->getSelect ( "*", " pricelists", $where );
51
-		foreach ( $account->result_array () as $key => $value ) {
50
+		$account = $this->db_model->getSelect("*", " pricelists", $where);
51
+		foreach ($account->result_array() as $key => $value) {
52 52
 			$edit_data = $value;
53 53
 		}
54
-		$routing_data = $this->db_model->getSelect ( "trunk_id", "routing", array (
54
+		$routing_data = $this->db_model->getSelect("trunk_id", "routing", array(
55 55
 				"pricelist_id" => $edit_id 
56
-		) );
56
+		));
57 57
 		if ($routing_data->num_rows > 0) {
58
-			foreach ( $routing_data->result_array () as $trunkid ) {
58
+			foreach ($routing_data->result_array() as $trunkid) {
59 59
 				$edit_data ["trunk_id"] [] = $trunkid ["trunk_id"];
60 60
 			}
61 61
 		}
62
-		$data ['form'] = $this->form->build_form ( $this->pricing_form->get_pricing_form_fields (), $edit_data );
63
-		$this->load->view ( 'view_price_add_edit', $data );
62
+		$data ['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), $edit_data);
63
+		$this->load->view('view_price_add_edit', $data);
64 64
 	}
65 65
 	function price_save() {
66
-		$add_array = $this->input->post ();
66
+		$add_array = $this->input->post();
67 67
 		
68
-		$data ['form'] = $this->form->build_form ( $this->pricing_form->get_pricing_form_fields (), $add_array );
68
+		$data ['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), $add_array);
69 69
 		if ($add_array ['id'] != '') {
70
-			$data ['page_title'] = gettext ( 'Edit Price Details' );
71
-			if ($this->form_validation->run () == FALSE) {
72
-				$data ['validation_errors'] = validation_errors ();
70
+			$data ['page_title'] = gettext('Edit Price Details');
71
+			if ($this->form_validation->run() == FALSE) {
72
+				$data ['validation_errors'] = validation_errors();
73 73
 				echo $data ['validation_errors'];
74 74
 				exit ();
75 75
 			} else {
76
-				$where = array (
76
+				$where = array(
77 77
 						"pricelist_id" => $add_array ['id'] 
78 78
 				);
79
-				$this->db->delete ( "routing", $where );
80
-				if (isset ( $add_array ['trunk_id'] ) && $add_array ['trunk_id'] != '') {
81
-					$this->set_force_routing ( $add_array ['id'], $add_array ['trunk_id'] );
82
-					unset ( $add_array ['trunk_id'] );
79
+				$this->db->delete("routing", $where);
80
+				if (isset ($add_array ['trunk_id']) && $add_array ['trunk_id'] != '') {
81
+					$this->set_force_routing($add_array ['id'], $add_array ['trunk_id']);
82
+					unset ($add_array ['trunk_id']);
83 83
 				}
84
-				$this->pricing_model->edit_price ( $add_array, $add_array ['id'] );
85
-				echo json_encode ( array (
86
-						"SUCCESS" => $add_array ["name"] . " rate group updated successfully!" 
87
-				) );
84
+				$this->pricing_model->edit_price($add_array, $add_array ['id']);
85
+				echo json_encode(array(
86
+						"SUCCESS" => $add_array ["name"]." rate group updated successfully!" 
87
+				));
88 88
 				exit ();
89 89
 			}
90
-			$this->load->view ( 'view_price_add_edit', $data );
90
+			$this->load->view('view_price_add_edit', $data);
91 91
 		} else {
92
-			$data ['page_title'] = gettext ( 'Create Price Details' );
93
-			if ($this->form_validation->run () == FALSE) {
94
-				$data ['validation_errors'] = validation_errors ();
92
+			$data ['page_title'] = gettext('Create Price Details');
93
+			if ($this->form_validation->run() == FALSE) {
94
+				$data ['validation_errors'] = validation_errors();
95 95
 				echo $data ['validation_errors'];
96 96
 				exit ();
97 97
 			} else {
98
-				if (isset ( $add_array ['trunk_id'] ) && ! empty ( $add_array ['trunk_id'] ))
98
+				if (isset ($add_array ['trunk_id']) && ! empty ($add_array ['trunk_id']))
99 99
 					$trunk_id = $add_array ['trunk_id'];
100
-				unset ( $add_array ['trunk_id'] );
101
-				$priceid = $this->pricing_model->add_price ( $add_array );
102
-				if (isset ( $trunk_id ) && $trunk_id != '') {
103
-					$this->set_force_routing ( $priceid, $trunk_id );
100
+				unset ($add_array ['trunk_id']);
101
+				$priceid = $this->pricing_model->add_price($add_array);
102
+				if (isset ($trunk_id) && $trunk_id != '') {
103
+					$this->set_force_routing($priceid, $trunk_id);
104 104
 				}
105
-				echo json_encode ( array (
106
-						"SUCCESS" => $add_array ["name"] . " rate group added successfully!" 
107
-				) );
105
+				echo json_encode(array(
106
+						"SUCCESS" => $add_array ["name"]." rate group added successfully!" 
107
+				));
108 108
 				exit ();
109 109
 			}
110 110
 		}
111 111
 	}
112 112
 	function set_force_routing($priceid, $trunkid) {
113 113
 		// echo "<pre>".$priceid; print_r($trunkid);
114
-		foreach ( $trunkid as $id ) {
115
-			$routing_arr = array (
114
+		foreach ($trunkid as $id) {
115
+			$routing_arr = array(
116 116
 					"trunk_id" => $id,
117 117
 					"pricelist_id" => $priceid 
118 118
 			);
119
-			$this->db->insert ( "routing", $routing_arr );
119
+			$this->db->insert("routing", $routing_arr);
120 120
 		}
121 121
 	}
122 122
 	function price_list_search() {
123
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
123
+		$ajax_search = $this->input->post('ajax_search', 0);
124 124
 		
125
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
126
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
127
-			$action = $this->input->post ();
128
-			unset ( $action ['action'] );
129
-			unset ( $action ['advance_search'] );
130
-			$this->session->set_userdata ( 'price_list_search', $action );
125
+		if ($this->input->post('advance_search', TRUE) == 1) {
126
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
127
+			$action = $this->input->post();
128
+			unset ($action ['action']);
129
+			unset ($action ['advance_search']);
130
+			$this->session->set_userdata('price_list_search', $action);
131 131
 		}
132 132
 		if (@$ajax_search != 1) {
133
-			redirect ( base_url () . 'accounts/customer_list/' );
133
+			redirect(base_url().'accounts/customer_list/');
134 134
 		}
135 135
 	}
136 136
 	function price_list_clearsearchfilter() {
137
-		$this->session->set_userdata ( 'advance_search', 0 );
138
-		$this->session->set_userdata ( 'account_search', "" );
137
+		$this->session->set_userdata('advance_search', 0);
138
+		$this->session->set_userdata('account_search', "");
139 139
 	}
140 140
 	function price_list() {
141
-		$data ['username'] = $this->session->userdata ( 'user_name' );
142
-		$data ['page_title'] = gettext ( 'Rate Groups' );
141
+		$data ['username'] = $this->session->userdata('user_name');
142
+		$data ['page_title'] = gettext('Rate Groups');
143 143
 		$data ['search_flag'] = true;
144
-		$this->session->set_userdata ( 'advance_search', 0 );
145
-		$data ['grid_fields'] = $this->pricing_form->build_pricing_list_for_admin ();
146
-		$data ["grid_buttons"] = $this->pricing_form->build_grid_buttons ();
147
-		$data ['form_search'] = $this->form->build_serach_form ( $this->pricing_form->get_pricing_search_form () );
148
-		$this->load->view ( 'view_price_list', $data );
144
+		$this->session->set_userdata('advance_search', 0);
145
+		$data ['grid_fields'] = $this->pricing_form->build_pricing_list_for_admin();
146
+		$data ["grid_buttons"] = $this->pricing_form->build_grid_buttons();
147
+		$data ['form_search'] = $this->form->build_serach_form($this->pricing_form->get_pricing_search_form());
148
+		$this->load->view('view_price_list', $data);
149 149
 	}
150 150
 	
151 151
 	/**
@@ -153,95 +153,95 @@  discard block
 block discarded – undo
153 153
 	 * Listing of Accounts table data through php function json_encode
154 154
 	 */
155 155
 	function price_list_json() {
156
-		$json_data = array ();
157
-		$count_all = $this->pricing_model->getpricing_list ( false );
158
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
156
+		$json_data = array();
157
+		$count_all = $this->pricing_model->getpricing_list(false);
158
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
159 159
 		$json_data = $paging_data ["json_paging"];
160 160
 		
161
-		$query = $this->pricing_model->getpricing_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
162
-		$grid_fields = json_decode ( $this->pricing_form->build_pricing_list_for_admin () );
163
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
161
+		$query = $this->pricing_model->getpricing_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
162
+		$grid_fields = json_decode($this->pricing_form->build_pricing_list_for_admin());
163
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
164 164
 		
165
-		echo json_encode ( $json_data );
165
+		echo json_encode($json_data);
166 166
 	}
167 167
 	function price_delete($pricelist_id) {
168
-		$where = array (
168
+		$where = array(
169 169
 				"id" => $pricelist_id 
170 170
 		);
171
-		$this->db_model->update ( "pricelists", array (
171
+		$this->db_model->update("pricelists", array(
172 172
 				"status" => "2" 
173
-		), $where );
174
-		$this->db->delete ( "routing", array (
173
+		), $where);
174
+		$this->db->delete("routing", array(
175 175
 				"pricelist_id" => $pricelist_id 
176
-		) );
177
-		$this->session->set_flashdata ( 'astpp_notification', 'Rate group removed successfully!' );
178
-		redirect ( base_url () . 'pricing/price_list/' );
176
+		));
177
+		$this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!');
178
+		redirect(base_url().'pricing/price_list/');
179 179
 	}
180 180
 	function price_delete_multiple() {
181
-		$add_array = $this->input->post ();
182
-		$where = 'IN (' . $add_array ['selected_ids'] . ')';
183
-		if (isset ( $add_array ['flag'] )) {
184
-			$update_data = array (
181
+		$add_array = $this->input->post();
182
+		$where = 'IN ('.$add_array ['selected_ids'].')';
183
+		if (isset ($add_array ['flag'])) {
184
+			$update_data = array(
185 185
 					'status' => '2' 
186 186
 			);
187
-			$this->db->where ( 'pricelist_id ' . $where );
188
-			$this->db->delete ( 'routes' );
189
-			$this->db->delete ( "routing", array (
187
+			$this->db->where('pricelist_id '.$where);
188
+			$this->db->delete('routes');
189
+			$this->db->delete("routing", array(
190 190
 					"pricelist_id" => $where 
191
-			) );
192
-			$this->db->where ( 'id ' . $where );
193
-			echo $this->db->update ( 'pricelists', $update_data );
191
+			));
192
+			$this->db->where('id '.$where);
193
+			echo $this->db->update('pricelists', $update_data);
194 194
 		} else {
195
-			$pricelist_arr = array ();
195
+			$pricelist_arr = array();
196 196
 			// Get selected Rategroup Name from database.
197
-			$this->db->select ( 'id,name' );
198
-			$this->db->where ( 'id ' . $where );
199
-			$pricelist_res = $this->db->get ( 'pricelists' );
200
-			$pricelist_res = $pricelist_res->result_array ();
201
-			foreach ( $pricelist_res as $value ) {
197
+			$this->db->select('id,name');
198
+			$this->db->where('id '.$where);
199
+			$pricelist_res = $this->db->get('pricelists');
200
+			$pricelist_res = $pricelist_res->result_array();
201
+			foreach ($pricelist_res as $value) {
202 202
 				$pricelist_arr [$value ['id']] ['name'] = $value ['name'];
203 203
 			}
204 204
 			// Get count of accounts which are using selected rategroups.
205
-			$this->db->where ( 'pricelist_id ' . $where );
206
-			$this->db->where ( 'deleted', 0 );
207
-			$this->db->select ( 'count(id) as cnt,pricelist_id' );
208
-			$this->db->group_by ( 'pricelist_id' );
209
-			$account_res = $this->db->get ( 'accounts' );
210
-			if ($account_res->num_rows () > 0) {
211
-				$account_res = $account_res->result_array ();
212
-				foreach ( $account_res as $key => $value ) {
205
+			$this->db->where('pricelist_id '.$where);
206
+			$this->db->where('deleted', 0);
207
+			$this->db->select('count(id) as cnt,pricelist_id');
208
+			$this->db->group_by('pricelist_id');
209
+			$account_res = $this->db->get('accounts');
210
+			if ($account_res->num_rows() > 0) {
211
+				$account_res = $account_res->result_array();
212
+				foreach ($account_res as $key => $value) {
213 213
 					$pricelist_arr [$value ['pricelist_id']] ['account'] = $value ['cnt'];
214 214
 				}
215 215
 			}
216 216
 			// Get count of routes which are using selected rategroups.
217
-			$this->db->where ( 'pricelist_id ' . $where );
218
-			$this->db->select ( 'count(id) as cnt,pricelist_id' );
219
-			$this->db->group_by ( 'pricelist_id' );
220
-			$routes_res = $this->db->get ( 'routes' );
221
-			if ($routes_res->num_rows () > 0) {
222
-				$routes_res = $routes_res->result_array ();
223
-				foreach ( $routes_res as $key => $value ) {
217
+			$this->db->where('pricelist_id '.$where);
218
+			$this->db->select('count(id) as cnt,pricelist_id');
219
+			$this->db->group_by('pricelist_id');
220
+			$routes_res = $this->db->get('routes');
221
+			if ($routes_res->num_rows() > 0) {
222
+				$routes_res = $routes_res->result_array();
223
+				foreach ($routes_res as $key => $value) {
224 224
 					$pricelist_arr [$value ['pricelist_id']] ['routes'] = $value ['cnt'];
225 225
 				}
226 226
 			}
227 227
 			$str = null;
228
-			foreach ( $pricelist_arr as $key => $value ) {
228
+			foreach ($pricelist_arr as $key => $value) {
229 229
 				$custom_str = null;
230
-				if (isset ( $value ['account'] ) || isset ( $value ['routes'] )) {
231
-					if (isset ( $value ['account'] )) {
232
-						$custom_str .= $value ['account'] . " accounts and ";
230
+				if (isset ($value ['account']) || isset ($value ['routes'])) {
231
+					if (isset ($value ['account'])) {
232
+						$custom_str .= $value ['account']." accounts and ";
233 233
 					}
234
-					if (isset ( $value ['routes'] )) {
235
-						$custom_str .= $value ['routes'] . " origination rates and ";
234
+					if (isset ($value ['routes'])) {
235
+						$custom_str .= $value ['routes']." origination rates and ";
236 236
 					}
237
-					$str .= " Rate group Name : " . $value ['name'] . " using by " . rtrim ( $custom_str, " and " ) . "\n";
237
+					$str .= " Rate group Name : ".$value ['name']." using by ".rtrim($custom_str, " and ")."\n";
238 238
 				}
239 239
 			}
240
-			if (! empty ( $str )) {
240
+			if ( ! empty ($str)) {
241 241
 				$data ['str'] = $str;
242 242
 			}
243 243
 			$data ['selected_ids'] = $add_array ['selected_ids'];
244
-			echo json_encode ( $data );
244
+			echo json_encode($data);
245 245
 		}
246 246
 	}
247 247
 /**
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/libraries/pricing_form.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -20,27 +20,27 @@  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' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class pricing_form {
26 26
 	function __construct($library_name = '') {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	function get_pricing_form_fields() {
30
-		$form ['forms'] = array (
31
-				base_url () . 'pricing/price_save/',
32
-				array (
30
+		$form ['forms'] = array(
31
+				base_url().'pricing/price_save/',
32
+				array(
33 33
 						'id' => 'pricing_form',
34 34
 						'method' => 'POST',
35 35
 						'name' => 'pricing_form' 
36 36
 				) 
37 37
 		);
38
-		if ($this->CI->session->userdata ( 'logintype' ) == 1 || $this->CI->session->userdata ( 'logintype' ) == 5) {
39
-			$form ['Rate Group Information'] = array (
40
-					array (
38
+		if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
39
+			$form ['Rate Group Information'] = array(
40
+					array(
41 41
 							'',
42 42
 							'HIDDEN',
43
-							array (
43
+							array(
44 44
 									'name' => 'id' 
45 45
 							),
46 46
 							'',
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 							'',
49 49
 							'' 
50 50
 					),
51
-					array (
51
+					array(
52 52
 							'',
53 53
 							'HIDDEN',
54
-							array (
54
+							array(
55 55
 									'name' => 'status',
56 56
 									'value' => '1' 
57 57
 							),
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 							'',
60 60
 							'' 
61 61
 					),
62
-					array (
63
-							gettext ( 'Name' ),
62
+					array(
63
+							gettext('Name'),
64 64
 							'INPUT',
65
-							array (
65
+							array(
66 66
 									'name' => 'name',
67 67
 									'size' => '20',
68 68
 									'class' => "text field medium" 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 							'tOOL TIP',
72 72
 							'Please Enter account number' 
73 73
 					),
74
-					array (
75
-							gettext ( 'Routing Type' ),
74
+					array(
75
+							gettext('Routing Type'),
76 76
 							'routing_type',
77 77
 							'SELECT',
78 78
 							'',
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 							'',
85 85
 							'set_routetype' 
86 86
 					),
87
-					array (
88
-							gettext ( 'Initial Increment' ),
87
+					array(
88
+							gettext('Initial Increment'),
89 89
 							'INPUT',
90
-							array (
90
+							array(
91 91
 									'name' => 'initially_increment',
92 92
 									'size' => '20',
93 93
 									'class' => "text field medium" 
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 							'tOOL TIP',
97 97
 							'Please Enter account number' 
98 98
 					),
99
-					array (
100
-							gettext ( 'Default Increment' ),
99
+					array(
100
+							gettext('Default Increment'),
101 101
 							'INPUT',
102
-							array (
102
+							array(
103 103
 									'name' => 'inc',
104 104
 									'size' => '20',
105 105
 									'class' => "text field medium" 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 							'tOOL TIP',
109 109
 							'Please Enter account number' 
110 110
 					),
111
-					array (
112
-							gettext ( 'Markup(%)' ),
111
+					array(
112
+							gettext('Markup(%)'),
113 113
 							'INPUT',
114
-							array (
114
+							array(
115 115
 									'name' => 'markup',
116 116
 									'value' => "0",
117 117
 									'size' => '20',
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 							'tOOL TIP',
122 122
 							'Please Enter account number' 
123 123
 					),
124
-					array (
125
-							gettext ( 'Status' ),
124
+					array(
125
+							gettext('Status'),
126 126
 							'status',
127 127
 							'SELECT',
128 128
 							'',
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 					) 
137 137
 			);
138 138
 		} else {
139
-			$form ['Rate Group Information'] = array (
140
-					array (
139
+			$form ['Rate Group Information'] = array(
140
+					array(
141 141
 							'',
142 142
 							'HIDDEN',
143
-							array (
143
+							array(
144 144
 									'name' => 'id' 
145 145
 							),
146 146
 							'',
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 							'',
149 149
 							'' 
150 150
 					),
151
-					array (
151
+					array(
152 152
 							'',
153 153
 							'HIDDEN',
154
-							array (
154
+							array(
155 155
 									'name' => 'status',
156 156
 									'value' => '1' 
157 157
 							),
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 							'',
160 160
 							'' 
161 161
 					),
162
-					array (
163
-							gettext ( 'Name' ),
162
+					array(
163
+							gettext('Name'),
164 164
 							'INPUT',
165
-							array (
165
+							array(
166 166
 									'name' => 'name',
167 167
 									'size' => '20',
168 168
 									'maxlength' => '30',
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 							'tOOL TIP',
173 173
 							'Please Enter account number' 
174 174
 					),
175
-					array (
176
-							gettext ( 'Routing Type' ),
175
+					array(
176
+							gettext('Routing Type'),
177 177
 							'routing_type',
178 178
 							'SELECT',
179 179
 							'',
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 							'',
186 186
 							'set_routetype' 
187 187
 					),
188
-					array (
189
-							gettext ( 'Initial Increment' ),
188
+					array(
189
+							gettext('Initial Increment'),
190 190
 							'INPUT',
191
-							array (
191
+							array(
192 192
 									'name' => 'initially_increment',
193 193
 									'size' => '20',
194 194
 									'class' => "text field medium" 
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 							'tOOL TIP',
198 198
 							'Please Enter account number' 
199 199
 					),
200
-					array (
201
-							gettext ( 'Default Increment' ),
200
+					array(
201
+							gettext('Default Increment'),
202 202
 							'INPUT',
203
-							array (
203
+							array(
204 204
 									'name' => 'inc',
205 205
 									'size' => '20',
206 206
 									'class' => "text field medium" 
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 							'tOOL TIP',
210 210
 							'Please Enter account number' 
211 211
 					),
212
-					array (
213
-							gettext ( 'Markup(%)' ),
212
+					array(
213
+							gettext('Markup(%)'),
214 214
 							'INPUT',
215
-							array (
215
+							array(
216 216
 									'name' => 'markup',
217 217
 									'value' => "0",
218 218
 									'size' => '20',
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 							'tOOL TIP',
223 223
 							'Please Enter account number' 
224 224
 					),
225
-					array (
226
-							gettext ( 'Trunks' ),
225
+					array(
226
+							gettext('Trunks'),
227 227
 							'trunk_id',
228 228
 							'SELECT',
229 229
 							'',
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
 							'trunks',
236 236
 							'build_dropdown',
237 237
 							'where_arr',
238
-							array (
238
+							array(
239 239
 									"status <" => "2" 
240 240
 							),
241 241
 							'multi' 
242 242
 					),
243
-					array (
244
-							gettext ( 'Status' ),
243
+					array(
244
+							gettext('Status'),
245 245
 							'status',
246 246
 							'SELECT',
247 247
 							'',
@@ -256,17 +256,17 @@  discard block
 block discarded – undo
256 256
 			);
257 257
 		}
258 258
 		
259
-		$form ['button_cancel'] = array (
259
+		$form ['button_cancel'] = array(
260 260
 				'name' => 'action',
261
-				'content' => gettext ( 'Close' ),
261
+				'content' => gettext('Close'),
262 262
 				'value' => 'cancel',
263 263
 				'type' => 'button',
264 264
 				'class' => 'btn btn-line-sky margin-x-10',
265 265
 				'onclick' => 'return redirect_page(\'NULL\')' 
266 266
 		);
267
-		$form ['button_save'] = array (
267
+		$form ['button_save'] = array(
268 268
 				'name' => 'action',
269
-				'content' => gettext ( 'Save' ),
269
+				'content' => gettext('Save'),
270 270
 				'value' => 'save',
271 271
 				'id' => 'submit',
272 272
 				'type' => 'button',
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
 		return $form;
277 277
 	}
278 278
 	function get_pricing_search_form() {
279
-		$form ['forms'] = array (
279
+		$form ['forms'] = array(
280 280
 				"",
281
-				array (
281
+				array(
282 282
 						'id' => "price_search" 
283 283
 				) 
284 284
 		);
285
-		$form ['Search'] = array (
286
-				array (
287
-						gettext ( 'Name' ),
285
+		$form ['Search'] = array(
286
+				array(
287
+						gettext('Name'),
288 288
 						'INPUT',
289
-						array (
289
+						array(
290 290
 								'name' => 'name[name]',
291 291
 								'',
292 292
 								'size' => '20',
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 						'search_string_type',
303 303
 						'' 
304 304
 				),
305
-				array (
306
-						gettext ( 'Routing Type' ),
305
+				array(
306
+						gettext('Routing Type'),
307 307
 						'routing_type',
308 308
 						'SELECT',
309 309
 						'',
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 						'',
318 318
 						'' 
319 319
 				),
320
-				array (
321
-						gettext ( 'Initial Increment ' ),
320
+				array(
321
+						gettext('Initial Increment '),
322 322
 						'INPUT',
323
-						array (
323
+						array(
324 324
 								'name' => 'initially_increment[initially_increment]',
325 325
 								'',
326 326
 								'size' => '20',
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 						'search_string_type',
337 337
 						'' 
338 338
 				),
339
-				array (
340
-						gettext ( 'Default Increment ' ),
339
+				array(
340
+						gettext('Default Increment '),
341 341
 						'INPUT',
342
-						array (
342
+						array(
343 343
 								'name' => 'inc[inc]',
344 344
 								'',
345 345
 								'size' => '20',
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 						'' 
357 357
 				),
358 358
 				
359
-				array (
359
+				array(
360 360
 						'Status',
361 361
 						'status',
362 362
 						'SELECT',
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						'',
372 372
 						'' 
373 373
 				),
374
-				array (
374
+				array(
375 375
 						'',
376 376
 						'HIDDEN',
377 377
 						'ajax_search',
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 						'',
381 381
 						'' 
382 382
 				),
383
-				array (
383
+				array(
384 384
 						'',
385 385
 						'HIDDEN',
386 386
 						'advance_search',
@@ -391,18 +391,18 @@  discard block
 block discarded – undo
391 391
 				) 
392 392
 		)
393 393
 		;
394
-		$form ['button_search'] = array (
394
+		$form ['button_search'] = array(
395 395
 				'name' => 'action',
396 396
 				'id' => "price_search_btn",
397
-				'content' => gettext ( 'Search' ),
397
+				'content' => gettext('Search'),
398 398
 				'value' => 'save',
399 399
 				'type' => 'button',
400 400
 				'class' => "btn btn-line-parrot pull-right" 
401 401
 		);
402
-		$form ['button_reset'] = array (
402
+		$form ['button_reset'] = array(
403 403
 				'name' => 'action',
404 404
 				'id' => "id_reset",
405
-				'content' => gettext ( 'Clear' ),
405
+				'content' => gettext('Clear'),
406 406
 				'value' => 'cancel',
407 407
 				'type' => 'reset',
408 408
 				'class' => "btn btn-line-sky pull-right margin-x-10" 
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	function build_pricing_list_for_admin() {
418 418
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
419
-		$grid_field_arr = json_encode ( array (
420
-				array (
419
+		$grid_field_arr = json_encode(array(
420
+				array(
421 421
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
422 422
 						"30",
423 423
 						"",
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 				 * For Rategroup edit on Name
434 434
 				 * *
435 435
 				 */
436
-				array (
437
-						gettext ( "Name" ),
436
+				array(
437
+						gettext("Name"),
438 438
 						"110",
439 439
 						"name",
440 440
 						"",
@@ -447,16 +447,16 @@  discard block
 block discarded – undo
447 447
 				/**
448 448
 				 * ************************************
449 449
 				 */
450
-				array (
451
-						gettext ( "Routing Type" ),
450
+				array(
451
+						gettext("Routing Type"),
452 452
 						"120",
453 453
 						"routing_type",
454 454
 						"routing_type",
455 455
 						"routing_type",
456 456
 						"get_routetype" 
457 457
 				),
458
-				array (
459
-						gettext ( "Initial Increment" ),
458
+				array(
459
+						gettext("Initial Increment"),
460 460
 						"140",
461 461
 						"initially_increment",
462 462
 						"",
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 						"true",
467 467
 						"center" 
468 468
 				),
469
-				array (
469
+				array(
470 470
 						"Default Increment",
471 471
 						"140",
472 472
 						"inc",
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 						"true",
478 478
 						"center" 
479 479
 				),
480
-				array (
481
-						gettext ( "Markup(%)" ),
480
+				array(
481
+						gettext("Markup(%)"),
482 482
 						"100",
483 483
 						"markup",
484 484
 						"",
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 						"true",
489 489
 						"center" 
490 490
 				),
491
-				array (
492
-						gettext ( "Rate Count" ),
491
+				array(
492
+						gettext("Rate Count"),
493 493
 						"100",
494 494
 						"id",
495 495
 						"pricelist_id",
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 						"true",
500 500
 						"center" 
501 501
 				),
502
-				array (
503
-						gettext ( "Status" ),
502
+				array(
503
+						gettext("Status"),
504 504
 						"110",
505 505
 						"status",
506 506
 						"id",
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
 						"true",
511 511
 						"center" 
512 512
 				),
513
-				array (
514
-						gettext ( "Created Date" ),
513
+				array(
514
+						gettext("Created Date"),
515 515
 						"120",
516 516
 						"creation_date",
517 517
 						"creation_date",
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 						"true",
522 522
 						"center" 
523 523
 				),
524
-				array (
525
-						gettext ( "Modified Date" ),
524
+				array(
525
+						gettext("Modified Date"),
526 526
 						"140",
527 527
 						"last_modified_date",
528 528
 						"last_modified_date",
@@ -532,45 +532,45 @@  discard block
 block discarded – undo
532 532
 						"true",
533 533
 						"center" 
534 534
 				),
535
-				array (
536
-						gettext ( "Action" ),
535
+				array(
536
+						gettext("Action"),
537 537
 						"150",
538 538
 						"",
539 539
 						"",
540 540
 						"",
541
-						array (
542
-								"EDIT" => array (
541
+						array(
542
+								"EDIT" => array(
543 543
 										"url" => "pricing/price_edit/",
544 544
 										"mode" => "popup" 
545 545
 								),
546 546
 								
547
-								"DELETE" => array (
547
+								"DELETE" => array(
548 548
 										"url" => "pricing/price_delete/",
549 549
 										"mode" => "single" 
550 550
 								) 
551 551
 						) 
552 552
 				) 
553
-		) );
553
+		));
554 554
 		return $grid_field_arr;
555 555
 	}
556 556
 	function build_grid_buttons() {
557
-		$buttons_json = json_encode ( array (
558
-				array (
559
-						gettext ( "Create" ),
557
+		$buttons_json = json_encode(array(
558
+				array(
559
+						gettext("Create"),
560 560
 						"btn btn-line-warning btn",
561 561
 						"fa fa-plus-circle fa-lg",
562 562
 						"button_action",
563 563
 						"/pricing/price_add/",
564 564
 						"popup" 
565 565
 				),
566
-				array (
567
-						gettext ( "Delete" ),
566
+				array(
567
+						gettext("Delete"),
568 568
 						"btn btn-line-danger",
569 569
 						"fa fa-times-circle fa-lg",
570 570
 						"button_action",
571 571
 						"/pricing/price_delete_multiple/" 
572 572
 				) 
573
-		) );
573
+		));
574 574
 		return $buttons_json;
575 575
 	}
576 576
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/models/rates_model.php 1 patch
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -22,105 +22,105 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class rates_model extends CI_Model {
24 24
 	function rates_model() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 	}
27 27
 	function get_termination_rates_list($flag, $start = 0, $limit = 0) {
28
-		$this->db_model->build_search ( 'termination_rates_list_search' );
28
+		$this->db_model->build_search('termination_rates_list_search');
29 29
 		/**
30 30
 		 * ******
31 31
 		 * ASTPP 3.0
32 32
 		 * Batch Delete
33 33
 		 * *******
34 34
 		 */
35
-		if ($this->session->userdata ( 'advance_batch_delete' ) == 1) {
35
+		if ($this->session->userdata('advance_batch_delete') == 1) {
36 36
 			
37 37
 			//Samir - Added if condition to resolve "Delete Search Record - This option deletes ALL termination rates #264"
38 38
 			if (count($this->db->ar_where) > 0)
39 39
 			{
40
-				$this->db->where ( array (
40
+				$this->db->where(array(
41 41
 						"trunk_id >" => "0" 
42
-				) );
43
-				$this->db->delete ( "outbound_routes" );				
42
+				));
43
+				$this->db->delete("outbound_routes");				
44 44
 			}
45
-			$this->session->set_userdata ( 'advance_batch_delete', '0' );
46
-			$this->session->unset_userdata ( 'advance_batch_delete' );			
45
+			$this->session->set_userdata('advance_batch_delete', '0');
46
+			$this->session->unset_userdata('advance_batch_delete');			
47 47
 		}
48 48
 		/**
49 49
 		 * ***********
50 50
 		 */
51 51
 		if ($flag) {
52
-			$query = $this->db_model->select ( "*", "outbound_routes", "", "id", "ASC", $limit, $start );
52
+			$query = $this->db_model->select("*", "outbound_routes", "", "id", "ASC", $limit, $start);
53 53
 		} else {
54
-			$query = $this->db_model->countQuery ( "*", "outbound_routes", "" );
54
+			$query = $this->db_model->countQuery("*", "outbound_routes", "");
55 55
 		}
56 56
 		return $query;
57 57
 	}
58 58
 	function get_termination_rate($flag, $start = 0, $limit = 0, $export = true) {
59
-		$this->db_model->build_search ( 'termination_rates_list_search' );
60
-		$this->db->from ( 'outbound_routes' );
59
+		$this->db_model->build_search('termination_rates_list_search');
60
+		$this->db->from('outbound_routes');
61 61
 		if ($flag) {
62 62
 			if ($export)
63
-				$this->db->limit ( $limit, $start );
64
-			$result = $this->db->get ();
63
+				$this->db->limit($limit, $start);
64
+			$result = $this->db->get();
65 65
 		} else {
66
-			$result = $this->db->count_all_results ();
66
+			$result = $this->db->count_all_results();
67 67
 		}
68 68
 		return $result;
69 69
 	}
70 70
 	function get_origination_rate($flag, $start = 0, $limit = 0, $export = true) {
71
-		$this->db_model->build_search ( 'origination_rate_list_search' );
72
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
73
-			$account_data = $this->session->userdata ( "accountinfo" );
71
+		$this->db_model->build_search('origination_rate_list_search');
72
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
73
+			$account_data = $this->session->userdata("accountinfo");
74 74
 			$reseller = $account_data ['id'];
75
-			$where = array (
75
+			$where = array(
76 76
 					"reseller_id" => $reseller 
77 77
 			);
78 78
 		} else {
79
-			$where = array (
79
+			$where = array(
80 80
 					'reseller_id' => '0' 
81 81
 			);
82 82
 		}
83 83
 		
84
-		$this->db_model->build_search ( 'origination_rate_list_search' );
84
+		$this->db_model->build_search('origination_rate_list_search');
85 85
 		if ($flag) {
86 86
 			if ($export)
87
-				$this->db->limit ( $limit, $start );
88
-			$result = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
87
+				$this->db->limit($limit, $start);
88
+			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
89 89
 		} else {
90
-			$result = $this->db_model->countQuery ( "*", "routes", $where );
90
+			$result = $this->db_model->countQuery("*", "routes", $where);
91 91
 		}
92 92
 		// echo "<pre>";print_r($result->result());exit;
93 93
 		return $result;
94 94
 	}
95 95
 	function get_origination_rate_for_user($flag, $start = 0, $limit = 0, $export = true) {
96
-		$this->db_model->build_search ( 'origination_rate_list_search' );
96
+		$this->db_model->build_search('origination_rate_list_search');
97 97
 		
98
-		$account_data = $this->session->userdata ( "accountinfo" );
98
+		$account_data = $this->session->userdata("accountinfo");
99 99
 		
100
-		$where = array (
100
+		$where = array(
101 101
 				"pricelist_id" => $account_data ["pricelist_id"] 
102 102
 		);
103 103
 		
104
-		$this->db_model->build_search ( 'origination_rate_list_search' );
104
+		$this->db_model->build_search('origination_rate_list_search');
105 105
 		if ($flag) {
106 106
 			if ($export)
107
-				$this->db->limit ( $limit, $start );
108
-			$result = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
107
+				$this->db->limit($limit, $start);
108
+			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
109 109
 		} else {
110
-			$result = $this->db_model->countQuery ( "*", "routes", $where );
110
+			$result = $this->db_model->countQuery("*", "routes", $where);
111 111
 		}
112 112
 		return $result;
113 113
 	}
114 114
 	// ==============================================
115 115
 	function get_origination_rate_list($flag, $start = 0, $limit = 0) {
116
-		$this->db_model->build_search ( 'origination_rate_list_search' );
117
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
118
-			$account_data = $this->session->userdata ( "accountinfo" );
119
-			$where = array (
116
+		$this->db_model->build_search('origination_rate_list_search');
117
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
118
+			$account_data = $this->session->userdata("accountinfo");
119
+			$where = array(
120 120
 					"reseller_id" => $account_data ['id'] 
121 121
 			);
122 122
 		} else {
123
-			$where = array (
123
+			$where = array(
124 124
 					'reseller_id' => '0' 
125 125
 			);
126 126
 		}
@@ -130,158 +130,158 @@  discard block
 block discarded – undo
130 130
 		 * Batch delete
131 131
 		 * ***********
132 132
 		 */
133
-		if ($this->session->userdata ( 'advance_batch_delete' ) == 1) {
133
+		if ($this->session->userdata('advance_batch_delete') == 1) {
134 134
 			//Samir - Added if condition to resolve "Delete Search Record - This option deletes ALL termination rates #264"
135 135
 			if (count($this->db->ar_where) > 0)
136 136
 			{
137
-				$this->db->where ( $where );
138
-				$this->db->delete ( "routes" );				
137
+				$this->db->where($where);
138
+				$this->db->delete("routes");				
139 139
 			}
140
-			$this->session->set_userdata ( 'advance_batch_delete', '0' );	
141
-			$this->session->unset_userdata ( 'advance_batch_delete' );
140
+			$this->session->set_userdata('advance_batch_delete', '0');	
141
+			$this->session->unset_userdata('advance_batch_delete');
142 142
 		}
143
-		$this->db_model->build_search ( 'origination_rate_list_search' );
143
+		$this->db_model->build_search('origination_rate_list_search');
144 144
 		/**
145 145
 		 * ********************
146 146
 		 */
147 147
 		
148 148
 		if ($flag) {
149
-			$query = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
149
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
150 150
 		} else {
151
-			$query = $this->db_model->countQuery ( "*", "routes", $where );
151
+			$query = $this->db_model->countQuery("*", "routes", $where);
152 152
 		}
153 153
 		// echo $this->db->last_query();
154 154
 		return $query;
155 155
 	}
156 156
 	function getunblocked_pattern_list($accountid, $flag, $start = 0, $limit = 0) {
157
-		$this->db_model->build_search ( 'origination_rate_list_search' );
158
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
159
-			$account_data = $this->session->userdata ( "accountinfo" );
157
+		$this->db_model->build_search('origination_rate_list_search');
158
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
159
+			$account_data = $this->session->userdata("accountinfo");
160 160
 			$reseller = $account_data ['id'];
161
-			$where = array (
161
+			$where = array(
162 162
 					"reseller_id" => $reseller,
163 163
 					"status" => "0" 
164 164
 			);
165 165
 		} else {
166
-			$where = array (
166
+			$where = array(
167 167
 					"status" => "0",
168 168
 					'reseller_id' => '0' 
169 169
 			);
170 170
 		}
171
-		$where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "' . $accountid . '"))';
172
-		$this->db->where ( $where1 );
171
+		$where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "'.$accountid.'"))';
172
+		$this->db->where($where1);
173 173
 		if ($flag) {
174
-			$query = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
174
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
175 175
 			// echo "<pre>"; print_r($query); exit;
176 176
 		} else {
177
-			$query = $this->db_model->countQuery ( "*", "routes", $where );
177
+			$query = $this->db_model->countQuery("*", "routes", $where);
178 178
 		}
179 179
 		return $query;
180 180
 	}
181 181
 	function getunblocked_package_pattern($accountid, $flag, $start = 0, $limit = 0) {
182
-		$this->db_model->build_search ( 'origination_rate_list_search' );
183
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
184
-			$account_data = $this->session->userdata ( "accountinfo" );
182
+		$this->db_model->build_search('origination_rate_list_search');
183
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
184
+			$account_data = $this->session->userdata("accountinfo");
185 185
 			$reseller = $account_data ['id'];
186
-			$where = array (
186
+			$where = array(
187 187
 					"reseller_id" => $reseller,
188 188
 					"status" => "0" 
189 189
 			);
190 190
 		} else {
191
-			$where = array (
191
+			$where = array(
192 192
 					"status" => "0",
193 193
 					'reseller_id' => '0' 
194 194
 			);
195 195
 		}
196
-		$where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "' . $accountid . '"))';
197
-		$this->db->where ( $where1 );
196
+		$where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "'.$accountid.'"))';
197
+		$this->db->where($where1);
198 198
 		if ($flag) {
199
-			$query = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
199
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
200 200
 		} else {
201
-			$query = $this->db_model->countQuery ( "*", "routes", $where );
201
+			$query = $this->db_model->countQuery("*", "routes", $where);
202 202
 		}
203 203
 		return $query;
204 204
 	}
205 205
 	function get_origination_rate_list_for_user($flag, $start = 0, $limit = 0) {
206
-		$this->db_model->build_search ( 'user_rates_list_search' );
206
+		$this->db_model->build_search('user_rates_list_search');
207 207
 		
208
-		$account_data = $this->session->userdata ( "accountinfo" );
209
-		$where = array (
208
+		$account_data = $this->session->userdata("accountinfo");
209
+		$where = array(
210 210
 				"pricelist_id" => $account_data ["pricelist_id"],
211 211
 				"status" => '0' 
212 212
 		);
213 213
 		
214
-		$this->db_model->build_search ( 'origination_rate_list_search' );
214
+		$this->db_model->build_search('origination_rate_list_search');
215 215
 		if ($flag) {
216
-			$query = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
216
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
217 217
 		} else {
218
-			$query = $this->db_model->countQuery ( "*", "routes", $where );
218
+			$query = $this->db_model->countQuery("*", "routes", $where);
219 219
 		}
220 220
 		return $query;
221 221
 	}
222 222
 	function add_termination_rate($add_array) {
223
-		unset ( $add_array ["action"] );
224
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
225
-			$account_data = $this->session->userdata ( "accountinfo" );
223
+		unset ($add_array ["action"]);
224
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
225
+			$account_data = $this->session->userdata("accountinfo");
226 226
 			$reseller = $account_data ['id'];
227 227
 			$add_array ['reseller_id'] = $reseller;
228 228
 		}
229
-		$add_array ['pattern'] = "^" . $add_array ['pattern'] . ".*";
229
+		$add_array ['pattern'] = "^".$add_array ['pattern'].".*";
230 230
 		$add_array ['prepend'] = $add_array ['prepend'];
231 231
 		/*
232 232
 		 * ASTPP 3.0
233 233
 		 * add creation date.
234 234
 		 */
235
-		$add_array ['creation_date'] = gmdate ( 'Y-m-d H:i:s' );
235
+		$add_array ['creation_date'] = gmdate('Y-m-d H:i:s');
236 236
 		/**
237 237
 		 * ****************************************************
238 238
 		 */
239
-		$this->insert_if_not_exitst ( $add_array, "outbound_routes" );
239
+		$this->insert_if_not_exitst($add_array, "outbound_routes");
240 240
 		// $this->db->insert("outbound_routes", $add_array);
241 241
 		return true;
242 242
 	}
243 243
 	function edit_termination_rate($data, $id) {
244
-		unset ( $data ["action"] );
244
+		unset ($data ["action"]);
245 245
 		/*
246 246
 		 * ASTPP 3.0
247 247
 		 * Edit time last modified date
248 248
 		 */
249
-		$data ['last_modified_date'] = gmdate ( 'Y-m-d H:i:s' );
249
+		$data ['last_modified_date'] = gmdate('Y-m-d H:i:s');
250 250
 		/**
251 251
 		 * ************************************************
252 252
 		 */
253
-		$data ['pattern'] = "^" . $data ['pattern'] . ".*";
254
-		$this->db->where ( "id", $id );
255
-		$this->db->update ( "outbound_routes", $data );
253
+		$data ['pattern'] = "^".$data ['pattern'].".*";
254
+		$this->db->where("id", $id);
255
+		$this->db->update("outbound_routes", $data);
256 256
 	}
257 257
 	function remove_termination_rate($id) {
258
-		$this->db->where ( "id", $id );
259
-		$this->db->delete ( "outbound_routes" );
258
+		$this->db->where("id", $id);
259
+		$this->db->delete("outbound_routes");
260 260
 		return true;
261 261
 	}
262 262
 	function add_origination_rate($add_array) {
263
-		unset ( $add_array ["action"] );
263
+		unset ($add_array ["action"]);
264 264
 		/*
265 265
 		 * ASTPP 3.0
266 266
 		 * ADD time put creation date in routes table
267 267
 		 */
268
-		$add_array ['creation_date'] = gmdate ( 'Y-m-d H:i:s' );
268
+		$add_array ['creation_date'] = gmdate('Y-m-d H:i:s');
269 269
 		/**
270 270
 		 * *******************************************
271 271
 		 */
272
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
273
-			$account_data = $this->session->userdata ( "accountinfo" );
272
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
273
+			$account_data = $this->session->userdata("accountinfo");
274 274
 			$reseller = $account_data ['id'];
275 275
 			$add_array ['reseller_id'] = $reseller;
276 276
 		}
277
-		$add_array ['pattern'] = "^" . $add_array ['pattern'] . ".*";
277
+		$add_array ['pattern'] = "^".$add_array ['pattern'].".*";
278 278
 		/**
279 279
 		 * ***********
280 280
 		 * ASTPP 3.0
281 281
 		 * Rate insert
282 282
 		 * ************
283 283
 		 */
284
-		$this->insert_if_not_exitst ( $add_array, "routes" );
284
+		$this->insert_if_not_exitst($add_array, "routes");
285 285
 		// $this->db->insert("routes", $add_array);
286 286
 		/**
287 287
 		 * ****************************
@@ -289,28 +289,28 @@  discard block
 block discarded – undo
289 289
 		return true;
290 290
 	}
291 291
 	function edit_origination_rate($data, $id) {
292
-		unset ( $data ["action"] );
292
+		unset ($data ["action"]);
293 293
 		/*
294 294
 		 * ASTPP 3.0
295 295
 		 * Edit tile last modified date update
296 296
 		 */
297
-		$data ['last_modified_date'] = gmdate ( 'Y-m-d H:i:s' );
297
+		$data ['last_modified_date'] = gmdate('Y-m-d H:i:s');
298 298
 		/**
299 299
 		 * *****************************************************
300 300
 		 */
301
-		$data ['pattern'] = "^" . $data ['pattern'] . ".*";
302
-		$this->db->where ( "id", $id );
303
-		$this->db->update ( "routes", $data );
301
+		$data ['pattern'] = "^".$data ['pattern'].".*";
302
+		$this->db->where("id", $id);
303
+		$this->db->update("routes", $data);
304 304
 	}
305 305
 	function remove_origination_rate($id) {
306
-		$this->db->where ( "id", $id );
307
-		$this->db->delete ( "routes" );
306
+		$this->db->where("id", $id);
307
+		$this->db->delete("routes");
308 308
 		return true;
309 309
 	}
310 310
 	function get_trunk_name($field_value) {
311
-		$this->db->where ( "name", $field_value );
312
-		$query = $this->db->get ( 'trunks' );
313
-		$data = $query->result ();
311
+		$this->db->where("name", $field_value);
312
+		$query = $this->db->get('trunks');
313
+		$data = $query->result();
314 314
 		if ($query->num_rows > 0) {
315 315
 			return $data [0]->id;
316 316
 		} else {
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 		}
319 319
 	}
320 320
 	function bulk_insert_termination_rate($field_values, $count) {
321
-		$keys = array_keys ( $field_values );
322
-		$arr_key = array_keys ( $field_values [$keys [0]] );
321
+		$keys = array_keys($field_values);
322
+		$arr_key = array_keys($field_values [$keys [0]]);
323 323
 		$str = null;
324 324
 		$i = 0;
325 325
 		$update_fields [] = "comment=VALUES(comment),
@@ -333,28 +333,28 @@  discard block
 block discarded – undo
333 333
 		prepend=VALUES(prepend),
334 334
 		last_modified_date=VALUES(last_modified_date),
335 335
 		status=VALUES(status)";
336
-		$insert_string = "INSERT INTO outbound_routes (" . implode ( ', ', $arr_key ) . ") VALUES ";
337
-		$update_string = " ON DUPLICATE KEY UPDATE " . implode ( ', ', $update_fields );
336
+		$insert_string = "INSERT INTO outbound_routes (".implode(', ', $arr_key).") VALUES ";
337
+		$update_string = " ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields);
338 338
 		$k = 0;
339
-		$j = ceil ( $count / 500 );
339
+		$j = ceil($count / 500);
340 340
 		$current_value = 0;
341
-		for($i = 0; $i < $j; $i ++) {
341
+		for ($i = 0; $i < $j; $i++) {
342 342
 			$str = null;
343
-			for($k = 0; $k <= 500; $k ++) {
343
+			for ($k = 0; $k <= 500; $k++) {
344 344
 				$current_value = ($i * 500) + $k;
345
-				if (isset ( $field_values [$current_value] )) {
346
-					$str .= "('" . implode ( "','", $field_values [$current_value] ) . "'),";
345
+				if (isset ($field_values [$current_value])) {
346
+					$str .= "('".implode("','", $field_values [$current_value])."'),";
347 347
 				}
348 348
 			}
349
-			$str = rtrim ( $str, "," );
350
-			$this->db->query ( $insert_string . $str . $update_string, false );
349
+			$str = rtrim($str, ",");
350
+			$this->db->query($insert_string.$str.$update_string, false);
351 351
 		}
352 352
 		return true;
353 353
 	}
354 354
 	function bulk_insert_origination_rate($field_values, $count) {
355
-		$temp_arr = array ();
356
-		$keys = array_keys ( $field_values );
357
-		$arr_key = array_keys ( $field_values [$keys [0]] );
355
+		$temp_arr = array();
356
+		$keys = array_keys($field_values);
357
+		$arr_key = array_keys($field_values [$keys [0]]);
358 358
 		$str = null;
359 359
 		$i = 0;
360 360
 		$update_fields [] = "comment=VALUES(comment),
@@ -365,60 +365,60 @@  discard block
 block discarded – undo
365 365
 		inc=VALUES(inc),
366 366
 		last_modified_date=VALUES(last_modified_date),
367 367
 		status=VALUES(status)";
368
-		$insert_string = "INSERT INTO routes (" . implode ( ', ', $arr_key ) . ") VALUES ";
369
-		$update_string = " ON DUPLICATE KEY UPDATE " . implode ( ', ', $update_fields );
368
+		$insert_string = "INSERT INTO routes (".implode(', ', $arr_key).") VALUES ";
369
+		$update_string = " ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields);
370 370
 		$k = 0;
371
-		$j = ceil ( $count / 500 );
371
+		$j = ceil($count / 500);
372 372
 		$current_value = 0;
373
-		for($i = 0; $i < $j; $i ++) {
373
+		for ($i = 0; $i < $j; $i++) {
374 374
 			$str = null;
375
-			for($k = 0; $k <= 500; $k ++) {
375
+			for ($k = 0; $k <= 500; $k++) {
376 376
 				$current_value = ($i * 500) + $k;
377
-				if (isset ( $field_values [$current_value] )) {
378
-					$str .= "('" . implode ( "','", $field_values [$current_value] ) . "'),";
377
+				if (isset ($field_values [$current_value])) {
378
+					$str .= "('".implode("','", $field_values [$current_value])."'),";
379 379
 				}
380 380
 			}
381
-			$str = rtrim ( $str, "," );
382
-			$this->db->query ( $insert_string . $str . $update_string, false );
381
+			$str = rtrim($str, ",");
382
+			$this->db->query($insert_string.$str.$update_string, false);
383 383
 		}
384 384
 		return true;
385 385
 	}
386 386
 	function termination_rate_batch_update($update_array) {
387
-		$this->db_model->build_search ( 'termination_rates_list_search' );
388
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
389
-			$account_data = $this->session->userdata ( "accountinfo" );
390
-			$this->db->where ( "reseller_id", $account_data ['id'] );
387
+		$this->db_model->build_search('termination_rates_list_search');
388
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
389
+			$account_data = $this->session->userdata("accountinfo");
390
+			$this->db->where("reseller_id", $account_data ['id']);
391 391
 		}
392 392
 		
393
-		$updateflg = $this->db_model->build_batch_update_array ( $update_array );
393
+		$updateflg = $this->db_model->build_batch_update_array($update_array);
394 394
 		if ($updateflg)
395
-			return $this->db->update ( "outbound_routes" );
395
+			return $this->db->update("outbound_routes");
396 396
 		else
397 397
 			return false;
398 398
 	}
399 399
 	function origination_rate_batch_update($update_array) {
400
-		$this->db_model->build_search ( 'origination_rate_list_search' );
401
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
402
-			$account_data = $this->session->userdata ( "accountinfo" );
403
-			$this->db->where ( "reseller_id", $account_data ['id'] );
400
+		$this->db_model->build_search('origination_rate_list_search');
401
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
402
+			$account_data = $this->session->userdata("accountinfo");
403
+			$this->db->where("reseller_id", $account_data ['id']);
404 404
 		}
405
-		$updateflg = $this->db_model->build_batch_update_array ( $update_array );
405
+		$updateflg = $this->db_model->build_batch_update_array($update_array);
406 406
 		if ($updateflg)
407
-			return $this->db->update ( "routes" );
407
+			return $this->db->update("routes");
408 408
 		else
409 409
 			return false;
410 410
 	}
411 411
 	function getreseller_rates_list($flag, $start = 0, $limit = 0, $export = false) {
412
-		$this->db_model->build_search ( 'resellerrates_list_search' );
413
-		$account_data = $this->session->userdata ( "accountinfo" );
414
-		$where = array (
412
+		$this->db_model->build_search('resellerrates_list_search');
413
+		$account_data = $this->session->userdata("accountinfo");
414
+		$where = array(
415 415
 				"status" => "0",
416 416
 				"pricelist_id" => $account_data ["pricelist_id"] 
417 417
 		);
418 418
 		if ($flag) {
419
-			$query = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
419
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
420 420
 		} else {
421
-			$query = $this->db_model->countQuery ( "*", "routes", $where );
421
+			$query = $this->db_model->countQuery("*", "routes", $where);
422 422
 		}
423 423
 		return $query;
424 424
 	}
@@ -437,17 +437,17 @@  discard block
 block discarded – undo
437 437
 		$insert_key = "";
438 438
 		$insert_value = "";
439 439
 		$update_str = "";
440
-		foreach ( $add_array as $key => $value ) {
440
+		foreach ($add_array as $key => $value) {
441 441
 			if ($key != 'id') {
442
-				$insert_key .= $key . ",";
443
-				$insert_value .= "'" . mysql_real_escape_string ( $value ) . "',";
444
-				$update_str .= $key . " = '" . mysql_real_escape_string ( $value ) . "',";
442
+				$insert_key .= $key.",";
443
+				$insert_value .= "'".mysql_real_escape_string($value)."',";
444
+				$update_str .= $key." = '".mysql_real_escape_string($value)."',";
445 445
 			}
446 446
 		}
447
-		$insert_key = rtrim ( $insert_key, "," );
448
-		$insert_value = rtrim ( $insert_value, "," );
449
-		$update_str = rtrim ( $update_str, "," );
450
-		$insert_str .= $insert_key . ") values" . "(" . $insert_value . ")  ON DUPLICATE KEY UPDATE $update_str";
451
-		$this->db->query ( $insert_str );
447
+		$insert_key = rtrim($insert_key, ",");
448
+		$insert_value = rtrim($insert_value, ",");
449
+		$update_str = rtrim($update_str, ",");
450
+		$insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
451
+		$this->db->query($insert_str);
452 452
 	}
453 453
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/controllers/rates.php 1 patch
Spacing   +681 added lines, -681 removed lines patch added patch discarded remove patch
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class Rates extends MX_Controller {
24 24
 	function Rates() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 		
27
-		$this->load->helper ( 'template_inheritance' );
27
+		$this->load->helper('template_inheritance');
28 28
 		
29
-		$this->load->library ( 'session' );
30
-		$this->load->library ( 'rates_form' );
31
-		$this->load->library ( 'astpp/form' );
32
-		$this->load->model ( 'rates_model' );
33
-		$this->load->library ( 'csvreader' );
34
-		ini_set ( "memory_limit", "2048M" );
35
-		ini_set ( "max_execution_time", "259200" );
36
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
37
-			redirect ( base_url () . '/astpp/login' );
29
+		$this->load->library('session');
30
+		$this->load->library('rates_form');
31
+		$this->load->library('astpp/form');
32
+		$this->load->model('rates_model');
33
+		$this->load->library('csvreader');
34
+		ini_set("memory_limit", "2048M");
35
+		ini_set("max_execution_time", "259200");
36
+		if ($this->session->userdata('user_login') == FALSE)
37
+			redirect(base_url().'/astpp/login');
38 38
 	}
39 39
 	function termination_rates_list() {
40
-		$data ['username'] = $this->session->userdata ( 'user_name' );
41
-		$data ['page_title'] = gettext ( 'Termination Rates' );
40
+		$data ['username'] = $this->session->userdata('user_name');
41
+		$data ['page_title'] = gettext('Termination Rates');
42 42
 		$data ['search_flag'] = true;
43 43
 		$data ['batch_update_flag'] = true;
44 44
 		/**
@@ -51,68 +51,68 @@  discard block
 block discarded – undo
51 51
 		/**
52 52
 		 * ************
53 53
 		 */
54
-		$this->session->set_userdata ( 'advance_search', 0 );
55
-		$data ['grid_fields'] = $this->rates_form->build_termination_rate_for_admin ();
56
-		$data ["grid_buttons"] = $this->rates_form->build_grid_buttons ();
57
-		$data ['form_search'] = $this->form->build_serach_form ( $this->rates_form->get_termination_rate_search_form () );
58
-		$data ['form_batch_update'] = $this->form->build_batchupdate_form ( $this->rates_form->termination_rate_batch_update_form () );
59
-		$this->load->view ( 'view_termination_rates_list', $data );
54
+		$this->session->set_userdata('advance_search', 0);
55
+		$data ['grid_fields'] = $this->rates_form->build_termination_rate_for_admin();
56
+		$data ["grid_buttons"] = $this->rates_form->build_grid_buttons();
57
+		$data ['form_search'] = $this->form->build_serach_form($this->rates_form->get_termination_rate_search_form());
58
+		$data ['form_batch_update'] = $this->form->build_batchupdate_form($this->rates_form->termination_rate_batch_update_form());
59
+		$this->load->view('view_termination_rates_list', $data);
60 60
 	}
61 61
 	/**
62 62
 	 * -------Here we write code for controller accounts functions account_list------
63 63
 	 * Listing of Accounts table data through php function json_encode
64 64
 	 */
65 65
 	function termination_rates_list_json() {
66
-		$json_data = array ();
67
-		$count_all = $this->rates_model->get_termination_rates_list ( false );
68
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
66
+		$json_data = array();
67
+		$count_all = $this->rates_model->get_termination_rates_list(false);
68
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
69 69
 		$json_data = $paging_data ["json_paging"];
70 70
 		
71
-		$query = $this->rates_model->get_termination_rates_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
72
-		$grid_fields = json_decode ( $this->rates_form->build_termination_rate_for_admin () );
73
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
71
+		$query = $this->rates_model->get_termination_rates_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
72
+		$grid_fields = json_decode($this->rates_form->build_termination_rate_for_admin());
73
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
74 74
 		
75
-		echo json_encode ( $json_data );
75
+		echo json_encode($json_data);
76 76
 	}
77 77
 	function termination_rates_list_delete($flag = '') {
78
-		$json_data = array ();
79
-		$this->session->set_userdata ( 'advance_batch_data_delete', 1 );
80
-		$count_all = $this->rates_model->get_termination_rates_list ( false );
78
+		$json_data = array();
79
+		$this->session->set_userdata('advance_batch_data_delete', 1);
80
+		$count_all = $this->rates_model->get_termination_rates_list(false);
81 81
 		echo $count_all;
82 82
 	}
83 83
 	/**
84 84
 	 * *************
85 85
 	 */
86 86
 	function termination_rate_import() {
87
-		$data ['page_title'] = gettext ( 'Import Termination Rates' );
88
-		$this->session->set_userdata ( 'import_termination_rate_csv', "" );
89
-		$this->session->set_userdata ( 'import_termination_rate_csv_error', "" );
90
-		$this->load->view ( 'view_import_termination_rate', $data );
87
+		$data ['page_title'] = gettext('Import Termination Rates');
88
+		$this->session->set_userdata('import_termination_rate_csv', "");
89
+		$this->session->set_userdata('import_termination_rate_csv_error', "");
90
+		$this->load->view('view_import_termination_rate', $data);
91 91
 	}
92 92
 	function termination_rate_preview_file() {
93 93
 		$invalid_flag = false;
94
-		$check_header = $this->input->post ( 'check_header', true );
95
-		$data ['page_title'] = gettext ( 'Import Termination Rates' );
96
-		$new_final_arr_key = $this->config->item ( 'Termination-rates-field' );
97
-		if (empty ( $_FILES ) || ! isset ( $_FILES )) {
98
-			redirect ( base_url () . "rates/termination_rates_list/" );
94
+		$check_header = $this->input->post('check_header', true);
95
+		$data ['page_title'] = gettext('Import Termination Rates');
96
+		$new_final_arr_key = $this->config->item('Termination-rates-field');
97
+		if (empty ($_FILES) || ! isset ($_FILES)) {
98
+			redirect(base_url()."rates/termination_rates_list/");
99 99
 		}
100
-		if (isset ( $_FILES ['termination_rate_import'] ['name'] ) && $_FILES ['termination_rate_import'] ['name'] != "" && isset ( $_POST ['trunk_id'] ) && $_POST ['trunk_id'] != '') {
101
-			list ( $txt, $ext ) = explode ( ".", $_FILES ['termination_rate_import'] ['name'] );
100
+		if (isset ($_FILES ['termination_rate_import'] ['name']) && $_FILES ['termination_rate_import'] ['name'] != "" && isset ($_POST ['trunk_id']) && $_POST ['trunk_id'] != '') {
101
+			list ($txt, $ext) = explode(".", $_FILES ['termination_rate_import'] ['name']);
102 102
 			if ($ext == "csv" && $_FILES ['termination_rate_import'] ['size'] > 0) {
103 103
 				$error = $_FILES ['termination_rate_import'] ['error'];
104 104
 				if ($error == 0) {
105 105
 					$uploadedFile = $_FILES ["termination_rate_import"] ["tmp_name"];
106
-					$csv_data = $this->csvreader->parse_file ( $uploadedFile, $new_final_arr_key, $check_header );
107
-					if (! empty ( $csv_data )) {
108
-						$full_path = $this->config->item ( 'rates-file-path' );
109
-						$actual_file_name = "ASTPP-TERMINATION-RATES-" . date ( "Y-m-d H:i:s" ) . "." . $ext;
110
-						if (move_uploaded_file ( $uploadedFile, $full_path . $actual_file_name )) {
106
+					$csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
107
+					if ( ! empty ($csv_data)) {
108
+						$full_path = $this->config->item('rates-file-path');
109
+						$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s").".".$ext;
110
+						if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
111 111
 							$data ['csv_tmp_data'] = $csv_data;
112 112
 							$data ['trunkid'] = $_POST ['trunk_id'];
113 113
 							$data ['check_header'] = $check_header;
114
-							$data ['page_title'] = gettext ( 'Termination Rates Preview' );
115
-							$this->session->set_userdata ( 'import_termination_rate_csv', $actual_file_name );
114
+							$data ['page_title'] = gettext('Termination Rates Preview');
115
+							$this->session->set_userdata('import_termination_rate_csv', $actual_file_name);
116 116
 						} else {
117 117
 							$data ['error'] = "File Uploading Fail Please Try Again";
118 118
 						}
@@ -128,134 +128,134 @@  discard block
 block discarded – undo
128 128
 		}
129 129
 		if ($invalid_flag) {
130 130
 			$str = '';
131
-			if (! isset ( $_POST ['trunk_id'] ) || empty ( $_POST ['trunk_id'] )) {
131
+			if ( ! isset ($_POST ['trunk_id']) || empty ($_POST ['trunk_id'])) {
132 132
 				$str .= '<br/>Please Create Trunk.';
133 133
 			}
134
-			if (empty ( $_FILES ['termination_rate_import'] ['name'] )) {
134
+			if (empty ($_FILES ['termination_rate_import'] ['name'])) {
135 135
 				$str .= '<br/>Please Select  File.';
136 136
 			}
137 137
 			$data ['error'] = $str;
138 138
 		}
139
-		$this->load->view ( 'view_import_termination_rate', $data );
139
+		$this->load->view('view_import_termination_rate', $data);
140 140
 	}
141 141
 	function termination_rate_rates_import($trunkID, $check_header = false) {
142
-		$new_final_arr = array ();
143
-		$invalid_array = array ();
142
+		$new_final_arr = array();
143
+		$invalid_array = array();
144 144
 		$row_count = 0;
145
-		$new_final_arr_key = $this->config->item ( 'Termination-rates-field' );
146
-		$screen_path = $this->config->item ( 'screen_path' );
147
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
148
-			$account_data = $this->session->userdata ( "accountinfo" );
145
+		$new_final_arr_key = $this->config->item('Termination-rates-field');
146
+		$screen_path = $this->config->item('screen_path');
147
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
148
+			$account_data = $this->session->userdata("accountinfo");
149 149
 		}
150
-		$full_path = $this->config->item ( 'rates-file-path' );
151
-		$terminationrate_file_name = $this->session->userdata ( 'import_termination_rate_csv' );
152
-		$csv_tmp_data = $this->csvreader->parse_file ( $full_path . $terminationrate_file_name, $new_final_arr_key, $check_header );
150
+		$full_path = $this->config->item('rates-file-path');
151
+		$terminationrate_file_name = $this->session->userdata('import_termination_rate_csv');
152
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header);
153 153
 		$i = 0;
154
-		foreach ( $csv_tmp_data as $key => $csv_data ) {
155
-			if (isset ( $csv_data ['pattern'] ) && $csv_data ['pattern'] != '' && $i != 0) {
154
+		foreach ($csv_tmp_data as $key => $csv_data) {
155
+			if (isset ($csv_data ['pattern']) && $csv_data ['pattern'] != '' && $i != 0) {
156 156
 				$str = null;
157
-				$csv_data ['prepend'] = isset ( $csv_data ['prepend'] ) ? $csv_data ['prepend'] : '';
158
-				$csv_data ['comment'] = isset ( $csv_data ['comment'] ) ? $csv_data ['comment'] : '';
159
-				$csv_data ['connectcost'] = isset ( $csv_data ['connectcost'] ) ? $this->common_model->add_calculate_currency ( $csv_data ['connectcost'], '', '', false, false ) : 0;
160
-				$csv_data ['includedseconds'] = isset ( $csv_data ['includedseconds'] ) ? $csv_data ['includedseconds'] : 0;
161
-				$csv_data ['cost'] = ! empty ( $csv_data ['cost'] ) && is_numeric ( $csv_data ['cost'] ) ? $this->common_model->add_calculate_currency ( $csv_data ['cost'], '', '', false, false ) : 0;
162
-				$csv_data ['inc'] = isset ( $csv_data ['inc'] ) ? $csv_data ['inc'] : 0;
163
-				$csv_data ['precedence'] = isset ( $csv_data ['precedence'] ) ? $csv_data ['precedence'] : '';
164
-				$csv_data ['strip'] = isset ( $csv_data ['strip'] ) ? $csv_data ['strip'] : '';
165
-				$str = $this->data_validate ( $csv_data );
157
+				$csv_data ['prepend'] = isset ($csv_data ['prepend']) ? $csv_data ['prepend'] : '';
158
+				$csv_data ['comment'] = isset ($csv_data ['comment']) ? $csv_data ['comment'] : '';
159
+				$csv_data ['connectcost'] = isset ($csv_data ['connectcost']) ? $this->common_model->add_calculate_currency($csv_data ['connectcost'], '', '', false, false) : 0;
160
+				$csv_data ['includedseconds'] = isset ($csv_data ['includedseconds']) ? $csv_data ['includedseconds'] : 0;
161
+				$csv_data ['cost'] = ! empty ($csv_data ['cost']) && is_numeric($csv_data ['cost']) ? $this->common_model->add_calculate_currency($csv_data ['cost'], '', '', false, false) : 0;
162
+				$csv_data ['inc'] = isset ($csv_data ['inc']) ? $csv_data ['inc'] : 0;
163
+				$csv_data ['precedence'] = isset ($csv_data ['precedence']) ? $csv_data ['precedence'] : '';
164
+				$csv_data ['strip'] = isset ($csv_data ['strip']) ? $csv_data ['strip'] : '';
165
+				$str = $this->data_validate($csv_data);
166 166
 				if ($str != "") {
167 167
 					$invalid_array [$i] = $csv_data;
168 168
 					$invalid_array [$i] ['error'] = $str;
169 169
 				} else {
170 170
 					$csv_data ['trunk_id'] = $trunkID;
171
-					$csv_data ['pattern'] = "^" . $csv_data ['pattern'] . ".*";
172
-					$csv_data ['creation_date'] = gmdate ( "Y-m-d H:i:s" );
173
-					$csv_data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" );
171
+					$csv_data ['pattern'] = "^".$csv_data ['pattern'].".*";
172
+					$csv_data ['creation_date'] = gmdate("Y-m-d H:i:s");
173
+					$csv_data ['last_modified_date'] = gmdate("Y-m-d H:i:s");
174 174
 					$new_final_arr [$i] = $csv_data;
175
-					$row_count ++;
175
+					$row_count++;
176 176
 				}
177 177
 			}
178
-			$i ++;
178
+			$i++;
179 179
 		}
180
-		if (! empty ( $new_final_arr )) {
181
-			$this->rates_model->bulk_insert_termination_rate ( $new_final_arr, $row_count );
180
+		if ( ! empty ($new_final_arr)) {
181
+			$this->rates_model->bulk_insert_termination_rate($new_final_arr, $row_count);
182 182
 		}
183
-		unlink ( $full_path . $terminationrate_file_name );
184
-		$count = count ( $invalid_array );
183
+		unlink($full_path.$terminationrate_file_name);
184
+		$count = count($invalid_array);
185 185
 		if ($count > 0) {
186 186
 			$session_id = "-1";
187
-			$fp = fopen ( $full_path . $session_id . '.csv', 'w' );
188
-			foreach ( $new_final_arr_key as $key => $value ) {
189
-				$custom_array [0] [$key] = ucfirst ( $key );
187
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
188
+			foreach ($new_final_arr_key as $key => $value) {
189
+				$custom_array [0] [$key] = ucfirst($key);
190 190
 			}
191 191
 			$custom_array [0] ['error'] = "Error";
192
-			$invalid_array = array_merge ( $custom_array, $invalid_array );
193
-			foreach ( $invalid_array as $err_data ) {
194
-				fputcsv ( $fp, $err_data );
192
+			$invalid_array = array_merge($custom_array, $invalid_array);
193
+			foreach ($invalid_array as $err_data) {
194
+				fputcsv($fp, $err_data);
195 195
 			}
196
-			fclose ( $fp );
197
-			$this->session->set_userdata ( 'import_termination_rate_csv_error', $session_id . ".csv" );
196
+			fclose($fp);
197
+			$this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv");
198 198
 			$data ["error"] = $invalid_array;
199 199
 			$data ['trunkid'] = $trunkID;
200
-			$data ['impoted_count'] = count ( $new_final_arr );
201
-			$data ['failure_count'] = count ( $invalid_array ) - 1;
202
-			$data ['page_title'] = gettext ( 'Termination Rates Import Error' );
203
-			$this->load->view ( 'view_import_error', $data );
200
+			$data ['impoted_count'] = count($new_final_arr);
201
+			$data ['failure_count'] = count($invalid_array) - 1;
202
+			$data ['page_title'] = gettext('Termination Rates Import Error');
203
+			$this->load->view('view_import_error', $data);
204 204
 		} else {
205
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Total ' . count ( $new_final_arr ) . ' Termination rates imported successfully!' );
206
-			redirect ( base_url () . "rates/termination_rates_list/" );
205
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
206
+			redirect(base_url()."rates/termination_rates_list/");
207 207
 		}
208 208
 	}
209 209
 	function termination_rate_error_download() {
210
-		$this->load->helper ( 'download' );
211
-		$error_data = $this->session->userdata ( 'import_termination_rate_csv_error' );
212
-		$full_path = $this->config->item ( 'rates-file-path' );
213
-		$data = file_get_contents ( $full_path . $error_data );
214
-		force_download ( "Termination_rate_error.csv", $data );
210
+		$this->load->helper('download');
211
+		$error_data = $this->session->userdata('import_termination_rate_csv_error');
212
+		$full_path = $this->config->item('rates-file-path');
213
+		$data = file_get_contents($full_path.$error_data);
214
+		force_download("Termination_rate_error.csv", $data);
215 215
 	}
216 216
 	function origination_rate_import() {
217
-		$data ['page_title'] = gettext ( 'Import Origination Rates' );
218
-		$this->session->set_userdata ( 'import_origination_rate_csv', "" );
219
-		$error_data = $this->session->userdata ( 'import_origination_rate_csv_error' );
220
-		$full_path = $this->config->item ( 'rates-file-path' );
221
-		if (file_exists ( $full_path . $error_data ) && $error_data != "") {
222
-			unlink ( $full_path . $error_data );
223
-			$this->session->set_userdata ( 'import_origination_rate_csv_error', "" );
217
+		$data ['page_title'] = gettext('Import Origination Rates');
218
+		$this->session->set_userdata('import_origination_rate_csv', "");
219
+		$error_data = $this->session->userdata('import_origination_rate_csv_error');
220
+		$full_path = $this->config->item('rates-file-path');
221
+		if (file_exists($full_path.$error_data) && $error_data != "") {
222
+			unlink($full_path.$error_data);
223
+			$this->session->set_userdata('import_origination_rate_csv_error', "");
224 224
 		}
225
-		$this->load->view ( 'view_import_origination_rate', $data );
225
+		$this->load->view('view_import_origination_rate', $data);
226 226
 	}
227 227
 	function origination_rate_preview_file() {
228 228
 		$invalid_flag = false;
229
-		$data = array ();
230
-		$data ['page_title'] = gettext ( 'Import Origination Rates' );
231
-		$check_header = $this->input->post ( 'check_header', true );
232
-		if (empty ( $_FILES ) || ! isset ( $_FILES )) {
233
-			redirect ( base_url () . "rates/origination_rate_list/" );
229
+		$data = array();
230
+		$data ['page_title'] = gettext('Import Origination Rates');
231
+		$check_header = $this->input->post('check_header', true);
232
+		if (empty ($_FILES) || ! isset ($_FILES)) {
233
+			redirect(base_url()."rates/origination_rate_list/");
234 234
 		}
235
-		$get_extension = strpos ( $_FILES ['origination_rate_import'] ['name'], '.' );
236
-		$new_final_arr_key = $this->config->item ( 'Origination-rates-field' );
237
-		if (! $get_extension) {
235
+		$get_extension = strpos($_FILES ['origination_rate_import'] ['name'], '.');
236
+		$new_final_arr_key = $this->config->item('Origination-rates-field');
237
+		if ( ! $get_extension) {
238 238
 			$data ['error'] = "Please Upload File Atleast";
239 239
 		}
240
-		if (isset ( $_FILES ['origination_rate_import'] ['name'] ) && $_FILES ['origination_rate_import'] ['name'] != "" && isset ( $_POST ['pricelist_id'] ) && $_POST ['pricelist_id'] != '') {
241
-			list ( $txt, $ext ) = explode ( ".", $_FILES ['origination_rate_import'] ['name'] );
240
+		if (isset ($_FILES ['origination_rate_import'] ['name']) && $_FILES ['origination_rate_import'] ['name'] != "" && isset ($_POST ['pricelist_id']) && $_POST ['pricelist_id'] != '') {
241
+			list ($txt, $ext) = explode(".", $_FILES ['origination_rate_import'] ['name']);
242 242
 			
243 243
 			if ($ext == "csv" && $_FILES ['origination_rate_import'] ['size'] > 0) {
244 244
 				$error = $_FILES ['origination_rate_import'] ['error'];
245 245
 				if ($error == 0) {
246 246
 					$uploadedFile = $_FILES ["origination_rate_import"] ["tmp_name"];
247
-					$csv_data = $this->csvreader->parse_file ( $uploadedFile, $new_final_arr_key, $check_header );
248
-					if (! empty ( $csv_data )) {
249
-						$full_path = $this->config->item ( 'rates-file-path' );
250
-						$actual_file_name = "ASTPP-ORIGIN-RATES-" . date ( "Y-m-d H:i:s" ) . "." . $ext;
251
-						if (move_uploaded_file ( $uploadedFile, $full_path . $actual_file_name )) {
247
+					$csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
248
+					if ( ! empty ($csv_data)) {
249
+						$full_path = $this->config->item('rates-file-path');
250
+						$actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s").".".$ext;
251
+						if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
252 252
 							$flag = false;
253
-							$data ['trunkid'] = isset ( $_POST ['trunk_id'] ) && $_POST ['trunk_id'] > 0 ? $_POST ['trunk_id'] : 0;
253
+							$data ['trunkid'] = isset ($_POST ['trunk_id']) && $_POST ['trunk_id'] > 0 ? $_POST ['trunk_id'] : 0;
254 254
 							$data ['csv_tmp_data'] = $csv_data;
255 255
 							$data ['pricelistid'] = $_POST ['pricelist_id'];
256
-							$data ['page_title'] = gettext ( "Origination Rates Preview" );
256
+							$data ['page_title'] = gettext("Origination Rates Preview");
257 257
 							$data ['check_header'] = $check_header;
258
-							$this->session->set_userdata ( 'import_origination_rate_csv', $actual_file_name );
258
+							$this->session->set_userdata('import_origination_rate_csv', $actual_file_name);
259 259
 						} else {
260 260
 							$data ['error'] = "File Uploading Fail Please Try Again";
261 261
 						}
@@ -271,86 +271,86 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 		if ($invalid_flag) {
273 273
 			$str = '';
274
-			if (! isset ( $_POST ['pricelist_id'] ) || empty ( $_POST ['pricelist_id'] )) {
274
+			if ( ! isset ($_POST ['pricelist_id']) || empty ($_POST ['pricelist_id'])) {
275 275
 				$str .= '<br/>Please Create Rate Group.';
276 276
 			}
277
-			if (empty ( $_FILES ['origination_rate_import'] ['name'] )) {
277
+			if (empty ($_FILES ['origination_rate_import'] ['name'])) {
278 278
 				$str .= '<br/>Please Select File.';
279 279
 			}
280 280
 			$data ['error'] = $str;
281 281
 		}
282
-		$this->load->view ( 'view_import_origination_rate', $data );
282
+		$this->load->view('view_import_origination_rate', $data);
283 283
 	}
284 284
 	function origination_rate_import_file($pricelistID, $trunkid, $check_header = false) {
285
-		$new_final_arr = array ();
286
-		$invalid_array = array ();
287
-		$new_final_arr_key = $this->config->item ( 'Origination-rates-field' );
288
-		$screen_path = $this->config->item ( 'screen_path' );
285
+		$new_final_arr = array();
286
+		$invalid_array = array();
287
+		$new_final_arr_key = $this->config->item('Origination-rates-field');
288
+		$screen_path = $this->config->item('screen_path');
289 289
 		$reseller_id = 0;
290
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
290
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
291 291
 			$reseller_id = $this->session->userdata ["accountinfo"] ['id'];
292 292
 		}
293 293
 		
294
-		$full_path = $this->config->item ( 'rates-file-path' );
295
-		$originationrate_file_name = $this->session->userdata ( 'import_origination_rate_csv' );
296
-		$csv_tmp_data = $this->csvreader->parse_file ( $full_path . $originationrate_file_name, $new_final_arr_key, $check_header );
294
+		$full_path = $this->config->item('rates-file-path');
295
+		$originationrate_file_name = $this->session->userdata('import_origination_rate_csv');
296
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name, $new_final_arr_key, $check_header);
297 297
 		// echo "<pre>";print_r($csv_tmp_data);exit;
298 298
 		$i = 0;
299 299
 		$row_count = 0;
300
-		foreach ( $csv_tmp_data as $key => $csv_data ) {
301
-			if (isset ( $csv_data ['pattern'] ) && $csv_data ['pattern'] != '' && $i != 0) {
300
+		foreach ($csv_tmp_data as $key => $csv_data) {
301
+			if (isset ($csv_data ['pattern']) && $csv_data ['pattern'] != '' && $i != 0) {
302 302
 				$str = null;
303
-				$csv_data ['comment'] = isset ( $csv_data ['comment'] ) ? $csv_data ['comment'] : '';
304
-				$csv_data ['connectcost'] = isset ( $csv_data ['connectcost'] ) ? $this->common_model->add_calculate_currency ( $csv_data ['connectcost'], '', '', false, false ) : 0;
305
-				$csv_data ['includedseconds'] = isset ( $csv_data ['includedseconds'] ) ? $csv_data ['includedseconds'] : 0;
306
-				$csv_data ['cost'] = ! empty ( $csv_data ['cost'] ) && is_numeric ( $csv_data ['cost'] ) ? $this->common_model->add_calculate_currency ( $csv_data ['cost'], '', '', false, false ) : 0;
307
-				$csv_data ['inc'] = isset ( $csv_data ['inc'] ) ? $csv_data ['inc'] : 0;
308
-				$csv_data ['precedence'] = isset ( $csv_data ['precedence'] ) ? $csv_data ['precedence'] : '';
309
-				$csv_data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" );
310
-				$str = $this->data_validate ( $csv_data );
303
+				$csv_data ['comment'] = isset ($csv_data ['comment']) ? $csv_data ['comment'] : '';
304
+				$csv_data ['connectcost'] = isset ($csv_data ['connectcost']) ? $this->common_model->add_calculate_currency($csv_data ['connectcost'], '', '', false, false) : 0;
305
+				$csv_data ['includedseconds'] = isset ($csv_data ['includedseconds']) ? $csv_data ['includedseconds'] : 0;
306
+				$csv_data ['cost'] = ! empty ($csv_data ['cost']) && is_numeric($csv_data ['cost']) ? $this->common_model->add_calculate_currency($csv_data ['cost'], '', '', false, false) : 0;
307
+				$csv_data ['inc'] = isset ($csv_data ['inc']) ? $csv_data ['inc'] : 0;
308
+				$csv_data ['precedence'] = isset ($csv_data ['precedence']) ? $csv_data ['precedence'] : '';
309
+				$csv_data ['last_modified_date'] = gmdate("Y-m-d H:i:s");
310
+				$str = $this->data_validate($csv_data);
311 311
 				if ($str != "") {
312 312
 					$invalid_array [$i] = $csv_data;
313 313
 					$invalid_array [$i] ['error'] = $str;
314 314
 				} else {
315 315
 					$csv_data ['pricelist_id'] = $pricelistID;
316 316
 					$csv_data ['trunk_id'] = $trunkid;
317
-					$csv_data ['pattern'] = "^" . $csv_data ['pattern'] . ".*";
317
+					$csv_data ['pattern'] = "^".$csv_data ['pattern'].".*";
318 318
 					$csv_data ['reseller_id'] = $reseller_id;
319
-					$csv_data ['creation_date'] = gmdate ( "Y-m-d H:i:s" );
320
-					$csv_data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" );
319
+					$csv_data ['creation_date'] = gmdate("Y-m-d H:i:s");
320
+					$csv_data ['last_modified_date'] = gmdate("Y-m-d H:i:s");
321 321
 					$new_final_arr [$i] = $csv_data;
322
-					$row_count ++;
322
+					$row_count++;
323 323
 				}
324 324
 			}
325
-			$i ++;
325
+			$i++;
326 326
 		}
327
-		if (! empty ( $new_final_arr )) {
328
-			$this->rates_model->bulk_insert_origination_rate ( $new_final_arr, $row_count );
327
+		if ( ! empty ($new_final_arr)) {
328
+			$this->rates_model->bulk_insert_origination_rate($new_final_arr, $row_count);
329 329
 		}
330
-		unlink ( $full_path . $originationrate_file_name );
331
-		$count = count ( $invalid_array );
330
+		unlink($full_path.$originationrate_file_name);
331
+		$count = count($invalid_array);
332 332
 		if ($count > 0) {
333 333
 			$session_id = "-1";
334
-			$fp = fopen ( $full_path . $session_id . '.csv', 'w' );
335
-			foreach ( $new_final_arr_key as $key => $value ) {
336
-				$custom_array [0] [$key] = ucfirst ( $key );
334
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
335
+			foreach ($new_final_arr_key as $key => $value) {
336
+				$custom_array [0] [$key] = ucfirst($key);
337 337
 			}
338 338
 			$custom_array [0] ['error'] = "Error";
339
-			$invalid_array = array_merge ( $custom_array, $invalid_array );
340
-			foreach ( $invalid_array as $err_data ) {
341
-				fputcsv ( $fp, $err_data );
339
+			$invalid_array = array_merge($custom_array, $invalid_array);
340
+			foreach ($invalid_array as $err_data) {
341
+				fputcsv($fp, $err_data);
342 342
 			}
343
-			fclose ( $fp );
344
-			$this->session->set_userdata ( 'import_origination_rate_csv_error', $session_id . ".csv" );
343
+			fclose($fp);
344
+			$this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv");
345 345
 			$data ["error"] = $invalid_array;
346 346
 			$data ['pricelistid'] = $pricelistID;
347
-			$data ['impoted_count'] = count ( $new_final_arr );
348
-			$data ['failure_count'] = count ( $invalid_array ) - 1;
349
-			$data ['page_title'] = gettext ( 'Origination Rates Import Error' );
350
-			$this->load->view ( 'view_import_error', $data );
347
+			$data ['impoted_count'] = count($new_final_arr);
348
+			$data ['failure_count'] = count($invalid_array) - 1;
349
+			$data ['page_title'] = gettext('Origination Rates Import Error');
350
+			$this->load->view('view_import_error', $data);
351 351
 		} else {
352
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Total ' . count ( $new_final_arr ) . ' Origination rates imported successfully!' );
353
-			redirect ( base_url () . "rates/origination_rates_list/" );
352
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Origination rates imported successfully!');
353
+			redirect(base_url()."rates/origination_rates_list/");
354 354
 		}
355 355
 	}
356 356
 	function data_validate($csvdata) {
@@ -359,144 +359,144 @@  discard block
 block discarded – undo
359 359
 		$alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i";
360 360
 		$email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/";
361 361
 		$str .= $csvdata ['pattern'] != '' ? null : 'Code,';
362
-		$str = rtrim ( $str, ',' );
363
-		if (! $str) {
364
-			$str .= is_numeric ( $csvdata ['pattern'] ) ? null : 'Code,';
362
+		$str = rtrim($str, ',');
363
+		if ( ! $str) {
364
+			$str .= is_numeric($csvdata ['pattern']) ? null : 'Code,';
365 365
 			
366
-			$str .= ! empty ( $csvdata ['connectcost'] ) && is_numeric ( $csvdata ['connectcost'] ) ? null : (empty ( $csvdata ['connectcost'] ) ? null : 'Connect Cost,');
367
-			$str .= ! empty ( $csvdata ['includedseconds'] ) && is_numeric ( $csvdata ['includedseconds'] ) ? null : (empty ( $csvdata ['includedseconds'] ) ? null : 'Included Seconds,');
366
+			$str .= ! empty ($csvdata ['connectcost']) && is_numeric($csvdata ['connectcost']) ? null : (empty ($csvdata ['connectcost']) ? null : 'Connect Cost,');
367
+			$str .= ! empty ($csvdata ['includedseconds']) && is_numeric($csvdata ['includedseconds']) ? null : (empty ($csvdata ['includedseconds']) ? null : 'Included Seconds,');
368 368
 			
369
-			$str .= ! empty ( $csvdata ['inc'] ) && is_numeric ( $csvdata ['inc'] ) ? null : (empty ( $csvdata ['inc'] ) ? null : 'Increment,');
370
-			$str .= ! empty ( $csvdata ['precedence'] ) && is_numeric ( $csvdata ['precedence'] ) ? null : (empty ( $csvdata ['precedence'] ) ? null : 'Precedence,');
371
-			$str .= (isset ( $csvdata ['strip'] ) && ! empty ( $csvdata ['strip'] )) ? (is_numeric ( $csvdata ['strip'] ) ? null : 'Strip,') : null;
369
+			$str .= ! empty ($csvdata ['inc']) && is_numeric($csvdata ['inc']) ? null : (empty ($csvdata ['inc']) ? null : 'Increment,');
370
+			$str .= ! empty ($csvdata ['precedence']) && is_numeric($csvdata ['precedence']) ? null : (empty ($csvdata ['precedence']) ? null : 'Precedence,');
371
+			$str .= (isset ($csvdata ['strip']) && ! empty ($csvdata ['strip'])) ? (is_numeric($csvdata ['strip']) ? null : 'Strip,') : null;
372 372
 			if ($str) {
373
-				$str = rtrim ( $str, ',' );
374
-				$error_field = explode ( ',', $str );
375
-				$count = count ( $error_field );
373
+				$str = rtrim($str, ',');
374
+				$error_field = explode(',', $str);
375
+				$count = count($error_field);
376 376
 				$str .= $count > 1 ? ' are not valid' : ' is not Valid';
377 377
 				return $str;
378 378
 			} else {
379 379
 				return false;
380 380
 			}
381 381
 		} else {
382
-			$str = rtrim ( $str, ',' );
383
-			$error_field = explode ( ',', $str );
384
-			$count = count ( $error_field );
382
+			$str = rtrim($str, ',');
383
+			$error_field = explode(',', $str);
384
+			$count = count($error_field);
385 385
 			$str .= $count > 1 ? ' are required' : ' is Required';
386 386
 			return $str;
387 387
 		}
388 388
 	}
389 389
 	function origination_rate_error_download() {
390
-		$this->load->helper ( 'download' );
391
-		$error_data = $this->session->userdata ( 'import_origination_rate_csv_error' );
392
-		$full_path = $this->config->item ( 'rates-file-path' );
393
-		$data = file_get_contents ( $full_path . $error_data );
394
-		force_download ( "Origination_rate_error.csv", $data );
390
+		$this->load->helper('download');
391
+		$error_data = $this->session->userdata('import_origination_rate_csv_error');
392
+		$full_path = $this->config->item('rates-file-path');
393
+		$data = file_get_contents($full_path.$error_data);
394
+		force_download("Origination_rate_error.csv", $data);
395 395
 	}
396 396
 	function origination_rate_add($type = "") {
397
-		$data ['username'] = $this->session->userdata ( 'user_name' );
397
+		$data ['username'] = $this->session->userdata('user_name');
398 398
 		$data ['flag'] = 'create';
399
-		$data ['page_title'] = gettext ( 'Create Origination Rate' );
400
-		$data ['form'] = $this->form->build_form ( $this->rates_form->get_origination_rate_form_fields (), '' );
399
+		$data ['page_title'] = gettext('Create Origination Rate');
400
+		$data ['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), '');
401 401
 		
402
-		$this->load->view ( 'view_origination_rate_add_edit', $data );
402
+		$this->load->view('view_origination_rate_add_edit', $data);
403 403
 	}
404 404
 	function origination_rate_edit($edit_id = '') {
405
-		$data ['page_title'] = gettext ( 'Edit Origination Rate' );
406
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
407
-			$account_data = $this->session->userdata ( "accountinfo" );
405
+		$data ['page_title'] = gettext('Edit Origination Rate');
406
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
407
+			$account_data = $this->session->userdata("accountinfo");
408 408
 			$reseller = $account_data ['id'];
409
-			$where = array (
409
+			$where = array(
410 410
 					'id' => $edit_id,
411 411
 					"reseller_id" => $reseller 
412 412
 			);
413 413
 		} else {
414
-			$where = array (
414
+			$where = array(
415 415
 					'id' => $edit_id 
416 416
 			);
417 417
 		}
418
-		$account = $this->db_model->getSelect ( "*", "routes", $where );
418
+		$account = $this->db_model->getSelect("*", "routes", $where);
419 419
 		if ($account->num_rows > 0) {
420
-			foreach ( $account->result_array () as $key => $value ) {
420
+			foreach ($account->result_array() as $key => $value) {
421 421
 				$edit_data = $value;
422 422
 			}
423
-			$edit_data ['connectcost'] = $this->common_model->to_calculate_currency ( $edit_data ['connectcost'], '', '', true, false );
424
-			$edit_data ['cost'] = $this->common_model->to_calculate_currency ( $edit_data ['cost'], '', '', true, false );
425
-			$edit_data ['pattern'] = filter_var ( $edit_data ['pattern'], FILTER_SANITIZE_NUMBER_INT );
423
+			$edit_data ['connectcost'] = $this->common_model->to_calculate_currency($edit_data ['connectcost'], '', '', true, false);
424
+			$edit_data ['cost'] = $this->common_model->to_calculate_currency($edit_data ['cost'], '', '', true, false);
425
+			$edit_data ['pattern'] = filter_var($edit_data ['pattern'], FILTER_SANITIZE_NUMBER_INT);
426 426
 			
427
-			$data ['form'] = $this->form->build_form ( $this->rates_form->get_origination_rate_form_fields (), $edit_data );
428
-			$this->load->view ( 'view_origination_rate_add_edit', $data );
427
+			$data ['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data);
428
+			$this->load->view('view_origination_rate_add_edit', $data);
429 429
 		} else {
430
-			redirect ( base_url () . 'rates/origination_rate_list/' );
430
+			redirect(base_url().'rates/origination_rate_list/');
431 431
 		}
432 432
 	}
433 433
 	function origination_rate_save() {
434
-		$add_array = $this->input->post ();
435
-		$data ['form'] = $this->form->build_form ( $this->rates_form->get_origination_rate_form_fields (), $add_array );
434
+		$add_array = $this->input->post();
435
+		$data ['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $add_array);
436 436
 		if ($add_array ['id'] != '') {
437
-			$data ['page_title'] = gettext ( 'Edit Origination Rate' );
438
-			if ($this->form_validation->run () == FALSE) {
439
-				$data ['validation_errors'] = validation_errors ();
437
+			$data ['page_title'] = gettext('Edit Origination Rate');
438
+			if ($this->form_validation->run() == FALSE) {
439
+				$data ['validation_errors'] = validation_errors();
440 440
 				echo $data ['validation_errors'];
441 441
 				exit ();
442 442
 			} else {
443
-				$add_array ['connectcost'] = $this->common_model->add_calculate_currency ( $add_array ['connectcost'], '', '', false, false );
444
-				$add_array ['cost'] = $this->common_model->add_calculate_currency ( $add_array ['cost'], '', '', false, false );
445
-				$this->rates_model->edit_origination_rate ( $add_array, $add_array ['id'] );
446
-				echo json_encode ( array (
443
+				$add_array ['connectcost'] = $this->common_model->add_calculate_currency($add_array ['connectcost'], '', '', false, false);
444
+				$add_array ['cost'] = $this->common_model->add_calculate_currency($add_array ['cost'], '', '', false, false);
445
+				$this->rates_model->edit_origination_rate($add_array, $add_array ['id']);
446
+				echo json_encode(array(
447 447
 						"SUCCESS" => "Origination rate updated successfully!" 
448
-				) );
448
+				));
449 449
 				exit ();
450 450
 			}
451 451
 		} else {
452
-			$data ['page_title'] = gettext ( 'Add Origination Rate' );
453
-			if ($this->form_validation->run () == FALSE) {
454
-				$data ['validation_errors'] = validation_errors ();
452
+			$data ['page_title'] = gettext('Add Origination Rate');
453
+			if ($this->form_validation->run() == FALSE) {
454
+				$data ['validation_errors'] = validation_errors();
455 455
 				echo $data ['validation_errors'];
456 456
 				exit ();
457 457
 			} else {
458 458
 				
459
-				$add_array ['connectcost'] = $this->common_model->add_calculate_currency ( $add_array ['connectcost'], '', '', false, false );
460
-				$add_array ['cost'] = $this->common_model->add_calculate_currency ( $add_array ['cost'], '', '', false, false );
461
-				$this->rates_model->add_origination_rate ( $add_array );
462
-				echo json_encode ( array (
459
+				$add_array ['connectcost'] = $this->common_model->add_calculate_currency($add_array ['connectcost'], '', '', false, false);
460
+				$add_array ['cost'] = $this->common_model->add_calculate_currency($add_array ['cost'], '', '', false, false);
461
+				$this->rates_model->add_origination_rate($add_array);
462
+				echo json_encode(array(
463 463
 						"SUCCESS" => "Origination rate added successfully!" 
464
-				) );
464
+				));
465 465
 				exit ();
466 466
 			}
467 467
 		}
468 468
 	}
469 469
 	function origination_rates_list_search() {
470
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
470
+		$ajax_search = $this->input->post('ajax_search', 0);
471 471
 		
472
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
473
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
474
-			$action = $this->input->post ();
475
-			unset ( $action ['action'] );
476
-			unset ( $action ['advance_search'] );
477
-			$this->session->set_userdata ( 'origination_rate_list_search', $action );
472
+		if ($this->input->post('advance_search', TRUE) == 1) {
473
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
474
+			$action = $this->input->post();
475
+			unset ($action ['action']);
476
+			unset ($action ['advance_search']);
477
+			$this->session->set_userdata('origination_rate_list_search', $action);
478 478
 		}
479 479
 		if (@$ajax_search != 1) {
480
-			redirect ( base_url () . 'rates/origination_rates_list/' );
480
+			redirect(base_url().'rates/origination_rates_list/');
481 481
 		}
482 482
 	}
483 483
 	function origination_rates_list_clearsearchfilter() {
484
-		$this->session->set_userdata ( 'advance_search', 0 );
485
-		$this->session->set_userdata ( 'account_search', "" );
484
+		$this->session->set_userdata('advance_search', 0);
485
+		$this->session->set_userdata('account_search', "");
486 486
 	}
487 487
 	function termination_rate_delete($id) {
488
-		$this->rates_model->remove_termination_rate ( $id );
489
-		$this->session->set_flashdata ( 'astpp_notification', 'Termination removed successfully!' );
490
-		redirect ( base_url () . '/rates/termination_rates_list/' );
488
+		$this->rates_model->remove_termination_rate($id);
489
+		$this->session->set_flashdata('astpp_notification', 'Termination removed successfully!');
490
+		redirect(base_url().'/rates/termination_rates_list/');
491 491
 	}
492 492
 	function origination_rate_delete($id) {
493
-		$this->rates_model->remove_origination_rate ( $id );
494
-		$this->session->set_flashdata ( 'astpp_notification', 'Origination rate removed successfully!' );
495
-		redirect ( base_url () . 'rates/origination_rates_list/' );
493
+		$this->rates_model->remove_origination_rate($id);
494
+		$this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!');
495
+		redirect(base_url().'rates/origination_rates_list/');
496 496
 	}
497 497
 	function origination_rates_list() {
498
-		$data ['username'] = $this->session->userdata ( 'user_name' );
499
-		$data ['page_title'] = gettext ( 'Origination Rates' );
498
+		$data ['username'] = $this->session->userdata('user_name');
499
+		$data ['page_title'] = gettext('Origination Rates');
500 500
 		$data ['search_flag'] = true;
501 501
 		$data ['batch_update_flag'] = true;
502 502
 		/**
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
 		/**
510 510
 		 * ************
511 511
 		 */
512
-		$this->session->set_userdata ( 'advance_search', 0 );
513
-		$data ['grid_fields'] = $this->rates_form->build_origination_rate_list_for_admin ();
514
-		$data ["grid_buttons"] = $this->rates_form->build_grid_buttons_origination_rate ();
515
-		$data ['form_search'] = $this->form->build_serach_form ( $this->rates_form->get_origination_rate_search_form () );
516
-		$data ['form_batch_update'] = $this->form->build_batchupdate_form ( $this->rates_form->origination_rate_batch_update_form () );
517
-		$this->load->view ( 'view_origination_rate_list', $data );
512
+		$this->session->set_userdata('advance_search', 0);
513
+		$data ['grid_fields'] = $this->rates_form->build_origination_rate_list_for_admin();
514
+		$data ["grid_buttons"] = $this->rates_form->build_grid_buttons_origination_rate();
515
+		$data ['form_search'] = $this->form->build_serach_form($this->rates_form->get_origination_rate_search_form());
516
+		$data ['form_batch_update'] = $this->form->build_batchupdate_form($this->rates_form->origination_rate_batch_update_form());
517
+		$this->load->view('view_origination_rate_list', $data);
518 518
 	}
519 519
 	
520 520
 	/**
@@ -524,249 +524,249 @@  discard block
 block discarded – undo
524 524
 	 * ********
525 525
 	 */
526 526
 	function origination_rates_list_json() {
527
-		$json_data = array ();
528
-		$count_all = $this->rates_model->get_origination_rate_list ( false );
529
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
527
+		$json_data = array();
528
+		$count_all = $this->rates_model->get_origination_rate_list(false);
529
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
530 530
 		$json_data = $paging_data ["json_paging"];
531 531
 		// echo "<pre>"; print_r($json_data);
532
-		$query = $this->rates_model->get_origination_rate_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
533
-		$grid_fields = json_decode ( $this->rates_form->build_origination_rate_list_for_admin () );
534
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
532
+		$query = $this->rates_model->get_origination_rate_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
533
+		$grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_admin());
534
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
535 535
 		
536
-		echo json_encode ( $json_data );
536
+		echo json_encode($json_data);
537 537
 	}
538 538
 	function origination_rates_list_delete($flag = '') {
539
-		$json_data = array ();
540
-		$this->session->set_userdata ( 'advance_batch_data_delete', 1 );
541
-		$count_all = $this->rates_model->get_origination_rate_list ( false );
539
+		$json_data = array();
540
+		$this->session->set_userdata('advance_batch_data_delete', 1);
541
+		$count_all = $this->rates_model->get_origination_rate_list(false);
542 542
 		echo $count_all;
543 543
 	}
544 544
 	/**
545 545
 	 * ****************
546 546
 	 */
547 547
 	function termination_rate_add($type = "") {
548
-		$data ['username'] = $this->session->userdata ( 'user_name' );
548
+		$data ['username'] = $this->session->userdata('user_name');
549 549
 		$data ['flag'] = 'create';
550
-		$data ['page_title'] = gettext ( 'Create Termination Rate' );
551
-		$data ['form'] = $this->form->build_form ( $this->rates_form->get_termination_rate_form_fields (), '' );
552
-		$this->load->view ( 'view_termination_rate_add_edit', $data );
550
+		$data ['page_title'] = gettext('Create Termination Rate');
551
+		$data ['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), '');
552
+		$this->load->view('view_termination_rate_add_edit', $data);
553 553
 	}
554 554
 	function termination_rate_edit($edit_id = '') {
555
-		$data ['page_title'] = gettext ( 'Edit Termination Rate' );
556
-		$where = array (
555
+		$data ['page_title'] = gettext('Edit Termination Rate');
556
+		$where = array(
557 557
 				'id' => $edit_id 
558 558
 		);
559
-		$account = $this->db_model->getSelect ( "*", "outbound_routes", $where );
560
-		foreach ( $account->result_array () as $key => $value ) {
559
+		$account = $this->db_model->getSelect("*", "outbound_routes", $where);
560
+		foreach ($account->result_array() as $key => $value) {
561 561
 			$edit_data = $value;
562 562
 		}
563
-		$edit_data ['connectcost'] = $this->common_model->to_calculate_currency ( $edit_data ['connectcost'], '', '', false, false );
564
-		$edit_data ['cost'] = $this->common_model->to_calculate_currency ( $edit_data ['cost'], '', '', false, false );
563
+		$edit_data ['connectcost'] = $this->common_model->to_calculate_currency($edit_data ['connectcost'], '', '', false, false);
564
+		$edit_data ['cost'] = $this->common_model->to_calculate_currency($edit_data ['cost'], '', '', false, false);
565 565
 		
566
-		$edit_data ['pattern'] = filter_var ( $edit_data ['pattern'], FILTER_SANITIZE_NUMBER_INT );
567
-		$data ['form'] = $this->form->build_form ( $this->rates_form->get_termination_rate_form_fields (), $edit_data );
568
-		$this->load->view ( 'view_termination_rate_add_edit', $data );
566
+		$edit_data ['pattern'] = filter_var($edit_data ['pattern'], FILTER_SANITIZE_NUMBER_INT);
567
+		$data ['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $edit_data);
568
+		$this->load->view('view_termination_rate_add_edit', $data);
569 569
 	}
570 570
 	function termination_rate_save() {
571
-		$add_array = $this->input->post ();
572
-		$data ['form'] = $this->form->build_form ( $this->rates_form->get_termination_rate_form_fields (), $add_array );
571
+		$add_array = $this->input->post();
572
+		$data ['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $add_array);
573 573
 		if ($add_array ['id'] != '') {
574
-			$data ['page_title'] = gettext ( 'Edit Termination Rate' );
575
-			if ($this->form_validation->run () == FALSE) {
576
-				$data ['validation_errors'] = validation_errors ();
574
+			$data ['page_title'] = gettext('Edit Termination Rate');
575
+			if ($this->form_validation->run() == FALSE) {
576
+				$data ['validation_errors'] = validation_errors();
577 577
 				echo $data ['validation_errors'];
578 578
 				exit ();
579 579
 			} else {
580
-				$add_array ['connectcost'] = $this->common_model->add_calculate_currency ( $add_array ['connectcost'], '', '', false, false );
581
-				$add_array ['cost'] = $this->common_model->add_calculate_currency ( $add_array ['cost'], '', '', false, false );
582
-				$this->rates_model->edit_termination_rate ( $add_array, $add_array ['id'] );
583
-				echo json_encode ( array (
580
+				$add_array ['connectcost'] = $this->common_model->add_calculate_currency($add_array ['connectcost'], '', '', false, false);
581
+				$add_array ['cost'] = $this->common_model->add_calculate_currency($add_array ['cost'], '', '', false, false);
582
+				$this->rates_model->edit_termination_rate($add_array, $add_array ['id']);
583
+				echo json_encode(array(
584 584
 						"SUCCESS" => "Termination updated successfully!" 
585
-				) );
585
+				));
586 586
 				exit ();
587 587
 			}
588 588
 		} else {
589
-			$data ['page_title'] = gettext ( 'Add Termination Rate' );
590
-			if ($this->form_validation->run () == FALSE) {
591
-				$data ['validation_errors'] = validation_errors ();
589
+			$data ['page_title'] = gettext('Add Termination Rate');
590
+			if ($this->form_validation->run() == FALSE) {
591
+				$data ['validation_errors'] = validation_errors();
592 592
 				echo $data ['validation_errors'];
593 593
 				exit ();
594 594
 			} else {
595 595
 				
596
-				$add_array ['connectcost'] = $this->common_model->add_calculate_currency ( $add_array ['connectcost'], '', '', false, false );
597
-				$add_array ['cost'] = $this->common_model->add_calculate_currency ( $add_array ['cost'], '', '', false, false );
598
-				$this->rates_model->add_termination_rate ( $add_array );
599
-				echo json_encode ( array (
596
+				$add_array ['connectcost'] = $this->common_model->add_calculate_currency($add_array ['connectcost'], '', '', false, false);
597
+				$add_array ['cost'] = $this->common_model->add_calculate_currency($add_array ['cost'], '', '', false, false);
598
+				$this->rates_model->add_termination_rate($add_array);
599
+				echo json_encode(array(
600 600
 						"SUCCESS" => "Termination added successfully!" 
601
-				) );
601
+				));
602 602
 				exit ();
603 603
 			}
604 604
 		}
605
-		$this->load->view ( 'view_termination_rate_add_edit', $data );
605
+		$this->load->view('view_termination_rate_add_edit', $data);
606 606
 	}
607 607
 	function termination_rates_list_search() {
608
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
608
+		$ajax_search = $this->input->post('ajax_search', 0);
609 609
 		
610
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
611
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
612
-			$action = $this->input->post ();
613
-			unset ( $action ['action'] );
614
-			unset ( $action ['advance_search'] );
615
-			$this->session->set_userdata ( 'termination_rates_list_search', $action );
610
+		if ($this->input->post('advance_search', TRUE) == 1) {
611
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
612
+			$action = $this->input->post();
613
+			unset ($action ['action']);
614
+			unset ($action ['advance_search']);
615
+			$this->session->set_userdata('termination_rates_list_search', $action);
616 616
 		}
617 617
 		if (@$ajax_search != 1) {
618
-			redirect ( base_url () . 'rates/termination_rates_list/' );
618
+			redirect(base_url().'rates/termination_rates_list/');
619 619
 		}
620 620
 	}
621 621
 	function termination_rates_list_clearsearchfilter() {
622
-		$this->session->set_userdata ( 'advance_search', 0 );
623
-		$this->session->set_userdata ( 'account_search', "" );
622
+		$this->session->set_userdata('advance_search', 0);
623
+		$this->session->set_userdata('account_search', "");
624 624
 	}
625 625
 	function customer_block_pattern_list($accountid, $accounttype) {
626
-		$json_data = array ();
627
-		$where = array (
626
+		$json_data = array();
627
+		$where = array(
628 628
 				'accountid' => $accountid 
629 629
 		);
630
-		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_pattern' );
631
-		$like_str = ! empty ( $instant_search ) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
632
-		if (! empty ( $like_str ))
633
-			$this->db->where ( $like_str );
634
-		$count_all = $this->db_model->countQuery ( "*", "block_patterns", $where );
635
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
630
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_pattern');
631
+		$like_str = ! empty ($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
632
+		if ( ! empty ($like_str))
633
+			$this->db->where($like_str);
634
+		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
635
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
636 636
 		$json_data = $paging_data ["json_paging"];
637
-		if (! empty ( $like_str ))
638
-			$this->db->where ( $like_str );
639
-		$pattern_data = $this->db_model->getSelect ( "*", "block_patterns", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
640
-		$grid_fields = json_decode ( $this->rates_form->build_pattern_list_for_customer ( $accountid, $accounttype ) );
641
-		$json_data ['rows'] = $this->form->build_grid ( $pattern_data, $grid_fields );
642
-		echo json_encode ( $json_data );
637
+		if ( ! empty ($like_str))
638
+			$this->db->where($like_str);
639
+		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"]);
640
+		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype));
641
+		$json_data ['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
642
+		echo json_encode($json_data);
643 643
 	}
644 644
 	function termination_rate_delete_multiple() {
645
-		$ids = $this->input->post ( "selected_ids", true );
645
+		$ids = $this->input->post("selected_ids", true);
646 646
 		$where = "id IN ($ids)";
647
-		$this->db->where ( $where );
648
-		echo $this->db->delete ( "outbound_routes" );
647
+		$this->db->where($where);
648
+		echo $this->db->delete("outbound_routes");
649 649
 	}
650 650
 	function origination_rate_delete_multiple() {
651
-		$ids = $this->input->post ( "selected_ids", true );
651
+		$ids = $this->input->post("selected_ids", true);
652 652
 		$where = "id IN ($ids)";
653
-		$this->db->where ( $where );
654
-		echo $this->db->delete ( "routes" );
653
+		$this->db->where($where);
654
+		echo $this->db->delete("routes");
655 655
 	}
656 656
 	function user_origination_rate_list_json() {
657
-		$json_data = array ();
658
-		$account_data = $this->session->userdata ( "accountinfo" );
659
-		$markup = $this->common->get_field_name ( 'markup', 'pricelists', array (
657
+		$json_data = array();
658
+		$account_data = $this->session->userdata("accountinfo");
659
+		$markup = $this->common->get_field_name('markup', 'pricelists', array(
660 660
 				'id' => $account_data ["pricelist_id"] 
661
-		) );
661
+		));
662 662
 		$markup = ($markup > 0) ? $markup : 1;
663 663
 		
664
-		$count_all = $this->rates_model->get_origination_rate_list_for_user ( false );
665
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
664
+		$count_all = $this->rates_model->get_origination_rate_list_for_user(false);
665
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
666 666
 		$json_data = $paging_data ["json_paging"];
667 667
 		
668
-		$query = $this->rates_model->get_origination_rate_list_for_user ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
669
-		$grid_fields = json_decode ( $this->rates_form->build_origination_rate_list_for_user () );
670
-		foreach ( $query->result_array () as $key => $value ) {
671
-			$json_data ['rows'] [] = array (
672
-					'cell' => array (
673
-							$this->common->get_only_numeric_val ( "", "", $value ["pattern"] ),
668
+		$query = $this->rates_model->get_origination_rate_list_for_user(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
669
+		$grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user());
670
+		foreach ($query->result_array() as $key => $value) {
671
+			$json_data ['rows'] [] = array(
672
+					'cell' => array(
673
+							$this->common->get_only_numeric_val("", "", $value ["pattern"]),
674 674
 							$value ['comment'],
675 675
 							$value ['inc'],
676
-							$this->common_model->calculate_currency ( ($value ['cost'] + ($value ['cost'] * $markup) / 100), '', '', '', true ),
677
-							$this->common_model->calculate_currency ( $value ['connectcost'], '', '', '', true ),
676
+							$this->common_model->calculate_currency(($value ['cost'] + ($value ['cost'] * $markup) / 100), '', '', '', true),
677
+							$this->common_model->calculate_currency($value ['connectcost'], '', '', '', true),
678 678
 							$value ['includedseconds'] 
679 679
 					) 
680 680
 			);
681 681
 		}
682 682
 		// $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
683
-		echo json_encode ( $json_data );
683
+		echo json_encode($json_data);
684 684
 	}
685 685
 	function user_origination_rate_list_search() {
686
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
686
+		$ajax_search = $this->input->post('ajax_search', 0);
687 687
 		
688
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
689
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
690
-			$action = $this->input->post ();
691
-			unset ( $action ['action'] );
692
-			unset ( $action ['advance_search'] );
693
-			$this->session->set_userdata ( 'origination_rate_list_search', $action );
688
+		if ($this->input->post('advance_search', TRUE) == 1) {
689
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
690
+			$action = $this->input->post();
691
+			unset ($action ['action']);
692
+			unset ($action ['advance_search']);
693
+			$this->session->set_userdata('origination_rate_list_search', $action);
694 694
 		}
695 695
 		if (@$ajax_search != 1) {
696
-			redirect ( base_url () . 'user/user_rates_list/' );
696
+			redirect(base_url().'user/user_rates_list/');
697 697
 		}
698 698
 	}
699 699
 	function user_origination_rate_list_clearsearchfilter() {
700
-		$this->session->set_userdata ( 'advance_search', 0 );
701
-		$this->session->set_userdata ( 'account_search', "" );
700
+		$this->session->set_userdata('advance_search', 0);
701
+		$this->session->set_userdata('account_search', "");
702 702
 	}
703 703
 	function customer_rates_download_sample_file($file_name) {
704
-		$this->load->helper ( 'download' );
705
-		$full_path = base_url () . "assets/Rates_File/" . $file_name . ".csv";
706
-		$arrContextOptions = array (
707
-				"ssl" => array (
704
+		$this->load->helper('download');
705
+		$full_path = base_url()."assets/Rates_File/".$file_name.".csv";
706
+		$arrContextOptions = array(
707
+				"ssl" => array(
708 708
 						"verify_peer" => false,
709 709
 						"verify_peer_name" => false 
710 710
 				) 
711 711
 		);
712
-		$file = file_get_contents ( $full_path, false, stream_context_create ( $arrContextOptions ) );
713
-		force_download ( "samplefile.csv", $file );
712
+		$file = file_get_contents($full_path, false, stream_context_create($arrContextOptions));
713
+		force_download("samplefile.csv", $file);
714 714
 	}
715 715
 	function termination_rate_batch_update() {
716
-		$batch_update_arr = $this->input->post ();
717
-		$batch_update_arr ["cost"] ["cost"] = isset ( $batch_update_arr ["cost"] ["cost"] ) ? $this->common_model->add_calculate_currency ( $batch_update_arr ["cost"] ["cost"], '', '', true, false ) : "0.0000";
718
-		$batch_update_arr ["connectcost"] ["connectcost"] = isset ( $batch_update_arr ["connectcost"] ["connectcost"] ) ? $this->common_model->add_calculate_currency ( $batch_update_arr ["connectcost"] ["connectcost"], '', '', true, false ) : "0.0000";
716
+		$batch_update_arr = $this->input->post();
717
+		$batch_update_arr ["cost"] ["cost"] = isset ($batch_update_arr ["cost"] ["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr ["cost"] ["cost"], '', '', true, false) : "0.0000";
718
+		$batch_update_arr ["connectcost"] ["connectcost"] = isset ($batch_update_arr ["connectcost"] ["connectcost"]) ? $this->common_model->add_calculate_currency($batch_update_arr ["connectcost"] ["connectcost"], '', '', true, false) : "0.0000";
719 719
 		// $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
720
-		$result = $this->rates_model->termination_rate_batch_update ( $batch_update_arr );
721
-		echo json_encode ( array (
720
+		$result = $this->rates_model->termination_rate_batch_update($batch_update_arr);
721
+		echo json_encode(array(
722 722
 				"SUCCESS" => "Termination rates batch updated successfully!" 
723
-		) );
723
+		));
724 724
 		exit ();
725 725
 	}
726 726
 	function origination_rate_batch_update() {
727
-		$batch_update_arr = $this->input->post ();
728
-		$batch_update_arr ["cost"] ["cost"] = isset ( $batch_update_arr ["cost"] ["cost"] ) ? $this->common_model->add_calculate_currency ( $batch_update_arr ["cost"] ["cost"], '', '', true, false ) : "0.0000";
727
+		$batch_update_arr = $this->input->post();
728
+		$batch_update_arr ["cost"] ["cost"] = isset ($batch_update_arr ["cost"] ["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr ["cost"] ["cost"], '', '', true, false) : "0.0000";
729 729
 		// $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
730
-		$result = $this->rates_model->origination_rate_batch_update ( $batch_update_arr );
731
-		echo json_encode ( array (
730
+		$result = $this->rates_model->origination_rate_batch_update($batch_update_arr);
731
+		echo json_encode(array(
732 732
 				"SUCCESS" => "Origination rates batch updated successfully!" 
733
-		) );
733
+		));
734 734
 		exit ();
735 735
 	}
736 736
 	function termination_rate_export_cdr_xls() {
737
-		$account_info = $accountinfo = $this->session->userdata ( 'accountinfo' );
737
+		$account_info = $accountinfo = $this->session->userdata('accountinfo');
738 738
 		$currency_id = $account_info ['currency_id'];
739
-		$currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id );
740
-		$query = $this->rates_model->get_termination_rate ( true, '', '', false );
741
-		$outbound_array = array ();
742
-		ob_clean ();
743
-		$outbound_array [] = array (
744
-				gettext ( "Code" ),
745
-				gettext ( "Destination" ),
746
-				gettext ( "Connect Cost" ) . "(" . $currency . ")",
747
-				gettext ( "Included Seconds" ),
748
-				gettext ( "Per Minute Cost" ) . "(" . $currency . ")",
749
-				gettext ( "Initial Increment" ),
750
-				gettext ( "Increment" ),
751
-				gettext ( "Priority" ),
752
-				gettext ( "Strip" ),
753
-				gettext ( "Prepend" ),
754
-				gettext ( "Trunk" ),
755
-				gettext ( "Status" ),
756
-				gettext ( "Created Date" ),
757
-				gettext ( "Modified Date" ) 
739
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
740
+		$query = $this->rates_model->get_termination_rate(true, '', '', false);
741
+		$outbound_array = array();
742
+		ob_clean();
743
+		$outbound_array [] = array(
744
+				gettext("Code"),
745
+				gettext("Destination"),
746
+				gettext("Connect Cost")."(".$currency.")",
747
+				gettext("Included Seconds"),
748
+				gettext("Per Minute Cost")."(".$currency.")",
749
+				gettext("Initial Increment"),
750
+				gettext("Increment"),
751
+				gettext("Priority"),
752
+				gettext("Strip"),
753
+				gettext("Prepend"),
754
+				gettext("Trunk"),
755
+				gettext("Status"),
756
+				gettext("Created Date"),
757
+				gettext("Modified Date") 
758 758
 		);
759
-		if ($query->num_rows () > 0) {
759
+		if ($query->num_rows() > 0) {
760 760
 			
761
-			foreach ( $query->result_array () as $row ) {
761
+			foreach ($query->result_array() as $row) {
762 762
 				// echo"<pre>";print_r($row);exit;
763
-				$outbound_array [] = array (
764
-						$row ['pattern'] = $this->common->get_only_numeric_val ( "", "", $row ["pattern"] ),
763
+				$outbound_array [] = array(
764
+						$row ['pattern'] = $this->common->get_only_numeric_val("", "", $row ["pattern"]),
765 765
 						$row ['comment'],
766
-						$this->common_model->calculate_currency ( $row ['connectcost'], '', '', TRUE, false ),
766
+						$this->common_model->calculate_currency($row ['connectcost'], '', '', TRUE, false),
767 767
 						
768 768
 						$row ['includedseconds'],
769
-						$this->common_model->calculate_currency ( $row ['cost'], '', '', TRUE, false ),
769
+						$this->common_model->calculate_currency($row ['cost'], '', '', TRUE, false),
770 770
 						/**
771 771
 						 * ASTPP 3.0
772 772
 						 * For Add Initial Increment field
@@ -781,25 +781,25 @@  discard block
 block discarded – undo
781 781
 						$row ['strip'],
782 782
 						$row ['prepend'],
783 783
 						// $row['trunk_id'],
784
-						$this->common->get_field_name ( 'name', 'trunks', $row ["trunk_id"] ),
785
-						$this->common->get_status ( 'export', '', $row ['status'] ),
786
-						$this->common->convert_GMT_to ( '', '', $row ['creation_date'] ),
787
-						$this->common->convert_GMT_to ( '', '', $row ['last_modified_date'] ) 
784
+						$this->common->get_field_name('name', 'trunks', $row ["trunk_id"]),
785
+						$this->common->get_status('export', '', $row ['status']),
786
+						$this->common->convert_GMT_to('', '', $row ['creation_date']),
787
+						$this->common->convert_GMT_to('', '', $row ['last_modified_date']) 
788 788
 				);
789 789
 			}
790 790
 		}
791
-		$this->load->helper ( 'csv' );
791
+		$this->load->helper('csv');
792 792
 		
793
-		array_to_csv ( $outbound_array, 'Termination_Rates_' . date ( "Y-m-d" ) . '.csv' );
793
+		array_to_csv($outbound_array, 'Termination_Rates_'.date("Y-m-d").'.csv');
794 794
 	}
795 795
 	function termination_rate_export_cdr_pdf() {
796
-		$query = $this->rates_model->get_termination_rate ( true, '', '', false );
797
-		$outbound_array = array ();
798
-		$this->load->library ( 'fpdf' );
799
-		$this->load->library ( 'pdf' );
800
-		$this->fpdf = new PDF ( 'P', 'pt' );
801
-		$this->fpdf->initialize ( 'P', 'mm', 'A4' );
802
-		$this->fpdf->tablewidths = array (
796
+		$query = $this->rates_model->get_termination_rate(true, '', '', false);
797
+		$outbound_array = array();
798
+		$this->load->library('fpdf');
799
+		$this->load->library('pdf');
800
+		$this->fpdf = new PDF('P', 'pt');
801
+		$this->fpdf->initialize('P', 'mm', 'A4');
802
+		$this->fpdf->tablewidths = array(
803 803
 				20,
804 804
 				30,
805 805
 				20,
@@ -810,27 +810,27 @@  discard block
 block discarded – undo
810 810
 				20,
811 811
 				20 
812 812
 		);
813
-		$outbound_array [] = array (
814
-				gettext ( "Code" ),
815
-				gettext ( "Destination" ),
816
-				gettext ( "Connect Cost" ),
817
-				gettext ( "Included Seconds" ),
818
-				gettext ( "Per Minute Cost" ),
819
-				gettext ( "Initial Increment" ),
820
-				gettext ( "Increment" ),
821
-				gettext ( "Precedence" ),
822
-				gettext ( "Prepend" ),
823
-				gettext ( "Strip" ) 
813
+		$outbound_array [] = array(
814
+				gettext("Code"),
815
+				gettext("Destination"),
816
+				gettext("Connect Cost"),
817
+				gettext("Included Seconds"),
818
+				gettext("Per Minute Cost"),
819
+				gettext("Initial Increment"),
820
+				gettext("Increment"),
821
+				gettext("Precedence"),
822
+				gettext("Prepend"),
823
+				gettext("Strip") 
824 824
 		);
825
-		if ($query->num_rows () > 0) {
825
+		if ($query->num_rows() > 0) {
826 826
 			
827
-			foreach ( $query->result_array () as $row ) {
828
-				$outbound_array [] = array (
829
-						$row ['pattern'] = $this->common->get_only_numeric_val ( "", "", $row ["pattern"] ),
827
+			foreach ($query->result_array() as $row) {
828
+				$outbound_array [] = array(
829
+						$row ['pattern'] = $this->common->get_only_numeric_val("", "", $row ["pattern"]),
830 830
 						$row ['comment'],
831 831
 						$row ['connectcost'],
832 832
 						$row ['includedseconds'],
833
-						$this->common_model->calculate_currency ( $row ['cost'] ),
833
+						$this->common_model->calculate_currency($row ['cost']),
834 834
 						/**
835 835
 						 * ASTPP 3.0
836 836
 						 * For Add Initial Increment field
@@ -847,51 +847,51 @@  discard block
 block discarded – undo
847 847
 				);
848 848
 			}
849 849
 		}
850
-		$this->fpdf->AliasNbPages ();
851
-		$this->fpdf->AddPage ();
850
+		$this->fpdf->AliasNbPages();
851
+		$this->fpdf->AddPage();
852 852
 		
853
-		$this->fpdf->SetFont ( 'Arial', '', 15 );
854
-		$this->fpdf->SetXY ( 60, 5 );
855
-		$this->fpdf->Cell ( 100, 10, "Outbound Rates Report " . date ( 'Y-m-d' ) );
853
+		$this->fpdf->SetFont('Arial', '', 15);
854
+		$this->fpdf->SetXY(60, 5);
855
+		$this->fpdf->Cell(100, 10, "Outbound Rates Report ".date('Y-m-d'));
856 856
 		
857
-		$this->fpdf->SetY ( 20 );
858
-		$this->fpdf->SetFont ( 'Arial', '', 7 );
859
-		$this->fpdf->SetFillColor ( 255, 255, 255 );
857
+		$this->fpdf->SetY(20);
858
+		$this->fpdf->SetFont('Arial', '', 7);
859
+		$this->fpdf->SetFillColor(255, 255, 255);
860 860
 		$this->fpdf->lMargin = 2;
861 861
 		
862
-		$dimensions = $this->fpdf->export_pdf ( $outbound_array, "7" );
863
-		$this->fpdf->Output ( 'Termination_Rate_' . date ( "Y-m-d" ) . '.pdf', "D" );
862
+		$dimensions = $this->fpdf->export_pdf($outbound_array, "7");
863
+		$this->fpdf->Output('Termination_Rate_'.date("Y-m-d").'.pdf', "D");
864 864
 	}
865 865
 	function origination_rate_export_cdr_xls() {
866
-		$account_info = $accountinfo = $this->session->userdata ( 'accountinfo' );
866
+		$account_info = $accountinfo = $this->session->userdata('accountinfo');
867 867
 		$currency_id = $account_info ['currency_id'];
868
-		$currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id );
869
-		$query = $this->rates_model->get_origination_rate ( true, '', '', false );
868
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
869
+		$query = $this->rates_model->get_origination_rate(true, '', '', false);
870 870
 		// echo "<pre>";print_r($query);exit;
871
-		$inbound_array = array ();
872
-		ob_clean ();
873
-		$inbound_array [] = array (
874
-				gettext ( "Code" ),
875
-				gettext ( "Destination" ),
876
-				gettext ( "Connect Cost" ) . "(" . $currency . ")",
877
-				gettext ( "Included Seconds" ),
878
-				gettext ( "Per Minute Cost" ) . "(" . $currency . ")",
879
-				gettext ( "Initial Increment" ),
880
-				gettext ( "Increment" ),
881
-				gettext ( "Rate Group" ),
882
-				gettext ( "Status" ),
883
-				gettext ( "Created Date" ) 
871
+		$inbound_array = array();
872
+		ob_clean();
873
+		$inbound_array [] = array(
874
+				gettext("Code"),
875
+				gettext("Destination"),
876
+				gettext("Connect Cost")."(".$currency.")",
877
+				gettext("Included Seconds"),
878
+				gettext("Per Minute Cost")."(".$currency.")",
879
+				gettext("Initial Increment"),
880
+				gettext("Increment"),
881
+				gettext("Rate Group"),
882
+				gettext("Status"),
883
+				gettext("Created Date") 
884 884
 		);
885
-		if ($query->num_rows () > 0) {
885
+		if ($query->num_rows() > 0) {
886 886
 			
887
-			foreach ( $query->result_array () as $row ) {
887
+			foreach ($query->result_array() as $row) {
888 888
 				// echo"<pre>";print_r($row);exit;
889
-				$inbound_array [] = array (
890
-						$row ['pattern'] = $this->common->get_only_numeric_val ( "", "", $row ["pattern"] ),
889
+				$inbound_array [] = array(
890
+						$row ['pattern'] = $this->common->get_only_numeric_val("", "", $row ["pattern"]),
891 891
 						$row ['comment'],
892
-						$this->common_model->calculate_currency ( $row ['connectcost'], '', '', TRUE, false ),
892
+						$this->common_model->calculate_currency($row ['connectcost'], '', '', TRUE, false),
893 893
 						$row ['includedseconds'],
894
-						$this->common_model->calculate_currency ( $row ['cost'], '', '', TRUE, false ),
894
+						$this->common_model->calculate_currency($row ['cost'], '', '', TRUE, false),
895 895
 						/**
896 896
 						 * ASTPP 3.0
897 897
 						 * For Add Initial Increment field
@@ -903,24 +903,24 @@  discard block
 block discarded – undo
903 903
 						 */
904 904
 						$row ['inc'],
905 905
 						// $row['precedence'],
906
-						$this->common->get_field_name ( 'name', 'pricelists', $row ['pricelist_id'] ),
907
-						$this->common->get_status ( 'export', '', $row ['status'] ),
906
+						$this->common->get_field_name('name', 'pricelists', $row ['pricelist_id']),
907
+						$this->common->get_status('export', '', $row ['status']),
908 908
 						$row ['creation_date'] 
909 909
 				);
910 910
 			}
911 911
 		}
912
-		$this->load->helper ( 'csv' );
913
-		array_to_csv ( $inbound_array, 'Origination_Rates_' . date ( "Y-m-d" ) . '.csv' );
912
+		$this->load->helper('csv');
913
+		array_to_csv($inbound_array, 'Origination_Rates_'.date("Y-m-d").'.csv');
914 914
 	}
915 915
 	function origination_rate_export_cdr_pdf() {
916
-		$query = $this->rates_model->get_origination_rate ( true, '', '', false );
916
+		$query = $this->rates_model->get_origination_rate(true, '', '', false);
917 917
 		
918
-		$inbound_array = array ();
919
-		$this->load->library ( 'fpdf' );
920
-		$this->load->library ( 'pdf' );
921
-		$this->fpdf = new PDF ( 'P', 'pt' );
922
-		$this->fpdf->initialize ( 'P', 'mm', 'A4' );
923
-		$this->fpdf->tablewidths = array (
918
+		$inbound_array = array();
919
+		$this->load->library('fpdf');
920
+		$this->load->library('pdf');
921
+		$this->fpdf = new PDF('P', 'pt');
922
+		$this->fpdf->initialize('P', 'mm', 'A4');
923
+		$this->fpdf->tablewidths = array(
924 924
 				20,
925 925
 				20,
926 926
 				20,
@@ -928,23 +928,23 @@  discard block
 block discarded – undo
928 928
 				20,
929 929
 				20 
930 930
 		);
931
-		$inbound_array [] = array (
932
-				gettext ( "Code" ),
933
-				gettext ( "Destination" ),
934
-				gettext ( "Connect Cost" ),
935
-				gettext ( "Included Seconds" ),
936
-				gettext ( "Per Minute Cost" ),
937
-				gettext ( "Initial Increment" ),
938
-				gettext ( "Increment" ) 
931
+		$inbound_array [] = array(
932
+				gettext("Code"),
933
+				gettext("Destination"),
934
+				gettext("Connect Cost"),
935
+				gettext("Included Seconds"),
936
+				gettext("Per Minute Cost"),
937
+				gettext("Initial Increment"),
938
+				gettext("Increment") 
939 939
 		);
940
-		if ($query->num_rows () > 0) {
941
-			foreach ( $query->result_array () as $row ) {
942
-				$inbound_array [] = array (
943
-						$row ['pattern'] = $this->common->get_only_numeric_val ( "", "", $row ["pattern"] ),
940
+		if ($query->num_rows() > 0) {
941
+			foreach ($query->result_array() as $row) {
942
+				$inbound_array [] = array(
943
+						$row ['pattern'] = $this->common->get_only_numeric_val("", "", $row ["pattern"]),
944 944
 						$row ['comment'],
945 945
 						$row ['connectcost'],
946 946
 						$row ['includedseconds'],
947
-						$this->common_model->calculate_currency ( $row ['cost'], '', '', '', false ),
947
+						$this->common_model->calculate_currency($row ['cost'], '', '', '', false),
948 948
 						/**
949 949
 						 * ASTPP 3.0
950 950
 						 * For Add Initial Increment field
@@ -958,29 +958,29 @@  discard block
 block discarded – undo
958 958
 				);
959 959
 			}
960 960
 		}
961
-		$this->fpdf->AliasNbPages ();
962
-		$this->fpdf->AddPage ();
961
+		$this->fpdf->AliasNbPages();
962
+		$this->fpdf->AddPage();
963 963
 		
964
-		$this->fpdf->SetFont ( 'Arial', '', 15 );
965
-		$this->fpdf->SetXY ( 60, 5 );
966
-		$this->fpdf->Cell ( 100, 10, "Origination Rates Report " . date ( 'Y-m-d' ) );
964
+		$this->fpdf->SetFont('Arial', '', 15);
965
+		$this->fpdf->SetXY(60, 5);
966
+		$this->fpdf->Cell(100, 10, "Origination Rates Report ".date('Y-m-d'));
967 967
 		
968
-		$this->fpdf->SetY ( 20 );
969
-		$this->fpdf->SetFont ( 'Arial', '', 7 );
970
-		$this->fpdf->SetFillColor ( 255, 255, 255 );
968
+		$this->fpdf->SetY(20);
969
+		$this->fpdf->SetFont('Arial', '', 7);
970
+		$this->fpdf->SetFillColor(255, 255, 255);
971 971
 		$this->fpdf->lMargin = 2;
972 972
 		
973
-		$dimensions = $this->fpdf->export_pdf ( $inbound_array, "5" );
974
-		$this->fpdf->Output ( 'Origination_Rate_' . date ( "Y-m-d" ) . '.pdf', "D" );
973
+		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
974
+		$this->fpdf->Output('Origination_Rate_'.date("Y-m-d").'.pdf', "D");
975 975
 	}
976 976
 	function user_origination_rate_cdr_pdf() {
977
-		$query = $this->rates_model->get_origination_rate_for_user ( true, '', '', false );
978
-		$inbound_array = array ();
979
-		$this->load->library ( 'fpdf' );
980
-		$this->load->library ( 'pdf' );
981
-		$this->fpdf = new PDF ( 'P', 'pt' );
982
-		$this->fpdf->initialize ( 'P', 'mm', 'A4' );
983
-		$this->fpdf->tablewidths = array (
977
+		$query = $this->rates_model->get_origination_rate_for_user(true, '', '', false);
978
+		$inbound_array = array();
979
+		$this->load->library('fpdf');
980
+		$this->load->library('pdf');
981
+		$this->fpdf = new PDF('P', 'pt');
982
+		$this->fpdf->initialize('P', 'mm', 'A4');
983
+		$this->fpdf->tablewidths = array(
984 984
 				20,
985 985
 				20,
986 986
 				20,
@@ -988,135 +988,135 @@  discard block
 block discarded – undo
988 988
 				20,
989 989
 				20 
990 990
 		);
991
-		$inbound_array [] = array (
992
-				gettext ( "Code" ),
993
-				gettext ( "Destination" ),
994
-				gettext ( "Increment" ),
995
-				gettext ( "Cost Per Minutes" ),
996
-				gettext ( "Connect Charge" ),
997
-				gettext ( "Included Seconds" ) 
991
+		$inbound_array [] = array(
992
+				gettext("Code"),
993
+				gettext("Destination"),
994
+				gettext("Increment"),
995
+				gettext("Cost Per Minutes"),
996
+				gettext("Connect Charge"),
997
+				gettext("Included Seconds") 
998 998
 		);
999
-		if ($query->num_rows () > 0) {
1000
-			foreach ( $query->result_array () as $row ) {
1001
-				$inbound_array [] = array (
1002
-						$row ['pattern'] = $this->common->get_only_numeric_val ( "", "", $row ["pattern"] ),
999
+		if ($query->num_rows() > 0) {
1000
+			foreach ($query->result_array() as $row) {
1001
+				$inbound_array [] = array(
1002
+						$row ['pattern'] = $this->common->get_only_numeric_val("", "", $row ["pattern"]),
1003 1003
 						$row ['comment'],
1004 1004
 						$row ['inc'],
1005
-						$this->common_model->calculate_currency ( $row ['cost'], '', '', '', false ),
1005
+						$this->common_model->calculate_currency($row ['cost'], '', '', '', false),
1006 1006
 						$row ['connectcost'],
1007 1007
 						$row ['includedseconds'] 
1008 1008
 				);
1009 1009
 			}
1010 1010
 		}
1011 1011
 		
1012
-		$this->fpdf->AliasNbPages ();
1013
-		$this->fpdf->AddPage ();
1012
+		$this->fpdf->AliasNbPages();
1013
+		$this->fpdf->AddPage();
1014 1014
 		
1015
-		$this->fpdf->SetFont ( 'Arial', '', 15 );
1016
-		$this->fpdf->SetXY ( 60, 5 );
1017
-		$this->fpdf->Cell ( 100, 10, "Rates Report " . date ( 'Y-m-d' ) );
1015
+		$this->fpdf->SetFont('Arial', '', 15);
1016
+		$this->fpdf->SetXY(60, 5);
1017
+		$this->fpdf->Cell(100, 10, "Rates Report ".date('Y-m-d'));
1018 1018
 		
1019
-		$this->fpdf->SetY ( 20 );
1020
-		$this->fpdf->SetFont ( 'Arial', '', 7 );
1021
-		$this->fpdf->SetFillColor ( 255, 255, 255 );
1019
+		$this->fpdf->SetY(20);
1020
+		$this->fpdf->SetFont('Arial', '', 7);
1021
+		$this->fpdf->SetFillColor(255, 255, 255);
1022 1022
 		$this->fpdf->lMargin = 2;
1023 1023
 		
1024
-		$dimensions = $this->fpdf->export_pdf ( $inbound_array, "5" );
1025
-		$this->fpdf->Output ( 'Rates_' . date ( "Y-m-d" ) . '.pdf', "D" );
1024
+		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
1025
+		$this->fpdf->Output('Rates_'.date("Y-m-d").'.pdf', "D");
1026 1026
 	}
1027 1027
 	function resellersrates_list() {
1028
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1029
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1030
-		$data ['page_title'] = gettext ( 'My Rates' );
1028
+		$accountinfo = $this->session->userdata('accountinfo');
1029
+		$data ['username'] = $this->session->userdata('user_name');
1030
+		$data ['page_title'] = gettext('My Rates');
1031 1031
 		$data ['search_flag'] = true;
1032
-		$this->session->set_userdata ( 'advance_search', 0 );
1033
-		$data ['grid_fields'] = $this->rates_form->build_rates_list_for_reseller ();
1034
-		$data ["grid_buttons"] = $this->rates_form->build_grid_buttons_rates ();
1035
-		$data ['form_search'] = $this->form->build_serach_form ( $this->rates_form->get_reseller_origination_rate_search_form () );
1036
-		$this->load->view ( 'view_resellersrates_list', $data );
1032
+		$this->session->set_userdata('advance_search', 0);
1033
+		$data ['grid_fields'] = $this->rates_form->build_rates_list_for_reseller();
1034
+		$data ["grid_buttons"] = $this->rates_form->build_grid_buttons_rates();
1035
+		$data ['form_search'] = $this->form->build_serach_form($this->rates_form->get_reseller_origination_rate_search_form());
1036
+		$this->load->view('view_resellersrates_list', $data);
1037 1037
 	}
1038 1038
 	function resellersrates_list_json() {
1039
-		$json_data = array ();
1040
-		$account_data = $this->session->userdata ( "accountinfo" );
1041
-		$markup = $this->common->get_field_name ( 'markup', 'pricelists', array (
1039
+		$json_data = array();
1040
+		$account_data = $this->session->userdata("accountinfo");
1041
+		$markup = $this->common->get_field_name('markup', 'pricelists', array(
1042 1042
 				'id' => $account_data ["pricelist_id"] 
1043
-		) );
1043
+		));
1044 1044
 		// $markup = ($markup > 0)?$markup:1;
1045
-		$count_all = $this->rates_model->getreseller_rates_list ( false );
1046
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
1045
+		$count_all = $this->rates_model->getreseller_rates_list(false);
1046
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
1047 1047
 		$json_data = $paging_data ["json_paging"];
1048
-		$query = $this->rates_model->getreseller_rates_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
1049
-		$grid_fields = json_decode ( $this->rates_form->build_rates_list_for_reseller () );
1050
-		foreach ( $query->result_array () as $key => $value ) {
1051
-			$json_data ['rows'] [] = array (
1052
-					'cell' => array (
1053
-							$this->common->get_only_numeric_val ( "", "", $value ["pattern"] ),
1048
+		$query = $this->rates_model->getreseller_rates_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
1049
+		$grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller());
1050
+		foreach ($query->result_array() as $key => $value) {
1051
+			$json_data ['rows'] [] = array(
1052
+					'cell' => array(
1053
+							$this->common->get_only_numeric_val("", "", $value ["pattern"]),
1054 1054
 							$value ['comment'],
1055
-							$this->common_model->calculate_currency ( $value ['connectcost'], '', '', 'true', true ),
1055
+							$this->common_model->calculate_currency($value ['connectcost'], '', '', 'true', true),
1056 1056
 							$value ['includedseconds'],
1057
-							$this->common_model->calculate_currency ( ($value ['cost'] + ($value ['cost'] * $markup) / 100), '', '', 'true', true ),
1057
+							$this->common_model->calculate_currency(($value ['cost'] + ($value ['cost'] * $markup) / 100), '', '', 'true', true),
1058 1058
 							$value ['inc'],
1059 1059
 							$value ['precedence'] 
1060 1060
 					) 
1061 1061
 			);
1062 1062
 		}
1063 1063
 		// $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
1064
-		echo json_encode ( $json_data );
1064
+		echo json_encode($json_data);
1065 1065
 	}
1066 1066
 	function resellersrates_list_search() {
1067
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
1067
+		$ajax_search = $this->input->post('ajax_search', 0);
1068 1068
 		
1069
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
1070
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
1071
-			$action = $this->input->post ();
1069
+		if ($this->input->post('advance_search', TRUE) == 1) {
1070
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
1071
+			$action = $this->input->post();
1072 1072
 			
1073
-			unset ( $action ['action'] );
1074
-			unset ( $action ['advance_search'] );
1075
-			$this->session->set_userdata ( 'resellerrates_list_search', $action );
1073
+			unset ($action ['action']);
1074
+			unset ($action ['advance_search']);
1075
+			$this->session->set_userdata('resellerrates_list_search', $action);
1076 1076
 		}
1077 1077
 		if (@$ajax_search != 1) {
1078
-			redirect ( base_url () . 'rates/resellersrates_list/' );
1078
+			redirect(base_url().'rates/resellersrates_list/');
1079 1079
 		}
1080 1080
 	}
1081 1081
 	function resellersrates_list_clearsearchfilter() {
1082
-		$this->session->set_userdata ( 'advance_search', 0 );
1083
-		$this->session->set_userdata ( 'resellerrates_list_search', "" );
1082
+		$this->session->set_userdata('advance_search', 0);
1083
+		$this->session->set_userdata('resellerrates_list_search', "");
1084 1084
 	}
1085 1085
 	function resellersrates_xls() {
1086
-		$account_info = $accountinfo = $this->session->userdata ( 'accountinfo' );
1086
+		$account_info = $accountinfo = $this->session->userdata('accountinfo');
1087 1087
 		$currency_id = $account_info ['currency_id'];
1088
-		$currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id );
1089
-		$query = $this->rates_model->getreseller_rates_list ( true, '0', '0', '1' );
1090
-		$customer_array = array ();
1091
-		ob_clean ();
1088
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
1089
+		$query = $this->rates_model->getreseller_rates_list(true, '0', '0', '1');
1090
+		$customer_array = array();
1091
+		ob_clean();
1092 1092
 		
1093
-		$customer_array [] = array (
1094
-				gettext ( "Code" ),
1095
-				gettext ( "Destination" ),
1096
-				gettext ( "Connect Cost" ) . "(" . $currency . ")",
1097
-				gettext ( "Included Seconds" ),
1098
-				gettext ( "Per Minute Cost" ) . "(" . $currency . ")",
1099
-				gettext ( "Increment" ),
1100
-				gettext ( "Precedence" ) 
1093
+		$customer_array [] = array(
1094
+				gettext("Code"),
1095
+				gettext("Destination"),
1096
+				gettext("Connect Cost")."(".$currency.")",
1097
+				gettext("Included Seconds"),
1098
+				gettext("Per Minute Cost")."(".$currency.")",
1099
+				gettext("Increment"),
1100
+				gettext("Precedence") 
1101 1101
 		);
1102 1102
 		
1103
-		if ($query->num_rows () > 0) {
1103
+		if ($query->num_rows() > 0) {
1104 1104
 			
1105
-			foreach ( $query->result_array () as $row ) {
1105
+			foreach ($query->result_array() as $row) {
1106 1106
 				
1107
-				$customer_array [] = array (
1108
-						$row ['pattern'] = $this->common->get_only_numeric_val ( "", "", $row ["pattern"] ),
1107
+				$customer_array [] = array(
1108
+						$row ['pattern'] = $this->common->get_only_numeric_val("", "", $row ["pattern"]),
1109 1109
 						$row ['comment'],
1110 1110
 						$row ['connectcost'],
1111 1111
 						$row ['includedseconds'],
1112
-						$this->common_model->calculate_currency ( $row ['cost'] ),
1112
+						$this->common_model->calculate_currency($row ['cost']),
1113 1113
 						$row ['inc'],
1114 1114
 						$row ['precedence'] 
1115 1115
 				);
1116 1116
 			}
1117 1117
 		}
1118
-		$this->load->helper ( 'csv' );
1119
-		array_to_csv ( $customer_array, 'My_Own_Rate_' . date ( "Y-m-d" ) . '.csv' );
1118
+		$this->load->helper('csv');
1119
+		array_to_csv($customer_array, 'My_Own_Rate_'.date("Y-m-d").'.csv');
1120 1120
 		exit ();
1121 1121
 	}
1122 1122
 	/**
@@ -1126,109 +1126,109 @@  discard block
 block discarded – undo
1126 1126
 	 * **********
1127 1127
 	 */
1128 1128
 	function termination_rates_list_batch_delete() {
1129
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
1130
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
1131
-			$this->session->set_userdata ( 'advance_batch_delete', $this->input->post ( 'advance_search' ) );
1132
-			$action = $this->input->post ();
1133
-			unset ( $action ['action'] );
1134
-			unset ( $action ['advance_search'] );
1135
-			$this->session->set_userdata ( 'termination_rates_list_search', $action );
1129
+		$ajax_search = $this->input->post('ajax_search', 0);
1130
+		if ($this->input->post('advance_search', TRUE) == 1) {
1131
+			$this->session->set_userdata('advance_batch_delete', $this->input->post('advance_search'));
1132
+			$action = $this->input->post();
1133
+			unset ($action ['action']);
1134
+			unset ($action ['advance_search']);
1135
+			$this->session->set_userdata('termination_rates_list_search', $action);
1136 1136
 		}
1137 1137
 		if (@$ajax_search != 1) {
1138
-			redirect ( base_url () . 'rates/termination_rates_list/' );
1138
+			redirect(base_url().'rates/termination_rates_list/');
1139 1139
 		}
1140 1140
 	}
1141 1141
 	function origination_rates_list_batch_delete() {
1142
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
1143
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
1144
-			$this->session->set_userdata ( 'advance_batch_delete', $this->input->post ( 'advance_search' ) );
1145
-			$action = $this->input->post ();
1146
-			unset ( $action ['action'] );
1147
-			unset ( $action ['advance_search'] );
1148
-			$this->session->set_userdata ( 'origination_rate_list_search', $action );
1142
+		$ajax_search = $this->input->post('ajax_search', 0);
1143
+		if ($this->input->post('advance_search', TRUE) == 1) {
1144
+			$this->session->set_userdata('advance_batch_delete', $this->input->post('advance_search'));
1145
+			$action = $this->input->post();
1146
+			unset ($action ['action']);
1147
+			unset ($action ['advance_search']);
1148
+			$this->session->set_userdata('origination_rate_list_search', $action);
1149 1149
 		}
1150 1150
 		if (@$ajax_search != 1) {
1151
-			redirect ( base_url () . 'rates/origination_rates_list/' );
1151
+			redirect(base_url().'rates/origination_rates_list/');
1152 1152
 		}
1153 1153
 	}
1154 1154
 	/**
1155 1155
 	 * ******* Import Mapper Code - ISSUE-142 *********
1156 1156
 	 */
1157 1157
 	function termination_rate_import_mapper() {
1158
-		$data ['page_title'] = gettext ( 'Import Termination Rates using field mapper' );
1159
-		$this->session->set_userdata ( 'import_termination_rate_mapper_csv', "" );
1160
-		$this->session->set_userdata ( 'import_termination_rate_mapper_csv_error', "" );
1158
+		$data ['page_title'] = gettext('Import Termination Rates using field mapper');
1159
+		$this->session->set_userdata('import_termination_rate_mapper_csv', "");
1160
+		$this->session->set_userdata('import_termination_rate_mapper_csv_error', "");
1161 1161
 		
1162
-		$this->load->view ( 'view_import_termination_rate_mapper', $data );
1162
+		$this->load->view('view_import_termination_rate_mapper', $data);
1163 1163
 	}
1164 1164
 	function csv_to_array($filename = '', $delimiter = ',') {
1165
-		if (! file_exists ( $filename ) || ! is_readable ( $filename ))
1165
+		if ( ! file_exists($filename) || ! is_readable($filename))
1166 1166
 			return FALSE;
1167 1167
 		$header = NULL;
1168
-		$data = array ();
1169
-		if (($handle = fopen ( $filename, 'r' )) !== FALSE) {
1170
-			while ( ($row = fgetcsv ( $handle, 1000, $delimiter )) !== FALSE ) {
1168
+		$data = array();
1169
+		if (($handle = fopen($filename, 'r')) !== FALSE) {
1170
+			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
1171 1171
 				
1172
-				if (! $header)
1172
+				if ( ! $header)
1173 1173
 					$header = $row;
1174 1174
 				else
1175
-					$data [] = array_combine ( $header, $row );
1175
+					$data [] = array_combine($header, $row);
1176 1176
 			}
1177 1177
 			
1178
-			fclose ( $handle );
1178
+			fclose($handle);
1179 1179
 		}
1180 1180
 		
1181 1181
 		return $data;
1182 1182
 	}
1183 1183
 	function utf8_converter($array) {
1184
-		array_walk_recursive ( $array, function (&$item, $key) {
1185
-			if (! mb_detect_encoding ( $item, 'utf-8', true )) {
1186
-				$item = utf8_encode ( $item );
1184
+		array_walk_recursive($array, function(&$item, $key) {
1185
+			if ( ! mb_detect_encoding($item, 'utf-8', true)) {
1186
+				$item = utf8_encode($item);
1187 1187
 			}
1188 1188
 		} );
1189 1189
 		return $array;
1190 1190
 	}
1191 1191
 	function termination_rate_mapper_preview_file() {
1192 1192
 		$invalid_flag = false;
1193
-		$check_header = $this->input->post ( 'check_header', true );
1194
-		$data ['page_title'] = gettext ( 'Import Termination Rates' );
1195
-		$new_final_arr_key = $this->config->item ( 'Termination-rates-field' );
1196
-		if (empty ( $_FILES ) || ! isset ( $_FILES )) {
1197
-			redirect ( base_url () . "rates/termination_rates_list/" );
1193
+		$check_header = $this->input->post('check_header', true);
1194
+		$data ['page_title'] = gettext('Import Termination Rates');
1195
+		$new_final_arr_key = $this->config->item('Termination-rates-field');
1196
+		if (empty ($_FILES) || ! isset ($_FILES)) {
1197
+			redirect(base_url()."rates/termination_rates_list/");
1198 1198
 		}
1199 1199
 		
1200 1200
 		$data ['mapto_fields'] = $new_final_arr_key;
1201 1201
 		
1202
-		if (isset ( $_FILES ['termination_rate_import_mapper'] ['name'] ) && $_FILES ['termination_rate_import_mapper'] ['name'] != "" && isset ( $_POST ['trunk_id'] ) && $_POST ['trunk_id'] != '') {
1203
-			list ( $txt, $ext ) = explode ( ".", $_FILES ['termination_rate_import_mapper'] ['name'] );
1202
+		if (isset ($_FILES ['termination_rate_import_mapper'] ['name']) && $_FILES ['termination_rate_import_mapper'] ['name'] != "" && isset ($_POST ['trunk_id']) && $_POST ['trunk_id'] != '') {
1203
+			list ($txt, $ext) = explode(".", $_FILES ['termination_rate_import_mapper'] ['name']);
1204 1204
 			if ($ext == "csv" && $_FILES ['termination_rate_import_mapper'] ['size'] > 0) {
1205 1205
 				$error = $_FILES ['termination_rate_import_mapper'] ['error'];
1206 1206
 				if ($error == 0) {
1207 1207
 					$uploadedFile = $_FILES ["termination_rate_import_mapper"] ["tmp_name"];
1208 1208
 					
1209
-					$file_data = $this->csv_to_array ( $uploadedFile );
1209
+					$file_data = $this->csv_to_array($uploadedFile);
1210 1210
 					
1211
-					$field_select = (array_keys ( $file_data [0] ));
1211
+					$field_select = (array_keys($file_data [0]));
1212 1212
 					
1213 1213
 					$data ['file_data'] = $field_select;
1214 1214
 					
1215 1215
 					// $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
1216 1216
 					
1217
-					$csv_data = $this->utf8_converter ( $this->csvreader->parse_file ( $uploadedFile, $field_select, $check_header ) );
1217
+					$csv_data = $this->utf8_converter($this->csvreader->parse_file($uploadedFile, $field_select, $check_header));
1218 1218
 					
1219
-					if (! empty ( $csv_data )) {
1220
-						$full_path = $this->config->item ( 'rates-file-path' );
1221
-						$actual_file_name = "ASTPP-TERMINATION-RATES-" . date ( "Y-m-d H:i:s" ) . "." . $ext;
1222
-						$actual_file_name = str_replace ( ' ', '-', $actual_file_name );
1223
-						$actual_file_name = str_replace ( ':', '-', $actual_file_name );
1219
+					if ( ! empty ($csv_data)) {
1220
+						$full_path = $this->config->item('rates-file-path');
1221
+						$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s").".".$ext;
1222
+						$actual_file_name = str_replace(' ', '-', $actual_file_name);
1223
+						$actual_file_name = str_replace(':', '-', $actual_file_name);
1224 1224
 						
1225
-						if (move_uploaded_file ( $uploadedFile, $full_path . $actual_file_name )) {
1226
-							$data ['field_select'] = serialize ( $field_select );
1225
+						if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
1226
+							$data ['field_select'] = serialize($field_select);
1227 1227
 							$data ['csv_tmp_data'] = $csv_data;
1228 1228
 							$data ['trunkid'] = $_POST ['trunk_id'];
1229 1229
 							$data ['check_header'] = $check_header;
1230
-							$data ['page_title'] = gettext ( 'Map CSV to Termination Rates' );
1231
-							$this->session->set_userdata ( 'import_termination_rate_mapper_csv', $actual_file_name );
1230
+							$data ['page_title'] = gettext('Map CSV to Termination Rates');
1231
+							$this->session->set_userdata('import_termination_rate_mapper_csv', $actual_file_name);
1232 1232
 						} else {
1233 1233
 							$data ['error'] = "File Uploading Fail Please Try Again";
1234 1234
 						}
@@ -1246,132 +1246,132 @@  discard block
 block discarded – undo
1246 1246
 		
1247 1247
 		if ($invalid_flag) {
1248 1248
 			$str = '';
1249
-			if (! isset ( $_POST ['trunk_id'] ) || empty ( $_POST ['trunk_id'] )) {
1249
+			if ( ! isset ($_POST ['trunk_id']) || empty ($_POST ['trunk_id'])) {
1250 1250
 				$str .= '<br/>Please Create Trunk.';
1251 1251
 			}
1252 1252
 			
1253
-			if (empty ( $_FILES ['termination_rate_import_mapper'] ['name'] )) {
1253
+			if (empty ($_FILES ['termination_rate_import_mapper'] ['name'])) {
1254 1254
 				$str .= '<br/>Please Select  File.';
1255 1255
 			}
1256 1256
 			
1257 1257
 			$data ['error'] = $str;
1258 1258
 		}
1259 1259
 		
1260
-		$this->load->view ( 'view_import_termination_rate_mapper', $data );
1260
+		$this->load->view('view_import_termination_rate_mapper', $data);
1261 1261
 	}
1262 1262
 	function termination_rate_rates_mapper_import() {
1263 1263
 		
1264 1264
 		// var_dump($this->input->post());
1265
-		$trunkID = $this->input->post ( "trunkid" );
1266
-		$check_header = $this->input->post ( "check_header" );
1267
-		$pattern_prefix = $this->input->post ( "pattern-prefix" );
1268
-		$filefields = unserialize ( $this->input->post ( "filefields" ) );
1269
-		$new_final_arr = array ();
1270
-		$invalid_array = array ();
1271
-		$new_final_arr_key = array ();
1272
-		foreach ( $filefields as $item ) {
1265
+		$trunkID = $this->input->post("trunkid");
1266
+		$check_header = $this->input->post("check_header");
1267
+		$pattern_prefix = $this->input->post("pattern-prefix");
1268
+		$filefields = unserialize($this->input->post("filefields"));
1269
+		$new_final_arr = array();
1270
+		$invalid_array = array();
1271
+		$new_final_arr_key = array();
1272
+		foreach ($filefields as $item) {
1273 1273
 			$new_final_arr_key [$item] = $item;
1274 1274
 		}
1275 1275
 		// $new_final_arr_key = $this->config->item('Termination-rates-field');
1276 1276
 		
1277
-		$screen_path = $this->config->item ( 'screen_path' );
1278
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
1279
-			$account_data = $this->session->userdata ( "accountinfo" );
1277
+		$screen_path = $this->config->item('screen_path');
1278
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
1279
+			$account_data = $this->session->userdata("accountinfo");
1280 1280
 		}
1281 1281
 		
1282
-		$full_path = $this->config->item ( 'rates-file-path' );
1283
-		$terminationrate_file_name = $this->session->userdata ( 'import_termination_rate_mapper_csv' );
1284
-		$csv_tmp_data = $this->csvreader->parse_file ( $full_path . $terminationrate_file_name, $new_final_arr_key, $check_header );
1282
+		$full_path = $this->config->item('rates-file-path');
1283
+		$terminationrate_file_name = $this->session->userdata('import_termination_rate_mapper_csv');
1284
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header);
1285 1285
 		
1286 1286
 		$i = 0;
1287
-		foreach ( $csv_tmp_data as $key => $csv_data ) {
1288
-			if (isset ( $csv_data [$this->input->post ( "pattern-select" )] ) && $csv_data [$this->input->post ( "pattern-select" )] != '' && $i != 0 && $i != 1) {
1287
+		foreach ($csv_tmp_data as $key => $csv_data) {
1288
+			if (isset ($csv_data [$this->input->post("pattern-select")]) && $csv_data [$this->input->post("pattern-select")] != '' && $i != 0 && $i != 1) {
1289 1289
 				$str = null;
1290
-				$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" )];
1291
-				$csv_data ['cost'] = ($this->input->post ( "cost-select" )) ? $csv_data [$this->input->post ( "cost-select" )] : "";
1292
-				$csv_data ['cost'] = ($this->input->post ( "cost-prefix" )) ? $this->input->post ( "cost-prefix" ) . $csv_data ['cost'] : $csv_data ['cost'];
1293
-				$csv_data ['prepend'] = ($this->input->post ( "prepend-select" )) ? $csv_data [$this->input->post ( "prepend-select" )] : "";
1294
-				$csv_data ['prepend'] = ($this->input->post ( "prepend-prefix" )) ? $this->input->post ( "prepend-prefix" ) . $csv_data ['prepend'] : $csv_data ['prepend'];
1295
-				$csv_data ['comment'] = ($this->input->post ( "comment-select" )) ? $csv_data [$this->input->post ( "comment-select" )] : "";
1296
-				$csv_data ['comment'] = ($this->input->post ( "comment-prefix" )) ? $this->input->post ( "comment-prefix" ) . $csv_data ['comment'] : $csv_data ['comment'];
1297
-				$csv_data ['connectcost'] = ($this->input->post ( "connectcost-select" )) ? $csv_data [$this->input->post ( "connectcost-select" )] : "0";
1298
-				$csv_data ['connectcost'] = ($this->input->post ( "connectcost-prefix" )) ? $this->input->post ( "connectcost-prefix" ) . $csv_data ['connectcost'] : $csv_data ['connectcost'];
1299
-				$csv_data ['includedseconds'] = ($this->input->post ( "includedseconds-select" )) ? $csv_data [$this->input->post ( "includedseconds-select" )] : "0";
1300
-				$csv_data ['includedseconds'] = ($this->input->post ( "includedseconds-prefix" )) ? $this->input->post ( "includedseconds-prefix" ) . $csv_data ['includedseconds'] : $csv_data ['includedseconds'];
1301
-				$csv_data ['inc'] = ($this->input->post ( "inc-select" )) ? $csv_data [$this->input->post ( "inc-select" )] : "0";
1302
-				$csv_data ['inc'] = ($this->input->post ( "inc-prefix" )) ? $this->input->post ( "inc-prefix" ) . $csv_data ['inc'] : $csv_data ['inc'];
1303
-				$csv_data ['precedence'] = ($this->input->post ( "precedence-select" )) ? $csv_data [$this->input->post ( "precedence-select" )] : "";
1304
-				$csv_data ['precedence'] = ($this->input->post ( "precedence-prefix" )) ? $this->input->post ( "precedence-prefix" ) . $csv_data ['precedence'] : $csv_data ['precedence'];
1305
-				$csv_data ['strip'] = ($this->input->post ( "strip-select" )) ? $csv_data [$this->input->post ( "strip-select" )] : "";
1306
-				$csv_data ['strip'] = ($this->input->post ( "strip-prefix" )) ? $this->input->post ( "strip-prefix" ) . $csv_data ['strip'] : $csv_data ['strip'];
1307
-				$csv_data ['last_modified_date'] = date ( "Y-m-d H:i:s" );
1308
-				$str = $this->data_validate ( $csv_data );
1290
+				$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")];
1291
+				$csv_data ['cost'] = ($this->input->post("cost-select")) ? $csv_data [$this->input->post("cost-select")] : "";
1292
+				$csv_data ['cost'] = ($this->input->post("cost-prefix")) ? $this->input->post("cost-prefix").$csv_data ['cost'] : $csv_data ['cost'];
1293
+				$csv_data ['prepend'] = ($this->input->post("prepend-select")) ? $csv_data [$this->input->post("prepend-select")] : "";
1294
+				$csv_data ['prepend'] = ($this->input->post("prepend-prefix")) ? $this->input->post("prepend-prefix").$csv_data ['prepend'] : $csv_data ['prepend'];
1295
+				$csv_data ['comment'] = ($this->input->post("comment-select")) ? $csv_data [$this->input->post("comment-select")] : "";
1296
+				$csv_data ['comment'] = ($this->input->post("comment-prefix")) ? $this->input->post("comment-prefix").$csv_data ['comment'] : $csv_data ['comment'];
1297
+				$csv_data ['connectcost'] = ($this->input->post("connectcost-select")) ? $csv_data [$this->input->post("connectcost-select")] : "0";
1298
+				$csv_data ['connectcost'] = ($this->input->post("connectcost-prefix")) ? $this->input->post("connectcost-prefix").$csv_data ['connectcost'] : $csv_data ['connectcost'];
1299
+				$csv_data ['includedseconds'] = ($this->input->post("includedseconds-select")) ? $csv_data [$this->input->post("includedseconds-select")] : "0";
1300
+				$csv_data ['includedseconds'] = ($this->input->post("includedseconds-prefix")) ? $this->input->post("includedseconds-prefix").$csv_data ['includedseconds'] : $csv_data ['includedseconds'];
1301
+				$csv_data ['inc'] = ($this->input->post("inc-select")) ? $csv_data [$this->input->post("inc-select")] : "0";
1302
+				$csv_data ['inc'] = ($this->input->post("inc-prefix")) ? $this->input->post("inc-prefix").$csv_data ['inc'] : $csv_data ['inc'];
1303
+				$csv_data ['precedence'] = ($this->input->post("precedence-select")) ? $csv_data [$this->input->post("precedence-select")] : "";
1304
+				$csv_data ['precedence'] = ($this->input->post("precedence-prefix")) ? $this->input->post("precedence-prefix").$csv_data ['precedence'] : $csv_data ['precedence'];
1305
+				$csv_data ['strip'] = ($this->input->post("strip-select")) ? $csv_data [$this->input->post("strip-select")] : "";
1306
+				$csv_data ['strip'] = ($this->input->post("strip-prefix")) ? $this->input->post("strip-prefix").$csv_data ['strip'] : $csv_data ['strip'];
1307
+				$csv_data ['last_modified_date'] = date("Y-m-d H:i:s");
1308
+				$str = $this->data_validate($csv_data);
1309 1309
 				if ($str != "") {
1310 1310
 					$invalid_array [$i] = $csv_data;
1311 1311
 					$invalid_array [$i] ['error'] = $str;
1312 1312
 				} else {
1313 1313
 					$new_final_arr [$i] ['trunk_id'] = $trunkID;
1314
-					$new_final_arr [$i] ['pattern'] = "^" . $csv_data ['pattern'] . ".*";
1314
+					$new_final_arr [$i] ['pattern'] = "^".$csv_data ['pattern'].".*";
1315 1315
 					$new_final_arr [$i] ['prepend'] = $csv_data ['prepend'];
1316 1316
 					$new_final_arr [$i] ['last_modified_date'] = $csv_data ['last_modified_date'];
1317 1317
 					$new_final_arr [$i] ['comment'] = $csv_data ['comment'];
1318 1318
 					$new_final_arr [$i] ['connectcost'] = $csv_data ['connectcost'];
1319 1319
 					$new_final_arr [$i] ['includedseconds'] = $csv_data ['includedseconds'];
1320
-					$new_final_arr [$i] ['cost'] = ! empty ( $csv_data ['cost'] ) && is_numeric ( $csv_data ['cost'] ) ? $csv_data ['cost'] : 0;
1321
-					$new_final_arr [$i] ['inc'] = isset ( $csv_data ['inc'] ) ? $csv_data ['inc'] : 0;
1322
-					$new_final_arr [$i] ['precedence'] = isset ( $csv_data ['precedence'] ) ? $csv_data ['precedence'] : '';
1323
-					$new_final_arr [$i] ['strip'] = isset ( $csv_data ['strip'] ) ? $csv_data ['strip'] : '';
1320
+					$new_final_arr [$i] ['cost'] = ! empty ($csv_data ['cost']) && is_numeric($csv_data ['cost']) ? $csv_data ['cost'] : 0;
1321
+					$new_final_arr [$i] ['inc'] = isset ($csv_data ['inc']) ? $csv_data ['inc'] : 0;
1322
+					$new_final_arr [$i] ['precedence'] = isset ($csv_data ['precedence']) ? $csv_data ['precedence'] : '';
1323
+					$new_final_arr [$i] ['strip'] = isset ($csv_data ['strip']) ? $csv_data ['strip'] : '';
1324 1324
 				}
1325 1325
 			}
1326 1326
 			
1327
-			$i ++;
1327
+			$i++;
1328 1328
 		}
1329 1329
 		// print_r($new_final_arr);exit;
1330
-		if (! empty ( $new_final_arr )) {
1331
-			$result = $this->rates_model->bulk_insert_termination_rate ( $new_final_arr );
1330
+		if ( ! empty ($new_final_arr)) {
1331
+			$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
1332 1332
 		} else {
1333 1333
 			
1334
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Error - Nothing selected to import/process!' );
1335
-			redirect ( base_url () . 'rates/termination_rates_list/' );
1334
+			$this->session->set_flashdata('astpp_errormsg', 'Error - Nothing selected to import/process!');
1335
+			redirect(base_url().'rates/termination_rates_list/');
1336 1336
 		}
1337 1337
 		
1338
-		unlink ( $full_path . $terminationrate_file_name );
1339
-		$count = count ( $invalid_array );
1338
+		unlink($full_path.$terminationrate_file_name);
1339
+		$count = count($invalid_array);
1340 1340
 		
1341 1341
 		if ($count > 0) {
1342 1342
 			$session_id = "-1";
1343
-			$fp = fopen ( $full_path . $session_id . '.csv', 'w' );
1344
-			foreach ( $new_final_arr_key as $key => $value ) {
1345
-				$custom_array [0] [$key] = ucfirst ( $key );
1343
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
1344
+			foreach ($new_final_arr_key as $key => $value) {
1345
+				$custom_array [0] [$key] = ucfirst($key);
1346 1346
 			}
1347 1347
 			
1348 1348
 			$custom_array [0] ['error'] = "Error";
1349
-			$invalid_array = array_merge ( $custom_array, $invalid_array );
1350
-			foreach ( $invalid_array as $err_data ) {
1351
-				fputcsv ( $fp, $err_data );
1349
+			$invalid_array = array_merge($custom_array, $invalid_array);
1350
+			foreach ($invalid_array as $err_data) {
1351
+				fputcsv($fp, $err_data);
1352 1352
 			}
1353 1353
 			
1354
-			fclose ( $fp );
1355
-			$this->session->set_userdata ( 'import_termination_rate_mapper_csv_error', $session_id . ".csv" );
1354
+			fclose($fp);
1355
+			$this->session->set_userdata('import_termination_rate_mapper_csv_error', $session_id.".csv");
1356 1356
 			$data ["error"] = $invalid_array;
1357 1357
 			$data ['trunkid'] = $trunkID;
1358
-			$data ['impoted_count'] = count ( $new_final_arr );
1359
-			$data ['failure_count'] = count ( $invalid_array ) - 1;
1360
-			$data ['page_title'] = gettext ( 'Termination Rates Import Error' );
1361
-			$this->load->view ( 'view_import_error', $data );
1358
+			$data ['impoted_count'] = count($new_final_arr);
1359
+			$data ['failure_count'] = count($invalid_array) - 1;
1360
+			$data ['page_title'] = gettext('Termination Rates Import Error');
1361
+			$this->load->view('view_import_error', $data);
1362 1362
 		} else {
1363
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Total ' . count ( $new_final_arr ) . ' Termination rates imported successfully!' );
1363
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
1364 1364
 			
1365
-			redirect ( base_url () . "rates/termination_rates_list/" );
1365
+			redirect(base_url()."rates/termination_rates_list/");
1366 1366
 		}
1367 1367
 	}
1368 1368
 	function termination_rate_mapper_error_download() {
1369
-		$this->load->helper ( 'download' );
1370
-		$error_data = $this->session->userdata ( 'import_termination_rate_mapper_csv_error' );
1369
+		$this->load->helper('download');
1370
+		$error_data = $this->session->userdata('import_termination_rate_mapper_csv_error');
1371 1371
 		
1372
-		$full_path = $this->config->item ( 'rates-file-path' );
1373
-		$data = file_get_contents ( $full_path . $error_data );
1374
-		force_download ( "Termination_rate_mapper_error.csv", $data );
1372
+		$full_path = $this->config->item('rates-file-path');
1373
+		$data = file_get_contents($full_path.$error_data);
1374
+		force_download("Termination_rate_mapper_error.csv", $data);
1375 1375
 	}
1376 1376
 /**
1377 1377
  * **********************
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/libraries/rates_form.php 1 patch
Spacing   +418 added lines, -418 removed lines patch added patch discarded remove patch
@@ -20,26 +20,26 @@  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' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class rates_form {
26 26
 	function __construct($library_name = '') {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	function get_termination_rate_form_fields() {
30
-		$form ['forms'] = array (
31
-				base_url () . 'rates/termination_rate_save/',
32
-				array (
30
+		$form ['forms'] = array(
31
+				base_url().'rates/termination_rate_save/',
32
+				array(
33 33
 						'id' => 'termination_rate_form',
34 34
 						'method' => 'POST',
35 35
 						'name' => 'termination_rate_form' 
36 36
 				) 
37 37
 		);
38
-		$form [gettext ( 'Rate Information' )] = array (
39
-				array (
38
+		$form [gettext('Rate Information')] = array(
39
+				array(
40 40
 						'',
41 41
 						'HIDDEN',
42
-						array (
42
+						array(
43 43
 								'name' => 'id' 
44 44
 						),
45 45
 						'',
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 						'',
48 48
 						'' 
49 49
 				),
50
-				array (
51
-						gettext ( 'Trunk' ),
50
+				array(
51
+						gettext('Trunk'),
52 52
 						'trunk_id',
53 53
 						'SELECT',
54 54
 						'',
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 						'trunks',
61 61
 						'build_dropdown',
62 62
 						'where_arr',
63
-						array (
63
+						array(
64 64
 								"status" => "0" 
65 65
 						) 
66 66
 				),
67
-				array (
68
-						gettext ( 'Code' ),
67
+				array(
68
+						gettext('Code'),
69 69
 						'INPUT',
70
-						array (
70
+						array(
71 71
 								'name' => 'pattern',
72 72
 								'size' => '20',
73 73
 								'class' => "text field medium" 
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 						'tOOL TIP',
77 77
 						'' 
78 78
 				),
79
-				array (
80
-						gettext ( 'Destination' ),
79
+				array(
80
+						gettext('Destination'),
81 81
 						'INPUT',
82
-						array (
82
+						array(
83 83
 								'name' => 'comment',
84 84
 								'size' => '20',
85 85
 								'class' => "text field medium" 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 						'tOOL TIP',
88 88
 						'' 
89 89
 				),
90
-				array (
91
-						gettext ( 'Strip' ),
90
+				array(
91
+						gettext('Strip'),
92 92
 						'INPUT',
93
-						array (
93
+						array(
94 94
 								'name' => 'strip',
95 95
 								'size' => '20',
96 96
 								'class' => "text field medium" 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 						'tOOL TIP',
100 100
 						'' 
101 101
 				),
102
-				array (
103
-						gettext ( 'Prepend' ),
102
+				array(
103
+						gettext('Prepend'),
104 104
 						'INPUT',
105
-						array (
105
+						array(
106 106
 								'name' => 'prepend',
107 107
 								'size' => '20',
108 108
 								'class' => "text field medium" 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 						'tOOL TIP',
112 112
 						'' 
113 113
 				),
114
-				array (
115
-						gettext ( 'Status' ),
114
+				array(
115
+						gettext('Status'),
116 116
 						'status',
117 117
 						'SELECT',
118 118
 						'',
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 				) 
127 127
 		)
128 128
 		;
129
-		$form [gettext ( 'Billing Information' )] = array (
130
-				array (
131
-						gettext ( 'Connect Cost' ),
129
+		$form [gettext('Billing Information')] = array(
130
+				array(
131
+						gettext('Connect Cost'),
132 132
 						'INPUT',
133
-						array (
133
+						array(
134 134
 								'name' => 'connectcost',
135 135
 								'size' => '20',
136 136
 								'class' => "text field medium" 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 						'tOOL TIP',
140 140
 						'' 
141 141
 				),
142
-				array (
143
-						gettext ( 'Included Seconds' ),
142
+				array(
143
+						gettext('Included Seconds'),
144 144
 						'INPUT',
145
-						array (
145
+						array(
146 146
 								'name' => 'includedseconds',
147 147
 								'size' => '20',
148 148
 								'class' => "text field medium" 
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 						'tOOL TIP',
152 152
 						'' 
153 153
 				),
154
-				array (
155
-						gettext ( 'Per Minute Cost' ),
154
+				array(
155
+						gettext('Per Minute Cost'),
156 156
 						'INPUT',
157
-						array (
157
+						array(
158 158
 								'name' => 'cost',
159 159
 								'size' => '20',
160 160
 								'class' => "text field medium" 
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 				 * For Add Initial Increment field
169 169
 				 * *
170 170
 				 */
171
-				array (
172
-						gettext ( 'Initial Increment' ),
171
+				array(
172
+						gettext('Initial Increment'),
173 173
 						'INPUT',
174
-						array (
174
+						array(
175 175
 								'name' => 'init_inc',
176 176
 								'size' => '20',
177 177
 								'class' => "text field medium" 
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 				/**
184 184
 				 * ****************************************************
185 185
 				 */
186
-				array (
187
-						gettext ( 'Increment' ),
186
+				array(
187
+						gettext('Increment'),
188 188
 						'INPUT',
189
-						array (
189
+						array(
190 190
 								'name' => 'inc',
191 191
 								'size' => '20',
192 192
 								'class' => "text field medium" 
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 						'tOOL TIP',
196 196
 						'' 
197 197
 				),
198
-				array (
199
-						gettext ( 'Priority' ),
198
+				array(
199
+						gettext('Priority'),
200 200
 						'INPUT',
201
-						array (
201
+						array(
202 202
 								'name' => 'precedence',
203 203
 								'size' => '20',
204 204
 								'class' => "text field medium" 
@@ -209,17 +209,17 @@  discard block
 block discarded – undo
209 209
 				) 
210 210
 		);
211 211
 		
212
-		$form ['button_cancel'] = array (
212
+		$form ['button_cancel'] = array(
213 213
 				'name' => 'action',
214
-				'content' => gettext ( 'Close' ),
214
+				'content' => gettext('Close'),
215 215
 				'value' => 'cancel',
216 216
 				'type' => 'button',
217 217
 				'class' => 'btn btn-line-sky margin-x-10',
218 218
 				'onclick' => 'return redirect_page(\'NULL\')' 
219 219
 		);
220
-		$form ['button_save'] = array (
220
+		$form ['button_save'] = array(
221 221
 				'name' => 'action',
222
-				'content' => gettext ( 'Save' ),
222
+				'content' => gettext('Save'),
223 223
 				'value' => 'save',
224 224
 				'id' => 'submit',
225 225
 				'type' => 'button',
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 		return $form;
230 230
 	}
231 231
 	function get_origination_rate_form_fields() {
232
-		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
232
+		$logintype = $this->CI->session->userdata('userlevel_logintype');
233 233
 		$trunk = null;
234 234
 		if ($logintype != 1)
235
-			$trunk = array (
235
+			$trunk = array(
236 236
 					'Force Trunk',
237 237
 					'trunk_id',
238 238
 					'SELECT',
@@ -245,23 +245,23 @@  discard block
 block discarded – undo
245 245
 					'trunks',
246 246
 					'build_dropdown',
247 247
 					'where_arr',
248
-					array (
248
+					array(
249 249
 							"status" => "0" 
250 250
 					) 
251 251
 			);
252
-		$form ['forms'] = array (
253
-				base_url () . 'rates/origination_rate_save/',
254
-				array (
252
+		$form ['forms'] = array(
253
+				base_url().'rates/origination_rate_save/',
254
+				array(
255 255
 						'id' => 'origination_rate_form',
256 256
 						'method' => 'POST',
257 257
 						'name' => 'origination_rate_form' 
258 258
 				) 
259 259
 		);
260
-		$form [gettext ( 'Rate Information' )] = array (
261
-				array (
260
+		$form [gettext('Rate Information')] = array(
261
+				array(
262 262
 						'',
263 263
 						'HIDDEN',
264
-						array (
264
+						array(
265 265
 								'name' => 'id' 
266 266
 						),
267 267
 						'',
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 						'',
270 270
 						'' 
271 271
 				),
272
-				array (
273
-						gettext ( 'Rate Group' ),
272
+				array(
273
+						gettext('Rate Group'),
274 274
 						'pricelist_id',
275 275
 						'SELECT',
276 276
 						'',
@@ -282,15 +282,15 @@  discard block
 block discarded – undo
282 282
 						'pricelists',
283 283
 						'build_dropdown',
284 284
 						'where_arr',
285
-						array (
285
+						array(
286 286
 								"status" => "0",
287 287
 								'reseller_id' => 0 
288 288
 						) 
289 289
 				),
290
-				array (
291
-						gettext ( 'Code' ),
290
+				array(
291
+						gettext('Code'),
292 292
 						'INPUT',
293
-						array (
293
+						array(
294 294
 								'name' => 'pattern',
295 295
 								'size' => '20',
296 296
 								'class' => "text field medium" 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 						'tOOL TIP',
300 300
 						'' 
301 301
 				),
302
-				array (
303
-						gettext ( 'Destination' ),
302
+				array(
303
+						gettext('Destination'),
304 304
 						'INPUT',
305
-						array (
305
+						array(
306 306
 								'name' => 'comment',
307 307
 								'size' => '20',
308 308
 								'class' => "text field medium" 
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 						'' 
312 312
 				),
313 313
 				// array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
314
-				array (
315
-						gettext ( 'Status' ),
314
+				array(
315
+						gettext('Status'),
316 316
 						'status',
317 317
 						'SELECT',
318 318
 						'',
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 				) 
327 327
 		)
328 328
 		;
329
-		$form [gettext ( 'Billing Information' )] = array (
330
-				array (
331
-						gettext ( 'Connect Cost' ),
329
+		$form [gettext('Billing Information')] = array(
330
+				array(
331
+						gettext('Connect Cost'),
332 332
 						'INPUT',
333
-						array (
333
+						array(
334 334
 								'name' => 'connectcost',
335 335
 								'size' => '20',
336 336
 								'class' => "text field medium" 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 						'tOOL TIP',
340 340
 						'' 
341 341
 				),
342
-				array (
343
-						gettext ( 'Included Seconds' ),
342
+				array(
343
+						gettext('Included Seconds'),
344 344
 						'INPUT',
345
-						array (
345
+						array(
346 346
 								'name' => 'includedseconds',
347 347
 								'size' => '20',
348 348
 								'class' => "text field medium" 
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
 						'tOOL TIP',
352 352
 						'' 
353 353
 				),
354
-				array (
355
-						gettext ( 'Per Minute Cost' ),
354
+				array(
355
+						gettext('Per Minute Cost'),
356 356
 						'INPUT',
357
-						array (
357
+						array(
358 358
 								'name' => 'cost',
359 359
 								'size' => '20',
360 360
 								'class' => "text field medium" 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 				 * For Add Initial Increment field
369 369
 				 * *
370 370
 				 */
371
-				array (
372
-						gettext ( 'Initial Increment' ),
371
+				array(
372
+						gettext('Initial Increment'),
373 373
 						'INPUT',
374
-						array (
374
+						array(
375 375
 								'name' => 'init_inc',
376 376
 								'size' => '20',
377 377
 								'class' => "text field medium" 
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
 				/**
384 384
 				 * *****************************************************************
385 385
 				 */
386
-				array (
387
-						gettext ( 'Increment' ),
386
+				array(
387
+						gettext('Increment'),
388 388
 						'INPUT',
389
-						array (
389
+						array(
390 390
 								'name' => 'inc',
391 391
 								'size' => '20',
392 392
 								'class' => "text field medium" 
@@ -398,17 +398,17 @@  discard block
 block discarded – undo
398 398
 				 $trunk,
399 399
 		);
400 400
 		
401
-		$form ['button_cancel'] = array (
401
+		$form ['button_cancel'] = array(
402 402
 				'name' => 'action',
403
-				'content' => gettext ( 'Close' ),
403
+				'content' => gettext('Close'),
404 404
 				'value' => 'cancel',
405 405
 				'type' => 'button',
406 406
 				'class' => 'btn btn-line-sky margin-x-10',
407 407
 				'onclick' => 'return redirect_page(\'NULL\')' 
408 408
 		);
409
-		$form ['button_save'] = array (
409
+		$form ['button_save'] = array(
410 410
 				'name' => 'action',
411
-				'content' => gettext ( 'Save' ),
411
+				'content' => gettext('Save'),
412 412
 				'value' => 'save',
413 413
 				'id' => 'submit',
414 414
 				'type' => 'button',
@@ -418,18 +418,18 @@  discard block
 block discarded – undo
418 418
 		return $form;
419 419
 	}
420 420
 	function get_termination_rate_search_form() {
421
-		$form ['forms'] = array (
421
+		$form ['forms'] = array(
422 422
 				"",
423
-				array (
423
+				array(
424 424
 						'id' => "termination_rate_search" 
425 425
 				) 
426 426
 		);
427
-		$form [gettext ( 'Search' )] = array (
427
+		$form [gettext('Search')] = array(
428 428
 				
429
-				array (
430
-						gettext ( 'Code' ),
429
+				array(
430
+						gettext('Code'),
431 431
 						'INPUT',
432
-						array (
432
+						array(
433 433
 								'name' => 'pattern[pattern]',
434 434
 								'',
435 435
 								'size' => '20',
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
 						'search_string_type',
446 446
 						'' 
447 447
 				),
448
-				array (
449
-						gettext ( 'Destination' ),
448
+				array(
449
+						gettext('Destination'),
450 450
 						'INPUT',
451
-						array (
451
+						array(
452 452
 								'name' => 'comment[comment]',
453 453
 								'',
454 454
 								'size' => '20',
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 						'search_string_type',
465 465
 						'' 
466 466
 				),
467
-				array (
468
-						gettext ( 'Connect Cost' ),
467
+				array(
468
+						gettext('Connect Cost'),
469 469
 						'INPUT',
470
-						array (
470
+						array(
471 471
 								'name' => 'connectcost[connectcost]',
472 472
 								'value' => '',
473 473
 								'size' => '20',
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
 						'search_int_type',
484 484
 						'' 
485 485
 				),
486
-				array (
487
-						gettext ( 'Included Seconds' ),
486
+				array(
487
+						gettext('Included Seconds'),
488 488
 						'INPUT',
489
-						array (
489
+						array(
490 490
 								'name' => 'includedseconds[includedseconds]',
491 491
 								'value' => '',
492 492
 								'size' => '20',
@@ -502,10 +502,10 @@  discard block
 block discarded – undo
502 502
 						'search_int_type',
503 503
 						'' 
504 504
 				),
505
-				array (
506
-						gettext ( 'Per Minute Cost' ),
505
+				array(
506
+						gettext('Per Minute Cost'),
507 507
 						'INPUT',
508
-						array (
508
+						array(
509 509
 								'name' => 'cost[cost]',
510 510
 								'value' => '',
511 511
 								'size' => '20',
@@ -526,10 +526,10 @@  discard block
 block discarded – undo
526 526
 				 * For Add Initial Increment field
527 527
 				 * *
528 528
 				 */
529
-				array (
530
-						gettext ( 'Initial Increment' ),
529
+				array(
530
+						gettext('Initial Increment'),
531 531
 						'INPUT',
532
-						array (
532
+						array(
533 533
 								'name' => 'init_inc[init_inc]',
534 534
 								'',
535 535
 								'size' => '20',
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
 				/**
549 549
 				 * ************************************************************
550 550
 				 */
551
-				array (
552
-						gettext ( 'Increment' ),
551
+				array(
552
+						gettext('Increment'),
553 553
 						'INPUT',
554
-						array (
554
+						array(
555 555
 								'name' => 'inc[inc]',
556 556
 								'',
557 557
 								'size' => '20',
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
 						'search_int_type',
568 568
 						'' 
569 569
 				),
570
-				array (
571
-						gettext ( 'Priority' ),
570
+				array(
571
+						gettext('Priority'),
572 572
 						'INPUT',
573
-						array (
573
+						array(
574 574
 								'name' => 'prepend[prepend]',
575 575
 								'',
576 576
 								'size' => '20',
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 						'search_string_type',
587 587
 						'' 
588 588
 				),
589
-				array (
590
-						gettext ( 'Trunk' ),
589
+				array(
590
+						gettext('Trunk'),
591 591
 						'trunk_id',
592 592
 						'SELECT',
593 593
 						'',
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
 						'trunks',
600 600
 						'build_dropdown',
601 601
 						'where_arr',
602
-						array (
602
+						array(
603 603
 								"status" => "0" 
604 604
 						) 
605 605
 				),				
606
-				array (
607
-						gettext ( 'Status' ),
606
+				array(
607
+						gettext('Status'),
608 608
 						'status',
609 609
 						'SELECT',
610 610
 						'',
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 				 * Batch Delete
625 625
 				 * *****
626 626
 				 */
627
-				array (
627
+				array(
628 628
 						'',
629 629
 						'HIDDEN',
630 630
 						'ajax_search',
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 				/**
637 637
 				 * *********************
638 638
 				 */
639
-				array (
639
+				array(
640 640
 						'',
641 641
 						'HIDDEN',
642 642
 						'advance_search',
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 		 * Batch Delete
654 654
 		 * *****
655 655
 		 */
656
-		$form ['button_search_delete'] = array (
656
+		$form ['button_search_delete'] = array(
657 657
 				'name' => 'action',
658 658
 				'id' => "termination_rate_batch_dlt",
659 659
 				'onclick' => "check_btn();",
660
-				'content' => gettext ( 'Delete Search Record' ),
660
+				'content' => gettext('Delete Search Record'),
661 661
 				'style' => 'display:none;',
662 662
 				'value' => 'submit',
663 663
 				'type' => 'button',
@@ -673,11 +673,11 @@  discard block
 block discarded – undo
673 673
 		 * Batch Delete
674 674
 		 * *****
675 675
 		 */
676
-		$form ['button_search'] = array (
676
+		$form ['button_search'] = array(
677 677
 				'name' => 'action',
678 678
 				'id' => "termination_rate_search_btn",
679 679
 				'onclick' => 'search_btn();',
680
-				'content' => gettext ( 'Search' ),
680
+				'content' => gettext('Search'),
681 681
 				'value' => 'save',
682 682
 				'type' => 'button',
683 683
 				'class' => 'btn btn-line-parrot pull-right margin-x-10' 
@@ -685,10 +685,10 @@  discard block
 block discarded – undo
685 685
 		/**
686 686
 		 * ********************
687 687
 		 */
688
-		$form ['button_reset'] = array (
688
+		$form ['button_reset'] = array(
689 689
 				'name' => 'action',
690 690
 				'id' => "id_reset",
691
-				'content' => gettext ( 'Clear' ),
691
+				'content' => gettext('Clear'),
692 692
 				'value' => 'cancel',
693 693
 				'type' => 'reset',
694 694
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -697,17 +697,17 @@  discard block
 block discarded – undo
697 697
 		return $form;
698 698
 	}
699 699
 	function termination_rate_batch_update_form() {
700
-		$form ['forms'] = array (
700
+		$form ['forms'] = array(
701 701
 				"rates/termination_rate_batch_update/",
702
-				array (
702
+				array(
703 703
 						'id' => "termination_rate_batch_update" 
704 704
 				) 
705 705
 		);
706
-		$form ['Batch Update'] = array (
707
-				array (
708
-						gettext ( 'Connect Cost' ),
706
+		$form ['Batch Update'] = array(
707
+				array(
708
+						gettext('Connect Cost'),
709 709
 						'INPUT',
710
-						array (
710
+						array(
711 711
 								'name' => 'connectcost[connectcost]',
712 712
 								'id' => 'connectcost',
713 713
 								'value' => '',
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 						'',
718 718
 						'Tool tips info',
719 719
 						'1',
720
-						array (
720
+						array(
721 721
 								'name' => 'connectcost[operator]',
722 722
 								'class' => 'update_drp' 
723 723
 						),
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
 						'update_int_type',
728 728
 						'' 
729 729
 				),
730
-				array (
731
-						gettext ( 'Included Seconds' ),
730
+				array(
731
+						gettext('Included Seconds'),
732 732
 						'INPUT',
733
-						array (
733
+						array(
734 734
 								'name' => 'includedseconds[includedseconds]',
735 735
 								'id' => 'includedseconds',
736 736
 								'value' => '',
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 						'',
741 741
 						'Tool tips info',
742 742
 						'1',
743
-						array (
743
+						array(
744 744
 								'name' => 'includedseconds[operator]',
745 745
 								'class' => 'update_drp' 
746 746
 						),
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
 						'update_int_type',
751 751
 						'' 
752 752
 				),
753
-				array (
754
-						gettext ( 'Per Minute Cost' ),
753
+				array(
754
+						gettext('Per Minute Cost'),
755 755
 						'INPUT',
756
-						array (
756
+						array(
757 757
 								'name' => 'cost[cost]',
758 758
 								'id' => 'cost',
759 759
 								'value' => '',
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 						'',
764 764
 						'Tool tips info',
765 765
 						'1',
766
-						array (
766
+						array(
767 767
 								'name' => 'cost[operator]',
768 768
 								'class' => 'update_drp' 
769 769
 						),
@@ -774,10 +774,10 @@  discard block
 block discarded – undo
774 774
 						'' 
775 775
 				),
776 776
 				
777
-				array (
778
-						gettext ( 'Increment' ),
777
+				array(
778
+						gettext('Increment'),
779 779
 						'INPUT',
780
-						array (
780
+						array(
781 781
 								'name' => 'inc[inc]',
782 782
 								'id' => 'inc',
783 783
 								'size' => '20',
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 						'',
787 787
 						'tOOL TIP',
788 788
 						'1',
789
-						array (
789
+						array(
790 790
 								'name' => 'inc[operator]',
791 791
 								'class' => 'update_drp' 
792 792
 						),
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
 						'update_int_type',
797 797
 						'' 
798 798
 				),
799
-				array (
800
-						gettext ( 'Priority' ),
799
+				array(
800
+						gettext('Priority'),
801 801
 						'INPUT',
802
-						array (
802
+						array(
803 803
 								'name' => 'precedence[precedence]',
804 804
 								'id' => 'precedence',
805 805
 								'size' => '20',
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 						'',
809 809
 						'tOOL TIP',
810 810
 						'1',
811
-						array (
811
+						array(
812 812
 								'name' => 'precedence[operator]',
813 813
 								'class' => 'update_drp' 
814 814
 						),
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
 						'update_drp_type',
819 819
 						'' 
820 820
 				),
821
-				array (
822
-						gettext ( 'Prepand' ),
821
+				array(
822
+						gettext('Prepand'),
823 823
 						'INPUT',
824
-						array (
824
+						array(
825 825
 								'name' => 'prepend[prepend]',
826 826
 								'id' => 'prepend',
827 827
 								'size' => '20',
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 						'',
831 831
 						'tOOL TIP',
832 832
 						'1',
833
-						array (
833
+						array(
834 834
 								'name' => 'prepend[operator]',
835 835
 								'class' => 'update_drp' 
836 836
 						),
@@ -843,18 +843,18 @@  discard block
 block discarded – undo
843 843
 		)
844 844
 		;
845 845
 		
846
-		$form ['button_search'] = array (
846
+		$form ['button_search'] = array(
847 847
 				'name' => 'action',
848 848
 				'id' => "batch_update_btn",
849
-				'content' => gettext ( 'Update' ),
849
+				'content' => gettext('Update'),
850 850
 				'value' => 'save',
851 851
 				'type' => 'button',
852 852
 				'class' => 'btn btn-line-parrot pull-right' 
853 853
 		);
854
-		$form ['button_reset'] = array (
854
+		$form ['button_reset'] = array(
855 855
 				'name' => 'action',
856 856
 				'id' => "id_batch_reset",
857
-				'content' => gettext ( 'Clear' ),
857
+				'content' => gettext('Clear'),
858 858
 				'value' => 'cancel',
859 859
 				'type' => 'reset',
860 860
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -863,12 +863,12 @@  discard block
 block discarded – undo
863 863
 		return $form;
864 864
 	}
865 865
 	function origination_rate_batch_update_form() {
866
-		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
866
+		$logintype = $this->CI->session->userdata('userlevel_logintype');
867 867
 		$trunk = null;
868 868
 		if ($logintype != 1)
869
-			$trunk = array (
869
+			$trunk = array(
870 870
 					'Force Trunk',
871
-					array (
871
+					array(
872 872
 							'name' => 'trunk_id[trunk_id]',
873 873
 							'id' => 'trunk_id' 
874 874
 					),
@@ -882,26 +882,26 @@  discard block
 block discarded – undo
882 882
 					'trunks',
883 883
 					'build_dropdown',
884 884
 					'where_arr',
885
-					array (
885
+					array(
886 886
 							"status" => "0" 
887 887
 					),
888
-					array (
888
+					array(
889 889
 							'name' => 'trunk_id[operator]',
890 890
 							'class' => 'update_drp' 
891 891
 					),
892 892
 					'update_drp_type' 
893 893
 			);
894
-		$form ['forms'] = array (
894
+		$form ['forms'] = array(
895 895
 				"rates/origination_rate_batch_update/",
896
-				array (
896
+				array(
897 897
 						'id' => "origination_rate_batch_update" 
898 898
 				) 
899 899
 		);
900
-		$form [gettext ( 'Batch Update' )] = array (
901
-				array (
902
-						gettext ( 'Connect Cost' ),
900
+		$form [gettext('Batch Update')] = array(
901
+				array(
902
+						gettext('Connect Cost'),
903 903
 						'INPUT',
904
-						array (
904
+						array(
905 905
 								'name' => 'connectcost[connectcost]',
906 906
 								'id' => 'connectcost',
907 907
 								'value' => '',
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 						'',
912 912
 						'Tool tips info',
913 913
 						'1',
914
-						array (
914
+						array(
915 915
 								'name' => 'connectcost[operator]',
916 916
 								'class' => 'update_drp' 
917 917
 						),
@@ -921,10 +921,10 @@  discard block
 block discarded – undo
921 921
 						'update_int_type',
922 922
 						'' 
923 923
 				),
924
-				array (
925
-						gettext ( 'Included Seconds' ),
924
+				array(
925
+						gettext('Included Seconds'),
926 926
 						'INPUT',
927
-						array (
927
+						array(
928 928
 								'name' => 'includedseconds[includedseconds]',
929 929
 								'id' => 'includedseconds',
930 930
 								'value' => '',
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 						'',
935 935
 						'Tool tips info',
936 936
 						'1',
937
-						array (
937
+						array(
938 938
 								'name' => 'includedseconds[operator]',
939 939
 								'class' => 'update_drp' 
940 940
 						),
@@ -944,10 +944,10 @@  discard block
 block discarded – undo
944 944
 						'update_int_type',
945 945
 						'' 
946 946
 				),
947
-				array (
948
-						gettext ( 'Per Minute Cost' ),
947
+				array(
948
+						gettext('Per Minute Cost'),
949 949
 						'INPUT',
950
-						array (
950
+						array(
951 951
 								'name' => 'cost[cost]',
952 952
 								'id' => 'cost',
953 953
 								'value' => '',
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 						'',
958 958
 						'Tool tips info',
959 959
 						'1',
960
-						array (
960
+						array(
961 961
 								'name' => 'cost[operator]',
962 962
 								'class' => 'update_drp' 
963 963
 						),
@@ -967,10 +967,10 @@  discard block
 block discarded – undo
967 967
 						'update_int_type',
968 968
 						'' 
969 969
 				),
970
-				array (
971
-						gettext ( 'Increment' ),
970
+				array(
971
+						gettext('Increment'),
972 972
 						'INPUT',
973
-						array (
973
+						array(
974 974
 								'name' => 'inc[inc]',
975 975
 								'id' => 'inc',
976 976
 								'size' => '20',
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 						'',
980 980
 						'tOOL TIP',
981 981
 						'1',
982
-						array (
982
+						array(
983 983
 								'name' => 'inc[operator]',
984 984
 								'class' => 'update_drp' 
985 985
 						),
@@ -993,18 +993,18 @@  discard block
 block discarded – undo
993 993
 				$trunk 
994 994
 		);
995 995
 		
996
-		$form ['button_search'] = array (
996
+		$form ['button_search'] = array(
997 997
 				'name' => 'action',
998 998
 				'id' => "batch_update",
999
-				'content' => gettext ( 'Update' ),
999
+				'content' => gettext('Update'),
1000 1000
 				'value' => 'save',
1001 1001
 				'type' => 'button',
1002 1002
 				'class' => 'btn btn-line-parrot pull-right' 
1003 1003
 		);
1004
-		$form ['button_reset'] = array (
1004
+		$form ['button_reset'] = array(
1005 1005
 				'name' => 'action',
1006 1006
 				'id' => "id_batch_reset",
1007
-				'content' => gettext ( 'Clear' ),
1007
+				'content' => gettext('Clear'),
1008 1008
 				'value' => 'cancel',
1009 1009
 				'type' => 'reset',
1010 1010
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -1013,13 +1013,13 @@  discard block
 block discarded – undo
1013 1013
 		return $form;
1014 1014
 	}
1015 1015
 	function build_rates_list_for_reseller() {
1016
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1016
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1017 1017
 		$currency_id = $account_info ['currency_id'];
1018
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1018
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1019 1019
 		
1020
-		$grid_field_arr = json_encode ( array (
1021
-				array (
1022
-						gettext ( 'Code' ),
1020
+		$grid_field_arr = json_encode(array(
1021
+				array(
1022
+						gettext('Code'),
1023 1023
 						"140",
1024 1024
 						"pattern",
1025 1025
 						"pattern",
@@ -1029,16 +1029,16 @@  discard block
 block discarded – undo
1029 1029
 						"true",
1030 1030
 						"center" 
1031 1031
 				),
1032
-				array (
1033
-						gettext ( 'Destination' ),
1032
+				array(
1033
+						gettext('Destination'),
1034 1034
 						"240",
1035 1035
 						"comment",
1036 1036
 						"",
1037 1037
 						"",
1038 1038
 						"" 
1039 1039
 				),
1040
-				array (
1041
-						gettext ( 'Connection Cost(' . $currency . ')' ),
1040
+				array(
1041
+						gettext('Connection Cost('.$currency.')'),
1042 1042
 						"210",
1043 1043
 						"connectcost",
1044 1044
 						"connectcost",
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
 						"true",
1049 1049
 						"right" 
1050 1050
 				),
1051
-				array (
1052
-						gettext ( 'Included Seconds' ),
1051
+				array(
1052
+						gettext('Included Seconds'),
1053 1053
 						"180",
1054 1054
 						"includedseconds",
1055 1055
 						"",
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 						"true",
1060 1060
 						"center" 
1061 1061
 				),
1062
-				array (
1063
-						gettext ( 'Per Minute Cost(' . $currency . ')' ),
1062
+				array(
1063
+						gettext('Per Minute Cost('.$currency.')'),
1064 1064
 						"180",
1065 1065
 						"cost",
1066 1066
 						"cost",
@@ -1070,8 +1070,8 @@  discard block
 block discarded – undo
1070 1070
 						"true",
1071 1071
 						"right" 
1072 1072
 				),
1073
-				array (
1074
-						gettext ( 'Increment' ),
1073
+				array(
1074
+						gettext('Increment'),
1075 1075
 						"140",
1076 1076
 						"inc",
1077 1077
 						"",
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
 						"true",
1082 1082
 						"center" 
1083 1083
 				),
1084
-				array (
1085
-						gettext ( 'Priority' ),
1084
+				array(
1085
+						gettext('Priority'),
1086 1086
 						"155",
1087 1087
 						"precedence",
1088 1088
 						"",
@@ -1092,24 +1092,24 @@  discard block
 block discarded – undo
1092 1092
 						"true",
1093 1093
 						"center" 
1094 1094
 				) 
1095
-		) );
1095
+		));
1096 1096
 		return $grid_field_arr;
1097 1097
 	}
1098 1098
 	function get_reseller_origination_rate_search_form() {
1099
-		$accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1099
+		$accountinfo = $this->CI->session->userdata('accountinfo');
1100 1100
 		
1101
-		$form ['forms'] = array (
1101
+		$form ['forms'] = array(
1102 1102
 				"",
1103
-				array (
1103
+				array(
1104 1104
 						'id' => "resellerrates_list_search" 
1105 1105
 				) 
1106 1106
 		);
1107
-		$form [gettext ( 'Search My Rates' )] = array (
1107
+		$form [gettext('Search My Rates')] = array(
1108 1108
 				
1109
-				array (
1110
-						gettext ( 'Code' ),
1109
+				array(
1110
+						gettext('Code'),
1111 1111
 						'INPUT',
1112
-						array (
1112
+						array(
1113 1113
 								'name' => 'pattern[pattern]',
1114 1114
 								'',
1115 1115
 								'size' => '20',
@@ -1125,10 +1125,10 @@  discard block
 block discarded – undo
1125 1125
 						'search_string_type',
1126 1126
 						'' 
1127 1127
 				),
1128
-				array (
1129
-						gettext ( 'Destination' ),
1128
+				array(
1129
+						gettext('Destination'),
1130 1130
 						'INPUT',
1131
-						array (
1131
+						array(
1132 1132
 								'name' => 'comment[comment]',
1133 1133
 								'',
1134 1134
 								'size' => '20',
@@ -1144,10 +1144,10 @@  discard block
 block discarded – undo
1144 1144
 						'search_string_type',
1145 1145
 						'' 
1146 1146
 				),
1147
-				array (
1148
-						gettext ( 'Connect Cost' ),
1147
+				array(
1148
+						gettext('Connect Cost'),
1149 1149
 						'INPUT',
1150
-						array (
1150
+						array(
1151 1151
 								'name' => 'connectcost[connectcost]',
1152 1152
 								'value' => '',
1153 1153
 								'size' => '20',
@@ -1163,10 +1163,10 @@  discard block
 block discarded – undo
1163 1163
 						'search_int_type',
1164 1164
 						'' 
1165 1165
 				),
1166
-				array (
1167
-						gettext ( 'Included Seconds' ),
1166
+				array(
1167
+						gettext('Included Seconds'),
1168 1168
 						'INPUT',
1169
-						array (
1169
+						array(
1170 1170
 								'name' => 'includedseconds[includedseconds]',
1171 1171
 								'value' => '',
1172 1172
 								'size' => '20',
@@ -1182,10 +1182,10 @@  discard block
 block discarded – undo
1182 1182
 						'search_int_type',
1183 1183
 						'' 
1184 1184
 				),
1185
-				array (
1186
-						gettext ( 'Per Minute Cost' ),
1185
+				array(
1186
+						gettext('Per Minute Cost'),
1187 1187
 						'INPUT',
1188
-						array (
1188
+						array(
1189 1189
 								'name' => 'cost[cost]',
1190 1190
 								'value' => '',
1191 1191
 								'size' => '20',
@@ -1201,10 +1201,10 @@  discard block
 block discarded – undo
1201 1201
 						'search_int_type',
1202 1202
 						'' 
1203 1203
 				),
1204
-				array (
1205
-						gettext ( 'Increment' ),
1204
+				array(
1205
+						gettext('Increment'),
1206 1206
 						'INPUT',
1207
-						array (
1207
+						array(
1208 1208
 								'name' => 'inc[inc]',
1209 1209
 								'',
1210 1210
 								'size' => '20',
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 						'search_int_type',
1221 1221
 						'' 
1222 1222
 				),
1223
-				array (
1223
+				array(
1224 1224
 						'',
1225 1225
 						'HIDDEN',
1226 1226
 						'ajax_search',
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 						'',
1230 1230
 						'' 
1231 1231
 				),
1232
-				array (
1232
+				array(
1233 1233
 						'',
1234 1234
 						'HIDDEN',
1235 1235
 						'advance_search',
@@ -1240,19 +1240,19 @@  discard block
 block discarded – undo
1240 1240
 				) 
1241 1241
 		);
1242 1242
 		
1243
-		$form ['button_search'] = array (
1243
+		$form ['button_search'] = array(
1244 1244
 				'name' => 'action',
1245 1245
 				'id' => "resellerrates_list_search_btn",
1246
-				'content' => gettext ( 'Search' ),
1246
+				'content' => gettext('Search'),
1247 1247
 				'value' => 'save',
1248 1248
 				'type' => 'button',
1249 1249
 				'class' => 'btn btn-line-parrot pull-right' 
1250 1250
 		);
1251
-		$form ['button_reset'] = array (
1251
+		$form ['button_reset'] = array(
1252 1252
 				'name' => 'action',
1253 1253
 				'id' => "id_reset",
1254 1254
 				'content' => 'Clear',
1255
-				'value' => gettext ( 'cancel' ),
1255
+				'value' => gettext('cancel'),
1256 1256
 				'type' => 'reset',
1257 1257
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
1258 1258
 		);
@@ -1260,18 +1260,18 @@  discard block
 block discarded – undo
1260 1260
 		return $form;
1261 1261
 	}
1262 1262
 	function get_origination_rate_search_form() {
1263
-		$form ['forms'] = array (
1263
+		$form ['forms'] = array(
1264 1264
 				"",
1265
-				array (
1265
+				array(
1266 1266
 						'id' => "origination_rate_list_search" 
1267 1267
 				) 
1268 1268
 		);
1269
-		$form [gettext ( 'Search' )] = array (
1269
+		$form [gettext('Search')] = array(
1270 1270
 				
1271
-				array (
1272
-						gettext ( 'Code' ),
1271
+				array(
1272
+						gettext('Code'),
1273 1273
 						'INPUT',
1274
-						array (
1274
+						array(
1275 1275
 								'name' => 'pattern[pattern]',
1276 1276
 								'',
1277 1277
 								'size' => '20',
@@ -1287,10 +1287,10 @@  discard block
 block discarded – undo
1287 1287
 						'search_string_type',
1288 1288
 						'' 
1289 1289
 				),
1290
-				array (
1291
-						gettext ( 'Destination' ),
1290
+				array(
1291
+						gettext('Destination'),
1292 1292
 						'INPUT',
1293
-						array (
1293
+						array(
1294 1294
 								'name' => 'comment[comment]',
1295 1295
 								'',
1296 1296
 								'size' => '20',
@@ -1306,10 +1306,10 @@  discard block
 block discarded – undo
1306 1306
 						'search_string_type',
1307 1307
 						'' 
1308 1308
 				),
1309
-				array (
1310
-						gettext ( 'Connect Cost' ),
1309
+				array(
1310
+						gettext('Connect Cost'),
1311 1311
 						'INPUT',
1312
-						array (
1312
+						array(
1313 1313
 								'name' => 'connectcost[connectcost]',
1314 1314
 								'value' => '',
1315 1315
 								'size' => '20',
@@ -1325,10 +1325,10 @@  discard block
 block discarded – undo
1325 1325
 						'search_int_type',
1326 1326
 						'' 
1327 1327
 				),
1328
-				array (
1329
-						gettext ( 'Included Seconds' ),
1328
+				array(
1329
+						gettext('Included Seconds'),
1330 1330
 						'INPUT',
1331
-						array (
1331
+						array(
1332 1332
 								'name' => 'includedseconds[includedseconds]',
1333 1333
 								'value' => '',
1334 1334
 								'size' => '20',
@@ -1344,10 +1344,10 @@  discard block
 block discarded – undo
1344 1344
 						'search_int_type',
1345 1345
 						'' 
1346 1346
 				),
1347
-				array (
1348
-						gettext ( 'Per Minute Cost' ),
1347
+				array(
1348
+						gettext('Per Minute Cost'),
1349 1349
 						'INPUT',
1350
-						array (
1350
+						array(
1351 1351
 								'name' => 'cost[cost]',
1352 1352
 								'value' => '',
1353 1353
 								'size' => '20',
@@ -1368,10 +1368,10 @@  discard block
 block discarded – undo
1368 1368
 				 * For Add Initial Increment field
1369 1369
 				 * *
1370 1370
 				 */
1371
-				array (
1372
-						gettext ( 'Initial Increment' ),
1371
+				array(
1372
+						gettext('Initial Increment'),
1373 1373
 						'INPUT',
1374
-						array (
1374
+						array(
1375 1375
 								'name' => 'init_inc[init_inc]',
1376 1376
 								'',
1377 1377
 								'size' => '20',
@@ -1390,10 +1390,10 @@  discard block
 block discarded – undo
1390 1390
 				/**
1391 1391
 				 * ***********************************************************
1392 1392
 				 */
1393
-				array (
1394
-						gettext ( 'Increment' ),
1393
+				array(
1394
+						gettext('Increment'),
1395 1395
 						'INPUT',
1396
-						array (
1396
+						array(
1397 1397
 								'name' => 'inc[inc]',
1398 1398
 								'',
1399 1399
 								'size' => '20',
@@ -1409,8 +1409,8 @@  discard block
 block discarded – undo
1409 1409
 						'search_int_type',
1410 1410
 						'' 
1411 1411
 				),
1412
-				array (
1413
-						gettext ( 'Rate Group' ),
1412
+				array(
1413
+						gettext('Rate Group'),
1414 1414
 						'pricelist_id',
1415 1415
 						'SELECT',
1416 1416
 						'',
@@ -1422,13 +1422,13 @@  discard block
 block discarded – undo
1422 1422
 						'pricelists',
1423 1423
 						'build_dropdown',
1424 1424
 						'where_arr',
1425
-						array (
1425
+						array(
1426 1426
 								"status" => "0",
1427 1427
 								"reseller_id" => "0" 
1428 1428
 						) 
1429 1429
 				),
1430
-				array (
1431
-						gettext ( 'Status' ),
1430
+				array(
1431
+						gettext('Status'),
1432 1432
 						'status',
1433 1433
 						'SELECT',
1434 1434
 						'',
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 						'',
1443 1443
 						'' 
1444 1444
 				),
1445
-				array (
1445
+				array(
1446 1446
 						'',
1447 1447
 						'HIDDEN',
1448 1448
 						'ajax_search',
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 						'',
1452 1452
 						'' 
1453 1453
 				),
1454
-				array (
1454
+				array(
1455 1455
 						'',
1456 1456
 						'HIDDEN',
1457 1457
 						'advance_search',
@@ -1467,11 +1467,11 @@  discard block
 block discarded – undo
1467 1467
 		 * Batch Delete
1468 1468
 		 * *****
1469 1469
 		 */
1470
-		$form ['button_search_delete'] = array (
1470
+		$form ['button_search_delete'] = array(
1471 1471
 				'name' => 'action',
1472 1472
 				'id' => "origination_rate_batch_dlt",
1473 1473
 				'onclick' => "check_btn();",
1474
-				'content' => gettext ( 'Delete Search Record' ),
1474
+				'content' => gettext('Delete Search Record'),
1475 1475
 				'style' => 'display:none;',
1476 1476
 				'value' => 'save',
1477 1477
 				'type' => 'button',
@@ -1487,11 +1487,11 @@  discard block
 block discarded – undo
1487 1487
 		 * Batch delete
1488 1488
 		 * ********
1489 1489
 		 */
1490
-		$form ['button_search'] = array (
1490
+		$form ['button_search'] = array(
1491 1491
 				'name' => 'action',
1492 1492
 				'id' => "origination_rate_list_search_btn",
1493 1493
 				'onclick' => 'search_btn();',
1494
-				'content' => gettext ( 'Search' ),
1494
+				'content' => gettext('Search'),
1495 1495
 				'value' => 'save',
1496 1496
 				'type' => 'button',
1497 1497
 				'class' => 'btn btn-line-parrot pull-right  margin-x-10' 
@@ -1499,10 +1499,10 @@  discard block
 block discarded – undo
1499 1499
 		/**
1500 1500
 		 * ***********************
1501 1501
 		 */
1502
-		$form ['button_reset'] = array (
1502
+		$form ['button_reset'] = array(
1503 1503
 				'name' => 'action',
1504 1504
 				'id' => "id_reset",
1505
-				'content' => gettext ( 'Clear' ),
1505
+				'content' => gettext('Clear'),
1506 1506
 				'value' => 'cancel',
1507 1507
 				'type' => 'reset',
1508 1508
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -1516,13 +1516,13 @@  discard block
 block discarded – undo
1516 1516
 	 * changes in grid size
1517 1517
 	 */
1518 1518
 	function build_termination_rate_for_admin() {
1519
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1519
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1520 1520
 		$currency_id = $account_info ['currency_id'];
1521
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1521
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1522 1522
 		
1523 1523
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1524
-		$grid_field_arr = json_encode ( array (
1525
-				array (
1524
+		$grid_field_arr = json_encode(array(
1525
+				array(
1526 1526
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
1527 1527
 						"30",
1528 1528
 						"",
@@ -1538,8 +1538,8 @@  discard block
 block discarded – undo
1538 1538
 				 * For Termination Rate edit on Code
1539 1539
 				 * *
1540 1540
 				 */
1541
-				array (
1542
-						gettext ( "Code" ),
1541
+				array(
1542
+						gettext("Code"),
1543 1543
 						"78",
1544 1544
 						"pattern",
1545 1545
 						"pattern",
@@ -1552,8 +1552,8 @@  discard block
 block discarded – undo
1552 1552
 				/**
1553 1553
 				 * ******************************
1554 1554
 				 */
1555
-				array (
1556
-						gettext ( "Destination" ),
1555
+				array(
1556
+						gettext("Destination"),
1557 1557
 						"80",
1558 1558
 						"comment",
1559 1559
 						"",
@@ -1563,8 +1563,8 @@  discard block
 block discarded – undo
1563 1563
 						"true",
1564 1564
 						"center" 
1565 1565
 				),
1566
-				array (
1567
-						gettext ( "Connect Cost($currency)" ),
1566
+				array(
1567
+						gettext("Connect Cost($currency)"),
1568 1568
 						"125",
1569 1569
 						"connectcost",
1570 1570
 						"connectcost",
@@ -1574,8 +1574,8 @@  discard block
 block discarded – undo
1574 1574
 						"true",
1575 1575
 						"right" 
1576 1576
 				),
1577
-				array (
1578
-						gettext ( "Included<br/> Seconds" ),
1577
+				array(
1578
+						gettext("Included<br/> Seconds"),
1579 1579
 						"70",
1580 1580
 						"includedseconds",
1581 1581
 						"",
@@ -1585,8 +1585,8 @@  discard block
 block discarded – undo
1585 1585
 						"true",
1586 1586
 						"center" 
1587 1587
 				),
1588
-				array (
1589
-						gettext ( "Per Minute <br/>Cost($currency)" ),
1588
+				array(
1589
+						gettext("Per Minute <br/>Cost($currency)"),
1590 1590
 						"100",
1591 1591
 						"cost",
1592 1592
 						"cost",
@@ -1596,8 +1596,8 @@  discard block
 block discarded – undo
1596 1596
 						"true",
1597 1597
 						"right" 
1598 1598
 				),
1599
-				array (
1600
-						gettext ( "Initial <br/> Increment" ),
1599
+				array(
1600
+						gettext("Initial <br/> Increment"),
1601 1601
 						"95",
1602 1602
 						"init_inc",
1603 1603
 						"",
@@ -1607,8 +1607,8 @@  discard block
 block discarded – undo
1607 1607
 						"true",
1608 1608
 						"center" 
1609 1609
 				),
1610
-				array (
1611
-						gettext ( "Increment" ),
1610
+				array(
1611
+						gettext("Increment"),
1612 1612
 						"75",
1613 1613
 						"inc",
1614 1614
 						"",
@@ -1618,8 +1618,8 @@  discard block
 block discarded – undo
1618 1618
 						"true",
1619 1619
 						"center" 
1620 1620
 				),
1621
-				array (
1622
-						gettext ( "Priority" ),
1621
+				array(
1622
+						gettext("Priority"),
1623 1623
 						"70",
1624 1624
 						"precedence",
1625 1625
 						"",
@@ -1629,8 +1629,8 @@  discard block
 block discarded – undo
1629 1629
 						"true",
1630 1630
 						"center" 
1631 1631
 				),
1632
-				array (
1633
-						gettext ( "Strip" ),
1632
+				array(
1633
+						gettext("Strip"),
1634 1634
 						"60",
1635 1635
 						"strip",
1636 1636
 						"",
@@ -1640,8 +1640,8 @@  discard block
 block discarded – undo
1640 1640
 						"true",
1641 1641
 						"center" 
1642 1642
 				),
1643
-				array (
1644
-						gettext ( "Prepend" ),
1643
+				array(
1644
+						gettext("Prepend"),
1645 1645
 						"70",
1646 1646
 						"prepend",
1647 1647
 						"pattern",
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 						"true",
1652 1652
 						"center" 
1653 1653
 				),
1654
-				array (
1655
-						gettext ( "Trunk" ),
1654
+				array(
1655
+						gettext("Trunk"),
1656 1656
 						"80",
1657 1657
 						"trunk_id",
1658 1658
 						"name",
@@ -1666,8 +1666,8 @@  discard block
 block discarded – undo
1666 1666
             ASTPP  3.0 
1667 1667
             creation field show in grid
1668 1668
             */
1669
-			array (
1670
-						gettext ( "Status" ),
1669
+			array(
1670
+						gettext("Status"),
1671 1671
 						"100",
1672 1672
 						"status",
1673 1673
 						"status",
@@ -1678,8 +1678,8 @@  discard block
 block discarded – undo
1678 1678
 						"center" 
1679 1679
 				),
1680 1680
 				// array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
1681
-				array (
1682
-						gettext ( "Modified Date" ),
1681
+				array(
1682
+						gettext("Modified Date"),
1683 1683
 						"150",
1684 1684
 						"last_modified_date",
1685 1685
 						"last_modified_date",
@@ -1701,25 +1701,25 @@  discard block
 block discarded – undo
1701 1701
 				 * ********************************************************************
1702 1702
 				 */
1703 1703
 				// array("Reseller", "103", "reseller_id", "number", "accounts", "get_field_name"),
1704
-				array (
1705
-						gettext ( "Action" ),
1704
+				array(
1705
+						gettext("Action"),
1706 1706
 						"80",
1707 1707
 						"",
1708 1708
 						"",
1709 1709
 						"",
1710
-						array (
1711
-								"EDIT" => array (
1710
+						array(
1711
+								"EDIT" => array(
1712 1712
 										"url" => "rates/termination_rate_edit/",
1713 1713
 										"mode" => "popup",
1714 1714
 										"layout" => "medium" 
1715 1715
 								),
1716
-								"DELETE" => array (
1716
+								"DELETE" => array(
1717 1717
 										"url" => "rates/termination_rate_delete/",
1718 1718
 										"mode" => "single" 
1719 1719
 								) 
1720 1720
 						) 
1721 1721
 				) 
1722
-		) );
1722
+		));
1723 1723
 		return $grid_field_arr;
1724 1724
 	}
1725 1725
 	/**
@@ -1731,13 +1731,13 @@  discard block
 block discarded – undo
1731 1731
 	 * changes in grid size
1732 1732
 	 */
1733 1733
 	function build_origination_rate_list_for_admin() {
1734
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
1734
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
1735 1735
 		$currency_id = $account_info ['currency_id'];
1736
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
1736
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
1737 1737
 		
1738 1738
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
1739
-		$grid_field_arr = json_encode ( array (
1740
-				array (
1739
+		$grid_field_arr = json_encode(array(
1740
+				array(
1741 1741
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
1742 1742
 						"30",
1743 1743
 						"",
@@ -1753,8 +1753,8 @@  discard block
 block discarded – undo
1753 1753
 				 * For Origination rate edit on code
1754 1754
 				 * *
1755 1755
 				 */
1756
-				array (
1757
-						gettext ( "Code" ),
1756
+				array(
1757
+						gettext("Code"),
1758 1758
 						"75",
1759 1759
 						"pattern",
1760 1760
 						"pattern",
@@ -1767,8 +1767,8 @@  discard block
 block discarded – undo
1767 1767
 				/**
1768 1768
 				 * *********************************
1769 1769
 				 */
1770
-				array (
1771
-						gettext ( "Destination" ),
1770
+				array(
1771
+						gettext("Destination"),
1772 1772
 						"100",
1773 1773
 						"comment",
1774 1774
 						"",
@@ -1778,8 +1778,8 @@  discard block
 block discarded – undo
1778 1778
 						"true",
1779 1779
 						"center" 
1780 1780
 				),
1781
-				array (
1782
-						gettext ( "Connect Cost($currency)" ),
1781
+				array(
1782
+						gettext("Connect Cost($currency)"),
1783 1783
 						"130",
1784 1784
 						"connectcost",
1785 1785
 						"connectcost",
@@ -1789,8 +1789,8 @@  discard block
 block discarded – undo
1789 1789
 						"true",
1790 1790
 						"right" 
1791 1791
 				),
1792
-				array (
1793
-						gettext ( "Included Seconds" ),
1792
+				array(
1793
+						gettext("Included Seconds"),
1794 1794
 						"120",
1795 1795
 						"includedseconds",
1796 1796
 						"",
@@ -1800,8 +1800,8 @@  discard block
 block discarded – undo
1800 1800
 						"true",
1801 1801
 						"center" 
1802 1802
 				),
1803
-				array (
1804
-						gettext ( "Per Minute Cost($currency)" ),
1803
+				array(
1804
+						gettext("Per Minute Cost($currency)"),
1805 1805
 						"150",
1806 1806
 						"cost",
1807 1807
 						"cost",
@@ -1816,8 +1816,8 @@  discard block
 block discarded – undo
1816 1816
 				 * For Add Initial Increment field
1817 1817
 				 * *
1818 1818
 				 */
1819
-				array (
1820
-						gettext ( "Initial Increment" ),
1819
+				array(
1820
+						gettext("Initial Increment"),
1821 1821
 						"130",
1822 1822
 						"init_inc",
1823 1823
 						"",
@@ -1830,8 +1830,8 @@  discard block
 block discarded – undo
1830 1830
 				/**
1831 1831
 				 * ****************************************************************
1832 1832
 				 */
1833
-				array (
1834
-						gettext ( "Increment" ),
1833
+				array(
1834
+						gettext("Increment"),
1835 1835
 						"90",
1836 1836
 						"inc",
1837 1837
 						"",
@@ -1842,8 +1842,8 @@  discard block
 block discarded – undo
1842 1842
 						"center" 
1843 1843
 				),
1844 1844
 				// array("Priority", "72", "precedence", "", "", "","","true","center"),
1845
-				array (
1846
-						gettext ( "Rate Group" ),
1845
+				array(
1846
+						gettext("Rate Group"),
1847 1847
 						"90",
1848 1848
 						"pricelist_id",
1849 1849
 						"name",
@@ -1856,8 +1856,8 @@  discard block
 block discarded – undo
1856 1856
 			/*
1857 1857
             ASTPP  3.0  creation field show in grid
1858 1858
             */
1859
-			array (
1860
-						gettext ( "Status" ),
1859
+			array(
1860
+						gettext("Status"),
1861 1861
 						"100",
1862 1862
 						"status",
1863 1863
 						"status",
@@ -1868,8 +1868,8 @@  discard block
 block discarded – undo
1868 1868
 						"center" 
1869 1869
 				),
1870 1870
 				// array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
1871
-				array (
1872
-						gettext ( "Modified Date" ),
1871
+				array(
1872
+						gettext("Modified Date"),
1873 1873
 						"150",
1874 1874
 						"last_modified_date",
1875 1875
 						"last_modified_date",
@@ -1888,34 +1888,34 @@  discard block
 block discarded – undo
1888 1888
 				 * chnage in status active or inactive
1889 1889
 				 */
1890 1890
 				
1891
-				array (
1892
-						gettext ( "Action" ),
1891
+				array(
1892
+						gettext("Action"),
1893 1893
 						"95",
1894 1894
 						"",
1895 1895
 						"",
1896 1896
 						"",
1897
-						array (
1898
-								"EDIT" => array (
1897
+						array(
1898
+								"EDIT" => array(
1899 1899
 										"url" => "rates/origination_rate_edit/",
1900 1900
 										"mode" => "popup",
1901 1901
 										"layout" => "medium" 
1902 1902
 								),
1903
-								"DELETE" => array (
1903
+								"DELETE" => array(
1904 1904
 										"url" => "/rates/origination_rate_delete/",
1905 1905
 										"mode" => "single" 
1906 1906
 								) 
1907 1907
 						) 
1908 1908
 				) 
1909
-		) );
1909
+		));
1910 1910
 		return $grid_field_arr;
1911 1911
 	}
1912 1912
 	/**
1913 1913
 	 * *************************************************************************************
1914 1914
 	 */
1915 1915
 	function build_grid_buttons() {
1916
-		$buttons_json = json_encode ( array (
1917
-				array (
1918
-						gettext ( "Create" ),
1916
+		$buttons_json = json_encode(array(
1917
+				array(
1918
+						gettext("Create"),
1919 1919
 						"btn btn-line-warning btn",
1920 1920
 						"fa fa-plus-circle fa-lg",
1921 1921
 						"button_action",
@@ -1923,44 +1923,44 @@  discard block
 block discarded – undo
1923 1923
 						"popup",
1924 1924
 						"medium" 
1925 1925
 				),
1926
-				array (
1927
-						gettext ( "Delete" ),
1926
+				array(
1927
+						gettext("Delete"),
1928 1928
 						"btn btn-line-danger",
1929 1929
 						"fa fa-times-circle fa-lg",
1930 1930
 						"button_action",
1931 1931
 						"/rates/termination_rate_delete_multiple/" 
1932 1932
 				),
1933
-				array (
1934
-						gettext ( "import" ),
1933
+				array(
1934
+						gettext("import"),
1935 1935
 						"btn btn-line-blue",
1936 1936
 						"fa fa-upload fa-lg",
1937 1937
 						"button_action",
1938 1938
 						"/rates/termination_rate_import/",
1939 1939
 						'single' 
1940 1940
 				),
1941
-				array (
1942
-						gettext ( "Import with field map" ),
1941
+				array(
1942
+						gettext("Import with field map"),
1943 1943
 						"btn btn-line-blue",
1944 1944
 						"fa fa-upload fa-lg",
1945 1945
 						"button_action",
1946 1946
 						"/rates/termination_rate_import_mapper/",
1947 1947
 						'single' 
1948 1948
 				),
1949
-				array (
1950
-						gettext ( "Export" ),
1949
+				array(
1950
+						gettext("Export"),
1951 1951
 						"btn btn-xing",
1952 1952
 						" fa fa-download fa-lg",
1953 1953
 						"button_action",
1954 1954
 						"/rates/termination_rate_export_cdr_xls/",
1955 1955
 						'single' 
1956 1956
 				) 
1957
-		) );
1957
+		));
1958 1958
 		return $buttons_json;
1959 1959
 	}
1960 1960
 	function build_grid_buttons_origination_rate() {
1961
-		$buttons_json = json_encode ( array (
1962
-				array (
1963
-						gettext ( "Create" ),
1961
+		$buttons_json = json_encode(array(
1962
+				array(
1963
+						gettext("Create"),
1964 1964
 						"btn btn-line-warning btn",
1965 1965
 						"fa fa-plus-circle fa-lg",
1966 1966
 						"button_action",
@@ -1968,23 +1968,23 @@  discard block
 block discarded – undo
1968 1968
 						"popup",
1969 1969
 						"medium" 
1970 1970
 				),
1971
-				array (
1972
-						gettext ( "Delete" ),
1971
+				array(
1972
+						gettext("Delete"),
1973 1973
 						"btn btn-line-danger",
1974 1974
 						"fa fa-times-circle fa-lg",
1975 1975
 						"button_action",
1976 1976
 						"/rates/origination_rate_delete_multiple/" 
1977 1977
 				),
1978
-				array (
1979
-						gettext ( "import" ),
1978
+				array(
1979
+						gettext("import"),
1980 1980
 						"btn btn-line-blue",
1981 1981
 						"fa fa-upload fa-lg",
1982 1982
 						"button_action",
1983 1983
 						"/rates/origination_rate_import/",
1984 1984
 						'single' 
1985 1985
 				),
1986
-				array (
1987
-						gettext ( "Export" ),
1986
+				array(
1987
+						gettext("Export"),
1988 1988
 						"btn btn-xing",
1989 1989
 						" fa fa-download fa-lg",
1990 1990
 						"button_action",
@@ -1997,8 +1997,8 @@  discard block
 block discarded – undo
1997 1997
 	}
1998 1998
 	function build_termination_rate_list_for_customer() {
1999 1999
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
2000
-		$grid_field_arr = json_encode ( array (
2001
-				array (
2000
+		$grid_field_arr = json_encode(array(
2001
+				array(
2002 2002
 						"<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>",
2003 2003
 						"30",
2004 2004
 						"",
@@ -2009,76 +2009,76 @@  discard block
 block discarded – undo
2009 2009
 						"false",
2010 2010
 						"center" 
2011 2011
 				),
2012
-				array (
2013
-						gettext ( "Code" ),
2012
+				array(
2013
+						gettext("Code"),
2014 2014
 						"70",
2015 2015
 						"pattern",
2016 2016
 						"pattern",
2017 2017
 						"",
2018 2018
 						"get_only_numeric_val" 
2019 2019
 				),
2020
-				array (
2021
-						gettext ( "Increment" ),
2020
+				array(
2021
+						gettext("Increment"),
2022 2022
 						"75",
2023 2023
 						"inc",
2024 2024
 						"",
2025 2025
 						"",
2026 2026
 						"" 
2027 2027
 				),
2028
-				array (
2029
-						gettext ( "Connect <br> Charge", "100" ),
2028
+				array(
2029
+						gettext("Connect <br> Charge", "100"),
2030 2030
 						"connectcost",
2031 2031
 						"connectcost",
2032 2032
 						"connectcost",
2033 2033
 						"convert_to_currency" 
2034 2034
 				),
2035
-				array (
2036
-						gettext ( "Included <br> Seconds" ),
2035
+				array(
2036
+						gettext("Included <br> Seconds"),
2037 2037
 						"100",
2038 2038
 						"includedseconds",
2039 2039
 						"",
2040 2040
 						"",
2041 2041
 						"" 
2042 2042
 				),
2043
-				array (
2044
-						gettext ( "Destination" ),
2043
+				array(
2044
+						gettext("Destination"),
2045 2045
 						"100",
2046 2046
 						"comment",
2047 2047
 						"",
2048 2048
 						"",
2049 2049
 						"" 
2050 2050
 				),
2051
-				array (
2052
-						gettext ( "Cost per <br> Minutes" ),
2051
+				array(
2052
+						gettext("Cost per <br> Minutes"),
2053 2053
 						"100",
2054 2054
 						"cost",
2055 2055
 						"cost",
2056 2056
 						"cost",
2057 2057
 						"convert_to_currency" 
2058 2058
 				),
2059
-				array (
2060
-						gettext ( "Priority" ),
2059
+				array(
2060
+						gettext("Priority"),
2061 2061
 						"80",
2062 2062
 						"precedence",
2063 2063
 						"",
2064 2064
 						"",
2065 2065
 						"" 
2066 2066
 				),
2067
-				array (
2068
-						gettext ( "Reseller" ),
2067
+				array(
2068
+						gettext("Reseller"),
2069 2069
 						"80",
2070 2070
 						"reseller_id",
2071 2071
 						"number",
2072 2072
 						"accounts",
2073 2073
 						"get_field_name" 
2074 2074
 				) 
2075
-		) );
2075
+		));
2076 2076
 		return $grid_field_arr;
2077 2077
 	}
2078 2078
 	function build_block_pattern_list_for_customer() {
2079 2079
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
2080
-		$grid_field_arr = json_encode ( array (
2081
-				array (
2080
+		$grid_field_arr = json_encode(array(
2081
+				array(
2082 2082
 						"<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>",
2083 2083
 						"30",
2084 2084
 						"",
@@ -2090,28 +2090,28 @@  discard block
 block discarded – undo
2090 2090
 						"center",
2091 2091
 						"PatternChkBox" 
2092 2092
 				),
2093
-				array (
2094
-						gettext ( "Code" ),
2093
+				array(
2094
+						gettext("Code"),
2095 2095
 						"350",
2096 2096
 						"pattern",
2097 2097
 						"pattern",
2098 2098
 						"",
2099 2099
 						"get_only_numeric_val" 
2100 2100
 				),
2101
-				array (
2102
-						gettext ( "Destination" ),
2101
+				array(
2102
+						gettext("Destination"),
2103 2103
 						"350",
2104 2104
 						"comment",
2105 2105
 						"",
2106 2106
 						"",
2107 2107
 						"" 
2108 2108
 				) 
2109
-		) );
2109
+		));
2110 2110
 		return $grid_field_arr;
2111 2111
 	}
2112 2112
 	function build_pattern_list_for_customer($accountid, $accounttype) {
2113
-		$grid_field_arr = json_encode ( array (
2114
-				array (
2113
+		$grid_field_arr = json_encode(array(
2114
+				array(
2115 2115
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
2116 2116
 						"30",
2117 2117
 						"",
@@ -2122,116 +2122,116 @@  discard block
 block discarded – undo
2122 2122
 						"false",
2123 2123
 						"center" 
2124 2124
 				),
2125
-				array (
2126
-						gettext ( "Code" ),
2125
+				array(
2126
+						gettext("Code"),
2127 2127
 						"450",
2128 2128
 						"blocked_patterns",
2129 2129
 						"blocked_patterns",
2130 2130
 						"",
2131 2131
 						"get_only_numeric_val" 
2132 2132
 				),
2133
-				array (
2134
-						gettext ( "Destination" ),
2133
+				array(
2134
+						gettext("Destination"),
2135 2135
 						"450",
2136 2136
 						"destination",
2137 2137
 						"",
2138 2138
 						"",
2139 2139
 						"" 
2140 2140
 				),
2141
-				array (
2142
-						gettext ( "Action" ),
2141
+				array(
2142
+						gettext("Action"),
2143 2143
 						"100",
2144 2144
 						"",
2145 2145
 						"",
2146 2146
 						"",
2147
-						array (
2148
-								"DELETE" => array (
2149
-										"url" => "accounts/" . $accounttype . "_delete_block_pattern/$accountid/",
2147
+						array(
2148
+								"DELETE" => array(
2149
+										"url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/",
2150 2150
 										"mode" => "single" 
2151 2151
 								) 
2152 2152
 						) 
2153 2153
 				) 
2154
-		) );
2154
+		));
2155 2155
 		return $grid_field_arr;
2156 2156
 	}
2157 2157
 	function set_pattern_grid_buttons($accountid) {
2158
-		$buttons_json = json_encode ( array (
2159
-				array (
2160
-						gettext ( "Add Prefixes" ),
2158
+		$buttons_json = json_encode(array(
2159
+				array(
2160
+						gettext("Add Prefixes"),
2161 2161
 						"btn btn-line-warning btn",
2162 2162
 						"fa fa-plus-circle fa-lg",
2163 2163
 						"button_action",
2164 2164
 						"/accounts/customer_add_blockpatterns/$accountid",
2165 2165
 						"popup" 
2166 2166
 				) 
2167
-		) );
2167
+		));
2168 2168
 		return $buttons_json;
2169 2169
 	}
2170 2170
 	function build_origination_rate_list_for_user() {
2171 2171
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
2172
-		$grid_field_arr = json_encode ( array (
2173
-				array (
2174
-						gettext ( "Code" ),
2172
+		$grid_field_arr = json_encode(array(
2173
+				array(
2174
+						gettext("Code"),
2175 2175
 						"155",
2176 2176
 						"pattern",
2177 2177
 						"pattern",
2178 2178
 						"",
2179 2179
 						"get_only_numeric_val" 
2180 2180
 				),
2181
-				array (
2182
-						gettext ( "Destination" ),
2181
+				array(
2182
+						gettext("Destination"),
2183 2183
 						"225",
2184 2184
 						"comment",
2185 2185
 						"",
2186 2186
 						"",
2187 2187
 						"" 
2188 2188
 				),
2189
-				array (
2190
-						gettext ( "Increment" ),
2189
+				array(
2190
+						gettext("Increment"),
2191 2191
 						"235",
2192 2192
 						"inc",
2193 2193
 						"",
2194 2194
 						"",
2195 2195
 						"" 
2196 2196
 				),
2197
-				array (
2198
-						gettext ( "Cost per Minutes" ),
2197
+				array(
2198
+						gettext("Cost per Minutes"),
2199 2199
 						"240",
2200 2200
 						"cost",
2201 2201
 						"cost",
2202 2202
 						"cost",
2203 2203
 						"convert_to_currency" 
2204 2204
 				),
2205
-				array (
2206
-						gettext ( "Connect Charge" ),
2205
+				array(
2206
+						gettext("Connect Charge"),
2207 2207
 						"200",
2208 2208
 						"connectcost",
2209 2209
 						"connectcost",
2210 2210
 						"connectcost",
2211 2211
 						"convert_to_currency" 
2212 2212
 				),
2213
-				array (
2214
-						gettext ( "Included Seconds" ),
2213
+				array(
2214
+						gettext("Included Seconds"),
2215 2215
 						"200",
2216 2216
 						"includedseconds",
2217 2217
 						"",
2218 2218
 						"",
2219 2219
 						"" 
2220 2220
 				) 
2221
-		) );
2221
+		));
2222 2222
 		return $grid_field_arr;
2223 2223
 	}
2224 2224
 	function build_grid_buttons_rates() {
2225
-		$buttons_json = json_encode ( array (
2226
-				array (
2227
-						gettext ( "Export" ),
2225
+		$buttons_json = json_encode(array(
2226
+				array(
2227
+						gettext("Export"),
2228 2228
 						"btn btn-xing",
2229 2229
 						" fa fa-download fa-lg",
2230 2230
 						"button_action",
2231 2231
 						"/rates/resellersrates_xls/",
2232 2232
 						'single' 
2233 2233
 				) 
2234
-		) );
2234
+		));
2235 2235
 		return $buttons_json;
2236 2236
 	}
2237 2237
 }
Please login to merge, or discard this patch.
application/modules/rates/views/view_import_termination_rate_mapper.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 <?php
4 4
    startblock('extra_head') ?>
5 5
    <? //echo "<pre>";print_r($csv_tmp_data);exit;
6
-   if (isset($csv_tmp_data) && !empty($csv_tmp_data)) {
6
+   if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) {
7 7
    echo '<script>';
8
-   echo 'var csv_tmp_data = ' . json_encode($csv_tmp_data) . ';';
8
+   echo 'var csv_tmp_data = '.json_encode($csv_tmp_data).';';
9 9
   //  echo 'alert(csv_tmp_data);';
10 10
    echo '</script>';
11 11
    }
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
    $(document).ready(function() {
15 15
    });
16 16
 </script> <script type="text/javascript" language="javascript"><?
17
-   if (isset($mapto_fields) && !empty($mapto_fields)) {
18
-    foreach($mapto_fields as $csv_key => $csv_value) {
19
-    echo '$("#'.$csv_value .'-prefix").live("change", function () {';
20
-    echo 'var select = document.getElementById("'.$csv_value .'-select");';
17
+   if (isset($mapto_fields) && ! empty($mapto_fields)) {
18
+    foreach ($mapto_fields as $csv_key => $csv_value) {
19
+    echo '$("#'.$csv_value.'-prefix").live("change", function () {';
20
+    echo 'var select = document.getElementById("'.$csv_value.'-select");';
21 21
     echo 'var answer = select.options[select.selectedIndex].value;';
22
-    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];';
22
+    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];';
23 23
     echo '});';
24
-    echo '$("#'.$csv_value .'-select").live("change", function () {';
25
-    echo 'var select = document.getElementById("'.$csv_value .'-select");';
24
+    echo '$("#'.$csv_value.'-select").live("change", function () {';
25
+    echo 'var select = document.getElementById("'.$csv_value.'-select");';
26 26
     echo 'var answer = select.options[select.selectedIndex].value;';
27 27
    
28
-    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];';
28
+    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];';
29 29
     echo '});';
30 30
     }
31 31
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 <?php
44 44
    startblock('content') ?>
45 45
 <?php
46
-   if (!isset($csv_tmp_data)) { ?>
46
+   if ( ! isset($csv_tmp_data)) { ?>
47 47
 <section class="slice color-three padding-t-20">
48 48
    <div class="w-section inverse no-padding">
49 49
       <div class="container">
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                   <div class="w-box">
54 54
                      <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
55 55
                      <?php
56
-                        if (isset($error) && !empty($error)) {
56
+                        if (isset($error) && ! empty($error)) {
57 57
                         	echo $error;
58 58
                         } ?>
59 59
                      </span>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                               <?php
72 72
                                  $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array(
73 73
                                  	"status " => "0"
74
-                                 )) , '');
74
+                                 )), '');
75 75
                                  echo $trunklist; ?>
76 76
                            </div>
77 77
                         </div>
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             <div class="col-md-12 padding-b-10">
104 104
                <div class="pull-right">
105 105
                   <input class="btn btn-line-parrot" id="import_terminationrate" type="submit" name="action" value="Import" />
106
-                  <a href="<?php echo base_url() . 'rates/termination_rates_list/' ?>" >
106
+                  <a href="<?php echo base_url().'rates/termination_rates_list/' ?>" >
107 107
                   <input class="btn btn-line-sky margin-x-10" id="ok" type="button" name="action" value="Cancel"/>
108 108
                   </a>
109 109
                </div>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 <?php
117 117
    } ?>
118 118
 <?php // echo "<pre>";	print_R($csv_tmp_data);exit;
119
-   if (isset($csv_tmp_data) && !empty($csv_tmp_data)) { ?>
119
+   if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?>
120 120
 <section class="slice color-three padding-b-20">
121 121
    <div class="w-section inverse no-padding">
122 122
       <div class="container">
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
                   </thead>
138 138
                   <tbody>
139 139
                      <?php  //echo "<pre>";	print_R($mapto_fields);exit;
140
-                        foreach($mapto_fields as $csv_key => $csv_value) {
140
+                        foreach ($mapto_fields as $csv_key => $csv_value) {
141 141
 
142 142
                         		echo "<tr>";
143
-                        		echo "<td>" . $csv_key . '(' . $csv_value . ")</td>";
144
-                        		echo "<td><input type='text' name='".$csv_value ."-prefix' id='".$csv_value ."-prefix'></td>";
143
+                        		echo "<td>".$csv_key.'('.$csv_value.")</td>";
144
+                        		echo "<td><input type='text' name='".$csv_value."-prefix' id='".$csv_value."-prefix'></td>";
145 145
                         		echo "<td>";
146
-                        		echo "<select name='".$csv_value ."-select' id='".$csv_value ."-select'>";
146
+                        		echo "<select name='".$csv_value."-select' id='".$csv_value."-select'>";
147 147
                         		?>
148 148
                      <option value=""></option>
149 149
                      <?php
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                      <?php
156 156
                         }
157 157
                         echo "</td>";
158
-                        echo "<td><input type='text' name='".$csv_value ."-display' id='".$csv_value ."-display'></td>";
158
+                        echo "<td><input type='text' name='".$csv_value."-display' id='".$csv_value."-display'></td>";
159 159
                         echo "</tr>";
160 160
 
161 161
                         } ?>
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
                <H2> Import File Data..</H2>
171 171
                <table width="100%" border="1"  class="details_table">
172 172
                   <?php
173
-                     $cnt = 1;  //echo "<pre>";print_r($csv_tmp_data);exit;
174
-                     foreach($csv_tmp_data as $csv_key => $csv_value) {
173
+                     $cnt = 1; //echo "<pre>";print_r($csv_tmp_data);exit;
174
+                     foreach ($csv_tmp_data as $csv_key => $csv_value) {
175 175
                    
176 176
                      	if ($csv_key < 15) {
177 177
                      		echo "<tr>";
178 178
                      		
179
-                     		foreach($csv_value as $field_name => $field_val) {
179
+                     		foreach ($csv_value as $field_name => $field_val) {
180 180
                      			if ($csv_key == 0) {
181 181
 
182 182
                      				 echo "<th>".ucfirst($field_val)."</th>";
183 183
 
184 184
                      			}
185 185
                      			else {
186
-                     				echo "<td class='portlet-content'>" . $field_val . "</td>";
186
+                     				echo "<td class='portlet-content'>".$field_val."</td>";
187 187
                      				$cnt++;
188 188
                      			}
189 189
                      		}
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                      	}
193 193
                      }
194 194
 
195
-                     echo "<tr><td colspan='" . $cnt . "'>
196
-                                            <a href='" . base_url() . "rates/termination_rate_list/'><input type='button' class='btn btn-line-sky pull-right  margin-x-10' value='Back'/></a>
195
+                     echo "<tr><td colspan='".$cnt."'>
196
+                                            <a href='" . base_url()."rates/termination_rate_list/'><input type='button' class='btn btn-line-sky pull-right  margin-x-10' value='Back'/></a>
197 197
                                             <input type='submit' class='btn btn-line-parrot pull-right'' id='Process' value='Process Records'/></td></tr>";
198 198
                      ?>
199 199
                </table>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/views/view_import_error.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
                    <div class="pull-right">
49 49
                         <a href="<?= base_url().'rates/termination_rates_list/'?>"><input class="btn btn-line-sky margin-x-10" id="ok" type="button" name="action" value="Back to Termination Rates List" /> </a>
50 50
 
51
-                       <?php $profile_url = explode("/",base_url(uri_string()));
52
-        if($profile_url[4] == 'termination_rate_rates_import'){ ?>
51
+                       <?php $profile_url = explode("/", base_url(uri_string()));
52
+        if ($profile_url[4] == 'termination_rate_rates_import') { ?>
53 53
                         <a href="<?= base_url().'rates/termination_rate_error_download/'?>"><input class="btn btn-line-parrot" id="ok" type="button" name="action" value="Download Errors" /> </a>
54
-             </div></div>       <? }else{ ?>
54
+             </div></div>       <? } else { ?>
55 55
              <a href="<?= base_url().'rates/termination_rate_mapper_error_download/'?>"><input class="btn btn-line-parrot" id="ok" type="button" name="action" value="Download Errors" /> </a>
56 56
              
57 57
            <?  } }?>    
Please login to merge, or discard this patch.