[Vtigercrm-commits] [vtiger-commits] r10006 - in /vtigercrm/branches/5.0.3: ./ Smarty/templates/ include/js/ include/utils/ modules/Calendar/ modules/Contacts/ modules/Potentials/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Jan 2 10:59:34 EST 2007


Author: richie
Date: Tue Jan  2 08:59:21 2007
New Revision: 10006

Log:
Changes made to show contacts of Accounts/Potential and not all

Modified:
    vtigercrm/branches/5.0.3/Popup.php
    vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
    vtigercrm/branches/5.0.3/include/js/general.js
    vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
    vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php
    vtigercrm/branches/5.0.3/modules/Contacts/Contact.js
    vtigercrm/branches/5.0.3/modules/Potentials/CallRelatedList.php

Modified: vtigercrm/branches/5.0.3/Popup.php
==============================================================================
--- vtigercrm/branches/5.0.3/Popup.php (original)
+++ vtigercrm/branches/5.0.3/Popup.php Tue Jan  2 08:59:21 2007
@@ -20,7 +20,6 @@
 require_once('include/database/PearDatabase.php');
 require_once('include/ComboUtil.php');
 require_once('include/utils/utils.php');
-
 global $app_strings;
 global $currentModule;
 global $theme;
@@ -221,10 +220,17 @@
 			$url_string .='&recordid='.$_REQUEST['recordid'];
 		}
         $where_relquery = getRelCheckquery($currentModule,$_REQUEST['return_module'],$_REQUEST['recordid']);
+	if($where_relquery == '')
+	{
+		if(isset($_REQUEST['relmod_id']))
+			$where_relquery = getPopupCheckquery($currentModule,$_REQUEST['parent_module'],$_REQUEST['relmod_id']);
+		else
+			$where_relquery = getPopupCheckquery($currentModule,$_REQUEST['task_parent_module'],$_REQUEST['task_relmod_id']);
+	}
+	
         $query = getListQuery($currentModule,$where_relquery);
 }
 			
-
 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
 {
 	list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
@@ -235,7 +241,6 @@
 {
         $query .= ' and '.$where;
 }
-
 if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
 if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '')	$sorder = $_REQUEST['sorder'];
 
@@ -246,7 +251,6 @@
 $list_result = $adb->query($query);
 //Retreiving the no of rows
 $noofrows = $adb->num_rows($list_result);
-
 //Retreiving the start value from request
 if(isset($_REQUEST['start']) && $_REQUEST['start'] != '')
 {

Modified: vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl Tue Jan  2 08:59:21 2007
@@ -566,8 +566,8 @@
 								<td><b>{$APP.Contacts}</b></td>
 								<td colspan="2">
 									<input name="contactidlist" id="contactidlist" value="{$CONTACTSID}" type="hidden">
-									<textarea rows="5" name="contactlist" readonly="readonly" class="calTxt">{$CONTACTSNAME}</textarea>&nbsp;
-									<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&return_module=Calendar&popuptype=detailview&select=enable&form=EditView&form_submit=false','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="Select Contacts">
+									<textarea rows="5" name="contactlist" readonly="readonly" class="calTxt" id='parentid'>{$CONTACTSNAME}</textarea>&nbsp;
+									<input type="button" onclick="selectContact('true','general',document.EditView);" class="crmButton small edit" name="selectcnt" value="Select Contacts">
 								</td>
 							</tr>
 						</table>
@@ -796,8 +796,8 @@
 			     <tr>
                                      <td><b>{$LABEL.contact_id}</b></td>
 				     <td colspan="2">
-						<input name="contact_name" readonly type="text" class="calTxt" value="{$ACTIVITYDATA.contact_id}"><input name="contact_id" type="hidden" value="{$secondvalue.contact_id}">&nbsp;
-						<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="Select Contact">
+						<input name="contact_name" id = "contact_name" readonly type="text" class="calTxt" value="{$ACTIVITYDATA.contact_id}"><input name="contact_id"  type="hidden" value="{$secondvalue.contact_id}">&nbsp;
+						<input type="button" onclick="selectContact('false','task',document.EditView);" class="crmButton small edit" name="selectcnt" value="Select Contact">
 				     </td>
                              </tr>
 			     {/if}

Modified: vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl Tue Jan  2 08:59:21 2007
@@ -207,7 +207,7 @@
 				<font color="red">*</font>{$fldlabel}
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
-				<input readonly name="account_name" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype=specific_account_address&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
+				<input readonly name="account_name" id = "single_accountid" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype=specific_account_address&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
 			</td>
 
 		{elseif $uitype eq 75 || $uitype eq 81}
@@ -230,7 +230,8 @@
 				{$fldlabel}
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
-				<input name="contact_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.contact_id.value=''; this.form.contact_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			
+				<input name="contact_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='selectContact("false","general",document.EditView)' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.contact_id.value=''; this.form.contact_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
 			</td>
 		
 		{elseif $uitype eq 58}
@@ -246,7 +247,7 @@
 				{$fldlabel}
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
-				<input name="salesorder_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=SalesOrder&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.salesorder_id.value=''; this.form.salesorder_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+				<input name="salesorder_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='selectSalesOrder();' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.salesorder_id.value=''; this.form.salesorder_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
 			</td>
 
 		{elseif $uitype eq 78}
@@ -254,7 +255,7 @@
 				{$fldlabel}
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
-				<input name="quote_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$QUOTE_ID}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Quotes&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.quote_id.value=''; this.form.quote_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+				<input name="quote_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$QUOTE_ID}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='selectQuote()' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.quote_id.value=''; this.form.quote_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
 			</td>
 
 		{elseif $uitype eq 76}
