Index: /branches/feature-module-update/html/shopping/confirm.php
===================================================================
--- /branches/feature-module-update/html/shopping/confirm.php	(revision 15080)
+++ /branches/feature-module-update/html/shopping/confirm.php	(revision 15223)
@@ -6,129 +6,14 @@
  */
 
+// {{{ requires
 require_once("../require.php");
+require_once(CLASS_PATH . "page_extends/shopping/LC_Page_Shopping_Confirm_Ex.php");
 
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	var $tpl_total_deliv_fee;
-	function LC_Page() {
-		$this->tpl_mainpage = 'shopping/confirm.tpl';
-		$this->tpl_css = URL_DIR.'css/layout/shopping/confirm.css';
-		$this->tpl_title = "ご入力内容のご確認";
-		global $arrPref;
-		$this->arrPref = $arrPref;
-		global $arrSex;
-		$this->arrSex = $arrSex;
-		global $arrMAILMAGATYPE;
-		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
-		global $arrReminder;
-		$this->arrReminder = $arrReminder;
-		/*
-		 session_start時のno-cacheヘッダーを抑制することで
-		 「戻る」ボタン使用時の有効期限切れ表示を抑制する。
-		 private-no-expire:クライアントのキャッシュを許可する。
-		*/
-		session_cache_limiter('private-no-expire');		
+// }}}
+// {{{ generate page
 
-	}
-}
-
-$objPage = new LC_Page();
-$objView = new SC_SiteView();
-$objCartSess = new SC_CartSession();
-$objSiteInfo = $objView->objSiteInfo;
-$objSiteSess = new SC_SiteSession();
-$objCampaignSess = new SC_CampaignSession();
-$objCustomer = new SC_Customer();
-$arrInfo = $objSiteInfo->data;
-$objQuery = new SC_Query();
-
-// 前のページで正しく登録手続きが行われた記録があるか判定
-sfIsPrePage($objSiteSess);
-
-// ユーザユニークIDの取得と購入状態の正当性をチェック
-$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
-$objPage->tpl_uniqid = $uniqid;
-
-// カート集計処理
-$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
-// 一時受注テーブルの読込
-$arrData = sfGetOrderTemp($uniqid);
-// カート集計を元に最終計算
-$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer, $objCampaignSess);
-// キャンペーンからの遷移で送料が無料だった場合の処理
-if($objCampaignSess->getIsCampaign()) {
-	$deliv_free_flg = $objQuery->get("dtb_campaign", "deliv_free_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId()));
-	// 送料無料が設定されていた場合
-	if($deliv_free_flg) {
-		$arrData['payment_total'] -= $arrData['deliv_fee'];
-		$arrData['deliv_fee'] = 0;
-	}
-}
-
-
-// カート内の商品の売り切れチェック
-$objCartSess->chkSoldOut($objCartSess->getCartList());
-
-// 会員ログインチェック
-if($objCustomer->isLoginSuccess()) {
-	$objPage->tpl_login = '1';
-	$objPage->tpl_user_point = $objCustomer->getValue('point');
-}
-
-// 決済区分を取得する
-$payment_type = "";
-if(sfColumnExists("dtb_payment", "memo01")){
-	// MEMO03に値が入っている場合には、モジュール追加されたものとみなす
-	$sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
-	$arrPayment = $objQuery->getall($sql, array($arrData['payment_id']));
-	$payment_type = $arrPayment[0]["memo03"];
-}
-$objPage->payment_type = $payment_type;
-
-
-switch($_POST['mode']) {
-// 前のページに戻る
-case 'return':
-	// 正常な推移であることを記録しておく
-	$objSiteSess->setRegistFlag();
-	header("Location: " . URL_SHOP_PAYMENT);
-	exit;
-	break;
-case 'confirm':
-	// この時点でオーダーIDを確保しておく（クレジット、コンビニ決済で必要なため）
-	// postgresqlとmysqlとで処理を分ける
-	if (DB_TYPE == "pgsql") {
-		$order_id = $objQuery->nextval("dtb_order","order_id");
-	}elseif (DB_TYPE == "mysql") {
-		$order_id = $objQuery->get_auto_increment("dtb_order");
-	}
-	$arrData["order_id"] = $order_id;
-    
-    // セッション情報を保持
-    $arrData['session'] = serialize($_SESSION);
-	
-	// 集計結果を受注一時テーブルに反映
-	sfRegistTempOrder($uniqid, $arrData);
-	// 正常に登録されたことを記録しておく
-	$objSiteSess->setRegistFlag();
-	
-	// 決済方法により画面切替
-	if($payment_type != "") {
-		$_SESSION["payment_id"] = $arrData['payment_id'];
-		header("Location: " . URL_SHOP_MODULE);
-	}else{
-		header("Location: " . URL_SHOP_COMPLETE);
-	}
-	break;
-default:
-	break;
-}
-
-$objPage->arrData = $arrData;
-$objPage->arrInfo = $arrInfo;
-$objView->assignobj($objPage);
-// フレームを選択(キャンペーンページから遷移なら変更)
-$objCampaignSess->pageView($objView);
-//--------------------------------------------------------------------------------------------------------------------------
+$objPage = new LC_Page_Shopping_Confirm_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/html/shopping/payment.php
===================================================================
--- /branches/feature-module-update/html/shopping/payment.php	(revision 15080)
+++ /branches/feature-module-update/html/shopping/payment.php	(revision 15223)
@@ -6,334 +6,14 @@
  */
 
+// {{{ requires
 require_once("../require.php");
+require_once(CLASS_PATH . "page_extends/shopping/LC_Page_Shopping_Payment_Ex.php");
 
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	function LC_Page() {
-		$this->tpl_css = URL_DIR.'css/layout/shopping/pay.css';
-		$this->tpl_mainpage = 'shopping/payment.tpl';
-		$this->tpl_onload = 'fnCheckInputPoint();';
-		$this->tpl_title = "お支払方法・お届け時間等の指定";
-		/*
-		 session_start時のno-cacheヘッダーを抑制することで
-		 「戻る」ボタン使用時の有効期限切れ表示を抑制する。
-		 private-no-expire:クライアントのキャッシュを許可する。
-		*/
-		session_cache_limiter('private-no-expire');		
-	}
-}
+// }}}
+// {{{ generate page
 
