Index: branches/dev/html/mobile/nonmember/payment1.php
===================================================================
--- branches/dev/html/mobile/nonmember/payment1.php	(revision 14830)
+++ 	(revision )
@@ -1,375 +1,0 @@
-<?php
-/**
- * 
- * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- * 
- */
-
-require_once("../require.php");
-
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	function LC_Page() {
-		$this->tpl_css = '/css/layout/shopping/pay.css';
-		$this->tpl_mainpage = 'nonmember/payment.tpl';
-		$this->tpl_onload = 'fnCheckInputPoint();';
-		$this->tpl_title = "¤ª»ÙÊ§ÊýË¡¤Î»ØÄê";
-		/*
-		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
-		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
-		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
-		*/
-		session_cache_limiter('private-no-expire');		
-	}
-}
-
-$objPage = new LC_Page();
-$objView = new SC_MobileView();
-$objSiteSess = new SC_SiteSession();
-$objCartSess = new SC_CartSession();
-$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');
-}
-
-
-// ¶â³Û¤Î¼èÆÀ (¹ØÆþÅÓÃæ¤ÇÇä¤êÀÚ¤ì¤¿¾ì¹ç¤Ë¤Ï¤³¤Î´Ø¿ôÆâ¤Ë¤Æ¤½¤Î¾¦ÉÊ¤Î¸Ä¿ô¤¬£°¤Ë¤Ê¤ë)
-$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
-$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
-
-// ¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ¤ÎÇä¤êÀÚ¤ì¥Á¥§¥Ã¥¯
-$objCartSess->chkSoldOut($objCartSess->getCartList(), true);
-
-// Ìá¤ë¥Ü¥¿¥ó¤Î½èÍý
-if (!empty($_POST['return'])) {
-	switch ($_POST['mode']) {
-	case 'confirm':
-		$_POST['mode'] = 'payment';
-		break;
-	default:
-		// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
-		$objSiteSess->setRegistFlag();
-		//header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_TOP));
-        header("Location: " . gfAddSessionId('../nonmember/index.php'));
-		exit;
-//        $_POST['mode'] = "deliv_date";
-	}
-}
-
-switch($_POST['mode']) {
-// »ÙÊ§¤¤ÊýË¡»ØÄê ¢ª ÇÛÃ£Æü»þ»ØÄê
-case 'deliv_date':
-	
-    // ÆþÎÏÃÍ¤ÎÊÑ´¹
-	$objFormParam->convParam();
-	$objPage->arrErr = lfCheckError($objPage->arrData);
-	if (!isset($objPage->arrErr['payment_id'])) {
-		// »ÙÊ§¤¤ÊýË¡¤ÎÆþÎÏ¥¨¥é¡¼¤Ê¤·
-		$objPage->tpl_mainpage = 'nonmember/deliv_date.tpl';
-		$objPage->tpl_title = "ÇÛÃ£Æü»þ»ØÄê";
-		break;
-	} else {
-		// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
-		$uniqid = $objSiteSess->getUniqId();
-		// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
-		lfSetOrderTempData($uniqid);
-	}
-	break;
-case 'confirm':
-	// ÆþÎÏÃÍ¤ÎÊÑ´¹
-	$objFormParam->convParam();
-	$objPage->arrErr = lfCheckError($objPage->arrData );
-	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
-	if(count($objPage->arrErr) == 0) {
-		// DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
-		lfRegistData($uniqid);
-		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
-		$objSiteSess->setRegistFlag();
-		// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
-		//header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_CONFIRM));
-        header("Location: " . gfAddSessionId('./confirm.php'));
-		exit;
-	}else{
-		// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
-		$uniqid = $objSiteSess->getUniqId();
-		// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
-		lfSetOrderTempData($uniqid);
-		if (!isset($objPage->arrErr['payment_id'])) {
-			// »ÙÊ§¤¤ÊýË¡¤ÎÆþÎÏ¥¨¥é¡¼¤Ê¤·
-			$objPage->tpl_mainpage = 'nonmember/deliv_date.tpl';
-			$objPage->tpl_title = "ÇÛÃ£Æü»þ»ØÄê";
-		}
-	}
-	break;
-// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
-case 'return':
-	// Èó²ñ°÷¤Î¾ì¹ç
-	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
-	$objSiteSess->setRegistFlag();
-	header("Location: " . gfAddSessionId('../shopping/index.php'));
-	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);
-$objView->display(SITE_FRAME);
-//--------------------------------------------------------------------------------------------------------------------------
-/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
-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;
-}
-
-
-?>
