Index: /branches/version-2_12-dev/data/Smarty/templates/admin/basis/kiyaku.tpl
===================================================================
--- /branches/version-2_12-dev/data/Smarty/templates/admin/basis/kiyaku.tpl	(revision 21867)
+++ /branches/version-2_12-dev/data/Smarty/templates/admin/basis/kiyaku.tpl	(revision 21936)
@@ -49,5 +49,5 @@
     <div class="btn-area">
         <ul>
-            <li><a class="btn-action" href="javascript:;" onclick="fnFormModeSubmit('form1', 'edit', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>
+            <li><a class="btn-action" href="javascript:;" onclick="fnFormModeSubmit('form1', 'confirm', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>
         </ul>
     </div>
@@ -70,5 +70,5 @@
                 <td align="center">
                     <!--{if $tpl_kiyaku_id != $arrKiyaku[cnt].kiyaku_id}-->
-                    <a href="?" onclick="fnModeSubmit('pre_edit', 'kiyaku_id', <!--{$arrKiyaku[cnt].kiyaku_id}-->); return false;">編集</a>
+                    <a href="?" onclick="fnSetFormSubmit('form1', 'kiyaku_id', <!--{$arrKiyaku[cnt].kiyaku_id}-->); return false;">編集</a>
                     <!--{else}-->
                     編集中
Index: /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php	(revision 21867)
+++ /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php	(revision 21936)
@@ -71,18 +71,15 @@
 
         $mode = $this->getMode();
