*** go_list.php	2013-06-18 17:39:54.000000000 -0400
--- go_list_new.php	2013-06-18 17:27:00.000000000 -0400
***************
*** 16,34 ****
          parent::Controller();
          $this->load->model('golist');
          $this->load->model('go_dashboard');
!         $this->asteriskDB = $this->load->database('dialerdb',TRUE);
!         //$this->a2billingDB =$this->load->database('billingdb',TRUE) ;
!         $this->load->library(array('session','userhelper','commonhelper'));
      }
  
      function index() {
  
          /* load models */
          $this->asteriskDB = $this->load->database('dialerdb',TRUE);
-         //$this->a2billingDB =$this->load->database('billingdb',TRUE) ;
          
          $this->load->model('golist');
- //        $this->load->model('go_reports');
          $this->load->model('go_dashboard');
  
          $groupId = $this->go_dashboard->go_get_groupid();
--- 16,31 ----
          parent::Controller();
          $this->load->model('golist');
          $this->load->model('go_dashboard');
!         $this->asteriskDB = $this->load->database('dialerdb',TRUE); 
! 	$this->load->library(array('session','userhelper','commonhelper'));
      }
  
      function index() {
  
          /* load models */
          $this->asteriskDB = $this->load->database('dialerdb',TRUE);
          
          $this->load->model('golist');
          $this->load->model('go_dashboard');
  
          $groupId = $this->go_dashboard->go_get_groupid();
***************
*** 576,590 ****
  															$li_recs = $rslt->num_rows;
  															
  															if ($li_recs > 0) 	{
! 																$L=0;
! 																while ($li_recs > $L) {
! 																	$row = $rslt->row();
! 																	$dup_lists .=	"'$row->list_id',";
! 																	$L++;
! 																}
  																$dup_lists = eregi_replace(",$",'',$dup_lists);
  									
! 																$stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
  																$rslt = $this->asteriskDB->query($stmt);
  																$pc_recs = $rslt->num_rows;
  																		
--- 573,587 ----
  															$li_recs = $rslt->num_rows;
  															
  															if ($li_recs > 0) 	{
! 																$L=0;
! 																foreach ($rslt->result() as $L => $row) {
! 																	$dup_lists .=	"'$row->list_id',";
! 																	$L++;
!  																}
!  															
  																$dup_lists = eregi_replace(",$",'',$dup_lists);
  									
! 																$stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; 
  																$rslt = $this->asteriskDB->query($stmt);
  																$pc_recs = $rslt->num_rows;
  																		
***************
*** 681,688 ****
  														
  														
  														
! 												if ( (strlen($phone_number)>6 && strlen($phone_number) < 11) and ($dup_lead<1) and ($list_id >= 100 )) {
! 														
  														if (strlen($phone_code)<1) {$phone_code = '1';}
  														if (eregi("TITLEALTPHONE",$dupcheck)) {
  															$phone_list .= "$alt_phone$title$US$list_id|";
--- 678,685 ----
  														
  														
  														
! 												
! 												if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 )) {		
  														if (strlen($phone_code)<1) {$phone_code = '1';}
  														if (eregi("TITLEALTPHONE",$dupcheck)) {
  															$phone_list .= "$alt_phone$title$US$list_id|";
***************
*** 691,700 ****
  														}
  								
  														$gmt_offset = $this->lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code,$owner);
! 														//$gmt_offset = 10.00; //ganito muna
  								
  														if (strlen($custom_SQL)>3) {
! 															$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');";
  															
  														$rslt = $this->asteriskDB->query($stmtZ);
  														$lead_id = $this->asteriskDB->insert_id();
--- 688,698 ----
  														}
  								
  														$gmt_offset = $this->lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code,$owner);
! 														
  								
  														if (strlen($custom_SQL)>3) {
! 															$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01
! 00:00:00','$rank','$owner','$list_id');";
  															
  														$rslt = $this->asteriskDB->query($stmtZ);
  														$lead_id = $this->asteriskDB->insert_id();
***************
*** 709,715 ****
  														
  																if ($multi_insert_counter > 8) {
  																	### insert good record into vicidial_list table ###
! 																	$stmtZx = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
  											
  																	$rslt = $this->asteriskDB->query($stmtZx);
  																	$multistmt='';
--- 707,714 ----
  														
  																if ($multi_insert_counter > 8) {
  																	### insert good record into vicidial_list table ###
! 																	$stmtZx = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01
! 00:00:00','$rank','$owner','0');";
  											
  																	$rslt = $this->asteriskDB->query($stmtZx);
  																	$multistmt='';
***************
*** 2003,2009 ****
  		$dlquery = $this->golist->dlquery($listidx);
   
                  foreach($dlquery as $dlqueryinfo){
!  			$dimez .= "{$dlqueryinfo->lead_id},{$dlqueryinfo->entry_date},{$dlqueryinfo->modify_date},{$dlqueryinfo->status},{$dlqueryinfo->user},{$dlqueryinfo->vendor_lead_code},{$dlqueryinfo->source_id},{$dlqueryinfo->list_id},{$dlqueryinfo->gmt_offset_now},{$dlqueryinfo->called_since_last_reset},{$dlqueryinfo->phone_code},{$dlqueryinfo->phone_number},{$dlqueryinfo->title},{$dlqueryinfo->first_name},{$dlqueryinfo->middle_initial},{$dlqueryinfo->last_name},{$dlqueryinfo->address1},{$dlqueryinfo->address2},{$dlqueryinfo->address3},{$dlqueryinfo->city},{$dlqueryinfo->state},{$dlqueryinfo->province},{$dlqueryinfo->postal_code},{$dlqueryinfo->country_code},{$dlqueryinfo->gender},{$dlqueryinfo->date_of_birth},{$dlqueryinfo->alt_phone},{$dlqueryinfo->email},{$dlqueryinfo->security_phrase},{$dlqueryinfo->comments},{$dlqueryinfo->called_count},{$dlqueryinfo->last_local_call_time},{$dlqueryinfo->rank},{$dlqueryinfo->owner}\n";
  
                	}
  		$data["csv"] = $dimez;
--- 2002,2009 ----
  		$dlquery = $this->golist->dlquery($listidx);
   
                  foreach($dlquery as $dlqueryinfo){
!  			$dimez .= "{$dlqueryinfo->lead_id},{$dlqueryinfo->entry_date},{$dlqueryinfo->modify_date},{$dlqueryinfo->status},{$dlqueryinfo->user},{$dlqueryinfo->vendor_lead_code},{$dlqueryinfo->source_id},{$dlqueryinfo->list_id},{$dlqueryinfo->gmt_offset_now},{$dlqueryinfo->called_since_last_reset},{$dlqueryinfo->phone_code},{$dlqueryinfo->phone_number},{$dlqueryinfo->title},{$dlqueryinfo->first_name},{$dlqueryinfo->middle_initial},{$dlqueryinfo->last_name},{$dlqueryinfo->address1},{$dlqueryinfo->address2},{$dlqueryinfo->address3},{$dlqueryinfo->city},{$dlqueryinfo->state},{$dlqueryinfo->province},{$dlqueryinfo->postal_code},{$dlqueryinfo->country_code},{$dlqueryinfo->gender},{$dlqueryinfo->date_of_birth},{$dlqueryinfo->alt_phone},{$dlqueryinfo->email},{$dlqueryinfo->security_phrase},{$dlqueryinfo->comments},{$dlqueryinfo->called_count},{$dlqueryinfo->last_local_call_time},{$dlqueryinfo->rank},{$dlqueryinfo
! ->owner}\n";
  
                	}
  		$data["csv"] = $dimez;
