//code by prashant Jadhav for manual calls on alternate number and same mobile number assign to different records then it shows another customer info while dialing--------
if($kstychCall['crmid'])
{
$crmid=$kstychCall['previewcrmid'];
}
else
{
$crmid=$kstychCall['previewcrmid'];
}
if($kstychDialer['mDialerState']=="Manual")
{
if($crmid!="")
{
$tusers=$wakka->getPersonIDs("(mobile like '%".substr($callnumber,-10)."' OR
altphone1 like '%".substr($callnumber,-10)."' OR
altphone2 like '%".substr($callnumber,-10)."' OR
altphone3 like '%".substr($callnumber,-10)."' OR
altphone4 like '%".substr($callnumber,-10)."' OR
altphone5 like '%".substr($callnumber,-10)."' OR
altphone6 like '%".substr($callnumber,-10)."' OR
altphone7 like '%".substr($callnumber,-10)."' OR
altphone8 like '%".substr($callnumber,-10)."' OR
altphone9 like '%".substr($callnumber,-10)."' OR
altphone10 like '%".substr($callnumber,-10)."') and id=$crmid ");
/*$tusers=$wakka->getPersonIDs("(mobile like '%".substr($callnumber,-10)."' OR
altphone1 like '%$callnumber' OR
altphone2 like '%$callnumber' OR
altphone3 like '%$callnumber' OR
altphone4 like '%$callnumber' OR
altphone5 like '%$callnumber' OR
altphone6 like '%$callnumber' OR
altphone7 like '%$callnumber' OR
altphone8 like '%$callnumber' OR
altphone9 like '%$callnumber' OR
altphone10 like '%$callnumber') and id=$crmid ");*/
}
else
{
$tusers=$wakka->getPersonIDs("mobile like '%".substr($callnumber,-10)."' OR
altphone1 like '%".substr($callnumber,-10)."' OR
altphone2 like '%".substr($callnumber,-10)."' OR
altphone3 like '%".substr($callnumber,-10)."' OR
altphone4 like '%".substr($callnumber,-10)."' OR
altphone5 like '%".substr($callnumber,-10)."' OR
altphone6 like '%".substr($callnumber,-10)."' OR
altphone7 like '%".substr($callnumber,-10)."' OR
altphone8 like '%".substr($callnumber,-10)."' OR
altphone9 like '%".substr($callnumber,-10)."' OR
altphone10 like '%".substr($callnumber,-10)."' ");
/*$tusers=$wakka->getPersonIDs("mobile like '%".substr($callnumber,-10)."' OR
altphone1 like '%$callnumber' OR
altphone2 like '%$callnumber' OR
altphone3 like '%$callnumber' OR
altphone4 like '%$callnumber' OR
altphone5 like '%$callnumber' OR
altphone6 like '%$callnumber' OR
altphone7 like '%$callnumber' OR
altphone8 like '%$callnumber' OR
altphone9 like '%$callnumber' OR
altphone10 like '%$callnumber' ");*/
}
/*if($crmid!=""){
$tusers=$wakka->getPersonIDs("mobile like '%".substr($callnumber,-10)."' and id=$crmid ");
}else{
$tusers=$wakka->getPersonIDs("mobile like '%".substr($callnumber,-10)."'");
if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html('');
});
</script>";
returnResponse::make($searchresult);
}
else
{
returnResponse::make("<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Lines Free to Dial!');</script>");
}
}
else
{
returnResponse::make("<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','You Are Not Connected!');</script>");
returnResponse::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>");
}
}
else
{
returnResponse::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','Multiple Records Found!');createSearchRecordDiv('dialersearchbox');</script>");
}
}
elsereturnResponse::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Records Found!');createSearchRecordDiv('dialersearchbox');</script>");
if($key!=''&&$stxt!='')$key=" and $key like '$stxt%'";else $key="";*/
/*if($stxt!='')$skey=" and (id like '$stxt%' or firstname like '$stxt%' or lastname like '$stxt%' or client like '$stxt%' or mobile like '$stxt%' or emailid like '$stxt%' or passportno like '$stxt%' or ibannumber like '$stxt%' or currentstatus like '$stxt%' or laborcardpersonalid like '$stxt%' or clientinternalid like '$stxt%' or clientcode like '$stxt%')";else $skey="";*/
if($stxt!='')$skey=" and (firstname like '$stxt%' or mobile like '$stxt%' or clientcode like '$stxt%')";else$skey="";
elseif($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10) $owclientstr limit $bs,$bl");
elseif($bucket=="TotalData")$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl");
elseif($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl");
elseif($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl");
elseif($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl");
$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('".implode("','",$number_list)."') GROUP BY number )");
$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('".implode("','",$number_list)."') GROUP BY number )");