Code Duplication    Length = 17-20 lines in 3 locations

web_interface/astpp/application/modules/accounts/controllers/accounts.php 1 location

@@ 471-490 (lines=20) @@
468
		}
469
	}
470
471
	function customer_animap_json($accountid, $accounttype) {
472
		$json_data = array();
473
		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
474
		$like_str=!empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" :null;
475
		if(!empty($like_str))
476
		$this->db->where($like_str);
477
		$where = array("accountid" => $accountid);
478
		$count_all = $this->db_model->countQuery("*", "ani_map", $where);
479
480
		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
481
		$json_data = $paging_data["json_paging"];
482
		if(!empty($like_str))
483
		$this->db->where($like_str);
484
		$query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
485
486
		$grid_fields = json_decode($this->accounts_form->build_animap_list_for_customer($accountid, $accounttype));
487
		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
488
489
		echo json_encode($json_data);
490
	}
491
492
	function provider_animap_action($action, $accountid, $aniid = "") {
493
		$this->customer_animap_action($action, $accountid, $aniid);

web_interface/astpp/application/modules/package/controllers/package.php 1 location

@@ 197-215 (lines=19) @@
194
			redirect(base_url()."package/package_list/");
195
		}    
196
	}
197
	function package_pattern_list_json($package_id){
198
		$json_data = array();
199
		$instant_search=$this->session->userdata('left_panel_search_package_pattern');
200
		$like_str=!empty($instant_search) ? "(patterns like '%$instant_search%'  OR destination like '%$instant_search%' )" :null;
201
		if(!empty($like_str))
202
		$this->db->where($like_str);
203
		$where = array('package_id' => $package_id);
204
		$count_all = $this->db_model->countQuery("*", "package_patterns", $where);
205
		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
206
		$json_data = $paging_data["json_paging"];
207
		if(!empty($like_str))
208
		$this->db->where($like_str);
209
		$pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
210
        
211
		$grid_fields = json_decode($this->package_form->build_pattern_list_for_customer($package_id));
212
		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
213
214
		echo json_encode($json_data);
215
	}
216
	function package_counter() {
217
		$data['username'] = $this->session->userdata('user_name');
218
		$data['page_title'] = 'Usage Report';

web_interface/astpp/application/modules/rates/controllers/rates.php 1 location

@@ 778-794 (lines=17) @@
775
		$this->session->set_userdata('account_search', "");
776
	}
777
778
	function customer_block_pattern_list($accountid, $accounttype)
779
	{
780
		$json_data = array();
781
		$where = array(
782
			'accountid' => $accountid
783
		);
784
		$instant_search = $this->session->userdata('left_panel_search_' . $accounttype . '_pattern');
785
		$like_str = !empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
786
		if (!empty($like_str)) $this->db->where($like_str);
787
		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
788
		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
789
		$json_data = $paging_data["json_paging"];
790
		if (!empty($like_str)) $this->db->where($like_str);
791
		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
792
		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype));
793
		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
794
		echo json_encode($json_data);
795
	}
796
797
	function termination_rate_delete_multiple()