Ticket #236: eccube.patch

File eccube.patch, 25.1 KB (added by miningbrownie, 16 years ago)
  • data/Smarty/templates/default/admin/products/subnavi.tpl

    diff -urN eccube-2.0.1.org/data/Smarty/templates/default/admin/products/subnavi.tpl eccube-2.0.1/data/Smarty/templates/default/admin/products/subnavi.tpl
    old new  
    3333    <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 
    3434    <tr><td class=<!--{if $tpl_subno != 'category'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./category.php" onMouseOver="naviStyleChange('category', '#a5a5a5')" <!--{if $tpl_subno != 'category'}-->onMouseOut="naviStyleChange('category', '#636469')"<!--{/if}--> id="category"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">カテゴリー管理</span></a></td></tr> 
    3535    <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 
    36     <tr><td class=<!--{if $tpl_subno != 'product_rank'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./product_rank.php" onMouseOver="naviStyleChange('product_rank', '#a5a5a5')" <!--{if $tpl_subno != 'product_rank'}-->onMouseOut="naviStyleChange('product_rank', '#636469')"<!--{/if}--> id="product_rank"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">商品並び替え</span></a></td></tr> 
     36    <tr><td class=<!--{if $tpl_subno != 'upload_csv_category'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./upload_csv_category.php" onMouseOver="naviStyleChange('upload_csv_category', '#a5a5a5')" <!--{if $tpl_subno != 'upload_csv_category'}-->onMouseOut="naviStyleChange('upload_csv_category', '#636469')"<!--{/if}--> id="upload_csv_category"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">カテゴリーCSV</span></a></td></tr> 
     37    <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 
     38    <tr><td class=<!--{if $tpl_subno != 'product_rank'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./product_rank.php" onMouseOver="naviStyleChange('product_rank', '#a5a5a5')" <!--{if $tpl_subno != 'product_rank'}-->onMouseOut="naviStyleChange('product_rank', '#636469')"<!--{/if}--> id="product_rank"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">商品並び替え</span></a></td></tr> 
    3739    <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 
    3840    <tr><td class=<!--{if $tpl_subno != 'review'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./review.php" onMouseOver="naviStyleChange('review', '#a5a5a5')" <!--{if $tpl_subno != 'review'}-->onMouseOut="naviStyleChange('review', '#636469')"<!--{/if}--> id="review"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">レビュー管理</span></a></td></tr> 
    3941    <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 
  • data/Smarty/templates/default/admin/products/upload_csv_category.tpl

    diff -urN eccube-2.0.1.org/data/Smarty/templates/default/admin/products/upload_csv_category.tpl eccube-2.0.1/data/Smarty/templates/default/admin/products/upload_csv_category.tpl
    old new  
     1<!--{* 
     2/* 
     3 * This file is part of EC-CUBE 
     4 * 
     5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
     6 * 
     7 * http://www.lockon.co.jp/ 
     8 * 
     9 * This program is free software; you can redistribute it and/or 
     10 * modify it under the terms of the GNU General Public License 
     11 * as published by the Free Software Foundation; either version 2 
     12 * of the License, or (at your option) any later version. 
     13 * 
     14 * This program is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17 * GNU General Public License for more details. 
     18 * 
     19 * You should have received a copy of the GNU General Public License 
     20 * along with this program; if not, write to the Free Software 
     21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     22 */ 
     23*}--> 
     24<!--★★メインコンテンツ★★--> 
     25<form name="form1" id="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->" enctype="multipart/form-data" onSubmit="winSubmit('','form1', 'upload', 500, 400)"> 
     26<input type="hidden" name="mode" value="csv_upload"> 
     27<table width="878" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     28    <tr valign="top"> 
     29        <td background="<!--{$TPL_DIR}-->img/contents/navi_bg.gif" height="402"> 
     30            <!-- サブナビ --> 
     31            <!--{include file=$tpl_subnavi}--> 
     32        </td> 
     33        <td class="mainbg"> 
     34        <table width="737" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     35            <!--メインエリア--> 
     36            <tr> 
     37                <td align="center"> 
     38                <table width="706" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     39                    <tr><td height="14"></td></tr> 
     40                    <tr> 
     41                        <td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_top.jpg" width="706" height="14" alt=""></td> 
     42                    </tr> 
     43                    <tr> 
     44                        <td background="<!--{$TPL_DIR}-->img/contents/main_left.jpg"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="14" height="1" alt=""></td> 
     45                        <td bgcolor="#cccccc"> 
     46                        <table width="678" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     47                            <tr> 
     48                                <td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_top.gif" width="678" height="7" alt=""></td> 
     49                            </tr> 
     50                            <tr> 
     51                                <td background="<!--{$TPL_DIR}-->img/contents/contents_title_left_bg.gif"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_left.gif" width="22" height="12" alt=""></td> 
     52                                <td bgcolor="#636469" width="638" class="fs14n"><span class="white"><!--コンテンツタイトル-->カテゴリ登録CSV</span></td> 
     53                                <td background="<!--{$TPL_DIR}-->img/contents/contents_title_right_bg.gif"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="18" height="1" alt=""></td> 
     54                            </tr> 
     55                            <tr> 
     56                                <td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_bottom.gif" width="678" height="7" alt=""></td> 
     57                            </tr> 
     58                            <tr> 
     59                                <td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td> 
     60                            </tr> 
     61                        </table> 
     62 
     63                        <!--{if $tpl_errtitle != ""}--> 
     64                        <table width="678" border="0" cellspacing="1" cellpadding="5" summary=" " bgcolor="#cccccc"> 
     65                        <tr><td bgcolor="#ffffff"> 
     66                            <span class="red12"><!--{$tpl_errtitle}--><br><br></span> 
     67                            <!--{foreach key=key item=item from=$arrCSVErr}--> 
     68                            <span class="red12"><!--{$item}--> 
     69                            <!--{if $key != 'blank'}--> 
     70                            [値:<!--{$arrParam[$key]}-->] 
     71                            <!--{/if}--> 
     72                            <br></span> 
     73                            <!--{/foreach}--> 
     74                        </td></tr> 
     75                        </table> 
     76                        <!--{/if}--> 
     77 
     78                        <!--▼登録テーブルここから--> 
     79                        <table width="678" border="0" cellspacing="1" cellpadding="5" summary=" " bgcolor="#cccccc"> 
     80                            <tr class="fs12n"> 
     81                                <td bgcolor="#f0f0f0" width="110">CSVファイル</td> 
     82                                <td bgcolor="#ffffff" width="607"> 
     83                                <span class="red12"><!--{$arrErr.csv_file}--></span> 
     84                                <input type="file" name="csv_file" size="60" class="box60" /><span class="red10"> (1行目タイトル行)</span></td> 
     85                            </tr> 
     86                            <tr class="fs12n"> 
     87                                <td bgcolor="#f0f0f0" width="110">登録情報</td> 
     88                                <td bgcolor="#ffffff" width="607"> 
     89                                <!--{foreach name=title key=key item=item from=$arrTitle}--> 
     90                                <!--{$smarty.foreach.title.iteration}-->項目:<!--{$item}--><br> 
     91                                <!--{/foreach}--> 
     92                                </td> 
     93                            </tr> 
     94                        </table> 
     95                        <!--▲登録テーブルここまで--> 
     96                        <table width="678" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     97                            <tr> 
     98                                <td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="5" alt=""></td> 
     99                                <td><img src="<!--{$TPL_DIR}-->img/contents/tbl_top.gif" width="676" height="7" alt=""></td> 
     100                                <td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="5" alt=""></td> 
     101                            </tr> 
     102                            <tr> 
     103                                <td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="10" alt=""></td> 
     104                                <td bgcolor="#e9e7de" align="center"> 
     105                                <table border="0" cellspacing="0" cellpadding="0" summary=" "> 
     106                                    <tr> 
     107                                    <td> 
     108                                        <input type="image" onMouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist.jpg',this)" src="<!--{$TPL_DIR}-->img/contents/btn_regist.jpg" width="123" height="24" alt="この内容で登録する" border="0" name="subm" > 
     109                                    </td> 
     110                                    </tr> 
     111                                </table> 
     112                                </td> 
     113                                <td bgcolor="#cccccc"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="1" height="10" alt=""></td> 
     114                            </tr> 
     115                            <tr> 
     116                                <td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/tbl_bottom.gif" width="678" height="8" alt=""></td> 
     117                            </tr> 
     118                        </table>                                         
     119                        </td> 
     120                        <td background="<!--{$TPL_DIR}-->img/contents/main_right.jpg"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="14" height="1" alt=""></td> 
     121                    </tr>                    
     122                    <tr> 
     123                        <td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_bottom.jpg" width="706" height="14" alt=""></td> 
     124                    </tr> 
     125                    <tr><td height="30"></td></tr> 
     126                </table> 
     127                </td> 
     128            </tr> 
     129            <!--メインエリア--> 
     130        </table> 
     131        </td> 
     132    </tr> 
     133</form>  
     134</table> 
     135<!--▲CONTENTS--> 
     136 ファイル末尾に改行がありません 
  • data/class_extends/page_extends/admin/products/LC_Page_Admin_Products_UploadCSVCategory_Ex.php

    diff -urN eccube-2.0.1.org/data/class_extends/page_extends/admin/products/LC_Page_Admin_Products_UploadCSVCategory_Ex.php eccube-2.0.1/data/class_extends/page_extends/admin/products/LC_Page_Admin_Products_UploadCSVCategory_Ex.php
    old new  
     1<?php 
     2/* 
     3 * This file is part of EC-CUBE 
     4 * 
     5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
     6 * 
     7 * http://www.lockon.co.jp/ 
     8 * 
     9 * This program is free software; you can redistribute it and/or 
     10 * modify it under the terms of the GNU General Public License 
     11 * as published by the Free Software Foundation; either version 2 
     12 * of the License, or (at your option) any later version. 
     13 * 
     14 * This program is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17 * GNU General Public License for more details. 
     18 * 
     19 * You should have received a copy of the GNU General Public License 
     20 * along with this program; if not, write to the Free Software 
     21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     22 */ 
     23 
     24// {{{ requires 
     25require_once(CLASS_PATH . "pages/admin/products/LC_Page_Admin_Products_UploadCSV.php"); 
     26 
     27/** 
     28 * CSV アップロード のページクラス(拡張) 
     29 * 
     30 * LC_Page_Admin_Products_UploadCSV をカスタマイズする場合はこのクラスを編集する. 
     31 * 
     32 * @package Page 
     33 * @author LOCKON CO.,LTD. 
     34 * @version $$Id: LC_Page_Admin_Products_UploadCSV_Ex.php 16741 2007-11-08 00:43:24Z adachi $$ 
     35 */ 
     36class LC_Page_Admin_Products_UploadCSVCategory_Ex extends LC_Page_Admin_Products_UploadCSV { 
     37 
     38    // }}} 
     39    // {{{ functions 
     40 
     41    /** 
     42     * Page を初期化する. 
     43     * 
     44     * @return void 
     45     */ 
     46    function init() { 
     47        parent::init(); 
     48        $this->tpl_mainpage = 'products/upload_csv_category.tpl'; 
     49        $this->tpl_subnavi = 'products/subnavi.tpl'; 
     50        $this->tpl_mainno = 'products'; 
     51        $this->tpl_subno = 'upload_csv_category'; 
     52    } 
     53 
     54    /** 
     55     * Page のプロセス. 
     56     * 
     57     * @return void 
     58     */ 
     59    function process() { 
     60        $conn = new SC_DBConn(); 
     61        $objView = new SC_AdminView(); 
     62        $objSess = new SC_Session(); 
     63        $objDb = new SC_Helper_DB_Ex(); 
     64 
     65        // 認証可否の判定 
     66        SC_Utils_Ex::sfIsSuccess($objSess); 
     67 
     68        // ファイル管理クラス 
     69        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); 
     70        // ファイル情報の初期化 
     71        $this->lfInitFile(); 
     72        // パラメータ管理クラス 
     73        $this->objFormParam = new SC_FormParam(); 
     74        // パラメータ情報の初期化 
     75        $this->lfInitParam(); 
     76        $colmax = $this->objFormParam->getCount(); 
     77        $this->objFormParam->setHtmlDispNameArray(); 
     78        $this->arrTitle = $this->objFormParam->getHtmlDispNameArray(); 
     79 
     80        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
     81 
     82        switch($_POST['mode']) { 
     83            case 'csv_upload': 
     84                $err = false; 
     85                // エラーチェック 
     86                $arrErr['csv_file'] = $this->objUpFile->makeTempFile('csv_file'); 
     87 
     88                if($arrErr['css_file'] == "") { 
     89                    $arrErr = $this->objUpFile->checkEXISTS(); 
     90                } 
     91 
     92                // 実行時間を制限しない 
     93                set_time_limit(0); 
     94 
     95                // 出力をバッファリングしない(==日本語自動変換もしない) 
     96                ob_end_clean(); 
     97 
     98                // IEのために256バイト空文字出力 
     99                echo str_pad('',256); 
     100 
     101                if(empty($arrErr['csv_file'])) { 
     102                    // 一時ファイル名の取得 
     103                    $filepath = $this->objUpFile->getTempFilePath('csv_file'); 
     104                    // エンコード 
     105                    $enc_filepath = SC_Utils_Ex::sfEncodeFile($filepath, 
     106                    CHAR_CODE, CSV_TEMP_DIR); 
     107 
     108                    // レコード数を得る 
     109                    $rec_count = $this->lfCSVRecordCount($enc_filepath); 
     110 
     111                    $fp = fopen($enc_filepath, "r"); 
     112                    $line = 0;      // 行数 
     113                    $regist = 0;    // 登録数 
     114 
     115                    $objQuery = new SC_Query(); 
     116                    $objQuery->begin(); 
     117 
     118                    echo "■ CSV登録進捗状況 <br/><br/>\n"; 
     119 
     120                    while(!feof($fp) && !$err) { 
     121                        $arrCSV = fgetcsv($fp, CSV_LINE_MAX); 
     122 
     123                        // 行カウント 
     124                        $line++; 
     125 
     126                        if($line <= 1) { 
     127                            continue; 
     128                        } 
     129 
     130                        // 項目数カウント 
     131                        $max = count($arrCSV); 
     132 
     133                        // 項目数が1以下の場合は無視する 
     134                        if($max <= 1) { 
     135                            continue; 
     136                        } 
     137 
     138                        // 項目数チェック 
     139                        if($max != $colmax) { 
     140                            echo "※ 項目数が" . $max . "個検出されました。項目数は" . $colmax . "個になります。</br>\n"; 
     141                            $err = true; 
     142                        } else { 
     143                            // シーケンス配列を格納する。 
     144                            $this->objFormParam->setParam($arrCSV, true); 
     145                            $arrRet = $this->objFormParam->getHashArray(); 
     146                            $this->objFormParam->setParam($arrRet); 
     147                            // 入力値の変換 
     148                            $this->objFormParam->convParam(); 
     149                            // <br>なしでエラー取得する。 
     150                            $arrCSVErr = $this->lfCheckError(); 
     151                        } 
     152 
     153                        // 入力エラーチェック 
     154                        if(count($arrCSVErr) > 0) { 
     155                            echo "<font color=\"red\">■" . $line . "行目でエラーが発生しました。</font></br>\n"; 
     156                            foreach($arrCSVErr as $val) { 
     157                                $this->printError($val); 
     158                            } 
     159                            $err = true; 
     160                        } 
     161 
     162                        if(!$err) { 
     163                            $this->lfRegistProduct($objQuery, $line); 
     164                            $regist++; 
     165                        } 
     166                        $arrParam = $this->objFormParam->getHashArray(); 
     167 
     168                        if(!$err) echo $line." / ".$rec_count. "行目 (カテゴリID:".$arrParam['category_id']." / カテゴリ名:".$arrParam['category_name'].")\n<br />"; 
     169                        flush(); 
     170                    } 
     171                    fclose($fp); 
     172 
     173                    if(!$err) { 
     174                        $objQuery->commit(); 
     175                        echo "■" . $regist . "件のレコードを登録しました。"; 
     176                        // カテゴリ件数カウント関数の実行 
     177                        $objDb->sfCategory_Count($objQuery); 
     178                    } else { 
     179                        $objQuery->rollback(); 
     180                    } 
     181                } else { 
     182                    foreach($arrErr as $val) { 
     183                        $this->printError($val); 
     184                    } 
     185                } 
     186                echo "<br/><a href=\"javascript:window.close()\">→閉じる</a>"; 
     187                flush(); 
     188                exit; 
     189                break; 
     190            default: 
     191                break; 
     192        } 
     193 
     194        $objView->assignobj($this); 
     195        $objView->display(MAIN_FRAME); 
     196    } 
     197 
     198    /** 
     199     * デストラクタ. 
     200     * 
     201     * @return void 
     202     */ 
     203    function destroy() { 
     204        parent::destroy(); 
     205    } 
     206 
     207 
     208    /** 
     209     * ファイル情報の初期化を行う. 
     210     * 
     211     * @return void 
     212     */ 
     213    function lfInitFile() { 
     214        $this->objUpFile->addFile("CSVファイル", 'csv_file', array('csv'), 
     215        CSV_SIZE, true, 0, 0, false); 
     216    } 
     217 
     218    /** 
     219     * 入力情報の初期化を行う. 
     220     * 
     221     * @return void 
     222     */ 
     223    function lfInitParam() { 
     224        $this->objFormParam->addParam("カテゴリID","category_id",INT_LEN,"n",array("MAX_LENGTH_CHECK","NUM_CHECK")); 
     225        $this->objFormParam->addParam("カテゴリ名","category_name",STEXT_LEN,"KVa",array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 
     226        $this->objFormParam->addParam("親カテゴリID","parent_category_id",INT_LEN,"n",array("MAX_LENGTH_CHECK","NUM_CHECK")); 
     227        $this->objFormParam->addParam("階層","level",INT_LEN,"n",array("MAX_LENGTH_CHECK","NUM_CHECK")); 
     228        $this->objFormParam->addParam("表示順","rank",INT_LEN,"n",array("MAX_LENGTH_CHECK","NUM_CHECK")); 
     229        //     $this->objFormParam->addParam("削除フラグ","del_flg",INT_LEN,"n",array()); 
     230    } 
     231 
     232    /** 
     233     * カテゴリ登録を行う. 
     234     * 
     235     * @param SC_Query $objQuery SC_Queryインスタンス 
     236     * @param string|integer $line 処理中の行数 
     237     * @return void 
     238     */ 
     239    function lfRegistProduct($objQuery, $line = "") { 
     240        $objDb = new SC_Helper_DB_Ex(); 
     241        $arrRet = $this->objFormParam->getHashArray(); 
     242        foreach($arrRet as $key => $val) { 
     243            switch($key) { 
     244                case 'parent_category_id': 
     245 
     246                    break; 
     247                default: 
     248                    if(!ereg("^dummy", $key)) { 
     249                        $sqlval[$key] = $val; 
     250                    } 
     251                    break; 
     252            } 
     253        } 
     254        // 登録時間を生成(DBのnow()だとcommitした際、すべて同一の時間になってしまう) 
     255        $time = date("Y-m-d H:i:s"); 
     256        // 秒以下を生成 
     257        if($line != "") { 
     258            $microtime = sprintf("%06d", $line); 
     259            $time .= ".$microtime"; 
     260        } 
     261        $sqlval['update_date'] = $time; 
     262        $sqlval['creator_id'] = $_SESSION['member_id']; 
     263        //カテゴリIDの設定。 
     264        $update = false; 
     265        if($arrRet['category_id'] != ""){ 
     266            $sqlval['category_id'] = $arrRet['category_id']; 
     267            $update = true; 
     268        }else{ 
     269            $category_id = $objQuery->max("dtb_category","category_id")+1; 
     270            $sqlval['category_id'] = $category_id; 
     271            $count = $objQuery->count("dtb_category", "category_id = ?", array($arrRet['category_id'])); 
     272            if($count == 0){ 
     273                $update = false; 
     274            }else{ 
     275                $update = true; 
     276            } 
     277        } 
     278 
     279        //親カテゴリIDの設定 
     280        if($arrRet['parent_category_id'] == ""){ 
     281            $sqlval['parent_category_id'] = 0; 
     282            $sqlval['level'] = 1; 
     283        }else{ 
     284            $sqlval['parent_category_id'] = $arrRet['parent_category_id']; 
     285            $parent_level = $objQuery->get('dtb_category','level',"category_id = ?",array($sqlval['parent_category_id'])); 
     286            $sqlval['level'] = $parent_level+1; 
     287        } 
     288         
     289 
     290        if($update) { 
     291            // UPDATEの実行 
     292            echo "UPDATEの実行"; 
     293            $where = "category_id = ?"; 
     294            $objQuery->update("dtb_category", $sqlval, $where, array($sqlval['category_id'])); 
     295        } else { 
     296            // 新規登録 
     297 
     298            $sqlval['create_date'] = $time; 
     299            if($arrRet['rank'] == ""){ 
     300                // カテゴリ内で最大のランクを割り当てる 
     301                $sqlval['rank'] = $objQuery->max("dtb_category", "rank", "parent_category_id = ?", array($arrRet['parent_category_id'])) + 1; 
     302            } 
     303            // INSERTの実行 
     304            $objQuery->insert("dtb_category", $sqlval); 
     305        } 
     306    } 
     307 
     308    /** 
     309     * 入力チェックを行う. 
     310     * 
     311     * @return void 
     312     */ 
     313    function lfCheckError() { 
     314        // 入力データを渡す。 
     315        $arrRet =  $this->objFormParam->getHashArray(); 
     316        $objErr = new SC_CheckError($arrRet); 
     317        $objErr->arrErr = $this->objFormParam->checkError(false); 
     318        if(count($objErr->arrErr) == 0) { 
     319            $objQuery = new SC_Query(); 
     320            // 存在する親カテゴリIDかチェック 
     321            if($arrRet['parent_category_id'] != 0){ 
     322                $count = $objQuery->count("dtb_category", "category_id = ?", array($arrRet['parent_category_id'])); 
     323                if($count == 0) { 
     324                    $objErr->arrErr['parent_category_id'] = "※ 指定の親カテゴリID(".$arrRet['parent_category_id'].")は、存在しません。"; 
     325                } 
     326            } 
     327        } 
     328        return $objErr->arrErr; 
     329    } 
     330 
     331    /** 
     332     * CSVのカウント数を得る. 
     333     * 
     334     * @param string $file_name ファイルパス 
     335     * @return integer CSV のカウント数 
     336     */ 
     337    function lfCSVRecordCount($file_name) { 
     338 
     339        $count = 0; 
     340        $fp = fopen($file_name, "r"); 
     341        while(!feof($fp)) { 
     342            $arrCSV = fgetcsv($fp, CSV_LINE_MAX); 
     343            $count++; 
     344        } 
     345 
     346        return $count-1; 
     347    } 
     348 
     349    /** 
     350     * 引数の文字列をエラー出力する. 
     351     * 
     352     * 引数 $val の内容は, htmlspecialchars() によってサニタイズされ 
     353     * 
     354     * @param string $val 出力する文字列 
     355     * @return void 
     356     */ 
     357    function printError($val) { 
     358        echo "<font color=\"red\">" 
     359        . htmlspecialchars($val, ENT_QUOTES) 
     360        . "</font></br>\n"; 
     361    } 
     362} 
     363?> 
  • html/admin/products/upload_csv_category.php

    diff -urN eccube-2.0.1.org/html/admin/products/upload_csv_category.php eccube-2.0.1/html/admin/products/upload_csv_category.php
    old new  
     1<?php 
     2/* 
     3 * This file is part of EC-CUBE 
     4 * 
     5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
     6 * 
     7 * http://www.lockon.co.jp/ 
     8 * 
     9 * This program is free software; you can redistribute it and/or 
     10 * modify it under the terms of the GNU General Public License 
     11 * as published by the Free Software Foundation; either version 2 
     12 * of the License, or (at your option) any later version. 
     13 * 
     14 * This program is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17 * GNU General Public License for more details. 
     18 * 
     19 * You should have received a copy of the GNU General Public License 
     20 * along with this program; if not, write to the Free Software 
     21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     22 */ 
     23 
     24// {{{ requires 
     25require_once("../../require.php"); 
     26require_once(CLASS_EX_PATH . "page_extends/admin/products/LC_Page_Admin_Products_UploadCSVCategory_Ex.php"); 
     27 
     28// }}} 
     29// {{{ generate page 
     30 
     31$objPage = new LC_Page_Admin_Products_UploadCSVCategory_Ex(); 
     32register_shutdown_function(array($objPage, "destroy")); 
     33$objPage->init(); 
     34$objPage->process(); 
     35?>