[Vtigercrm-commits] [vtiger-commits] r4841 - in /vtigercrm/branches/4.2_postgresql_integration/modules/Reports: ReportRun.php Save.php SaveReportFolder.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Apr 3 13:41:08 EDT 2006
Author: allanbush
Date: Mon Apr 3 11:41:02 2006
New Revision: 4841
Log:
Various changes to get reports working with postgres. Refs #17.
Modified:
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/SaveReportFolder.php
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php Mon Apr 3 11:41:02 2006
@@ -93,15 +93,15 @@
{
if($this->primarymodule == "HelpDesk")
{
- $querycolumn = "case crmentityRelHelpDesk.setype when 'Accounts' then accountRelHelpDesk.accountname when 'Contacts' then contactdetailsRelHelpDesk.lastname End"." '".$selectedfields[2]."', crmentityRelHelpDesk.setype 'Entity_type'";
+ $querycolumn = "case crmentityRelHelpDesk.setype when 'Accounts' then accountRelHelpDesk.accountname when 'Contacts' then contactdetailsRelHelpDesk.lastname End"." AS \"".$selectedfields[2]."\", crmentityRelHelpDesk.setype AS Entity_type";
}
if($this->primarymodule == "Products" || $this->secondarymodule == "Products")
{
- $querycolumn = "case crmentityRelProducts.setype when 'Accounts' then accountRelProducts.accountname when 'Leads' then leaddetailsRelProducts.lastname when 'Potentials' then potentialRelProducts.potentialname End"." '".$selectedfields[2]."', crmentityRelProducts.setype 'Entity_type'";
+ $querycolumn = "case crmentityRelProducts.setype when 'Accounts' then accountRelProducts.accountname when 'Leads' then leaddetailsRelProducts.lastname when 'Potentials' then potentialRelProducts.potentialname End"." AS \"".$selectedfields[2]."\", crmentityRelProducts.setype AS Entity_type";
}
if($this->primarymodule == "Activities" || $this->secondarymodule == "Activities")
{
- $querycolumn = "case crmentityRelActivities.setype when 'Accounts' then accountRelActivities.accountname when 'Leads' then leaddetailsRelActivities.lastname when 'Potentials' then potentialRelActivities.potentialname when 'Quotes' then quotesRelActivities.subject when 'Orders' then purchaseorderRelActivities.subject when 'Invoice' then invoiceRelActivities.subject End"." '".$selectedfields[2]."', crmentityRelActivities.setype 'Entity_type'";
+ $querycolumn = "case crmentityRelActivities.setype when 'Accounts' then accountRelActivities.accountname when 'Leads' then leaddetailsRelActivities.lastname when 'Potentials' then potentialRelActivities.potentialname when 'Quotes' then quotesRelActivities.subject when 'Orders' then purchaseorderRelActivities.subject when 'Invoice' then invoiceRelActivities.subject End"." AS \"".$selectedfields[2]."\", crmentityRelActivities.setype AS Entity_type";
}
}
/*if($fieldname == "contact_id")
@@ -1471,19 +1471,19 @@
$fieldlist = explode(":",$fieldcolname);
if($fieldlist[4] == 2)
{
- $stdfilterlist[$fieldcolname] = "sum(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ $stdfilterlist[$fieldcolname] = "sum(".$fieldlist[1].".".$fieldlist[2].") AS ".$fieldlist[3];
}
if($fieldlist[4] == 3)
{
- $stdfilterlist[$fieldcolname] = "avg(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ $stdfilterlist[$fieldcolname] = "avg(".$fieldlist[1].".".$fieldlist[2].") AS ".$fieldlist[3];
}
if($fieldlist[4] == 4)
{
- $stdfilterlist[$fieldcolname] = "min(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ $stdfilterlist[$fieldcolname] = "min(".$fieldlist[1].".".$fieldlist[2].") AS ".$fieldlist[3];
}
if($fieldlist[4] == 5)
{
- $stdfilterlist[$fieldcolname] = "max(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ $stdfilterlist[$fieldcolname] = "max(".$fieldlist[1].".".$fieldlist[2].") AS ".$fieldlist[3];
}
}
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php Mon Apr 3 11:41:02 2006
@@ -36,10 +36,10 @@
//<<<<<<<reportmodules>>>>>>>>>
//<<<<<<<report>>>>>>>>>
-$reportname = $adb->database->qstr($_REQUEST["reportName"]);
-$reportdescription = $adb->database->qstr($_REQUEST["reportDesc"]);
-$reporttype = $adb->database->qstr($_REQUEST["reportType"]);
-$folderid = $adb->database->qstr($_REQUEST["folder"]);
+$reportname = $adb->quote($_REQUEST["reportName"]);
+$reportdescription = $adb->quote($_REQUEST["reportDesc"]);
+$reporttype = $adb->quote($_REQUEST["reportType"]);
+$folderid = $adb->quote($_REQUEST["folder"]);
//<<<<<<<report>>>>>>>>>
//<<<<<<<standarfilters>>>>>>>>>
@@ -214,9 +214,9 @@
}
$ireportsql = "update report set";
- $ireportsql .= " REPORTNAME='".$reportname."',";
- $ireportsql .= " DESCRIPTION='".$reportdescription."',";
- $ireportsql .= " REPORTTYPE='".$reporttype."'";
+ $ireportsql .= " REPORTNAME=".$reportname.",";
+ $ireportsql .= " DESCRIPTION=".$reportdescription.",";
+ $ireportsql .= " REPORTTYPE=".$reporttype."";
$ireportsql .= " where REPORTID=".$reportid;
$ireportresult = $adb->query($ireportsql);
$vtlog->logthis("Reports :: Save->Successfully saved report","info");
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/SaveReportFolder.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/SaveReportFolder.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/SaveReportFolder.php Mon Apr 3 11:41:02 2006
@@ -19,8 +19,8 @@
$rfid = $_REQUEST['record'];
$mode = $_REQUEST['mode'];
-$foldername = addslashes($_REQUEST["folderName"]);
-$folderdesc = addslashes($_REQUEST["folderDesc"]);
+$foldername = $adb->quote($_REQUEST["folderName"]);
+$folderdesc = $adb->quote($_REQUEST["folderDesc"]);
//echo $id.$mode."1".$foldername."2".$folderdesc;
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
@@ -32,9 +32,8 @@
{
if($rfid=="")
{
- $sql = "INSERT INTO reportfolder ";
- $sql .= "(FOLDERID,FOLDERNAME,DESCRIPTION,STATE) ";
- $sql .= "VALUES ('','".$foldername."','".$folderdesc."','CUSTOMIZED')";
+ $sql = "INSERT INTO reportfolder (foldername,description,state)
+ VALUES (".$foldername.",".$folderdesc.",'CUSTOMIZED')";
$result = $adb->query($sql);
if($result!=false)
{
@@ -53,8 +52,8 @@
if($rfid != "")
{
$sql = "update reportfolder set ";
- $sql .= "FOLDERNAME='".$foldername."', ";
- $sql .= "DESCRIPTION='".$folderdesc."' ";
+ $sql .= "FOLDERNAME=".$foldername.", ";
+ $sql .= "DESCRIPTION=".$folderdesc." ";
$sql .= "where folderid=".$rfid;
$result = $adb->query($sql);
if($result!=false)
More information about the vtigercrm-commits
mailing list