-$objPage = new LC_Page();
-$objView = new SC_SiteView();
-$objSiteSess = new SC_SiteSession();
-$objCartSess = new SC_CartSession();
-$objCampaignSess = new SC_CampaignSession();
-$objCustomer = new SC_Customer();
-$objSiteInfo = $objView->objSiteInfo;
-$arrInfo = $objSiteInfo->data;
-
-// パラメータ管理クラス
-$objFormParam = new SC_FormParam();
-// パラメータ情報の初期化
-lfInitParam();
-// POST値の取得
-$objFormParam->setParam($_POST);
-
-// ユーザユニークIDの取得と購入状態の正当性をチェック
-$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
-// ユニークIDを引き継ぐ
-$objPage->tpl_uniqid = $uniqid;
-
-// 会員ログインチェック
-if($objCustomer->isLoginSuccess()) {
-	$objPage->tpl_login = '1';
-	$objPage->tpl_user_point = $objCustomer->getValue('point');
-	//戻り先URL
-	$objPage->tpl_back_url = URL_DELIV_TOP;
-} else {
-	$objPage->tpl_back_url = URL_SHOP_TOP . "?from=nonmember";
-}
-
-// 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の個数が０になる)
-$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
-$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
-
-// カー都内の商品の売り切れチェック
-$objCartSess->chkSoldOut($objCartSess->getCartList());
-
-switch($_POST['mode']) {
-case 'confirm':
-	// 入力値の変換
-	$objFormParam->convParam();
-	$objPage->arrErr = lfCheckError($objPage->arrData );
-	// 入力エラーなし
-	if(count($objPage->arrErr) == 0) {
-		// DBへのデータ登録
-		lfRegistData($uniqid);
-		// 正常に登録されたことを記録しておく
-		$objSiteSess->setRegistFlag();
-		// 確認ページへ移動
-		header("Location: " . URL_SHOP_CONFIRM);
-		exit;
-	}else{
-		// ユーザユニークIDの取得
-		$uniqid = $objSiteSess->getUniqId();
-		// 受注一時テーブルからの情報を格納
-		lfSetOrderTempData($uniqid);
-	}
-	break;
-// 前のページに戻る
-case 'return':
-	// 非会員の場合
-	// 正常な推移であることを記録しておく
-	$objSiteSess->setRegistFlag();
-	header("Location: " . URL_SHOP_TOP);
-	exit;
-	break;
-// 支払い方法が変更された場合
-case 'payment':
-	// ここのbreakは、意味があるので外さないで下さい。
-	break;
-default:
-	// 受注一時テーブルからの情報を格納
-	lfSetOrderTempData($uniqid);
-	break;
-}
-
-// 店舗情報の取得
-$arrInfo = $objSiteInfo->data;
-// 購入金額の取得得
-$total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
-// 支払い方法の取得
-$objPage->arrPayment = lfGetPayment($total_pretax);
-// 配送時間の取得
-$arrRet = sfGetDelivTime($objFormParam->getValue('payment_id'));
-$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'deliv_time');
-$objPage->objCustomer = $objCustomer;
-//　配送日一覧の取得
-$objPage->arrDelivDate = lfGetDelivDate();
-
-$objPage->arrForm = $objFormParam->getFormParamList();
-
-$objView->assignobj($objPage);
-// フレームを選択(キャンペーンページから遷移なら変更)
-$objCampaignSess->pageView($objView);
-//--------------------------------------------------------------------------------------------------------------------------
-/* パラメータ情報の初期化 */
-function lfInitParam() {
-	global $objFormParam;
-	$objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("ポイント", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START"));
-	$objFormParam->addParam("配達時間", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("ご質問", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("ポイントを使用する", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2');
-	$objFormParam->addParam("配達日", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
-}
-
-function lfGetPayment($total_pretax) {
-	$objQuery = new SC_Query();
-	$objQuery->setorder("rank DESC");
-	//削除されていない支払方法を取得
-	$arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "del_flg = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE del_flg = 0) ");
-	//利用条件から支払可能方法を判定
-	foreach($arrRet as $data) {
-		//下限と上限が設定されている
-		if($data['rule'] > 0 && $data['upper_rule'] > 0) {
-			if($data['rule'] <= $total_pretax && $data['upper_rule'] >= $total_pretax) {
-				$arrPayment[] = $data;
-			}
-		//下限のみ設定されている
-		} elseif($data['rule'] > 0) {	
-			if($data['rule'] <= $total_pretax) {
-				$arrPayment[] = $data;
-			}
-		//上限のみ設定されている
-		} elseif($data['upper_rule'] > 0) {
-			if($data['upper_rule'] >= $total_pretax) {
-				$arrPayment[] = $data;
-			}
-		//設定なし
-		} else {
-			$arrPayment[] = $data;
-		}	
-	}
-	return $arrPayment;	
-}
-
-/* 入力内容のチェック */
-function lfCheckError($arrData) {
-	global $objFormParam;
-	global $objCustomer;
-	// 入力データを渡す。
-	$arrRet =  $objFormParam->getHashArray();
-	$objErr = new SC_CheckError($arrRet);
-	$objErr->arrErr = $objFormParam->checkError();
-	
-	if($_POST['point_check'] == '1') {
-		$objErr->doFunc(array("ポイントを使用する", "point_check"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("ポイント", "use_point"), array("EXIST_CHECK"));
-		$max_point = $objCustomer->getValue('point');
-		if($max_point == "") {
-			$max_point = 0;
-		}
-		if($arrRet['use_point'] > $max_point) {
-			$objErr->arrErr['use_point'] = "※ ご利用ポイントが所持ポイントを超えています。<br />";
-		}
-		if(($arrRet['use_point'] * POINT_VALUE) > $arrData['subtotal']) {
-			$objErr->arrErr['use_point'] = "※ ご利用ポイントがご購入金額を超えています。<br />";
-		}
-	}
-	return $objErr->arrErr;
-}
-
-/* 支払い方法文字列の取得 */
-function lfGetPaymentInfo($payment_id) {
-	$objQuery = new SC_Query();
-	$where = "payment_id = ?";
-	$arrRet = $objQuery->select("payment_method, charge", "dtb_payment", $where, array($payment_id));
-	return (array($arrRet[0]['payment_method'], $arrRet[0]['charge']));
-}
-
-/* 配送時間文字列の取得 */
-function lfGetDelivTimeInfo($time_id) {
-	$objQuery = new SC_Query();
-	$where = "time_id = ?";
-	$arrRet = $objQuery->select("deliv_id, deliv_time", "dtb_delivtime", $where, array($time_id));
-	return (array($arrRet[0]['deliv_id'], $arrRet[0]['deliv_time']));
-}
-
-/* DBへデータの登録 */
-function lfRegistData($uniqid) {
-	global $objFormParam;
-	$arrRet = $objFormParam->getHashArray();
-	$sqlval = $objFormParam->getDbArray();
-	// 登録データの作成
-	$sqlval['order_temp_id'] = $uniqid;
-	$sqlval['update_date'] = 'Now()';
-	
-	if($sqlval['payment_id'] != "") {
-		list($sqlval['payment_method'], $sqlval['charge']) = lfGetPaymentInfo($sqlval['payment_id']);
-	} else {
-		$sqlval['payment_id'] = '0';
-		$sqlval['payment_method'] = "";
-	}
-	
-	if($sqlval['deliv_time_id'] != "") {
-		list($sqlval['deliv_id'], $sqlval['deliv_time']) = lfGetDelivTimeInfo($sqlval['deliv_time_id']);
-	} else {
-		$sqlval['deliv_time_id'] = '0';
-		$sqlval['deliv_id'] = '0';
-		$sqlval['deliv_time'] = "";
-	}
-	
-	// 使用ポイントの設定
-	if($sqlval['point_check'] != '1') {
-		$sqlval['use_point'] = 0;
-	}
-	
-	sfRegistTempOrder($uniqid, $sqlval);
-}
-
-/* 配達日一覧を取得する */
-function lfGetDelivDate() {
-	$objCartSess = new SC_CartSession();
-	$objQuery = new SC_Query();
-	// 商品IDの取得
-	$max = $objCartSess->getMax();
-	for($i = 1; $i <= $max; $i++) {
-		if($_SESSION[$objCartSess->key][$i]['id'][0] != "") {
-			$arrID['product_id'][$i] = $_SESSION[$objCartSess->key][$i]['id'][0];
-		}
-	}
-	if(count($arrID['product_id']) > 0) {
-		$id = implode(",", $arrID['product_id']);
-		//商品から発送目安の取得
-		$deliv_date = $objQuery->get("dtb_products", "MAX(deliv_date_id)", "product_id IN (".$id.")");
-		//発送目安
-		switch($deliv_date) {
-		//即日発送
-		case '1':
-			$start_day = 1;
-			break;
-		//1-2日後
-		case '2':
-			$start_day = 3;
-			break;
-		//3-4日後
-		case '3':
-			$start_day = 5;
-			break;
-		//1週間以内
-		case '4':
-			$start_day = 8;
-			break;
-		//2週間以内
-		case '5':
-			$start_day = 15;
-			break;
-		//3週間以内
-		case '6':
-			$start_day = 22;
-			break;
-		//1ヶ月以内
-		case '7':
-			$start_day = 32;
-			break;
-		//2ヶ月以降
-		case '8':
-			$start_day = 62;			
-			break;
-		//お取り寄せ(商品入荷後)
-		case '9':
-			$start_day = "";
-			break;
-		default:
-			//お届け日が設定されていない場合
-			$start_day = "";
-			break;
-		}
-		//配達可能日のスタート値から、配達日の配列を取得する
-		$arrDelivDate = lfGetDateArray($start_day, DELIV_DATE_END_MAX);
-	}
-	return $arrDelivDate;
-}
-
-//配達可能日のスタート値から、配達日の配列を取得する
-function lfGetDateArray($start_day, $end_day) {
-	global $arrWDAY;
-	//配達可能日のスタート値がセットされていれば
-	if($start_day >= 1) {
-		$now_time = time();
-		$max_day = $start_day + $end_day;
-		// 集計
-		for ($i = $start_day; $i < $max_day; $i++) {
-			// 基本時間から日数を追加していく
-			$tmp_time = $now_time + ($i * 24 * 3600);
-			list($y, $m, $d, $w) = split(" ", date("y m d w", $tmp_time));	
-			$val = sprintf("%02d/%02d/%02d(%s)", $y, $m, $d, $arrWDAY[$w]);
-			$arrDate[$val] = $val;
-		}
-	} else {
-		$arrDate = false;
-	}
-	return $arrDate;
-}
-
-//一時受注テーブルからの情報を格納する
-function lfSetOrderTempData($uniqid) {
-	global $objQuery;
-	global $objFormParam;
-	
-	$objQuery = new SC_Query();
-	$col = "payment_id, use_point, deliv_time_id, message, point_check, deliv_date";
-	$from = "dtb_order_temp";
-	$where = "order_temp_id = ?";
-	$arrRet = $objQuery->select($col, $from, $where, array($uniqid));
-	// DB値の取得
-	$objFormParam->setParam($arrRet[0]);
-	return $objFormParam;
-}
-
-
+$objPage = new LC_Page_Shopping_Payment_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/html/shopping/deliv.php
===================================================================
--- /branches/feature-module-update/html/shopping/deliv.php	(revision 15080)
+++ /branches/feature-module-update/html/shopping/deliv.php	(revision 15223)
@@ -6,274 +6,14 @@
  */
 
+// {{{ requires
 require_once("../require.php");
+require_once(CLASS_PATH . "page_extends/shopping/LC_Page_Shopping_Deliv_Ex.php");
 
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	var $arrAddr;
-	function LC_Page() {
-		$this->tpl_mainpage = 'shopping/deliv.tpl';
-		$this->tpl_css = URL_DIR.'css/layout/shopping/index.css';
-		global $arrPref;
-		$this->arrPref = $arrPref;
-		$this->tpl_title = "お届け先指定";		// タイトル
+// }}}
+// {{{ generate page
 
-		/*
-		 session_start時のno-cacheヘッダーを抑制することで
-		 「戻る」ボタン使用時の有効期限切れ表示を抑制する。
-		 private-no-expire:クライアントのキャッシュを許可する。
-		*/
-		session_cache_limiter('private-no-expire');		
-
-	}
-}
-
-$objPage = new LC_Page();
-$objView = new SC_SiteView();
-$objSiteSess = new SC_SiteSession();
-$objCartSess = new SC_CartSession();
-$objCampaignSess = new SC_CampaignSession();
-$objCustomer = new SC_Customer();
-// クッキー管理クラス
-$objCookie = new SC_Cookie(COOKIE_EXPIRE);
-// パラメータ管理クラス
-$objFormParam = new SC_FormParam();
-// パラメータ情報の初期化
-lfInitParam();
-// POST値の取得
-$objFormParam->setParam($_POST);
-
-$objLoginFormParam = new SC_FormParam();	// ログインフォーム用
-lfInitLoginFormParam();						// 初期設定
-$objLoginFormParam->setParam($_POST);		// POST値の取得
-
-// ユーザユニークIDの取得と購入状態の正当性をチェック
-$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
-$objPage->tpl_uniqid = $uniqid;
-
-// ログインチェック
-if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess()) {
-	// 不正アクセスとみなす
-	sfDispSiteError(CUSTOMER_ERROR);
-}
-
-switch($_POST['mode']) {
-case 'login':
-	$objLoginFormParam->toLower('login_email');
-	$objPage->arrErr = $objLoginFormParam->checkError();
-	$arrForm =  $objLoginFormParam->getHashArray();
-	// クッキー保存判定
-	if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
-		$objCookie->setCookie('login_email', $_POST['login_email']);
-	} else {
-		$objCookie->setCookie('login_email', '');
-	}
-
-	if(count($objPage->arrErr) == 0) {
-		// ログイン判定
-		if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
-			// 仮登録の判定
-			$objQuery = new SC_Query;
-			$where = "email = ? AND status = 1 AND del_flg = 0";
-			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
-			
-			if($ret > 0) {
-				sfDispSiteError(TEMP_LOGIN_ERROR);
-			} else {
-				sfDispSiteError(SITE_LOGIN_ERROR);
-			}
-		} 
-	} else {
-		// ログインページに戻る
-		header("Location: " . URL_SHOP_TOP);
-		exit;	
-	}
-	break;
-// 削除
-case 'delete':
-	if (sfIsInt($_POST['other_deliv_id'])) {
-		$objQuery = new SC_Query();
-		$where = "other_deliv_id = ?";
-		$arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
-		$objFormParam->setValue('select_addr_id', '');
-	}
-	break;
-// 会員登録住所に送る
-case 'customer_addr':
-	// 会員登録住所がチェックされている場合
-	if ($_POST['deliv_check'] == '-1') {
-		// 会員情報の住所を受注一時テーブルに書き込む
-		lfRegistDelivData($uniqid, $objCustomer);
-		// 正常に登録されたことを記録しておく
-		$objSiteSess->setRegistFlag();
-		// お支払い方法選択ページへ移動
-		header("Location: " . URL_SHOP_PAYMENT);
-		exit;
-	// 別のお届け先がチェックされている場合
-	} elseif($_POST['deliv_check'] >= 1) {
-		if (sfIsInt($_POST['deliv_check'])) {
-			// 登録済みの別のお届け先を受注一時テーブルに書き込む
-			lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['deliv_check']);
-			// 正常に登録されたことを記録しておく
-			$objSiteSess->setRegistFlag();
-			// お支払い方法選択ページへ移動
-			header("Location: " . URL_SHOP_PAYMENT);
-			exit;
-		}
-	}else{
-		// エラーを返す
-		$arrErr['deli'] = '※ お届け先を選択してください。';
-	}	
-	break;
-// 前のページに戻る
-case 'return':
-	// 確認ページへ移動
-	header("Location: " . URL_CART_TOP);
-	exit;
-	break;
-default:
-	$objQuery = new SC_Query();
-	$where = "order_temp_id = ?";
-	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
-	$objFormParam->setParam($arrRet[0]);
-	break;
-}
-
-/** 表示処理 **/
-
-// 会員登録住所の取得
-$col = "name01, name02, pref, addr01, addr02";
-$where = "customer_id = ?";
-$objQuery = new SC_Query();
-$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
-// 別のお届け先住所の取得
-$col = "other_deliv_id, name01, name02, pref, addr01, addr02";
-$objQuery->setorder("other_deliv_id DESC");
-$objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
-$objPage->arrAddr = $arrCustomerAddr;
-$objPage->tpl_addrmax = count($objOtherAddr);
-$cnt = 1;
-foreach($objOtherAddr as $val) {
-	$objPage->arrAddr[$cnt] = $val;
-	$cnt++;
-}
-
-// 入力値の取得
-$objPage->arrForm = $objFormParam->getFormParamList();
-$objPage->arrErr = $arrErr;
-
-$objView->assignobj($objPage);
-// フレームを選択(キャンペーンページから遷移なら変更)
-$objCampaignSess->pageView($objView);
-//--------------------------------------------------------------------------------------------------------------------------
-/* パラメータ情報の初期化 */
-function lfInitParam() {
-	global $objFormParam;
-	$objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("お名前2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("フリガナ1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("フリガナ2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("", "deliv_check");	
-}
-
-function lfInitLoginFormParam() {
-	global $objLoginFormParam;
-	$objLoginFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objLoginFormParam->addParam("メールアドレス", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-	$objLoginFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-}
-
-/* DBへデータの登録 */
-function lfRegistNewAddrData($uniqid, $objCustomer) {
-	global $objFormParam;
-	$arrRet = $objFormParam->getHashArray();
-	$sqlval = $objFormParam->getDbArray();
-	// 登録データの作成
-	$sqlval['deliv_check'] = '1';
-	$sqlval['order_temp_id'] = $uniqid;
-	$sqlval['update_date'] = 'Now()';
-	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
-	$sqlval['order_birth'] = $objCustomer->getValue('birth');
-	
-	sfRegistTempOrder($uniqid, $sqlval);
-}
-
-/* 会員情報の住所を一時受注テーブルへ */
-function lfRegistDelivData($uniqid, $objCustomer) {
-	// 登録データの作成
-	$sqlval['order_temp_id'] = $uniqid;
-	$sqlval['update_date'] = 'Now()';
-	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
-    $sqlval['deliv_check'] = '-1';
-	$sqlval['deliv_name01'] = $objCustomer->getValue('name01');
-    $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
-    $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
-    $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
-    $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
-    $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
-    $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
-    $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
-    $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
-    $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
-    $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
-	$sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
-
-    $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
-    $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
-	$sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
-
-	sfRegistTempOrder($uniqid, $sqlval);
-}
-
-/* 別のお届け先住所を一時受注テーブルへ */
-function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
-	// 登録データの作成
-	$sqlval['order_temp_id'] = $uniqid;
-	$sqlval['update_date'] = 'Now()';
-	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
-	$sqlval['order_birth'] = $objCustomer->getValue('birth');
-		
-	$objQuery = new SC_Query();
-	$where = "other_deliv_id = ?";
-	$arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
-	
-	$sqlval['deliv_check'] = $other_deliv_id;
-    $sqlval['deliv_name01'] = $arrRet[0]['name01'];
-    $sqlval['deliv_name02'] = $arrRet[0]['name02'];
-    $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
-    $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
-    $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
-    $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
-    $sqlval['deliv_pref'] = $arrRet[0]['pref'];
-    $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
-    $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
-    $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
-    $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
-	$sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
-	sfRegistTempOrder($uniqid, $sqlval);
-}
-
-/* 入力内容のチェック */
-function lfCheckError() {
-	global $objFormParam;
-	// 入力データを渡す。
-	$arrRet =  $objFormParam->getHashArray();
-	$objErr = new SC_CheckError($arrRet);
-	$objErr->arrErr = $objFormParam->checkError();
-	// 複数項目チェック
-	if ($_POST['mode'] == 'login'){
-	$objErr->doFunc(array("メールアドレス", "login_email", STEXT_LEN), array("EXIST_CHECK"));
-	$objErr->doFunc(array("パスワード", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
-	}
-	$objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
-	return $objErr->arrErr;
-}
+$objPage = new LC_Page_Shopping_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/html/shopping/index.php
===================================================================
--- /branches/feature-module-update/html/shopping/index.php	(revision 15080)
+++ /branches/feature-module-update/html/shopping/index.php	(revision 15223)
@@ -6,272 +6,14 @@
  */
 
+// {{{ requires
 require_once("../require.php");
+require_once(CLASS_PATH . "page_extends/shopping/LC_Page_Shopping_Ex.php");
 
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	var $tpl_login_email;
-	function LC_Page() {
-		$this->tpl_mainpage = 'shopping/index.tpl';
-		global $arrPref;
-		$this->arrPref = $arrPref;
-		global $arrSex;
-		$this->arrSex = $arrSex;
-		global $arrJob;
-		$this->arrJob = $arrJob;
-		$this->tpl_onload = 'fnCheckInputDeliv();';
-		
-		/*
-		 session_start時のno-cacheヘッダーを抑制することで
-		 「戻る」ボタン使用時の有効期限切れ表示を抑制する。
-		 private-no-expire:クライアントのキャッシュを許可する。
-		*/
-		session_cache_limiter('private-no-expire');				
-	}
-}
+// }}}
+// {{{ generate page
 
-$conn = new SC_DBConn();
-$objPage = new LC_Page();
-$objView = new SC_SiteView();
-$objSiteSess = new SC_SiteSession();
-$objCartSess = new SC_CartSession();
-$objCampaignSess = new SC_CampaignSession();
-$objCustomer = new SC_Customer();
-$objCookie = new SC_Cookie();
-$objFormParam = new SC_FormParam();			// フォーム用
-lfInitParam();								// パラメータ情報の初期化
-$objFormParam->setParam($_POST);			// POST値の取得
-
-// ユーザユニークIDの取得と購入状態の正当性をチェック
-$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
-
-$objPage->tpl_uniqid = $uniqid;
-
-// ログインチェック
-if($objCustomer->isLoginSuccess()) {
-	// すでにログインされている場合は、お届け先設定画面に転送
-	header("Location: ./deliv.php");
-	exit;
-}
-
-switch($_POST['mode']) {
-case 'nonmember_confirm':
-	$objPage = lfSetNonMember($objPage);
-	// ※breakなし
-case 'confirm':
-	// 入力値の変換
-	$objFormParam->convParam();
-	$objFormParam->toLower('order_mail');
-	$objFormParam->toLower('order_mail_check');
-	
-	$objPage->arrErr = lfCheckError();
-
-	// 入力エラーなし
-	if(count($objPage->arrErr) == 0) {
-		// DBへのデータ登録
-		lfRegistData($uniqid);
-		
-		// お届け先のコピー
-		lfCopyDeliv($uniqid, $_POST);
-		
-		// 正常に登録されたことを記録しておく
-		$objSiteSess->setRegistFlag();
-		// お支払い方法選択ページへ移動
-		header("Location: " . URL_SHOP_PAYMENT);
-		exit;		
-	}
-	
-	break;
-// 前のページに戻る
-case 'return':
-	// 確認ページへ移動
-	header("Location: " . URL_CART_TOP);
-	exit;
-	break;
-case 'nonmember':
-	$objPage = lfSetNonMember($objPage);
-	// ※breakなし
-default:
-	if($_GET['from'] == 'nonmember') {
-		$objPage = lfSetNonMember($objPage);
-	}
-	// ユーザユニークIDの取得
-	$uniqid = $objSiteSess->getUniqId();
-	$objQuery = new SC_Query();
-	$where = "order_temp_id = ?";
-	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
-	// DB値の取得
-	$objFormParam->setParam($arrRet[0]);
-	$objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
-	$objFormParam->setDBDate($arrRet[0]['order_birth']);
-	break;
-}
-
-// クッキー判定
-$objPage->tpl_login_email = $objCookie->getCookie('login_email');
-if($objPage->tpl_login_email != "") {
-	$objPage->tpl_login_memory = "1";
-}
-
-// 選択用日付の取得
-$objDate = new SC_Date(START_BIRTH_YEAR);
-$objPage->arrYear = $objDate->getYear('', 1950);	//　日付プルダウン設定
-$objPage->arrMonth = $objDate->getMonth();
-$objPage->arrDay = $objDate->getDay();
-
-if($objPage->year == '') {
-	$objPage->year = '----';
-}
-
-// 入力値の取得
-$objPage->arrForm = $objFormParam->getFormParamList();
-
-if($objPage->arrForm['year']['value'] == ""){
-	$objPage->arrForm['year']['value'] = '----';	
-}
-
-$objView->assignobj($objPage);
-// フレームを選択(キャンペーンページから遷移なら変更)
-$objCampaignSess->pageView($objView);
-//--------------------------------------------------------------------------------------------------------------------------
-/* 非会員入力ページのセット */
-function lfSetNonMember($objPage) {
-	$objPage->tpl_mainpage = 'shopping/nonmember_input.tpl';
-	$objPage->tpl_css = array();
-	$objPage->tpl_css[] = URL_DIR.'css/layout/login/nonmember.css';
-	return $objPage;
-}
-
-/* パラメータ情報の初期化 */
-function lfInitParam() {
-	global $objFormParam;
-	$objFormParam->addParam("お名前（姓）", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("お名前（名）", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("フリガナ（セイ）", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("フリガナ（メイ）", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("住所1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("住所2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("FAX番号1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("FAX番号2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("FAX番号3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("メールアドレス", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
-	$objFormParam->addParam("メールアドレス（確認）", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
-	$objFormParam->addParam("年", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
-	$objFormParam->addParam("月", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
-	$objFormParam->addParam("日", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
-	$objFormParam->addParam("性別", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("職業", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("別のお届け先", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("お名前（姓）", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("お名前（名）", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("フリガナ（セイ）", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("フリガナ（メイ）", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-	$objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-	$objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-	$objFormParam->addParam("メールマガジン", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
-}
-
-/* DBへデータの登録 */
-function lfRegistData($uniqid) {
-	global $objFormParam;
-	$arrRet = $objFormParam->getHashArray();
-	$sqlval = $objFormParam->getDbArray();
-	// 登録データの作成
-	$sqlval['order_temp_id'] = $uniqid;
-	$sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
-	$sqlval['update_date'] = 'Now()';
-	$sqlval['customer_id'] = '0';
-	
-	// 既存データのチェック
-	$objQuery = new SC_Query();
-	$where = "order_temp_id = ?";
-	$cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
-	// 既存データがない場合
-	if ($cnt == 0) {
-		$sqlval['create_date'] = 'Now()';
-		$objQuery->insert("dtb_order_temp", $sqlval);
-	} else {
-		$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
-	}
-	
-}
-
-/* 入力内容のチェック */
-function lfCheckError() {
-	global $objFormParam;
-	// 入力データを渡す。
-	$arrRet =  $objFormParam->getHashArray();
-	$objErr = new SC_CheckError($arrRet);
-	$objErr->arrErr = $objFormParam->checkError();
-		
-	// 別のお届け先チェック
-	if($_POST['deliv_check'] == "1") { 
-		$objErr->doFunc(array("お名前（姓）", "deliv_name01"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("お名前（名）", "deliv_name02"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("フリガナ（セイ）", "deliv_kana01"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("フリガナ（メイ）", "deliv_kana02"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("郵便番号1", "deliv_zip01"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("郵便番号2", "deliv_zip02"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("都道府県", "deliv_pref"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("住所1", "deliv_addr01"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("住所2", "deliv_addr02"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("電話番号1", "deliv_tel01"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("電話番号2", "deliv_tel02"), array("EXIST_CHECK"));
-		$objErr->doFunc(array("電話番号3", "deliv_tel03"), array("EXIST_CHECK"));
-	}
-	
-	// 複数項目チェック
-	$objErr->doFunc(array("TEL", "order_tel01", "order_tel02", "order_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
-	$objErr->doFunc(array("FAX", "order_fax01", "order_fax02", "order_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
-	$objErr->doFunc(array("郵便番号", "order_zip01", "order_zip02"), array("ALL_EXIST_CHECK"));
-	$objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
-	$objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
-	$objErr->doFunc(array("郵便番号", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
-	$objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
-	$objErr->doFunc(array("メールアドレス", "メールアドレス（確認）", "order_email", "order_email_check"), array("EQUAL_CHECK"));
-	
-	// すでにメルマガテーブルに会員としてメールアドレスが登録されている場合
-	if(sfCheckCustomerMailMaga($arrRet['order_email'])) {
-		$objErr->arrErr['order_email'] = "このメールアドレスはすでに登録されています。<br />";
-	}
-		
-	return $objErr->arrErr;
-}
-
-// 受注一時テーブルのお届け先をコピーする
-function lfCopyDeliv($uniqid, $arrData) {
-	$objQuery = new SC_Query();
-	
-	// 別のお届け先を指定していない場合、配送先に登録住所をコピーする。
-	if($arrData["deliv_check"] != "1") {
-		$sqlval['deliv_name01'] = $arrData['order_name01'];
-		$sqlval['deliv_name02'] = $arrData['order_name02'];
-		$sqlval['deliv_kana01'] = $arrData['order_kana01'];
-		$sqlval['deliv_kana02'] = $arrData['order_kana02'];
-		$sqlval['deliv_pref'] = $arrData['order_pref'];
-		$sqlval['deliv_zip01'] = $arrData['order_zip01'];
-		$sqlval['deliv_zip02'] = $arrData['order_zip02'];
-		$sqlval['deliv_addr01'] = $arrData['order_addr01'];
-		$sqlval['deliv_addr02'] = $arrData['order_addr02'];
-		$sqlval['deliv_tel01'] = $arrData['order_tel01'];
-		$sqlval['deliv_tel02'] = $arrData['order_tel02'];
-		$sqlval['deliv_tel03'] = $arrData['order_tel03'];
-		$where = "order_temp_id = ?";
-		$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
-	}
-}
-
-
+$objPage = new LC_Page_Shopping_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/html/shopping/complete.php
===================================================================
--- /branches/feature-module-update/html/shopping/complete.php	(revision 15080)
+++ /branches/feature-module-update/html/shopping/complete.php	(revision 15223)
@@ -1,4 +1,4 @@
 <?php
-/* 
+/*
  * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
  *
@@ -6,528 +6,14 @@
  */
 
+// {{{ requires
 require_once("../require.php");
+require_once(CLASS_PATH . "page_extends/shopping/LC_Page_Shopping_Complete_Ex.php");
 
-class LC_Page {
-	function LC_Page() {
-		$this->tpl_mainpage = 'shopping/complete.tpl';
-		$this->tpl_css = URL_DIR.'css/layout/shopping/complete.css';
-		$this->tpl_title = "ご注文完了";
-		global $arrCONVENIENCE;
-		$this->arrCONVENIENCE = $arrCONVENIENCE;
-		global $arrCONVENIMESSAGE;
-		$this->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
-		global $arrCONVENIENCE;
-		global $arrCONVENIMESSAGE;
-		$objPage->arrCONVENIENCE = $arrCONVENIENCE;
-		$objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
-		/*
-		 session_start時のno-cacheヘッダーを抑制することで
-		 「戻る」ボタン使用時の有効期限切れ表示を抑制する。
-		 private-no-expire:クライアントのキャッシュを許可する。
-		*/
-		session_cache_limiter('private-no-expire');		
+// }}}
+// {{{ generate page
 
-	}
-}
-
-$conn = new SC_DBConn();
-$objPage = new LC_Page();
-$objView = new SC_SiteView();
-$objSiteSess = new SC_SiteSession();
-$objCartSess = new SC_CartSession();
-$objCampaignSess = new SC_CampaignSession();
-$objSiteInfo = $objView->objSiteInfo;
-$arrInfo = $objSiteInfo->data;
-$objCustomer = new SC_Customer();
-
-// 前のページで正しく登録手続きが行われたか判定
-sfIsPrePage($objSiteSess);
-// ユーザユニークIDの取得と購入状態の正当性をチェック
-$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
-if ($uniqid != "") {
-	
-	// 完了処理
-	$objQuery = new SC_Query();
-	$objQuery->begin();
-	$order_id = lfDoComplete($objQuery, $uniqid);
-	$objQuery->commit();
-	
-	// セッションに保管されている情報を更新する
-	$objCustomer->updateSession();
-
-	// 完了メール送信
-	if($order_id != "") {
-		sfSendOrderMail($order_id, '1');
-	}
-
-	// その他情報の取得
-	$arrResults = $objQuery->getall("SELECT memo02, memo05 FROM dtb_order WHERE order_id = ? ", array($order_id));
-
-	if (count($arrResults) > 0) {	
-		if (isset($arrResults[0]["memo02"]) || isset($arrResults[0]["memo05"])) {
-			// 完了画面で表示する決済内容
-			$arrOther = unserialize($arrResults[0]["memo02"]);
-			// 完了画面から送信する決済内容
-			$arrModuleParam = unserialize($arrResults[0]["memo05"]);
-			
-			// データを編集
-			foreach($arrOther as $key => $val){
-				// URLの場合にはリンクつきで表示させる
-				if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
-					$arrOther[$key]["value"] = "<a href='#' onClick=\"window.open('". $val["value"] . "'); \" >" . $val["value"] ."</a>";
-				}
-			}
-					
-			$objPage->arrOther = $arrOther;
-			$objPage->arrModuleParam = $arrModuleParam;
-		}
-	}
-	
-	// アフィリエイト用コンバージョンタグの設定
-	$objPage->tpl_conv_page = AFF_SHOPPING_COMPLETE;
-	$objPage->tpl_aff_option = "order_id=$order_id";
-	//合計価格の取得
-	$total = $objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
-	if($total != "") {
-		$objPage->tpl_aff_option.= "|total=$total";
-	}
-}
-
-$objPage->arrInfo = $arrInfo;
-// キャンペーンからの遷移かチェック
-$objPage->is_campaign = $objCampaignSess->getIsCampaign();
-$objPage->campaign_dir = $objCampaignSess->getCampaignDir();
-
-$objView->assignobj($objPage);
-// フレームを選択(キャンペーンページから遷移なら変更)
-$objCampaignSess->pageView($objView);
-
-// セッション開放
-$objCampaignSess->delCampaign();
-//--------------------------------------------------------------------------------------------------------------------------
-// エビスタグ引渡し用データを生成する
-function lfGetEbisData($order_id) {
-	$objQuery = new SC_Query();
-	$col = "customer_id, total, order_sex, order_job, to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) AS order_age";
-	$arrRet = $objQuery->select($col, "dtb_order", "order_id = ?", array($order_id));
-	
-	if($arrRet[0]['customer_id'] > 0) {
-		// 会員番号
-		$arrEbis['m1id'] = $arrRet[0]['customer_id'];
-		// 非会員or会員
-		$arrEbis['o5id'] = '1';
-	} else {
-		// 会員番号
-		$arrEbis['m1id'] = '';
-		// 非会員or会員
-		$arrEbis['o5id'] = '2';	
-	}
-	
-	// 購入金額
-	$arrEbis['a1id'] = $arrRet[0]['total'];
-	// 性別
-	$arrEbis['o2id'] = $arrRet[0]['order_sex'];
-	// 年齢
-	$arrEbis['o3id'] = $arrRet[0]['order_age'];
-	// 職業
-	$arrEbis['o4id'] = $arrRet[0]['order_job'];
-		
-	$objQuery->setgroupby("product_id");
-	$arrRet = $objQuery->select("product_id", "dtb_order_detail", "order_id = ?", array($order_id));
-	$arrProducts = sfSwapArray($arrRet);
-	
-	$line = "";
-	// 商品IDをアンダーバーで接続する。
-	foreach($arrProducts['product_id'] as $val) {
-		if($line != "") {
-			$line .= "_$val";		
-		} else {
-			$line .= "$val";
-		}
-	}
-	
-	// 商品ID	
-	$arrEbis['o1id'] = $line;
-	
-	return $arrEbis;
-}
-
-// 完了処理
-function lfDoComplete($objQuery, $uniqid) {
-	global $objCartSess;
-	global $objSiteSess;
-	global $objCampaignSess;
-	global $objCustomer;
-	global $arrInfo;
-	
-	// 一時受注テーブルの読込
-	$arrData = sfGetOrderTemp($uniqid);
-
-	// 会員情報登録処理
-	if ($objCustomer->isLoginSuccess()) {
-		// 新お届け先の登録
-		lfSetNewAddr($uniqid, $objCustomer->getValue('customer_id'));
-		// 購入集計を顧客テーブルに反映
-		lfSetCustomerPurchase($objCustomer->getValue('customer_id'), $arrData, $objQuery);
-	} else {
-		//購入時強制会員登録
-		switch(PURCHASE_CUSTOMER_REGIST) {
-		//無効
-		case '0':
-			// 購入時会員登録
-			if($arrData['member_check'] == '1') {
-				// 仮会員登録
-				$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
-				// 購入集計を顧客テーブルに反映
-				lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
-			}
-			break;
-		//有効
-		case '1':
-			// 仮会員登録
-			$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
-			// 購入集計を顧客テーブルに反映
-			lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
-			break;
-		}
-		
-	}
-	// 一時テーブルを受注テーブルに格納する
-	$order_id = lfRegistOrder($objQuery, $arrData, $objCampaignSess);
-	// カート商品を受注詳細テーブルに格納する
-	lfRegistOrderDetail($objQuery, $order_id, $objCartSess);
-	// 受注一時テーブルの情報を削除する。
-	lfDeleteTempOrder($objQuery, $uniqid);
-	// キャンペーンからの遷移の場合登録する。
-	if($objCampaignSess->getIsCampaign() and $objCartSess->chkCampaign($objCampaignSess->getCampaignId())) {
-		lfRegistCampaignOrder($objQuery, $objCampaignSess, $order_id);
-	}
-	
-	// セッションカート内の商品を削除する。
-	$objCartSess->delAllProducts();
-	// 注文一時IDを解除する。
-	$objSiteSess->unsetUniqId();
-	
-	return $order_id;
-}
-
-// 会員登録（仮登録）
-function lfRegistPreCustomer($arrData, $arrInfo) {
-	// 購入時の会員登録
-	$sqlval['name01'] = $arrData['order_name01'];
-	$sqlval['name02'] = $arrData['order_name02'];
-	$sqlval['kana01'] = $arrData['order_kana01'];
-	$sqlval['kana02'] = $arrData['order_kana02'];
-	$sqlval['zip01'] = $arrData['order_zip01'];
-	$sqlval['zip02'] = $arrData['order_zip02'];
-	$sqlval['pref'] = $arrData['order_pref'];
-	$sqlval['addr01'] = $arrData['order_addr01'];
-	$sqlval['addr02'] = $arrData['order_addr02'];
-	$sqlval['email'] = $arrData['order_email'];
-	$sqlval['tel01'] = $arrData['order_tel01'];
-	$sqlval['tel02'] = $arrData['order_tel02'];
-	$sqlval['tel03'] = $arrData['order_tel03'];
-	$sqlval['fax01'] = $arrData['order_fax01'];
-	$sqlval['fax02'] = $arrData['order_fax02'];
-	$sqlval['fax03'] = $arrData['order_fax03'];
-	$sqlval['sex'] = $arrData['order_sex'];
-	$sqlval['password'] = $arrData['password'];
-	$sqlval['reminder'] = $arrData['reminder'];
-	$sqlval['reminder_answer'] = $arrData['reminder_answer'];
-	
-	// メルマガ配信用フラグの判定
-	switch($arrData['mail_flag']) {
-	case '1':	// HTMLメール
-		$mail_flag = 4;
-		break;
-	case '2':	// TEXTメール
-		$mail_flag = 5;
-		break;
-	case '3':	// 希望なし
-		$mail_flag = 6;
-		break;
-	default:
-		$mail_flag = 6;
-		break;
-	}
-	// メルマガフラグ
-	$sqlval['mailmaga_flg'] = $mail_flag;
-		
-	// 会員仮登録
-	$sqlval['status'] = 1;
-	// URL判定用キー
-	$sqlval['secret_key'] = sfGetUniqRandomId("t"); 
-	
-	$objQuery = new SC_Query();
-	$sqlval['create_date'] = "now()";
-	$sqlval['update_date'] = "now()";
-	$objQuery->insert("dtb_customer", $sqlval);
-	
-	// 顧客IDの取得
-	$arrRet = $objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
-	$customer_id = $arrRet[0]['customer_id'];
-	
-	//　仮登録完了メール送信
-	$objMailPage = new LC_Page();
-	$objMailPage->to_name01 = $arrData['order_name01'];
-	$objMailPage->to_name02 = $arrData['order_name02'];
-	$objMailPage->CONF = $arrInfo;
-	$objMailPage->uniqid = $sqlval['secret_key'];
-	$objMailView = new SC_SiteView();
-	$objMailView->assignobj($objMailPage);
-	$body = $objMailView->fetch("mail_templates/customer_mail.tpl");
-	
-	$objMail = new GC_SendMail();
-	$objMail->setItem(
-						''										//　宛先
-						, sfMakeSubject("会員登録のご確認")		//　サブジェクト
-						, $body									//　本文
-						, $arrInfo['email03']					//　配送元アドレス
-						, $arrInfo['shop_name']					//　配送元　名前
-						, $arrInfo["email03"]					//　reply_to
-						, $arrInfo["email04"]					//　return_path
-						, $arrInfo["email04"]					//  Errors_to
-						, $arrInfo["email01"]					//  Bcc
-														);
-	// 宛先の設定
-	$name = $arrData['order_name01'] . $arrData['order_name02'] ." 様";
-	$objMail->setTo($arrData['order_email'], $name);			
-	$objMail->sendMail();
-	
-	return $customer_id;
-}
-
-// 受注テーブルへ登録
-function lfRegistOrder($objQuery, $arrData, $objCampaignSess) {
-	$sqlval = $arrData;
-
-	// 受注テーブルに書き込まない列を除去
-	unset($sqlval['mailmaga_flg']);		// メルマガチェック
-	unset($sqlval['deliv_check']);		// 別のお届け先チェック
-	unset($sqlval['point_check']);		// ポイント利用チェック
-	unset($sqlval['member_check']);		// 購入時会員チェック
-	unset($sqlval['password']);			// ログインパスワード
-	unset($sqlval['reminder']);			// リマインダー質問
-	unset($sqlval['reminder_answer']);	// リマインダー答え
-	unset($sqlval['mail_flag']);		// メールフラグ
-	unset($sqlval['session']);		    // セッション情報
-	
-	// 注文ステータス:指定が無ければ新規受付に設定
-	if($sqlval["status"] == ""){
-		$sqlval['status'] = '1';			
-	}
-	
-	// 別のお届け先を指定していない場合、配送先に登録住所をコピーする。
-	if($arrData["deliv_check"] == "-1") {
-		$sqlval['deliv_name01'] = $arrData['order_name01'];
-		$sqlval['deliv_name02'] = $arrData['order_name02'];
-		$sqlval['deliv_kana01'] = $arrData['order_kana01'];
-		$sqlval['deliv_kana02'] = $arrData['order_kana02'];
-		$sqlval['deliv_pref'] = $arrData['order_pref'];
-		$sqlval['deliv_zip01'] = $arrData['order_zip01'];
-		$sqlval['deliv_zip02'] = $arrData['order_zip02'];
-		$sqlval['deliv_addr01'] = $arrData['order_addr01'];
-		$sqlval['deliv_addr02'] = $arrData['order_addr02'];
-		$sqlval['deliv_tel01'] = $arrData['order_tel01'];
-		$sqlval['deliv_tel02'] = $arrData['order_tel02'];
-		$sqlval['deliv_tel03'] = $arrData['order_tel03'];
-	}
-	
-	$order_id = $arrData['order_id'];		// オーダーID
-	$sqlval['create_date'] = 'now()';		// 受注日
-	
-	// キャンペーンID
-	if($objCampaignSess->getIsCampaign()) $sqlval['campaign_id'] = $objCampaignSess->getCampaignId();
-
-	// ゲットの値をインサート
-	//$sqlval = lfGetInsParam($sqlval);
-	
-	// INSERTの実行
-	$objQuery->insert("dtb_order", $sqlval);
-	
-	return $order_id;
-}
-
-// 受注詳細テーブルへ登録
-function lfRegistOrderDetail($objQuery, $order_id, $objCartSess) {
-	// カート内情報の取得
-	$arrCart = $objCartSess->getCartList();
-	$max = count($arrCart);
-	
-	// 既に存在する詳細レコードを消しておく。
-	$objQuery->delete("dtb_order_detail", "order_id = $order_id");
-
-	// 規格名一覧
-	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
-	// 規格分類名一覧
-	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
-			
-	for ($i = 0; $i < $max; $i++) {
-		// 商品規格情報の取得	
-		$arrData = sfGetProductsClass($arrCart[$i]['id']);
-		
-		// 存在する商品のみ表示する。
-		if($arrData != "") {
-			$sqlval['order_id'] = $order_id;
-			$sqlval['product_id'] = $arrCart[$i]['id'][0];
-			$sqlval['classcategory_id1'] = $arrCart[$i]['id'][1];
-			$sqlval['classcategory_id2'] = $arrCart[$i]['id'][2];
-			$sqlval['product_name'] = $arrData['name'];
-			$sqlval['product_code'] = $arrData['product_code'];
-			$sqlval['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
-			$sqlval['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
-			$sqlval['point_rate'] = $arrCart[$i]['point_rate'];			
-			$sqlval['price'] = $arrCart[$i]['price'];
-			$sqlval['quantity'] = $arrCart[$i]['quantity'];
-			lfReduceStock($objQuery, $arrCart[$i]['id'], $arrCart[$i]['quantity']);
-			// INSERTの実行
-			$objQuery->insert("dtb_order_detail", $sqlval);
-		} else {
-			sfDispSiteError(CART_NOT_FOUND);
-		}
-	}
-}
-
-// キャンペーン受注テーブルへ登録
-function lfRegistCampaignOrder($objQuery, $objCampaignSess, $order_id) {
-
-	// 受注データを取得
-	$cols = "order_id, campaign_id, customer_id, message, order_name01, order_name02,".
-			"order_kana01, order_kana02, order_email, order_tel01, order_tel02, order_tel03,".
-			"order_fax01, order_fax02, order_fax03, order_zip01, order_zip02, order_pref, order_addr01,".
-			"order_addr02, order_sex, order_birth, order_job, deliv_name01, deliv_name02, deliv_kana01,".
-			"deliv_kana02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_fax01, deliv_fax02, deliv_fax03,".
-			"deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, payment_total";
-
-	$arrOrder = $objQuery->select($cols, "dtb_order", "order_id = ?", array($order_id)); 
-			
-	$sqlval = $arrOrder[0];
-    $sqlval['create_date'] = 'now()';
-		
-	// INSERTの実行
-	$objQuery->insert("dtb_campaign_order", $sqlval);
-	
-	// 申し込み数の更新
-	$total_count = $objQuery->get("dtb_campaign", "total_count", "campaign_id = ?", array($sqlval['campaign_id']));
-	$arrCampaign['total_count'] = $total_count += 1;
-	$objQuery->update("dtb_campaign", $arrCampaign, "campaign_id = ?", array($sqlval['campaign_id']));
-	
-}
-
-
-
-/* 受注一時テーブルの削除 */
-function lfDeleteTempOrder($objQuery, $uniqid) {
-	$where = "order_temp_id = ?";
-	$sqlval['del_flg'] = 1;
-	$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
-	// $objQuery->delete("dtb_order_temp", $where, array($uniqid));
-}
-
-// 受注一時テーブルの住所が登録済みテーブルと異なる場合は、別のお届け先に追加する
-function lfSetNewAddr($uniqid, $customer_id) {
-	$objQuery = new SC_Query();
-	$diff = false;
-	$find_same = false;
-	
-	$col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
-	$where = "order_temp_id = ?";
-	$arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
-	
-	// 要素名のdeliv_を削除する。
-	foreach($arrRet[0] as $key => $val) {
-		$keyname = ereg_replace("^deliv_", "", $key);
-		$arrNew[$keyname] = $val;
-	}
-	
-	// 会員情報テーブルとの比較
-	$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
-	$where = "customer_id = ?";
-	$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
-	
-	// 会員情報の住所と異なる場合
-	if($arrNew != $arrCustomerAddr[0]) {
-		// 別のお届け先テーブルの住所と比較する
-		$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
-		$where = "customer_id = ?";
-		$arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
-
-		foreach($arrOtherAddr as $arrval) {
-			if($arrNew == $arrval) {
-				// すでに同じ住所が登録されている
-				$find_same = true;
-			}
-		}
-		
-		if(!$find_same) {
-			$diff = true;
-		}
-	}
-	
-	// 新しいお届け先が登録済みのものと異なる場合は別のお届け先テーブルに登録する
-	if($diff) {
-		$sqlval = $arrNew;
-		$sqlval['customer_id'] = $customer_id;
-		$objQuery->insert("dtb_other_deliv", $sqlval);
-	}
-}
-
-/* 購入情報を会員テーブルに登録する */
-function lfSetCustomerPurchase($customer_id, $arrData, $objQuery) {
-	$col = "first_buy_date, last_buy_date, buy_times, buy_total, point";
-	$where = "customer_id = ?";
-	$arrRet = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
-	$sqlval = $arrRet[0];
-	
-	if($sqlval['first_buy_date'] == "") {
-		$sqlval['first_buy_date'] = "Now()";
-	}
-	$sqlval['last_buy_date'] = "Now()";
-	$sqlval['buy_times']++;
-	$sqlval['buy_total']+= $arrData['total'];
-	$sqlval['point'] = ($sqlval['point'] + $arrData['add_point'] - $arrData['use_point']);
-	
-	// ポイントが不足している場合
-	if($sqlval['point'] < 0) {
-		$objQuery->rollback();
-		sfDispSiteError(LACK_POINT);
-	}
-	
-	$objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
-}
-
-// 在庫を減らす処理
-function lfReduceStock($objQuery, $arrID, $quantity) {
-	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
-	$arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
-	
-	// 売り切れエラー
-	if(($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
-		$objQuery->rollback();
-		sfDispSiteError(SOLD_OUT, "", true);
-	// 無制限の場合、在庫はNULL
-	} elseif($arrRet[0]['stock_unlimited'] == '1') {
-		$sqlval['stock'] = null;
-		$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
-	// 在庫を減らす
-	} else {
-		$sqlval['stock'] = ($arrRet[0]['stock'] - $quantity);
-		if($sqlval['stock'] == "") {
-			$sqlval['stock'] = '0';
-		}		
-		$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
-	}
-}
-
-// GETの値をインサート用に整える
-function lfGetInsParam($sqlVal){
-	
-	foreach($_GET as $key => $val){
-		// カラムの存在チェック
-		if(sfColumnExists("dtb_order", $key)) $sqlVal[$key] = $val;
-	}
-	
-	return $sqlVal;
-}
-
+$objPage = new LC_Page_Shopping_Complete_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Confirm.php
===================================================================
--- /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Confirm.php	(revision 15223)
+++ /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Confirm.php	(revision 15223)
@@ -0,0 +1,157 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * 入力内容確認のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Confirm extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'shopping/confirm.tpl';
+        $this->tpl_css = URL_DIR.'css/layout/shopping/confirm.css';
+        $this->tpl_title = "ご入力内容のご確認";
+        $masterData = new SC_DB_MasterData();
+        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+        $this->arrSex = $masterData->getMasterData("mtb_sex");
+        $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type");
+        $this->arrReminder = $masterData->getMasterData("mtb_reminder");
+
+        $this->allowClientCache();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView = new SC_SiteView();
+        $objCartSess = new SC_CartSession();
+        $objSiteInfo = $objView->objSiteInfo;
+        $objSiteSess = new SC_SiteSession();
+        $objCampaignSess = new SC_CampaignSession();
+        $objCustomer = new SC_Customer();
+        $arrInfo = $objSiteInfo->data;
+        $objQuery = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
+
+        // 前のページで正しく登録手続きが行われた記録があるか判定
+        SC_Utils_Ex::sfIsPrePage($objSiteSess);
+
+        // ユーザユニークIDの取得と購入状態の正当性をチェック
+        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
+        $this->tpl_uniqid = $uniqid;
+
+        // カート集計処理
+        $this = SC_Utils_Ex::sfTotalCart($this, $objCartSess, $arrInfo);
+        // 一時受注テーブルの読込
+        $arrData = SC_Utils_Ex::sfGetOrderTemp($uniqid);
+        // カート集計を元に最終計算
+        $arrData = sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer, $objCampaignSess);
+        // キャンペーンからの遷移で送料が無料だった場合の処理
+        if($objCampaignSess->getIsCampaign()) {
+            $deliv_free_flg = $objQuery->get("dtb_campaign", "deliv_free_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId()));
+            // 送料無料が設定されていた場合
+            if($deliv_free_flg) {
+                $arrData['payment_total'] -= $arrData['deliv_fee'];
+                $arrData['deliv_fee'] = 0;
+            }
+        }
+
+
+        // カート内の商品の売り切れチェック
+        $objCartSess->chkSoldOut($objCartSess->getCartList());
+
+        // 会員ログインチェック
+        if($objCustomer->isLoginSuccess()) {
+            $this->tpl_login = '1';
+            $this->tpl_user_point = $objCustomer->getValue('point');
+        }
+
+        // 決済区分を取得する
+        $payment_type = "";
+        if($objDb->sfColumnExists("dtb_payment", "memo01")){
+            // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
+            $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
+            $arrPayment = $objQuery->getall($sql, array($arrData['payment_id']));
+            $payment_type = $arrPayment[0]["memo03"];
+        }
+        $this->payment_type = $payment_type;
+
+
+        switch($_POST['mode']) {
+        // 前のページに戻る
+        case 'return':
+            // 正常な推移であることを記録しておく
+            $objSiteSess->setRegistFlag();
+            header("Location: " . URL_SHOP_PAYMENT);
+            exit;
+            break;
+        case 'confirm':
+            // この時点でオーダーIDを確保しておく（クレジット、コンビニ決済で必要なため）
+            // postgresqlとmysqlとで処理を分ける
+            if (DB_TYPE == "pgsql") {
+                $order_id = $objQuery->nextval("dtb_order","order_id");
+            }elseif (DB_TYPE == "mysql") {
+                $order_id = $objQuery->get_auto_increment("dtb_order");
+            }
+            $arrData["order_id"] = $order_id;
+
+            // セッション情報を保持
+            $arrData['session'] = serialize($_SESSION);
+
+            // 集計結果を受注一時テーブルに反映
+            sfRegistTempOrder($uniqid, $arrData);
+            // 正常に登録されたことを記録しておく
+            $objSiteSess->setRegistFlag();
+
+            // 決済方法により画面切替
+            if($payment_type != "") {
+                // TODO 決済方法のモジュールは Plugin として実装したい
+                $_SESSION["payment_id"] = $arrData['payment_id'];
+                header("Location: " . URL_SHOP_MODULE);
+            }else{
+                header("Location: " . URL_SHOP_COMPLETE);
+            }
+            break;
+        default:
+            break;
+        }
+
+        $this->arrData = $arrData;
+        $this->arrInfo = $arrInfo;
+        $objView->assignobj($this);
+        // フレームを選択(キャンペーンページから遷移なら変更)
+        $objCampaignSess->pageView($objView);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Payment.php
===================================================================
--- /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 15223)
+++ /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 15223)
@@ -0,0 +1,368 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * 支払い方法選択 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Payment extends LC_Page {
+
+    // {{{ properties
+
+    /** フォームパラメータの配列 */
+    var $objFormParam;
+
+    /** 顧客情報のインスタンス */
+    var $objCustomer;
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_css = URL_DIR.'css/layout/shopping/pay.css';
+        $this->tpl_mainpage = 'shopping/payment.tpl';
+        $this->tpl_onload = 'fnCheckInputPoint();';
+        $this->tpl_title = "お支払方法・お届け時間等の指定";
+
+        $this->allowClientCache();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView = new SC_SiteView();
+        $objSiteSess = new SC_SiteSession();
+        $objCartSess = new SC_CartSession();
+        $objCampaignSess = new SC_CampaignSession();
+        $this->objCustomer = new SC_Customer();
+        $objSiteInfo = $objView->objSiteInfo;
+        $arrInfo = $objSiteInfo->data;
+
+        // パラメータ管理クラス
+        $this->objFormParam = new SC_FormParam();
+        // パラメータ情報の初期化
+        $this->lfInitParam();
+        // POST値の取得
+        $this->objFormParam->setParam($_POST);
+
+        // ユーザユニークIDの取得と購入状態の正当性をチェック
+        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
+        // ユニークIDを引き継ぐ
+        $this->tpl_uniqid = $uniqid;
+
+        // 会員ログインチェック
+        if($objCustomer->isLoginSuccess()) {
+            $this->tpl_login = '1';
+            $this->tpl_user_point = $objCustomer->getValue('point');
+            //戻り先URL
+            $this->tpl_back_url = URL_DELIV_TOP;
+        } else {
+            $this->tpl_back_url = URL_SHOP_TOP . "?from=nonmember";
+        }
+
+        // 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の個数が０になる)
+        $this = SC_Utils_Ex::sfTotalCart($this, $objCartSess, $arrInfo);
+        $this->arrData = SC_Utils_Ex::sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo);
+
+        // カー都内の商品の売り切れチェック
+        $objCartSess->chkSoldOut($objCartSess->getCartList());
+
+        switch($_POST['mode']) {
+        case 'confirm':
+            // 入力値の変換
+            $this->objFormParam->convParam();
+            $this->arrErr = $this->lfCheckError($this->arrData );
+            // 入力エラーなし
+            if(count($this->arrErr) == 0) {
+                // DBへのデータ登録
+                $this->lfRegistData($uniqid);
+                // 正常に登録されたことを記録しておく
+                $objSiteSess->setRegistFlag();
+                // 確認ページへ移動
+                $this->sendRedirect($this->getLocation(URL_SHOP_CONFIRM, array(), true));
+                exit;
+            }else{
+                // ユーザユニークIDの取得
+                $uniqid = $objSiteSess->getUniqId();
+                // 受注一時テーブルからの情報を格納
+                $this->lfSetOrderTempData($uniqid);
+            }
+            break;
+        // 前のページに戻る
+        case 'return':
+            // 非会員の場合
+            // 正常な推移であることを記録しておく
+            $objSiteSess->setRegistFlag();
+            $this->sendRedirect(URL_SHOP_TOP);
+            exit;
+            break;
+        // 支払い方法が変更された場合
+        case 'payment':
+            // ここのbreakは、意味があるので外さないで下さい。
+            break;
+        default:
+            // 受注一時テーブルからの情報を格納
+            $this->lfSetOrderTempData($uniqid);
+            break;
+        }
+
+        // 店舗情報の取得
+        $arrInfo = $objSiteInfo->data;
+        // 購入金額の取得得
+        $total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+        // 支払い方法の取得
+        $this->arrPayment = $this->lfGetPayment($total_pretax);
+        // 配送時間の取得
+        $arrRet = $this->sfGetDelivTime($this->objFormParam->getValue('payment_id'));
+        $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time');
+        $this->objCustomer = $objCustomer;
+        //　配送日一覧の取得
+        $this->arrDelivDate = $this->lfGetDelivDate();
+
+        $this->arrForm = $this->objFormParam->getFormParamList();
+
+        $objView->assignobj($this);
+        // フレームを選択(キャンペーンページから遷移なら変更)
+        $objCampaignSess->pageView($objView);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* パラメータ情報の初期化 */
+    function lfInitParam() {
+        $this->objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("ポイント", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START"));
+        $this->objFormParam->addParam("配達時間", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("ご質問", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("ポイントを使用する", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2');
+        $this->objFormParam->addParam("配達日", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+    }
+
+    function lfGetPayment($total_pretax) {
+        $objQuery = new SC_Query();
+        $objQuery->setorder("rank DESC");
+        //削除されていない支払方法を取得
+        $arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "del_flg = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE del_flg = 0) ");
+        //利用条件から支払可能方法を判定
+        foreach($arrRet as $data) {
+            //下限と上限が設定されている
+            if($data['rule'] > 0 && $data['upper_rule'] > 0) {
+                if($data['rule'] <= $total_pretax && $data['upper_rule'] >= $total_pretax) {
+                    $arrPayment[] = $data;
+                }
+            //下限のみ設定されている
+            } elseif($data['rule'] > 0) {
+                if($data['rule'] <= $total_pretax) {
+                    $arrPayment[] = $data;
+                }
+            //上限のみ設定されている
+            } elseif($data['upper_rule'] > 0) {
+                if($data['upper_rule'] >= $total_pretax) {
+                    $arrPayment[] = $data;
+                }
+            //設定なし
+            } else {
+                $arrPayment[] = $data;
+            }
+        }
+        return $arrPayment;
+    }
+
+    /* 入力内容のチェック */
+    function lfCheckError($arrData) {
+        // 入力データを渡す。
+        $arrRet =  $this->objFormParam->getHashArray();
+        $objErr = new SC_CheckError($arrRet);
+        $objErr->arrErr = $this->objFormParam->checkError();
+
+        if($_POST['point_check'] == '1') {
+            $objErr->doFunc(array("ポイントを使用する", "point_check"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("ポイント", "use_point"), array("EXIST_CHECK"));
+            $max_point = $this->objCustomer->getValue('point');
+            if($max_point == "") {
+                $max_point = 0;
+            }
+            if($arrRet['use_point'] > $max_point) {
+                $objErr->arrErr['use_point'] = "※ ご利用ポイントが所持ポイントを超えています。<br />";
+            }
+            if(($arrRet['use_point'] * POINT_VALUE) > $arrData['subtotal']) {
+                $objErr->arrErr['use_point'] = "※ ご利用ポイントがご購入金額を超えています。<br />";
+            }
+        }
+        return $objErr->arrErr;
+    }
+
+    /* 支払い方法文字列の取得 */
+    function lfGetPaymentInfo($payment_id) {
+        $objQuery = new SC_Query();
+        $where = "payment_id = ?";
+        $arrRet = $objQuery->select("payment_method, charge", "dtb_payment", $where, array($payment_id));
+        return (array($arrRet[0]['payment_method'], $arrRet[0]['charge']));
+    }
+
+    /* 配送時間文字列の取得 */
+    function lfGetDelivTimeInfo($time_id) {
+        $objQuery = new SC_Query();
+        $where = "time_id = ?";
+        $arrRet = $objQuery->select("deliv_id, deliv_time", "dtb_delivtime", $where, array($time_id));
+        return (array($arrRet[0]['deliv_id'], $arrRet[0]['deliv_time']));
+    }
+
+    /* DBへデータの登録 */
+    function lfRegistData($uniqid) {
+        $arrRet = $this->objFormParam->getHashArray();
+        $sqlval = $this->objFormParam->getDbArray();
+        // 登録データの作成
+        $sqlval['order_temp_id'] = $uniqid;
+        $sqlval['update_date'] = 'Now()';
+
+        if($sqlval['payment_id'] != "") {
+            list($sqlval['payment_method'], $sqlval['charge']) = lfGetPaymentInfo($sqlval['payment_id']);
+        } else {
+            $sqlval['payment_id'] = '0';
+            $sqlval['payment_method'] = "";
+        }
+
+        if($sqlval['deliv_time_id'] != "") {
+            list($sqlval['deliv_id'], $sqlval['deliv_time']) = lfGetDelivTimeInfo($sqlval['deliv_time_id']);
+        } else {
+            $sqlval['deliv_time_id'] = '0';
+            $sqlval['deliv_id'] = '0';
+            $sqlval['deliv_time'] = "";
+        }
+
+        // 使用ポイントの設定
+        if($sqlval['point_check'] != '1') {
+            $sqlval['use_point'] = 0;
+        }
+
+        $objDb = new SC_Helper_DB_Ex();
+        $objDb->sfRegistTempOrder($uniqid, $sqlval);
+    }
+
+    /* 配達日一覧を取得する */
+    function lfGetDelivDate() {
+        $objCartSess = new SC_CartSession();
+        $objQuery = new SC_Query();
+        // 商品IDの取得
+        $max = $objCartSess->getMax();
+        for($i = 1; $i <= $max; $i++) {
+            if($_SESSION[$objCartSess->key][$i]['id'][0] != "") {
+                $arrID['product_id'][$i] = $_SESSION[$objCartSess->key][$i]['id'][0];
+            }
+        }
+        if(count($arrID['product_id']) > 0) {
+            $id = implode(",", $arrID['product_id']);
+            //商品から発送目安の取得
+            $deliv_date = $objQuery->get("dtb_products", "MAX(deliv_date_id)", "product_id IN (".$id.")");
+            //発送目安
+            switch($deliv_date) {
+            //即日発送
+            case '1':
+                $start_day = 1;
+                break;
+            //1-2日後
+            case '2':
+                $start_day = 3;
+                break;
+            //3-4日後
+            case '3':
+                $start_day = 5;
+                break;
+            //1週間以内
+            case '4':
+                $start_day = 8;
+                break;
+            //2週間以内
+            case '5':
+                $start_day = 15;
+                break;
+            //3週間以内
+            case '6':
+                $start_day = 22;
+                break;
+            //1ヶ月以内
+            case '7':
+                $start_day = 32;
+                break;
+            //2ヶ月以降
+            case '8':
+                $start_day = 62;
+                break;
+            //お取り寄せ(商品入荷後)
+            case '9':
+                $start_day = "";
+                break;
+            default:
+                //お届け日が設定されていない場合
+                $start_day = "";
+                break;
+            }
+            //配達可能日のスタート値から、配達日の配列を取得する
+            $arrDelivDate = $this->lfGetDateArray($start_day, DELIV_DATE_END_MAX);
+        }
+        return $arrDelivDate;
+    }
+
+    //配達可能日のスタート値から、配達日の配列を取得する
+    function lfGetDateArray($start_day, $end_day) {
+        $masterData = new SC_DB_MasterData();
+        $arrWDAY = $masterData->getMasterData("mtb_wday");
+        //配達可能日のスタート値がセットされていれば
+        if($start_day >= 1) {
+            $now_time = time();
+            $max_day = $start_day + $end_day;
+            // 集計
+            for ($i = $start_day; $i < $max_day; $i++) {
+                // 基本時間から日数を追加していく
+                $tmp_time = $now_time + ($i * 24 * 3600);
+                list($y, $m, $d, $w) = split(" ", date("y m d w", $tmp_time));
+                $val = sprintf("%02d/%02d/%02d(%s)", $y, $m, $d, $arrWDAY[$w]);
+                $arrDate[$val] = $val;
+            }
+        } else {
+            $arrDate = false;
+        }
+        return $arrDate;
+    }
+
+    //一時受注テーブルからの情報を格納する
+    function lfSetOrderTempData($uniqid) {
+
+        $objQuery = new SC_Query();
+        $col = "payment_id, use_point, deliv_time_id, message, point_check, deliv_date";
+        $from = "dtb_order_temp";
+        $where = "order_temp_id = ?";
+        $arrRet = $objQuery->select($col, $from, $where, array($uniqid));
+        // DB値の取得
+        $this->objFormParam->setParam($arrRet[0]);
+        return $this->objFormParam;
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping.php
===================================================================
--- /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping.php	(revision 15223)
+++ /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping.php	(revision 15223)
@@ -0,0 +1,308 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * ショッピングログインのページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping extends LC_Page {
+
+    // {{{ properties
+
+    /** フォームパラメータ */
+    var $objFormParam;
+
+    // TODO
+    var $arrSession;
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'shopping/index.tpl';
+        $masterData = new SC_DB_MasterData();
+        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+        $this->arrSex = $masterData->getMasterData("mtb_sex");
+        $this->arrJob = $masterData->getMasterData("mtb_job");
+        $this->tpl_onload = 'fnCheckInputDeliv();';
+
+        $this->allowClientCache();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $conn = new SC_DBConn();
+        $objView = new SC_SiteView();
+        $objSiteSess = new SC_SiteSession();
+        $objCartSess = new SC_CartSession();
+        $objCampaignSess = new SC_CampaignSession();
+        $objCustomer = new SC_Customer();
+        $objCookie = new SC_Cookie();
+        $this->objFormParam = new SC_FormParam();			// フォーム用
+        $this->lfInitParam();								// パラメータ情報の初期化
+        $this->objFormParam->setParam($_POST);			// POST値の取得
+
+        // ユーザユニークIDの取得と購入状態の正当性をチェック
+        $this->tpl_uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+        // ログインチェック
+        if($objCustomer->isLoginSuccess()) {
+            // すでにログインされている場合は、お届け先設定画面に転送
+            $this->sendRedirect($this->getLocation("./deliv.php"), array());
+            exit;
+        }
+
+        if ($_SERVER["REQUEST_METHOD"] == "POST") {
+            if (!$this->isValidToken()) {
+                SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
+            }
+        }
+
+        switch($_POST['mode']) {
+        case 'nonmember_confirm':
+            $this = $this->lfSetNonMember($this);
+            // ※breakなし
+        case 'confirm':
+            // 入力値の変換
+            $this->objFormParam->convParam();
+            $this->objFormParam->toLower('order_mail');
+            $this->objFormParam->toLower('order_mail_check');
+
+            $this->arrErr = $this->lfCheckError();
+
+            // 入力エラーなし
+            if(count($this->arrErr) == 0) {
+                // DBへのデータ登録
+                $this->lfRegistData($uniqid);
+
+                // お届け先のコピー
+                $this->lfCopyDeliv($uniqid, $_POST);
+
+                // 正常に登録されたことを記録しておく
+                $objSiteSess->setRegistFlag();
+                // お支払い方法選択ページへ移動
+                $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT, array()));
+                exit;
+            }
+
+            break;
+        // 前のページに戻る
+        case 'return':
+            // 確認ページへ移動
+            $this->sendRedirect($this->getLocation(URL_CART_TOP, array()));
+            exit;
+            break;
+        case 'nonmember':
+            $this = $this->lfSetNonMember($this);
+            // ※breakなし
+        default:
+            if($_GET['from'] == 'nonmember') {
+                $this = $this->lfSetNonMember($this);
+            }
+            // ユーザユニークIDの取得
+            $uniqid = $objSiteSess->getUniqId();
+            $objQuery = new SC_Query();
+            $where = "order_temp_id = ?";
+            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
+            // DB値の取得
+            $this->objFormParam->setParam($arrRet[0]);
+            $this->objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
+            $this->objFormParam->setDBDate($arrRet[0]['order_birth']);
+            break;
+        }
+
+        // クッキー判定
+        $this->tpl_login_email = $objCookie->getCookie('login_email');
+        if($this->tpl_login_email != "") {
+            $this->tpl_login_memory = "1";
+        }
+
+        // 選択用日付の取得
+        $objDate = new SC_Date(START_BIRTH_YEAR);
+        $this->arrYear = $objDate->getYear('', 1950);	//　日付プルダウン設定
+        $this->arrMonth = $objDate->getMonth();
+        $this->arrDay = $objDate->getDay();
+
+        if($this->year == '') {
+            $this->year = '----';
+        }
+
+        // 入力値の取得
+        $this->arrForm = $this->objFormParam->getFormParamList();
+
+        if($this->arrForm['year']['value'] == ""){
+            $this->arrForm['year']['value'] = '----';
+        }
+
+        $this->transactionid = $this->getToken();
+        $objView->assignobj($this);
+        // フレームを選択(キャンペーンページから遷移なら変更)
+        $objCampaignSess->pageView($objView);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* 非会員入力ページのセット */
+    function lfSetNonMember($objPage) {
+        $objPage->tpl_mainpage = 'shopping/nonmember_input.tpl';
+        $objPage->tpl_css = array();
+        $objPage->tpl_css[] = URL_DIR.'css/layout/login/nonmember.css';
+        return $objPage;
+    }
+
+    /* パラメータ情報の初期化 */
+    function lfInitParam() {
+        $this->objFormParam->addParam("お名前（姓）", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("お名前（名）", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ（セイ）", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ（メイ）", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("住所1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("FAX番号1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("FAX番号2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("FAX番号3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("メールアドレス", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
+        $this->objFormParam->addParam("メールアドレス（確認）", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
+        $this->objFormParam->addParam("年", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
+        $this->objFormParam->addParam("月", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
+        $this->objFormParam->addParam("日", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
+        $this->objFormParam->addParam("性別", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("職業", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("別のお届け先", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("お名前（姓）", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("お名前（名）", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ（セイ）", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ（メイ）", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("メールマガジン", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
+    }
+
+    /* DBへデータの登録 */
+    function lfRegistData($uniqid) {
+        $arrRet = $this->objFormParam->getHashArray();
+        $sqlval = $this->objFormParam->getDbArray();
+        // 登録データの作成
+        $sqlval['order_temp_id'] = $uniqid;
+        $sqlval['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
+        $sqlval['update_date'] = 'Now()';
+        $sqlval['customer_id'] = '0';
+
+        // 既存データのチェック
+        $objQuery = new SC_Query();
+        $where = "order_temp_id = ?";
+        $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
+        // 既存データがない場合
+        if ($cnt == 0) {
+            $sqlval['create_date'] = 'Now()';
+            $objQuery->insert("dtb_order_temp", $sqlval);
+        } else {
+            $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+        }
+
+    }
+
+    /* 入力内容のチェック */
+    function lfCheckError() {
+        // 入力データを渡す。
+        $arrRet = $this->objFormParam->getHashArray();
+        $objErr = new SC_CheckError($arrRet);
+        $objErr->arrErr = $this->objFormParam->checkError();
+
+        // 別のお届け先チェック
+        if($_POST['deliv_check'] == "1") {
+            $objErr->doFunc(array("お名前（姓）", "deliv_name01"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("お名前（名）", "deliv_name02"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("フリガナ（セイ）", "deliv_kana01"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("フリガナ（メイ）", "deliv_kana02"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("郵便番号1", "deliv_zip01"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("郵便番号2", "deliv_zip02"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("都道府県", "deliv_pref"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("住所1", "deliv_addr01"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("住所2", "deliv_addr02"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("電話番号1", "deliv_tel01"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("電話番号2", "deliv_tel02"), array("EXIST_CHECK"));
+            $objErr->doFunc(array("電話番号3", "deliv_tel03"), array("EXIST_CHECK"));
+        }
+
+        // 複数項目チェック
+        $objErr->doFunc(array("TEL", "order_tel01", "order_tel02", "order_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+        $objErr->doFunc(array("FAX", "order_fax01", "order_fax02", "order_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+        $objErr->doFunc(array("郵便番号", "order_zip01", "order_zip02"), array("ALL_EXIST_CHECK"));
+        $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+        $objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+        $objErr->doFunc(array("郵便番号", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("メールアドレス", "メールアドレス（確認）", "order_email", "order_email_check"), array("EQUAL_CHECK"));
+
+        // すでにメルマガテーブルに会員としてメールアドレスが登録されている場合
+        if(SC_Utils_Ex::sfCheckCustomerMailMaga($arrRet['order_email'])) {
+            $objErr->arrErr['order_email'] = "このメールアドレスはすでに登録されています。<br />";
+        }
+
+        return $objErr->arrErr;
+    }
+
+    // 受注一時テーブルのお届け先をコピーする
+    function lfCopyDeliv($uniqid, $arrData) {
+        $objQuery = new SC_Query();
+
+        // 別のお届け先を指定していない場合、配送先に登録住所をコピーする。
+        if($arrData["deliv_check"] != "1") {
+            $sqlval['deliv_name01'] = $arrData['order_name01'];
+            $sqlval['deliv_name02'] = $arrData['order_name02'];
+            $sqlval['deliv_kana01'] = $arrData['order_kana01'];
+            $sqlval['deliv_kana02'] = $arrData['order_kana02'];
+            $sqlval['deliv_pref'] = $arrData['order_pref'];
+            $sqlval['deliv_zip01'] = $arrData['order_zip01'];
+            $sqlval['deliv_zip02'] = $arrData['order_zip02'];
+            $sqlval['deliv_addr01'] = $arrData['order_addr01'];
+            $sqlval['deliv_addr02'] = $arrData['order_addr02'];
+            $sqlval['deliv_tel01'] = $arrData['order_tel01'];
+            $sqlval['deliv_tel02'] = $arrData['order_tel02'];
+            $sqlval['deliv_tel03'] = $arrData['order_tel03'];
+            $where = "order_temp_id = ?";
+            $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+        }
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Deliv.php
===================================================================
--- /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Deliv.php	(revision 15223)
+++ /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Deliv.php	(revision 15223)
@@ -0,0 +1,310 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * お届け先指定 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Deliv extends LC_Page {
+
+    // {{{ properties
+
+    /** フォームパラメータの配列 */
+    var $objFormParam;
+
+    /** ログインフォームパラメータ配列 */
+    var $objLoginFormParam;
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'shopping/deliv.tpl';
+        $this->tpl_css = URL_DIR.'css/layout/shopping/index.css';
+        $masterData = new SC_DB_MasterData();
+        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+        $this->tpl_title = "お届け先指定";
+
+        $this->allowClientCache();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView = new SC_SiteView();
+        $objSiteSess = new SC_SiteSession();
+        $objCartSess = new SC_CartSession();
+        $objCampaignSess = new SC_CampaignSession();
+        $objCustomer = new SC_Customer();
+        // クッキー管理クラス
+        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
+        // パラメータ管理クラス
+        $this->objFormParam = new SC_FormParam();
+        // パラメータ情報の初期化
+        $this->lfInitParam();
+        // POST値の取得
+        $this->objFormParam->setParam($_POST);
+
+        $this->objLoginFormParam = new SC_FormParam();	// ログインフォーム用
+        $this->lfInitLoginFormParam();						// 初期設定
+        $this->objLoginFormParam->setParam($_POST);		// POST値の取得
+
+        // ユーザユニークIDの取得と購入状態の正当性をチェック
+        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
+        $objPage->tpl_uniqid = $uniqid;
+
+        // ログインチェック
+        if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess()) {
+            // 不正アクセスとみなす
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
+        }
+
+        switch($_POST['mode']) {
+        case 'login':
+            $this->objLoginFormParam->toLower('login_email');
+            $objPage->arrErr = $this->objLoginFormParam->checkError();
+            $arrForm =  $this->objLoginFormParam->getHashArray();
+            // クッキー保存判定
+            if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
+                $objCookie->setCookie('login_email', $_POST['login_email']);
+            } else {
+                $objCookie->setCookie('login_email', '');
+            }
+
+            if(count($objPage->arrErr) == 0) {
+                // ログイン判定
+                if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
+                    // 仮登録の判定
+                    $objQuery = new SC_Query;
+                    $where = "email = ? AND status = 1 AND del_flg = 0";
+                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
+
+                    if($ret > 0) {
+                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
+                    } else {
+                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
+                    }
+                }
+            } else {
+                // ログインページに戻る
+                $this->sendRedirect(URL_SHOP_TOP);
+                exit;
+            }
+            break;
+        // 削除
+        case 'delete':
+            if (sfIsInt($_POST['other_deliv_id'])) {
+                $objQuery = new SC_Query();
+                $where = "other_deliv_id = ?";
+                $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
+                $this->objFormParam->setValue('select_addr_id', '');
+            }
+            break;
+        // 会員登録住所に送る
+        case 'customer_addr':
+            // 会員登録住所がチェックされている場合
+            if ($_POST['deliv_check'] == '-1') {
+                // 会員情報の住所を受注一時テーブルに書き込む
+                $this->lfRegistDelivData($uniqid, $objCustomer);
+                // 正常に登録されたことを記録しておく
+                $objSiteSess->setRegistFlag();
+                // お支払い方法選択ページへ移動
+                $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT, array(), true));
+                exit;
+            // 別のお届け先がチェックされている場合
+            } elseif($_POST['deliv_check'] >= 1) {
+                if (sfIsInt($_POST['deliv_check'])) {
+                    // 登録済みの別のお届け先を受注一時テーブルに書き込む
+                    lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['deliv_check']);
+                    // 正常に登録されたことを記録しておく
+                    $objSiteSess->setRegistFlag();
+                    // お支払い方法選択ページへ移動
+                    $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT, array(), true));
+                    exit;
+                }
+            }else{
+                // エラーを返す
+                $arrErr['deli'] = '※ お届け先を選択してください。';
+            }
+            break;
+        // 前のページに戻る
+        case 'return':
+            // 確認ページへ移動
+            $this->sendRedirect($this->getLocation(URL_CART_TOP, array(), true));
+            exit;
+            break;
+        default:
+            $objQuery = new SC_Query();
+            $where = "order_temp_id = ?";
+            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
+            $this->objFormParam->setParam($arrRet[0]);
+            break;
+        }
+
+        /** 表示処理 **/
+
+        // 会員登録住所の取得
+        $col = "name01, name02, pref, addr01, addr02";
+        $where = "customer_id = ?";
+        $objQuery = new SC_Query();
+        $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
+        // 別のお届け先住所の取得
+        $col = "other_deliv_id, name01, name02, pref, addr01, addr02";
+        $objQuery->setorder("other_deliv_id DESC");
+        $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
+        $objPage->arrAddr = $arrCustomerAddr;
+        $objPage->tpl_addrmax = count($objOtherAddr);
+        $cnt = 1;
+        foreach($objOtherAddr as $val) {
+            $objPage->arrAddr[$cnt] = $val;
+            $cnt++;
+        }
+
+        // 入力値の取得
+        $objPage->arrForm = $this->objFormParam->getFormParamList();
+        $objPage->arrErr = $arrErr;
+
+        $objView->assignobj($objPage);
+        // フレームを選択(キャンペーンページから遷移なら変更)
+        $objCampaignSess->pageView($objView);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* パラメータ情報の初期化 */
+    function lfInitParam() {
+        $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("お名前2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("", "deliv_check");
+    }
+
+    function lfInitLoginFormParam() {
+        $this->objLoginFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objLoginFormParam->addParam("メールアドレス", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objLoginFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+    }
+
+    /* DBへデータの登録 */
+    function lfRegistNewAddrData($uniqid, $objCustomer) {
+        $arrRet = $this->objFormParam->getHashArray();
+        $sqlval = $this->objFormParam->getDbArray();
+        // 登録データの作成
+        $sqlval['deliv_check'] = '1';
+        $sqlval['order_temp_id'] = $uniqid;
+        $sqlval['update_date'] = 'Now()';
+        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+        $sqlval['order_birth'] = $objCustomer->getValue('birth');
+
+        $objDb = new SC_Helper_DB_Ex();
+        $objDb->sfRegistTempOrder($uniqid, $sqlval);
+    }
+
+    /* 会員情報の住所を一時受注テーブルへ */
+    function lfRegistDelivData($uniqid, $objCustomer) {
+        // 登録データの作成
+        $sqlval['order_temp_id'] = $uniqid;
+        $sqlval['update_date'] = 'Now()';
+        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+        $sqlval['deliv_check'] = '-1';
+        $sqlval['deliv_name01'] = $objCustomer->getValue('name01');
+        $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
+        $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
+        $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
+        $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
+        $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
+        $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
+        $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
+        $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
+        $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
+        $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
+        $sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
+
+        $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
+        $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
+        $sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
+
+        $objDb = new SC_Helper_DB_Ex();
+        $objDb->sfRegistTempOrder($uniqid, $sqlval);
+    }
+
+    /* 別のお届け先住所を一時受注テーブルへ */
+    function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
+        // 登録データの作成
+        $sqlval['order_temp_id'] = $uniqid;
+        $sqlval['update_date'] = 'Now()';
+        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+        $sqlval['order_birth'] = $objCustomer->getValue('birth');
+
+        $objQuery = new SC_Query();
+        $where = "other_deliv_id = ?";
+        $arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
+
+        $sqlval['deliv_check'] = $other_deliv_id;
+        $sqlval['deliv_name01'] = $arrRet[0]['name01'];
+        $sqlval['deliv_name02'] = $arrRet[0]['name02'];
+        $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
+        $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
+        $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
+        $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
+        $sqlval['deliv_pref'] = $arrRet[0]['pref'];
+        $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
+        $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
+        $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
+        $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
+        $sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
+        $objDb = new SC_Helper_DB_Ex();
+        $objDb->sfRegistTempOrder($uniqid, $sqlval);
+    }
+
+    /* 入力内容のチェック */
+    function lfCheckError() {
+        // 入力データを渡す。
+        $arrRet =  $this->objFormParam->getHashArray();
+        $objErr = new SC_CheckError($arrRet);
+        $objErr->arrErr = $this->objFormParam->checkError();
+        // 複数項目チェック
+        if ($_POST['mode'] == 'login'){
+            $objErr->doFunc(array("メールアドレス", "login_email", STEXT_LEN), array("EXIST_CHECK"));
+            $objErr->doFunc(array("パスワード", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
+        }
+        $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+        return $objErr->arrErr;
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Complete.php
===================================================================
--- /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 15223)
+++ /branches/feature-module-update/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 15223)
@@ -0,0 +1,555 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * ご注文完了 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Complete extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'shopping/complete.tpl';
+        $this->tpl_css = URL_DIR.'css/layout/shopping/complete.css';
+        $this->tpl_title = "ご注文完了";
+
+        // TODO
+        $this->arrCONVENIENCE = $arrCONVENIENCE;
+        $this->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+        $objPage->arrCONVENIENCE = $arrCONVENIENCE;
+        $objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+
+        $this->allowClientCache();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $conn = new SC_DBConn();
+        $objView = new SC_SiteView();
+        $this->objSiteSess = new SC_SiteSession();
+        $this->objCartSess = new SC_CartSession();
+        $this->objCampaignSess = new SC_CampaignSession();
+        $objSiteInfo = $objView->objSiteInfo;
+        $this->arrInfo = $objSiteInfo->data;
+        $this->objCustomer = new SC_Customer();
+
+        // 前のページで正しく登録手続きが行われたか判定
+        SC_Utils_Ex::sfIsPrePage($objSiteSess);
+        // ユーザユニークIDの取得と購入状態の正当性をチェック
+        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
+        if ($uniqid != "") {
+
+            // 完了処理
+            $objQuery = new SC_Query();
+            $objQuery->begin();
+            $order_id = lfDoComplete($objQuery, $uniqid);
+            $objQuery->commit();
+
+            // セッションに保管されている情報を更新する
+            $objCustomer->updateSession();
+
+            // 完了メール送信
+            if($order_id != "") {
+                SC_Utils_Ex::sfSendOrderMail($order_id, '1');
+            }
+
+            // その他情報の取得
+            $arrResults = $objQuery->getall("SELECT memo02, memo05 FROM dtb_order WHERE order_id = ? ", array($order_id));
+
+            if (count($arrResults) > 0) {
+                if (isset($arrResults[0]["memo02"]) || isset($arrResults[0]["memo05"])) {
+                    // 完了画面で表示する決済内容
+                    $arrOther = unserialize($arrResults[0]["memo02"]);
+                    // 完了画面から送信する決済内容
+                    $arrModuleParam = unserialize($arrResults[0]["memo05"]);
+
+                    // データを編集
+                    foreach($arrOther as $key => $val){
+                        // URLの場合にはリンクつきで表示させる
+                        if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
+                            $arrOther[$key]["value"] = "<a href='#' onClick=\"window.open('". $val["value"] . "'); \" >" . $val["value"] ."</a>";
+                        }
+                    }
+
+                    $this->arrOther = $arrOther;
+                    $this->arrModuleParam = $arrModuleParam;
+                }
+            }
+
+            // アフィリエイト用コンバージョンタグの設定
+            $this->tpl_conv_page = AFF_SHOPPING_COMPLETE;
+            $this->tpl_aff_option = "order_id=$order_id";
+            //合計価格の取得
+            $total = $objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
+            if($total != "") {
+                $this->tpl_aff_option.= "|total=$total";
+            }
+        }
+
+        $this->arrInfo = $arrInfo;
+        // キャンペーンからの遷移かチェック
+        $this->is_campaign = $objCampaignSess->getIsCampaign();
+        $this->campaign_dir = $objCampaignSess->getCampaignDir();
+
+        $objView->assignobj($this);
+        // フレームを選択(キャンペーンページから遷移なら変更)
+        $objCampaignSess->pageView($objView);
+
+        // セッション開放
+        $objCampaignSess->delCampaign();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    // エビスタグ引渡し用データを生成する
+    function lfGetEbisData($order_id) {
+        $objQuery = new SC_Query();
+        $col = "customer_id, total, order_sex, order_job, to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) AS order_age";
+        $arrRet = $objQuery->select($col, "dtb_order", "order_id = ?", array($order_id));
+
+        if($arrRet[0]['customer_id'] > 0) {
+            // 会員番号
+            $arrEbis['m1id'] = $arrRet[0]['customer_id'];
+            // 非会員or会員
+            $arrEbis['o5id'] = '1';
+        } else {
+            // 会員番号
+            $arrEbis['m1id'] = '';
+            // 非会員or会員
+            $arrEbis['o5id'] = '2';
+        }
+
+        // 購入金額
+        $arrEbis['a1id'] = $arrRet[0]['total'];
+        // 性別
+        $arrEbis['o2id'] = $arrRet[0]['order_sex'];
+        // 年齢
+        $arrEbis['o3id'] = $arrRet[0]['order_age'];
+        // 職業
+        $arrEbis['o4id'] = $arrRet[0]['order_job'];
+
+        $objQuery->setgroupby("product_id");
+        $arrRet = $objQuery->select("product_id", "dtb_order_detail", "order_id = ?", array($order_id));
+        $arrProducts = sfSwapArray($arrRet);
+
+        $line = "";
+        // 商品IDをアンダーバーで接続する。
+        foreach($arrProducts['product_id'] as $val) {
+            if($line != "") {
+                $line .= "_$val";
+            } else {
+                $line .= "$val";
+            }
+        }
+
+        // 商品ID
+        $arrEbis['o1id'] = $line;
+
+        return $arrEbis;
+    }
+
+    // 完了処理
+    function lfDoComplete($objQuery, $uniqid) {
+        $objDb = new SC_Helper_DB_Ex();
+
+        // 一時受注テーブルの読込
+        $arrData = $objDb->sfGetOrderTemp($uniqid);
+
+        // 会員情報登録処理
+        if ($objCustomer->isLoginSuccess()) {
+            // 新お届け先の登録
+            $this->lfSetNewAddr($uniqid, $objCustomer->getValue('customer_id'));
+            // 購入集計を顧客テーブルに反映
+            $this->lfSetCustomerPurchase($objCustomer->getValue('customer_id'), $arrData, $objQuery);
+        } else {
+            //購入時強制会員登録
+            switch(PURCHASE_CUSTOMER_REGIST) {
+            //無効
+            case '0':
+                // 購入時会員登録
+                if($arrData['member_check'] == '1') {
+                    // 仮会員登録
+                    $customer_id = $this->lfRegistPreCustomer($arrData, $arrInfo);
+                    // 購入集計を顧客テーブルに反映
+                    $this->lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
+                }
+                break;
+            //有効
+            case '1':
+                // 仮会員登録
+                $customer_id = $this->lfRegistPreCustomer($arrData, $arrInfo);
+                // 購入集計を顧客テーブルに反映
+                $this->lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
+                break;
+            }
+
+        }
+        // 一時テーブルを受注テーブルに格納する
+        $order_id = $this->lfRegistOrder($objQuery, $arrData, $objCampaignSess);
+        // カート商品を受注詳細テーブルに格納する
+        $this->lfRegistOrderDetail($objQuery, $order_id, $objCartSess);
+        // 受注一時テーブルの情報を削除する。
+        $this->lfDeleteTempOrder($objQuery, $uniqid);
+        // キャンペーンからの遷移の場合登録する。
+        if($objCampaignSess->getIsCampaign() and $objCartSess->chkCampaign($objCampaignSess->getCampaignId())) {
+            $this->lfRegistCampaignOrder($objQuery, $objCampaignSess, $order_id);
+        }
+
+        // セッションカート内の商品を削除する。
+        $objCartSess->delAllProducts();
+        // 注文一時IDを解除する。
+        $objSiteSess->unsetUniqId();
+
+        return $order_id;
+    }
+
+    // 会員登録（仮登録）
+    function lfRegistPreCustomer($arrData, $arrInfo) {
+        // 購入時の会員登録
+        $sqlval['name01'] = $arrData['order_name01'];
+        $sqlval['name02'] = $arrData['order_name02'];
+        $sqlval['kana01'] = $arrData['order_kana01'];
+        $sqlval['kana02'] = $arrData['order_kana02'];
+        $sqlval['zip01'] = $arrData['order_zip01'];
+        $sqlval['zip02'] = $arrData['order_zip02'];
+        $sqlval['pref'] = $arrData['order_pref'];
+        $sqlval['addr01'] = $arrData['order_addr01'];
+        $sqlval['addr02'] = $arrData['order_addr02'];
+        $sqlval['email'] = $arrData['order_email'];
+        $sqlval['tel01'] = $arrData['order_tel01'];
+        $sqlval['tel02'] = $arrData['order_tel02'];
+        $sqlval['tel03'] = $arrData['order_tel03'];
+        $sqlval['fax01'] = $arrData['order_fax01'];
+        $sqlval['fax02'] = $arrData['order_fax02'];
+        $sqlval['fax03'] = $arrData['order_fax03'];
+        $sqlval['sex'] = $arrData['order_sex'];
+        $sqlval['password'] = $arrData['password'];
+        $sqlval['reminder'] = $arrData['reminder'];
+        $sqlval['reminder_answer'] = $arrData['reminder_answer'];
+
+        // メルマガ配信用フラグの判定
+        switch($arrData['mail_flag']) {
+        case '1':	// HTMLメール
+            $mail_flag = 4;
+            break;
+        case '2':	// TEXTメール
+            $mail_flag = 5;
+            break;
+        case '3':	// 希望なし
+            $mail_flag = 6;
+            break;
+        default:
+            $mail_flag = 6;
+            break;
+        }
+        // メルマガフラグ
+        $sqlval['mailmaga_flg'] = $mail_flag;
+
+        // 会員仮登録
+        $sqlval['status'] = 1;
+        // URL判定用キー
+        $sqlval['secret_key'] = SC_Utils_Ex::sfGetUniqRandomId("t");
+
+        $objQuery = new SC_Query();
+        $sqlval['create_date'] = "now()";
+        $sqlval['update_date'] = "now()";
+        $objQuery->insert("dtb_customer", $sqlval);
+
+        // 顧客IDの取得
+        $arrRet = $objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
+        $customer_id = $arrRet[0]['customer_id'];
+
+        //　仮登録完了メール送信
+        $objMailPage = $this;
+        $objMailPage->to_name01 = $arrData['order_name01'];
+        $objMailPage->to_name02 = $arrData['order_name02'];
+        $objMailPage->CONF = $arrInfo;
+        $objMailPage->uniqid = $sqlval['secret_key'];
+        $objMailView = new SC_SiteView();
+        $objMailView->assignobj($objMailPage);
+        $body = $objMailView->fetch("mail_templates/customer_mail.tpl");
+
+        $objMail = new GC_SendMail();
+        $objMail->setItem(
+                            ''										//　宛先
+                            , sfMakeSubject("会員登録のご確認")		//　サブジェクト
+                            , $body									//　本文
+                            , $arrInfo['email03']					//　配送元アドレス
+                            , $arrInfo['shop_name']					//　配送元　名前
+                            , $arrInfo["email03"]					//　reply_to
+                            , $arrInfo["email04"]					//　return_path
+                            , $arrInfo["email04"]					//  Errors_to
+                            , $arrInfo["email01"]					//  Bcc
+                                                            );
+        // 宛先の設定
+        $name = $arrData['order_name01'] . $arrData['order_name02'] ." 様";
+        $objMail->setTo($arrData['order_email'], $name);
+        $objMail->sendMail();
+
+        return $customer_id;
+    }
+
+    // 受注テーブルへ登録
+    function lfRegistOrder($objQuery, $arrData, $objCampaignSess) {
+        $sqlval = $arrData;
+
+        // 受注テーブルに書き込まない列を除去
+        unset($sqlval['mailmaga_flg']);		// メルマガチェック
+        unset($sqlval['deliv_check']);		// 別のお届け先チェック
+        unset($sqlval['point_check']);		// ポイント利用チェック
+        unset($sqlval['member_check']);		// 購入時会員チェック
+        unset($sqlval['password']);			// ログインパスワード
+        unset($sqlval['reminder']);			// リマインダー質問
+        unset($sqlval['reminder_answer']);	// リマインダー答え
+        unset($sqlval['mail_flag']);		// メールフラグ
+        unset($sqlval['session']);		    // セッション情報
+
+        // 注文ステータス:指定が無ければ新規受付に設定
+        if($sqlval["status"] == ""){
+            $sqlval['status'] = '1';
+        }
+
+        // 別のお届け先を指定していない場合、配送先に登録住所をコピーする。
+        if($arrData["deliv_check"] == "-1") {
+            $sqlval['deliv_name01'] = $arrData['order_name01'];
+            $sqlval['deliv_name02'] = $arrData['order_name02'];
+            $sqlval['deliv_kana01'] = $arrData['order_kana01'];
+            $sqlval['deliv_kana02'] = $arrData['order_kana02'];
+            $sqlval['deliv_pref'] = $arrData['order_pref'];
+            $sqlval['deliv_zip01'] = $arrData['order_zip01'];
+            $sqlval['deliv_zip02'] = $arrData['order_zip02'];
+            $sqlval['deliv_addr01'] = $arrData['order_addr01'];
+            $sqlval['deliv_addr02'] = $arrData['order_addr02'];
+            $sqlval['deliv_tel01'] = $arrData['order_tel01'];
+            $sqlval['deliv_tel02'] = $arrData['order_tel02'];
+            $sqlval['deliv_tel03'] = $arrData['order_tel03'];
+        }
+
+        $order_id = $arrData['order_id'];		// オーダーID
+        $sqlval['create_date'] = 'now()';		// 受注日
+
+        // キャンペーンID
+        if($objCampaignSess->getIsCampaign()) $sqlval['campaign_id'] = $objCampaignSess->getCampaignId();
+
+        // ゲットの値をインサート
+        //$sqlval = lfGetInsParam($sqlval);
+
+        // INSERTの実行
+        $objQuery->insert("dtb_order", $sqlval);
+
+        return $order_id;
+    }
+
+    // 受注詳細テーブルへ登録
+    function lfRegistOrderDetail($objQuery, $order_id, $objCartSess) {
+        $objDb = new SC_Helper_DB_Ex();
+        // カート内情報の取得
+        $arrCart = $objCartSess->getCartList();
+        $max = count($arrCart);
+
+        // 既に存在する詳細レコードを消しておく。
+        $objQuery->delete("dtb_order_detail", "order_id = $order_id");
+
+        // 規格名一覧
+        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
+        // 規格分類名一覧
+        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+
+        for ($i = 0; $i < $max; $i++) {
+            // 商品規格情報の取得
+            $arrData = $objDb->sfGetProductsClass($arrCart[$i]['id']);
+
+            // 存在する商品のみ表示する。
+            if($arrData != "") {
+                $sqlval['order_id'] = $order_id;
+                $sqlval['product_id'] = $arrCart[$i]['id'][0];
+                $sqlval['classcategory_id1'] = $arrCart[$i]['id'][1];
+                $sqlval['classcategory_id2'] = $arrCart[$i]['id'][2];
+                $sqlval['product_name'] = $arrData['name'];
+                $sqlval['product_code'] = $arrData['product_code'];
+                $sqlval['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
+                $sqlval['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
+                $sqlval['point_rate'] = $arrCart[$i]['point_rate'];
+                $sqlval['price'] = $arrCart[$i]['price'];
+                $sqlval['quantity'] = $arrCart[$i]['quantity'];
+                $this->lfReduceStock($objQuery, $arrCart[$i]['id'], $arrCart[$i]['quantity']);
+                // INSERTの実行
+                $objQuery->insert("dtb_order_detail", $sqlval);
+            } else {
+                SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND);
+            }
+        }
+    }
+
+    // キャンペーン受注テーブルへ登録
+    function lfRegistCampaignOrder($objQuery, $objCampaignSess, $order_id) {
+
+        // 受注データを取得
+        $cols = "order_id, campaign_id, customer_id, message, order_name01, order_name02,".
+                "order_kana01, order_kana02, order_email, order_tel01, order_tel02, order_tel03,".
+                "order_fax01, order_fax02, order_fax03, order_zip01, order_zip02, order_pref, order_addr01,".
+                "order_addr02, order_sex, order_birth, order_job, deliv_name01, deliv_name02, deliv_kana01,".
+                "deliv_kana02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_fax01, deliv_fax02, deliv_fax03,".
+                "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, payment_total";
+
+        $arrOrder = $objQuery->select($cols, "dtb_order", "order_id = ?", array($order_id));
+
+        $sqlval = $arrOrder[0];
+        $sqlval['create_date'] = 'now()';
+
+        // INSERTの実行
+        $objQuery->insert("dtb_campaign_order", $sqlval);
+
+        // 申し込み数の更新
+        $total_count = $objQuery->get("dtb_campaign", "total_count", "campaign_id = ?", array($sqlval['campaign_id']));
+        $arrCampaign['total_count'] = $total_count += 1;
+        $objQuery->update("dtb_campaign", $arrCampaign, "campaign_id = ?", array($sqlval['campaign_id']));
+
+    }
+
+
+
+    /* 受注一時テーブルの削除 */
+    function lfDeleteTempOrder($objQuery, $uniqid) {
+        $where = "order_temp_id = ?";
+        $sqlval['del_flg'] = 1;
+        $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+        // $objQuery->delete("dtb_order_temp", $where, array($uniqid));
+    }
+
+    // 受注一時テーブルの住所が登録済みテーブルと異なる場合は、別のお届け先に追加する
+    function lfSetNewAddr($uniqid, $customer_id) {
+        $objQuery = new SC_Query();
+        $diff = false;
+        $find_same = false;
+
+        $col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
+        $where = "order_temp_id = ?";
+        $arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
+
+        // 要素名のdeliv_を削除する。
+        foreach($arrRet[0] as $key => $val) {
+            $keyname = ereg_replace("^deliv_", "", $key);
+            $arrNew[$keyname] = $val;
+        }
+
+        // 会員情報テーブルとの比較
+        $col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
+        $where = "customer_id = ?";
+        $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
+
+        // 会員情報の住所と異なる場合
+        if($arrNew != $arrCustomerAddr[0]) {
+            // 別のお届け先テーブルの住所と比較する
+            $col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
+            $where = "customer_id = ?";
+            $arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
+
+            foreach($arrOtherAddr as $arrval) {
+                if($arrNew == $arrval) {
+                    // すでに同じ住所が登録されている
+                    $find_same = true;
+                }
+            }
+
+            if(!$find_same) {
+                $diff = true;
+            }
+        }
+
+        // 新しいお届け先が登録済みのものと異なる場合は別のお届け先テーブルに登録する
+        if($diff) {
+            $sqlval = $arrNew;
+            $sqlval['customer_id'] = $customer_id;
+            $objQuery->insert("dtb_other_deliv", $sqlval);
+        }
+    }
+
+    /* 購入情報を会員テーブルに登録する */
+    function lfSetCustomerPurchase($customer_id, $arrData, $objQuery) {
+        $col = "first_buy_date, last_buy_date, buy_times, buy_total, point";
+        $where = "customer_id = ?";
+        $arrRet = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
+        $sqlval = $arrRet[0];
+
+        if($sqlval['first_buy_date'] == "") {
+            $sqlval['first_buy_date'] = "Now()";
+        }
+        $sqlval['last_buy_date'] = "Now()";
+        $sqlval['buy_times']++;
+        $sqlval['buy_total']+= $arrData['total'];
+        $sqlval['point'] = ($sqlval['point'] + $arrData['add_point'] - $arrData['use_point']);
+
+        // ポイントが不足している場合
+        if($sqlval['point'] < 0) {
+            $objQuery->rollback();
+            sfDispSiteError(LACK_POINT);
+        }
+
+        $objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
+    }
+
+    // 在庫を減らす処理
+    function lfReduceStock($objQuery, $arrID, $quantity) {
+        $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+        $arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
+
+        // 売り切れエラー
+        if(($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
+            $objQuery->rollback();
+            sfDispSiteError(SOLD_OUT, "", true);
+        // 無制限の場合、在庫はNULL
+        } elseif($arrRet[0]['stock_unlimited'] == '1') {
+            $sqlval['stock'] = null;
+            $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+        // 在庫を減らす
+        } else {
+            $sqlval['stock'] = ($arrRet[0]['stock'] - $quantity);
+            if($sqlval['stock'] == "") {
+                $sqlval['stock'] = '0';
+            }
+            $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+        }
+    }
+
+    // GETの値をインサート用に整える
+    function lfGetInsParam($sqlVal){
+
+        foreach($_GET as $key => $val){
+            // カラムの存在チェック
+            if(sfColumnExists("dtb_order", $key)) $sqlVal[$key] = $val;
+        }
+
+        return $sqlVal;
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Confirm_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Confirm_Ex.php	(revision 15223)
+++ /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Confirm_Ex.php	(revision 15223)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/shopping/LC_Page_Shopping_Confirm.php");
+
+/**
+ * 入力内容確認 のページクラス(拡張).
+ *
+ * LC_Page_Shopping_Confirm をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Confirm_Ex extends LC_Page_Shopping_Confirm {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Payment_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Payment_Ex.php	(revision 15223)
+++ /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Payment_Ex.php	(revision 15223)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/shopping/LC_Page_Shopping_Payment.php");
+
+/**
+ * 支払い方法選択 のページクラス(拡張).
+ *
+ * LC_Page_Shopping_Payment をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Payment_Ex extends LC_Page_Shopping_Payment {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Ex.php	(revision 15223)
+++ /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Ex.php	(revision 15223)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/shopping/LC_Page_Shopping.php");
+
+/**
+ * ショッピングログイン のページクラス(拡張).
+ *
+ * LC_Page_Shopping をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Ex extends LC_Page_Shopping {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Deliv_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Deliv_Ex.php	(revision 15223)
+++ /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Deliv_Ex.php	(revision 15223)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/shopping/LC_Page_Shopping_Deliv.php");
+
+/**
+ * お届け先指定 のページクラス(拡張).
+ *
+ * LC_Page_Shopping_Deliv をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Deliv_Ex extends LC_Page_Shopping_Deliv {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Complete_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Complete_Ex.php	(revision 15223)
+++ /branches/feature-module-update/data/class/page_extends/shopping/LC_Page_Shopping_Complete_Ex.php	(revision 15223)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/shopping/LC_Page_Shopping_Complete.php");
+
+/**
+ * ご注文完了 のページクラス(拡張).
+ *
+ * LC_Page_Shopping_Complete をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Shopping_Complete_Ex extends LC_Page_Shopping_Complete {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        parent::process();
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
