Example #1
0
 /**
  * Process dupes.
  */
 public static function processDupes()
 {
     $oper = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
     $cid = CRM_Utils_Type::escape($_REQUEST['cid'], 'Positive');
     $oid = CRM_Utils_Type::escape($_REQUEST['oid'], 'Positive');
     if (!$oper || !$cid || !$oid) {
         return;
     }
     $exception = new CRM_Dedupe_DAO_Exception();
     $exception->contact_id1 = $cid;
     $exception->contact_id2 = $oid;
     //make sure contact2 > contact1.
     if ($cid > $oid) {
         $exception->contact_id1 = $oid;
         $exception->contact_id2 = $cid;
     }
     $exception->find(TRUE);
     $status = NULL;
     if ($oper == 'dupe-nondupe') {
         $status = $exception->save();
     }
     if ($oper == 'nondupe-dupe') {
         $status = $exception->delete();
     }
     CRM_Utils_JSON::output(array('status' => $status ? $oper : $status));
 }
Example #2
0
 /**
  * Function to process dupes.
  *
  */
 static function processDupes()
 {
     $oper = CRM_Utils_Type::escape($_POST['op'], 'String');
     $cid = CRM_Utils_Type::escape($_POST['cid'], 'Positive');
     $oid = CRM_Utils_Type::escape($_POST['oid'], 'Positive');
     if (!$oper || !$cid || !$oid) {
         return;
     }
     require_once 'CRM/Dedupe/DAO/Exception.php';
     $exception = new CRM_Dedupe_DAO_Exception();
     $exception->contact_id1 = $cid;
     $exception->contact_id2 = $oid;
     //make sure contact2 > contact1.
     if ($cid > $oid) {
         $exception->contact_id1 = $oid;
         $exception->contact_id2 = $cid;
     }
     $exception->find(true);
     $status = null;
     if ($oper == 'dupe-nondupe') {
         $status = $exception->save();
     }
     if ($oper == 'nondupe-dupe') {
         $status = $exception->delete();
     }
     echo json_encode(array('status' => $status ? $oper : $status));
     CRM_Utils_System::civiExit();
 }