Index: /branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order.php
===================================================================
--- /branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order.php	(revision 22567)
+++ /branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order.php	(revision 22739)
@@ -440,8 +440,4 @@
     function doOutputCSV($where, $arrVal, $order)
     {
-        if ($where != '') {
-            $where = " WHERE $where ";
-        }
-
         $objCSV = new SC_Helper_CSV_Ex();
         $objCSV->sfDownloadCsv('3', $where, $arrVal, $order, true);
Index: /branches/version-2_13-dev/data/class/pages/admin/customer/LC_Page_Admin_Customer.php
===================================================================
--- /branches/version-2_13-dev/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 22569)
+++ /branches/version-2_13-dev/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 22739)
@@ -230,7 +230,8 @@
     {
         $objSelect = new SC_CustomerList_Ex($arrParam, 'customer');
+        $objCSV = new SC_Helper_CSV_Ex();
+
         $order = 'update_date DESC, customer_id DESC';
 
-        $objCSV = new SC_Helper_CSV_Ex();
         list($where, $arrVal) = $objSelect->getWhere();
         return $objCSV->sfDownloadCsv('2', $where, $arrVal, $order, true);
Index: /branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Review.php
===================================================================
--- /branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Review.php	(revision 22567)
+++ /branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Review.php	(revision 22739)
@@ -250,7 +250,4 @@
     {
         $objCSV = new SC_Helper_CSV_Ex();
-        if ($where != '') {
-            $where = 'WHERE ' . $where;
-        }
         $objCSV->sfDownloadCsv('4', $where, $arrWhereVal, '', true);
     }
Index: /branches/version-2_13-dev/data/class/SC_CustomerList.php
===================================================================
--- /branches/version-2_13-dev/data/class/SC_CustomerList.php	(revision 22567)
+++ /branches/version-2_13-dev/data/class/SC_CustomerList.php	(revision 22739)
@@ -371,5 +371,5 @@
     function getWhere()
     {
-        return array($this->where, $this->arrVal);
+        return array(parent::getWhere(), $this->arrVal);
     }
 }
Index: /branches/version-2_13-dev/data/class/SC_SelectSql.php
===================================================================
--- /branches/version-2_13-dev/data/class/SC_SelectSql.php	(revision 22567)
+++ /branches/version-2_13-dev/data/class/SC_SelectSql.php	(revision 22739)
@@ -221,4 +221,22 @@
     }
 
+    /**
+     * WHERE を取得する。
+     *
+     * ヘンテコセッター互換仕様。
+     * @param $with_where boolean 必要に応じて WHERE を前置するか
+     * @return string WHERE
+     */
+    function getWhere($with_where = false)
+    {
+        $where = $this->where;
+
+        if (!$with_where) {
+            $where = preg_replace('/^\s*WHERE\s+/', '', $where);
+        }
+
+        return $where;
+    }
+
     function setWhere($where)
     {
Index: /branches/version-2_13-dev/data/class/helper/SC_Helper_CSV.php
===================================================================
--- /branches/version-2_13-dev/data/class/helper/SC_Helper_CSV.php	(revision 22738)
+++ /branches/version-2_13-dev/data/class/helper/SC_Helper_CSV.php	(revision 22739)
@@ -75,4 +75,6 @@
     function sfDownloadCsv($csv_id, $where = '', $arrVal = array(), $order = '', $is_download = false)
     {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
         // CSV出力タイトル行の作成
         $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfGetCsvOutput($csv_id, 'status = ' . CSV_COLUMN_STATUS_FLG_ENABLE));
@@ -80,44 +82,31 @@
         $arrOutputCols = $arrOutput['col'];
 
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $objQuery->setOrder($order);
         $cols = SC_Utils_Ex::sfGetCommaList($arrOutputCols, true);
 
-        // TODO: 固有処理 なんかエレガントな処理にしたい
         // 商品の場合
         if ($csv_id == 1) {
-            $objProduct = new SC_Product_Ex();
-            // このWhereを足さないと無効な規格も出力される。現行仕様と合わせる為追加。
+            // この WHERE 句を足さないと無効な規格も出力される。現行仕様と合わせる為追加。
             $inner_where = 'dtb_products_class.del_flg = 0';
-            $from = $objProduct->prdclsSQL($inner_where);
-            $sql = $objQuery->getSql($cols, $from, $where);
-        }
-        // 商品以外の場合
-        else {
-            // 会員の場合
-            if ($csv_id == 2) {
-                $from = 'dtb_customer';
-            }
-            // 注文の場合
-            else if ($csv_id == 3) {
-                $from = 'dtb_order';
-            }
-            // レビューの場合
-            else if ($csv_id == 4) {
-                $from = 'dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id';
-            }
-            // カテゴリの場合
-            else if ($csv_id == 5) {
-                $from = 'dtb_category';
-            }
-
-            $sql = "SELECT $cols FROM $from $where";
-            // 「getSqlを使っているcsv_id=1」以外で「order指定」がある場合は末尾に付与
-            // 全csv_idでgetSqlを使用して生成するよう統一する場合は当メソッドの呼び元も要修正
-            if ($csv_id != 1 && strlen($order) >= 1) {
-                $sql .= " ORDER BY $order";
-            }
-        }
-        // 固有処理ここまで
+            $from = SC_Product_Ex::prdclsSQL($inner_where);
+        }
+        // 会員の場合
+        else if ($csv_id == 2) {
+            $from = 'dtb_customer';
+        }
+        // 注文の場合
+        else if ($csv_id == 3) {
+            $from = 'dtb_order';
+        }
+        // レビューの場合
+        else if ($csv_id == 4) {
+            $from = 'dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id';
+        }
+        // カテゴリの場合
+        else if ($csv_id == 5) {
+            $from = 'dtb_category';
+        }
+
+        $objQuery->setOrder($order);
+        $sql = $objQuery->getSql($cols, $from, $where);
 
         return $this->sfDownloadCsvFromSql($sql, $arrVal, $this->arrSubnavi[$csv_id], $arrOutput['disp_name'], $is_download);
