Index: anches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php
===================================================================
--- /branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getDelivTest.php	(revision 22206)
+++ 	(revision )
@@ -1,87 +1,0 @@
-<?php
-
-$HOME = realpath(dirname(__FILE__)) . "/../../../..";
-require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php");
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2013 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.
- */
-
-/**
- * SC_Helper_Purchase::getDeliv()のテストクラス.
- *
- *
- * @author Hiroko Tamagawa
- * @version $Id$
- */
-class SC_Helper_Purchase_getDelivTest extends SC_Helper_Purchase_TestBase {
-
-
-  protected function setUp() {
-    parent::setUp();
-    $this->setUpDeliv();
-  }
-
-  protected function tearDown() {
-    parent::tearDown();
-  }
-
-  /////////////////////////////////////////
-  public function testGetDeliv_存在しない商品種別IDを指定した場合_結果が空になる() {
-    $product_type_id = '9999'; // 存在しないID
-
-    $this->expected = array();
-    $helper = new SC_Helper_Purchase();
-    $this->actual = $helper->getDeliv($product_type_id);
-
-    $this->verify('配送業者');
-  }
-
-  public function testGetDeliv_存在する商品種別IDを指定した場合_結果が正しい順序で取得できる() {
-    $product_type_id = '1001';
-  
-    $this->expected['count'] = 2;
-    $this->expected['first'] = array(
-      'deliv_id' => '1002',
-      'product_type_id' => '1001',
-      'name' => '配送業者02',
-      'rank' => '3'
-    );
-    $this->expected['second'] = array(
-      'deliv_id' => '1001',
-      'product_type_id' => '1001',
-      'name' => '配送業者01',
-      'rank' => '2'
-    );
-
-    $helper = new SC_Helper_Purchase();
-    $result = $helper->getDeliv($product_type_id);
-    $this->actual['count'] = count($result);
-    $cols = array('deliv_id', 'product_type_id', 'name', 'rank');
-    $this->actual['first'] = Test_Utils::mapArray($result[0], $cols);
-    $this->actual['second'] = Test_Utils::mapArray($result[1], $cols);
-
-    $this->verify('配送業者');
-  }
-
-  //////////////////////////////////////////
-
-}
-
Index: /branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 22538)
+++ /branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 22553)
@@ -81,4 +81,5 @@
         $objCustomer = new SC_Customer_Ex();
         $objFormParam = new SC_FormParam_Ex();
+        $objDelivery = new SC_Helper_Delivery_Ex();
 
         $this->is_multiple = $objPurchase->isMultiple();
@@ -93,5 +94,5 @@
 
         // 配送業者を取得
-        $this->arrDeliv = $objPurchase->getDeliv($cart_key);
+        $this->arrDeliv = $objDelivery->getList($cart_key);
         $this->is_single_deliv = $this->isSingleDeliv($this->arrDeliv);
 
