Merge pull request #6964 from colemanw/CRM-17176
[civicrm-core.git] / templates / CRM / Contact / Form / Merge.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 *}
26 <div class="crm-block crm-form-block crm-contact-merge-form-block">
27 <div id="help">
28 {ts}Click <strong>Merge</strong> to move data from the Duplicate Contact on the left into the Main Contact. In addition to the contact data (address, phone, email...), you may choose to move all or some of the related activity records (groups, contributions, memberships, etc.).{/ts} {help id="intro"}
29 </div>
30
31 <div class="crm-submit-buttons">
32 {include file="CRM/common/formButtons.tpl" location="top"}
33 {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if}
34 {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if}
35 </div>
36
37 <div class="action-link">
38 <a href="{$flip}" class="action-item crm-hover-button">
39 <i class="crm-i fa-random"></i>
40 {ts}Flip between original and duplicate contacts.{/ts}
41 </a>
42 </div>
43
44 <div class="action-link">
45 <a href="#" class="action-item crm-hover-button crm-notDuplicate" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;">
46 <i class="crm-i fa-times-circle"></i>
47 {ts}Mark this pair as not a duplicate.{/ts}
48 </a>
49 </div>
50
51 <table class="row-highlight">
52 <tr class="columnheader">
53 <th>&nbsp;</th>
54 <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$other_cid"}">{$other_name}</a> ({ts}duplicate{/ts})</th>
55 <th>{ts}Mark All{/ts}<br />=={$form.toggleSelect.html} ==&gt;</th>
56 <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$main_cid"}">{$main_name}</a></th>
57 </tr>
58 {foreach from=$rows item=row key=field}
59 <tr class="{cycle values="odd-row,even-row"}">
60 <td>{$row.title}</td>
61 <td>
62 {if !is_array($row.other)}
63 {$row.other}
64 {elseif $row.other.fileName}
65 {$row.other.fileName}
66 {else}
67 {', '|implode:$row.other}
68 {/if}
69 </td>
70 <td style='white-space: nowrap'>{if $form.$field}=={$form.$field.html|crmAddClass:"select-row"}==&gt;{/if}</td>
71 <td>
72 {if $row.title|substr:0:5 == "Email" OR
73 $row.title|substr:0:7 == "Address" OR
74 $row.title|substr:0:2 == "IM" OR
75 $row.title|substr:0:6 == "OpenID" OR
76 $row.title|substr:0:5 == "Phone"}
77
78 {assign var=position value=$field|strrpos:'_'}
79 {assign var=blockId value=$field|substr:$position+1}
80 {assign var=blockName value=$field|substr:14:$position-14}
81
82 {$form.location.$blockName.$blockId.locTypeId.html}&nbsp;
83 {if $blockName eq 'email' || $blockName eq 'phone' }
84 <span id="main_{$blockName}_{$blockId}_overwrite">{if $row.main}(overwrite){$form.location.$blockName.$blockId.operation.html}&nbsp;<br />{else}(add){/if}</span>
85 {literal}
86 <script type="text/javascript">
87 function mergeBlock(blockname, element, blockId) {
88 var allBlock = {/literal}{$mainLocBlock}{literal};
89 var block = eval( "allBlock." + 'main_'+ blockname + element.value);
90 if(blockname == 'email' || blockname == 'phone'){
91 var label = '(overwrite)'+ '<span id="main_blockname_blockId_overwrite">{/literal}{$form.location.$blockName.$blockId.operation.html}{literal}<br /></span>';
92 }
93 else {
94 label = '(overwrite)<br />';
95 }
96
97 if ( !block ) {
98 block = '';
99 label = '(add)';
100 }
101 cj( "#main_"+ blockname +"_" + blockId ).html( block );
102 cj( "#main_"+ blockname +"_" + blockId +"_overwrite" ).html( label );
103 }
104 </script>
105 {/literal}
106 {else}
107 <span id="main_{$blockName}_{$blockId}_overwrite">{if $row.main}(overwrite)<br />{else}(add){/if}</span>
108 {/if}
109
110 {/if}
111 {*NYSS 5546*}
112 <span id="main_{$blockName}_{$blockId}">
113 {if !is_array($row.main)}
114 {$row.main}
115 {elseif $row.main.fileName}
116 {$row.main.fileName}
117 {else}
118 {', '|implode:$row.main}
119 {/if}
120 </span>
121 </td>
122 </tr>
123 {/foreach}
124
125 {foreach from=$rel_tables item=params key=paramName}
126 {if $paramName eq 'move_rel_table_users'}
127 <tr class="{cycle values="even-row,odd-row"}">
128 <td><strong>{ts}Move related...{/ts}</strong></td><td>{if $otherUfId}<a target="_blank" href="{$params.other_url}">{$otherUfName}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==&gt;{else}<td style='white-space: nowrap'></td>{/if}</td><td>{if $mainUfId}<a target="_blank" href="{$params.main_url}">{$mainUfName}</a>{/if}</td>
129 </tr>
130 {else}
131 <tr class="{cycle values="even-row,odd-row"}">
132 <td><strong>{ts}Move related...{/ts}</strong></td><td><a href="{$params.other_url}">{$params.title}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==&gt;</td><td><a href="{$params.main_url}">{$params.title}</a>{if $form.operation.$paramName.add.html}&nbsp;{$form.operation.$paramName.add.html}{/if}</td>
133 </tr>
134 {/if}
135 {/foreach}
136 </table>
137 <div class='form-item'>
138 <!--<p>{$form.moveBelongings.html} {$form.moveBelongings.label}</p>-->
139 <!--<p>{$form.deleteOther.html} {$form.deleteOther.label}</p>-->
140 </div>
141 <div class="message status">
142 <p><strong>{ts}WARNING: The duplicate contact record WILL BE DELETED after the merge is complete.{/ts}</strong></p>
143 {if $user}
144 <p><strong>{ts 1=$config->userFramework}There are %1 user accounts associated with both the original and duplicate contacts. Ensure that the Drupal User you want to retain is on the right - if necessary use the 'Flip between original and duplicate contacts.' option at top to swap the positions of the two records before doing the merge.
145 The user record associated with the duplicate contact will not be deleted, but will be un-linked from the associated contact record (which will be deleted).
146 You will need to manually delete that user (click on the link to open Drupal User account in new screen). You may need to give thought to how you handle any content or contents associated with that user.{/ts}</strong></p>
147 {/if}
148 </div>
149
150 <div class="crm-submit-buttons">
151 {include file="CRM/common/formButtons.tpl" location="bottom"}
152 </div>
153
154 {literal}
155 <script type="text/javascript">
156
157 CRM.$(function($) {
158 $('table td input.form-checkbox').each(function() {
159 var ele = null;
160 var element = $(this).attr('id').split('_',3);
161
162 switch ( element['1'] ) {
163 case 'addressee':
164 ele = '#' + element['0'] + '_' + element['1'];
165 break;
166
167 case 'email':
168 case 'postal':
169 ele = '#' + element['0'] + '_' + element['1'] + '_' + element['2'];
170 break;
171 }
172
173 if( ele ) {
174 $(this).on('click', function() {
175 var val = $(this).prop('checked');
176 $('input' + ele + ', input' + ele + '_custom').prop('checked', val);
177 });
178 }
179 });
180 });
181
182 </script>
183 {/literal}
184
185 {* process the dupe contacts *}
186 {include file="CRM/common/dedupe.tpl"}