[Vtigercrm-commits] [vtiger-commits] r9669 - in /vtigercrm/branches/5.0.2: Smarty/templates/ include/utils/ modules/Accounts/ modules/Calendar/ modules/Campaigns/ modules/Contacts/ modules/HelpDesk/ modules/Invoice/ modules/Leads/ modules/Potentials/ modules/Products/ modules/Quotes/ modules/SalesOrder/ modules/Users/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Oct 20 08:15:09 EDT 2006


Author: jerrydgeorge
Date: Fri Oct 20 06:14:25 2006
New Revision: 9669

Log:
* Modified to provide Group option in Change Owner in all ListView, Fixes #260

Modified:
    vtigercrm/branches/5.0.2/Smarty/templates/ListView.tpl
    vtigercrm/branches/5.0.2/include/utils/CommonUtils.php
    vtigercrm/branches/5.0.2/modules/Accounts/ListView.php
    vtigercrm/branches/5.0.2/modules/Calendar/ListView.php
    vtigercrm/branches/5.0.2/modules/Campaigns/ListView.php
    vtigercrm/branches/5.0.2/modules/Contacts/ListView.php
    vtigercrm/branches/5.0.2/modules/HelpDesk/ListView.php
    vtigercrm/branches/5.0.2/modules/Invoice/ListView.php
    vtigercrm/branches/5.0.2/modules/Leads/ListView.php
    vtigercrm/branches/5.0.2/modules/Potentials/ListView.php
    vtigercrm/branches/5.0.2/modules/Products/ListView.php
    vtigercrm/branches/5.0.2/modules/Quotes/ListView.php
    vtigercrm/branches/5.0.2/modules/SalesOrder/ListView.php
    vtigercrm/branches/5.0.2/modules/Users/updateLeadDBStatus.php

Modified: vtigercrm/branches/5.0.2/Smarty/templates/ListView.tpl
==============================================================================
--- vtigercrm/branches/5.0.2/Smarty/templates/ListView.tpl (original)
+++ vtigercrm/branches/5.0.2/Smarty/templates/ListView.tpl Fri Oct 20 06:14:25 2006
@@ -21,7 +21,20 @@
 {/if}
 <script language="JavaScript" type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
 <script language="javascript">
-
+function checkgroup()
+{ldelim}
+  if(document.change_ownerform_name.user_lead_owner[1].checked)
+  {ldelim}
+  document.change_ownerform_name.lead_group_owner.style.display = "block";
+  document.change_ownerform_name.lead_owner.style.display = "none";
+  {rdelim}
+  else
+  {ldelim}
+  document.change_ownerform_name.lead_owner.style.display = "block";
+  document.change_ownerform_name.lead_group_owner.style.display = "none";
+  {rdelim}    
+  
+{rdelim}
 function callSearch(searchtype)
 {ldelim}
 	for(i=1;i<=26;i++)
@@ -258,18 +271,24 @@
 		<td class=small >
 		
 			<!-- popup specific content fill in starts -->
-
+      <form name="change_ownerform_name">
 			<table border=0 celspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
 				<tr>
 					<td width="50%"><b>{$APP.LBL_TRANSFER_OWNERSHIP}</b></td>
 					<td width="2%"><b>:</b></td>
 					<td width="48%">
+					<input type = "radio" name = "user_lead_owner"  onclick=checkgroup(); checked>user&nbsp;
+					<input type = "radio" name = "user_lead_owner" onclick=checkgroup(); >group<br>
 					<select name="lead_owner" id="lead_owner" class="detailedViewTextBox">
 					{$CHANGE_OWNER}
+					</select>
+					<select name="lead_group_owner" id="lead_group_owner" class="detailedViewTextBox" style="display:none;">
+					{$CHANGE_GROUP_OWNER}
 					</select>
 					</td>
 				</tr>
 			</table>
+			</form>
 		</td>
 	</tr>
 </table>
