[Vtigercrm-commits] [vtiger development] #6341: Link to dataset of an incomming call is not shown if telephonnumber contains characters like '(/\)- '
vtiger development
vtiger-tickets at trac.vtiger.com
Fri Oct 9 07:48:41 EDT 2009
#6341: Link to dataset of an incomming call is not shown if telephonnumber
contains characters like '(/\)- '
-----------------------+----------------------------------------------------
Reporter: paproth | Owner: developer
Type: defect | Status: new
Priority: minor | Milestone: 5.2.0
Component: vtigercrm | Version: 5.1.0
Keywords: |
-----------------------+----------------------------------------------------
On an incomming call the link to a specified dataset in the popup-window
is not shown, even if the dataset exists.
This occurs when the telephonnumber in the dataset contains characters
like '(/{)- '.
For examble: An existing dataset contains following telephonnumber:
'(0511) / 123 - 4' this number would not match.
Only if the number is written like this: '05111234'
The following sql-statement strips all these charactes from the dataset-
telephonenumber.
In file 'include/utils/utils.php':
function getCallerInfo($number){
global $adb, $log;
if(empty($number)){
return false;
}
$caller = "Unknown Number (Unknown)"; //declare caller as unknown
in beginning
$name['Accounts'] = "SELECT `accountid` AS `id`, `accountname` AS `name` "
. "FROM `vtiger_account` "
. "INNER JOIN `vtiger_crmentity` ON `crmid` = accountid
"
. "WHERE deleted = 0 "
. "AND
(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`phone` ),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ? "
. "OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`otherphone`),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ? "
. "OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`fax` ),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ?)";
$name['Contacts'] = "SELECT `contactid` AS `id`, CONCAT(`firstname`, ' ',
`lastname`) AS `name` "
. "FROM `vtiger_contactdetails` "
. "INNER JOIN `vtiger_crmentity` ON `crmid` =
`contactid` "
. "WHERE `deleted` = 0 "
. "AND
(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`phone`),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ? "
. "OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`mobile` ),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ? "
. "OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`fax` ),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ?)";
$name['Leads'] = "SELECT `leadid` AS `id`, CONCAT(`firstname`,'
',`lastname`) AS `name` "
. "FROM `vtiger_leaddetails` "
. "INNER JOIN `vtiger_crmentity` ON
`vtiger_crmentity`.`crmid` = `vtiger_leaddetails`.`leadid` "
. "INNER JOIN `vtiger_leadaddress` ON
`vtiger_leaddetails`.`leadid` = `vtiger_leadaddress`.`leadaddressid` "
. "WHERE `vtiger_crmentity`.`deleted` = 0 "
. "AND
(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`vtiger_leadaddress`.`phone`),'
',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ? "
. "OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`vtiger_leadaddress`.`mobile`
),' ',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ? "
. "OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`vtiger_leadaddress`.`fax`
),' ',''),'(',''),')',''),'-',''),'/',''),'\\\\','') = ?)";
foreach ($name as $module => $query) {
$result =
$adb->pquery($query,array($number,$number,$number));
if($adb->num_rows($result) > 0 ){
$callerName = $adb->query_result($result, 0,
"name");
$callerID = $adb->query_result($result,0,'id');
$data = array("name"=>$callerName,
"module"=>$module, "id"=>$callerID);
return $data;
}
}
return false;
}
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/6341>
vtiger development <http://trac.vtiger.com/>
vtigerCRM
More information about the vtigercrm-commits
mailing list