[Svn-src-all:1352] [version-2_5-dev 20242] refs #1013

shutta admin @ mail.ec-cube.net
2011年 2月 20日 (日) 07:04:03 JST


Subversion committed to /home/svn/open 20242
http://svn.ec-cube.net/open_trac/changeset/20242
┌────────────────────────────┐
│更新者 :  shutta                                       │
│更新日時:  2011-02-20 07:04:03 +0900 (日, 20  2月 2011)│
└────────────────────────────┘

Log:
--------------------------------------------------------
refs #1013
年代別集計のPostgreSQLでのエラーを修正。
ただ、集計結果が、年代別ではなく年齢別になっちゃってる。


Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_5-dev/data/class/pages/admin/total/LC_Page_Admin_Total.php

変更: branches/version-2_5-dev/data/class/pages/admin/total/LC_Page_Admin_Total.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/total/LC_Page_Admin_Total.php	2011-02-19 21:51:07 UTC (rev 20241)
+++ branches/version-2_5-dev/data/class/pages/admin/total/LC_Page_Admin_Total.php	2011-02-19 22:04:03 UTC (rev 20242)
@@ -591,9 +591,17 @@
 
         list($where, $arrval) = $this->lfGetWhereMember('create_date', $sdate, $edate, $type);
 
-        // todo postgres
-        $col    = '
-            trunc((YEAR(create_date) - YEAR(order_birth)) - (RIGHT(create_date, 5) < RIGHT(order_birth, 5)), -1) as age,
+        if (DB_TYPE == 'pgsql') {
+            $col = '
+                EXTRACT(YEAR FROM AGE(create_date, order_birth)) AS age,
+                ';
+        } else {
+            $col = '
+                trunc((YEAR(create_date) - YEAR(order_birth)) - (RIGHT(create_date, 5) < RIGHT(order_birth, 5)), -1) as age,
+                ';
+        }
+
+        $col .= '
             COUNT(order_id) AS order_count,
             SUM(total) AS total,
             AVG(total) AS total_average




Svn-src-all メーリングリストの案内