Changeset 19746


Ignore:
Timestamp:
2010/12/19 13:34:00 (11 years ago)
Author:
AMUAMU
Message:

#652 (CSVダウンロードの改善) 商品CSVダウンロード修正。
#582 category_id が末尾に移動される不具合 の解決。
r19742 で発生したWarningの除去

Location:
branches/version-2_5-dev
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/SC_Product.php

    r19742 r19746  
    764764                 LEFT JOIN dtb_classcategory as Tcc2 
    765765                     ON Tpcm.classcategory_id = Tcc2.classcategory_id 
     766             $whereCause 
    766767        ) as prdcls 
    767768__EOS__; 
  • branches/version-2_5-dev/data/class/SC_Query.php

    r19742 r19746  
    241241         
    242242        while($data = $affected->fetchRow($fetchmode)) { 
    243             $result = call_user_func($cbFunc, &$data); 
     243            $result = call_user_func($cbFunc, $data); 
    244244            if($result === false) { 
    245245                break; 
  • branches/version-2_5-dev/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php

    r19740 r19746  
    7171        // TRUNCをTRUNCATEに変換する 
    7272        $sql = $this->sfChangeTrunc($sql); 
     73        // ARRAY_TO_STRINGをGROUP_CONCATに変換する 
     74        $sql = $this->sfChangeArrayToString($sql); 
    7375        return $sql; 
    7476    } 
     
    276278        return $changesql; 
    277279    } 
    278  
     280     
     281    /** 
     282     * ARRAY_TO_STRING(ARRAY(A),B) を GROUP_CONCAT() に変換する. 
     283     * 
     284     * @access private 
     285     * @param string $sql SQL文 
     286     * @return string 変換後の SQL 文 
     287     */ 
     288    function sfChangeArrayToString($sql){ 
     289        if(stripos($sql, 'ARRAY_TO_STRING') !== FALSE) { 
     290            preg_match_all('/ARRAY_TO_STRING.*?\(.*?ARRAY\(.*?SELECT (.+?) FROM (.+?) WHERE (.+?)\).*?\,.*?\'(.+?)\'.*?\)/is', $sql, $match, PREG_SET_ORDER); 
     291             
     292            foreach($match as $item) { 
     293                $replace = 'GROUP_CONCAT(' . $item[1] . ' SEPARATOR \'' . $item[4] . '\') FROM ' . $item[2] . ' WHERE ' . $item[3]; 
     294                $sql = str_replace($item[0], $replace, $sql); 
     295            } 
     296        } 
     297        return $sql; 
     298    } 
     299     
    279300    /** 
    280301     * WHERE 句置換用の配列を返す. 
  • branches/version-2_5-dev/data/class/helper/SC_Helper_CSV.php

    r19742 r19746  
    132132    // CSVを送信する。(商品) 
    133133    function sfDownloadProductsCsv($where, $arrval, $order, $is_download = false) { 
     134        // 実行時間を制限しない 
     135        @set_time_limit(0); 
    134136 
    135137        // CSV出力タイトル行の作成 
  • branches/version-2_5-dev/html/install/sql/insert_data.sql

    r19743 r19746  
    214214INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, rw_flg, status, create_date, update_date) VALUES (43, 1, 'sub_image5', '詳細-サブ画像(5)', 43, 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
    215215INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, rw_flg, status, create_date, update_date) VALUES (44, 1, 'sub_large_image5', '詳細-サブ拡大画像(5)', 44, 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
    216 INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, rw_flg, status, create_date, update_date) VALUES (45, 1, 'deliv_date_id', '発送日目安', 45, 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     216INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, rw_flg, status, create_date, update_date) VALUES (45, 1, 'deliv_date_id', '発送日目安ID', 45, 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
    217217INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, rw_flg, status, create_date, update_date) VALUES (46, 1, 'del_flg', '削除フラグ', 46, 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
    218218INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, rw_flg, status, create_date, update_date) VALUES (47, 1, 'product_type_id', '商品種別ID', 47, 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     
    364364INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (192, 5, 'level', '階層', NULL, 2, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
    365365INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (193, 5, 'rank', '表示ランク', NULL, 2, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     366INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (194, 1, '(SELECT ARRAY_TO_STRING(ARRAY(SELECT product_status_id FROM dtb_product_status WHERE dtb_product_status.product_id = prdcls.product_id and del_flg = 0 ORDER BY dtb_product_status.product_status_id), '','')) as product_statuses', '商品ステータス', 194, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     367INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (195, 1, '(SELECT ARRAY_TO_STRING(ARRAY(SELECT name FROM dtb_product_status LEFT JOIN mtb_status ON  dtb_product_status.product_status_id = mtb_status.id  WHERE dtb_product_status.product_id = prdcls.product_id and del_flg = 0 ORDER BY dtb_product_status.product_status_id), '','')) as product_status_names', '商品ステータス名', 195, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     368INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (196, 1, '(SELECT ARRAY_TO_STRING(ARRAY(SELECT payment_id FROM dtb_payment_options WHERE dtb_payment_options.product_class_id = prdcls.product_class_id ORDER BY dtb_payment_options.rank), '','')) as product_payment_ids', '支払い方法フラグ', 196, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     369INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (197, 1, '(SELECT ARRAY_TO_STRING(ARRAY(SELECT payment_method FROM dtb_payment_options LEFT JOIN dtb_payment ON dtb_payment_options.payment_id = dtb_payment.payment_id WHERE dtb_payment_options.product_class_id = prdcls.product_class_id ORDER BY dtb_payment_options.rank), '','')) as product_namess', '支払い方法名', 197, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     370INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (198, 1, '(SELECT ARRAY_TO_STRING(ARRAY(SELECT category_id FROM dtb_product_categories WHERE dtb_product_categories.product_id = prdcls.product_id ORDER BY dtb_product_categories.rank), '','')) as category_ids', 'カテゴリID', 198, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     371INSERT INTO dtb_csv (no, csv_id, col, disp_name, rank, status, create_date, update_date) VALUES (199, 1, '(SELECT ARRAY_TO_STRING(ARRAY(SELECT category_name FROM dtb_product_categories LEFT JOIN dtb_category ON dtb_product_categories.category_id = dtb_category.category_id WHERE dtb_product_categories.product_id = prdcls.product_id ORDER BY dtb_product_categories.rank), '','')) as category_names', 'カテゴリ名', 199, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
     372 
    366373 
    367374INSERT INTO dtb_deliv (deliv_id, product_type_id, name, service_name, confirm_url, rank, status, del_flg, creator_id, create_date, update_date) VALUES (1, 1, 'サンプル業者', 'サンプル業者', NULL, 1, 1, 0, 2, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 
Note: See TracChangeset for help on using the changeset viewer.