-
-        if (!empty($_POST)) {
-            $objFormParam = new SC_FormParam_Ex();
-            $this->lfInitParam($mode, $objFormParam);
-            $objFormParam->setParam($_POST);
-            $objFormParam->convParam();
-            $kiyaku_id = $objFormParam->getValue('kiyaku_id');
-
-            $this->arrErr = $this->lfCheckError($mode, $objFormParam);
-            if (!empty($this->arrErr['kiyaku_id'])) {
-                trigger_error('', E_USER_ERROR);
-                return;
-            }
-            $post = $objFormParam->getHashArray();
+        $objFormParam = new SC_FormParam_Ex();
+        $this->lfInitParam($mode, $objFormParam);
+        $objFormParam->setParam($_REQUEST);
+        $objFormParam->convParam();
+        $this->arrErr = $this->lfCheckError($mode, $objFormParam);
+        $is_error = (!SC_Utils_Ex::isBlank($this->arrErr));
+
+        $this->kiyaku_id = $objFormParam->getValue('kiyaku_id');
+        if ($is_error) {
+            trigger_error('', E_USER_ERROR);
+            return;
         }
 
@@ -90,33 +87,62 @@
         switch ($mode) {
             // 編集処理
-            case 'edit':
+            case 'confirm':
                 // POST値の引き継ぎ
                 $this->arrForm = $_POST;
 
-                if (count($this->arrErr) <= 0) {
-                    if ($post['kiyaku_id'] == '') {
-                        $this->lfInsertClass($this->arrForm, $_SESSION['member_id']);    // 新規作成
+                if (!$is_error) {
+                    if ($this->kiyaku_id == '') {
+                        $result = $this->lfInsertClass($this->arrForm, $_SESSION['member_id']);    // 新規作成
                     } else {
-                        $this->lfUpdateClass($this->arrForm, $post['kiyaku_id']);    // 既存編集
+                        $result = $this->lfUpdateClass($this->arrForm, $this->kiyaku_id);    // 既存編集
                     }
 
-                    // 再表示
-                    $this->objDisplay->reload();
-                } else {
-                    // POSTデータを引き継ぐ
-                    $this->tpl_kiyaku_id = $post['kiyaku_id'];
+                    if ($result !== FALSE) {
+                        $arrPram = array(
+                            'kiyaku_id' => $result,
+                            'msg' => 'on',
+                        );
+
+                        SC_Response_Ex::reload($arrPram, true);
+                        SC_Response_Ex::actionExit();
+                    }
                 }
                 break;
             // 削除
             case 'delete':
-                $objDb->sfDeleteRankRecord('dtb_kiyaku', 'kiyaku_id', $post['kiyaku_id'], '', true);
+                $objDb->sfDeleteRankRecord('dtb_kiyaku', 'kiyaku_id', $this->kiyaku_id, '', true);
 
                 // 再表示
                 $this->objDisplay->reload();
                 break;
-            // 編集前処理
-            case 'pre_edit':
+            case 'down':
+                $objDb->sfRankDown('dtb_kiyaku', 'kiyaku_id', $this->kiyaku_id);
+
+                // 再表示
+                $this->objDisplay->reload();
+                break;
+            case 'up':
+                $objDb->sfRankUp('dtb_kiyaku', 'kiyaku_id', $this->kiyaku_id);
+
+                // 再表示
+                $this->objDisplay->reload();
+                break;
+            default:
+                if (isset($_GET['msg']) && $_GET['msg'] == 'on') {
+                    // 完了メッセージ
+                    $this->tpl_onload = "alert('登録が完了しました。');";
+                }
+                break;
+        }
+
+        $this->arrForm = $objFormParam->getFormParamList();
+
+        if (!$is_error) {
+            // 規約一覧を取得
+            $this->arrKiyaku = $this->lfGetKiyakuList();
+            // kiyaku_id が指定されている場合には規約データの取得
+            if (!SC_Utils_Ex::isBlank($this->kiyaku_id)) {
                 // 編集項目を取得する。
-                $arrKiyakuData = $this->lfGetKiyakuDataByKiyakuID($post['kiyaku_id']);
+                $arrKiyakuData = $this->lfGetKiyakuDataByKiyakuID($this->kiyaku_id);
 
                 // 入力項目にカテゴリ名を入力する。
@@ -124,26 +150,10 @@
                 $this->arrForm['kiyaku_text'] = $arrKiyakuData[0]['kiyaku_text'];
                 // POSTデータを引き継ぐ
-                $this->tpl_kiyaku_id = $post['kiyaku_id'];
-                break;
-            case 'down':
-                $objDb->sfRankDown('dtb_kiyaku', 'kiyaku_id', $post['kiyaku_id']);
-
-                // 再表示
-                $this->objDisplay->reload();
-                break;
-            case 'up':
-                $objDb->sfRankUp('dtb_kiyaku', 'kiyaku_id', $post['kiyaku_id']);
-
-                // 再表示
-                $this->objDisplay->reload();
-                break;
-            default:
-                break;
-        }
-
-        $this->arrKiyaku = $this->lfGetKiyakuList();
-        // POSTデータを引き継ぐ
-        $this->tpl_kiyaku_id = $kiyaku_id;
-
+                $this->tpl_kiyaku_id = $this->kiyaku_id;
+            }
+        } else {
+            // 画面にエラー表示しないため, ログ出力
+            GC_Utils_Ex::gfPrintLog('Error: ' . print_r($this->arrErr, true));
+        }
     }
 
@@ -161,4 +171,5 @@
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         // INSERTする値を作成する。
+        $sqlval = array();
         $sqlval['kiyaku_title'] = $arrData['kiyaku_title'];
         $sqlval['kiyaku_text'] = $arrData['kiyaku_text'];
@@ -170,5 +181,5 @@
         $sqlval['kiyaku_id'] = $objQuery->nextVal('dtb_kiyaku_kiyaku_id');
         $ret = $objQuery->insert('dtb_kiyaku', $sqlval);
-        return $ret;
+        return ($ret) ? $sqlval['kiyaku_id'] : FALSE;
     }
 
@@ -198,10 +209,10 @@
         // UPDATEの実行
         $ret = $objQuery->update('dtb_kiyaku', $sqlval, $where, array($kiyaku_id));
-        return $ret;
+        return ($ret) ? $kiyaku_id : FALSE;
     }
 
     function lfInitParam($mode, &$objFormParam) {
         switch ($mode) {
-            case 'edit':
+            case 'confirm':
                 $objFormParam->addParam('規約タイトル', 'kiyaku_title', SMTEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK'));
                 $objFormParam->addParam('規約内容', 'kiyaku_text', MLTEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK'));
@@ -210,7 +221,6 @@
             case 'down':
             case 'up':
+            default:
                 $objFormParam->addParam('規約ID', 'kiyaku_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
-                break;
-            default:
                 break;
         }
@@ -225,5 +235,5 @@
     function lfCheckError($mode, $objFormParam) {
         $arrErr = $objFormParam->checkError();
-        if (!isset($arrErr['name']) && $mode == 'edit') {
+        if (!isset($arrErr['name']) && $mode == 'confirm') {
             $post = $objFormParam->getHashArray();
             $objQuery =& SC_Query_Ex::getSingletonInstance();
