[Vtigercrm-commits] [vtiger development] #4114: First row of reports for Lead by Source report are empty
vtiger development
vtiger-tickets at trac.vtiger.com
Fri Aug 10 06:38:27 EDT 2007
#4114: First row of reports for Lead by Source report are empty
-----------------------------+----------------------------------------------
Reporter: etienne.jodoin | Owner: etienne.jodoin
Type: defect | Status: new
Priority: unassigned | Milestone: 5.0.4
Component: vtigercrm | Version: 5.0.3
Resolution: | Keywords: reports, lead by source
-----------------------------+----------------------------------------------
Changes (by etienne.jodoin):
* owner: developer => etienne.jodoin
Comment:
The problem I have found is that it tries to compare a string with an
integer with the first row ($lastvalue=0 with the value of a field). In
php, if we compare a string with a numeric value, using "==" operator, it
converts the string to a number. See :
http://ch2.php.net/manual/en/language.operators.comparison.php. I solved
the problem using "===" operator.
So in file modules/Reports/ReportRun.php :
Around line 1742 in function GenerateReport, after:
{{{
$fld = $adb->field_name($result, $i);
if ($fld->name ==
"Potentials_Amount")
$fieldvalue =
convertFromMasterCurrency($custom_field_values[$i],$current_user->conv_rate);
else
$fieldvalue =
$custom_field_values[$i];
if($fieldvalue == "" )
{
$fieldvalue = "-";
}
else
if(stristr($fieldvalue,"|##|"))
{
$fieldvalue =
str_ireplace(' |##| ',', ',$fieldvalue);
}
else
if(stristr($fld->name, "_Date") || stristr($fld->name, "_Created_Time") ||
stristr($fld->name, "_Modified_Time")){
$fieldvalue =
getDisplayDate($fieldvalue);
}
}}}
Replace :
{{{
if(($lastvalue == $fieldvalue) && $this->reporttype == "summary")
{
if($this->reporttype == "summary")
{
$valtemplate .= "<td class='rptEmptyGrp'> </td>";
}else
{
$valtemplate .= "<td class='rptData'>".$fieldvalue."</td>";
}
}else if(($secondvalue ==
$fieldvalue) && $this->reporttype == "summary")
{
if($lastvalue ==
$newvalue)
{
$valtemplate .= "<td class='rptEmptyGrp'> </td>";
}else
{
$valtemplate .= "<td class='rptGrpHead'>".$fieldvalue."</td>";
}
}
else if(($thirdvalue ==
$fieldvalue) && $this->reporttype == "summary")
{
if($secondvalue ==
$snewvalue)
{
$valtemplate .= "<td class='rptEmptyGrp'> </td>";
}else
{
$valtemplate .= "<td class='rptGrpHead'>".$fieldvalue."</td>";
}
}
else
{
if($this->reporttype == "tabular")
{
$valtemplate .= "<td class='rptData'>".$fieldvalue."</td>";
}else
{
$valtemplate .= "<td class='rptGrpHead'>".$fieldvalue."</td>";
}
}
}}}
By :
{{{
//Etienne Jodoin modifications for report, we need to use operator === to
compare strings and numbers, otherwise if a value
//is numeric and another is a string, it will says
that both values are equal which is not true
if(($lastvalue === $fieldvalue) &&
$this->reporttype == "summary")
{
if($this->reporttype == "summary")
{
$valtemplate .= "<td class='rptEmptyGrp'> </td>";
}else
{
$valtemplate .= "<td class='rptData'>".$fieldvalue."</td>";
}
}else if(($secondvalue ===
$fieldvalue) && $this->reporttype == "summary")
{
if($lastvalue === $newvalue)
{
$valtemplate .= "<td class='rptEmptyGrp'> </td>";
}else
{
$valtemplate .= "<td class='rptGrpHead'>".$fieldvalue."</td>";
}
}
else if(($thirdvalue ===
$fieldvalue) && $this->reporttype == "summary")
{
if($secondvalue === $snewvalue)
{
$valtemplate .= "<td class='rptEmptyGrp'> </td>";
}else
{
$valtemplate .= "<td class='rptGrpHead'>".$fieldvalue."</td>";
}
}
else
{
if($this->reporttype == "tabular")
{
$valtemplate .= "<td class='rptData'>".$fieldvalue."</td>";
}else
{
$valtemplate .= "<td
class='rptGrpHead'>".$fieldvalue."</td>";
}
}
//END Etienne Jodoin modifications for reports
}}}
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/4114#comment:1>
vtiger development <http://trac.vtiger.com/>
vtigerCRM
More information about the vtigercrm-commits
mailing list