[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 3 /********************************************************************************* 4 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 5 * ("License"); You may not use this file except in compliance with the License 6 * The Original Code is: vtiger CRM Open Source 7 * The Initial Developer of the Original Code is vtiger. 8 * Portions created by vtiger are Copyright (C) vtiger. 9 * All Rights Reserved. 10 * 11 ********************************************************************************/ 12 13 require_once ('include/database/PearDatabase.php'); 14 require_once ('include/utils/utils.php'); 15 16 $idlist= $_REQUEST['idlist']; 17 $leadstatusval = $_REQUEST['leadval']; 18 $idval=$_REQUEST['user_id']; 19 $viewid = $_REQUEST['viewname']; 20 $return_module = $_REQUEST['return_module']; 21 $return_action = $_REQUEST['return_action']; 22 $module_array = array ( 23 'Leads' => 'updateLeadGroupRelation', 24 'Accounts' => 'updateAccountGroupRelation', 25 'Contacts' => 'updateContactGroupRelation', 26 'Potentials' => 'updatePotentialGroupRelation', 27 'Quotes' => 'updateQuoteGroupRelation', 28 'SalesOrder' => 'updateSoGroupRelation', 29 'Invoice' => 'updateInvoiceGroupRelation', 30 'PurchaseOrder' => 'updatePoGroupRelation', 31 'HelpDesk' => 'updateTicketGroupRelation', 32 'Campaigns' => 'updateCampaignGroupRelation', 33 'Calendar' => 'updateActivityGroupRelation', 34 ); 35 36 $deletegroup_array = array ( 37 'Leads'=>'vtiger_leadgrouprelation', 38 'Accounts'=>'vtiger_accountgrouprelation', 39 'Contacts'=>'vtiger_contactgrouprelation', 40 'Potentials'=>'vtiger_potentialgrouprelation', 41 'Quotes'=>'vtiger_quotegrouprelation', 42 'SalesOrder'=>'vtiger_sogrouprelation', 43 'Invoice'=>'vtiger_invoicegrouprelation', 44 'PurchaseOrder'=>'vtiger_pogrouprelation', 45 'HelpDesk'=>'vtiger_ticketgrouprelation', 46 'Campaigns'=>'vtiger_campaigngrouprelation', 47 'Calendar'=>'vtiger_activitygrouprelation', 48 ); 49 $tableId_array= array ( 50 'Leads'=>'leadid', 51 'Accounts'=>'accountid', 52 'Contacts'=>'contactid', 53 'Potentials'=>'potentialid', 54 'Quotes'=>'quoteid', 55 'SalesOrder'=>'salesorderid', 56 'Invoice'=>'invoiceid', 57 'PurchaseOrder'=>'purchaseorderid', 58 'HelpDesk'=>'ticketid', 59 'Campaigns'=>'campaignid', 60 'Calendar'=>'activityid', 61 ); 62 63 global $current_user; 64 global $adb; 65 $storearray = explode(";",trim($idlist,';')); 66 67 $ids_list = array(); 68 69 $date_var = date('YmdHis'); 70 71 if((isset($_REQUEST['user_id']) && $_REQUEST['user_id']!='') || ($_REQUEST['group_id'] != '')) 72 { 73 foreach($storearray as $id) 74 { 75 if(isPermitted($return_module,'EditView',$id) == 'yes') 76 { 77 if($_REQUEST['user_id'] != '' && $id != '') 78 { 79 //First we have to delete the group relationship 80 $delete_query = "delete from ". $deletegroup_array[$return_module] ." where " . $tableId_array[$return_module] . "='".$id."'"; 81 $result = $adb->query($delete_query); 82 83 //Now we have to update the smownerid 84 $sql = "update vtiger_crmentity set modifiedby=".$current_user->id.",smownerid='" .$idval ."', modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid='" .$id."'"; 85 $result = $adb->query($sql); 86 } 87 else if($_REQUEST['group_id'] != '' && $id != '') 88 { 89 //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 90 $groupname = $adb->query_result($adb->query("select groupname from vtiger_groups where groupid=".$_REQUEST['group_id']),0,'groupname'); 91 //This is to update the entity - group relation 92 $module_array[$return_module]($id,$groupname); 93 //Now we have to set the smownerid as 0 94 $adb->query("update vtiger_crmentity set smownerid=0 where crmid=$id"); 95 } 96 } 97 else 98 { 99 $ids_list[] = $id; 100 } 101 } 102 } 103 elseif(isset($_REQUEST['leadval']) && $_REQUEST['leadval']!='') 104 { 105 106 foreach($storearray as $id) 107 { 108 if(isPermitted($return_module,'EditView',$id) == 'yes') 109 { 110 if($id != '') { 111 $sql = "update vtiger_leaddetails set leadstatus='" .$leadstatusval ."' where leadid='" .$id."'"; 112 $result = $adb->query($sql); 113 $query = "update vtiger_crmentity set modifiedby=".$current_user->id.",modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$id; 114 $result1 = $adb->query($query); 115 } 116 } 117 else 118 { 119 $ids_list[] = $id; 120 } 121 122 } 123 } 124 if(count($ids_list) > 0) 125 { 126 $ret_owner = getEntityName($return_module,$ids_list); 127 $errormsg = implode(',',$ret_owner); 128 }else 129 { 130 $errormsg = ''; 131 } 132 133 if($return_action == 'ActivityAjax') 134 { 135 $view = $_REQUEST['view']; 136 $day = $_REQUEST['day']; 137 $month = $_REQUEST['month']; 138 $year = $_REQUEST['year']; 139 $type = $_REQUEST['type']; 140 $viewOption = $_REQUEST['viewOption']; 141 $subtab = $_REQUEST['subtab']; 142 header("Location: index.php?module=$return_module&action=".$return_action."&type=".$type."&view=".$view."&day=".$day."&month=".$month."&year=".$year."&viewOption=".$viewOption."&subtab=".$subtab); 143 } 144 else 145 { 146 header("Location: index.php?module=$return_module&action=".$return_module."Ajax&file=ListView&ajax=changestate&viewname=".$viewid."&errormsg=".$errormsg); 147 } 148 149 150 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |