Index: /branches/version-2_12-dev/data/class_extends/helper_extends/SC_Helper_Maker_Ex.php
===================================================================
--- /branches/version-2_12-dev/data/class_extends/helper_extends/SC_Helper_Maker_Ex.php	(revision 22578)
+++ /branches/version-2_12-dev/data/class_extends/helper_extends/SC_Helper_Maker_Ex.php	(revision 22578)
@@ -0,0 +1,39 @@
+<?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.
+ */
+
+// {{{ requires
+require_once CLASS_REALDIR . 'helper/SC_Helper_Maker.php';
+
+/**
+ * メーカーを管理するヘルパークラス(拡張).
+ *
+ * LC_Helper_Maker をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Helper
+ * @author pineray
+ * @version $Id:$
+ */
+class SC_Helper_Maker_Ex extends SC_Helper_Maker
+{
+    //put your code here
+}
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 22567)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 22578)
@@ -58,5 +58,5 @@
         $this->arrSTATUS_IMAGE = $masterData->getMasterData('mtb_status_image');
         $this->arrDELIVERYDATE = $masterData->getMasterData('mtb_delivery_date');
-        $this->arrMaker = SC_Helper_DB_Ex::sfGetIDValueList('dtb_maker', 'maker_id', 'name');
+        $this->arrMaker = SC_Helper_Maker_Ex::getIDValueList();
         $this->arrAllowedTag = $masterData->getMasterData('mtb_allowed_tag');
     }
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 22567)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 22578)
@@ -76,5 +76,5 @@
         $this->arrDELIVERYDATE = $masterData->getMasterData('mtb_delivery_date');
         $this->arrProductType = $masterData->getMasterData('mtb_product_type');
-        $this->arrMaker = SC_Helper_DB_Ex::sfGetIDValueList('dtb_maker', 'maker_id', 'name');
+        $this->arrMaker = SC_Helper_Maker_Ex::getIDValueList();
         $this->arrPayments = SC_Helper_Payment_Ex::getIDValueList();
         $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php	(revision 22567)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php	(revision 22578)
