Index: branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php	(revision 20543)
+++ branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php	(revision 20543)
@@ -0,0 +1,320 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
+
+/**
+ * 配送業者設定 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Basis_DeliveryInput extends LC_Page_Admin_Ex {
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'basis/delivery_input.tpl';
+        $this->tpl_subnavi = 'basis/subnavi.tpl';
+        $this->tpl_subno = 'delivery';
+        $this->tpl_mainno = 'basis';
+        $masterData = new SC_DB_MasterData_Ex();
+        $this->arrPref = $masterData->getMasterData('mtb_pref');
+        $this->arrProductType = $masterData->getMasterData("mtb_product_type");
+        $this->arrPayments = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+        $this->tpl_subtitle = '配送業者設定';
+        $this->mode = $this->getMode();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $this->action();
+        $this->sendResponse();
+    }
+
+    /**
+     * Page のアクション.
+     *
+     * @return void
+     */
+    function action() {
+        $objFormParam = new SC_FormParam_Ex();
+        $this->lfInitParam($this->mode, $objFormParam);
+        $objFormParam->setParam($_POST);
+
+        // 入力値の変換
+        $objFormParam->convParam();
+        $this->arrErr = $this->lfCheckError($objFormParam);
+
+        switch ($this->mode) {
+            case 'edit':
+                if (count($this->arrErr) == 0) {
+                    $objFormParam->setValue('deliv_id', $this->lfRegistData($objFormParam->getHashArray(), $_SESSION['member_id']));
+                    $this->tpl_onload = "window.alert('配送業者設定が完了しました。');";
+                }
+                break;
+            case 'pre_edit':
+                if (count($this->arrErr) > 0) {
+                    SC_Utils_Ex::sfDispException();
+                }
+                $this->lfGetDelivData($objFormParam);
+                break;
+            default:
+                break;
+        }
+
+        $this->arrForm = $objFormParam->getFormParamList();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* パラメータ情報の初期化 */
+    function lfInitParam($mode, &$objFormParam) {
+        $objFormParam->initParam();
+
+        switch ($mode) {
+            case 'edit':
+                $objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                $objFormParam->addParam("配送業者名", 'name', STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("名称", "service_name", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("説明", 'remark', LLTEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("伝票No.確認URL", "confirm_url", STEXT_LEN, 'n', array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
+                $objFormParam->addParam("取扱商品種別", "product_type_id", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("取扱支払方法", "payment_ids", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+
+                for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+                    $objFormParam->addParam("お届け時間$cnt", "deliv_time$cnt", STEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
+                }
+
+                if(INPUT_DELIV_FEE) {
+                    for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+                        $objFormParam->addParam("配送料金$cnt", "fee$cnt", PRICE_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+                    }
+                }
+                break;
+
+            case 'pre_edit':
+                $objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                break;
+
+            default:
+                break;
+        }
+    }
+
+    /**
+     * 配送情報を登録する
+     *
+     * @return $deliv_id
+     */
+    function lfRegistData($arrRet, $member_id) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $objQuery->begin();
+
+        // 入力データを渡す。
+        $sqlval['name'] = $arrRet['name'];
+        $sqlval['service_name'] = $arrRet['service_name'];
+        $sqlval['remark'] = $arrRet['remark'];
+        $sqlval['confirm_url'] = $arrRet['confirm_url'];
+        $sqlval['product_type_id'] = $arrRet['product_type_id'];
+        $sqlval['creator_id'] = $member_id;
+        $sqlval['update_date'] = 'Now()';
+
+        // deliv_id が決まっていた場合
+        if($arrRet['deliv_id'] != "") {
+            $deliv_id = $arrRet['deliv_id'];
+            $where = "deliv_id = ?";
+            $objQuery->update("dtb_deliv", $sqlval, $where, array($deliv_id));
+
+            // お届け時間の登録
+            $table = "dtb_delivtime";
+            $where = "deliv_id = ? AND time_id = ?";
+            for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+                $sqlval = array();
+                $keyname = "deliv_time".$cnt;
+                $arrval = array($deliv_id, $cnt);
+                // 既存データの有無を確認
+                $curData = $objQuery->select("*", $table, $where, $arrval);
+
+                if(strcmp($arrRet[$keyname], "") != 0) {
+                    $sqlval['deliv_time'] = $arrRet[$keyname];
+
+                    // 入力が空ではなく、DBに情報があれば更新
+                    if(count($curData)) {
+                        $objQuery->update($table, $sqlval, $where, $arrval);
+                    }
+                    // DBに情報がなければ登録
+                    else {
+                        $sqlval['deliv_id'] = $deliv_id;
+                        $sqlval['time_id'] = $cnt;
+                        $objQuery->insert($table, $sqlval);
+                    }
+                }
+                // 入力が空で、DBに情報がある場合は削除
+                else if(count($curData)) {
+                    $objQuery->delete($table, $where, $arrval);
+                }
+            }
+
+            // 配送料の登録
+            if(INPUT_DELIV_FEE) {
+                for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+                    $keyname = 'fee'.$cnt;
+                    if(strcmp($arrRet[$keyname], "") != 0) {
+                        $sqlval = array('fee' => $arrRet[$keyname]);
+                        $objQuery->update("dtb_delivfee", $sqlval, "deliv_id = ? AND fee_id = ?", array($deliv_id, $cnt));
+                    }
+                }
+            }
+        }
+        else {
+            // 登録する配送業者IDの取得
+            $deliv_id = $objQuery->nextVal('dtb_deliv_deliv_id');
+            $sqlval['deliv_id'] = $deliv_id;
+            $sqlval['rank'] = $objQuery->max('rank', "dtb_deliv") + 1;
+            $sqlval['create_date'] = 'Now()';
+            // INSERTの実行
+            $objQuery->insert("dtb_deliv", $sqlval);
+
+            $sqlval = array();
+            // お届け時間の設定
+            for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+                $keyname = "deliv_time$cnt";
+                if($arrRet[$keyname] != "") {
+                    $sqlval['deliv_id'] = $deliv_id;
+                    $sqlval['time_id'] = $cnt;
+                    $sqlval['deliv_time'] = $arrRet[$keyname];
+                    // INSERTの実行
+                    $objQuery->insert("dtb_delivtime", $sqlval);
+                }
+            }
+
+            if(INPUT_DELIV_FEE) {
+                $sqlval = array();
+                // 配送料金の設定
+                for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+                    $keyname = "fee$cnt";
+                    if($arrRet[$keyname] != "") {
+                        $sqlval['deliv_id'] = $deliv_id;
+                        $sqlval['fee'] = $arrRet[$keyname];
+                        $sqlval['pref'] = $cnt;
+                        // INSERTの実行
+                        $sqlval['fee_id'] = $cnt;
+                        $objQuery->insert("dtb_delivfee", $sqlval);
+                    }
+                }
+            }
+        }
+
+        $objQuery->delete('dtb_payment_options', 'deliv_id = ?', array($arrRet['deliv_id']));
+        $sqlval = array();
+        $i = 1;
+        foreach ($arrRet['payment_ids'] as $val) {
+            $sqlval['deliv_id'] = $deliv_id;
+            $sqlval['payment_id'] = $val;
+            $sqlval['rank'] = $i;
+            $objQuery->insert('dtb_payment_options', $sqlval);
+            $i++;
+        }
+        $objQuery->commit();
+        return $deliv_id;
+    }
+
+    /* 配送業者情報の取得 */
+    function lfGetDelivData(&$objFormParam) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+        $deliv_id = $objFormParam->getValue('deliv_id');
+
+        // パラメータ情報の初期化
+        $this->lfInitParam('edit', $objFormParam);
+
+        // 配送業者一覧の取得
+        $col = "deliv_id, name, service_name, remark, confirm_url, product_type_id";
+        $where = "deliv_id = ?";
+        $table = "dtb_deliv";
+        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+        $objFormParam->setParam($arrRet[0]);
+        // お届け時間の取得
+        $col = "deliv_time";
+        $where = "deliv_id = ?  ORDER BY time_id";
+        $table = "dtb_delivtime";
+        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+        $objFormParam->setParamList($arrRet, 'deliv_time');
+        // 配送料金の取得
+        $col = 'fee';
+        $where = "deliv_id = ? ORDER BY pref";
+        $table = "dtb_delivfee";
+        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+        $objFormParam->setParamList($arrRet, 'fee');
+        // 支払方法
+        $col = 'payment_id';
+        $where = 'deliv_id = ? ORDER BY rank';
+        $table = 'dtb_payment_options';
+        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+        $arrPaymentIds = array();
+        foreach ($arrRet as $val) {
+            $arrPaymentIds[] = $val['payment_id'];
+        }
+        $objFormParam->setValue('payment_ids', $arrPaymentIds);
+    }
+
+    /* 入力内容のチェック */
+    function lfCheckError(&$objFormParam) {
+        // 入力データを渡す。
+        $arrRet =  $objFormParam->getHashArray();
+        $objErr = new SC_CheckError_Ex($arrRet);
+        $objErr->arrErr = $objFormParam->checkError();
+
+        if(!isset($objErr->arrErr['name']) && $arrRet['deliv_id'] == "") {
+            // 既存チェック
+            $objDb = new SC_Helper_DB_Ex();
+            $ret = $objDb->sfIsRecord("dtb_deliv", "service_name", array($arrRet['service_name']));
+            if ($ret) {
+                $objErr->arrErr['name'] = "※ 同じ名称の組み合わせは登録できません。<br>";
+            }
+        }
+
+        return $objErr->arrErr;
+    }
+}
+?>
Index: branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php	(revision 20543)
+++ branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php	(revision 20543)
@@ -0,0 +1,266 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
+
+/**
+ * 支払方法設定 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Basis_PaymentInput extends LC_Page_Admin_Ex {
+
+    // {{{ properties
+
+    /** SC_UploadFile インスタンス */
+    var $objUpFile;
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'basis/payment_input.tpl';
+        $this->tpl_subtitle = '支払方法設定';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $this->action();
+        $this->sendResponse();
+    }
+
+    /**
+     * Page のアクション.
+     *
+     * @return void
+     */
+    function action() {
+        $objDb = new SC_Helper_DB_Ex();
+        $objFormParam = new SC_FormParam_Ex();
+
+        $mode = $this->getMode();
+
+        if (!empty($_POST) || !empty($_GET)) {
+            $this->lfInitParam($mode, $objFormParam);
+
+            $param = (empty($_POST))? $_GET : $_POST;
+
+            $objFormParam->setParam($param);
+            $objFormParam->convParam();
+
+            $this->arrErr = $objFormParam->checkError();
+            $post = $objFormParam->getHashArray();
+        }
+
+        // ファイル管理クラス
+        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR);
+        // ファイル情報の初期化
+        $this->objUpFile = $this->lfInitFile();
+        // Hiddenからのデータを引き継ぐ
+        $this->objUpFile->setHiddenFileList($_POST);
+
+        switch($mode) {
+        case 'edit':
+            $this->charge_flg = $post["charge_flg"];
+            if(count($this->arrErr) == 0) {
+                $this->lfRegistData($post['payment_id'], $_SESSION['member_id'], $objFormParam);
+                $this->objUpFile->moveTempFile();
+                $this->tpl_onload="fnUpdateParent('".ADMIN_PAYMENT_URLPATH."'); window.close();";
+            }
+
+            break;
+        // 画像のアップロード
+        case 'upload_image':
+            // ファイル存在チェック
+            $this->arrErr = $this->objUpFile->checkEXISTS($post['image_key']);
+            // 画像保存処理
+            $this->arrErr[$post['image_key']] = $this->objUpFile->makeTempFile($post['image_key']);
+            break;
+        // 画像の削除
+        case 'delete_image':
+
+            $this->objUpFile->deleteFile($post['image_key']);
+            break;
+
+        case 'pre_edit':
+                $arrRet = $this->lfGetData($post['payment_id']);
+
+                $objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("手数料", 'charge', PRICE_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("利用条件(～円以上)", 'rule', PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("固定", 'fix');
+                $objFormParam->setParam($arrRet);
+
+                $this->charge_flg = $arrRet["charge_flg"];
+                $this->objUpFile->setDBFileList($arrRet);
+                $this->tpl_payment_id = $post['payment_id'];
+            break;
+        default:
+            break;
+        }
+
+        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+            $this->tpl_payment_id = $_POST['payment_id'];
+        }
+
+        $this->arrForm = $objFormParam->getFormParamList();
+
+        // FORM表示用配列を渡す。
+        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URLPATH, IMAGE_SAVE_URLPATH);
+        // HIDDEN用に配列を渡す。
+        $this->arrHidden = array_merge((array)$this->arrHidden, (array)$this->objUpFile->getHiddenFileList());
+        $this->setTemplate($this->tpl_mainpage);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* ファイル情報の初期化 */
+    function lfInitFile() {
+        $this->objUpFile->addFile("ロゴ画像", 'payment_image', array('gif'), IMAGE_SIZE, false, CLASS_IMAGE_WIDTH, CLASS_IMAGE_HEIGHT);
+        return $this->objUpFile;
+    }
+
+    /* パラメータ情報の初期化 */
+    function lfInitParam($mode, &$objFormParam) {
+
+        switch ($mode) {
+            case 'edit':
+                $objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("手数料", 'charge', PRICE_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("利用条件(～円以上)", 'rule', PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("固定", 'fix');
+                $objFormParam->addParam('支払いID', 'payment_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                $objFormParam->addParam('課金フラグ', 'charge_flg', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+
+                break;
+            case "upload_image":
+            case "delete_image":
+                $objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("手数料", 'charge', PRICE_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("利用条件(～円以上)", 'rule', PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objFormParam->addParam("固定", 'fix');
+                $objFormParam->addParam("画像キー", "image_key", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+
+                break;
+            case "pre_edit":
+                $objFormParam->addParam('支払いID', 'payment_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                $objFormParam->addParam('課金フラグ', 'charge_flg', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                break;
+
+            default:
+                break;
+        }
+    }
+
+    /* DBからデータを読み込む */
+    function lfGetData($payment_id) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $where = "payment_id = ?";
+        $arrRet = $objQuery->select("*", "dtb_payment", $where, array($payment_id));
+        return $arrRet[0];
+    }
+
+    /* DBへデータを登録する */
+    function lfRegistData($payment_id = "", $member_id, &$objFormParam) {
+
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $sqlval = $objFormParam->getHashArray();
+        $arrRet = $this->objUpFile->getDBFileList();	// ファイル名の取得
+        $sqlval = array_merge($sqlval, $arrRet);
+        $sqlval['update_date'] = 'Now()';
+
+        if($sqlval['fix'] != '1') {
+            $sqlval['fix'] = 2;	// 自由設定
+        }
+
+        // 新規登録
+        if($payment_id == "") {
+            // INSERTの実行
+            $sqlval['creator_id'] = $member_id;
+            $sqlval['rank'] = $objQuery->max('rank', "dtb_payment") + 1;
+            $sqlval['create_date'] = 'Now()';
+            $sqlval['payment_id'] = $objQuery->nextVal('dtb_payment_payment_id');
+            $objQuery->insert("dtb_payment", $sqlval);
+        // 既存編集
+        } else {
+            $where = "payment_id = ?";
+            $objQuery->update("dtb_payment", $sqlval, $where, array($payment_id));
+        }
+    }
+
+    /*　利用条件の数値チェック */
+
+    /* 入力内容のチェック */
+    function lfCheckError($post) {
+
+        // DBのデータを取得
+        $arrPaymentData = $this->lfGetData($post['payment_id']);
+
+        // 手数料を設定できない場合には、手数料を0にする
+        if($arrPaymentData["charge_flg"] == 2) $this->objFormParam->setValue('charge', "0");
+
+        // 入力データを渡す。
+        $arrRet =  $this->objFormParam->getHashArray();
+        $objErr = new SC_CheckError_Ex($arrRet);
+        $objErr->arrErr = $this->objFormParam->checkError();
+
+        // 利用条件(下限)チェック
+        if($arrRet['rule'] < $arrPaymentData["rule_min"] and $arrPaymentData["rule_min"] != ""){
+            $objErr->arrErr['rule'] = "利用条件(下限)は" . $arrPaymentData["rule_min"] ."円以上にしてください。<br>";
+        }
+
+        // 利用条件(上限)チェック
+        if($arrRet["upper_rule"] > $arrPaymentData["upper_rule_max"] and $arrPaymentData["upper_rule_max"] != ""){
+            $objErr->arrErr["upper_rule"] = "利用条件(上限)は" . $arrPaymentData["upper_rule_max"] ."円以下にしてください。<br>";
+        }
+
+        // 利用条件チェック
+        $objErr->doFunc(array("利用条件(～円以上)", "利用条件(～円以下)", 'rule', "upper_rule"), array("GREATER_CHECK"));
+
+        return $objErr->arrErr;
+    }
+}
+?>
Index: branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment_Input.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment_Input.php	(revision 20540)
+++ 	(revision )
@@ -1,266 +1,0 @@
-<?php
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-// {{{ requires
-require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
-
-/**
- * 支払方法設定 のページクラス.
- *
- * @package Page
- * @author LOCKON CO.,LTD.
- * @version $Id$
- */
-class LC_Page_Admin_Basis_Payment_Input extends LC_Page_Admin_Ex {
-
-    // {{{ properties
-
-    /** SC_UploadFile インスタンス */
-    var $objUpFile;
-
-    // }}}
-    // {{{ functions
-
-    /**
-     * Page を初期化する.
-     *
-     * @return void
-     */
-    function init() {
-        parent::init();
-        $this->tpl_mainpage = 'basis/payment_input.tpl';
-        $this->tpl_subtitle = '支払方法設定';
-    }
-
-    /**
-     * Page のプロセス.
-     *
-     * @return void
-     */
-    function process() {
-        $this->action();
-        $this->sendResponse();
-    }
-
-    /**
-     * Page のアクション.
-     *
-     * @return void
-     */
-    function action() {
-        $objDb = new SC_Helper_DB_Ex();
-        $objFormParam = new SC_FormParam_Ex();
-
-        $mode = $this->getMode();
-
-        if (!empty($_POST) || !empty($_GET)) {
-            $this->lfInitParam($mode, $objFormParam);
-
-            $param = (empty($_POST))? $_GET : $_POST;
-
-            $objFormParam->setParam($param);
-            $objFormParam->convParam();
-
-            $this->arrErr = $objFormParam->checkError();
-            $post = $objFormParam->getHashArray();
-        }
-
-        // ファイル管理クラス
-        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR);
-        // ファイル情報の初期化
-        $this->objUpFile = $this->lfInitFile();
-        // Hiddenからのデータを引き継ぐ
-        $this->objUpFile->setHiddenFileList($_POST);
-
-        switch($mode) {
-        case 'edit':
-            $this->charge_flg = $post["charge_flg"];
-            if(count($this->arrErr) == 0) {
-                $this->lfRegistData($post['payment_id'], $_SESSION['member_id'], $objFormParam);
-                $this->objUpFile->moveTempFile();
-                $this->tpl_onload="fnUpdateParent('".ADMIN_PAYMENT_URLPATH."'); window.close();";
-            }
-
-            break;
-        // 画像のアップロード
-        case 'upload_image':
-            // ファイル存在チェック
-            $this->arrErr = $this->objUpFile->checkEXISTS($post['image_key']);
-            // 画像保存処理
-            $this->arrErr[$post['image_key']] = $this->objUpFile->makeTempFile($post['image_key']);
-            break;
-        // 画像の削除
-        case 'delete_image':
-
-            $this->objUpFile->deleteFile($post['image_key']);
-            break;
-
-        case 'pre_edit':
-                $arrRet = $this->lfGetData($post['payment_id']);
-
-                $objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("手数料", 'charge', PRICE_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("利用条件(～円以上)", 'rule', PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("固定", 'fix');
-                $objFormParam->setParam($arrRet);
-
-                $this->charge_flg = $arrRet["charge_flg"];
-                $this->objUpFile->setDBFileList($arrRet);
-                $this->tpl_payment_id = $post['payment_id'];
-            break;
-        default:
-            break;
-        }
-
-        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-            $this->tpl_payment_id = $_POST['payment_id'];
-        }
-
-        $this->arrForm = $objFormParam->getFormParamList();
-
-        // FORM表示用配列を渡す。
-        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URLPATH, IMAGE_SAVE_URLPATH);
-        // HIDDEN用に配列を渡す。
-        $this->arrHidden = array_merge((array)$this->arrHidden, (array)$this->objUpFile->getHiddenFileList());
-        $this->setTemplate($this->tpl_mainpage);
-    }
-
-    /**
-     * デストラクタ.
-     *
-     * @return void
-     */
-    function destroy() {
-        parent::destroy();
-    }
-
-    /* ファイル情報の初期化 */
-    function lfInitFile() {
-        $this->objUpFile->addFile("ロゴ画像", 'payment_image', array('gif'), IMAGE_SIZE, false, CLASS_IMAGE_WIDTH, CLASS_IMAGE_HEIGHT);
-        return $this->objUpFile;
-    }
-
-    /* パラメータ情報の初期化 */
-    function lfInitParam($mode, &$objFormParam) {
-
-        switch ($mode) {
-            case 'edit':
-                $objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("手数料", 'charge', PRICE_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("利用条件(～円以上)", 'rule', PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("固定", 'fix');
-                $objFormParam->addParam('支払いID', 'payment_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-                $objFormParam->addParam('課金フラグ', 'charge_flg', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-
-                break;
-            case "upload_image":
-            case "delete_image":
-                $objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("手数料", 'charge', PRICE_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("利用条件(～円以上)", 'rule', PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("固定", 'fix');
-                $objFormParam->addParam("画像キー", "image_key", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-
-                break;
-            case "pre_edit":
-                $objFormParam->addParam('支払いID', 'payment_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-                $objFormParam->addParam('課金フラグ', 'charge_flg', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-                break;
-
-            default:
-                break;
-        }
-    }
-
-    /* DBからデータを読み込む */
-    function lfGetData($payment_id) {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $where = "payment_id = ?";
-        $arrRet = $objQuery->select("*", "dtb_payment", $where, array($payment_id));
-        return $arrRet[0];
-    }
-
-    /* DBへデータを登録する */
-    function lfRegistData($payment_id = "", $member_id, &$objFormParam) {
-
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $sqlval = $objFormParam->getHashArray();
-        $arrRet = $this->objUpFile->getDBFileList();	// ファイル名の取得
-        $sqlval = array_merge($sqlval, $arrRet);
-        $sqlval['update_date'] = 'Now()';
-
-        if($sqlval['fix'] != '1') {
-            $sqlval['fix'] = 2;	// 自由設定
-        }
-
-        // 新規登録
-        if($payment_id == "") {
-            // INSERTの実行
-            $sqlval['creator_id'] = $member_id;
-            $sqlval['rank'] = $objQuery->max('rank', "dtb_payment") + 1;
-            $sqlval['create_date'] = 'Now()';
-            $sqlval['payment_id'] = $objQuery->nextVal('dtb_payment_payment_id');
-            $objQuery->insert("dtb_payment", $sqlval);
-        // 既存編集
-        } else {
-            $where = "payment_id = ?";
-            $objQuery->update("dtb_payment", $sqlval, $where, array($payment_id));
-        }
-    }
-
-    /*　利用条件の数値チェック */
-
-    /* 入力内容のチェック */
-    function lfCheckError($post) {
-
-        // DBのデータを取得
-        $arrPaymentData = $this->lfGetData($post['payment_id']);
-
-        // 手数料を設定できない場合には、手数料を0にする
-        if($arrPaymentData["charge_flg"] == 2) $this->objFormParam->setValue('charge', "0");
-
-        // 入力データを渡す。
-        $arrRet =  $this->objFormParam->getHashArray();
-        $objErr = new SC_CheckError_Ex($arrRet);
-        $objErr->arrErr = $this->objFormParam->checkError();
-
-        // 利用条件(下限)チェック
-        if($arrRet['rule'] < $arrPaymentData["rule_min"] and $arrPaymentData["rule_min"] != ""){
-            $objErr->arrErr['rule'] = "利用条件(下限)は" . $arrPaymentData["rule_min"] ."円以上にしてください。<br>";
-        }
-
-        // 利用条件(上限)チェック
-        if($arrRet["upper_rule"] > $arrPaymentData["upper_rule_max"] and $arrPaymentData["upper_rule_max"] != ""){
-            $objErr->arrErr["upper_rule"] = "利用条件(上限)は" . $arrPaymentData["upper_rule_max"] ."円以下にしてください。<br>";
-        }
-
-        // 利用条件チェック
-        $objErr->doFunc(array("利用条件(～円以上)", "利用条件(～円以下)", 'rule', "upper_rule"), array("GREATER_CHECK"));
-
-        return $objErr->arrErr;
-    }
-}
-?>
Index: branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery_Input.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery_Input.php	(revision 20541)
+++ 	(revision )
@@ -1,320 +1,0 @@
-<?php
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-// {{{ requires
-require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
-
-/**
- * 配送業者設定 のページクラス.
- *
- * @package Page
- * @author LOCKON CO.,LTD.
- * @version $Id$
- */
-class LC_Page_Admin_Basis_Delivery_Input extends LC_Page_Admin_Ex {
-    // }}}
-    // {{{ functions
-
-    /**
-     * Page を初期化する.
-     *
-     * @return void
-     */
-    function init() {
-        parent::init();
-        $this->tpl_mainpage = 'basis/delivery_input.tpl';
-        $this->tpl_subnavi = 'basis/subnavi.tpl';
-        $this->tpl_subno = 'delivery';
-        $this->tpl_mainno = 'basis';
-        $masterData = new SC_DB_MasterData_Ex();
-        $this->arrPref = $masterData->getMasterData('mtb_pref');
-        $this->arrProductType = $masterData->getMasterData("mtb_product_type");
-        $this->arrPayments = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
-        $this->tpl_subtitle = '配送業者設定';
-        $this->mode = $this->getMode();
-    }
-
-    /**
-     * Page のプロセス.
-     *
-     * @return void
-     */
-    function process() {
-        $this->action();
-        $this->sendResponse();
-    }
-
-    /**
-     * Page のアクション.
-     *
-     * @return void
-     */
-    function action() {
-        $objFormParam = new SC_FormParam_Ex();
-        $this->lfInitParam($this->mode, $objFormParam);
-        $objFormParam->setParam($_POST);
-
-        // 入力値の変換
-        $objFormParam->convParam();
-        $this->arrErr = $this->lfCheckError($objFormParam);
-
-        switch ($this->mode) {
-            case 'edit':
-                if (count($this->arrErr) == 0) {
-                    $objFormParam->setValue('deliv_id', $this->lfRegistData($objFormParam->getHashArray(), $_SESSION['member_id']));
-                    $this->tpl_onload = "window.alert('配送業者設定が完了しました。');";
-                }
-                break;
-            case 'pre_edit':
-                if (count($this->arrErr) > 0) {
-                    SC_Utils_Ex::sfDispException();
-                }
-                $this->lfGetDelivData($objFormParam);
-                break;
-            default:
-                break;
-        }
-
-        $this->arrForm = $objFormParam->getFormParamList();
-    }
-
-    /**
-     * デストラクタ.
-     *
-     * @return void
-     */
-    function destroy() {
-        parent::destroy();
-    }
-
-    /* パラメータ情報の初期化 */
-    function lfInitParam($mode, &$objFormParam) {
-        $objFormParam->initParam();
-
-        switch ($mode) {
-            case 'edit':
-                $objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-                $objFormParam->addParam("配送業者名", 'name', STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("名称", "service_name", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("説明", 'remark', LLTEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("伝票No.確認URL", "confirm_url", STEXT_LEN, 'n', array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
-                $objFormParam->addParam("取扱商品種別", "product_type_id", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objFormParam->addParam("取扱支払方法", "payment_ids", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-
-                for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
-                    $objFormParam->addParam("お届け時間$cnt", "deliv_time$cnt", STEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
-                }
-
-                if(INPUT_DELIV_FEE) {
-                    for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
-                        $objFormParam->addParam("配送料金$cnt", "fee$cnt", PRICE_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-                    }
-                }
-                break;
-
-            case 'pre_edit':
-                $objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-                break;
-
-            default:
-                break;
-        }
-    }
-
-    /**
-     * 配送情報を登録する
-     *
-     * @return $deliv_id
-     */
-    function lfRegistData($arrRet, $member_id) {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $objQuery->begin();
-
-        // 入力データを渡す。
-        $sqlval['name'] = $arrRet['name'];
-        $sqlval['service_name'] = $arrRet['service_name'];
-        $sqlval['remark'] = $arrRet['remark'];
-        $sqlval['confirm_url'] = $arrRet['confirm_url'];
-        $sqlval['product_type_id'] = $arrRet['product_type_id'];
-        $sqlval['creator_id'] = $member_id;
-        $sqlval['update_date'] = 'Now()';
-
-        // deliv_id が決まっていた場合
-        if($arrRet['deliv_id'] != "") {
-            $deliv_id = $arrRet['deliv_id'];
-            $where = "deliv_id = ?";
-            $objQuery->update("dtb_deliv", $sqlval, $where, array($deliv_id));
-
-            // お届け時間の登録
-            $table = "dtb_delivtime";
-            $where = "deliv_id = ? AND time_id = ?";
-            for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
-                $sqlval = array();
-                $keyname = "deliv_time".$cnt;
-                $arrval = array($deliv_id, $cnt);
-                // 既存データの有無を確認
-                $curData = $objQuery->select("*", $table, $where, $arrval);
-
-                if(strcmp($arrRet[$keyname], "") != 0) {
-                    $sqlval['deliv_time'] = $arrRet[$keyname];
-
-                    // 入力が空ではなく、DBに情報があれば更新
-                    if(count($curData)) {
-                        $objQuery->update($table, $sqlval, $where, $arrval);
-                    }
-                    // DBに情報がなければ登録
-                    else {
-                        $sqlval['deliv_id'] = $deliv_id;
-                        $sqlval['time_id'] = $cnt;
-                        $objQuery->insert($table, $sqlval);
-                    }
-                }
-                // 入力が空で、DBに情報がある場合は削除
-                else if(count($curData)) {
-                    $objQuery->delete($table, $where, $arrval);
-                }
-            }
-
-            // 配送料の登録
-            if(INPUT_DELIV_FEE) {
-                for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
-                    $keyname = 'fee'.$cnt;
-                    if(strcmp($arrRet[$keyname], "") != 0) {
-                        $sqlval = array('fee' => $arrRet[$keyname]);
-                        $objQuery->update("dtb_delivfee", $sqlval, "deliv_id = ? AND fee_id = ?", array($deliv_id, $cnt));
-                    }
-                }
-            }
-        }
-        else {
-            // 登録する配送業者IDの取得
-            $deliv_id = $objQuery->nextVal('dtb_deliv_deliv_id');
-            $sqlval['deliv_id'] = $deliv_id;
-            $sqlval['rank'] = $objQuery->max('rank', "dtb_deliv") + 1;
-            $sqlval['create_date'] = 'Now()';
-            // INSERTの実行
-            $objQuery->insert("dtb_deliv", $sqlval);
-
-            $sqlval = array();
-            // お届け時間の設定
-            for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
-                $keyname = "deliv_time$cnt";
-                if($arrRet[$keyname] != "") {
-                    $sqlval['deliv_id'] = $deliv_id;
-                    $sqlval['time_id'] = $cnt;
-                    $sqlval['deliv_time'] = $arrRet[$keyname];
-                    // INSERTの実行
-                    $objQuery->insert("dtb_delivtime", $sqlval);
-                }
-            }
-
-            if(INPUT_DELIV_FEE) {
-                $sqlval = array();
-                // 配送料金の設定
-                for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
-                    $keyname = "fee$cnt";
-                    if($arrRet[$keyname] != "") {
-                        $sqlval['deliv_id'] = $deliv_id;
-                        $sqlval['fee'] = $arrRet[$keyname];
-                        $sqlval['pref'] = $cnt;
-                        // INSERTの実行
-                        $sqlval['fee_id'] = $cnt;
-                        $objQuery->insert("dtb_delivfee", $sqlval);
-                    }
-                }
-            }
-        }
-
-        $objQuery->delete('dtb_payment_options', 'deliv_id = ?', array($arrRet['deliv_id']));
-        $sqlval = array();
-        $i = 1;
-        foreach ($arrRet['payment_ids'] as $val) {
-            $sqlval['deliv_id'] = $deliv_id;
-            $sqlval['payment_id'] = $val;
-            $sqlval['rank'] = $i;
-            $objQuery->insert('dtb_payment_options', $sqlval);
-            $i++;
-        }
-        $objQuery->commit();
-        return $deliv_id;
-    }
-
-    /* 配送業者情報の取得 */
-    function lfGetDelivData(&$objFormParam) {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-
-        $deliv_id = $objFormParam->getValue('deliv_id');
-
-        // パラメータ情報の初期化
-        $this->lfInitParam('edit', $objFormParam);
-
-        // 配送業者一覧の取得
-        $col = "deliv_id, name, service_name, remark, confirm_url, product_type_id";
-        $where = "deliv_id = ?";
-        $table = "dtb_deliv";
-        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
-        $objFormParam->setParam($arrRet[0]);
-        // お届け時間の取得
-        $col = "deliv_time";
-        $where = "deliv_id = ?  ORDER BY time_id";
-        $table = "dtb_delivtime";
-        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
-        $objFormParam->setParamList($arrRet, 'deliv_time');
-        // 配送料金の取得
-        $col = 'fee';
-        $where = "deliv_id = ? ORDER BY pref";
-        $table = "dtb_delivfee";
-        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
-        $objFormParam->setParamList($arrRet, 'fee');
-        // 支払方法
-        $col = 'payment_id';
-        $where = 'deliv_id = ? ORDER BY rank';
-        $table = 'dtb_payment_options';
-        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
-        $arrPaymentIds = array();
-        foreach ($arrRet as $val) {
-            $arrPaymentIds[] = $val['payment_id'];
-        }
-        $objFormParam->setValue('payment_ids', $arrPaymentIds);
-    }
-
-    /* 入力内容のチェック */
-    function lfCheckError(&$objFormParam) {
-        // 入力データを渡す。
-        $arrRet =  $objFormParam->getHashArray();
-        $objErr = new SC_CheckError_Ex($arrRet);
-        $objErr->arrErr = $objFormParam->checkError();
-
-        if(!isset($objErr->arrErr['name']) && $arrRet['deliv_id'] == "") {
-            // 既存チェック
-            $objDb = new SC_Helper_DB_Ex();
-            $ret = $objDb->sfIsRecord("dtb_deliv", "service_name", array($arrRet['service_name']));
-            if ($ret) {
-                $objErr->arrErr['name'] = "※ 同じ名称の組み合わせは登録できません。<br>";
-            }
-        }
-
-        return $objErr->arrErr;
-    }
-}
-?>
Index: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_UpDown.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_UpDown.php	(revision 20543)
+++ branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_UpDown.php	(revision 20543)
@@ -0,0 +1,263 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
+require_once DATA_REALDIR. 'module/Tar.php';
+require_once CLASS_EX_REALDIR . 'helper_extends/SC_Helper_FileManager_Ex.php';
+
+/**
+ * テンプレートアップロード のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Design_UpDown extends LC_Page_Admin_Ex {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'design/up_down.tpl';
+        $this->tpl_subnavi  = 'design/subnavi.tpl';
+        $this->tpl_subno    = 'up_down';
+        $this->tpl_mainno   = 'design';
+        $this->tpl_subtitle = 'テンプレート追加';
+        $this->arrErr  = array();
+        $this->arrForm = array();
+        ini_set("max_execution_time", 300);
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $this->action();
+        $this->sendResponse();
+    }
+
+    /**
+     * Page のアクション.
+     *
+     * FIXME ロジックを見直し
+     *
+     * @return void
+     */
+    function action() {
+        // 端末種別IDを取得
+        if (isset($_REQUEST['device_type_id'])
+            && is_numeric($_REQUEST['device_type_id'])) {
+            $device_type_id = $_REQUEST['device_type_id'];
+        } else {
+            $device_type_id = DEVICE_TYPE_PC;
+        }
+
+        switch($this->getMode()) {
+
+            // ダウンロードボタン押下時の処理
+        case 'download':
+            break;
+            // アップロードボタン押下時の処理
+        case 'upload':
+            // フォームパラメータ初期化
+            $objForm = $this->lfInitUpload();
+            // エラーチェック
+            if ($arrErr = $this->lfValidateUpload($objForm)) {
+                $this->arrErr  = $arrErr;
+                $this->arrForm = $objForm->getFormParamList();
+                break;
+            }
+            // アップロードファイル初期化
+            $objUpFile = $this->lfInitUploadFile($objForm);
+            // 一時ファイルへ保存
+            $errMsg = $objUpFile->makeTempFile('template_file', false);
+            // 書き込みエラーチェック
+            if(isset($errMsg)) {
+                $this->arrErr['template_file'] = $errMsg;
+                $this->arrForm = $objForm->getFormParamList();
+                break;
+            }
+            $this->lfAddTemplates($objForm, $objUpFile, $device_type_id);
+            $this->tpl_onload = "alert('テンプレートファイルをアップロードしました。');";
+            break;
+
+            // 初回表示
+        default:
+            break;
+        }
+        $this->device_type_id = $device_type_id;
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /**
+     * SC_UploadFileクラスの初期化.
+     *
+     * @param object $objForm SC_FormParamのインスタンス
+     * @return object SC_UploadFileのインスタンス
+     */
+    function lfInitUploadFile($objForm) {
+        $pkg_dir = SMARTY_TEMPLATES_REALDIR . $objForm->getValue('template_code');
+        $objUpFile = new SC_UploadFile_Ex(TEMPLATE_TEMP_REALDIR, $pkg_dir);
+        $objUpFile->addFile("テンプレートファイル", 'template_file', array(), TEMPLATE_SIZE, true, 0, 0, false);
+
+        return $objUpFile;
+    }
+    /**
+     * SC_FormParamクラスの初期化.
+     *
+     * @param void
+     * @return object SC_FormParamのインスタンス
+     */
+    function lfInitUpload() {
+        $objForm = new SC_FormParam;
+
+        $objForm->addParam("テンプレートコード", "template_code", STEXT_LEN, 'KVa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK"));
+        $objForm->addParam("テンプレート名", "template_name", STEXT_LEN, 'KVa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $objForm->setParam($_POST);
+
+        return $objForm;
+    }
+    /**
+     * uploadモードのパラメータ検証を行う.
+     *
+     * @param object $objForm SC_FormParamのインスタンス
+     * @return array エラー情報を格納した連想配列, エラーが無ければ(多分)nullを返す
+     */
+    function lfValidateUpload($objForm) {
+        $arrErr = $objForm->checkError();
+        if (!empty($arrErr)) {
+            return $arrErr;
+        }
+
+        $arrForm = $objForm->getHashArray();
+
+        // 同名のフォルダが存在する場合はエラー
+        if(file_exists(USER_TEMPLATE_REALDIR . $arrForm['template_code'])) {
+            $arrErr['template_code'] = "※ 同名のファイルがすでに存在します。<br/>";
+        }
+
+        // 登録不可の文字列チェック
+        $arrIgnoreCode = array('admin',
+                               MOBILE_DEFAULT_TEMPLATE_NAME,
+                               SMARTPHONE_DEFAULT_TEMPLATE_NAME,
+                               DEFAULT_TEMPLATE_NAME);
+        if(in_array($arrForm['template_code'], $arrIgnoreCode)) {
+            $arrErr['template_code'] = "※ このテンプレートコードは使用できません。<br/>";
+        }
+
+        // DBにすでに登録されていないかチェック
+        $objQuery = new SC_Query_Ex();
+        $ret = $objQuery->count("dtb_templates", "template_code = ?", array($arrForm['template_code']));
+        if(!empty($ret)) {
+            $arrErr['template_code'] = "※ すでに登録されているテンプレートコードです。<br/>";
+        }
+
+        // ファイルの拡張子チェック(.tar/tar.gzのみ許可)
+        $errFlag = true;
+        $array_ext = explode(".", $_FILES['template_file']['name']);
+        $ext = $array_ext[ count ( $array_ext ) - 1 ];
+        $ext = strtolower($ext);
+        // .tarチェック
+        if ($ext == 'tar') {
+            $errFlag = false;
+        }
+        $ext = $array_ext[ count ( $array_ext ) - 2 ].".".$ext;
+        $ext = strtolower($ext);
+        // .tar.gzチェック
+        if ($ext== 'tar.gz') {
+            $errFlag = false;
+        }
+
+        if($errFlag) {
+            $arrErr['template_file'] = "※ アップロードするテンプレートファイルで許可されている形式は、tar/tar.gzです。<br />";
+        }
+
+        return $arrErr;
+    }
+    /**
+     * DBおよびファイルシステムにテンプレートパッケージを追加する.
+     *
+     * @param object $objForm SC_FormParamのインスタンス
+     * @param object $objUpFile SC_UploadFileのインスタンス
+     * @return void
+     */
+    function lfAddTemplates($objForm, $objUpFile, $device_type_id) {
+        $template_code = $objForm->getValue('template_code');
+        $template_dir = SMARTY_TEMPLATES_REALDIR . $template_code;
+        $compile_dir  = DATA_REALDIR . "Smarty/templates_c/" . $template_code;
+        // フォルダ作成
+        if(!file_exists($template_dir)) {
+            mkdir($template_dir);
+        }
+        if(!file_exists($compile_dir)) {
+            mkdir($compile_dir);
+        }
+
+        // 一時フォルダから保存ディレクトリへ移動
+        $objUpFile->moveTempFile();
+
+        // 解凍
+        SC_Helper_FileManager_Ex::unpackFile($template_dir . "/" . $_FILES['template_file']['name']);
+        // ユーザデータの下のファイルをコピーする
+        $from_dir = SMARTY_TEMPLATES_REALDIR . $template_code . "/_packages/";
+        $to_dir = USER_REALDIR . "packages/" . $template_code . "/";
+        SC_Utils_Ex::sfMakeDir($to_dir);
+        SC_Utils_Ex::sfCopyDir($from_dir, $to_dir);
+
+        // DBにテンプレート情報を保存
+        $this->lfRegisterTemplates($objForm->getHashArray(), $device_type_id);
+    }
+
+    /**
+     * dtb_templatesへ入力内容を登録する.
+     *
+     * @param array $arrForm POSTされたパラメータ
+     * @return void
+     */
+    function lfRegisterTemplates($arrForm, $device_type_id) {
+        $objQuery = new SC_Query_Ex();
+        $sqlval = $arrForm;
+        $sqlval['device_type_id'] = $device_type_id;
+        $sqlval['create_date'] = "now()";
+        $sqlval['update_date'] = "now()";
+        $objQuery->insert('dtb_templates', $sqlval);
+    }
+}
+?>
Index: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Up_Down.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Up_Down.php	(revision 20538)
+++ 	(revision )
@@ -1,263 +1,0 @@
-<?php
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-// {{{ requires
-require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
-require_once DATA_REALDIR. 'module/Tar.php';
-require_once CLASS_EX_REALDIR . 'helper_extends/SC_Helper_FileManager_Ex.php';
-
-/**
- * テンプレートアップロード のページクラス.
- *
- * @package Page
- * @author LOCKON CO.,LTD.
- * @version $Id$
- */
-class LC_Page_Admin_Design_Up_Down extends LC_Page_Admin_Ex {
-
-    // }}}
-    // {{{ functions
-
-    /**
-     * Page を初期化する.
-     *
-     * @return void
-     */
-    function init() {
-        parent::init();
-        $this->tpl_mainpage = 'design/up_down.tpl';
-        $this->tpl_subnavi  = 'design/subnavi.tpl';
-        $this->tpl_subno    = 'up_down';
-        $this->tpl_mainno   = 'design';
-        $this->tpl_subtitle = 'テンプレート追加';
-        $this->arrErr  = array();
-        $this->arrForm = array();
-        ini_set("max_execution_time", 300);
-    }
-
-    /**
-     * Page のプロセス.
-     *
-     * @return void
-     */
-    function process() {
-        $this->action();
-        $this->sendResponse();
-    }
-
-    /**
-     * Page のアクション.
-     *
-     * FIXME ロジックを見直し
-     *
-     * @return void
-     */
-    function action() {
-        // 端末種別IDを取得
-        if (isset($_REQUEST['device_type_id'])
-            && is_numeric($_REQUEST['device_type_id'])) {
-            $device_type_id = $_REQUEST['device_type_id'];
-        } else {
-            $device_type_id = DEVICE_TYPE_PC;
-        }
-
-        switch($this->getMode()) {
-
-            // ダウンロードボタン押下時の処理
-        case 'download':
-            break;
-            // アップロードボタン押下時の処理
-        case 'upload':
-            // フォームパラメータ初期化
-            $objForm = $this->lfInitUpload();
-            // エラーチェック
-            if ($arrErr = $this->lfValidateUpload($objForm)) {
-                $this->arrErr  = $arrErr;
-                $this->arrForm = $objForm->getFormParamList();
-                break;
-            }
-            // アップロードファイル初期化
-            $objUpFile = $this->lfInitUploadFile($objForm);
-            // 一時ファイルへ保存
-            $errMsg = $objUpFile->makeTempFile('template_file', false);
-            // 書き込みエラーチェック
-            if(isset($errMsg)) {
-                $this->arrErr['template_file'] = $errMsg;
-                $this->arrForm = $objForm->getFormParamList();
-                break;
-            }
-            $this->lfAddTemplates($objForm, $objUpFile, $device_type_id);
-            $this->tpl_onload = "alert('テンプレートファイルをアップロードしました。');";
-            break;
-
-            // 初回表示
-        default:
-            break;
-        }
-        $this->device_type_id = $device_type_id;
-    }
-
-    /**
-     * デストラクタ.
-     *
-     * @return void
-     */
-    function destroy() {
-        parent::destroy();
-    }
-
-    /**
-     * SC_UploadFileクラスの初期化.
-     *
-     * @param object $objForm SC_FormParamのインスタンス
-     * @return object SC_UploadFileのインスタンス
-     */
-    function lfInitUploadFile($objForm) {
-        $pkg_dir = SMARTY_TEMPLATES_REALDIR . $objForm->getValue('template_code');
-        $objUpFile = new SC_UploadFile_Ex(TEMPLATE_TEMP_REALDIR, $pkg_dir);
-        $objUpFile->addFile("テンプレートファイル", 'template_file', array(), TEMPLATE_SIZE, true, 0, 0, false);
-
-        return $objUpFile;
-    }
-    /**
-     * SC_FormParamクラスの初期化.
-     *
-     * @param void
-     * @return object SC_FormParamのインスタンス
-     */
-    function lfInitUpload() {
-        $objForm = new SC_FormParam;
-
-        $objForm->addParam("テンプレートコード", "template_code", STEXT_LEN, 'KVa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK"));
-        $objForm->addParam("テンプレート名", "template_name", STEXT_LEN, 'KVa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $objForm->setParam($_POST);
-
-        return $objForm;
-    }
-    /**
-     * uploadモードのパラメータ検証を行う.
-     *
-     * @param object $objForm SC_FormParamのインスタンス
-     * @return array エラー情報を格納した連想配列, エラーが無ければ(多分)nullを返す
-     */
-    function lfValidateUpload($objForm) {
-        $arrErr = $objForm->checkError();
-        if (!empty($arrErr)) {
-            return $arrErr;
-        }
-
-        $arrForm = $objForm->getHashArray();
-
-        // 同名のフォルダが存在する場合はエラー
-        if(file_exists(USER_TEMPLATE_REALDIR . $arrForm['template_code'])) {
-            $arrErr['template_code'] = "※ 同名のファイルがすでに存在します。<br/>";
-        }
-
-        // 登録不可の文字列チェック
-        $arrIgnoreCode = array('admin',
-                               MOBILE_DEFAULT_TEMPLATE_NAME,
-                               SMARTPHONE_DEFAULT_TEMPLATE_NAME,
-                               DEFAULT_TEMPLATE_NAME);
-        if(in_array($arrForm['template_code'], $arrIgnoreCode)) {
-            $arrErr['template_code'] = "※ このテンプレートコードは使用できません。<br/>";
-        }
-
-        // DBにすでに登録されていないかチェック
-        $objQuery = new SC_Query_Ex();
-        $ret = $objQuery->count("dtb_templates", "template_code = ?", array($arrForm['template_code']));
-        if(!empty($ret)) {
-            $arrErr['template_code'] = "※ すでに登録されているテンプレートコードです。<br/>";
-        }
-
-        // ファイルの拡張子チェック(.tar/tar.gzのみ許可)
-        $errFlag = true;
-        $array_ext = explode(".", $_FILES['template_file']['name']);
-        $ext = $array_ext[ count ( $array_ext ) - 1 ];
-        $ext = strtolower($ext);
-        // .tarチェック
-        if ($ext == 'tar') {
-            $errFlag = false;
-        }
-        $ext = $array_ext[ count ( $array_ext ) - 2 ].".".$ext;
-        $ext = strtolower($ext);
-        // .tar.gzチェック
-        if ($ext== 'tar.gz') {
-            $errFlag = false;
-        }
-
-        if($errFlag) {
-            $arrErr['template_file'] = "※ アップロードするテンプレートファイルで許可されている形式は、tar/tar.gzです。<br />";
-        }
-
-        return $arrErr;
-    }
-    /**
-     * DBおよびファイルシステムにテンプレートパッケージを追加する.
-     *
-     * @param object $objForm SC_FormParamのインスタンス
-     * @param object $objUpFile SC_UploadFileのインスタンス
-     * @return void
-     */
-    function lfAddTemplates($objForm, $objUpFile, $device_type_id) {
-        $template_code = $objForm->getValue('template_code');
-        $template_dir = SMARTY_TEMPLATES_REALDIR . $template_code;
-        $compile_dir  = DATA_REALDIR . "Smarty/templates_c/" . $template_code;
-        // フォルダ作成
-        if(!file_exists($template_dir)) {
-            mkdir($template_dir);
-        }
-        if(!file_exists($compile_dir)) {
-            mkdir($compile_dir);
-        }
-
-        // 一時フォルダから保存ディレクトリへ移動
-        $objUpFile->moveTempFile();
-
-        // 解凍
-        SC_Helper_FileManager_Ex::unpackFile($template_dir . "/" . $_FILES['template_file']['name']);
-        // ユーザデータの下のファイルをコピーする
-        $from_dir = SMARTY_TEMPLATES_REALDIR . $template_code . "/_packages/";
-        $to_dir = USER_REALDIR . "packages/" . $template_code . "/";
-        SC_Utils_Ex::sfMakeDir($to_dir);
-        SC_Utils_Ex::sfCopyDir($from_dir, $to_dir);
-
-        // DBにテンプレート情報を保存
-        $this->lfRegisterTemplates($objForm->getHashArray(), $device_type_id);
-    }
-
-    /**
-     * dtb_templatesへ入力内容を登録する.
-     *
-     * @param array $arrForm POSTされたパラメータ
-     * @return void
-     */
-    function lfRegisterTemplates($arrForm, $device_type_id) {
-        $objQuery = new SC_Query_Ex();
-        $sqlval = $arrForm;
-        $sqlval['device_type_id'] = $device_type_id;
-        $sqlval['create_date'] = "now()";
-        $sqlval['update_date'] = "now()";
-        $objQuery->insert('dtb_templates', $sqlval);
-    }
-}
-?>
