06-11-2014, 06:13 AM
I went on and looked at the code of the pop-up page. Once I searched for the organization I wished, I looked at the code and here is what I see:
Pay close attention to this part:
As you can see the scrypt is basically saying that all address fields should be replaced with empty data (""). What's up with that?
For testing purposes, I replaced within the html code of the page the first 2 quotes ("") with some text and once I clicked "Yes" it indeed filled the address field with the text.
Code:
<html><head><script>
var image_pth = '';
function showAllRecords()
{
modname = document.getElementById("relmod").name;
idname= document.getElementById("relrecord_id").name;
var locate = location.href;
url_arr = locate.split("?");
emp_url = url_arr[1].split("&");
for(i=0;i< emp_url.length;i++)
{
if(emp_url[i] != '')
{
split_value = emp_url[i].split("=");
if(split_value[0] == modname || split_value[0] == idname )
emp_url[i]='';
else if(split_value[0] == "fromPotential" || split_value[0] == "acc_id")
emp_url[i]='';
}
}
correctUrl =emp_url.join("&");
Url = "index.php?"+correctUrl;
return Url;
}
//function added to get all the records when parent record doesn't relate with the selection module records while opening/loading popup.
function redirectWhenNoRelatedRecordsFound()
{
var loadUrl = showAllRecords();
window.location.href = loadUrl;
}
</script>
<link rel="stylesheet" type="text/css" href="themes/softed/style.css">
<script language="JavaScript" type="text/javascript" src="include/js/ListView.js"></script>
<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
<script language="JavaScript" type="text/javascript" src="include/js/Inventory.js"></script>
<script language="JavaScript" type="text/javascript" src="include/js/json.js"></script>
<!-- vtlib customization: Javascript hook -->
<script language="JavaScript" type="text/javascript" src="include/js/vtlib.js"></script>
<!-- END -->
<script language="JavaScript" type="text/javascript" src="include/js/en_us.lang.js?"></script>
<script language="JavaScript" type="text/javascript" src="modules/Emails/Emails.js"></script>
<script language="JavaScript" type="text/javascript" src="modules/Accounts/Accounts.js"></script><script type="text/javascript" src="include/js/Inventory.js"></script><script type="text/javascript" src="include/js/Mail.js"></script><script type="text/javascript" src="include/js/Merge.js"></script>
<script language="javascript" type="text/javascript" src="include/scriptaculous/prototype.js"></script>
<script type="text/javascript" src="modules/com_vtiger_workflow/resources/jquery-1.2.6.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script type="text/javascript">
function add_data_to_relatedlist(entity_id,recordid,mod, popupmode, callback) {
var return_module = document.getElementById('return_module').value;
if(popupmode == 'ajax') {
VtigerJS_DialogBox.block();
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: "module="+return_module+"&action="+return_module+"Ajax&file=updateRelations&destination_module="+mod+"&entityid="+entity_id+"&parentid="+recordid+"&mode=Ajax",
onComplete: function(response) {
VtigerJS_DialogBox.unblock();
var res = JSON.parse(response.responseText);
if(typeof callback == 'function') {
callback(res);
}
}
}
);
return false;
} else {
opener.document.location.href="index.php?module=Emails&action=updateRelations&destination_module="+mod+"&entityid="+entity_id+"&parentid="+recordid+"&return_module=Emails&return_action=&parenttab=Marketing";
window.close();
}
}
function set_focus() {
$('search_txt').focus();
}
</script>
</head><body onload="set_focus()" class="small" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mailClient mailClientBg">
<tbody><tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td class="moduleName" width="80%" style="padding-left:10px;">Organizations</td>
<td width="30%" nowrap="" class="componentName" align="right">coreBOS</td>
</tr>
</tbody></table>
<div id="status" style="position: absolute; display: none; right: 135px; top: 15px; height: 27px; white-space: nowrap;"><img src="themes/softed/images/status.gif"></div>
<table width="100%" cellpadding="5" cellspacing="0" border="0" class="homePageMatrixHdr">
<tbody><tr>
<td style="padding:10px;">
<form name="basicSearch" action="index.php" onsubmit="callSearch('Basic');return false;">
<table width="100%" cellpadding="5" cellspacing="0">
<tbody><tr>
<td width="20%" class="dvtCellLabel"><img src="themes/images/basicSearchLens.gif"></td>
<td width="30%" class="dvtCellLabel"><input type="text" name="search_text" id="search_txt" class="txtBox"> </td>
<td width="30%" class="dvtCellLabel"><b>In</b>
<select name="search_field" class="txtBox">
<option label="Organization Name" value="accountname">Organization Name</option>
<option label="Website" value="website">Website</option>
<option label="Phone" value="phone">Phone</option>
<option label="Assigned To" value="assigned_user_id">Assigned To</option>
</select>
<input type="hidden" name="searchtype" value="BasicSearch">
<input type="hidden" name="module" value="Accounts">
<input type="hidden" name="action" value="Popup">
<input type="hidden" name="query" value="true">
<input type="hidden" name="select_enable" id="select_enable" value="">
<input type="hidden" name="curr_row" id="curr_row" value="">
<input type="hidden" name="fldname_pb" value="">
<input type="hidden" name="productid_pb" value="">
<input name="popuptype" id="popup_type" type="hidden" value="specific_contact_account_address">
<input name="recordid" id="recordid" type="hidden" value="4845">
<input name="record_id" id="record_id" type="hidden" value="">
<input name="return_module" id="return_module" type="hidden" value="Emails">
<input name="from_link" id="from_link" type="hidden" value="">
<input name="maintab" id="maintab" type="hidden" value="">
<input type="hidden" id="relmod" name="" value="">
<input type="hidden" id="relrecord_id" name="" value="">
<input name="form" id="popupform" type="hidden" value="TasksEditView">
</td>
<td width="20%" class="dvtCellLabel">
<input type="button" name="search" value=" Search Now " onclick="callSearch('Basic');" class="crmbutton small create">
</td>
</tr>
<tr>
<td colspan="4" align="center">
<table width="100%" class="small">
<tbody><tr>
<td class="searchAlph" id="alpha_1" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=A&popuptype=specific_contact_account_address","alpha_1")">A</td><td class="searchAlph" id="alpha_2" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=B&popuptype=specific_contact_account_address","alpha_2")">B</td><td class="searchAlph" id="alpha_3" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=C&popuptype=specific_contact_account_address","alpha_3")">C</td><td class="searchAlph" id="alpha_4" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=D&popuptype=specific_contact_account_address","alpha_4")">D</td><td class="searchAlph" id="alpha_5" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=E&popuptype=specific_contact_account_address","alpha_5")">E</td><td class="searchAlph" id="alpha_6" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=F&popuptype=specific_contact_account_address","alpha_6")">F</td><td class="searchAlph" id="alpha_7" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=G&popuptype=specific_contact_account_address","alpha_7")">G</td><td class="searchAlph" id="alpha_8" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=H&popuptype=specific_contact_account_address","alpha_8")">H</td><td class="searchAlph" id="alpha_9" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=I&popuptype=specific_contact_account_address","alpha_9")">I</td><td class="searchAlph" id="alpha_10" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=J&popuptype=specific_contact_account_address","alpha_10")">J</td><td class="searchAlph" id="alpha_11" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=K&popuptype=specific_contact_account_address","alpha_11")">K</td><td class="searchAlph" id="alpha_12" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=L&popuptype=specific_contact_account_address","alpha_12")">L</td><td class="searchAlph" id="alpha_13" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=M&popuptype=specific_contact_account_address","alpha_13")">M</td><td class="searchAlph" id="alpha_14" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=N&popuptype=specific_contact_account_address","alpha_14")">N</td><td class="searchAlph" id="alpha_15" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=O&popuptype=specific_contact_account_address","alpha_15")">O</td><td class="searchAlph" id="alpha_16" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=P&popuptype=specific_contact_account_address","alpha_16")">P</td><td class="searchAlph" id="alpha_17" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=Q&popuptype=specific_contact_account_address","alpha_17")">Q</td><td class="searchAlph" id="alpha_18" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=R&popuptype=specific_contact_account_address","alpha_18")">R</td><td class="searchAlph" id="alpha_19" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=S&popuptype=specific_contact_account_address","alpha_19")">S</td><td class="searchAlph" id="alpha_20" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=T&popuptype=specific_contact_account_address","alpha_20")">T</td><td class="searchAlph" id="alpha_21" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=U&popuptype=specific_contact_account_address","alpha_21")">U</td><td class="searchAlph" id="alpha_22" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=V&popuptype=specific_contact_account_address","alpha_22")">V</td><td class="searchAlph" id="alpha_23" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=W&popuptype=specific_contact_account_address","alpha_23")">W</td><td class="searchAlph" id="alpha_24" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=X&popuptype=specific_contact_account_address","alpha_24")">X</td><td class="searchAlph" id="alpha_25" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=Y&popuptype=specific_contact_account_address","alpha_25")">Y</td><td class="searchAlph" id="alpha_26" align="center" onclick="alphabetic("Accounts","gname=&query=true&search_field=accountname&searchtype=BasicSearch&operator=s&type=alpbt&search_text=Z&popuptype=specific_contact_account_address","alpha_26")">Z</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</form>
</td>
</tr>
</tbody></table>
<div id="ListViewContents"><!-- BEGIN: main -->
<form name="selectall" method="POST">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="small">
<tbody><tr>
<td> </td>
<td style="padding-right:10px;" align="right"></td></tr>
<tr>
<td style="padding:10px;" colspan="3">
<input name="module" type="hidden" value="Emails">
<input name="action" type="hidden" value="">
<input name="pmodule" type="hidden" value="Accounts">
<input type="hidden" name="curr_row" value="">
<input name="entityid" type="hidden" value="">
<input name="popuptype" id="popup_type" type="hidden" value="specific_contact_account_address">
<input name="idlist" type="hidden" value="">
<div style="overflow:auto;height:348px;">
<table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="5" cellspacing="1" width="100%">
<tbody>
<tr>
<td class="lvtCol"><a href="javascript:;" onclick="getListViewSorted_js('Accounts','&recordid=4845&query=true&search_field=accountname&search_text=ORGANIZATION+NEW&searchtype=BasicSearch&popuptype=specific_contact_account_address&return_module=Emails&order_by=accountname&sorder=DESC')" class="listFormHeaderLinks">Organization Name <img src="themes/images/arrow_down.gif" border="0"></a></td>
<td class="lvtCol"><a href="javascript:;" onclick="getListViewSorted_js('Accounts','&recordid=4845&query=true&search_field=accountname&search_text=ORGANIZATION+NEW&searchtype=BasicSearch&popuptype=specific_contact_account_address&return_module=Emails&order_by=smownerid&sorder=DESC')" class="listFormHeaderLinks">Assigned To </a></td>
</tr>
<tr bgcolor="white" onmouseover="this.className='lvtColDataHover'" onmouseout="this.className='lvtColData'" class="lvtColData">
<td><a href="javascript:window.close();" onclick="set_return_contact_address("4846", "ORGANIZATION NEW", "", "", "", "", "", "", "", "", "", "","", "");" id="1">ORGANIZATION NEW</a></td>
<td> Administrator</td>
</tr>
</tbody>
</table>
<div>
</div></div></td>
</tr>
</tbody></table>
<table width="100%" align="center" class="reportCreateBottom">
<tbody><tr>
<td align="right" style="padding: 5px;"><img src="themes/images/start_disabled.gif" border="0" align="absmiddle"> <img src="themes/images/previous_disabled.gif" border="0" align="absmiddle"> <input class="small" name="pagenum" type="text" value="1" style="width: 3em;margin-right: 0.7em;" onchange="getListViewEntries_js('Accounts','parenttab=Marketing&start='+this.value+'');" onkeypress="return VT_disableFormSubmit(event);"><span name="Accounts_listViewCountContainerName" class="small" style="white-space: nowrap;">of 1</span><img src="themes/images/next_disabled.gif" border="0" align="absmiddle"> <img src="themes/images/end_disabled.gif" border="0" align="absmiddle"> </td>
<td width="35%"> </td>
</tr>
</tbody></table>
</form>
</div>
</td>
</tr>
</tbody></table>
<script>
var gPopupAlphaSearchUrl = '';
var gsorder ='';
var gstart ='';
function callSearch(searchtype)
{
gstart='';
for(i=1;i<=26;i++)
{
var data_td_id = 'alpha_'+ eval(i);
getObj(data_td_id).className = 'searchAlph';
}
gPopupAlphaSearchUrl = '';
search_fld_val= document.basicSearch.search_field[document.basicSearch.search_field.selectedIndex].value;
search_txt_val= encodeURIComponent(document.basicSearch.search_text.value.replace(/\'/,"\\'"));
var urlstring = '';
if(searchtype == 'Basic')
{
urlstring = 'search_field='+search_fld_val+'&searchtype=BasicSearch&search_text='+search_txt_val;
}
popuptype = $('popup_type').value;
act_tab = $('maintab').value;
urlstring += '&popuptype='+popuptype;
urlstring += '&maintab='+act_tab;
urlstring = urlstring +'&query=true&file=Popup&module=Accounts&action=AccountsAjax&ajax=true&search=true';
urlstring +=gethiddenelements();
record_id = document.basicSearch.record_id.value;
//support for popupmode and callback
urlstring += "&popupmode=";
urlstring += "&callback=";
if(record_id!='')
urlstring += '&record_id='+record_id;
$("status").style.display="inline";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: urlstring,
onComplete: function(response) {
$("status").style.display="none";
$("ListViewContents").innerHTML= response.responseText;
}
}
);
}
function alphabetic(module,url,dataid)
{
gstart='';
document.basicSearch.search_text.value = '';
for(i=1;i<=26;i++)
{
var data_td_id = 'alpha_'+ eval(i);
getObj(data_td_id).className = 'searchAlph';
}
getObj(dataid).className = 'searchAlphselected';
gPopupAlphaSearchUrl = '&'+url;
var urlstring ="module="+module+"&action="+module+"Ajax&file=Popup&ajax=true&search=true&"+url;
urlstring +=gethiddenelements();
record_id = document.basicSearch.record_id.value;
if(record_id!='')
urlstring += '&record_id='+record_id;
$("status").style.display="inline";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: urlstring,
onComplete: function(response) {
$("status").style.display="none";
$("ListViewContents").innerHTML= response.responseText;
}
}
);
}
function gethiddenelements()
{
gstart='';
var urlstring=''
if(getObj('select_enable').value != '')
urlstring +='&select=enable';
if(document.getElementById('curr_row').value != '')
urlstring +='&curr_row='+document.getElementById('curr_row').value;
if(getObj('fldname_pb').value != '')
urlstring +='&fldname='+getObj('fldname_pb').value;
if(getObj('productid_pb').value != '')
urlstring +='&productid='+getObj('productid_pb').value;
if(getObj('recordid').value != '')
urlstring +='&recordid='+getObj('recordid').value;
if(getObj('relmod').value != '')
urlstring +='&'+getObj('relmod').name+'='+getObj('relmod').value;
if(getObj('relrecord_id').value != '')
urlstring +='&'+getObj('relrecord_id').name+'='+getObj('relrecord_id').value;
// vtlib customization: For uitype 10 popup during paging
if(document.getElementById('popupform'))
urlstring +='&form='+encodeURIComponent(getObj('popupform').value);
if(document.getElementById('forfield'))
urlstring +='&forfield='+encodeURIComponent(getObj('forfield').value);
if(document.getElementById('srcmodule'))
urlstring +='&srcmodule='+encodeURIComponent(getObj('srcmodule').value);
if(document.getElementById('forrecord'))
urlstring +='&forrecord='+encodeURIComponent(getObj('forrecord').value);
// END
if(document.getElementById('currencyid') != null && document.getElementById('currencyid').value != '')
urlstring +='¤cyid='+document.getElementById('currencyid').value;
var return_module = document.getElementById('return_module').value;
if(return_module != '')
urlstring += '&return_module='+return_module;
return urlstring;
}
function getListViewEntries_js(module,url)
{
gstart="&"+url;
popuptype = document.getElementById('popup_type').value;
var urlstring ="module="+module+"&action="+module+"Ajax&file=Popup&ajax=true&"+url;
urlstring +=gethiddenelements();
search_fld_val= document.basicSearch.search_field[document.basicSearch.search_field.selectedIndex].value;
search_txt_val=document.basicSearch.search_text.value;
if(search_txt_val != '')
urlstring += '&query=true&search_field='+search_fld_val+'&searchtype=BasicSearch&search_text='+search_txt_val;
if(gPopupAlphaSearchUrl != '')
urlstring += gPopupAlphaSearchUrl;
else
urlstring += '&popuptype='+popuptype;
record_id = document.basicSearch.record_id.value;
if(record_id!='')
urlstring += '&record_id='+record_id;
urlstring += (gsorder !='') ? gsorder : '';
var return_module = document.getElementById('return_module').value;
if(module == 'Documents' && return_module == 'MailManager')
{
urlstring += '&callback=MailManager.add_data_to_relatedlist';
urlstring += '&popupmode=ajax';
urlstring += '&srcmodule=MailManager';
}
$("status").style.display = "";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: urlstring,
onComplete: function(response) {
$("ListViewContents").innerHTML= response.responseText;
$("status").style.display = "none";
}
}
);
}
function getListViewSorted_js(module,url)
{
gsorder=url;
var urlstring ="module="+module+"&action="+module+"Ajax&file=Popup&ajax=true"+url;
record_id = document.basicSearch.record_id.value;
if(record_id!='')
urlstring += '&record_id='+record_id;
urlstring += (gstart !='') ? gstart : '';
$("status").style.display = "";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: urlstring,
onComplete: function(response) {
$("ListViewContents").innerHTML= response.responseText;
$("status").style.display = "none";
}
}
);
}
var product_labelarr = {
CLEAR_COMMENT:'Clear Comment',
DISCOUNT:'Discount',
TOTAL_AFTER_DISCOUNT:'Total After Discount',
TAX:'Tax',
ZERO_DISCOUNT:'Zero Discount',
PERCENT_OF_PRICE:'of Price',
DIRECT_PRICE_REDUCTION:'Direct Price Reduction'
};
</script><!-- stopscrmprint --> <script type="text/javascript">
var userDateFormat = "dd-mm-yyyy";
var default_charset = "UTF-8";
var userCurrencySeparator = ",";
var userDecimalSeparator = ".";
</script>
</body></html>
Code:
<td><a href="javascript:window.close();" onclick="set_return_contact_address("4846", "ORGANIZATION NEW", "", "", "", "", "", "", "", "", "", "","", "");" id="1">ORGANIZATION NEW</a></td>
For testing purposes, I replaced within the html code of the page the first 2 quotes ("") with some text and once I clicked "Yes" it indeed filled the address field with the text.