@@ -342,13 +361,22 @@
 	}
 	else if(statusname == 'owner')
 	{
-		fninvsh('changeowner');
-		var url='&user_id='+document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
-		
-{/literal}
-		var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
-{literal}
-
+	   if(document.change_ownerform_name.user_lead_owner[0].checked)
+	   {
+		    fninvsh('changeowner');
+		    var url='&user_id='+document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
+		    {/literal}
+		        var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
+		    {literal}
+     }
+    else
+    {
+        fninvsh('changeowner');
+		    var url='&group_id='+document.getElementById('lead_group_owner').options[document.getElementById('lead_group_owner').options.selectedIndex].value;
+	       {/literal}
+		        var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
+        {literal}
+    }
 	}
 	new Ajax.Request(
                 'index.php',

Modified: vtigercrm/branches/5.0.2/include/utils/CommonUtils.php
==============================================================================
--- vtigercrm/branches/5.0.2/include/utils/CommonUtils.php (original)
+++ vtigercrm/branches/5.0.2/include/utils/CommonUtils.php Fri Oct 20 06:14:25 2006
@@ -1996,6 +1996,26 @@
 	$change_owner = get_select_options_with_id($usernamelist,'admin');
 	$log->debug("Exiting getUserslist method ...");
 	return $change_owner;
+}
+
+
+function getGroupslist()
+{
+	global $log;
+	$log->debug("Entering getGroupslist() method ...");
+	global $adb;
+	$result=$adb->query("select * from vtiger_groups");
+	
+	for($i=0;$i<$adb->num_rows($result);$i++)
+	{
+	       $groupidlist[$i]=$adb->query_result($result,$i,'groupid');
+	       $groupnamelist[$groupidlist[$i]]=$adb->query_result($result,$i,'groupname');
+	       
+	}
+	$change_groups_owner = get_select_options_with_id($groupnamelist,'');
+	$log->debug("Exiting getGroupslist method ...");
+
+	return $change_groups_owner;
 }
 
 

Modified: vtigercrm/branches/5.0.2/modules/Accounts/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Accounts/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Accounts/ListView.php Fri Oct 20 06:14:25 2006
@@ -80,6 +80,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
 {
 	list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));

Modified: vtigercrm/branches/5.0.2/modules/Calendar/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Calendar/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Calendar/ListView.php Fri Oct 20 06:14:25 2006
@@ -76,6 +76,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 $where = "";
 
 $url_string = ''; // assigning http url string

Modified: vtigercrm/branches/5.0.2/modules/Campaigns/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Campaigns/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Campaigns/ListView.php Fri Oct 20 06:14:25 2006
@@ -77,6 +77,7 @@
 $customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 //<<<<<customview>>>>>
 
 if($viewid != 0)

