1 {* common dupe contacts processing *}
2 <div id='processDupes' style="display:none;"></div>
4 <script type='text/javascript'>
6 cj( '#processDupes' ).hide( );
8 function processDupes(cid, oid, oper, context, reloadURL) {
9 //currently we are doing in a single way.
10 //later we might want two way operations.
12 if ( !cid || !oid || !oper ) return;
14 var title = {/literal}'{ts escape="js"}Mark as Dedupe Exception{/ts}'{literal};
15 var msg = {/literal}'{ts escape="js"}Are you sure you want to mark this pair of contacts as NOT duplicates?{/ts}'{literal};
16 if ( oper == 'nondupe-dupe' ) {
17 var title = {/literal}'{ts escape="js"}Remove Dedupe Exception{/ts}'{literal};
18 var msg = {/literal}'{ts escape="js"}Are you sure you want to remove this dedupe exception.{/ts}'{literal};
21 cj("#processDupes").show( );
22 cj("#processDupes").dialog({
27 cj( '#processDupes' ).show( ).html( msg );
31 "Cancel": function() {
32 cj(this).dialog("close");
35 saveProcessDupes( cid, oid, oper, context );
36 cj(this).dialog( 'close' );
37 if ( context == 'merge-contact' && reloadURL ) {
38 // redirect after a small delay
39 setTimeout("window.location.href = '" + reloadURL + "'", 500);
42 //CRM-15113 this has the effect of causing the alert to display. Also, as they are already 'actioned' Civi sensibly returns the browser to the
44 setTimeout(function(){
45 window.location.reload();
54 function saveProcessDupes( cid, oid, oper, context ) {
55 //currently we are doing in a single way.
56 //later we might want two way operations.
58 if ( !cid || !oid || !oper ) return;
60 var statusMsg = {/literal}'{ts escape="js"}Marked as non duplicates.{/ts}'{literal};
61 if ( oper == 'nondupe-dupe' ) {
62 var statusMsg = {/literal}'{ts escape="js"}Marked as duplicates.{/ts}'{literal};
65 var url = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=processDupes' h=0 }"{literal};
66 //post the data to process dupes.
68 {cid: cid, oid: oid, op: oper},
70 if ( result.status == oper ) {
72 if ( oper == 'dupe-nondupe' &&
73 context == 'dupe-listing' ) {
75 } else if ( oper == 'nondupe-dupe' ) {
76 cj( "#dupeRow_" + cid + '_' + oid ).hide( );