@@ -72,4 +72,5 @@
     {
 
+        $objMaker = new SC_Helper_Maker_Ex();
         $objFormParam = new SC_FormParam_Ex();
 
@@ -86,7 +87,4 @@
         $maker_id = $objFormParam->getValue('maker_id');
 
-        // 変換後のPOST値を取得
-        $this->arrForm  = $objFormParam->getHashArray();
-
         // モードによる処理切り替え
         switch ($this->getMode()) {
@@ -94,35 +92,38 @@
             // 編集処理
             case 'edit':
-            // 入力文字の変換
-
                 // エラーチェック
-                $this->arrErr = $this->lfCheckError($this->arrForm, $objFormParam);
+                $this->arrErr = $this->lfCheckError($objFormParam, $objMaker);
+                if (!SC_Utils_Ex::isBlank($this->arrErr['maker_id'])) {
+                    trigger_error('', E_USER_ERROR);
+                    return;
+                }
+
                 if (count($this->arrErr) <= 0) {
-                    if ($this->arrForm['maker_id'] == '') {
-                        // メーカー情報新規登録
-                        $this->lfInsert($this->arrForm);
-                    } else {
-                        // メーカー情報編集
-                        $this->lfUpdate($this->arrForm);
+                    // POST値の引き継ぎ
+                    $arrParam = $objFormParam->getHashArray();
+                    // 登録実行
+                    $res_maker_id = $this->doRegist($maker_id, $arrParam, $objMaker);
+                    if ($res_maker_id !== FALSE) {
+                        // 完了メッセージ
+                        $maker_id = $res_maker_id;
+                        $this->tpl_onload = "alert('登録が完了しました。');";
                     }
-
-                    // 再表示
-                    $this->objDisplay->reload();
-                } else {
-                    // POSTデータを引き継ぐ
-                    $this->tpl_maker_id = $this->arrForm['maker_id'];
                 }
+                // POSTデータを引き継ぐ
+                $this->tpl_maker_id = $maker_id;
                 break;
 
             // 編集前処理
             case 'pre_edit':
-                $this->arrForm = $this->lfPreEdit($this->arrForm, $this->arrForm['maker_id']);
-                $this->tpl_maker_id = $this->arrForm['maker_id'];
+                $maker = $objMaker->get($maker_id);
+                $objFormParam->setParam($maker);
+
+                // POSTデータを引き継ぐ
+                $this->tpl_maker_id = $maker_id;
                 break;
 
             // メーカー順変更
             case 'up':
-            case 'down':
-                $this->lfRankChange($this->arrForm['maker_id'], $this->getMode());
+                $objMaker->rankUp($maker_id);
 
                 // リロード
@@ -130,7 +131,14 @@
                 break;
 
+            case 'down':
+                $objMaker->rankDown($maker_id);
+
+                // リロード
+                SC_Response_Ex::reload();
+                break;
+
             // 削除
             case 'delete':
-                $this->lfDelete($this->arrForm['maker_id']);
+                $objMaker->delete($maker_id);
 
                 // リロード
@@ -142,9 +150,8 @@
         }
 
+        $this->arrForm = $objFormParam->getFormParamList();
+
         // メーカー情報読み込み
-        $this->arrMaker = $this->lfDisp();
-        // POSTデータを引き継ぐ
-        $this->tpl_maker_id = $maker_id;
-
+        $this->arrMaker = $objMaker->getList();
     }
 
@@ -172,116 +179,16 @@
 
     /**
-     * メーカー情報表示.
-     *
-     * @return array $arrMaker メーカー情報
-     */
-    function lfDisp()
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-
-        // 削除されていないメーカー情報を表示する
-        $where = 'del_flg = 0';
-        $objQuery->setOrder('rank DESC');
-        $arrMaker = array();
-        $arrMaker = $objQuery->select('maker_id, name', 'dtb_maker', $where);
-        return $arrMaker;
-    }
-
-    /**
-     * メーカー情報新規登録.
-     *
-     * @param array $arrForm メーカー情報
-     * @return void
-     */
-    function lfInsert(&$arrForm)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-
-        // INSERTする値を作成する
-        $sqlval['name'] = $arrForm['name'];
-        $sqlval['rank'] = $objQuery->max('rank', 'dtb_maker') + 1;
+     * 登録処理を実行.
+     * 
+     * @param integer $maker_id
+     * @param array $sqlval
+     * @param object $objMaker
+     * @return multiple
+     */
+    function doRegist($maker_id, $sqlval, SC_Helper_Maker_Ex $objMaker)
+    {
+        $sqlval['maker_id'] = $maker_id;
         $sqlval['creator_id'] = $_SESSION['member_id'];
-        $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
-        $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
-        $sqlval['maker_id'] = $objQuery->nextVal('dtb_maker_maker_id');
-
-        // INSERTの実行
-        $objQuery->insert('dtb_maker', $sqlval);
-    }
-
-    /**
-     * メーカー情報更新.
-     *
-     * @param array $arrForm メーカー情報
-     * @return void
-     */
-    function lfUpdate(&$arrForm)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-
-        // UPDATEする値を作成する
-        $sqlval['name'] = $arrForm['name'];
-        $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
-        $where = 'maker_id = ?';
-
-        // UPDATEの実行
-        $objQuery->update('dtb_maker', $sqlval, $where, array($arrForm['maker_id']));
-    }
-
-    /**
-     * メーカー情報削除.
-     *
-     * @param integer $maker_id メーカーID
-     * @return void
-     */
-    function lfDelete($maker_id)
-    {
-        $objDb = new SC_Helper_DB_Ex();
-        $objDb->sfDeleteRankRecord('dtb_maker', 'maker_id', $maker_id, '', true);
-    }
-
-    /**
-     * メーカー情報順番変更.
-     *
-     * @param  integer $maker_id メーカーID
-     * @param  string  $mode up か down のモードを示す文字列
-     * @return void
-     */
-    function lfRankChange($maker_id, $mode)
-    {
-        $objDb = new SC_Helper_DB_Ex();
-
-        switch ($mode) {
-            case 'up':
-                $objDb->sfRankUp('dtb_maker', 'maker_id', $maker_id);
-                break;
-
-            case 'down':
-                $objDb->sfRankDown('dtb_maker', 'maker_id', $maker_id);
-                break;
-
-            default:
-                break;
-        }
-    }
-
-    /**
-     * メーカー情報編集前処理.
-     *
-     * @param array   $arrForm メーカー情報
-     * @param integer $maker_id メーカーID
-     * @return array  $arrForm メーカー名を追加
-     */
-    function lfPreEdit(&$arrForm, $maker_id)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-
-        // 編集項目を取得する
-        $where = 'maker_id = ?';
-        $arrMaker = array();
-        $arrMaker = $objQuery->select('name', 'dtb_maker', $where, array($maker_id));
-        $arrForm['name'] = $arrMaker[0]['name'];
-
-        return $arrForm;
+        return $objMaker->save($sqlval);
     }
 
