[Svn-src-all:1251] [version-2_5-dev 20140] 退会手続きリファクタリング #981

kimoto admin @ mail.ec-cube.net
2011年 2月 11日 (金) 18:57:18 JST


Subversion committed to /home/svn/open 20140
http://svn.ec-cube.net/open_trac/changeset/20140
┌────────────────────────────┐
│更新者 :  kimoto                                       │
│更新日時:  2011-02-11 18:57:18 +0900 (金, 11  2月 2011)│
└────────────────────────────┘

Log:
--------------------------------------------------------
退会手続きリファクタリング #981


Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_5-dev/data/Smarty/templates/default/mypage/refusal_confirm.tpl
U   branches/version-2_5-dev/data/Smarty/templates/mobile/mypage/refusal.tpl
U   branches/version-2_5-dev/data/Smarty/templates/sphone/mypage/refusal_confirm.tpl
U   branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Refusal.php

変更: branches/version-2_5-dev/data/Smarty/templates/default/mypage/refusal_confirm.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/default/mypage/refusal_confirm.tpl	2011-02-11 09:57:13 UTC (rev 20139)
+++ branches/version-2_5-dev/data/Smarty/templates/default/mypage/refusal_confirm.tpl	2011-02-11 09:57:18 UTC (rev 20140)
@@ -27,7 +27,8 @@
   <!--{include file=$tpl_navi}-->
   <form name="form1" method="post" action="?">
   <input type="hidden" name="mode" value="complete" />
-  <input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->" />
+  <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
+
   <div id="mycontentsarea">
     <h3><!--{$tpl_subtitle|h}--></h3>
     <div id="completetext">

変更: branches/version-2_5-dev/data/Smarty/templates/mobile/mypage/refusal.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/mobile/mypage/refusal.tpl	2011-02-11 09:57:13 UTC (rev 20139)
+++ branches/version-2_5-dev/data/Smarty/templates/mobile/mypage/refusal.tpl	2011-02-11 09:57:18 UTC (rev 20140)
@@ -26,6 +26,8 @@
 <div align="center">
 <form action="?" method="post">
     <input type="hidden" name="mode" value="complete">
+    <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
+    
 	<input type="submit" name="complete" value="退会する">
 </form>
 </div>

変更: branches/version-2_5-dev/data/Smarty/templates/sphone/mypage/refusal_confirm.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/sphone/mypage/refusal_confirm.tpl	2011-02-11 09:57:13 UTC (rev 20139)
+++ branches/version-2_5-dev/data/Smarty/templates/sphone/mypage/refusal_confirm.tpl	2011-02-11 09:57:18 UTC (rev 20140)
@@ -27,7 +27,7 @@
   <!--{include file=$tpl_navi}-->
   <form name="form1" method="post" action="?">
   <input type="hidden" name="mode" value="complete" />
-  <input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->" />
+  <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
   <div id="mycontentsarea">
     <h3><!--{$tpl_subtitle|h}--></h3>
     <div id="completetext">

変更: branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Refusal.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Refusal.php	2011-02-11 09:57:13 UTC (rev 20139)
+++ branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Refusal.php	2011-02-11 09:57:18 UTC (rev 20140)
@@ -22,7 +22,7 @@
  */
 
 // {{{ requires
-require_once(CLASS_REALDIR . "pages/LC_Page.php");
+require_once(CLASS_REALDIR . "pages/mypage/LC_Page_AbstractMypage.php");
 
 /**
  * 退会手続き のページクラス.
@@ -31,7 +31,7 @@
  * @author LOCKON CO.,LTD.
  * @version $Id$
  */
