[Vtigercrm-commits] [vtiger-commits] r10083 - in /vtigercrm/branches/5.0.3/modules: Accounts/ Contacts/ Leads/ Potentials/ Vendors/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed Jan 17 05:24:34 EST 2007
Author: richie
Date: Wed Jan 17 03:24:22 2007
New Revision: 10083
Log:
* Modified to handle the products in relatedlists
Modified:
vtigercrm/branches/5.0.3/modules/Accounts/Accounts.php
vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php
vtigercrm/branches/5.0.3/modules/Contacts/Contacts.php
vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php
vtigercrm/branches/5.0.3/modules/Leads/Leads.php
vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php
vtigercrm/branches/5.0.3/modules/Potentials/Potentials.php
vtigercrm/branches/5.0.3/modules/Potentials/updateRelations.php
vtigercrm/branches/5.0.3/modules/Vendors/Vendors.php
vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php
Modified: vtigercrm/branches/5.0.3/modules/Accounts/Accounts.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Accounts/Accounts.php (original)
+++ vtigercrm/branches/5.0.3/modules/Accounts/Accounts.php Wed Jan 17 03:24:22 2007
@@ -639,14 +639,11 @@
vtiger_products.qty_per_unit, vtiger_products.unit_price,
vtiger_crmentity.crmid, vtiger_crmentity.smownerid
FROM vtiger_products
- INNER JOIN vtiger_seproductsrel
- ON vtiger_products.productid = vtiger_seproductsrel.productid
- INNER JOIN vtiger_crmentity
- ON vtiger_crmentity.crmid = vtiger_products.productid
- INNER JOIN vtiger_account
- ON vtiger_account.accountid = vtiger_seproductsrel.crmid
- WHERE vtiger_account.accountid = ".$id."
- AND vtiger_crmentity.deleted = 0";
+ INNER JOIN vtiger_seproductsrel ON vtiger_products.productid = vtiger_seproductsrel.productid and vtiger_seproductsrel.setype='Accounts'
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid
+ INNER JOIN vtiger_account ON vtiger_account.accountid = vtiger_seproductsrel.crmid
+ WHERE vtiger_crmentity.deleted = 0 AND vtiger_account.accountid = $id";
+
$log->debug("Exiting get_products method ...");
return GetRelatedList('Accounts','Products',$focus,$query,$button,$returnset);
}
Modified: vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php Wed Jan 17 03:24:22 2007
@@ -20,13 +20,13 @@
else
$action = "CallRelatedList";
-//save the relationship when we select Product from Lead RelatedList
+//save the relationship when we select Product from Account RelatedList
if($dest_mod == 'Products')
{
$accountid = $_REQUEST['parid'];
$productid = $_REQUEST['entityid'];
if($accountid != '' && $productid != '')
- $adb->query("insert into vtiger_seproductsrel values($accountid,$productid,'".$dest_mod."')");
+ $adb->query("insert into vtiger_seproductsrel values($accountid,$productid,'Accounts')");
$record = $accountid;
}
Modified: vtigercrm/branches/5.0.3/modules/Contacts/Contacts.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Contacts/Contacts.php (original)
+++ vtigercrm/branches/5.0.3/modules/Contacts/Contacts.php Wed Jan 17 03:24:22 2007
@@ -550,7 +550,18 @@
else
$returnset = '&return_module=Contacts&return_action=CallRelatedList&return_id='.$id;
- $query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid,vtiger_contactdetails.lastname from vtiger_products inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid left outer join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_products.contactid where vtiger_contactdetails.contactid = '.$id.' and vtiger_crmentity.deleted = 0';
+ $query = 'SELECT vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode,
+ vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price,
+ vtiger_crmentity.crmid, vtiger_crmentity.smownerid,vtiger_contactdetails.lastname
+ FROM vtiger_products
+ INNER JOIN vtiger_seproductsrel
+ ON vtiger_seproductsrel.productid=vtiger_products.productid and vtiger_seproductsrel.setype="Contacts"
+ INNER JOIN vtiger_crmentity
+ ON vtiger_crmentity.crmid = vtiger_products.productid
+ INNER JOIN vtiger_contactdetails
+ ON vtiger_contactdetails.contactid = vtiger_seproductsrel.crmid
+ WHERE vtiger_contactdetails.contactid = '.$id.' and vtiger_crmentity.deleted = 0';
+
$log->debug("Exiting get_products method ...");
return GetRelatedList('Contacts','Products',$focus,$query,$button,$returnset);
}
Modified: vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php Wed Jan 17 03:24:22 2007
@@ -27,7 +27,7 @@
$contactid = $_REQUEST['parid'];
$productid = $_REQUEST['entityid'];
if($contactid != '' && $productid != '')
- $adb->query("insert into vtiger_seproductsrel values ($contactid,$productid,'".$dest_mod."')");
+ $adb->query("insert into vtiger_seproductsrel values ($contactid,$productid,'Contacts')");
$record = $contactid;
}
Modified: vtigercrm/branches/5.0.3/modules/Leads/Leads.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Leads/Leads.php (original)
+++ vtigercrm/branches/5.0.3/modules/Leads/Leads.php Wed Jan 17 03:24:22 2007
@@ -380,7 +380,15 @@
else
$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
- $query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid from vtiger_products inner join vtiger_seproductsrel on vtiger_products.productid = vtiger_seproductsrel.productid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid inner join vtiger_leaddetails on vtiger_leaddetails.leadid = vtiger_seproductsrel.crmid where vtiger_leaddetails.leadid = '.$id.' and vtiger_crmentity.deleted = 0';
+ $query = "SELECT vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode,
+ vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price,
+ vtiger_crmentity.crmid, vtiger_crmentity.smownerid
+ FROM vtiger_products
+ INNER JOIN vtiger_seproductsrel ON vtiger_products.productid = vtiger_seproductsrel.productid and vtiger_seproductsrel.setype = 'Leads'
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid
+ INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_seproductsrel.crmid
+ WHERE vtiger_crmentity.deleted = 0 AND vtiger_leaddetails.leadid = $id";
+
$log->debug("Exiting get_products method ...");
return GetRelatedList('Leads','Products',$focus,$query,$button,$returnset);
}
Modified: vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php Wed Jan 17 03:24:22 2007
@@ -27,7 +27,7 @@
$leadid = $_REQUEST['parid'];
$productid = $_REQUEST['entityid'];
if($leadid != '' && $productid != '')
- $adb->query("insert into vtiger_seproductsrel values($leadid,$productid,'".$dest_mod."')");
+ $adb->query("insert into vtiger_seproductsrel values($leadid,$productid,'Leads')");
$record = $leadid;
}
Modified: vtigercrm/branches/5.0.3/modules/Potentials/Potentials.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Potentials/Potentials.php (original)
+++ vtigercrm/branches/5.0.3/modules/Potentials/Potentials.php Wed Jan 17 03:24:22 2007
@@ -316,7 +316,15 @@
else
$returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id;
- $query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid from vtiger_products inner join vtiger_seproductsrel on vtiger_products.productid = vtiger_seproductsrel.productid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid inner join vtiger_potential on vtiger_potential.potentialid = vtiger_seproductsrel.crmid where vtiger_potential.potentialid = '.$id.' and vtiger_crmentity.deleted = 0';
+ $query = "SELECT vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode,
+ vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price,
+ vtiger_crmentity.crmid, vtiger_crmentity.smownerid
+ FROM vtiger_products
+ INNER JOIN vtiger_seproductsrel ON vtiger_products.productid = vtiger_seproductsrel.productid and vtiger_seproductsrel.setype = 'Potentials'
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid
+ INNER JOIN vtiger_potential ON vtiger_potential.potentialid = vtiger_seproductsrel.crmid
+ WHERE vtiger_crmentity.deleted = 0 AND vtiger_potential.potentialid = $id";
+
$log->debug("Exiting get_products method ...");
return GetRelatedList('Potentials','Products',$focus,$query,$button,$returnset);
}
Modified: vtigercrm/branches/5.0.3/modules/Potentials/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Potentials/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Potentials/updateRelations.php Wed Jan 17 03:24:22 2007
@@ -30,7 +30,7 @@
{
$sql = "insert into vtiger_contpotentialrel values (".$id.",".$_REQUEST["parentid"] .")";
$adb->query($sql);
- $sql = "insert into vtiger_seproductsrel values (". $_REQUEST["parentid"] .",".$id.",'".$dest_mod."')";
+ $sql = "insert into vtiger_seproductsrel values (". $_REQUEST["parentid"] .",".$id.",'Potentials')";
$adb->query($sql);
}
}
@@ -41,7 +41,7 @@
{
$sql = "insert into vtiger_contpotentialrel values (". $_REQUEST["entityid"] .",".$_REQUEST["parid"] .")";
$adb->query($sql);
- $sql = "insert into vtiger_seproductsrel values (". $_REQUEST["parid"] .",".$_REQUEST["entityid"] .",'".$dest_mod."')";
+ $sql = "insert into vtiger_seproductsrel values (". $_REQUEST["parid"] .",".$_REQUEST["entityid"] .",'Potentials')";
$adb->query($sql);
header("Location: index.php?action=$action&module=Potentials&record=".$_REQUEST["parid"]);
Modified: vtigercrm/branches/5.0.3/modules/Vendors/Vendors.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Vendors/Vendors.php (original)
+++ vtigercrm/branches/5.0.3/modules/Vendors/Vendors.php Wed Jan 17 03:24:22 2007
@@ -89,7 +89,14 @@
else
$returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id;
- $query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid,vtiger_vendor.vendorname from vtiger_products inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid left outer join vtiger_vendor on vtiger_vendor.vendorid = vtiger_products.vendor_id where vtiger_vendor.vendorid = '.$id.' and vtiger_crmentity.deleted = 0';
+ $query = "SELECT vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode,
+ vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price,
+ vtiger_crmentity.crmid, vtiger_crmentity.smownerid,vtiger_vendor.vendorname
+ FROM vtiger_products
+ INNER JOIN vtiger_vendor ON vtiger_vendor.vendorid = vtiger_products.vendor_id
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid
+ WHERE vtiger_crmentity.deleted = 0 AND vtiger_vendor.vendorid = $id";
+
$log->debug("Exiting get_products method ...");
return GetRelatedList('Vendors','Products',$focus,$query,$button,$returnset);
}
Modified: vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php Wed Jan 17 03:24:22 2007
@@ -33,33 +33,31 @@
}
}
-if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
+//select contact from vendor relatedlist
+if($_REQUEST['destination_module']=='Contacts')
{
- //split the string and store in an array
- $storearray = explode (";",$idlist);
- foreach($storearray as $id)
+ if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
{
- if($id != '')
+ $record = $_REQUEST["parentid"];
+
+ //split the string and store in an array
+ $storearray = explode (";",$idlist);
+ foreach($storearray as $id)
{
- $sql = "insert into vtiger_vendorcontactrel values (".$_REQUEST["parentid"].",".$id.")";
- $adb->query($sql);
- $sql = "insert into vtiger_seproductsrel values (". $_REQUEST["parentid"] .",".$id.",'".$dest_mod."')";
- $adb->query($sql);
+ if($id != '')
+ {
+ $sql = "insert into vtiger_vendorcontactrel values (".$record.",".$id.")";
+ $adb->query($sql);
+ }
}
}
-
- $record = $_REQUEST["parentid"];
-}
+ elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '')
+ {
+ $record = $_REQUEST["parid"];
-elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '')
-{
-
- $sql = "insert into vtiger_vendorcontactrel values (".$_REQUEST['parid'].",".$_REQUEST['entityid'].")";
+ $sql = "insert into vtiger_vendorcontactrel values (".$record.",".$_REQUEST['entityid'].")";
$adb->query($sql);
- $sql = "insert into vtiger_seproductsrel values (". $_REQUEST["parid"] .",".$_REQUEST["entityid"] .",'".$dest_mod."')";
- $adb->query($sql);
-
- $record = $_REQUEST["parid"];
+ }
}
More information about the vtigercrm-commits
mailing list