@@ -262,7 +263,7 @@
 				{$fldlabel}
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
-				<input name="potential_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Potentials&action=Popup&html=Popup_picker&popuptype=specific_potential_account_address&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.potential_id.value=''; this.form.potential_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+				<input name="potential_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='selectPotential()' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.potential_id.value=''; this.form.potential_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
 			</td>
 
 		{elseif $uitype eq 17}
@@ -377,7 +378,7 @@
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
 				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
-				<input name="parent_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}">
+				<input name="parent_name" readonly id = "parentid" type="text" style="border:1px solid #bababa;" value="{$fldvalue}">
 				&nbsp;<img src="{$IMAGE_PATH}select.gif" tabindex="{$vt_tab}" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&html=Popup_picker&form=HelpDeskEditView","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=''; this.form.parent_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
 			</td>
 
@@ -711,5 +712,5 @@
 
 {rdelim}
 
-
 </script>
+

Modified: vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl Tue Jan  2 08:59:21 2007
@@ -17,7 +17,9 @@
 {else}
 	{assign var = return_modname value='CallRelatedList'}
 {/if}
-
+{if $BASE_ACCOUNT neq ''}
+        {assign var="search_string" value="&search_field=accountid&query=true&searchtype=BasicSearch&search_text=$BASE_ACCOUNT"}
+{/if}
 {foreach key=header item=detail from=$RELATEDLISTS}
 
 <table border=0 cellspacing=0 cellpadding=0 width=100% class="small" style="border-bottom:1px solid #999999;padding:5px;">
@@ -56,7 +58,7 @@
 				<input title="{$APP.LBL_ADD_NEW} {$APP.Lead}" accessyKey="F" class="crmbutton small edit" onclick="this.form.action.value='EditView';this.form.module.value='Leads'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Lead}"></td>
 			{elseif $header eq 'Contacts' }
 				{if $MODULE eq 'Calendar' || $MODULE eq 'Potentials' || $MODULE eq 'Vendors'}
-				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
+				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}{$search_string}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
 				{elseif $MODULE eq 'Emails'}
 				<input title="{$APP.LBL_BULK_MAILS}" accessykey="F" class="crmbutton small create" onclick="this.form.action.value='sendmail';this.form.return_action.value='DetailView';this.form.module.value='Emails';this.form.return_module.value='Emails';" name="button" value="{$APP.LBL_BULK_MAILS}" type="submit">&nbsp;
 				<input title="Change" accessKey="" class="crmbutton small create" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module=Emails&action=Popup&popuptype=detailview&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>

Modified: vtigercrm/branches/5.0.3/include/js/general.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/general.js (original)
+++ vtigercrm/branches/5.0.3/include/js/general.js Tue Jan  2 08:59:21 2007
@@ -1717,26 +1717,120 @@
                 inputField : fieldid, ifFormat : dateformat, showsTime : false, button : imageid, singleClick : true, step : 1
         });
 }
