[Vtigercrm-commits] [vtiger development] #7376: Bugs Fixed
vtiger development
vtiger-tickets at trac.vtiger.com
Fri Mar 9 13:47:08 PST 2012
#7376: Bugs Fixed
------------------------+---------------------------------------------------
Reporter: caguilarp | Owner: developer
Type: defect | Status: new
Priority: unassigned | Milestone: 5.3.0
Component: vtigercrm | Version: 5.3.0
Severity: Medium | Keywords:
------------------------+---------------------------------------------------
Bug #1
Use Currency fields in Expression Fields
...... vtigercrm/modules/FieldFormulas/VTModuleExpressionsManager.inc
Before
function expressionFields($moduleName){
global $current_user;
$result = vtws_describe($moduleName, $current_user);
$fields = $result['fields'];
$arr = array();
foreach($fields as $field){
//Use the field name to figure out the custom
field
if(preg_match('/cf_\d+/', $field['name']) &&
in_array($field['type']['name'], array('text',
'string','integer', 'double'))
){
$arr[$field['name']] =
getTranslatedString($field['label'], $moduleName);
}
}
return $arr;
}
After
function expressionFields($moduleName){
global $current_user;
$result = vtws_describe($moduleName, $current_user);
$fields = $result['fields'];
$arr = array();
foreach($fields as $field){
//Use the field name to figure out the custom
field
if(preg_match('/cf_\d+/', $field['name']) &&
in_array($field['type']['name'], array('text',
'string','integer', 'double', 'currency'))
){
$arr[$field['name']] =
getTranslatedString($field['label'], $moduleName);
}
}
return $arr;
}
Bug #2
Use custom number fields, in total field on Custom Reports
...... vtigercrm/modules/Reports/Reports.php
Before
function sgetColumnstoTotalHTML($module)
{
//retreive the vtiger_tabid
global $adb;
global $log;
global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
$tabid = getTabid($module);
$escapedchars = Array('_SUM','_AVG','_MIN','_MAX');
$sparams = array($tabid);
if($is_admin == true || $profileGlobalPermission[1] == 0
|| $profileGlobalPermission[2] ==0)
{
$ssql = "select * from vtiger_field inner join
vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid where
vtiger_field.uitype != 50 and vtiger_field.tabid=? and
vtiger_field.displaytype in (1,2,3) and vtiger_field.presence in (0,2) ";
}
else
{
$profileList = getCurrentUserProfileList();
$ssql = "select * from vtiger_field inner join
vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid inner join
vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid
inner join vtiger_profile2field on
vtiger_profile2field.fieldid=vtiger_field.fieldid where
vtiger_field.uitype != 50 and vtiger_field.tabid=? and
vtiger_field.displaytype in (1,2,3) and vtiger_def_org_field.visible=0 and
vtiger_profile2field.visible=0 and vtiger_field.presence in (0,2)";
if (count($profileList) > 0) {
$ssql .= " and
vtiger_profile2field.profileid in (". generateQuestionMarks($profileList)
.")";
array_push($sparams, $profileList);
}
}
//Added to avoid display the Related fields (Account
name,Vandor name,product name, etc) in Report Calculations(SUM,AVG..)
switch($tabid)
{
case 2://Potentials
//ie. Campaign name will not displayed in
Potential's report calcullation
$ssql.= " and vtiger_field.fieldname not
in ('campaignid')";
break;
case 4://Contacts
$ssql.= " and vtiger_field.fieldname not
in ('account_id')";
case 6://Accounts
$ssql.= " and vtiger_field.fieldname not
in ('account_id')";
break;
case 9://Calandar
$ssql.= " and vtiger_field.fieldname not
in ('parent_id','contact_id')";
break;
case 13://Trouble tickets(HelpDesk)
$ssql.= " and vtiger_field.fieldname not
in ('parent_id','product_id')";
break;
case 14://Products
$ssql.= " and vtiger_field.fieldname not
in ('vendor_id','product_id','handler')";
break;
case 20://Quotes
$ssql.= " and vtiger_field.fieldname not
in ('potential_id','assigned_user_id1','account_id','currency_id')";
break;
case 21://Purchase Order
$ssql.= " and vtiger_field.fieldname not
in ('contact_id','vendor_id','currency_id')";
break;
case 22://SalesOrder
$ssql.= " and vtiger_field.fieldname not
in ('potential_id','account_id','contact_id','quote_id','currency_id')";
break;
case 23://Invoice
$ssql.= " and vtiger_field.fieldname not
in ('salesorder_id','contact_id','account_id','currency_id')";
break;
case 26://Campaigns
$ssql.= " and vtiger_field.fieldname not
in ('product_id')";
break;
}
$ssql.= " order by sequence";
$result = $adb->pquery($ssql, $sparams);
$columntototalrow = $adb->fetch_array($result);
$options_list = Array();
do
{
$typeofdata =
explode("~",$columntototalrow["typeofdata"]);
if($typeofdata[0] == "N" || $typeofdata[0] == "I")
{
$options = Array();
if(isset($this->columnssummary))
{
$selectedcolumn = "";
$selectedcolumn1 = "";
for($i=0;$i <
count($this->columnssummary) ;$i++)
{
$selectedcolumnarray =
explode(":",$this->columnssummary[$i]);
$selectedcolumn =
$selectedcolumnarray[1].":".$selectedcolumnarray[2].":".
str_replace($escapedchars,"",$selectedcolumnarray[3]);
if ($selectedcolumn !=
$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.str_replace("
","_",$columntototalrow['fieldlabel']))
{
$selectedcolumn =
"";
}else
{
$selectedcolumn1[$selectedcolumnarray[4]] = $this->columnssummary[$i];
}
}
if(isset($_REQUEST["record"]) &&
$_REQUEST["record"] != '')
{
$options['label'][] =
getTranslatedString($columntototalrow['tablabel'],$columntototalrow['tablabel']).'
-'.getTranslatedString($columntototalrow['fieldlabel'],$columntototalrow['tablabel']);
}
$columntototalrow['fieldlabel'] =
str_replace(" ","_",$columntototalrow['fieldlabel']);
$options []=
getTranslatedString($columntototalrow['tablabel'],$columntototalrow['tablabel']).'
-
'.getTranslatedString($columntototalrow['fieldlabel'],$columntototalrow['tablabel']);
if($selectedcolumn1[2] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_SUM:2")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2"
type="checkbox" value="">';
}
if($selectedcolumn1[3] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_AVG:3")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3"
type="checkbox" value="">';
}
if($selectedcolumn1[4] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MIN:4")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"
type="checkbox" value="">';
}
if($selectedcolumn1[5] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MAX:5")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5"
type="checkbox" value="">';
}
}else
{
$options []=
getTranslatedString($columntototalrow['tablabel'],$columntototalrow['tablabel']).'
-
'.getTranslatedString($columntototalrow['fieldlabel'],$columntototalrow['tablabel']);
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2"
type="checkbox" value="">';
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3"
type="checkbox" value="" >';
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"type="checkbox"
value="" >';
$options [] ='<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5"
type="checkbox" value="" >';
}
$options_list [] = $options;
}
}while($columntototalrow = $adb->fetch_array($result));
$log->info("Reports :: Successfully returned
sgetColumnstoTotalHTML");
return $options_list;
}
after
function sgetColumnstoTotalHTML($module)
{
//retreive the vtiger_tabid
global $adb;
global $log;
global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
$tabid = getTabid($module);
$escapedchars = Array('_SUM','_AVG','_MIN','_MAX');
$sparams = array($tabid);
if($is_admin == true || $profileGlobalPermission[1] == 0
|| $profileGlobalPermission[2] ==0)
{
$ssql = "select * from vtiger_field inner join
vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid where
vtiger_field.uitype != 50 and vtiger_field.tabid=? and
vtiger_field.displaytype in (1,2,3) and vtiger_field.presence in (0,2) ";
}
else
{
$profileList = getCurrentUserProfileList();
$ssql = "select * from vtiger_field inner join
vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid inner join
vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid
inner join vtiger_profile2field on
vtiger_profile2field.fieldid=vtiger_field.fieldid where
vtiger_field.uitype != 50 and vtiger_field.tabid=? and
vtiger_field.displaytype in (1,2,3) and vtiger_def_org_field.visible=0 and
vtiger_profile2field.visible=0 and vtiger_field.presence in (0,2)";
if (count($profileList) > 0) {
$ssql .= " and
vtiger_profile2field.profileid in (". generateQuestionMarks($profileList)
.")";
array_push($sparams, $profileList);
}
}
//Added to avoid display the Related fields (Account
name,Vandor name,product name, etc) in Report Calculations(SUM,AVG..)
switch($tabid)
{
case 2://Potentials
//ie. Campaign name will not displayed in
Potential's report calcullation
$ssql.= " and vtiger_field.fieldname not
in ('campaignid')";
break;
case 4://Contacts
$ssql.= " and vtiger_field.fieldname not
in ('account_id')";
case 6://Accounts
$ssql.= " and vtiger_field.fieldname not
in ('account_id')";
break;
case 9://Calandar
$ssql.= " and vtiger_field.fieldname not
in ('parent_id','contact_id')";
break;
case 13://Trouble tickets(HelpDesk)
$ssql.= " and vtiger_field.fieldname not
in ('parent_id','product_id')";
break;
case 14://Products
$ssql.= " and vtiger_field.fieldname not
in ('vendor_id','product_id','handler')";
break;
case 20://Quotes
$ssql.= " and vtiger_field.fieldname not
in ('potential_id','assigned_user_id1','account_id','currency_id')";
break;
case 21://Purchase Order
$ssql.= " and vtiger_field.fieldname not
in ('contact_id','vendor_id','currency_id')";
break;
case 22://SalesOrder
$ssql.= " and vtiger_field.fieldname not
in ('potential_id','account_id','contact_id','quote_id','currency_id')";
break;
case 23://Invoice
$ssql.= " and vtiger_field.fieldname not
in ('salesorder_id','contact_id','account_id','currency_id')";
break;
case 26://Campaigns
$ssql.= " and vtiger_field.fieldname not
in ('product_id')";
break;
}
$ssql.= " order by sequence";
$result = $adb->pquery($ssql, $sparams);
$columntototalrow = $adb->fetch_array($result);
$options_list = Array();
do
{
$typeofdata =
explode("~",$columntototalrow["typeofdata"]);
if($typeofdata[0] == "N" || $typeofdata[0] == "I"
|| $typeofdata[0] == "NN")
{
$options = Array();
if(isset($this->columnssummary))
{
$selectedcolumn = "";
$selectedcolumn1 = "";
for($i=0;$i <
count($this->columnssummary) ;$i++)
{
$selectedcolumnarray =
explode(":",$this->columnssummary[$i]);
$selectedcolumn =
$selectedcolumnarray[1].":".$selectedcolumnarray[2].":".
str_replace($escapedchars,"",$selectedcolumnarray[3]);
if ($selectedcolumn !=
$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.str_replace("
","_",$columntototalrow['fieldlabel']))
{
$selectedcolumn =
"";
}else
{
$selectedcolumn1[$selectedcolumnarray[4]] = $this->columnssummary[$i];
}
}
if(isset($_REQUEST["record"]) &&
$_REQUEST["record"] != '')
{
$options['label'][] =
getTranslatedString($columntototalrow['tablabel'],$columntototalrow['tablabel']).'
-'.getTranslatedString($columntototalrow['fieldlabel'],$columntototalrow['tablabel']);
}
$columntototalrow['fieldlabel'] =
str_replace(" ","_",$columntototalrow['fieldlabel']);
$options []=
getTranslatedString($columntototalrow['tablabel'],$columntototalrow['tablabel']).'
-
'.getTranslatedString($columntototalrow['fieldlabel'],$columntototalrow['tablabel']);
if($selectedcolumn1[2] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_SUM:2")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2"
type="checkbox" value="">';
}
if($selectedcolumn1[3] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_AVG:3")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3"
type="checkbox" value="">';
}
if($selectedcolumn1[4] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MIN:4")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"
type="checkbox" value="">';
}
if($selectedcolumn1[5] ==
"cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MAX:5")
{
$options []= '<input
checked
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5"
type="checkbox" value="">';
}else
{
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5"
type="checkbox" value="">';
}
}else
{
$options []=
getTranslatedString($columntototalrow['tablabel'],$columntototalrow['tablabel']).'
-
'.getTranslatedString($columntototalrow['fieldlabel'],$columntototalrow['tablabel']);
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2"
type="checkbox" value="">';
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3"
type="checkbox" value="" >';
$options []= '<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"type="checkbox"
value="" >';
$options [] ='<input
name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5"
type="checkbox" value="" >';
}
$options_list [] = $options;
}
}while($columntototalrow = $adb->fetch_array($result));
$log->info("Reports :: Successfully returned
sgetColumnstoTotalHTML");
return $options_list;
}
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7376>
vtiger development <http://trac.vtiger.com/>
vtiger CRM
More information about the vtigercrm-commits
mailing list