Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 1328-1335 (lines=8) @@
1325
			$where = array("accountid"=> $accountinfo['id']);    
1326
		}
1327
		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1328
		if($query->num_rows >0){
1329
			$invoice_conf = $query->result_array();
1330
			$invoice_conf = $invoice_conf[0];
1331
		}else{
1332
			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1333
			$invoice_conf = $query->result_array();
1334
			$invoice_conf = $invoice_conf[0];            
1335
		}
1336
		 $last_invoice_ID = $this->get_invoice_date("invoiceid",$accountinfo["id"]);
1337
		 $invoice_prefix=$invoice_conf['invoice_prefix'];
1338
		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days"));

web_interface/astpp/application/modules/invoices/controllers/invoices.php 2 locations

@@ 688-695 (lines=8) @@
685
			$where = array("accountid"=> $accountdata['reseller_id']);    
686
		}
687
		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
688
		if($query->num_rows >0){
689
			$invoice_conf = $query->result_array();
690
			$invoice_conf = $invoice_conf[0];
691
		} else{
692
			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
693
			$invoice_conf = $query->result_array();
694
			$invoice_conf = $invoice_conf[0];            
695
		}
696
		 $template_config=$this->config->item('invoice_screen');
697
				 include($template_config.'generateInvoice.php');
698
				 $generateInvoice = new generateInvoice();
@@ 1432-1439 (lines=8) @@
1429
			$where = array("accountid"=> $accountdata['reseller_id']);    
1430
		}
1431
		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1432
		if($query->num_rows >0){
1433
			$invoice_conf = $query->result_array();
1434
			$invoice_conf = $invoice_conf[0];
1435
		} else{
1436
			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1437
			$invoice_conf = $query->result_array();
1438
			$invoice_conf = $invoice_conf[0];            
1439
		}
1440
		$last_invoice_ID = $this->get_invoice_date("invoiceid");
1441
		if($last_invoice_ID && $last_invoice_ID > 0){
1442
			$last_invoice_ID = ($last_invoice_ID+1);