-function AjaxDuplicateValidate(module,fieldname,oform)
-{
-	var fieldvalue = getObj(fieldname).value;
-	var url = "module="+module+"&action="+module+"Ajax&file=Save&"+fieldname+"="+fieldvalue+"&dup_check=true"
-	new Ajax.Request(
-          	  	      'index.php',
-			      	{queue: {position: 'end', scope: 'command'},
-		                        method: 'post',
-                		        postBody:url,
-		                        onComplete: function(response) {
-						var str = response.responseText
-						if(str.indexOf('SUCCESS') > -1)
-						{
-							oform.submit();	
-						}else
-						{
-							alert(str);
-						}
-		                        }
-              			 }
-       			);	
-
-}
+
+/**to get SelectContacts Popup
+check->to check select options enable or disable
+*type->to differentiate from task
+*frmName->form name*/
+
+function selectContact(check,type,frmName)
+{
+        if($("single_accountid"))
+        {
+		var potential_id = '';
+		if($("potential_id"))
+			potential_id = frmName.potential_id.value;
+		account_id = frmName.account_id.value;
+		if(potential_id != '')
+		{
+			record_id = potential_id;
+			module_string = "&parent_module=Potentials";
+		}	
+		else
+		{
+			record_id = account_id;
+			module_string = "&parent_module=Accounts";
+		}
+		if(record_id != '')
+	                window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView"+module_string+"&relmod_id="+record_id,"test","width=640,height=602,resizable=0,scrollbars=0");
+		else
+			 window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");	
+        }
+        else if(($("parentid")) && type != 'task' )
+        {
+                rel_parent_module = frmName.parent_type.value;
+		record_id = frmName.parent_id.value;
+                module = rel_parent_module.split("&");	
+		if(record_id != '' && module == "Leads")
+		{
+			alert("You can't select related contacts from Lead ");
+			document.formName.selectcnt.disabled="true";
+		}
+		else
+		{
+			if(check == 'true')
+				search_string = "&return_module=Calendar&select=enable&popuptype=detailview&form_submit=false";
+			else
+				search_string="&popuptype=specific";
+			if(record_id != '')
+				window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView"+search_string+"&relmod_id="+record_id+"&parent_module="+module[0],"test","width=640,height=602,resizable=0,scrollbars=0");
+			else
+				window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
+
+
+		}
+        }
+	else if(($("contact_name")) && type == 'task')
+	{
+		var formName = frmName.name;
+		if(formName == 'EditView')
+		{
+			task_parent_module = frmName.parent_type.value;
+			task_recordid = frmName.parent_id.value;
+			task_module = task_parent_module.split("&");
+			popuptype="&popuptype=specific";
+		}
+		else
+		{
+			task_parent_module = frmName.task_parent_type.value;
+			task_recordid = frmName.task_parent_id.value;
+			task_module = task_parent_module.split("&");
+			popuptype="&popuptype=toDospecific";
+		}
+		if(task_recordid != '' && task_module == "Leads" )
+		{
+			alert("You can't select related contacts from Lead ");
+			document.frmName.selectcnt.disabled="true";
+		}
+		else
+		{
+			if(task_recordid != '')
+				window.open("index.php?module=Contacts&action=Popup&html=Popup_picker"+popuptype+"&form=EditView&task_relmod_id="+task_recordid+"&task_parent_module="+task_module[0],"test","width=640,height=602,resizable=0,scrollbars=0");
+			else	
+				window.open("index.php?module=Contacts&action=Popup&html=Popup_picker"+popuptype+"&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
+		}
+
+	}
+        else
+        {
+                window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
+        }
+}
+//to get Select Potential Popup
+function selectPotential()
+{
+	var record_id= document.EditView.account_id.value;
+	if(record_id != '')
+		window.open("index.php?module=Potentials&action=Popup&html=Popup_picker&popuptype=specific_potential_account_address&form=EditView&relmod_id="+record_id+"&parent_module=Accounts","test","width=640,height=602,resizable=0,scrollbars=0");
+	else
+		window.open("index.php?module=Potentials&action=Popup&html=Popup_picker&popuptype=specific_potential_account_address&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
+}
+//to select Quote Popup
+function selectQuote()
+{
+	var record_id= document.EditView.account_id.value;
+        if(record_id != '')
+		window.open("index.php?module=Quotes&action=Popup&html=Popup_picker&popuptype=specific&form=EditView&relmod_id="+record_id+"&parent_module=Accounts","test","width=640,height=602,resizable=0,scrollbars=0");
+
+	else
+		window.open("index.php?module=Quotes&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
+}
+//to get select SalesOrder Popup
+function selectSalesOrder()
+{
+	var record_id= document.EditView.account_id.value;
+        if(record_id != '')
+		window.open("index.php?module=SalesOrder&action=Popup&html=Popup_picker&popuptype=specific&form=EditView&relmod_id="+record_id+"&parent_module=Accounts","test","width=640,height=602,resizable=0,scrollbars=0");
+	else
+		window.open("index.php?module=SalesOrder&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
+}

Modified: vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php Tue Jan  2 08:59:21 2007
@@ -1311,7 +1311,7 @@
 		{
 			if($mode == "search")
 			{
-				if($popuptype == "specific")
+				if($popuptype == "specific" || $popuptype=="toDospecific")
 				{
 					// Added for get the first name of contact in Popup window
 					if($colname == "lastname" && $module == 'Contacts')
@@ -1327,7 +1327,10 @@
 					if($module == 'SalesOrder')
 						$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'","'.$_REQUEST['form'].'");\'>'.$temp_val.'</a>';
 					else
-						$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
+						if($popuptype=='toDospecific')
+							$value = '<a href="javascript:window.close();" onclick=\'set_return_toDospecific("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
+						else
+							$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "detailview")
 				{
@@ -2627,7 +2630,189 @@
 	return;
 	else
 	return $output;
-} 
+}
+
+function getPopupCheckquery($current_module,$relmodule,$relmod_recordid)
+{
+	global $log,$adb;
+	$log->debug("Entering getPopupCheckquery(".$currentmodule.",".$relmodule.",".$relmod_recordid.") method ...");
+	if($current_module == "Contacts")	
+	{
+		if($relmodule == "Accounts")
+			$condition = "and vtiger_account.accountid= ".$relmod_recordid;
+
+		elseif($relmodule == "Potentials")
+		{
+			/*$query = "select accountid from vtiger_potential where potentialid=".$relmod_recordid;
+			$result = $adb->query($query);
+			$account_id = $adb->query_result($result,0,"accountid");
+			$condition = "and vtiger_contactdetails.accountid= ".$account_id;*/
+
+			$query = "select contactid from vtiger_contpotentialrel where potentialid=".$relmod_recordid;
+			$result = $adb->query($query);
+                        $contact_id = $adb->query_result($result,0,"contactid");
+			$condition = "and vtiger_contactdetails.contactid= ".$contact_id;
+		}
+		elseif($relmodule == "Quotes")
+		{
+
+			$query = "select contactid from vtiger_quotes where quoteid=".$relmod_recordid;
+			$result = $adb->query($query);
+			$contactid = $adb->query_result($result,0,"contactid");
+			if($contactid != '')
+				$condition = "and vtiger_contactdetails.contactid= ".$contactid;
+			else
+			{
+				$query = "select accountid from vtiger_quotes where quoteid=".$relmod_recordid;
+				$result = $adb->query($query);
+				$account_id = $adb->query_result($result,0,"accountid");
+				$condition = "and vtiger_contactdetails.accountid= ".$account_id;
+			}
+		}
+		elseif($relmodule == "PurchaseOrder")
+		{
+			$query = "select contactid from vtiger_purchaseorder where purchaseorderid=".$relmod_recordid;
+			$result = $adb->query($query);
+			$contact_id = $adb->query_result($result,0,"contactid");
+			$condition = "and vtiger_contactdetails.contactid= ".$contact_id;
+		}
+
+		elseif($relmodule == "SalesOrder")
+		{
+			$query = "select contactid from vtiger_salesorder where salesorderid=".$relmod_recordid;
+			$result = $adb->query($query);
+			$contact_id = $adb->query_result($result,0,"contactid");
+			$condition =  "and vtiger_contactdetails.contactid=".$contact_id;
+		}
+
+		elseif($relmodule == "Invoice")
+		{
+			$query = "select accountid from vtiger_invoice where invoiceid=".$relmod_recordid;
+			$result = $adb->query($query);
+			$account_id = $adb->query_result($result,0,"accountid");
+			$condition =  "and vtiger_contactdetails.accountid=".$account_id;
+
+		}
+
+		elseif($relmodule == "Campaigns")
+		{
+			$query = "select contactid from vtiger_campaigncontrel where campaignid =".$relmod_recordid;
+			$result = $adb->query($query);
+			$rows = $adb->num_rows($result);
+			if($rows != 0)
+			{
+				$j = 0;
+				$contactid_comma = "(";
+				for($k=0; $k < $rows; $k++)
+				{
+					$contactid = $adb->query_result($result,$k,'contactid');
+					$contactid_comma.=$contactid;
+					if($k < ($rows-1))
+						$contactid_comma.=', ';
+				}
+				$contactid_comma.= ")";
+			}
+			if($contactid_comma != '')
+				$condition = "and vtiger_contactdetails.contactid in ".$contactid_comma;
+		}
+
+		elseif($relmodule == "HelpDesk" || $relmodule == "Trouble Tickets")
+		{
+			$query = "select parent_id from vtiger_troubletickets where ticketid =".$relmod_recordid;	
+			$result = $adb->query($query);
+			$parent_id = $adb->query_result($result,0,"parent_id");
+			$crmquery = "select setype from vtiger_crmentity where crmid=".$parent_id;
+			$parentmodule_id = $adb->query($crmquery);
+			$parent_modname = $adb->query_result($parentmodule_id,0,"setype");
+			if($parent_modname == "Accounts")
+				$condition = "and vtiger_contactdetails.accountid= ".$parent_id;
+			if($parent_modname == "Contacts")
+				$condition = "and vtiger_contactdetails.contactid= ".$parent_id;
+
+		}
+	}
+	elseif($current_module == "Potentials")
+	{
+		if($relmodule == 'Accounts')
+		{
+			$pot_query = "select potentialid from vtiger_potential where accountid=".$relmod_recordid;
+			$pot_result = $result = $adb->query($pot_query);
+			$rows = $adb->num_rows($pot_result);
+			if($rows != 0)
+			{
+				$j = 0;
+				$potids_comma = "(";
+				for($k=0; $k < $rows; $k++)
+				{
+					$potential_ids = $adb->query_result($pot_result,$k,'potentialid');
+					$potids_comma.=$potential_ids;
+					if($k < ($rows-1))
+						$potids_comma.=',';
+				}
+				$potids_comma.= ")";
+			}
+			if($potids_comma != '')
+				$condition ="and vtiger_potential.potentialid in ".$potids_comma;
+		}
+		
+	}
+	else if($current_module == 'Quotes')
+	{
+		if($relmodule == 'Accounts')
+		{
+			$quote_query = "select quoteid from vtiger_quotes where accountid=".$relmod_recordid;
+			$quote_result = $result = $adb->query($quote_query);
+			$rows = $adb->num_rows($quote_result);
+			if($rows != 0)
+			{
+				$j = 0;
+				$qtids_comma = "(";
+				for($k=0; $k < $rows; $k++)
+				{
+					$quote_ids = $adb->query_result($quote_result,$k,'quoteid');
+					$qtids_comma.=$quote_ids;
+					if($k < ($rows-1))
+						$qtids_comma.=',';
+				}
+				$qtids_comma.= ")";
+			}
+			if($qtids_comma != '')
+				$condition ="and vtiger_quotes.quoteid in ".$qtids_comma;
+		}
+
+	}
+	else if($current_module == 'SalesOrder')
+	{
+		if($relmodule == 'Accounts')
+		{
+			$SO_query = "select salesorderid from vtiger_salesorder where accountid=".$relmod_recordid;
+			$SO_result = $result = $adb->query($SO_query);
+			$rows = $adb->num_rows($SO_result);
+			if($rows != 0)
+			{
+				$SOids_comma = "(";
+				for($k=0; $k < $rows; $k++)
+				{
+					$SO_ids = $adb->query_result($SO_result,$k,'salesorderid');
+					$SOids_comma.=$SO_ids;
+					if($k < ($rows-1))
+						$SOids_comma.=',';
+				}
+				$SOids_comma.= ")";
+			}
+			if($SOids_comma != '')
+				$condition ="and vtiger_salesorder.salesorderid in ".$SOids_comma;
+		}
+
+	}
+	else
+		$condition = '';
+	$where = $condition;	
+	$log->debug("Exiting getPopupCheckquery method ...");
+	return $where;
+	
+	
+}
 
 /**This function return the entity ids that need to be excluded in popup listview for a given record
 Param $currentmodule - modulename of the entity to be selected

Modified: vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php Tue Jan  2 08:59:21 2007
@@ -594,8 +594,8 @@
 						<td><b><?php echo $app_strings['Contacts'] ?></b></td>
 							<td colspan="2">
 								<input name="contactidlist" id="contactidlist" value="" type="hidden">
-								<textarea rows="5" name="contactlist" readonly="readonly" class="calTxt"></textarea>&nbsp;
-								<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&return_module=Calendar&popuptype=detailview&select=enable&form=EditView&form_submit=false','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="<?php echo $mod_strings['LBL_SELECT_CONTACT'] ; ?>">
+								<textarea rows="5" name="contactlist" readonly="readonly" class="calTxt" id="parentid"></textarea>&nbsp;
+								<input type="button" onclick="selectContact('true','general',document.EditView)" class="crmButton small edit" name="selectcnt" value="<?php echo $mod_strings['LBL_SELECT_CONTACT'] ; ?>">
 							</td>
 						</tr>
 					</table>
@@ -823,7 +823,7 @@
 				</td>
 				<td>
 					<div id="taskrelatedto" align="left">
-					<input name="task_parent_name" readonly type="text" class="calTxt small" value="">
+					<input name="task_parent_name" readonly  type="text" class="calTxt small" value="">
 					<input type="button" name="selectparent" class="crmButton small edit" value="<?php echo $mod_strings['LBL_SELECT']; ?>" onclick="return window.open('index.php?module='+document.createTodo.task_parent_type.value+'&action=Popup&maintab=Calendar','test','width=640,height=602,resizable=0,scrollbars=0,top=150,left=200');">
 					</div>
 				</td>
@@ -833,8 +833,8 @@
 			<tr>
 			<td><b><?php echo $mod_strings['LBL_CONTACT_NAME'] ?></b></td>
 			<td colspan="2">
-				<input name="task_contact_name" id="contact_name" readonly type="text" class="calTxt" value=""><input name="task_contact_id" id="contact_id" type="hidden" value="">&nbsp;
-				<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="<?php echo $mod_strings['LBL_SELECT_CONTACT'] ; ?>">
+				<input name="task_contact_name" id="contact_name" readonly type="text" class="calTxt" value="" ><input name="task_contact_id" id="contact_id" type="hidden" value="">&nbsp;
+				<input type="button" onclick="selectContact('false','task',document.createTodo);" class="crmButton small edit" name="selectcnt" value="<?php echo $mod_strings['LBL_SELECT_CONTACT'] ; ?>">
 			</td>
 			  </tr>
 			<?php } ?>

Modified: vtigercrm/branches/5.0.3/modules/Contacts/Contact.js
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Contacts/Contact.js (original)
+++ vtigercrm/branches/5.0.3/modules/Contacts/Contact.js Tue Jan  2 08:59:21 2007
@@ -95,6 +95,14 @@
         fldName.value = product_name;
         fldId.value = product_id;
 }
+//only for Todo
+function set_return_toDospecific(product_id, product_name) {
+        var fldName = getOpenerObj("task_contact_name");
+        var fldId = getOpenerObj("task_contact_id");
+        fldName.value = product_name;
+        fldId.value = product_id;
+}
+
 function submitform(id){
 		document.massdelete.entityid.value=id;
 		document.massdelete.submit();

Modified: vtigercrm/branches/5.0.3/modules/Potentials/CallRelatedList.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Potentials/CallRelatedList.php (original)
+++ vtigercrm/branches/5.0.3/modules/Potentials/CallRelatedList.php Tue Jan  2 08:59:21 2007
@@ -52,6 +52,7 @@
 if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
 $related_array = getRelatedLists($currentModule,$focus);
 $smarty->assign("RELATEDLISTS", $related_array);
+$smarty->assign("BASE_ACCOUNT",getAccountName($focus->column_fields[account_id]));
 $category = getParentTab();
 $smarty->assign("CATEGORY",$category);
 $smarty->assign("UPDATEINFO",updateInfo($focus->id));





More information about the vtigercrm-commits mailing list