First attempt at https://issues.civicrm.org/jira/browse/CRM-17556
[civicrm-core.git] / templates / CRM / Contact / Form / Merge.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
2c4c49ca 3 | CiviCRM version 4.7 |
6a488035 4 +--------------------------------------------------------------------+
e7112fa7 5 | Copyright CiviCRM LLC (c) 2004-2015 |
6a488035
TO
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">
f6eedce7 27<div class="help">
6a488035
TO
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
fd66df85 31<div class="crm-submit-buttons">
fd66df85 32 {include file="CRM/common/formButtons.tpl" location="top"}
f62db3ac
AH
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}
fd66df85 35</div>
6a488035
TO
36
37<div class="action-link">
fd66df85 38 <a href="{$flip}" class="action-item crm-hover-button">
f62db3ac 39 <i class="crm-i fa-random"></i>
fd66df85
CW
40 {ts}Flip between original and duplicate contacts.{/ts}
41 </a>
6a488035
TO
42</div>
43
44<div class="action-link">
aeb97cc1 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;">
f62db3ac 46 <i class="crm-i fa-times-circle"></i>
fd66df85
CW
47 {ts}Mark this pair as not a duplicate.{/ts}
48 </a>
6a488035
TO
49</div>
50
08ef1f91
R
51<div class="action-link">
52 <a href="javascript:void(0);" class="action-item crm-hover-button toggle_equal_rows">
53 <span class="icon ui-icon-circle-check"></span>
54 {ts}Show/hide rows with the same data on each contact record.{/ts}
55 </a>
56</div>
57
a76cd114 58<table class="row-highlight">
6a488035
TO
59 <tr class="columnheader">
60 <th>&nbsp;</th>
f1f27800 61 <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$other_cid"}">{$other_name}</a> ({ts}duplicate{/ts})</th>
6a488035 62 <th>{ts}Mark All{/ts}<br />=={$form.toggleSelect.html} ==&gt;</th>
f1f27800 63 <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$main_cid"}">{$main_name}</a></th>
08ef1f91
R
64 <th width="300">Add/overwrite?</th>
65 </tr>
66
67 {crmAPI var='other_result' entity='Contact' action='get' return="modified_date" id=$other_cid}
68
69 {crmAPI var='main_result' entity='Contact' action='get' return="modified_date" id=$main_cid}
70
71
72 <tr style="background-color: #FFFFCC !important; border-bottom:1px solid #ccc !important;">
73 <td>Last modified</td>
74 <td>{$other_result.values.0.modified_date|date_format:"%d/%m/%y %H:%M:%S"} {if $other_result.values.0.modified_date gt $main_result.values.0.modified_date} (Most recent) {/if}</td>
75 <td>{if $other_result.values.0.modified_date gt $main_result.values.0.modified_date} &gt;&gt;&gt;&gt;&gt;&gt; {else} &lt;&lt;&lt;&lt;&lt;&lt; {/if} </td>
76 <td>{$main_result.values.0.modified_date|date_format:"%d/%m/%y %H:%M:%S"} {if $main_result.values.0.modified_date gt $other_result.values.0.modified_date} (Most recent) {/if}</td>
77 <td></td>
6a488035 78 </tr>
08ef1f91 79
6a488035 80 {foreach from=$rows item=row key=field}
08ef1f91
R
81
82 {if !isset($row.main) && !isset($row.other)}
83 <tr style="background-color: #fff !important; border-bottom:1px solid #ccc !important;" class="no-data">
6a488035 84 <td>
08ef1f91 85 <strong>{$row.title}</strong>
6a488035 86 </td>
08ef1f91
R
87 {else}
88 {if $row.main eq $row.other}
89 <tr style="background-color: #EFFFE7 !important; border-bottom:1px solid #ccc !important;" class="equal-data {cycle values="odd-row,even-row"}">
90 {else}
91 <tr style="background-color: #FFECEC !important; border-bottom:1px solid #ccc !important;" class="diff-data {cycle values="odd-row,even-row"}">
92 {/if}
6a488035 93 <td>
08ef1f91
R
94 {$row.title}
95 </td>
96 {/if}
97
98 <td>
99 {if $row.title|substr:0:7 == "Address"}<span id="other_{$blockName}_{$blockId}" style="white-space:pre">{else}<span id="other_{$blockName}_{$blockId}">{/if}{if !is_array($row.other)}{$row.other}{elseif $row.other.fileName}{$row.other.fileName}{else}{', '|implode:$row.other}{/if}</span>
100 </td>
101
102 <td style='white-space: nowrap'>
103 {if $form.$field}=={$form.$field.html|crmAddClass:"select-row"}==&gt;{/if}
104 </td>
105
106 {assign var=position value=$field|strrpos:'_'}
107 {assign var=blockId value=$field|substr:$position+1}
108 {assign var=blockName value=$field|substr:14:$position-14}
109
110 {if $row.title|substr:0:5 == "Email" OR
111 $row.title|substr:0:7 == "Address" OR
112 $row.title|substr:0:2 == "IM" OR
113 $row.title|substr:0:7 == "Website" OR
114 $row.title|substr:0:5 == "Phone"}
115
116 <td>
117 {if $row.title|substr:0:7 == "Address"}<span id="main_{$blockName}_{$blockId}" style="white-space:pre">{else}<span id="main_{$blockName}_{$blockId}">{/if}{if !is_array($row.main)}{$row.main}{elseif $row.main.fileName}{$row.main.fileName}{else}{', '|implode:$row.main}{/if}</span>
118 </td>
119
120 <td>
121
122 {if $blockName eq 'email' || $blockName eq 'phone' || $blockName eq 'address' || $blockName eq 'im' }
6a488035 123 {$form.location.$blockName.$blockId.locTypeId.html}&nbsp;
08ef1f91
R
124 {/if}
125
126 {* TODO display other_type_id for websites, ims and phones *}
127 {if $blockName eq 'website' || $blockName eq 'im' || $blockName eq 'phone' }
128 {$form.type.$blockName.$blockId.typeTypeId.html}&nbsp;
129 {/if}
130
131 {if $blockName eq 'email' || $blockName eq 'phone' || $blockName eq 'website' || $blockName eq 'im' }
132 <span id="main_{$blockName}_{$blockId}_overwrite">
133 {if $row.main}
134 (overwrite){$form.location.$blockName.$blockId.html}&nbsp;<br />
135 {else}
136 (add)
137 {/if}
138 </span>
139 {/if}
140
141 {literal}
142 <script type="text/javascript">
143 function mergeBlock(blockname, element, blockId) {
144 var allBlock = {/literal}{$mainLocBlock}{literal};
145 var block = eval( "allBlock." + 'main_'+ blockname + element.value);
146 if(blockname == 'email' || blockname == 'phone'){
147 var label = '(overwrite)'+ '<span id="main_blockname_blockId_overwrite">{/literal}{$form.location.$blockName.$blockId.operation.html}{literal}<br /></span>';
148 }
149 else {
150 label = '(overwrite)<br />';
151 }
152
153 if ( !block ) {
154 block = '';
155 label = '(add)';
156 }
157 cj( "#main_"+ blockname +"_" + blockId ).html( block );
158 cj( "#main_"+ blockname +"_" + blockId +"_overwrite" ).html( label );
159 }
160 </script>
161 {/literal}
162
163 </td>
164
165 {else}
166
167 <td>
168 <span id="main_{$blockName}_{$blockId}">
169 {if !is_array($row.main)}
170 {$row.main}
171 {elseif $row.main.fileName}
172 {$row.main.fileName}
173 {else}
174 {', '|implode:$row.main}
6a488035 175 {/if}
08ef1f91
R
176 </span>
177 </td>
178
179 <td>
180
181 {if isset($row.main) || isset($row.other)}
182 <span id="main_{$blockName}_{$blockId}_overwrite">
183 {if $row.main}
184 (overwrite)<br />
185 {else}
186 (add)
187 {/if}
188 </span>
6a488035 189 {/if}
08ef1f91
R
190
191 </td>
192
193 {/if}
194 {*NYSS 5546*}
195
196
6a488035
TO
197 </tr>
198 {/foreach}
199
200 {foreach from=$rel_tables item=params key=paramName}
201 {if $paramName eq 'move_rel_table_users'}
202 <tr class="{cycle values="even-row,odd-row"}">
a76cd114 203 <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>
08ef1f91 204 <td>(migrate)</td>
6a488035
TO
205 </tr>
206 {else}
207 <tr class="{cycle values="even-row,odd-row"}">
a76cd114 208 <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>
08ef1f91 209 <td>(migrate)</td>
6a488035
TO
210 </tr>
211 {/if}
212 {/foreach}
213</table>
214<div class='form-item'>
215 <!--<p>{$form.moveBelongings.html} {$form.moveBelongings.label}</p>-->
216 <!--<p>{$form.deleteOther.html} {$form.deleteOther.label}</p>-->
217</div>
218<div class="message status">
219 <p><strong>{ts}WARNING: The duplicate contact record WILL BE DELETED after the merge is complete.{/ts}</strong></p>
220 {if $user}
221 <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.
222The 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).
223You 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>
224 {/if}
6a488035
TO
225</div>
226
fd66df85 227<div class="crm-submit-buttons">
fd66df85 228 {include file="CRM/common/formButtons.tpl" location="bottom"}
6a488035
TO
229</div>
230
231{literal}
232<script type="text/javascript">
233
ae8f569f
CW
234 CRM.$(function($) {
235 $('table td input.form-checkbox').each(function() {
6a488035 236 var ele = null;
ae8f569f 237 var element = $(this).attr('id').split('_',3);
6a488035
TO
238
239 switch ( element['1'] ) {
240 case 'addressee':
8539f25d 241 ele = '#' + element['0'] + '_' + element['1'];
6a488035
TO
242 break;
243
244 case 'email':
245 case 'postal':
8539f25d 246 ele = '#' + element['0'] + '_' + element['1'] + '_' + element['2'];
6a488035
TO
247 break;
248 }
249
250 if( ele ) {
ae8f569f
CW
251 $(this).on('click', function() {
252 var val = $(this).prop('checked');
253 $('input' + ele + ', input' + ele + '_custom').prop('checked', val);
6a488035
TO
254 });
255 }
256 });
ae8f569f 257 });
08ef1f91
R
258
259 // show / hide same data rows
260
261 CRM.$('.toggle_equal_rows').click( function() {
262 CRM.$('tr.equal-data').toggle();
263 });
6a488035
TO
264
265</script>
266{/literal}
267
268{* process the dupe contacts *}
269{include file="CRM/common/dedupe.tpl"}