2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
40 <form name="EditView" id="EditView" method="POST" action="index.php">
41 <input type="hidden" name="module" value="MergeRecords">
42 <input type="hidden" name="record" value="{ID}">
43 <input type="hidden" name="merge_module" value="{MERGE_MODULE}">
44 <input type="hidden" name="action">
45 <input type="hidden" name="return_module" value="{RETURN_MODULE}">
46 <input type="hidden" name="return_id" value="{RETURN_ID}">
47 <input type="hidden" name="return_action" value="{RETURN_ACTION}">
48 <input type="hidden" name="change_parent" value="0">
49 <input type="hidden" name="change_parent_id" value="">
50 <input type="hidden" name="remove" value="0">
51 <input type="hidden" name="remove_id" value="">
52 <input type="hidden" name="merged_links" value="{MERGED_LINKS}">
55 <table width="100%" cellpadding="0" cellspacing="0" border="0">
57 <td align="left" style="padding-bottom: 2px;"><input title="{MOD.LBL_SAVE_MERGED_RECORD_BUTTON_TITLE}" class="button" onclick="return merge_verify();" type="submit" name="button" value=" {MOD.LBL_SAVE_MERGED_RECORD_BUTTON_LABEL} " id="save_merged_record_button" >
58 <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} " id="cancel_merge_button"></td>
59 <td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
62 <table width="100%" border="0" cellspacing="0" cellpadding="0" >
65 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabform">
67 <!-- BEGIN: merge_row_diff -->
68 <tr height="20">{FILE "modules/MergeRecords/MergeField.html"}</tr>
69 <!-- END: merge_row_diff -->
72 <!-- BEGIN: merge_row_similar -->
73 <tr height="20">{FILE "modules/MergeRecords/MergeField.html"}</tr>
74 <!-- END: merge_row_similar -->
80 <table width="100%" cellpadding="0" cellspacing="0" border="0">
82 <td align="left" style="padding-bottom: 2px;"><input title="{MOD.LBL_SAVE_MERGED_RECORD_BUTTON_TITLE}" class="button" onclick="return merge_verify();" type="submit" name="button" value=" {MOD.LBL_SAVE_MERGED_RECORD_BUTTON_LABEL} " >
83 <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} "></td>
89 <script type="text/javascript">
90 function merge_verify() {
91 if (!check_form('EditView')) {
95 var message="{MERGE_VERIFY}";
96 if (confirm(message)) {
97 document.EditView.action.value='SaveMerge';
103 function copy_value(json_array)
105 var target_element = document.getElementById(json_array['field_name']);
106 if(json_array['field_type'] == 'enum')
108 for(i=0; i < target_element.options.length; i++)
110 if(target_element.options[i].value == json_array['field_value'])
112 target_element.options[i].selected=true;
113 i=target_element.options.length+1;
117 else if(json_array['field_type'] == 'bool')
119 if(json_array['field_value'] == '1' || json_array['field_value'] == 'on')
120 target_element.checked=true;
122 target_element.checked=false;
124 else if(json_array['field_type'] == 'relate' || json_array['field_type'] == 'link')
126 for(popup_field in json_array['popup_fields'])
128 var target_element = document.getElementById(popup_field);
129 target_element.value = json_array['popup_fields'][popup_field];
130 //alert("Field:"+popup_field+"\nValue:"+json_array['popup_fields'][popup_field]);
133 else if(json_array['field_type'] == 'teamset')
135 var teams = json_array['field_value2'];
136 var isFirstFieldEmpty = collection['EditView_team_name'].clean_up();
140 collection['EditView_team_name'].js_more();
141 collection['EditView_team_name'].show_arrow_label(true);
143 for(team_id in teams) {
144 if(teams[team_id]['id']) {
146 temp_array['name'] = teams[team_id]['display_name'];
147 temp_array['id'] = teams[team_id]['id'];
148 if(isFirstFieldEmpty && index == 0){
149 collection['EditView_team_name'].replace_first(temp_array);
151 collection['EditView_team_name'].add(temp_array);
157 else if(json_array['field_type'] == 'datetimecombo'){
158 dt = json_array['field_value'];
159 date = dt.substr(0,10);
160 //Get hours and minutes and adjust as necessary
161 var hrs = parseInt(dt.substring(11,13), 10);
162 var mins = parseInt(dt.substring(14,16), 10);
164 //A safety scan to make sure hrs and minutes are formatted correctly
165 if (mins > 0 && mins < 15) {
167 } else if (mins > 15 && mins < 30) {
169 } else if (mins > 30 && mins < 45) {
171 } else if (mins > 45) {
176 document.getElementById(json_array['field_name']+'_date').value=date;
177 var hourObj = document.getElementById(json_array['field_name']+'_hours');
178 for(var i=0; i< hourObj.length; i++){
179 if(hourObj.options[i].value == hrs){
180 hourObj.options[i].selected='checked';
185 var minuteObj = document.getElementById(json_array['field_name']+'_minutes');
186 for(var i=0; i< minuteObj.length; i++){
187 if(minuteObj.options[i].value == mins){
188 minuteObj.options[i].selected='checked';
192 var hasMeridiem = /am|pm/i.test("{USER_DATEFORMAT}");
194 meridiem = trim(dt.substring(16));
195 var meridiemObj = document.getElementById(json_array['field_name'] + "_meridiem");
196 for(var i=0; i< meridiemObj.length; i++){
197 if(meridiemObj.options[i].value == meridiem){
198 meridiemObj.options[i].selected='checked';
202 target_element.value = json_array['field_value'];
204 else if(json_array['field_type'] == 'multienum'){
205 var multienumObj = document.getElementById(json_array['field_name']);
206 for(var i=0; i< multienumObj.length; i++){
208 if ( json_array['field_value'].indexOf(multienumObj.options[i].value) != -1 ) {
209 multienumObj.options[i].selected='checked';
212 multienumObj.options[i].selected = '';
218 target_element.value = json_array['field_value'];
223 function change_primary(button, new_id) {
224 document.EditView.change_parent.value='1';
225 document.EditView.change_parent_id.value=new_id;
226 document.EditView.action.value='Step3';
228 document.EditView.submit();
230 function remove_me(button, new_id) {
231 document.EditView.remove.value='1';
232 document.EditView.remove_id.value=new_id;
233 document.EditView.action.value='Step3';
235 document.EditView.submit();