init
This commit is contained in:
49
modules/MergeRecords/Menu.php
Executable file
49
modules/MergeRecords/Menu.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
global $mod_strings, $app_strings;
|
||||
$module_menu = Array(
|
||||
//Nothing here yet
|
||||
);
|
||||
|
||||
?>
|
||||
93
modules/MergeRecords/Merge.js
Normal file
93
modules/MergeRecords/Merge.js
Normal file
@@ -0,0 +1,93 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
var lbl_remove=SUGAR.language.get('app_strings','LBL_REMOVE');function remove_filter(spanfieldid){var selspan=document.getElementById(spanfieldid);selspan.setAttribute("style","visibility:hidden");selspan.innerHTML='';var ops=object_refs['field_avail_list'].options;var newoption=new Option(selspan.getAttribute("Value"),selspan.getAttribute("ValueId"),false,true);ops.add(newoption);}
|
||||
function ajax_fetch_sync(url,post_data)
|
||||
{global_xmlhttp=getXMLHTTPinstance();var method='GET';if(typeof(post_data)!='undefined')
|
||||
{method='POST';}
|
||||
try
|
||||
{global_xmlhttp.open(method,url,false);}
|
||||
catch(error)
|
||||
{alert('message:'+error.message+":url:"+url);}
|
||||
if(method=='POST')
|
||||
{global_xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
|
||||
global_xmlhttp.send(post_data);var ajax_response={"responseText":global_xmlhttp.responseText,"responseXML":global_xmlhttp.responseXML};return ajax_response;}
|
||||
function get_fields_to_dedup(parent_mod)
|
||||
{var rel_map_div_obj=document.getElementById('rel_map');if(parent_mod!='')
|
||||
{var request_id=1;var url=site_url+'/index.php?to_pdf=1&sugar_body_only=1&inline=1&parent_module='+parent_mod+'&module=MigrationMappings&action=GetRelationshipsToMap';var ajax_return_obj=ajax_fetch_sync(url);try{eval("var responseObj ="+ajax_return_obj['responseText']);}
|
||||
catch(e){alert(ajax_return_obj['responseText']);}
|
||||
build_avail_rels_array(responseObj);rel_map_div_obj.innerHTML=responseObj['html_content'];}
|
||||
else
|
||||
{rel_map_div_obj.innerHTML='';}
|
||||
return true;}
|
||||
function get_dedup_fields()
|
||||
{var parent_div=document.getElementById('filter_def');var node;var spannode;var value;var valueid;var style;document.DedupSetup.dedup_fields.value='';for(node in parent_div.childNodes){spannode=parent_div.childNodes[node];if(spannode.tagName=='SPAN'){value=spannode.getAttribute('value');valueid=spannode.getAttribute('valueid');style=spannode.getAttribute('style');if(typeof(style)=='undefined'||style==null||style==''||style.lastIndexOf('hidden')==-1){if(document.DedupSetup.dedup_fields.value!=''){document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value+'#';}
|
||||
document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value+valueid;}}}}
|
||||
var object_refs=new Object();object_refs['field_include_list']=document.DedupSetup['field_include_list'];object_refs['field_avail_list']=document.DedupSetup['field_avail_list'];function setselected(included_name,avail_name)
|
||||
{var included_columns_ref=object_refs[included_name];var avail_columns_ref=object_refs[avail_name];var included_td=document.getElementById(included_name+'_td');var avail_td=document.getElementById(avail_name+'_td');var selected_avail=new Array();var notselected_avail=new Array();var notselected_include=new Array();for(i=0;i<avail_columns_ref.options.length;i++)
|
||||
{if(avail_columns_ref.options[i].selected==true)
|
||||
{selected_avail[selected_avail.length]={text:avail_columns_ref.options[i].text,value:avail_columns_ref.options[i].value};}
|
||||
else
|
||||
{notselected_avail[notselected_avail.length]={text:avail_columns_ref.options[i].text,value:avail_columns_ref.options[i].value};}}
|
||||
var right_select_html_info=new Object();var right_options=new Array();var right_select=new Object();right_select['name']=avail_name+'[]';right_select['id']=avail_name;right_select['multiple']='true';right_select['size']='10';for(i=0;i<notselected_avail.length;i++)
|
||||
{right_options[right_options.length]=notselected_avail[i];}
|
||||
right_select_html_info['options']=right_options;right_select_html_info['select']=right_select;var right_html=buildSelectHTML(right_select_html_info);avail_td.innerHTML=right_html;object_refs[avail_name]=avail_td.getElementsByTagName('select')[0];for(p=0;p<selected_avail.length;p++)
|
||||
{addFieldRow(selected_avail[p].value,selected_avail[p].text)}}
|
||||
function up(name){var td=document.getElementById(name+'_td');var obj=td.getElementsByTagName('select')[0];obj=(typeof obj=="string")?document.getElementById(obj):obj;if(obj.tagName.toLowerCase()!="select"&&obj.length<2)
|
||||
return false;var sel=new Array();for(i=0;i<obj.length;i++){if(obj[i].selected==true){sel[sel.length]=i;}}
|
||||
for(i in sel){if(sel[i]!=0&&!obj[sel[i]-1].selected){var tmp=new Array(obj[sel[i]-1].text,obj[sel[i]-1].value);obj[sel[i]-1].text=obj[sel[i]].text;obj[sel[i]-1].value=obj[sel[i]].value;obj[sel[i]].text=tmp[0];obj[sel[i]].value=tmp[1];obj[sel[i]-1].selected=true;obj[sel[i]].selected=false;}}}
|
||||
function down(name){var td=document.getElementById(name+'_td');var obj=td.getElementsByTagName('select')[0];if(obj.tagName.toLowerCase()!="select"&&obj.length<2)
|
||||
return false;var sel=new Array();for(i=obj.length-1;i>-1;i--){if(obj[i].selected==true){sel[sel.length]=i;}}
|
||||
for(i in sel){if(sel[i]!=obj.length-1&&!obj[sel[i]+1].selected){var tmp=new Array(obj[sel[i]+1].text,obj[sel[i]+1].value);obj[sel[i]+1].text=obj[sel[i]].text;obj[sel[i]+1].value=obj[sel[i]].value;obj[sel[i]].text=tmp[0];obj[sel[i]].value=tmp[1];obj[sel[i]+1].selected=true;obj[sel[i]].selected=false;}}}
|
||||
function buildSelectHTML(info)
|
||||
{var text;text="<div align='left'><select";if(typeof(info['select']['size'])!='undefined')
|
||||
{text+=" size=\""+info['select']['size']+"\"";}
|
||||
if(typeof(info['select']['name'])!='undefined')
|
||||
{text+=" name=\""+info['select']['name']+"\"";}
|
||||
if(typeof(info['select']['style'])!='undefined')
|
||||
{text+=" style=\""+info['select']['style']+"\"";}
|
||||
if(typeof(info['select']['onchange'])!='undefined')
|
||||
{text+=" onChange=\""+info['select']['onchange']+"\"";}
|
||||
if(typeof(info['select']['multiple'])!='undefined')
|
||||
{text+=" multiple";}
|
||||
text+=">";for(i=0;i<info['options'].length;i++)
|
||||
{option=info['options'][i];text+="<option value=\""+option['value']+"\" ";if(typeof(option['selected'])!='undefined'&&option['selected']==true)
|
||||
{text+="SELECTED";}
|
||||
text+=">"+option['text']+"</option>";}
|
||||
text+="</select></div>";return text;}
|
||||
var fieldCount=0;function addFieldRow(colName,colLabel){var tableId='search_type';var rowIdName='field';var fieldArrayCount;var optionVal;var optionDispVal;var optionsIndex=0;fieldCount=fieldCount+1;document.DedupSetup.num_fields.value=fieldCount;var selElement=document.createElement("select");var selectName=colName+"SearchType";selElement.setAttribute("name",selectName);var i=0;for(theoption in operator_options){selElement.options[i]=new Option(operator_options[theoption],theoption,false,false);i++;}
|
||||
var aElement=document.createElement("a");aElement.setAttribute("href","javascript:remove_filter('filter_"+colName+"')");aElement.setAttribute("class","listViewTdToolsS1");var imgElement=document.createElement("img");imgElement.setAttribute("src",delete_inline_image);imgElement.setAttribute("align","absmiddle");imgElement.setAttribute("alt",lbl_remove);imgElement.setAttribute("border","0");imgElement.setAttribute("height","12");imgElement.setAttribute("width","12");aElement.appendChild(imgElement);aElement.appendChild(document.createTextNode(" "));var div=document.getElementById('filter_def');var span1=document.getElementById('filter_'+colName);if(span1==null||span1==''||typeof(span1)=='undefined'){span1=document.createElement("span");}else{span1.setAttribute("style","visibility:visible");}
|
||||
span1.setAttribute("id",'filter_'+colName);span1.setAttribute("Value",colLabel);span1.setAttribute("ValueId",colName);var table=document.createElement("table");var row=table.insertRow(table.rows.length);table.setAttribute("width","100%");table.setAttribute("border","0");table.setAttribute("cellpadding","0");var td1=document.createElement("td");td1.setAttribute("width","2%");td1.appendChild(aElement);row.appendChild(td1)
|
||||
var td2=document.createElement("td");td2.setAttribute("width","20%");td2.appendChild(document.createTextNode(colLabel+': '));row.appendChild(td2)
|
||||
var td3=document.createElement("td");td3.setAttribute("width","10%");td3.appendChild(selElement);row.appendChild(td3);var coldata;eval("coldata=bean_data."+colName+";");var edit=document.createElement("input");edit.setAttribute("type","text");edit.setAttribute("name",colName+'SearchField');edit.setAttribute("id",colName+'SearchField');edit.setAttribute("value",coldata);var td5=document.createElement("td");td5.setAttribute("width","68%");td5.appendChild(edit);row.appendChild(td5);span1.appendChild(table);div.appendChild(span1);}
|
||||
124
modules/MergeRecords/MergeField.html
Executable file
124
modules/MergeRecords/MergeField.html
Executable file
@@ -0,0 +1,124 @@
|
||||
<!--
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/*********************************************************************************
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<!-- --------------------------------------------------------------------------- -->
|
||||
<!-- BEGIN: merge_cell_label -->
|
||||
<td width="{CELL_WIDTH}" valign="top" >{FIELD_LABEL} {REQUIRED_SYMBOL}</td>
|
||||
<!-- END: merge_cell_label -->
|
||||
<!-- --------------------------------------------------------------------------- -->
|
||||
<!-- BEGIN: merge_cell_edit_text -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><input name="{EDIT_FIELD_NAME}" id="{EDIT_FIELD_NAME}" tabindex="{TAB_INDEX}" size="35" maxlength="150" type="text" value="{EDIT_FIELD_VALUE}"></slot></td>
|
||||
<!-- END: merge_cell_edit_text -->
|
||||
<!-- BEGIN: merge_cell_edit_textarea -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><textarea name="{EDIT_FIELD_NAME}" id="{EDIT_FIELD_NAME}" tabindex="{TAB_INDEX}" cols="35" rows="4">{EDIT_FIELD_VALUE}</textarea></slot></td>
|
||||
<!-- END: merge_cell_edit_textarea -->
|
||||
<!-- BEGIN: merge_cell_edit_checkbox -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><input name="{EDIT_FIELD_NAME}" id="{EDIT_FIELD_NAME}" class="checkbox" tabindex="{TAB_INDEX}" type="checkbox" {EDIT_FIELD_VALUE}/></slot></td>
|
||||
<!-- END: merge_cell_edit_checkbox -->
|
||||
<!-- BEGIN: merge_cell_edit_datetime -->
|
||||
<td valign="top" width="{CELL_WIDTH}"><slot><input name='{EDIT_FIELD_NAME}' id='{EDIT_FIELD_NAME}_date' type="text" tabindex='{TAB_INDEX}' size='11' maxlength='10' value="{EDIT_FIELD_VALUE}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="{EDIT_FIELD_NAME}_trigger" align="absmiddle"> <span class="dateFormat"></span><span id='{EDIT_FIELD_NAME}_time_section' ></span><input type="hidden" name='{EDIT_FIELD_NAME}' id='{EDIT_FIELD_NAME}'></slot></td>
|
||||
<script type="text/javascript" src="include/SugarFields/Fields/Datetimecombo/Datetimecombo.js"></script>
|
||||
<script type="text/javascript">
|
||||
var combo_{EDIT_FIELD_NAME} = new Datetimecombo("{EDIT_FIELD_VALUE}", "{EDIT_FIELD_NAME}", "{USER_DATEFORMAT}", '','','');
|
||||
//Render the remaining widget fields
|
||||
text = combo_{EDIT_FIELD_NAME}.html('');
|
||||
document.getElementById('{EDIT_FIELD_NAME}_time_section').innerHTML = text;
|
||||
|
||||
//Call eval on the update function to handle updates to calendar picker object
|
||||
eval(combo_{EDIT_FIELD_NAME}.jsscript(''));
|
||||
|
||||
function update_{EDIT_FIELD_NAME}_available() {
|
||||
YAHOO.util.Event.onAvailable("{EDIT_FIELD_NAME}_date", this.handleOnAvailable, this);
|
||||
}
|
||||
|
||||
update_{EDIT_FIELD_NAME}_available.prototype.handleOnAvailable = function(me) {
|
||||
Calendar.setup ({
|
||||
onClose : update_{EDIT_FIELD_NAME},
|
||||
inputField : "{EDIT_FIELD_NAME}_date",
|
||||
daFormat : "{CALENDAR_DATEFORMAT}",
|
||||
ifFormat : "{CALENDAR_DATEFORMAT}",
|
||||
button : "{EDIT_FIELD_NAME}_trigger",
|
||||
singleClick : true,
|
||||
step : 1,
|
||||
weekNumbers:false
|
||||
});
|
||||
|
||||
//Call update for first time to round hours and minute values
|
||||
combo_{EDIT_FIELD_NAME}.update();
|
||||
}
|
||||
|
||||
var obj_{EDIT_FIELD_NAME} = new update_{EDIT_FIELD_NAME}_available();
|
||||
</script>
|
||||
<!-- END: merge_cell_edit_datetime -->
|
||||
<!-- BEGIN: merge_cell_edit_date -->
|
||||
<td valign="top" width="{CELL_WIDTH}"><slot><input name='{EDIT_FIELD_NAME}' id='{EDIT_FIELD_NAME}' type="text" tabindex='{TAB_INDEX}' size='11' maxlength='10' value="{EDIT_FIELD_VALUE}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="{EDIT_FIELD_NAME}_trigger" align="absmiddle"> <span class="dateFormat">{USER_DATEFORMAT}</span></slot></td>
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "{EDIT_FIELD_NAME}", daFormat : "{CALENDAR_DATEFORMAT}", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "{EDIT_FIELD_NAME}_trigger", singleClick : true, step : 1
|
||||
});
|
||||
</script>
|
||||
<!-- END: merge_cell_edit_date -->
|
||||
<!-- BEGIN: merge_cell_edit_dropdown -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><select tabindex="{TAB_INDEX}" name="{EDIT_FIELD_NAME}" id="{EDIT_FIELD_NAME}">{SELECT_OPTIONS}</select></slot></td>
|
||||
<!-- END: merge_cell_edit_dropdown -->
|
||||
<!-- BEGIN: merge_cell_edit_multidropdown -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><select tabindex="{TAB_INDEX}" name="{EDIT_FIELD_NAME}[]" id="{EDIT_FIELD_NAME}" multiple="true" size="6">{SELECT_OPTIONS}</select></slot></td>
|
||||
<!-- END: merge_cell_edit_multidropdown -->
|
||||
<!-- BEGIN: merge_cell_edit_popup -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><input class="sqsEnabled" autocomplete="off" tabindex="{TAB_INDEX}" "id="{POPUP_NAME_FIELD}" name="{POPUP_NAME_FIELD}" type="text" value="{POPUP_NAME_VALUE}"><input id='{POPUP_ID_FIELD}' name='{POPUP_ID_FIELD}' type="hidden" value="{POPUP_ID_VALUE}"/>
|
||||
<input title="{APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1' class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name=btn1
|
||||
onclick='open_popup("{POPUP_MODULE}", 600, 400, "", true, false, {ENCODED_POPUP_DATA},"single",true);' /></slot></td>
|
||||
<!-- END: merge_cell_edit_popup -->
|
||||
|
||||
<!-- --------------------------------------------------------------------------- -->
|
||||
<!-- --------------------------------------------------------------------------- -->
|
||||
|
||||
<!-- --------------------------------------------------------------------------- -->
|
||||
<!-- BEGIN: merge_cell_field_value -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><input title="{HOVER_TEXT}" class="button" onclick='copy_value({ENCODED_JSON_DATA});' type="button" name="copyValue" value="<<"/> {FIELD_VALUE}</slot></td>
|
||||
<!-- END: merge_cell_field_value -->
|
||||
<!-- BEGIN: merge_cell_field_value_checkbox -->
|
||||
<td width="{CELL_WIDTH}" valign="top" ><slot><input title="{HOVER_TEXT}" class="button" onclick='copy_value({ENCODED_JSON_DATA});' type="button" name="copyValue" value="<<"/> <input disabled type="checkbox" class="checkbox" {FIELD_VALUE}/></slot></td>
|
||||
<!-- END: merge_cell_field_value_checkbox -->
|
||||
<!-- --------------------------------------------------------------------------- -->
|
||||
334
modules/MergeRecords/MergeRecord.php
Executable file
334
modules/MergeRecords/MergeRecord.php
Executable file
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
if (!defined('sugarEntry') || !sugarEntry)
|
||||
die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
class MergeRecord extends SugarBean {
|
||||
var $object_name = 'MergeRecord';
|
||||
var $module_dir = 'MergeRecords';
|
||||
var $acl_display_only = true;
|
||||
var $merge_module;
|
||||
var $merge_bean_class;
|
||||
var $merge_bean_file_path;
|
||||
|
||||
var $merge_module2;
|
||||
var $merge_bean_class2;
|
||||
var $merge_bean_file_path2;
|
||||
|
||||
var $master_id;
|
||||
|
||||
//these arrays store the fields and params to search on
|
||||
var $field_search_params = Array ();
|
||||
|
||||
//this is a object for the bean you are merging on
|
||||
var $merge_bean;
|
||||
var $merge_bean2;
|
||||
|
||||
//store a copy of the merge bean related strings
|
||||
var $merge_bean_strings = Array ();
|
||||
|
||||
function MergeRecord($merge_module = '', $merge_id = '') {
|
||||
global $sugar_config;
|
||||
//parent :: SugarBean();
|
||||
|
||||
if ($merge_module != '')
|
||||
$this->load_merge_bean($merge_module, $merge_id);
|
||||
}
|
||||
|
||||
function retrieve($id) {
|
||||
if (isset ($_REQUEST['action']) && $_REQUEST['action'] == 'Step2')
|
||||
$this->load_merge_bean($this->merge_bean, false, $id);
|
||||
else
|
||||
parent :: retrieve($id);
|
||||
}
|
||||
|
||||
function load_merge_bean($merge_module, $load_module_strings = false, $merge_id = '') {
|
||||
global $moduleList;
|
||||
global $beanList;
|
||||
global $beanFiles;
|
||||
global $current_language;
|
||||
|
||||
$this->merge_module = $merge_module;
|
||||
$this->merge_bean_class = $beanList[$this->merge_module];
|
||||
$this->merge_bean_file_path = $beanFiles[$this->merge_bean_class];
|
||||
|
||||
require_once ($this->merge_bean_file_path);
|
||||
$this->merge_bean = new $this->merge_bean_class();
|
||||
if ($merge_id != '')
|
||||
$this->merge_bean->retrieve($merge_id);
|
||||
//load master module strings
|
||||
if ($load_module_strings)
|
||||
$this->merge_bean_strings = return_module_language($current_language, $merge_module);
|
||||
}
|
||||
|
||||
// Bug 22994, when the search key words are in other module, there needs to be another merge_bean.
|
||||
function load_merge_bean2($merge_module, $load_module_strings = false, $merge_id = '') {
|
||||
global $moduleList;
|
||||
global $beanList;
|
||||
global $beanFiles;
|
||||
global $current_language;
|
||||
|
||||
$this->merge_module2 = $merge_module;
|
||||
$this->merge_bean_class2 = $beanList[$this->merge_module2];
|
||||
$this->merge_bean_file_path2 = $beanFiles[$this->merge_bean_class2];
|
||||
|
||||
require_once ($this->merge_bean_file_path2);
|
||||
$this->merge_bean2 = new $this->merge_bean_class2();
|
||||
if ($merge_id != '')
|
||||
$this->merge_bean2->retrieve($merge_id);
|
||||
//load master module strings
|
||||
if ($load_module_strings)
|
||||
$this->merge_bean_strings2 = return_module_language($current_language, $merge_module);
|
||||
}
|
||||
|
||||
var $new_schema = true;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//-------------Wrapping Necessary Merge Bean Calls-----------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
function fill_in_additional_list_fields() {
|
||||
return $this->merge_bean->fill_in_additional_list_fields();
|
||||
}
|
||||
|
||||
function fill_in_additional_detail_fields() {
|
||||
return $this->merge_bean->fill_in_additional_detail_fields();
|
||||
}
|
||||
|
||||
function get_summary_text() {
|
||||
return $this->merge_bean->get_summary_text();
|
||||
}
|
||||
|
||||
function get_list_view_data() {
|
||||
return $this->merge_bean->get_list_view_data();
|
||||
}
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
builds a generic search based on the query string using or
|
||||
do not include any $this-> because this is called on without having the class instantiated
|
||||
*/
|
||||
function build_generic_where_clause($the_query_string) {
|
||||
return $this->merge_bean->build_generic_where_clause($the_query_string);
|
||||
}
|
||||
|
||||
//adding in 4.0+ acl function for possible acl stuff down the line
|
||||
function bean_implements($interface) {
|
||||
switch ($interface) {
|
||||
case 'ACL' :
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ACLAccess($view,$is_owner='not_set'){
|
||||
global $current_user;
|
||||
|
||||
//if the module doesn't implement ACLS or is empty
|
||||
if(empty($this->merge_bean) || !$this->merge_bean->bean_implements('ACL'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if($is_owner == 'not_set'){
|
||||
$is_owner = $this->merge_bean->isOwner($current_user->id);
|
||||
}
|
||||
return ACLController::checkAccess($this->merge_bean->module_dir,'edit', true);
|
||||
}
|
||||
|
||||
|
||||
//keep save function to handle anything special on merges
|
||||
function save($check_notify = FALSE) {
|
||||
//something here
|
||||
return parent :: save($check_notify);
|
||||
}
|
||||
|
||||
function populate_search_params($search_params) {
|
||||
foreach ($this->merge_bean->field_defs as $key=>$value) {
|
||||
$searchFieldString=$key.'SearchField';
|
||||
$searchTypeString=$key.'SearchType';
|
||||
|
||||
if (isset($search_params[$searchFieldString]) ) {
|
||||
|
||||
if (isset($search_params[$searchFieldString]) == '') {
|
||||
$this->field_search_params[$key]['value']='NULL';
|
||||
} else {
|
||||
$this->field_search_params[$key]['value']=$search_params[$searchFieldString];
|
||||
}
|
||||
if (isset ($search_params[$searchTypeString])) {
|
||||
$this->field_search_params[$key]['search_type'] = $search_params[$searchTypeString];
|
||||
} else {
|
||||
$this->field_search_params[$key]['search_type'] = 'Exact';
|
||||
}
|
||||
//add field_def to the array.
|
||||
$this->field_search_params[$key] = array_merge($value,$this->field_search_params[$key] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_inputs_for_search_params($search_params)
|
||||
{
|
||||
$returnString = '';
|
||||
foreach ($this->merge_bean->field_defs as $key=>$value) {
|
||||
$searchFieldString=$key.'SearchField';
|
||||
$searchTypeString=$key.'SearchType';
|
||||
|
||||
if (isset($search_params[$searchFieldString]) ) {
|
||||
$returnString .= "<input type='hidden' name='$searchFieldString' value='{$search_params[$searchFieldString]}' />\n";
|
||||
$returnString .= "<input type='hidden' name='$searchTypeString' value='{$search_params[$searchTypeString]}' />\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $returnString;
|
||||
}
|
||||
|
||||
function email_addresses_query($table, $module, $bean_id) {
|
||||
$query = $table.".id IN (SELECT ear.bean_id FROM email_addresses ea
|
||||
LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id
|
||||
WHERE ear.bean_module = '{$module}'
|
||||
AND ear.bean_id != '{$bean_id}'
|
||||
AND ear.deleted = 0";
|
||||
return $query;
|
||||
}
|
||||
|
||||
function release_name_query($search_type, $value) {
|
||||
$this->load_merge_bean2('Releases');
|
||||
if($search_type=='like') {
|
||||
$where = "releases.name LIKE '%".$GLOBALS['db']->quote($value)."%'";
|
||||
}
|
||||
elseif($search_type=='start'){
|
||||
$where = "releases.name LIKE '".$GLOBALS['db']->quote($value)."%'";
|
||||
}
|
||||
else {
|
||||
$where = "releases.name = '".$GLOBALS['db']->quote($value)."'";
|
||||
}
|
||||
$list=$this->merge_bean2->get_releases(false,'Active',$where);
|
||||
foreach($list as $key => $value){
|
||||
$list_to_join[]="'".$GLOBALS['db']->quote($key)."'";
|
||||
}
|
||||
$in=implode(', ', $list_to_join);
|
||||
return $in;
|
||||
}
|
||||
|
||||
function create_where_statement() {
|
||||
$where_clauses = array ();
|
||||
foreach ($this->field_search_params as $merge_field => $vDefArray) {
|
||||
if (isset ($vDefArray['source']) && $vDefArray['source'] == 'custom_fields') {
|
||||
$table_name = $this->merge_bean->table_name."_cstm";
|
||||
} else {
|
||||
$table_name = $this->merge_bean->table_name;
|
||||
}
|
||||
|
||||
//Should move these if's into a central location for extensibility and addition for other search filters
|
||||
//Must do the same for pulling values in js dropdown
|
||||
if (isset ($vDefArray['search_type']) && $vDefArray['search_type'] == 'like') {
|
||||
if ($merge_field != "email1" && $merge_field != "email2" && $merge_field !="release_name") {
|
||||
array_push($where_clauses, $table_name.".".$merge_field." LIKE '%".$GLOBALS['db']->quote($vDefArray['value'])."%'");
|
||||
}
|
||||
elseif($merge_field =="release_name"){
|
||||
if(isset($vDefArray['value'])){
|
||||
$in = $this->release_name_query('like',$vDefArray['value']);
|
||||
array_push($where_clauses, $table_name.".found_in_release IN ($in)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$query = $this->email_addresses_query($table_name, $this->merge_module, $this->merge_bean->id);
|
||||
$query .= " AND ea.email_address LIKE '%".$GLOBALS['db']->quote($vDefArray['value'])."%')";
|
||||
$where_clauses[] = $query;
|
||||
}
|
||||
}
|
||||
elseif (isset ($vDefArray['search_type']) && $vDefArray['search_type'] == 'start') {
|
||||
if ($merge_field != "email1" && $merge_field != "email2" && $merge_field !="release_name") {
|
||||
array_push($where_clauses, $table_name.".".$merge_field." LIKE '".$GLOBALS['db']->quote($vDefArray['value'])."%'");
|
||||
}
|
||||
elseif($merge_field =="release_name"){
|
||||
if(isset($vDefArray['value'])){
|
||||
$in = $this->release_name_query('start',$vDefArray['value']);
|
||||
array_push($where_clauses, $table_name.".found_in_release IN ($in)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$query = $this->email_addresses_query($table_name, $this->merge_module, $this->merge_bean->id);
|
||||
$query .= " AND ea.email_address LIKE '".$GLOBALS['db']->quote($vDefArray['value'])."%')";
|
||||
$where_clauses[] = $query;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($merge_field != "email1" && $merge_field != "email2" && $merge_field !="release_name") {
|
||||
array_push($where_clauses, $table_name.".".$merge_field."='".$GLOBALS['db']->quote($vDefArray['value'])."'");
|
||||
}
|
||||
elseif($merge_field =="release_name"){
|
||||
if(isset($vDefArray['value'])){
|
||||
$in = $this->release_name_query('exact',$vDefArray['value']);
|
||||
array_push($where_clauses, $table_name.".found_in_release IN ($in)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$query = $this->email_addresses_query($table_name, $this->merge_module, $this->merge_bean->id);
|
||||
$query .= " AND ea.email_address = '".$GLOBALS['db']->quote($vDefArray['value'])."')";
|
||||
$where_clauses[] = $query;
|
||||
}
|
||||
}
|
||||
}
|
||||
array_push($where_clauses, $this->merge_bean->table_name.".id !='".$GLOBALS['db']->quote($this->merge_bean->id)."'");
|
||||
return $where_clauses;
|
||||
}
|
||||
|
||||
//duplicating utils function for now for possiblity of future or/and and
|
||||
//other functionality
|
||||
function generate_where_statement($where_clauses) {
|
||||
$where = '';
|
||||
|
||||
foreach ($where_clauses as $clause) {
|
||||
if ($where != "")
|
||||
$where .= " AND ";
|
||||
$where .= $clause;
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
?>
|
||||
218
modules/MergeRecords/SaveMerge.php
Executable file
218
modules/MergeRecords/SaveMerge.php
Executable file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
$focus = new MergeRecord();
|
||||
$focus->load_merge_bean($_REQUEST['merge_module'], true, $_REQUEST['record']);
|
||||
|
||||
foreach($focus->merge_bean->column_fields as $field)
|
||||
{
|
||||
if(isset($_POST[$field]))
|
||||
{
|
||||
$value = $_POST[$field];
|
||||
if(is_array($value) && !empty($focus->merge_bean->field_defs[$field]['isMultiSelect'])) {
|
||||
if(empty($value[0])) {
|
||||
unset($value[0]);
|
||||
}
|
||||
$value = encodeMultienumValue($value);
|
||||
}
|
||||
$focus->merge_bean->$field = $value;
|
||||
}elseif (isset($focus->merge_bean->field_name_map[$field]['type']) && $focus->merge_bean->field_name_map[$field]['type'] == 'bool' ) {
|
||||
$focus->merge_bean->$field = 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($focus->merge_bean->additional_column_fields as $field)
|
||||
{
|
||||
if(isset($_POST[$field]))
|
||||
{
|
||||
$value = $_POST[$field];
|
||||
if(is_array($value) && !empty($focus->merge_bean->field_defs[$field]->properties['isMultiSelect'])) {
|
||||
if(empty($value[0])) {
|
||||
unset($value[0]);
|
||||
}
|
||||
$value = encodeMultienumValue($value);
|
||||
}
|
||||
$focus->merge_bean->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
global $check_notify;
|
||||
|
||||
$_REQUEST['useEmailWidget'] = true;
|
||||
$focus->merge_bean->save($check_notify);
|
||||
unset($_REQUEST['useEmailWidget']);
|
||||
|
||||
$return_id = $focus->merge_bean->id;
|
||||
$return_module = $focus->merge_module;
|
||||
$return_action = 'DetailView';
|
||||
|
||||
//handle realated data.
|
||||
|
||||
$linked_fields=$focus->merge_bean->get_linked_fields();
|
||||
|
||||
$exclude = explode(',', $_REQUEST['merged_links']);
|
||||
|
||||
if (is_array($_POST['merged_ids'])) {
|
||||
foreach ($_POST['merged_ids'] as $id) {
|
||||
require_once ($focus->merge_bean_file_path);
|
||||
$mergesource = new $focus->merge_bean_class();
|
||||
$mergesource->retrieve($id);
|
||||
//kbrill Bug #13826
|
||||
foreach ($linked_fields as $name => $properties) {
|
||||
if ($properties['name']=='modified_user_link' || in_array($properties['name'], $exclude))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (isset($properties['duplicate_merge'])) {
|
||||
if ($properties['duplicate_merge']=='disabled' or
|
||||
$properties['duplicate_merge']=='false' or
|
||||
$properties['name']=='assigned_user_link') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($name == 'accounts' && $focus->merge_bean->module_dir == 'Opportunities')
|
||||
continue;
|
||||
|
||||
|
||||
if ($mergesource->load_relationship($name)) {
|
||||
//check to see if loaded relationship is with email address
|
||||
$relName=$mergesource->$name->getRelatedModuleName();
|
||||
if (!empty($relName) and strtolower($relName)=='emailaddresses'){
|
||||
//handle email address merge
|
||||
handleEmailMerge($focus,$name,$mergesource->$name->get());
|
||||
}else{
|
||||
$data=$mergesource->$name->get();
|
||||
if (is_array($data)) {
|
||||
if ($focus->merge_bean->load_relationship($name) ) {
|
||||
foreach ($data as $related_id) {
|
||||
//add to primary bean
|
||||
$focus->merge_bean->$name->add($related_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//END Bug #13826
|
||||
//delete the child bean, this action will cascade into related data too.
|
||||
$mergesource->mark_deleted($mergesource->id);
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("Merged record with id of ".$return_id);
|
||||
|
||||
header("Location: index.php?action=$return_action&module=$return_module&record=$return_id");
|
||||
|
||||
|
||||
//This function will compare the email addresses to be merged and only add the email id's
|
||||
//of the email addresses that are not duplicates.
|
||||
//$focus - Merge Bean
|
||||
//$name - name of relationship (email_addresses)
|
||||
//$data - array of email id's that will be merged into existing bean.
|
||||
function handleEmailMerge($focus,$name,$data){
|
||||
$mrgArray = array();
|
||||
//get the email id's to merge
|
||||
$existingData=$data;
|
||||
|
||||
//make sure id's to merge exist and are in array format
|
||||
|
||||
//get the existing email id's
|
||||
$focus->merge_bean->load_relationship($name);
|
||||
$exData=$focus->merge_bean->$name->get();
|
||||
|
||||
if (!is_array($existingData) || empty($existingData)) {
|
||||
return ;
|
||||
}
|
||||
//query email and retrieve existing email address
|
||||
$exEmailQuery = 'Select id, email_address from email_addresses where id in (';
|
||||
$first = true;
|
||||
foreach($exData as $id){
|
||||
if($first){
|
||||
$exEmailQuery .= " '$id' ";
|
||||
$first = false;
|
||||
}else{
|
||||
$exEmailQuery .= ", '$id' ";
|
||||
$first = false;
|
||||
}
|
||||
}
|
||||
$exEmailQuery .= ')';
|
||||
|
||||
$exResult = $focus->merge_bean->db->query($exEmailQuery);
|
||||
while(($row=$focus->merge_bean->db->fetchByAssoc($exResult))!= null) {
|
||||
$existingEmails[$row['id']]=$row['email_address'];
|
||||
}
|
||||
|
||||
|
||||
//query email and retrieve email address to be linked.
|
||||
$newEmailQuery = 'Select id, email_address from email_addresses where id in (';
|
||||
$first = true;
|
||||
foreach($existingData as $id){
|
||||
if($first){
|
||||
$newEmailQuery .= " '$id' ";
|
||||
$first = false;
|
||||
}else{
|
||||
$newEmailQuery .= ", '$id' ";
|
||||
$first = false;
|
||||
}
|
||||
}
|
||||
$newEmailQuery .= ')';
|
||||
|
||||
$newResult = $focus->merge_bean->db->query($newEmailQuery);
|
||||
while(($row=$focus->merge_bean->db->fetchByAssoc($newResult))!= null) {
|
||||
$newEmails[$row['id']]=$row['email_address'];
|
||||
}
|
||||
|
||||
//compare the two arrays and remove duplicates
|
||||
foreach($newEmails as $k=>$n){
|
||||
if(!in_array($n,$existingEmails)){
|
||||
$mrgArray[$k] = $n;
|
||||
}
|
||||
}
|
||||
|
||||
//add email id's.
|
||||
foreach ($mrgArray as $related_id=>$related_val) {
|
||||
//add to primary bean
|
||||
$focus->merge_bean->$name->add($related_id);
|
||||
}
|
||||
}
|
||||
?>
|
||||
102
modules/MergeRecords/SearchForm.html
Executable file
102
modules/MergeRecords/SearchForm.html
Executable file
@@ -0,0 +1,102 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* {APP.LBL_CURRENCY_SYM}Header: /cvsroot/sugarcrm/sugarcrm/modules/Cases/SearchForm.html,v 1.4 2004/07/02 04:34:05 sugarjacob Exp {APP.LBL_CURRENCY_SYM}
|
||||
********************************************************************************/
|
||||
-->
|
||||
<!-- BEGIN: main -->
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="edit view">
|
||||
<tr><td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<form>
|
||||
<td scope="row" noWrap><slot>{MOD.LBL_NUMBER}</slot> <slot><input type=text size="15" name="case_number" class=dataField value="{CASE_NUMBER}" /></slot>
|
||||
</td>
|
||||
<td scope="row" noWrap><slot>{MOD.LBL_SUBJECT}</slot> <slot><input type=text size="20" name="name" class=dataField value="{NAME}" /></slot></td>
|
||||
<td scope="row" noWrap><slot>{MOD.LBL_ACCOUNT_NAME}</slot> <slot><input type=text size="20" name="account_name" class=dataField value="{ACCOUNT_NAME}" /></slot></td>
|
||||
<td scope="row">{APP.LBL_CURRENT_USER_FILTER} <input name='current_user_only' onchange='this.form.submit();' class="checkbox" type="checkbox" {CURRENT_USER_ONLY}></td>
|
||||
<td align="right"><input type="hidden" name="action" value="index"/>
|
||||
<input type="hidden" name="query" value="true"/>
|
||||
<input type="hidden" name="module" value="Cases" />
|
||||
<input title="{APP.LBL_SEARCH_BUTTON_TITLE}" accessKey="{APP.LBL_SEARCH_BUTTON_KEY}" class="button" type="submit" name="button" value="{APP.LBL_SEARCH_BUTTON_LABEL}"/>
|
||||
<input title="{APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{APP.LBL_CLEAR_BUTTON_KEY}" onclick="clear_form(this.form);" class="button" type="button" name="clear" value=" {APP.LBL_CLEAR_BUTTON_LABEL} "/>
|
||||
<br>
|
||||
<a href='index.php?module=Cases&action=index&advanced=true' class="tabFormAdvLink">{ADVANCED_SEARCH_PNG}</a> <a href='index.php?module=Cases&action=index&advanced=true' class="tabFormAdvLink">{APP.LNK_ADVANCED_SEARCH}</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
{JAVASCRIPT}
|
||||
<!-- END: main -->
|
||||
|
||||
<!-- BEGIN: advanced -->
|
||||
|
||||
<form>
|
||||
<input type="hidden" name="module" value="Cases">
|
||||
<input type="hidden" name="action" value='index'>
|
||||
<input type="hidden" name="query" value="true"/>
|
||||
<input type="hidden" name="advanced" value="true"/>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="20%" scope="row"><slot>{MOD.LBL_SUBJECT}</slot></td>
|
||||
<td width="25%" ><slot><input name='name' type="text" tabindex='1' size='25' maxlength='50' value="{NAME}"></slot></td>
|
||||
<td width="20%" scope="row"><slot>{MOD.LBL_CASE_NUMBER}</slot></td>
|
||||
<td width="25%" ><slot><input name='case_number' tabindex='2' size='15' type="text" value='{CASE_NUMBER}'></slot></td>
|
||||
<td width="10%" rowspan="3" scope="row" align="right" ><slot><input title="{APP.LBL_SEARCH_BUTTON_TITLE}" accessKey="{APP.LBL_SEARCH_BUTTON_KEY}" class="button" type="submit" name="button" value="{APP.LBL_SEARCH_BUTTON_LABEL}"/> <input title="{APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{APP.LBL_CLEAR_BUTTON_KEY}" onclick="clear_form(this.form);" class="button" type="button" name="clear" value=" {APP.LBL_CLEAR_BUTTON_LABEL} "/>
|
||||
<br><a href='index.php?module=Cases&action=index&query=true' class="tabFormAdvLink">{BASIC_SEARCH_PNG}</a> <a href='index.php?module=Cases&action=index&query=true' class="tabFormAdvLink">{APP.LNK_BASIC_SEARCH}</a>
|
||||
</slot></td>
|
||||
</tr><tr>
|
||||
<td scope="row"><slot>{MOD.LBL_ACCOUNT_NAME}</slot></td>
|
||||
<td ><slot><input name='account_name' tabindex='1' type='text' value="{ACCOUNT_NAME}"></slot></td>
|
||||
<td scope="row"><slot>{MOD.LBL_STATUS}</slot></td>
|
||||
<td ><slot><select tabindex='2' size="3" name='status[]' multiple="true">{STATUS_OPTIONS}</select></slot></td>
|
||||
</tr><tr>
|
||||
<td scope="row"><slot>{APP.LBL_ASSIGNED_TO}</slot></td>
|
||||
<td ><slot><select size="3" tabindex='1' name='assigned_user_id[]' multiple="multiple">{USER_FILTER}</select></slot></td>
|
||||
<td scope="row"><slot>{MOD.LBL_PRIORITY}</slot></td>
|
||||
<td ><slot><select tabindex='2' size="3" name='priority[]' multiple="true">{PRIORITY_OPTIONS}</select></slot></td>
|
||||
</tr></table>
|
||||
</td></tr></table>
|
||||
</form>
|
||||
{JAVASCRIPT}
|
||||
<!-- END: advanced -->
|
||||
129
modules/MergeRecords/Step1.html
Executable file
129
modules/MergeRecords/Step1.html
Executable file
@@ -0,0 +1,129 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
********************************************************************************/
|
||||
-->
|
||||
<!-- BEGIN: main -->
|
||||
{MOD.LBL_STEP1_DIRECTIONS}
|
||||
<br><br>
|
||||
<script type="text/javascript">
|
||||
var bean_data={BEANDATA};
|
||||
var site_url="{URL}";
|
||||
var delete_inline_image="{DELETE_INLINE_IMAGE}";
|
||||
var operator_options={OPERATOR_OPTIONS};
|
||||
</script>
|
||||
<script src="include/javascript/quicksearch.js" type="text/javascript"></script>
|
||||
<form name="DedupSetup" id="DedupSetup" method="POST" action="index.php">
|
||||
<input type="hidden" name="module" value="MergeRecords"/>
|
||||
<input type="hidden" name="merge_module" value="{MERGE_MODULE}"/>
|
||||
<input type="hidden" name="record" value="{ID}"/>
|
||||
<input type="hidden" name="action" value="Step2"/>
|
||||
<input type="hidden" name="return_module" value="{RETURN_MODULE}"/>
|
||||
<input type="hidden" name="return_id" value="{RETURN_ID}"/>
|
||||
<input type="hidden" name="return_action" value="{RETURN_ACTION}"/>
|
||||
<input type="hidden" name="dedup_fields" value=""/>
|
||||
<input type="hidden" name="num_fields" value="0"/>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td><input title="{MOD.LBL_NEXT_STEP_TITLE}" accessKey="{MOD.LBL_NEXT_STEP_BUTTON_KEY}" class="button" onclick="this.form.action.value='Step2';" type="submit" name="button" value=" {MOD.LBL_NEXT_STEP_BUTTON_LABEL} " > <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>
|
||||
<td align='right'>{ADMIN_EDIT}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list view">
|
||||
<!-- BEGIN: select_module -->
|
||||
<tr>
|
||||
<td width="45%"><slot>{MOD.LBL_SELECT_MODULE}:</slot></td>
|
||||
<td width="5%"><slot> </slot></td>
|
||||
<td width="50%"><slot> </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="45%"><slot><select name="selected_module" id="selected_module" onchange="grab_fields();">{MIGRATION_MODULE_OPTIONS}</select></slot></td>
|
||||
<td width="5%"><slot> </slot></td>
|
||||
<td width="50%"><slot> </slot></td>
|
||||
</tr>
|
||||
<!-- END: select_module -->
|
||||
<tr>
|
||||
<td width="100%" class="edit view" colspan="3">
|
||||
<div id="field_select_block">
|
||||
<!-- BEGIN: field_select_block -->
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="25%" align="left" >{MOD.LBL_AVAIL_FIELDS}:</td>
|
||||
<td width="2%" > </td>
|
||||
<td width="73%" >{MOD.LBL_FILTER_COND}:</td>
|
||||
</tr>
|
||||
<tr id="multi_select_row">
|
||||
<td id="field_avail_list_td"><slot><div align="left"><select name="field_avail_list[]" id="field_avail_list" multiple="multiple" size="10" >{FIELD_AVAIL_OPTIONS}</select></div></slot></td>
|
||||
<td valign="top" style="padding-right: 2px; padding-left: 2px;">
|
||||
<div align="center">
|
||||
<a onclick="javascript:setselected('field_include_list','field_avail_list');">
|
||||
<img src='{RIGHTARROW_BIG_IMAGE}' width='16' height='16' border="0" style="margin-left: 1px;" alt="{LBL_ADD_BUTTON}">
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left"><div id='filter_def' width="100%" align="left">{PRE_LOADED_FIELDS}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END: field_select_block -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
{JAVASCRIPT}
|
||||
<script type="text/javascript">
|
||||
|
||||
function check_selected_module()
|
||||
{
|
||||
if(document.StartDedup.selected_module.value =='') {
|
||||
alert("Please select a module to work with.");
|
||||
document.StartDedup.selected_module.focus();
|
||||
return false;
|
||||
} else { return true; }
|
||||
}
|
||||
|
||||
function grab_fields()
|
||||
{
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="modules/MergeRecords/Merge.js"></script>
|
||||
<!-- END: main -->
|
||||
188
modules/MergeRecords/Step1.php
Executable file
188
modules/MergeRecords/Step1.php
Executable file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/JSON.php');
|
||||
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
global $app_list_strings;
|
||||
global $current_language;
|
||||
global $currentModule;
|
||||
global $theme;
|
||||
|
||||
$json=new JSON(JSON_LOOSE_TYPE);
|
||||
|
||||
$current_module_strings = return_module_language($current_language, 'MergeRecords');
|
||||
|
||||
if (!isset($where)) $where = "";
|
||||
|
||||
$focus = new MergeRecord();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//get instance of master record and retrieve related record
|
||||
//and items
|
||||
////////////////////////////////////////////////////////////
|
||||
$focus->merge_module = $_REQUEST['return_module'];
|
||||
$focus->load_merge_bean($focus->merge_module, true, $_REQUEST['record']);
|
||||
|
||||
|
||||
//get all available column fields
|
||||
//TO DO: add custom field handling
|
||||
$avail_fields=array();
|
||||
$sel_fields=array();
|
||||
$temp_field_array = $focus->merge_bean->field_defs;
|
||||
$bean_data=array();
|
||||
foreach($temp_field_array as $field_array)
|
||||
{
|
||||
if (isset($field_array['merge_filter'])
|
||||
) {
|
||||
if (strtolower($field_array['merge_filter'])=='enabled' or strtolower($field_array['merge_filter'])=='selected') {
|
||||
$col_name = $field_array['name'];
|
||||
|
||||
|
||||
if(!isset($focus->merge_bean_strings[$field_array['vname']])) {
|
||||
$col_label = $col_name;
|
||||
}
|
||||
else {
|
||||
$col_label = str_replace(':', '', $focus->merge_bean_strings[$field_array['vname']]);
|
||||
}
|
||||
|
||||
if (strtolower($field_array['merge_filter'])=='selected') {
|
||||
$sel_fields[$col_name]=$col_label;
|
||||
} else {
|
||||
$avail_fields[$col_name] = $col_label;
|
||||
}
|
||||
|
||||
$bean_data[$col_name]=$focus->merge_bean->$col_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
//Print the master record header to the page
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=index'>{$GLOBALS['app_list_strings']['moduleList'][$focus->merge_bean->module_dir]}</a>";
|
||||
$params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=DetailView&record={$focus->merge_bean->id}'>{$focus->merge_bean->name}</a>";
|
||||
$params[] = $mod_strings['LBL_LBL_MERGE_RECORDS_STEP_1'];
|
||||
echo getClassicModuleTitle($focus->merge_bean->module_dir, $params, true);
|
||||
|
||||
$xtpl = new XTemplate ('modules/MergeRecords/Step1.html');
|
||||
$xtpl->assign("MOD", $mod_strings);
|
||||
$xtpl->assign("APP", $app_strings);
|
||||
$xtpl->assign("BEANDATA",$json->encode($bean_data));
|
||||
//This is for the implemetation of finding all dupes for a module, not just
|
||||
//dupes for a particular record
|
||||
//commenting this out for now
|
||||
//$choose_master_by_options = array('First Record Found', 'Most Recent Record', 'Oldest Record', 'Record Containing Most Data');
|
||||
//$xtpl->assign("CHOOSE_MASTER_BY_OPTIONS", get_select_options_with_id($choose_master_by_options, 'First Record Found'));
|
||||
|
||||
$xtpl->assign("MERGE_MODULE", $focus->merge_module);
|
||||
$xtpl->assign("ID", $focus->merge_bean->id);
|
||||
|
||||
$xtpl->assign("FIELD_AVAIL_OPTIONS", get_select_options_with_id($avail_fields,''));
|
||||
$xtpl->assign("LBL_ADD_BUTTON", translate('LBL_ADD_BUTTON'));
|
||||
|
||||
if(isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
|
||||
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
|
||||
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
|
||||
|
||||
//set the url
|
||||
$port=null;
|
||||
if(isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
|
||||
$port = $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
$xtpl->assign("URL", appendPortToHost($sugar_config['site_url'], $port));
|
||||
//set images
|
||||
$xtpl->assign("RIGHTARROW_BIG_IMAGE", SugarThemeRegistry::current()->getImageURL('rightarrow_big.gif'));
|
||||
$xtpl->assign("DELETE_INLINE_IMAGE", SugarThemeRegistry::current()->getImageURL('delete_inline.gif'));
|
||||
|
||||
//process preloaded filter.
|
||||
$pre_loaded=null;
|
||||
foreach ($sel_fields as $colName=>$colLabel) {
|
||||
$pre_loaded.=addFieldRow($colName,$colLabel,$bean_data[$colName]);
|
||||
}
|
||||
$xtpl->assign("PRE_LOADED_FIELDS",$pre_loaded);
|
||||
$xtpl->assign("OPERATOR_OPTIONS",$json->encode($app_list_strings['merge_operators_dom']));
|
||||
|
||||
|
||||
$xtpl->parse("main.field_select_block");
|
||||
|
||||
$xtpl->parse("main");
|
||||
$xtpl->out("main");
|
||||
|
||||
|
||||
/**
|
||||
* This function is equivalent of AddFieldRow in merge.js. is being used to
|
||||
* preload the filter criteria based on the vardef.
|
||||
* <span><table><tr><td></td><td></td><td></td></tr></table></span>
|
||||
*/
|
||||
function addFieldRow($colName,$colLabel,$colValue) {
|
||||
global $theme, $app_list_strings;
|
||||
|
||||
static $operator_options;
|
||||
if (empty($operator_options)) {
|
||||
$operator_options= get_select_options_with_id($app_list_strings['merge_operators_dom'],'');
|
||||
}
|
||||
|
||||
$LBL_REMOVE = translate('LBL_REMOVE');
|
||||
$deleteInlineImage = SugarThemeRegistry::current()->getImageURL('delete_inline.gif');
|
||||
$snippet=<<<EOQ
|
||||
<span id=filter_{$colName} style='visibility:visible' value="{$colLabel}" valueId="{$colName}">
|
||||
<table width='100%' border='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td width='2%'><a class="listViewTdToolsS1" href="javascript:remove_filter('filter_{$colName}')"><img src='{$deleteInlineImage}' align='absmiddle' alt='{$LBL_REMOVE}' border='0' height='12' width='12'> </a></td>
|
||||
<td width='20%'>{$colLabel}: </td>
|
||||
<td width='10%'><select name='{$colName}SearchType'>{$operator_options}</select></td>
|
||||
<td width='68%'><input value="{$colValue}" id="{$colName}SearchField" name="{$colName}SearchField" type="text"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
EOQ;
|
||||
|
||||
return $snippet;
|
||||
}
|
||||
41
modules/MergeRecords/Step2.html
Executable file
41
modules/MergeRecords/Step2.html
Executable file
@@ -0,0 +1,41 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
********************************************************************************/
|
||||
-->
|
||||
<!-- BEGIN: main -->
|
||||
|
||||
<!-- END: main -->
|
||||
213
modules/MergeRecords/Step2.php
Executable file
213
modules/MergeRecords/Step2.php
Executable file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/ListView/ListViewSmarty.php');
|
||||
require_once('include/MVC/View/views/view.list.php');
|
||||
global $app_strings;
|
||||
global $app_list_strings;
|
||||
global $current_language;
|
||||
global $urlPrefix;
|
||||
global $currentModule;
|
||||
global $theme;
|
||||
|
||||
$current_module_strings = return_module_language($current_language, 'MergeRecords');
|
||||
|
||||
|
||||
$focus = new MergeRecord();
|
||||
$focus->load_merge_bean($_REQUEST['merge_module'], true, $_REQUEST['record']);
|
||||
|
||||
$this->bean = $focus->merge_bean;
|
||||
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=index'>{$GLOBALS['app_list_strings']['moduleList'][$focus->merge_bean->module_dir]}</a>";
|
||||
$params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=DetailView&record={$focus->merge_bean->id}'>{$focus->merge_bean->name}</a>";
|
||||
$params[] = $mod_strings['LBL_STEP2_FORM_TITLE'];
|
||||
echo getClassicModuleTitle($focus->merge_bean->module_dir, $params, true);
|
||||
|
||||
$order_by_name = $focus->merge_module.'2_'.strtoupper($focus->merge_bean->object_name).'_ORDER_BY' ;
|
||||
$lvso = isset($_REQUEST['lvso'])?$_REQUEST['lvso']:"";
|
||||
$request_order_by_name = isset($_REQUEST[$order_by_name])?$_REQUEST[$order_by_name]:"";
|
||||
|
||||
echo '<form onsubmit="return check_form(\'MassUpdate\');" id="MassUpdate" name="MassUpdate" method="post" action="index.php">'
|
||||
.'<input type="hidden" value="Step2" name="action"/>'
|
||||
.'<input type="hidden" value="true" name="massupdate"/>'
|
||||
.'<input type="hidden" value="false" name="delete"/>'
|
||||
.'<input type="hidden" value="false" name="merge"/>'
|
||||
.'<input type="hidden" value="MergeRecords" name="module"/>'
|
||||
."<input type='hidden' name='lvso' value='{$lvso}' />"
|
||||
."<input type='hidden' name='{$order_by_name}' value='{$request_order_by_name}' />";
|
||||
|
||||
$focus->populate_search_params($_REQUEST);
|
||||
echo $focus->get_inputs_for_search_params($_REQUEST);
|
||||
|
||||
$where_clauses = Array();
|
||||
$where_clauses = $focus->create_where_statement();
|
||||
$where = $focus->generate_where_statement($where_clauses);
|
||||
|
||||
$ListView = new ListViewSmarty();
|
||||
$ListView->should_process = true;
|
||||
$ListView->mergeduplicates = false;
|
||||
$ListView->export = false;
|
||||
$ListView->select = false;
|
||||
$ListView->delete = false;
|
||||
$module = $_REQUEST['merge_module'];
|
||||
$metadataFile = null;
|
||||
$foundViewDefs = false;
|
||||
if(file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')){
|
||||
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
|
||||
$foundViewDefs = true;
|
||||
}else{
|
||||
if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php')){
|
||||
require_once('custom/modules/'.$module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$module]['listviewdefs'])){
|
||||
$metadataFile = $metafiles[$module]['listviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}elseif(file_exists('modules/'.$module.'/metadata/metafiles.php')){
|
||||
require_once('modules/'.$module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$module]['listviewdefs'])){
|
||||
$metadataFile = $metafiles[$module]['listviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$foundViewDefs && file_exists('modules/'.$module.'/metadata/listviewdefs.php')){
|
||||
$metadataFile = 'modules/'.$module.'/metadata/listviewdefs.php';
|
||||
}
|
||||
require_once($metadataFile);
|
||||
$displayColumns = array();
|
||||
if(!empty($_REQUEST['displayColumns'])) {
|
||||
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
|
||||
if(!empty($listViewDefs[$module][$col]))
|
||||
$displayColumns[$col] = $listViewDefs[$module][$col];
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach($listViewDefs[$module] as $col => $params) {
|
||||
if(!empty($params['default']) && $params['default'])
|
||||
$displayColumns[$col] = $params;
|
||||
}
|
||||
}
|
||||
$params = array('massupdate' => true, 'export' => false, 'handleMassupdate' => false );
|
||||
$ListView->displayColumns = $displayColumns;
|
||||
$ListView->lvd->listviewName = $focus->merge_module; //27633, this will make the $module to be merge_module instead of 'MergeRecords'. Then the key of offset and orderby will be correct.
|
||||
$where = $focus->generate_where_statement($focus->create_where_statement());
|
||||
$ListView->setup($this->bean, 'include/ListView/ListViewGeneric.tpl', $where, $params);
|
||||
$ListView->force_mass_update=true;
|
||||
$ListView->show_mass_update_form=false;
|
||||
$ListView->show_export_button=false;
|
||||
$ListView->keep_mass_update_form_open=true;
|
||||
|
||||
$return_id = $_REQUEST['record'];
|
||||
$merge_module = $focus->merge_module;
|
||||
|
||||
$button_title = $current_module_strings['LBL_PERFORM_MERGE_BUTTON_TITLE'];
|
||||
$button_key = $current_module_strings['LBL_PERFORM_MERGE_BUTTON_KEY'];
|
||||
$button_label = $current_module_strings['LBL_PERFORM_MERGE_BUTTON_LABEL'];
|
||||
|
||||
$cancel_title=$app_strings['LBL_CANCEL_BUTTON_TITLE'];
|
||||
$cancel_key=$app_strings['LBL_CANCEL_BUTTON_KEY'];
|
||||
$cancel_label=$app_strings['LBL_CANCEL_BUTTON_LABEL'];
|
||||
|
||||
echo ($ListView->display());
|
||||
|
||||
$error_select=$current_module_strings['LBL_SELECT_ERROR'];
|
||||
$form_top = <<<EOQ
|
||||
|
||||
<input type="hidden" id="selectCount" name="selectCount[]" value=0>
|
||||
<input type="hidden" name="merge_module" value="$merge_module">
|
||||
<input type="hidden" name="record" value="$return_id">
|
||||
<input type="hidden" name="return_module" value="$focus->merge_module">
|
||||
<input type="hidden" name="return_id" value="$return_id">
|
||||
<input type="hidden" name="return_action" value="DetailView">
|
||||
<input title="$button_title" accessKey="$button_key" class="button" onclick="return verify_selection(this);" type="submit" name="button" value=" $button_label " >
|
||||
<input title="$cancel_title" accessKey="$cancel_key" class="button" onclick="this.form.action.value='DetailView';this.form.module.value='$focus->merge_module';this.form.module.record='$return_id'" type="submit" name="button" value=" $cancel_label " >
|
||||
</form>
|
||||
<script>
|
||||
function verify_selection(theElement) {
|
||||
theElement.form.action.value='Step3';
|
||||
var selcount=document.getElementById('selectCount');
|
||||
if (parseInt(selcount.value) >0 ) {
|
||||
return true;
|
||||
} else {
|
||||
alert("$error_select");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
sugarListView.prototype.order_checks = function(order,orderBy,moduleString){
|
||||
checks = sugarListView.get_checks();
|
||||
eval('document.MassUpdate.' + moduleString + '.value = orderBy');
|
||||
document.MassUpdate.lvso.value = order;
|
||||
if(typeof document.MassUpdate.massupdate != 'undefined') {
|
||||
document.MassUpdate.massupdate.value = 'false';
|
||||
}
|
||||
|
||||
document.MassUpdate.return_module.value='';
|
||||
document.MassUpdate.return_action.value='';
|
||||
document.MassUpdate.submit();
|
||||
|
||||
return !checks;
|
||||
}
|
||||
|
||||
sugarListView.prototype.save_checks = function(offset, moduleString) {
|
||||
checks = sugarListView.get_checks();
|
||||
eval('document.MassUpdate.' + moduleString + '.value = offset');
|
||||
|
||||
if(typeof document.MassUpdate.massupdate != 'undefined') {
|
||||
document.MassUpdate.massupdate.value = 'false';
|
||||
}
|
||||
|
||||
document.MassUpdate.return_module.value='';
|
||||
document.MassUpdate.return_action.value='';
|
||||
document.MassUpdate.submit();
|
||||
|
||||
return !checks;
|
||||
}
|
||||
</script>
|
||||
EOQ;
|
||||
echo $form_top;
|
||||
?>
|
||||
238
modules/MergeRecords/Step3.html
Executable file
238
modules/MergeRecords/Step3.html
Executable file
@@ -0,0 +1,238 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
-->
|
||||
<!-- BEGIN: main -->
|
||||
<p>
|
||||
<form name="EditView" id="EditView" method="POST" action="index.php">
|
||||
<input type="hidden" name="module" value="MergeRecords">
|
||||
<input type="hidden" name="record" value="{ID}">
|
||||
<input type="hidden" name="merge_module" value="{MERGE_MODULE}">
|
||||
<input type="hidden" name="action">
|
||||
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
|
||||
<input type="hidden" name="return_id" value="{RETURN_ID}">
|
||||
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
|
||||
<input type="hidden" name="change_parent" value="0">
|
||||
<input type="hidden" name="change_parent_id" value="">
|
||||
<input type="hidden" name="remove" value="0">
|
||||
<input type="hidden" name="remove_id" value="">
|
||||
<input type="hidden" name="merged_links" value="{MERGED_LINKS}">
|
||||
{MERGED_IDS}
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" style="padding-bottom: 2px;"><input title="{MOD.LBL_SAVE_MERGED_RECORD_BUTTON_TITLE}" accessKey="{MOD.LBL_SAVE_MERGED_RECORD_BUTTON_KEY}" class="button" onclick="return merge_verify();" type="submit" name="button" value=" {MOD.LBL_SAVE_MERGED_RECORD_BUTTON_LABEL} " >
|
||||
<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>
|
||||
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
|
||||
<tr height="20">
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabform">
|
||||
{DIFF_HEADER}
|
||||
<!-- BEGIN: merge_row_diff -->
|
||||
<tr height="20">{FILE "modules/MergeRecords/MergeField.html"}</tr>
|
||||
<!-- END: merge_row_diff -->
|
||||
{GROUP_PARTITION}
|
||||
{SIMILAR_HEADER}
|
||||
<!-- BEGIN: merge_row_similar -->
|
||||
<tr height="20">{FILE "modules/MergeRecords/MergeField.html"}</tr>
|
||||
<!-- END: merge_row_similar -->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" style="padding-bottom: 2px;"><input title="{MOD.LBL_SAVE_MERGED_RECORD_BUTTON_TITLE}" accessKey="{MOD.LBL_SAVE_MERGED_RECORD_BUTTON_KEY}" class="button" onclick="return merge_verify();" type="submit" name="button" value=" {MOD.LBL_SAVE_MERGED_RECORD_BUTTON_LABEL} " >
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function merge_verify() {
|
||||
if (!check_form('EditView')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var message="{MERGE_VERIFY}";
|
||||
if (confirm(message)) {
|
||||
document.EditView.action.value='SaveMerge';
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function copy_value(json_array)
|
||||
{
|
||||
var target_element = document.getElementById(json_array['field_name']);
|
||||
if(json_array['field_type'] == 'enum')
|
||||
{
|
||||
for(i=0; i < target_element.options.length; i++)
|
||||
{
|
||||
if(target_element.options[i].value == json_array['field_value'])
|
||||
{
|
||||
target_element.options[i].selected=true;
|
||||
i=target_element.options.length+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(json_array['field_type'] == 'bool')
|
||||
{
|
||||
if(json_array['field_value'] == '1' || json_array['field_value'] == 'on')
|
||||
target_element.checked=true;
|
||||
else
|
||||
target_element.checked=false;
|
||||
}
|
||||
else if(json_array['field_type'] == 'relate' || json_array['field_type'] == 'link')
|
||||
{
|
||||
for(popup_field in json_array['popup_fields'])
|
||||
{
|
||||
var target_element = document.getElementById(popup_field);
|
||||
target_element.value = json_array['popup_fields'][popup_field];
|
||||
//alert("Field:"+popup_field+"\nValue:"+json_array['popup_fields'][popup_field]);
|
||||
}
|
||||
}
|
||||
else if(json_array['field_type'] == 'teamset')
|
||||
{
|
||||
var teams = json_array['field_value2'];
|
||||
var isFirstFieldEmpty = collection['EditView_team_name'].clean_up();
|
||||
var index = 0;
|
||||
|
||||
//expand the list
|
||||
collection['EditView_team_name'].js_more();
|
||||
collection['EditView_team_name'].show_arrow_label(true);
|
||||
|
||||
for(team_id in teams) {
|
||||
if(teams[team_id]['id']) {
|
||||
var temp_array = [];
|
||||
temp_array['name'] = teams[team_id]['display_name'];
|
||||
temp_array['id'] = teams[team_id]['id'];
|
||||
if(isFirstFieldEmpty && index == 0){
|
||||
collection['EditView_team_name'].replace_first(temp_array);
|
||||
}else{
|
||||
collection['EditView_team_name'].add(temp_array);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(json_array['field_type'] == 'datetimecombo'){
|
||||
dt = json_array['field_value'];
|
||||
date = dt.substr(0,10);
|
||||
//Get hours and minutes and adjust as necessary
|
||||
var hrs = parseInt(dt.substring(11,13), 10);
|
||||
var mins = parseInt(dt.substring(14,16), 10);
|
||||
|
||||
//A safety scan to make sure hrs and minutes are formatted correctly
|
||||
if (mins > 0 && mins < 15) {
|
||||
mins = 15;
|
||||
} else if (mins > 15 && mins < 30) {
|
||||
mins = 30;
|
||||
} else if (mins > 30 && mins < 45) {
|
||||
mins = 45;
|
||||
} else if (mins > 45) {
|
||||
hrs += 1;
|
||||
mins = 0;
|
||||
} //if-else
|
||||
|
||||
document.getElementById(json_array['field_name']+'_date').value=date;
|
||||
var hourObj = document.getElementById(json_array['field_name']+'_hours');
|
||||
for(var i=0; i< hourObj.length; i++){
|
||||
if(hourObj.options[i].value == hrs){
|
||||
hourObj.options[i].selected='checked';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var minuteObj = document.getElementById(json_array['field_name']+'_minutes');
|
||||
for(var i=0; i< minuteObj.length; i++){
|
||||
if(minuteObj.options[i].value == mins){
|
||||
minuteObj.options[i].selected='checked';
|
||||
}
|
||||
}
|
||||
|
||||
var hasMeridiem = /am|pm/i.test("{USER_DATEFORMAT}");
|
||||
if(hasMeridiem){
|
||||
meridiem = trim(dt.substring(16));
|
||||
var meridiemObj = document.getElementById(json_array['field_name'] + "_meridiem");
|
||||
for(var i=0; i< meridiemObj.length; i++){
|
||||
if(meridiemObj.options[i].value == meridiem){
|
||||
meridiemObj.options[i].selected='checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
target_element.value = json_array['field_value'];
|
||||
}
|
||||
else if(json_array['field_type'] == 'multienum'){
|
||||
var multienumObj = document.getElementById(json_array['field_name']);
|
||||
for(var i=0; i< multienumObj.length; i++){
|
||||
|
||||
if ( json_array['field_value'].indexOf(multienumObj.options[i].value) != -1 ) {
|
||||
multienumObj.options[i].selected='checked';
|
||||
}
|
||||
else {
|
||||
multienumObj.options[i].selected = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target_element.value = json_array['field_value'];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function change_primary(button, new_id) {
|
||||
document.EditView.change_parent.value='1';
|
||||
document.EditView.change_parent_id.value=new_id;
|
||||
document.EditView.action.value='Step3';
|
||||
|
||||
document.EditView.submit();
|
||||
}
|
||||
function remove_me(button, new_id) {
|
||||
document.EditView.remove.value='1';
|
||||
document.EditView.remove_id.value=new_id;
|
||||
document.EditView.action.value='Step3';
|
||||
|
||||
document.EditView.submit();
|
||||
}
|
||||
</script>
|
||||
{VALIDATION_JS}
|
||||
<!-- END: main -->
|
||||
544
modules/MergeRecords/Step3.php
Executable file
544
modules/MergeRecords/Step3.php
Executable file
@@ -0,0 +1,544 @@
|
||||
<?php
|
||||
if (!defined('sugarEntry') || !sugarEntry)
|
||||
die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
require_once ('include/JSON.php');
|
||||
$timedate = new TimeDate();
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
global $app_list_strings;
|
||||
global $current_language;
|
||||
global $urlPrefix;
|
||||
global $currentModule;
|
||||
global $theme;
|
||||
global $filter_for_valid_editable_attributes;
|
||||
//filter condition for fields in vardefs that can participate in merge.
|
||||
$filter_for_valid_editable_attributes =
|
||||
array(
|
||||
array('type'=>'datetimecombo','source'=>'db'),
|
||||
array('type'=>'datetime','source'=>'db'),
|
||||
array('type'=>'varchar','source'=>'db'),
|
||||
array('type'=>'enum','source'=>'db'),
|
||||
array('type'=>'multienum','source'=>'db'),
|
||||
array('type'=>'text','source'=>'db'),
|
||||
array('type'=>'date','source'=>'db'),
|
||||
array('type'=>'time','source'=>'db'),
|
||||
array('type'=>'int','source'=>'db'),
|
||||
array('type'=>'long','source'=>'db'),
|
||||
array('type'=>'double','source'=>'db'),
|
||||
array('type'=>'float','source'=>'db'),
|
||||
array('type'=>'short','source'=>'db'),
|
||||
array('dbType'=>'varchar','source'=>'db'),
|
||||
array('dbType'=>'double','source'=>'db'),
|
||||
array('type'=>'relate'),
|
||||
);
|
||||
|
||||
$filter_for_valid_related_attributes = array( array('type'=>'link'),);
|
||||
$filter_for_invalid_related_attributes = array(array('type'=>'link','link_type'=>'one'));
|
||||
|
||||
//following attributes will be ignored from the merge process.
|
||||
$invalid_attribute_by_name= array('date_entered'=>'date_entered','date_modified'=>'date_modified','modified_user_id'=>'modified_user_id', 'created_by'=>'created_by','deleted'=>'deleted');
|
||||
|
||||
$merge_ids_array = array ();
|
||||
if (isset($_REQUEST['change_parent']) && $_REQUEST['change_parent']=='1') {
|
||||
$base_id=$_REQUEST['change_parent_id'];
|
||||
foreach ($_REQUEST['merged_ids'] as $id) {
|
||||
if ($id != $base_id) {
|
||||
$merge_ids_array[] = $id;
|
||||
}
|
||||
}
|
||||
//add the existing parent to merged_id array.
|
||||
$merge_ids_array[] = $_REQUEST['record'];
|
||||
} elseif (isset($_REQUEST['remove']) && $_REQUEST['remove']=='1') {
|
||||
$base_id=$_REQUEST['record'];
|
||||
$removed_id= $_REQUEST['remove_id'];
|
||||
foreach ($_REQUEST['merged_ids'] as $id) {
|
||||
if ($id != $removed_id) {
|
||||
$merge_ids_array[] = $id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$base_id=$_REQUEST['record'];
|
||||
foreach ($_REQUEST['mass'] as $id) {
|
||||
$merge_ids_array[] = $id;
|
||||
}
|
||||
}
|
||||
$focus = new MergeRecord();
|
||||
$focus->load_merge_bean($_REQUEST['merge_module'], true, $base_id);
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=index'>{$GLOBALS['app_list_strings']['moduleList'][$focus->merge_bean->module_dir]}</a>";
|
||||
$params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=DetailView&record={$focus->merge_bean->id}'>{$focus->merge_bean->name}</a>";
|
||||
$params[] = $mod_strings['LBL_MODULE_NAME'];
|
||||
echo getClassicModuleTitle($focus->merge_bean->module_dir, $params, true);
|
||||
|
||||
$mergeBeanArray = array ();
|
||||
$records=1;
|
||||
//render a column for each record to merge
|
||||
$merged_ids='';
|
||||
$merge_records_names=array();
|
||||
foreach ($merge_ids_array as $id) {
|
||||
require_once ($focus->merge_bean_file_path);
|
||||
$mergeBeanArray[$id] = new $focus->merge_bean_class();
|
||||
$mergeBeanArray[$id]->retrieve($id);
|
||||
$merge_records_names[]=$mergeBeanArray[$id]->get_summary_text();
|
||||
$records++;
|
||||
$merged_ids.="<input type='hidden' name='merged_ids[]' value='$id'>";
|
||||
}
|
||||
|
||||
$col_width=floor(80/$records).'%';
|
||||
global $max_data_length;
|
||||
$max_data_length=floor(65/$records);
|
||||
global $xtpl;
|
||||
$xtpl = new XTemplate("modules/MergeRecords/Step3.html");
|
||||
$xtpl->assign("MOD", $mod_strings);
|
||||
$xtpl->assign("APP", $app_strings);
|
||||
|
||||
$xtpl->assign("ID", $focus->merge_bean->id);
|
||||
$xtpl->assign("MERGE_MODULE", $focus->merge_module);
|
||||
|
||||
$xtpl->assign("MERGED_IDS", $merged_ids);
|
||||
|
||||
//set return parameters.
|
||||
if (!empty ($_REQUEST['return_module'])) {
|
||||
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
|
||||
}
|
||||
if (!empty ($_REQUEST['return_action'])) {
|
||||
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
|
||||
}
|
||||
if (!empty ($_REQUEST['return_id'])) {
|
||||
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
|
||||
}
|
||||
|
||||
$temp_field_array = $focus->merge_bean->field_defs;
|
||||
$field_count = 1;
|
||||
$json = new JSON(JSON_LOOSE_TYPE);
|
||||
$diff_field_count=0;
|
||||
foreach ($temp_field_array as $field_array) {
|
||||
|
||||
|
||||
if (show_field($field_array)
|
||||
) {
|
||||
|
||||
$select_row_curr_field_value = null;
|
||||
$b_values_different = false;
|
||||
$section_name='merge_row_similar';
|
||||
|
||||
//Prcoess locaton of the field. if values are different show field in first section. else 2nd.
|
||||
$select_row_curr_field_value = $focus->merge_bean->$field_array['name'];
|
||||
foreach ($merge_ids_array as $id) {
|
||||
if (($mergeBeanArray[$id]-> $field_array['name']=='' and $select_row_curr_field_value =='') or $mergeBeanArray[$id]-> $field_array['name'] == $select_row_curr_field_value ) {
|
||||
$section_name='merge_row_similar';
|
||||
} else {
|
||||
$section_name='merge_row_diff';
|
||||
$diff_field_count++;
|
||||
break; //foreach
|
||||
}
|
||||
}
|
||||
//check for vname in mod strings first, then app, else just display name
|
||||
$col_name = $field_array['name'];
|
||||
if (isset ($focus->merge_bean_strings[$field_array['vname']]) && $focus->merge_bean_strings[$field_array['vname']] != '')
|
||||
$xtpl->assign("FIELD_LABEL", $focus->merge_bean_strings[$field_array['vname']]);
|
||||
elseif (isset ($app_strings[$field_array['vname']]) && $app_strings[$field_array['vname']] != '') $xtpl->assign("FIELD_LABEL", $app_strings[$field_array['vname']]);
|
||||
else
|
||||
$xtpl->assign("FIELD_LABEL", $field_array['name']);
|
||||
//if required add signage.
|
||||
if (!empty($focus->merge_bean->required_fields[$col_name]) or $col_name=='team_name') {
|
||||
$xtpl->assign("REQUIRED_SYMBOL","<span class='required'>".$app_strings['LBL_REQUIRED_SYMBOL']."</span>");
|
||||
} else {
|
||||
$xtpl->assign("REQUIRED_SYMBOL","");
|
||||
}
|
||||
|
||||
$xtpl->assign("CELL_WIDTH", "20%");
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_label");
|
||||
|
||||
if (isset ($field_array['custom_type']) && $field_array['custom_type'] != '')
|
||||
$field_check = $field_array['custom_type'];
|
||||
else
|
||||
$field_check = $field_array['type'];
|
||||
|
||||
|
||||
if(preg_match('/.*?_address_street$/', $field_array['name'])) {
|
||||
$field_check = 'text';
|
||||
}
|
||||
|
||||
$xtpl->assign("EDIT_FIELD_NAME", $field_array['name']);
|
||||
$xtpl->assign("TAB_INDEX", $field_count);
|
||||
|
||||
switch ($field_check) {
|
||||
case ('name') :
|
||||
case ('varchar') :
|
||||
case ('phone') :
|
||||
case ('num') :
|
||||
case ('email') :
|
||||
case ('custom_fields') :
|
||||
case ('url') :
|
||||
case ('int') :
|
||||
case ('float') :
|
||||
case ('double') :
|
||||
case ('currency') :
|
||||
|
||||
$xtpl->assign("EDIT_FIELD_VALUE", $select_row_curr_field_value);
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_text");
|
||||
break;
|
||||
case ('text') :
|
||||
$xtpl->assign("EDIT_FIELD_VALUE", $select_row_curr_field_value);
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_textarea");
|
||||
break;
|
||||
case ('enum') :
|
||||
$xtpl->assign("SELECT_OPTIONS", get_select_options_with_id($app_list_strings[$field_array['options']], $select_row_curr_field_value));
|
||||
$xtpl->assign("CELL_WIDTH",$col_width);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_dropdown");
|
||||
break;
|
||||
case ('multienum') :
|
||||
$select_row_curr_field_value = unencodeMultienum($select_row_curr_field_value);
|
||||
$xtpl->assign("SELECT_OPTIONS", get_select_options_with_id($app_list_strings[$field_array['options']], $select_row_curr_field_value));
|
||||
$xtpl->assign("CELL_WIDTH",$col_width);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_multidropdown");
|
||||
break;
|
||||
//popup fields need to be fixed.., cant automate with vardefs
|
||||
case ('relate') :
|
||||
if(!empty($field_array['link'])) {
|
||||
$exclude[$field_array['link']] = $field_array['link'];
|
||||
}
|
||||
case ('link') :
|
||||
//get_related_name
|
||||
if (empty($select_row_curr_field_value)) {
|
||||
$related_name=get_related_name($field_array,$focus->merge_bean->$field_array['id_name']);
|
||||
if ($related_name !== false ) {
|
||||
$select_row_curr_field_value=$related_name;
|
||||
}
|
||||
}
|
||||
if($field_check == 'link') {//relate type should not enter this.
|
||||
$exclude[$field_array['name']] = $field_array['name'];
|
||||
}
|
||||
$xtpl->assign("POPUP_ID_FIELD", $field_array['id_name']);
|
||||
$xtpl->assign("POPUP_NAME_FIELD", $field_array['name']);
|
||||
$xtpl->assign("POPUP_NAME_VALUE", $select_row_curr_field_value);
|
||||
$xtpl->assign("POPUP_ID_VALUE", $focus->merge_bean-> $field_array['id_name']);
|
||||
$xtpl->assign("POPUP_MODULE", $field_array['module']);
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$xtpl->assign("MERGED_LINKS", implode(',', $exclude));
|
||||
|
||||
$popup_data = array ('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array ('id' => $field_array['id_name'], 'name' => $field_array['name'],),);
|
||||
$xtpl->assign('ENCODED_POPUP_DATA', $json->encode($popup_data));
|
||||
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_popup");
|
||||
break;
|
||||
case ('bool') :
|
||||
if (($select_row_curr_field_value == '1' || $select_row_curr_field_value == 'yes' || $select_row_curr_field_value == 'on') && !empty($select_row_curr_field_value))
|
||||
$xtpl->assign("EDIT_FIELD_VALUE", " checked");
|
||||
else
|
||||
$xtpl->assign("EDIT_FIELD_VALUE", "");
|
||||
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_checkbox");
|
||||
break;
|
||||
case ('date') :
|
||||
case ('datetime') :
|
||||
$xtpl->assign("CALENDAR_LANG", "en");
|
||||
$xtpl->assign("USER_DATEFORMAT", '('.$timedate->get_user_date_format().')');
|
||||
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
|
||||
$xtpl->assign("EDIT_FIELD_VALUE", $select_row_curr_field_value);
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$xtpl->assign("THEME", $theme);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_date");
|
||||
break;
|
||||
case ('datetimecombo') :
|
||||
$xtpl->assign("CALENDAR_LANG", "en");
|
||||
$xtpl->assign("USER_DATEFORMAT", $timedate->get_user_time_format());
|
||||
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
|
||||
$xtpl->assign("EDIT_FIELD_VALUE", $select_row_curr_field_value);
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$xtpl->assign("THEME", $theme);
|
||||
$xtpl->parse("main.".$section_name.".merge_cell_edit_datetime");
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
//render a column for each selected record to merge
|
||||
foreach ($merge_ids_array as $id) {
|
||||
$xtpl->assign("CELL_WIDTH", $col_width);
|
||||
$field_name=null;
|
||||
switch ($field_check) {
|
||||
case ('bool') :
|
||||
if (($mergeBeanArray[$id]->$field_array['name'] == '1' || $mergeBeanArray[$id]->$field_array['name'] == 'yes' || $mergeBeanArray[$id]->$field_array['name'] == 'on') && !empty($mergeBeanArray[$id]->$field_array['name'])) {
|
||||
$xtpl->assign("FIELD_VALUE", " checked");
|
||||
} else {
|
||||
$xtpl->assign("FIELD_VALUE", "");
|
||||
}
|
||||
$field_name="main.".$section_name.".merge_cell_field_value_checkbox";
|
||||
break;
|
||||
case ('enum') :
|
||||
if ($mergeBeanArray[$id]-> $field_array['name'] != '' and isset($field_array['options']) and isset($app_list_strings[$field_array['options']][$mergeBeanArray[$id]-> $field_array['name']])) {
|
||||
display_field_value( $app_list_strings[$field_array['options']][$mergeBeanArray[$id]-> $field_array['name']]);
|
||||
} else {
|
||||
display_field_value($mergeBeanArray[$id]-> $field_array['name']);
|
||||
}
|
||||
$field_name="main.".$section_name.".merge_cell_field_value";
|
||||
break;
|
||||
case ('multienum') :
|
||||
if ($mergeBeanArray[$id]-> $field_array['name'] != '' and isset($field_array['options']) and isset($app_list_strings[$field_array['options']][$mergeBeanArray[$id]-> $field_array['name']])) {
|
||||
display_field_value(str_replace("^","",$app_list_strings[$field_array['options']][$mergeBeanArray[$id]-> $field_array['name']]));
|
||||
} else {
|
||||
display_field_value(str_replace("^","",$mergeBeanArray[$id]-> $field_array['name']));
|
||||
}
|
||||
$field_name="main.".$section_name.".merge_cell_field_value";
|
||||
break;
|
||||
case ('relate') :
|
||||
case ('link') :
|
||||
$related_name=false;
|
||||
if (empty($mergeBeanArray[$id]-> $field_array['name']) && !empty($mergeBeanArray[$id]-> $field_array['id_name'])) {
|
||||
$related_name=get_related_name($field_array,$mergeBeanArray[$id]-> $field_array['id_name']);
|
||||
if ($related_name !== false) {
|
||||
$mergeBeanArray[$id]-> $field_array['name']=$related_name;
|
||||
}
|
||||
}
|
||||
display_field_value($mergeBeanArray[$id]-> $field_array['name']);
|
||||
$field_name="main.".$section_name.".merge_cell_field_value";
|
||||
break;
|
||||
default :
|
||||
display_field_value($mergeBeanArray[$id]-> $field_array['name']);
|
||||
$field_name="main.".$section_name.".merge_cell_field_value";
|
||||
break;
|
||||
}
|
||||
|
||||
$json_data = array ('field_name' => $field_array['name'], 'field_type' => $field_check,);
|
||||
//add an array of fields/values to the json array
|
||||
//for setting all the values for merge
|
||||
if ($field_check == 'relate' or $field_check == 'link') {
|
||||
$temp_array = Array ();
|
||||
$json_data['popup_fields'] = Array ($field_array['name'] => $mergeBeanArray[$id]-> $field_array['name'], $field_array['id_name'] => $mergeBeanArray[$id]-> $field_array['id_name'],);
|
||||
} else if($field_check == 'teamset') {
|
||||
$json_data['field_value'] = TeamSetManager::getCommaDelimitedTeams($mergeBeanArray[$id]->team_set_id, $mergeBeanArray[$id]->team_id, true);
|
||||
$json_data['field_value2'] = TeamSetManager::getTeamsFromSet($mergeBeanArray[$id]->team_set_id);
|
||||
$json_data['field_value3'] = $mergeBeanArray[$id]->team_set_id;
|
||||
} else if($field_check == 'multienum') {
|
||||
$json_data['field_value'] = unencodeMultienum($mergeBeanArray[$id]-> $field_array['name']);
|
||||
} else {
|
||||
$json_data['field_value'] = $mergeBeanArray[$id]-> $field_array['name'];
|
||||
}
|
||||
$encoded_json_data = $json->encode($json_data);
|
||||
$xtpl->assign('ENCODED_JSON_DATA', $encoded_json_data);
|
||||
$xtpl->parse($field_name);
|
||||
}
|
||||
|
||||
$xtpl->parse("main.".$section_name);
|
||||
$field_count ++;
|
||||
}
|
||||
}
|
||||
|
||||
$header_cols= array();
|
||||
foreach ($merge_ids_array as $id) {
|
||||
$td="<td width='$col_width' valign='top' class='dataLabel' align='left'><input type='button' class='button' id='$id' onclick=\"change_primary(this,'{$id}');\" value='<<'> {$mod_strings['LBL_CHANGE_PARENT']}";
|
||||
if (count($merge_ids_array) > 1) {
|
||||
$td.=" |<a id='remove_$id' onclick=\"remove_me(this,'{$id}');\" href='#' >{$mod_strings['LBL_REMOVE_FROM_MERGE']}</a>";
|
||||
}
|
||||
$td.="</td>";
|
||||
$header_cols[]=$td;
|
||||
}
|
||||
|
||||
if ($diff_field_count>0) {
|
||||
$xtpl->assign("DIFF_HEADER","<tr height='20'><td colspan=2><strong>{$mod_strings['LBL_DIFF_COL_VALUES']}</strong></td>".implode(' ',$header_cols)."</tr>");
|
||||
$xtpl->assign("SIMILAR_HEADER","<tr height='20'><td colspan=20><strong>{$mod_strings['LBL_SAME_COL_VALUES']}</strong></td></tr>");
|
||||
$xtpl->assign("GROUP_PARTITION","<tr height=3><td colspan=20' class='listViewHRS1'></td></tr>");
|
||||
} else {
|
||||
$xtpl->assign("SIMILAR_HEADER","<tr height='20'><td colspan=2><strong>{$mod_strings['LBL_SAME_COL_VALUES']}</strong></td>".implode(' ',$header_cols)."</tr>");
|
||||
}
|
||||
$merge_verify=$mod_strings['LBL_DELETE_MESSAGE'].'\\n';
|
||||
foreach ($merge_records_names as $name) {
|
||||
$merge_verify.= $name."\\n";
|
||||
}
|
||||
$merge_verify.='\\n'.$mod_strings['LBL_PROCEED'];
|
||||
$xtpl->assign("MERGE_VERIFY",$merge_verify);
|
||||
|
||||
global $beanList;
|
||||
|
||||
//Jenny - Bug 8386 - The object_name couldn't be found because it was searching for
|
||||
// 'Case' instead of 'aCase'.
|
||||
if ($focus->merge_bean->object_name == 'Case') {
|
||||
$focus->merge_bean->object_name = 'aCase';
|
||||
}
|
||||
|
||||
$mod=array_search($focus->merge_bean->object_name,$beanList);
|
||||
$mod_strings = return_module_language($current_language, $mod);
|
||||
|
||||
//add javascript for required fields enforcement.
|
||||
|
||||
$javascript = new javascript();
|
||||
$javascript->setFormName('EditView');
|
||||
$javascript->setSugarBean($focus->merge_bean);
|
||||
$javascript->addAllFields('');
|
||||
if (isset($focus->merge_bean->field_defs['team_name'])) {
|
||||
$javascript->addFieldGeneric('team_name', 'varchar', $app_strings['LBL_TEAM'] ,'true');
|
||||
}
|
||||
$xtpl->assign("VALIDATION_JS", $javascript->getScript());
|
||||
|
||||
$xtpl->parse("main");
|
||||
$xtpl->out("main");
|
||||
|
||||
/*
|
||||
* function truncates values to max_data_legth and adds the complete value as hover text.
|
||||
*/
|
||||
function display_field_value($value) {
|
||||
global $xtpl, $max_data_length, $mod_strings;
|
||||
if (strlen($value)-$max_data_length > 3) {
|
||||
$xtpl->assign("FIELD_VALUE", substr($value,0,$max_data_length).'...');
|
||||
} else {
|
||||
$xtpl->assign("FIELD_VALUE", $value);
|
||||
}
|
||||
$xtpl->assign("HOVER_TEXT", $mod_strings['LBL_MERGE_VALUE_OVER'] .': ' . $value);
|
||||
}
|
||||
/*
|
||||
* implements the rules that decide which fields will participate in a merge.
|
||||
*/
|
||||
function show_field($field_def) {
|
||||
global $filter_for_valid_editable_attributes,$invalid_attribute_by_name;
|
||||
//field in invalid attributes list?
|
||||
if (isset($invalid_attribute_by_name[$field_def['name']])) {
|
||||
return false;
|
||||
}
|
||||
//field has 'duplicate_merge property set to disabled?'
|
||||
if (isset($field_def['duplicate_merge']) ) {
|
||||
if ($field_def['duplicate_merge']=='disabled' or $field_def['duplicate_merge']==false) {
|
||||
return false;
|
||||
}
|
||||
if ($field_def['duplicate_merge']=='enabled' or $field_def['duplicate_merge']==true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//field has auto_increment set to true do not participate in merge.
|
||||
//we have a unique index on that field.
|
||||
if (isset($field_def['auto_increment']) and $field_def['auto_increment']==true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//set required attribute values in $field_def
|
||||
if (!isset($field_def['source']) or empty($field_def['source'])) {
|
||||
$field_def['source']='db';
|
||||
}
|
||||
|
||||
if (!isset($field_def['dbType']) or empty($field_def['dbType']) and isset($field_def['type'])) {
|
||||
$field_def['dbType']=$field_def['type'];
|
||||
}
|
||||
|
||||
foreach ($filter_for_valid_editable_attributes as $attribute_set) {
|
||||
$b_all=false;
|
||||
foreach ($attribute_set as $attr=>$value) {
|
||||
if (isset($field_def[$attr]) and $field_def[$attr]==$value) {
|
||||
$b_all=true;
|
||||
} else {
|
||||
$b_all=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($b_all) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/* if the attribute of type relate and name is empty fetch using the vardef entries.
|
||||
*
|
||||
*/
|
||||
function get_related_name($field_def,$id_value) {
|
||||
if (!empty($field_def['rname']) && !empty($field_def['id_name']) && !empty($field_def['table'])) {
|
||||
if (!empty($id_value)) {
|
||||
|
||||
//default the column name to rname in vardefs
|
||||
$col_name = $field_def['rname'];
|
||||
//if this module is non db and has a module set, then check to see if this field should be concatenated
|
||||
if (!empty($field_def['module']) && $field_def['source'] == 'non-db'){
|
||||
global $beanList, $beanFiles;
|
||||
//get the bean field defs based on the module param
|
||||
$bean = $beanList[$field_def['module']];
|
||||
require_once ($beanFiles[$bean]);
|
||||
$focus = new $bean();
|
||||
if(!empty( $focus->field_defs[$field_def['rname']])){
|
||||
$related_def = $focus->field_defs[$field_def['rname']];
|
||||
//if field defs has concat field array set, then concatenate values
|
||||
if(isset($related_def['db_concat_fields']) && !empty($related_def['db_concat_fields'])){
|
||||
$temp_str = '';
|
||||
|
||||
if ( ( $focus->db->dbType == 'mysql' ) || ( $focus->db->dbType == 'oci8' ) ){
|
||||
foreach($related_def['db_concat_fields'] as $vals){
|
||||
if(empty($temp_str)){
|
||||
$temp_str .= ' concat('. $vals;
|
||||
}else{
|
||||
$temp_str .= ", ' ', " .$vals;
|
||||
}
|
||||
}
|
||||
$temp_str .= ')';
|
||||
}else{
|
||||
foreach($related_def['db_concat_fields'] as $vals){
|
||||
if(empty($temp_str)){
|
||||
$temp_str .= $vals;
|
||||
}else{
|
||||
$temp_str .= " + ' ' + " .$vals;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$col_name = $temp_str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query = "select ".$col_name." from " .$field_def['table'] ." where id='$id_value'";
|
||||
|
||||
$result=$GLOBALS['db']->query($query);
|
||||
$row=$GLOBALS['db']->fetchByAssoc($result);
|
||||
if (!empty($row[$field_def['rname']])) {
|
||||
return $row[$field_def['rname']];
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
49
modules/MergeRecords/controller.php
Executable file
49
modules/MergeRecords/controller.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/Controller/SugarController.php');
|
||||
|
||||
class MergeRecordsController extends SugarController
|
||||
{
|
||||
/**
|
||||
* Override default method so we don't load a bean class automatically
|
||||
*
|
||||
* @see SugarController::loadBean()
|
||||
*/
|
||||
public function loadBean()
|
||||
{
|
||||
}
|
||||
}
|
||||
96
modules/MergeRecords/index.php
Executable file
96
modules/MergeRecords/index.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
if (isset($_REQUEST['uid'])) {
|
||||
$merge_ids = explode(',',$_REQUEST['uid']);
|
||||
|
||||
//redirect to step3.
|
||||
$_REQUEST['record']=$merge_ids[0];
|
||||
$_REQUEST['merge_module']=$_REQUEST['action_module'];
|
||||
unset($merge_ids[0]);
|
||||
$_REQUEST['mass']=$merge_ids;
|
||||
}
|
||||
else {
|
||||
global $beanList;
|
||||
global $beanFiles;
|
||||
$merge_ids = array();
|
||||
$bean = $beanList[$_REQUEST['return_module']];
|
||||
require_once($beanFiles[$bean]);
|
||||
$focus = new $bean();
|
||||
|
||||
if(isset($_SESSION['export_where']) && !empty($_SESSION['export_where'])) { // bug 4679
|
||||
$where = $_SESSION['export_where'];
|
||||
$whereArr = explode (" ", trim($where));
|
||||
if ($whereArr[0] == trim('where')) {
|
||||
$whereClean = array_shift($whereArr);
|
||||
}
|
||||
$where = implode(" ", $whereArr);
|
||||
}
|
||||
else {
|
||||
$where = '';
|
||||
}
|
||||
if(empty($order_by))$order_by = '';
|
||||
$query = $focus->create_export_query($order_by,$where);
|
||||
$result = $focus->db->query($query,true);
|
||||
|
||||
/*
|
||||
$query = 'select * from '.$focus->table_name.' where deleted=0';
|
||||
$result = $focus->db->query($query, true, "");
|
||||
*/
|
||||
$row = $focus->db->fetchByAssoc($result);
|
||||
|
||||
while ($row != null) {
|
||||
//$beanObj = new $bean;
|
||||
array_push($merge_ids, $row['id']);
|
||||
$row = $focus->db->fetchByAssoc($result);
|
||||
}
|
||||
$_REQUEST['record']=$merge_ids[0];
|
||||
$_REQUEST['action']='index.php';
|
||||
$_REQUEST['merge_module']=$_REQUEST['return_module'];
|
||||
unset($merge_ids[0]);
|
||||
$_REQUEST['mass']=$merge_ids;
|
||||
}
|
||||
require('modules/MergeRecords/Step3.php');
|
||||
|
||||
?>
|
||||
83
modules/MergeRecords/language/en_us.lang.php
Executable file
83
modules/MergeRecords/language/en_us.lang.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = array (
|
||||
'LBL_MODULE_NAME' => 'Merge Records',
|
||||
'LBL_MODULE_TITLE' => 'Merge Records: Home',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Merge Search',
|
||||
'LBL_LIST_FORM_TITLE' => 'Merge List',
|
||||
|
||||
'LBL_LBL_MERGE_RECORDS_STEP_1' => 'Find Search Records to Merge With',
|
||||
'LBL_AVAIL_FIELDS' => 'Available Fields',
|
||||
'LBL_FILTER_COND' => 'Filter Condition',
|
||||
'LBL_SELECTED_FIELDS' => 'Selected Fields',
|
||||
'LBL_MERGE_RECORDS_WITH' => 'Merge Records With',
|
||||
'LBL_MERGE_VALUE_OVER' => 'Merge value over',
|
||||
|
||||
'LBL_NEXT_STEP_TITLE' => 'Move to Next Step[Ctrl+N]',
|
||||
'LBL_NEXT_STEP_BUTTON_KEY' => 'N',
|
||||
'LBL_NEXT_STEP_BUTTON_LABEL' => 'Next Step >',
|
||||
|
||||
'LBL_PERFORM_MERGE_BUTTON_TITLE' => 'Perform Merge[Ctrl+P]',
|
||||
'LBL_PERFORM_MERGE_BUTTON_KEY' => 'P',
|
||||
'LBL_PERFORM_MERGE_BUTTON_LABEL' => 'Perform Merge',
|
||||
|
||||
'LBL_SAVE_MERGED_RECORD_BUTTON_TITLE' => 'Save Merge[Ctrl+S]',
|
||||
'LBL_SAVE_MERGED_RECORD_BUTTON_KEY' => 'S',
|
||||
'LBL_SAVE_MERGED_RECORD_BUTTON_LABEL' => 'Save Merge',
|
||||
|
||||
'LBL_STEP2_FORM_TITLE' => 'Records Found To Merge With',
|
||||
'LBL_SELECT_ERROR'=>'You must make a selection before you can proceed.',
|
||||
'LBL_SELECT_PRIMARY'=>'Select primary record for the merge.',
|
||||
'LBL_CHANGE_PARENT'=>'Set as primary',
|
||||
'LBL_REMOVE_FROM_MERGE'=>'Remove',
|
||||
'LBL_DIFF_COL_VALUES'=>'Columns whose value in primary row differs from value in merging rows:',
|
||||
'LBL_SAME_COL_VALUES'=>'Columns whose value is similar across all rows:',
|
||||
'ERR_EXCEEDS_MAX'=>'You are only allowed to merge a maximum of 5 records. Records exceeding the limit were ignored.',
|
||||
'LBL_DELETE_MESSAGE'=>'This action will delete following record(s):',
|
||||
'LBL_PROCEED'=>'Proceed ?',
|
||||
'LBL_STEP1_DIRECTIONS' => 'Find possible duplicate records. If possible duplicates are found, you can select which records to merge with the current record.',
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
74
modules/MergeRecords/language/pl_pl.lang.php
Executable file
74
modules/MergeRecords/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Professional End User
|
||||
* License Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; All Rights Reserved.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = array (
|
||||
'LBL_MODULE_NAME' => 'Scalaj rekordy',
|
||||
'LBL_MODULE_TITLE' => 'Scalanie Rekordów: Strona główna',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Szukaj scalonych',
|
||||
'LBL_LIST_FORM_TITLE' => 'Lista scalonych',
|
||||
|
||||
'LBL_LBL_MERGE_RECORDS_STEP_1' => 'Krok 1: Znajdź rekordy przeznaczone do scalenia ze sobą',
|
||||
'LBL_AVAIL_FIELDS' => 'Dostępne pola',
|
||||
'LBL_FILTER_COND' => 'Warunki filtrowania',
|
||||
'LBL_SELECTED_FIELDS' => 'Wybrane pola',
|
||||
'LBL_MERGE_RECORDS_WITH' => 'Scal rekordy',
|
||||
'LBL_MERGE_VALUE_OVER' => 'Scal wartości',
|
||||
|
||||
'LBL_NEXT_STEP_TITLE' => 'Przejdź do nastepnego kroku[Ctrl+N]',
|
||||
'LBL_NEXT_STEP_BUTTON_KEY' => 'N',
|
||||
'LBL_NEXT_STEP_BUTTON_LABEL' => 'Nastepny krok >',
|
||||
|
||||
'LBL_PERFORM_MERGE_BUTTON_TITLE' => 'Przeprowadź scalanie[Ctrl+P]',
|
||||
'LBL_PERFORM_MERGE_BUTTON_KEY' => 'P',
|
||||
'LBL_PERFORM_MERGE_BUTTON_LABEL' => 'Przeprowadź scalanie',
|
||||
|
||||
'LBL_SAVE_MERGED_RECORD_BUTTON_TITLE' => 'Zapisz scalone rekordy[Ctrl+S]',
|
||||
'LBL_SAVE_MERGED_RECORD_BUTTON_KEY' => 'S',
|
||||
'LBL_SAVE_MERGED_RECORD_BUTTON_LABEL' => 'Zapisz scalone',
|
||||
|
||||
'LBL_STEP2_FORM_TITLE' => 'Rekordy przeznaczone do scalenia ze sobą:',
|
||||
'LBL_SELECT_ERROR'=>'Musisz dokonać wyboru przed kontynuacją.',
|
||||
'LBL_SELECT_PRIMARY'=>'Wybierz główny rekord do połączenia',
|
||||
'LBL_CHANGE_PARENT'=>'Ustaw jako główny',
|
||||
'LBL_REMOVE_FROM_MERGE'=>'Usuń',
|
||||
'LBL_DIFF_COL_VALUES'=>'Kolumny, które są porównywane w głównym wierszu różnią sie od przyłączanych wierszy:',
|
||||
'LBL_SAME_COL_VALUES'=>'Kolumny, które mają tę samą zawartość we wszystkich wierszach:',
|
||||
'ERR_EXCEEDS_MAX'=>'Możesz połączyć maksymalnie 5 rekordów. Wiersze powyżej tego limitu nie zostaną połączone.',
|
||||
'LBL_DELETE_MESSAGE'=>'To działanie spowoduje usunięcie następujących rekordów:',
|
||||
'LBL_PROCEED'=>'Kontynuować?',
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
49
modules/MergeRecords/vardefs.php
Executable file
49
modules/MergeRecords/vardefs.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description:
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
|
||||
* Reserved. Contributor(s): ______________________________________..
|
||||
* *******************************************************************************/
|
||||
|
||||
$dictionary['MergeRecord'] = array(
|
||||
'table'=>'does_not_exist',
|
||||
'fields' => array (),
|
||||
);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user