[Vtigercrm-commits] [vtiger-commits] r9907 - /vtigercrm/branches/5.0.3/data/CRMEntity.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Nov 27 06:51:50 EST 2006
Author: richie
Date: Mon Nov 27 04:51:39 2006
New Revision: 9907
Log:
The grouprelation code is made generic
Modified:
vtigercrm/branches/5.0.3/data/CRMEntity.php
Modified: vtigercrm/branches/5.0.3/data/CRMEntity.php
==============================================================================
--- vtigercrm/branches/5.0.3/data/CRMEntity.php (original)
+++ vtigercrm/branches/5.0.3/data/CRMEntity.php Mon Nov 27 04:51:39 2006
@@ -39,6 +39,8 @@
* Contributor(s): ______________________________________..
*/
+ var $ownedby;
+
function saveentity($module)
{
@@ -62,6 +64,12 @@
}
}
+ //Inserting into the group Table
+ if($this->ownedby == 0)
+ {
+ $this->insertIntoGroupTable($module);
+ }
+
//Calling the Module specific save code
$this->save_module($module);
@@ -229,12 +237,18 @@
{
$ownerid = $this->column_fields['assigned_user_id'];
}
-
- if($module == 'Products' || $module == 'Notes' || $module =='Faq' || $module == 'Vendors' || $module == 'PriceBooks')
+
+ $sql="select ownedby from vtiger_tab where name='".$module."'";
+ $res=$adb->query($sql);
+ $this->ownedby = $adb->query_result($res,0,'ownedby');
+
+ if($this->ownedby == 1)
{
$log->info("module is =".$module);
$ownerid = $current_user->id;
- }
+ }
+
+
if($module == 'Events')
{
$module = 'Calendar';
@@ -276,6 +290,12 @@
$sql1 = "insert into vtiger_ownernotify values(".$this->id.",".$ownerid.",null)";
$adb->query($sql1);
}
+
+
+
+
+
+
}
else
{
@@ -288,6 +308,9 @@
$adb->query($sql);
$this->id = $current_id;
}
+
+
+
}
@@ -510,168 +533,14 @@
$adb->query($sql1);
}
- //to disable the update of groupentity relation in ajax edit for the fields except assigned_user_id field
- if($_REQUEST['ajxaction'] != 'DETAILVIEW' || ($_REQUEST['ajxaction'] == 'DETAILVIEW' && $_REQUEST['fldName'] == 'assigned_user_id'))
- {
- if($_REQUEST['assigntype'] == 'T')
- {
- $groupname = $_REQUEST['assigned_group_name'];
- //echo 'about to update lead group relation';
- if($module == 'Leads' && $table_name == 'vtiger_leaddetails')
- {
- updateLeadGroupRelation($this->id,$groupname);
- }
- elseif($module == 'Accounts' && $table_name == 'vtiger_account')
- {
- updateAccountGroupRelation($this->id,$groupname);
- }
- elseif($module == 'Contacts' && $table_name == 'vtiger_contactdetails')
- {
- updateContactGroupRelation($this->id,$groupname);
- }
- elseif($module == 'Potentials' && $table_name == 'vtiger_potential')
- {
- updatePotentialGroupRelation($this->id,$groupname);
- }
- elseif($module == 'Quotes' && $table_name == 'vtiger_quotes')
- {
- updateQuoteGroupRelation($this->id,$groupname);
- }
- elseif($module == 'SalesOrder' && $table_name == 'vtiger_salesorder')
- {
- updateSoGroupRelation($this->id,$groupname);
- }
- elseif($module == 'Invoice' && $table_name == 'vtiger_invoice')
- {
- updateInvoiceGroupRelation($this->id,$groupname);
- }
- elseif($module == 'PurchaseOrder' && $table_name == 'vtiger_purchaseorder')
- {
- updatePoGroupRelation($this->id,$groupname);
- }
- elseif($module == 'HelpDesk' && $table_name == 'vtiger_troubletickets')
- {
- updateTicketGroupRelation($this->id,$groupname);
- }
- elseif($module == 'Campaigns' && $table_name == 'vtiger_campaign')
- {
- updateCampaignGroupRelation($this->id,$groupname);
- }
- elseif($module =='Calendar' || $module =='Events' || $module == 'Emails')
- {
- if($table_name == 'vtiger_activity')
- {
- updateActivityGroupRelation($this->id,$groupname);
- }
- }
-
-
- }
- else
- {
- //echo 'about to update lead group relation again!';
- if($module == 'Leads' && $table_name == 'vtiger_leaddetails')
- {
- updateLeadGroupRelation($this->id,'');
- }
- elseif($module == 'Accounts' && $table_name == 'vtiger_account')
- {
- updateAccountGroupRelation($this->id,'');
- }
- elseif($module == 'Contacts' && $table_name == 'vtiger_contactdetails')
- {
- updateContactGroupRelation($this->id,'');
- }
- elseif($module == 'Potentials' && $table_name == 'vtiger_potential')
- {
- updatePotentialGroupRelation($this->id,'');
- }
- elseif($module == 'Quotes' && $table_name == 'vtiger_quotes')
- {
- updateQuoteGroupRelation($this->id,'');
- }
- elseif($module == 'SalesOrder' && $table_name == 'vtiger_salesorder')
- {
- updateSoGroupRelation($this->id,'');
- }
- elseif($module == 'Invoice' && $table_name == 'vtiger_invoice')
- {
- updateInvoiceGroupRelation($this->id,'');
- }
- elseif($module == 'PurchaseOrder' && $table_name == 'vtiger_purchaseorder')
- {
- updatePoGroupRelation($this->id,'');
- }
- elseif($module == 'HelpDesk' && $table_name == 'vtiger_troubletickets')
- {
- updateTicketGroupRelation($this->id,'');
- }
- elseif($module == 'Campaigns' && $table_name == 'vtiger_campaign')
- {
- updateCampaignGroupRelation($this->id,$groupname);
- }
- elseif($module =='Calendar' || $module =='Events' || $module == 'Emails')
- {
- if($table_name == 'vtiger_activity')
- {
- updateActivityGroupRelation($this->id,$groupname);
- }
- }
-
-
- }
- }
+
}
else
- {
+ {
$sql1 = "insert into ".$table_name." (".$column.") values(".$value.")";
$adb->query($sql1);
- $groupname = $_REQUEST['assigned_group_name'];
- if($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_leaddetails')
- {
- insert2LeadGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_account')
- {
- insert2AccountGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_contactdetails')
- {
- insert2ContactGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_potential')
- {
- insert2PotentialGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_quotes')
- {
- insert2QuoteGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_salesorder')
- {
- insert2SoGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_invoice')
- {
- insert2InvoiceGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_purchaseorder')
- {
- insert2PoGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_activity')
- {
- insert2ActivityGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_troubletickets')
- {
- insert2TicketGroupRelation($this->id,$groupname);
- }
- elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_campaign')
- {
- insert2CampaignGroupRelation($this->id,$groupname);
- }
+
}
@@ -750,9 +619,10 @@
$fieldcolname = $adb->query_result($result1,$i,"columnname");
$tablename = $adb->query_result($result1,$i,"tablename");
$fieldname = $adb->query_result($result1,$i,"fieldname");
-
+
$fld_value = $adb->query_result($result[$tablename],0,$fieldcolname);
$this->column_fields[$fieldname] = $fld_value;
+
}
if($module == 'Users')
@@ -1020,6 +890,41 @@
$tracker->track_view($user_id, $current_module, $id, '');
}
+ function insertIntoGroupTable($module)
+ {
+ if($this->mode=='edit')
+ {
+
+ //to disable the update of groupentity relation in ajax edit for the fields except assigned_user_id field
+ if($_REQUEST['ajxaction'] != 'DETAILVIEW' || ($_REQUEST['ajxaction'] == 'DETAILVIEW' && $_REQUEST['fldName'] == 'assigned_user_id'))
+ {
+ if($_REQUEST['assigntype'] == 'T')
+ {
+ $groupname = $_REQUEST['assigned_group_name'];
+ updateModuleGroupRelation($module,$this->id,$groupname);
+
+ }
+ else
+ {
+ updateModuleGroupRelation($module,$this->id,'');
+
+ }
+ }
+ }
+ else
+ {
+
+
+ $groupname = $_REQUEST['assigned_group_name'];
+ if($_REQUEST['assigntype'] == 'T')
+ {
+ insertIntoGroupRelation($module,$this->id,$groupname);
+ }
+
+ }
+
+ }
+
}
More information about the vtigercrm-commits
mailing list