[Vtigercrm-commits] [vtiger-commits] r7964 - /branches/VTIGERCRM-5.0.2-MMBRICH/modules/Campaigns/Campaign.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed Jul 12 05:58:40 EDT 2006
Author: mmbrich
Date: Wed Jul 12 03:58:39 2006
New Revision: 7964
Log:
more API usability issues
Modified:
branches/VTIGERCRM-5.0.2-MMBRICH/modules/Campaigns/Campaign.php
Modified: branches/VTIGERCRM-5.0.2-MMBRICH/modules/Campaigns/Campaign.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/modules/Campaigns/Campaign.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/modules/Campaigns/Campaign.php Wed Jul 12 03:58:39 2006
@@ -86,33 +86,6 @@
$log->debug("Exiting get_contacts method ...");
return GetRelatedList('Campaigns','Contacts',$focus,$query,$button,$returnset);
}
- function get_related_contacts_query($id) {
- global $log;
- $log->debug("Entering get_contacts_query(".$id.") method ...");
-
- $query = "SELECT vtiger_contactdetails.accountid"
- ." ,vtiger_users.user_name,vtiger_groups.groupname"
- ." ,vtiger_contactdetails.contactid, vtiger_contactdetails.lastname"
- ." ,vtiger_contactdetails.firstname, vtiger_contactdetails.title"
- ." ,vtiger_contactdetails.department, vtiger_contactdetails.email"
- ." ,vtiger_contactdetails.phone, vtiger_crmentity.crmid"
- ." ,vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime"
- ." FROM vtiger_contactdetails"
- ." INNER JOIN vtiger_campaigncontrel"
- ." ON vtiger_campaigncontrel.contactid=vtiger_contactdetails.contactid"
- ." INNER JOIN vtiger_crmentity"
- ." ON vtiger_crmentity.crmid=vtiger_contactdetails.contactid"
- ." LEFT JOIN vtiger_contactgrouprelation"
- ." ON vtiger_contactdetails.contactid=vtiger_contactgrouprelation.contactid"
- ." LEFT JOIN vtiger_groups"
- ." ON vtiger_groups.groupname=vtiger_contactgrouprelation.groupname"
- ." LEFT JOIN vtiger_users"
- ." ON vtiger_crmentity.smownerid=vtiger_users.id"
- ." WHERE vtiger_campaigncontrel.campaignid='".$id."' AND vtiger_crmentity.deleted='0'"
- ;
-
- return $query;
- }
function get_leads($id)
{
global $log;
@@ -127,32 +100,27 @@
$query = $this->get_related_leads_query($id);
return GetRelatedList('Campaigns','Leads',$focus,$query,$button,$returnset);
}
- function get_related_leads_query($id) {
- global $log;
- $log->debug("Entering get_leads_query(".$id.") method ...");
-
- $query = "SELECT vtiger_leaddetails.*, vtiger_crmentity.crmid, vtiger_users.user_name"
- ." ,vtiger_groups.groupname, vtiger_crmentity.smownerid"
- ." FROM vtiger_leaddetails"
- ." INNER JOIN vtiger_campaignleadrel"
- ." ON vtiger_campaignleadrel.leadid=vtiger_leaddetails.leadid"
- ." INNER JOIN vtiger_crmentity"
- ." ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid"
- ." LEFT JOIN vtiger_users"
- ." ON vtiger_crmentity.smownerid=vtiger_users.id"
- ." LEFT JOIN vtiger_leadgrouprelation"
- ." ON vtiger_leaddetails.leadid=vtiger_leadgrouprelation.leadid"
- ." LEFT JOIN vtiger_groups"
- ." ON vtiger_groups.groupname=vtiger_leadgrouprelation.groupname"
- ." WHERE vtiger_crmentity.deleted='0' AND vtiger_campaignleadrel.campaignid='".$id."'"
- ;
-
- $log->debug("Exiting get_leads method ...");
- return $query;
- }
+ function get_opportunities($id)
+ {
+ global $log;
+ $log->debug("Entering get_opportunities(".$id.") method ...");
+ global $mod_strings;
+
+ $focus = new Potential();
+
+ $button = '';
+ $returnset = '&return_module=Campaigns&return_action=CallRelatedList&return_id='.$id;
+
+ $query = $this->get_related_opportunities_query($id);
+ if($this->column_fields['account_id'] != 0)
+ $log->debug("Exiting get_opportunities method ...");
+ return GetRelatedList('Campaigns','Potentials',$focus,$query,$button,$returnset);
+
+ }
+
/*
* @param integer - id of campaign to retrieve list from
- * @return array - array of all contacts and leads from the get_related_[leads,contacts]_query function
+ * @return array - array of all db rows from the get_related_[leads,contacts]_query function
*
*/
function get_related_entities($id) {
@@ -179,22 +147,63 @@
function get_related_oportunities($id) {
}
- function get_opportunities($id)
- {
- global $log;
- $log->debug("Entering get_opportunities(".$id.") method ...");
- global $mod_strings;
-
- $focus = new Potential();
-
- $button = '';
- $returnset = '&return_module=Campaigns&return_action=CallRelatedList&return_id='.$id;
-
- $query = $this->get_related_opportunities_query($id);
- if($this->column_fields['account_id'] != 0)
- $log->debug("Exiting get_opportunities method ...");
- return GetRelatedList('Campaigns','Potentials',$focus,$query,$button,$returnset);
-
+ function get_related_leads_query($id) {
+ global $log;
+ $log->debug("Entering get_leads_query(".$id.") method ...");
+
+ $query = "SELECT vtiger_leaddetails.*, vtiger_crmentity.crmid, vtiger_users.user_name"
+ ." ,vtiger_groups.groupname, vtiger_crmentity.smownerid"
+ ." ,vtiger_leadaddress.*, vtiger_leadsubdetails.*"
+ ." FROM vtiger_leaddetails"
+ ." INNER JOIN vtiger_leadaddress"
+ ." ON vtiger_leadaddress.leadaddressid=vtiger_leaddetails.leadid"
+ ." INNER JOIN vtiger_leadsubdetails"
+ ." ON vtiger_leadsubdetails.leadsubscriptionid=vtiger_leaddetails.leadid"
+ ." INNER JOIN vtiger_campaignleadrel"
+ ." ON vtiger_campaignleadrel.leadid=vtiger_leaddetails.leadid"
+ ." INNER JOIN vtiger_crmentity"
+ ." ON vtiger_crmentity.crmid=vtiger_leaddetails.leadid"
+ ." LEFT JOIN vtiger_users"
+ ." ON vtiger_crmentity.smownerid=vtiger_users.id"
+ ." LEFT JOIN vtiger_leadgrouprelation"
+ ." ON vtiger_leaddetails.leadid=vtiger_leadgrouprelation.leadid"
+ ." LEFT JOIN vtiger_groups"
+ ." ON vtiger_groups.groupname=vtiger_leadgrouprelation.groupname"
+ ." WHERE vtiger_crmentity.deleted='0' AND vtiger_campaignleadrel.campaignid='".$id."'"
+ ." GROUP BY vtiger_leaddetails.leadid"
+ ;
+
+ $log->debug("Exiting get_leads method ...");
+ return $query;
+ }
+ function get_related_contacts_query($id) {
+ global $log;
+ $log->debug("Entering get_contacts_query(".$id.") method ...");
+
+ $query = "SELECT vtiger_contactdetails.*, vtiger_contactsubdetails.*, vtiger_contactaddress.*"
+ ." ,vtiger_users.user_name,vtiger_groups.groupname"
+ ." ,vtiger_crmentity.crmid"
+ ." ,vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime"
+ ." FROM vtiger_contactdetails"
+ ." INNER JOIN vtiger_contactaddress"
+ ." ON vtiger_contactaddress.contactaddressid=vtiger_contactdetails.contactid"
+ ." INNER JOIN vtiger_contactsubdetails"
+ ." ON vtiger_contactsubdetails.contactsubscriptionid=vtiger_contactdetails.contactid"
+ ." INNER JOIN vtiger_campaigncontrel"
+ ." ON vtiger_campaigncontrel.contactid=vtiger_contactdetails.contactid"
+ ." INNER JOIN vtiger_crmentity"
+ ." ON vtiger_crmentity.crmid=vtiger_contactdetails.contactid"
+ ." LEFT JOIN vtiger_contactgrouprelation"
+ ." ON vtiger_contactdetails.contactid=vtiger_contactgrouprelation.contactid"
+ ." LEFT JOIN vtiger_groups"
+ ." ON vtiger_groups.groupname=vtiger_contactgrouprelation.groupname"
+ ." LEFT JOIN vtiger_users"
+ ." ON vtiger_crmentity.smownerid=vtiger_users.id"
+ ." WHERE vtiger_campaigncontrel.campaignid='".$id."' AND vtiger_crmentity.deleted='0'"
+ ." GROUP BY vtiger_contactdetails.contactid"
+ ;
+
+ return $query;
}
function get_related_opportunities_query($id) {
global $log;
More information about the vtigercrm-commits
mailing list