@@ -289,21 +196,17 @@
      * 入力エラーチェック.
      *
-     * @param  array $arrForm メーカー情報
      * @return array $objErr->arrErr エラー内容
      */
-    function lfCheckError(&$arrForm, &$objFormParam)
+    function lfCheckError(&$objFormParam, SC_Helper_Maker_Ex &$objMaker)
     {
 
         $arrErr = $objFormParam->checkError();
-        if (!empty($arrErr)) {
-            return $arrErr;
-        }
+        $arrForm = $objFormParam->getHashArray();
 
         // maker_id の正当性チェック
         if (!empty($arrForm['maker_id'])) {
-            $objDb = new SC_Helper_DB_Ex();
             if (!SC_Utils_Ex::sfIsInt($arrForm['maker_id'])
                 || SC_Utils_Ex::sfIsZeroFilling($arrForm['maker_id'])
-                || !$objDb->sfIsRecord('dtb_maker', 'maker_id', array($arrForm['maker_id']))
+                || !$objMaker->get($arrForm['maker_id'])
             ) {
                 // maker_idが指定されていて、且つその値が不正と思われる場合はエラー
@@ -312,10 +215,12 @@
         }
         if (!isset($arrErr['name'])) {
-            $objQuery =& SC_Query_Ex::getSingletonInstance();
-            $arrMaker = array();
-            $arrMaker = $objQuery->select('maker_id, name', 'dtb_maker', 'del_flg = 0 AND name = ?', array($arrForm['name']));
+            $arrMaker = $objMaker->getByName($arrForm['name']);
 
             // 編集中のレコード以外に同じ名称が存在する場合
-            if ($arrMaker[0]['maker_id'] != $arrForm['maker_id'] && $arrMaker[0]['name'] == $arrForm['name']) {
+            if (
+                    !SC_Utils_Ex::isBlank($arrMaker)
+                    && $arrMaker['maker_id'] != $arrForm['maker_id']
+                    && $arrMaker['name'] == $arrForm['name']
+                ) {
                 $arrErr['name'] = '※ 既に同じ内容の登録が存在します。<br />';
             }
Index: /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 22567)
+++ /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 22578)
@@ -315,5 +315,7 @@
         // メーカー検索条件
         if (strlen($arrSearchData['maker_id']) > 0) {
-            $arrSearch['maker']     = $objQuery->get('name', 'dtb_maker', 'maker_id = ?', array($arrSearchData['maker_id']));
+            $objMaker = new SC_Helper_Maker_Ex();
+            $maker = $objMaker->get($arrSearchData['maker_id']);
+            $arrSearch['maker']     = $maker['name'];
         }
 
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Maker.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Maker.php	(revision 22578)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Maker.php	(revision 22578)
@@ -0,0 +1,164 @@
+<?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.
+ */
+
+/**
+ * メーカーを管理するヘルパークラス.
+ *
+ * @package Helper
+ * @author pineray
+ * @version $Id:$
+ */
+class SC_Helper_Maker
+{
+    /**
+     * メーカーの情報を取得.
+     * 
+     * @param integer $maker_id メーカーID
+     * @param boolean $has_deleted 削除されたメーカーも含む場合 true; 初期値 false
+     * @return array
+     */
+    public function get($maker_id, $has_deleted = false)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $where = 'maker_id = ?';
+        if (!$has_deleted) {
+            $where .= ' AND del_flg = 0';
+        }
+        $arrRet = $objQuery->select('*', 'dtb_maker', $where, array($maker_id));
+        return $arrRet[0];
+    }
+
+    /**
+     * 名前からメーカーの情報を取得.
+     * 
+     * @param integer $name メーカー名
+     * @param boolean $has_deleted 削除されたメーカーも含む場合 true; 初期値 false
+     * @return array
+     */
+    public function getByName($name, $has_deleted = false)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $where = 'name = ?';
+        if (!$has_deleted) {
+            $where .= ' AND del_flg = 0';
+        }
+        $arrRet = $objQuery->select('*', 'dtb_maker', $where, array($name));
+        return $arrRet[0];
+    }
+
+    /**
+     * メーカー一覧の取得.
+     *
+     * @param boolean $has_deleted 削除されたメーカーも含む場合 true; 初期値 false
+     * @return array
+     */
+    public function getList($has_deleted = false)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $col = 'maker_id, name';
+        $where = '';
+        if (!$has_deleted) {
+            $where .= 'del_flg = 0';
+        }
+        $table = 'dtb_maker';
+        $objQuery->setOrder('rank DESC');
+        $arrRet = $objQuery->select($col, $table, $where);
+        return $arrRet;
+    }
+
+    /**
+     * メーカーの登録.
+     * 
+     * @param array $sqlval
+     * @return multiple 登録成功:メーカーID, 失敗:FALSE
+     */
+    public function save($sqlval)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+        $maker_id = $sqlval['maker_id'];
+        $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
+        // 新規登録
+        if ($maker_id == '') {
+            // INSERTの実行
+            $sqlval['rank'] = $objQuery->max('rank', 'dtb_maker') + 1;
+            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
+            $sqlval['maker_id'] = $objQuery->nextVal('dtb_maker_maker_id');
+            $ret = $objQuery->insert('dtb_maker', $sqlval);
+        // 既存編集
+        } else {
+            unset($sqlval['creator_id']);
+            unset($sqlval['create_date']);
+            $where = 'maker_id = ?';
+            $ret = $objQuery->update('dtb_maker', $sqlval, $where, array($maker_id));
+        }
+        return ($ret) ? $sqlval['maker_id'] : FALSE;
+    }
+
+    /**
+     * メーカーの削除.
+     * 
+     * @param integer $maker_id メーカーID
+     * @return void
+     */
+    public function delete($maker_id)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        // ランク付きレコードの削除
+        $objDb->sfDeleteRankRecord('dtb_maker', 'maker_id', $maker_id, '', true);
+    }
+
+    /**
+     * メーカーの表示順をひとつ上げる.
+     * 
+     * @param integer $maker_id メーカーID
+     * @return void
+     */
+    public function rankUp($maker_id)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        $objDb->sfRankUp('dtb_maker', 'maker_id', $maker_id);
+    }
+
+    /**
+     * メーカーの表示順をひとつ下げる.
+     * 
+     * @param integer $maker_id メーカーID
+     * @return void
+     */
+    public function rankDown($maker_id)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        $objDb->sfRankDown('dtb_maker', 'maker_id', $maker_id);
+    }
+
+    /**
+     * メーカーIDをキー, 名前を値とする配列を取得.
+     * 
+     * @return array
+     */
+    public static function getIDValueList()
+    {
+        return SC_Helper_DB_Ex::sfGetIDValueList('dtb_maker', 'maker_id', 'name');
+    }
+}
Index: /branches/version-2_12-dev/data/Smarty/templates/admin/products/maker.tpl
===================================================================
--- /branches/version-2_12-dev/data/Smarty/templates/admin/products/maker.tpl	(revision 22206)
+++ /branches/version-2_12-dev/data/Smarty/templates/admin/products/maker.tpl	(revision 22578)
@@ -35,5 +35,5 @@
                     <!--{if $arrErr.maker_id}--><span class="attention"><!--{$arrErr.maker_id}--></span><br /><!--{/if}-->
                     <!--{if $arrErr.name}--><span class="attention"><!--{$arrErr.name}--></span><!--{/if}-->
-                    <input type="text" name="name" value="<!--{$arrForm.name|h}-->" maxlength="<!--{$smarty.const.SMTEXT_LEN}-->" style="" size="60" class="box60"/>
+                    <input type="text" name="name" value="<!--{$arrForm.name.value|h}-->" maxlength="<!--{$smarty.const.SMTEXT_LEN}-->" style="" size="60" class="box60"/>
                     <span class="attention"> (上限<!--{$smarty.const.SMTEXT_LEN}-->文字)</span>
                 </td>
