[Vtigercrm-commits] [vtiger-commits] r4825 - in /vtigercrm/branches/4.2_postgresql_integration: include/database/PearDatabase.php modules/Products/Product.php sendreminder.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Mar 31 20:40:58 EST 2006
Author: allanbush
Date: Fri Mar 31 18:40:54 2006
New Revision: 4825
Log:
Modified getDBDateString function to be a wrapper for adodb's SQLDate function with a default formatting and used it where needed to replace DATE_FORMAT. Closes #75.
Modified:
vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php
vtigercrm/branches/4.2_postgresql_integration/sendreminder.php
Modified: vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php Fri Mar 31 18:40:54 2006
@@ -930,11 +930,11 @@
return $date;
}
-function getDBDateString($datecolname)
+function getDBDateString($datecolname, $format='Y-m-d, H:i:s')
{
$this->checkConnection();
$db = &$this->database;
- $datestr = $db->SQLDate("Y-m-d, H:i:s" ,$datecolname);
+ $datestr = $db->SQLDate($format ,$datecolname);
return $datestr;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php Fri Mar 31 18:40:54 2006
@@ -215,27 +215,29 @@
function create_export_query(&$order_by, &$where)
{
+ global $adb;
+
if($this->checkIfCustomTableExists())
{
$query = $this->constructCustomQueryAddendum() .
",
products.productid productid,
- products.productname productname,
- products.productcode productcode,
- products.productcategory productcategory,
- products.manufacturer manufacturer,
- products.product_description product_description,
- products.qty_per_unit qty_per_unit,
- products.unit_price unit_price,
- products.weight weight,
- products.pack_size pack_size,
- DATE_FORMAT(products.start_date, '%Y-%M-%D') AS start_date,
- DATE_FORMAT(products.expiry_date, '%Y-%M-%D') AS expiry_date,
- products.cost_factor cost_factor,
- products.commissionrate commissionrate,
- products.commissionmethod commissionmethod,
- products.discontinued discontinued,
+ products.productname AS productname,
+ products.productcode AS productcode,
+ products.productcategory AS productcategory,
+ products.manufacturer AS manufacturer,
+ products.product_description AS product_description,
+ products.qty_per_unit AS qty_per_unit,
+ products.unit_price AS unit_price,
+ products.weight AS weight,
+ products.pack_size AS pack_size, "
+ .$adb->getDBDateString('products.start_date', 'Y-M-D')." AS start_date, "
+ .$adb->getDBDateString('products.expiry_date', 'Y-M-D')." AS expiry_date,
+ products.cost_factor AS cost_factor,
+ products.commissionrate AS commissionrate,
+ products.commissionmethod AS commissionmethod,
+ products.discontinued AS discontinued,
products.sales_start_date AS sales_start_date,
products.sales_end_date AS sales_end_date,
products.usageunit AS usageunit,
@@ -260,22 +262,22 @@
else
{
$query = "SELECT
- products.productid productid,
- products.productname productname,
- products.productcode productcode,
- products.productcategory productcategory,
- products.manufacturer manufacturer,
- products.product_description product_description,
- products.qty_per_unit qty_per_unit,
- products.unit_price unit_price,
- products.weight weight,
- products.pack_size pack_size,
- DATE_FORMAT(products.start_date, '%Y-%M-%D') AS start_date,
- DATE_FORMAT(products.expiry_date, '%Y-%M-%D') AS expiry_date,
- products.cost_factor cost_factor,
- products.commissionrate commissionrate,
- products.commissionmethod commissionmethod,
- products.discontinued discontinued,
+ products.productid AS productid,
+ products.productname AS productname,
+ products.productcode AS productcode,
+ products.productcategory AS productcategory,
+ products.manufacturer AS manufacturer,
+ products.product_description AS product_description,
+ products.qty_per_unit AS qty_per_unit,
+ products.unit_price AS unit_price,
+ products.weight AS weight,
+ products.pack_size AS pack_size, "
+ .$adb->getDBDateString('products.start_date', 'Y-M-D')." AS start_date, "
+ .$adb->getDBDateString('products.expiry_date', 'Y-M-D')." AS expiry_date,
+ products.cost_factor AS cost_factor,
+ products.commissionrate AS commissionrate,
+ products.commissionmethod AS commissionmethod,
+ products.discontinued AS discontinued,
products.sales_start_date AS sales_start_date,
products.sales_end_date AS sales_end_date,
products.usageunit AS usageunit,
Modified: vtigercrm/branches/4.2_postgresql_integration/sendreminder.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/sendreminder.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/sendreminder.php Fri Mar 31 18:40:54 2006
@@ -33,7 +33,7 @@
$vtlog->logthis(" invoked sendreminder ",'debug');
//modified query for recurring events -Jag
- $query="select crmentity.crmid,activity.*,activity_reminder.reminder_time,activity_reminder.reminder_sent,activity_reminder.recurringid,recurringevents.recurringdate from activity inner join crmentity on crmentity.crmid=activity.activityid inner join activity_reminder on activity.activityid=activity_reminder.activity_id left outer join recurringevents on activity.activityid=recurringevents.activityid where DATE_FORMAT(activity.date_start,'%Y-%m-%d, %H:%i:%s') >= '".date('Y-m-d')."' and crmentity.crmid != 0 and activity.eventstatus = 'Planned' and activity_reminder.reminder_sent = 0 group by activity.activityid,recurringevents.recurringid ;";
+$query="select crmentity.crmid,activity.*,activity_reminder.reminder_time,activity_reminder.reminder_sent,activity_reminder.recurringid,recurringevents.recurringdate from activity inner join crmentity on crmentity.crmid=activity.activityid inner join activity_reminder on activity.activityid=activity_reminder.activity_id left outer join recurringevents on activity.activityid=recurringevents.activityid where ".$adb->getDBDateString('activity.date_start', 'Y-m-d, H:i:s')." >= '".date('Y-m-d')."' and crmentity.crmid != 0 and activity.eventstatus = 'Planned' and activity_reminder.reminder_sent = 0 group by activity.activityid,recurringevents.recurringid ;";
$result = $adb->query($query);
More information about the vtigercrm-commits
mailing list