-class LC_Page_Mypage_Refusal extends LC_Page {
+class LC_Page_Mypage_Refusal extends LC_Page_AbstractMypage {
 
     // }}}
     // {{{ functions
@@ -43,10 +43,10 @@
      */
     function init() {
         parent::init();
-        $this->tpl_title = 'MYページ';
+        $this->tpl_title    = 'MYページ';
         $this->tpl_subtitle = '退会手続き(入力ページ)';
-        $this->tpl_navi = TEMPLATE_REALDIR . 'mypage/navi.tpl';
-        $this->tpl_mainno = 'mypage';
+        $this->tpl_navi     = TEMPLATE_REALDIR . 'mypage/navi.tpl';
+        $this->tpl_mainno   = 'mypage';
         $this->tpl_mypageno = 'refusal';
     }
 
@@ -57,8 +57,6 @@
      */
     function process() {
         parent::process();
-        $this->action();
-        $this->sendResponse();
     }
 
     /**
@@ -67,33 +65,25 @@
      * @return void
      */
     function action() {
-        $objCustomer = new SC_Customer();
-        $objSiteSess = new SC_SiteSession();
 
-        // 退会判定用情報の取得
-        $this->tpl_login = $objCustomer->isLoginSuccess(true);
-
-        $this->lfCheckLogin();
-
         switch ($this->getMode()){
         case 'confirm':
-
-            $this->tpl_mainpage = TEMPLATE_REALDIR . 'mypage/refusal_confirm.tpl';
-            $this->tpl_subtitle = '退会手続き(確認ページ)';
-
-            // 確認ページを経由したことを登録
-            $objSiteSess->setRegistFlag();
-            // hiddenにuniqidを埋め込む
-            $this->tpl_uniqid = $objSiteSess->getUniqId();
-
+            $this->tpl_mainpage     = TEMPLATE_REALDIR . 'mypage/refusal_confirm.tpl';
+            $this->tpl_subtitle     = '退会手続き(確認ページ)';
             break;
 
         case 'complete':
-            // 正しい遷移かどうかをチェック
-            $this->lfIsValidMovement($objSiteSess);
-            $this->lfDeleteCustomer();    //会員削除
-        }
+            if (!SC_Helper_Session_Ex::isValidToken()) {
+                SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
+            }
 
+            $objCustomer = new SC_Customer();
+            $this->lfDeleteCustomer($objCustomer->getValue('customer_id'));
+            $objCustomer->EndSession();
+            SC_Response_Ex::sendRedirect('refusal_complete.php');
+        }
+        // mobileは確認画面がない
+        $this->transactionid    = SC_Helper_Session_Ex::getToken();
     }
 
     /**
@@ -105,41 +95,20 @@
         parent::destroy();
     }
 
-    // 正しい遷移かどうかをチェック
-    function lfIsValidMovement(&$objSiteSess) {
-        // uniqid がPOSTされているかをチェック
-        $uniqid = $objSiteSess->getUniqId();
-        if ($objSiteSess->isPrePage() || !empty($_POST['uniqid']) && ($_POST['uniqid'] === $uniqid) ) {
-            return;
-        } else {
-            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess);
-        }
-    }
 
-    function lfCheckLogin(){
-        $objCustomer = new SC_Customer();
-        //ログイン判定
-        if (!$objCustomer->isLoginSuccess(true)){
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
-        }else {
-            //マイページトップ顧客情報表示用
-            $this->CustomerName1 = $objCustomer->getvalue('name01');
-            $this->CustomerName2 = $objCustomer->getvalue('name02');
-            $this->CustomerPoint = $objCustomer->getvalue('point');
-        }
-    }
+    /**
+     * 会員情報を削除する
+     *
+     * @access private
+     * @return void
+     */
+    function lfDeleteCustomer($customer_id){
+        $objQuery       = SC_Query::getSingletonInstance();
 
-    function lfDeleteCustomer(){
-        $objQuery = new SC_Query();
-        $objCustomer = new SC_Customer();
-        //会員削除
-        $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
-
-        $objCustomer->EndSession();
-        //完了ページへ
-        SC_Response_Ex::sendRedirect('refusal_complete.php');
-        exit;
+        $sqlval['del_flg']      = 1;
+        $sqlval['update_date']  = 'now()';
+        $where                  = 'customer_id = ?';
+        $objQuery->update('dtb_customer', $sqlval, $where, array($customer_id));
     }
 
 }
-?>




Svn-src-all メーリングリストの案内