Index: /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php	(revision 22537)
+++ /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php	(revision 22553)
@@ -149,8 +149,8 @@
      */
     function lfRegistData($arrRet, $member_id) {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $objQuery->begin();
+        $objDelivery = new SC_Helper_Delivery_Ex();
 
         // 入力データを渡す。
+        $sqlval['deliv_id'] = $arrRet['deliv_id'];
         $sqlval['name'] = $arrRet['name'];
         $sqlval['service_name'] = $arrRet['service_name'];
@@ -161,100 +161,43 @@
         $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
 
-        // 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;
-                $arrWhereVal = array($deliv_id, $cnt);
-                // 既存データの有無を確認
-                $curData = $objQuery->select('*', $table, $where, $arrWhereVal);
-
-                if (strcmp($arrRet[$keyname], '') != 0) {
-                    $sqlval['deliv_time'] = $arrRet[$keyname];
-
-                    // 入力が空ではなく、DBに情報があれば更新
-                    if (count($curData)) {
-                        $objQuery->update($table, $sqlval, $where, $arrWhereVal);
-                    }
-                    // DBに情報がなければ登録
-                    else {
-                        $sqlval['deliv_id'] = $deliv_id;
-                        $sqlval['time_id'] = $cnt;
-                        $objQuery->insert($table, $sqlval);
-                    }
-                }
-                // 入力が空で、DBに情報がある場合は削除
-                else if (count($curData)) {
-                    $objQuery->delete($table, $where, $arrWhereVal);
-                }
+        // お届け時間
+        $sqlval['deliv_time'] = array();
+        for ($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+            $keyname = "deliv_time$cnt";
+            if ($arrRet[$keyname] != '') {
+                $deliv_time = array();
+                $deliv_time['deliv_time'] = $arrRet[$keyname];
+                $sqlval['deliv_time'][$cnt] = $deliv_time;
             }
-
-            // 配送料の登録
-            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));
-                    }
+        }
+
+        // 配送料
+        if (INPUT_DELIV_FEE) {
+            $sqlval['deliv_fee'] = array();
+            // 配送料金の設定
+            for ($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+                $keyname = "fee$cnt";
+                if ($arrRet[$keyname] != '') {
+                    $fee = array();
+                    $fee['fee'] = $arrRet[$keyname];
+                    $fee['pref'] = $cnt;
+                    $sqlval['deliv_fee'][$cnt] = $fee;
                 }
             }
-        } 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'] = 'CURRENT_TIMESTAMP';
-            // 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();
+        }
+
+        // 支払い方法
+        $sqlval['payment_ids'] = 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);
+            $payment_ids = array();
+            $payment_ids['payment_id'] = $val;
+            $payment_ids['rank'] = $i;
+            $sqlval['payment_ids'][] = $payment_ids;
             $i++;
         }
-        $objQuery->commit();
+
+        $deliv_id = $objDelivery->save($sqlval);
+
         return $deliv_id;
     }