Modified: vtigercrm/branches/5.0.2/modules/Contacts/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Contacts/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Contacts/ListView.php Fri Oct 20 06:14:25 2006
@@ -114,6 +114,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 // Buttons and View options
 if($viewid != 0)
 {

Modified: vtigercrm/branches/5.0.2/modules/HelpDesk/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/HelpDesk/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/HelpDesk/ListView.php Fri Oct 20 06:14:25 2006
@@ -82,6 +82,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 if($viewid != 0)
 {
         $CActionDtls = $oCustomView->getCustomActionDetails($viewid);

Modified: vtigercrm/branches/5.0.2/modules/Invoice/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Invoice/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Invoice/ListView.php Fri Oct 20 06:14:25 2006
@@ -80,6 +80,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 if(isPermitted('Invoice','Delete','') == 'yes')
 {
 	$other_text['del'] = $app_strings[LBL_MASS_DELETE];

Modified: vtigercrm/branches/5.0.2/modules/Leads/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Leads/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Leads/ListView.php Fri Oct 20 06:14:25 2006
@@ -83,6 +83,7 @@
 $smarty->assign("CHANGE_STATUS",$change_status);
 
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 	
 
 

Modified: vtigercrm/branches/5.0.2/modules/Potentials/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Potentials/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Potentials/ListView.php Fri Oct 20 06:14:25 2006
@@ -108,7 +108,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
-
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 if(isPermitted('Potentials','Delete','') == 'yes')
 {
 	$other_text['del'] = $app_strings[LBL_MASS_DELETE];

Modified: vtigercrm/branches/5.0.2/modules/Products/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Products/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Products/ListView.php Fri Oct 20 06:14:25 2006
@@ -84,6 +84,7 @@
 //<<<<<customview>>>>>
 
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 if($viewnamedesc['viewname'] == 'All')
 {
 	$smarty->assign("ALL", 'All');

Modified: vtigercrm/branches/5.0.2/modules/Quotes/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Quotes/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/Quotes/ListView.php Fri Oct 20 06:14:25 2006
@@ -79,6 +79,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 
 if(isPermitted('Quotes','Delete','') == 'yes')
 {

Modified: vtigercrm/branches/5.0.2/modules/SalesOrder/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/SalesOrder/ListView.php (original)
+++ vtigercrm/branches/5.0.2/modules/SalesOrder/ListView.php Fri Oct 20 06:14:25 2006
@@ -79,6 +79,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 // Buttons and View options
 if(isPermitted('SalesOrder','Delete','') == 'yes')
 {

Modified: vtigercrm/branches/5.0.2/modules/Users/updateLeadDBStatus.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Users/updateLeadDBStatus.php (original)
+++ vtigercrm/branches/5.0.2/modules/Users/updateLeadDBStatus.php Fri Oct 20 06:14:25 2006
@@ -19,6 +19,19 @@
 $viewid = $_REQUEST['viewname'];
 $return_module = $_REQUEST['return_module'];
 $return_action = $_REQUEST['return_action'];
+$module_array = array (
+                          'Leads' => 'updateLeadGroupRelation',
+                          'Accounts' => 'updateAccountGroupRelation',
+                          'Contacts' => 'updateContactGroupRelation',
+                          'Potentials' => 'updatePotentialGroupRelation',
+                          'Quotes' => 'updateQuoteGroupRelation',
+                          'SalesOrder' => 'updateSoGroupRelation',
+                          'Invoice' => 'updateInvoiceGroupRelation',
+                          'PurchaseOrder' => 'updatePoGroupRelation',
+                          'HelpDesk' => 'updateTicketGroupRelation',
+                          'Campaigns' => 'updateCampaignGroupRelation',
+                          'Calendar' => 'updateActivityGroupRelation',
+                       );
 global $current_user;
 global $adb;
 $storearray = explode(";",trim($idlist,';'));
@@ -26,15 +39,26 @@
 $ids_list = array();
 
 $date_var = date('YmdHis');
-if(isset($_REQUEST['user_id']) && $_REQUEST['user_id']!='')
+
+if((isset($_REQUEST['user_id']) && $_REQUEST['user_id']!='') || ($_REQUEST['group_id'] != ''))
 {
 	foreach($storearray as $id)
 	{
 		if(isPermitted($return_module,'EditView',$id) == 'yes')
 		{
-			if($id != '') {
+			if($_REQUEST['user_id'] != '' && $id != '')
+			{
 				$sql = "update vtiger_crmentity set modifiedby=".$current_user->id.",smownerid='" .$idval ."', modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid='" .$id."'";
 				$result = $adb->query($sql);
+			}
+			else if($_REQUEST['group_id'] != '' && $id != '')
+			{
+				//CHANGE HERE -- Here we have to use the getGroupName function. But that function is not correct one because they have used this function to get the assigned group name for the entity - Mickie
+				$groupname = $adb->query_result($adb->query("select groupname from vtiger_groups where groupid=".$_REQUEST['group_id']),0,'groupname');
+				//This is to update the entity - group relation
+				$module_array[$return_module]($id,$groupname); 
+				//Now we have to set the smownerid as 0 
+				$adb->query("update vtiger_crmentity set smownerid=0 where crmid=$id");
 			}
 		}
 		else





More information about the vtigercrm-commits mailing list