Wednesday, August 7, 2013

Duplicate Finder

This is what i have find during surfing on internet,

Give an indication next to phone number if it is found to be repeated over various Contacts :

1.Create a process_record logic hook in custom/modules/Contacts/logic_hooks.php



<?php
$hook_array['process_record'][] = Array(1, 'Check Dup', 'custom/modules/Contacts/checkDup.php','checkDupC', 'checkDupF');

2. Create a file checkDup.php in SugarCRM/custom/modules/Contacts/








<?php
class checkDupC{
function checkDupF($bean){
$sContacts = $bean->db->query('SELECT contacts.id FROM contacts WHERE contacts.phone_work = "'.$bean->phone_work.'" AND contacts.id <> "'.$bean->id.'" AND contacts.phone_work IS NOT NULL', true);
$bFound = false;
while($aContacts = $bean->db->fetchByAssoc($sContacts)){
if(!empty($aContacts['id']))
$bFound = true;
}

if($bFound){
$bean->phone_work = $bean->phone_work."&nbsp;".SugarThemeRegistry::current()->getImage('no');
}
}
}

Now, refresh the list view and you should have (X) mark after phone number.









No comments:

Ad