[Vtigercrm-developers] WHERE to change campaignid to campaignname in report

Torsten Zenk tzenk at gmx.net
Fri Apr 13 05:22:05 PDT 2007


Hi all,
in a report "Campaigns by Potentials" including sales stage possibility 
and Amount i try to change the output of that report. i wanna change 
Campaign (which gives me the ID) to Campaignname (which would give me 
the real Name ) because i don´t recognize which campaign a report shows 
when i only get the ID (542 for example). What i do:
1.Create a report in the settings choosing Potentials >>> Relative 
Module (i leave None here, if i could chosse campaigns here, everything 
would be great, as the campaignmodul lets me choose campaignname, but 
the campaign and the Potentials have no connection in the report 
creation process) >>>tableformat>>>Potential, Amount, Salesstage, 
Possibility and Campaign>>>6x sum >>>no filters, leave it as is>>> 
generate Report.
2. This Report gives me the CampaignID althoug it should show the 
campaignname if i understand the code below right:

In the table vtiger_campaign i found the field "campaignname" which 
holds the name and field "campaignID" which holds the id.

In include/Utils/CommonUtils.php around line 499 i found this code:
++++++++++++++++++++++++++++++++++++++++++++++++++
/**
 * Function to get the Campaign Name when a campaign id is given
 * Takes the input as $campaign_id - campaign id
 * returns the Campaign Name in string format.
 */

function getCampaignName($campaign_id)
{
    global $log;
    $log->debug("Entering getCampaignName(".$campaign_id.") method ...");
    $log->info("in getCampaignName ".$campaign_id);

    global $adb;
    $sql = "select * from vtiger_campaign where campaignid=".$campaign_id;
    $result = $adb->query($sql);
    $campaign_name = $adb->query_result($result,0,"campaignname");
    $log->debug("Exiting getCampaignName method ...");
    return $campaign_name;
}
++++++++++++++++++++++++++++++++++++++++++++++++++

So isn´t this code there returning the campaign_name ?

I guess i have to change the query where the campaignid is returned to 
campaignname, that would do, but i can´t find the place WHERE to do 
this. Does anybody have a clue?

Thx in advance

Torsten Zenk



More information about the vtigercrm-developers mailing list