@@ -263,4 +206,5 @@
     function lfGetDelivData(&$objFormParam) {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $objDelivery = new SC_Helper_Delivery_Ex();
 
         $deliv_id = $objFormParam->getValue('deliv_id');
@@ -269,32 +213,17 @@
         $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');
+        $arrDeliv = $objDelivery->get($deliv_id);
+
+        // お届け時間
+        $objFormParam->setParamList($arrDeliv['deliv_time'], 'deliv_time');
+        unset($arrDeliv['deliv_time']);
+        // 配送料金
+        $objFormParam->setParamList($arrDeliv['fee'], 'fee');
+        unset($arrDeliv['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);
+        $objFormParam->setValue('payment_ids', $arrDeliv['payment_ids']);
+        unset($arrDeliv['payment_ids']);
+        // 配送業者
+        $objFormParam->setParam($arrDeliv);
     }
 
@@ -308,12 +237,6 @@
         if (!isset($objErr->arrErr['name'])) {
             // 既存チェック
-            $objDb = new SC_Helper_DB_Ex();
-            if ($arrRet['deliv_id'] == '') {
-                $ret = $objDb->sfIsRecord('dtb_deliv', 'service_name', array($arrRet['service_name']));
-            } else {
-                $objQuery =& SC_Query_Ex::getSingletonInstance();
-                $ret = (($objQuery->count('dtb_deliv', 'deliv_id != ? AND service_name = ? ', array($arrRet['deliv_id'], $arrRet['service_name'])) > 0)? true : false);
-            }
-            if ($ret) {
+            $objDelivery = new SC_Helper_Delivery_Ex();
+            if ($objDelivery->checkExist($arrRet)) {
                 $objErr->arrErr['service_name'] = '※ 同じ名称の組み合わせは登録できません。<br>';
             }
Index: /branches/version-2_12-dev/data/class/SC_CartSession.php
===================================================================
--- /branches/version-2_12-dev/data/class/SC_CartSession.php	(revision 22358)
+++ /branches/version-2_12-dev/data/class/SC_CartSession.php	(revision 22553)
@@ -508,4 +508,6 @@
     function checkProducts($productTypeId) {
         $objProduct = new SC_Product_Ex();
+        $objDelivery = new SC_Helper_Delivery_Ex();
+        $arrDeliv = $objDelivery->getList($productTypeId);
         $tpl_message = '';
 
@@ -525,5 +527,4 @@
                  * 配送業者のチェック
                  */
-                $arrDeliv = SC_Helper_Purchase_Ex::getDeliv($productTypeId);
                 if (SC_Utils_Ex::isBlank($arrDeliv)) {
                     $tpl_message .= '※「' . $product['name'] . '」はまだ配送の準備ができておりません。';
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php	(revision 22537)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php	(revision 22553)
@@ -673,17 +673,4 @@
 
     /**
-     * 商品種別ID から配送業者を取得する.
-     *
-     * @param integer $product_type_id 商品種別ID
-     * @return array 配送業者の配列
-     */
-    function getDeliv($product_type_id) {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $objQuery->setOrder('rank DESC');
-        return $objQuery->select('*', 'dtb_deliv', 'product_type_id = ? AND del_flg = 0',
-                                 array($product_type_id));
-    }
-
-    /**
      * 配送業者ID から, 有効な支払方法IDを取得する.
      *
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Delivery.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Delivery.php	(revision 22543)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Delivery.php	(revision 22553)
@@ -31,22 +31,182 @@
 class SC_Helper_Delivery
 {
+    /**
+     * 配送方法の情報を取得.
+     * 
+     * @param integer $deliv_id 配送方法ID
+     * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false
+     * @return array
+     */
+    public function get($deliv_id, $has_deleted = false) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+        // 配送業者一覧の取得
+        $col = 'deliv_id, name, service_name, remark, confirm_url, product_type_id';
+        $where = 'deliv_id = ?';
+        if (!$has_deleted) {
+            $where .= ' AND del_flg = 0';
+        }
+        $table = 'dtb_deliv';
+        $arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+        $arrDeliv = $arrRet[0];
+        if (!$arrDeliv) {
+            return $arrDeliv;
+        }
+
+        // お届け時間の取得
+        $col = 'deliv_time';
+        $where = 'deliv_id = ? ORDER BY time_id';
+        $table = 'dtb_delivtime';
+        $arrDeliv['deliv_time'] = $objQuery->select($col, $table, $where, array($deliv_id));
+
+        // 配送料金の取得
+        $col = 'fee';
+        $where = 'deliv_id = ? ORDER BY pref';
+        $table = 'dtb_delivfee';
+        $arrDeliv['fee'] = $objQuery->select($col, $table, $where, array($deliv_id));
+
+        // 支払方法
+        $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'];
+        }
+        $arrDeliv['payment_ids'] = $arrPaymentIds;
+
+        return $arrDeliv;
+    }
 
     /**
      * 配送方法一覧の取得.
      *
+     * @param integer $product_type_id 商品種別ID
      * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false
      * @return array
      */
-    public function getList($has_deleted = false) {
+    public function getList($product_type_id = null, $has_deleted = false) {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $col = '*';
         $where = '';
+        $arrVal = array();
         if (!$has_deleted) {
             $where .= 'del_flg = 0';
         }
+        if (!is_null($product_type_id)) {
+            if (!$has_deleted) {
+                $where .= ' AND ';
+            }
+            $where .= 'product_type_id = ?';
+            $arrVal[] = $product_type_id;
+        }
         $table = 'dtb_deliv';
         $objQuery->setOrder('rank DESC');
-        $arrRet = $objQuery->select($col, $table, $where);
+        $arrRet = $objQuery->select($col, $table, $where, $arrVal);
         return $arrRet;
+    }
+
+    /**
+     * 配送方法の登録.
+     * 
+     * @param array $sqlval
+     * @return integer $deliv_id
+     */
+    public function save($sqlval) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $objQuery->begin();
+
+        // お届け時間
+        $sqlval_deliv_time = $sqlval['deliv_time'];
+        unset($sqlval['deliv_time']);
+        // 配送料
+        if (INPUT_DELIV_FEE) {
+            $sqlval_deliv_fee = $sqlval['deliv_fee'];
+        }
+        unset($sqlval['deliv_fee']);
+        // 支払い方法
+        $sqlval_payment_ids = $sqlval['payment_ids'];
+        unset($sqlval['payment_ids']);
+
+        // deliv_id が決まっていた場合
+        if ($sqlval['deliv_id'] != '') {
+            $deliv_id = $sqlval['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++) {
+                $keyname = 'deliv_time'.$cnt;
+                $arrWhereVal = array($deliv_id, $cnt);
+                // 既存データの有無を確認
+                $curData = $objQuery->select('*', $table, $where, $arrWhereVal);
+
+                if (isset($sqlval_deliv_time[$cnt])) {
+                    $deliv_time = $sqlval_deliv_time[$cnt];
+
+                    // 入力が空ではなく、DBに情報があれば更新
+                    if (count($curData)) {
+                        $objQuery->update($table, $deliv_time, $where, $arrWhereVal);
+                    }
+                    // DBに情報がなければ登録
+                    else {
+                        $deliv_time['deliv_id'] = $deliv_id;
+                        $deliv_time['time_id'] = $cnt;
+                        $objQuery->insert($table, $deliv_time);
+                    }
+                }
+                // 入力が空で、DBに情報がある場合は削除
+                else if (count($curData)) {
+                    $objQuery->delete($table, $where, $arrWhereVal);
+                }
+            }
+
+            // 配送料の登録
+            if (INPUT_DELIV_FEE) {
+                foreach ($sqlval_deliv_fee as $cnt => $deliv_fee) {
+                    $objQuery->update('dtb_delivfee', array('fee' => $deliv_fee['fee']), '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'] = 'CURRENT_TIMESTAMP';
+            // INSERTの実行
+            $objQuery->insert('dtb_deliv', $sqlval);
+
+            // お届け時間の設定
+            foreach ($sqlval_deliv_time as $cnt => $deliv_time) {
+                $deliv_time['deliv_id'] = $deliv_id;
+                $deliv_time['time_id'] = $cnt;
+                // INSERTの実行
+                $objQuery->insert('dtb_delivtime', $deliv_time);
+            }
+
+            if (INPUT_DELIV_FEE) {
+                // 配送料金の設定
+                foreach ($sqlval_deliv_fee as $cnt => $deliv_fee) {
+                    $deliv_fee['deliv_id'] = $deliv_id;
+                    $deliv_fee['fee_id'] = $cnt;
+                    // INSERTの実行
+                    $objQuery->insert('dtb_delivfee', $deliv_fee);
+                }
+            }
+        }
+
+        // 支払い方法
+        $objQuery->delete('dtb_payment_options', 'deliv_id = ?', array($deliv_id));
+        foreach ($sqlval_payment_ids as $payment_ids) {
+            $payment_ids['deliv_id'] = $deliv_id;
+            $objQuery->insert('dtb_payment_options', $payment_ids);
+        }
+
+        $objQuery->commit();
+
+        return $deliv_id;
     }
 
@@ -86,4 +246,21 @@
 
     /**
+     * 同じ内容の配送方法が存在するか確認.
+     * 
+     * @param array $arrDeliv
+     * @return boolean
+     */
+    public function checkExist($arrDeliv) {
+        $objDb = new SC_Helper_DB_Ex();
+        if ($arrDeliv['deliv_id'] == '') {
+            $ret = $objDb->sfIsRecord('dtb_deliv', 'service_name', array($arrDeliv['service_name']));
+        } else {
+            $objQuery =& SC_Query_Ex::getSingletonInstance();
+            $ret = (($objQuery->count('dtb_deliv', 'deliv_id != ? AND service_name = ? ', array($arrDeliv['deliv_id'], $arrDeliv['service_name'])) > 0)? true : false);
+        }
+        return $ret;
+    }
+
+    /**
      * 配送方法IDをキー, 名前を値とする配列を取得.
      * 
