Index: /branches/feature-module-update/html/admin/customer/edit.php
===================================================================
--- /branches/feature-module-update/html/admin/customer/edit.php	(revision 15532)
+++ /branches/feature-module-update/html/admin/customer/edit.php	(revision 15568)
@@ -5,343 +5,15 @@
  * http://www.lockon.co.jp/
  */
-require_once("../require.php");
 
-// 認証可否の判定
-$objSess = new SC_Session();
-sfIsSuccess($objSess);
+// {{{ requires
+require_once("../../require.php");
+require_once(CLASS_PATH . "page_extends/admin/customer/LC_Page_Admin_Customer_Edit_Ex.php");
 
-//---- ページ表示用クラス
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	var $list_data;
+// }}}
+// {{{ generate page
 
-	var $arrErr;
-	var $arrYear;
-	var $arrMonth;
-	var $arrDay;
-	var $arrPref;
-	var $arrJob;
-	var $arrSex;
-	var $arrReminder;
-	var $count;
-	
-	var $tpl_strnavi;
-				
-	function LC_Page() {
-		$this->tpl_mainpage = 'customer/edit.tpl';
-		$this->tpl_mainno = 'customer';
-		$this->tpl_subnavi = 'customer/subnavi.tpl';
-		$this->tpl_subno = 'index';
-		$this->tpl_pager = DATA_PATH . 'Smarty/templates/admin/pager.tpl';
-		$this->tpl_subtitle = '顧客マスタ';
-
-		global $arrPref;
-		$this->arrPref = $arrPref;
-		global $arrJob;
-		$this->arrJob = $arrJob;
-		global $arrSex;		
-		$this->arrSex = $arrSex;
-		global $arrReminder;
-		$this->arrReminder = $arrReminder;
-	}
-}
-$objQuery = new SC_Query();
-$objConn = new SC_DBConn();
-$objPage = new LC_Page();
-$objView = new SC_AdminView();
-$objDate = new SC_Date(1901);
-$objPage->arrYear = $objDate->getYear();	//　日付プルダウン設定
-$objPage->arrMonth = $objDate->getMonth();
-$objPage->arrDay = $objDate->getDay();
-
-//---- 登録用カラム配列
-$arrRegistColumn = array(
-							 array(  "column" => "name01",		"convert" => "aKV" ),
-							 array(  "column" => "name02",		"convert" => "aKV" ),
-							 array(  "column" => "kana01",		"convert" => "CKV" ),
-							 array(  "column" => "kana02",		"convert" => "CKV" ),
-							 array(  "column" => "zip01",		"convert" => "n" ),
-							 array(  "column" => "zip02",		"convert" => "n" ),
-							 array(  "column" => "pref",		"convert" => "n" ),
-							 array(  "column" => "addr01",		"convert" => "aKV" ),
-							 array(  "column" => "addr02",		"convert" => "aKV" ),
-							 array(  "column" => "email",		"convert" => "a" ),
-							 array(  "column" => "email_mobile",	"convert" => "a" ),
-							 array(  "column" => "tel01",		"convert" => "n" ),
-							 array(  "column" => "tel02",		"convert" => "n" ),
-							 array(  "column" => "tel03",		"convert" => "n" ),
-							 array(  "column" => "fax01",		"convert" => "n" ),
-							 array(  "column" => "fax02",		"convert" => "n" ),
-							 array(  "column" => "fax03",		"convert" => "n" ),
-							 array(  "column" => "sex",			"convert" => "n" ),
-							 array(  "column" => "job",			"convert" => "n" ),
-							 array(  "column" => "birth",		"convert" => "n" ),
-							 array(  "column" => "password",	"convert" => "a" ),
-							 array(  "column" => "reminder",	"convert" => "n" ),
-							 array(  "column" => "reminder_answer", "convert" => "aKV" ),
-							 array(  "column" => "mailmaga_flg", "convert" => "n" ),						 
-							 array(  "column" => "note",		"convert" => "aKV" ),
-							 array(  "column" => "point",		"convert" => "n" ),
-							 array(  "column" => "status",		"convert" => "n" )
-						 );
-
-//---- 登録除外用カラム配列
-$arrRejectRegistColumn = array("year", "month", "day");
-
-// 検索条件を保持
-if ($_POST['mode'] == "edit_search") {
-	$arrSearch = $_POST;
-}else{
-	$arrSearch = $_POST['search_data'];
-}
-if(is_array($arrSearch)){
-	foreach($arrSearch as $key => $val){
-		$arrSearchData[$key] = $val;
-	}
-}
-
-$objPage->arrSearchData= $arrSearchData;
-
-//----　顧客編集情報取得
-if (($_POST["mode"] == "edit" || $_POST["mode"] == "edit_search") && is_numeric($_POST["edit_customer_id"])) {
-
-	//--　顧客データ取得
-	$sql = "SELECT * FROM dtb_customer WHERE del_flg = 0 AND customer_id = ?";
-	$result = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
-	$objPage->list_data = $result[0];
-	
-	$birth = split(" ", $objPage->list_data["birth"]);
-	$birth = split("-",$birth[0]);
-	
-	$objPage->list_data["year"] = $birth[0];
-	$objPage->list_data["month"] = $birth[1];
-	$objPage->list_data["day"] = $birth[2];
-	
-	$objPage->list_data["password"] = DEFAULT_PASSWORD;
-	//DB登録のメールアドレスを渡す
-	$objPage->tpl_edit_email = $result[0]['email'];
-	//購入履歴情報の取得
-	$objPage->arrPurchaseHistory = lfPurchaseHistory($_POST['edit_customer_id']);
-	// 支払い方法の取得
-	$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
-}
-
-//----　顧客情報編集
-if ( $_POST["mode"] != "edit" && $_POST["mode"] != "edit_search" && is_numeric($_POST["customer_id"])) {
-
-	//-- POSTデータの引き継ぎ
-	$objPage->arrForm = $_POST;
-	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// emailはすべて小文字で処理
-
-	//-- 入力データの変換
-	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
-	//-- 入力チェック
-	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
-
-	//-- 入力エラー発生 or リターン時
-	if ($objPage->arrErr || $_POST["mode"] == "return") {
-		foreach($objPage->arrForm as $key => $val) {
-			$objPage->list_data[ $key ] = $val;
-		}
-		//購入履歴情報の取得
-		$objPage->arrPurchaseHistory = lfPurchaseHistory($_POST['customer_id']);
-		// 支払い方法の取得
-		$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
-		
-	} else {
-		//-- 確認
-		if ($_POST["mode"] == "confirm") {
-			$objPage->tpl_mainpage = 'customer/edit_confirm.tpl';
-			$passlen = strlen($objPage->arrForm['password']);
-			$objPage->passlen = lfPassLen($passlen);
-			
-		}
-		//--　編集
-		if($_POST["mode"] == "complete") {
-			$objPage->tpl_mainpage = 'customer/edit_complete.tpl';
-			
-			// 現在の会員情報を取得する
-			$arrCusSts = $objQuery->getOne("SELECT status FROM dtb_customer WHERE customer_id = ?", array($_POST["customer_id"]));
-
-			// 会員情報が変更されている場合にはシークレット№も更新する。
-			if ($arrCusSts != $_POST['status']){
-				$secret = sfGetUniqRandomId("r");
-				$objPage->arrForm['secret_key'] = $secret;
-				array_push($arrRegistColumn, array('column' => 'secret_key', 'convert' => 'n'));
-			}
-			//-- 編集登録
-			sfEditCustomerData($objPage->arrForm, $arrRegistColumn);
-		}
-	}
-}
-
-//----　ページ表示
-$objView->assignobj($objPage);
-$objView->display(MAIN_FRAME);
-
-
-
-//-------------- function
-
-// 編集登録
-function lfRegisDatat($array, $arrRegistColumn) {
-	global $objConn;
-	global $objQuery;
-	foreach ($arrRegistColumn as $data) {
-		if($array[$data["column"]] != "") {
-			$arrRegist[$data["column"]] = $array[$data["column"]];
-		} else {
-			$arrRegist[$data["column"]] = NULL;
-		}
-	}
-	if (strlen($array["year"]) > 0) {
-		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
-	}
-
-	//-- パスワードの更新がある場合は暗号化。（更新がない場合はUPDATE文を構成しない）
-	if ($array["password"] != DEFAULT_PASSWORD) {
-		$arrRegist["password"] = sha1($array["password"] . ":" . AUTH_MAGIC);
-	} else {
-		unset($arrRegist['password']);
-	}
-
-	$arrRegist["update_date"] = "Now()";
-
-	//-- 編集登録実行
-	$objConn->query("BEGIN");
-	$objQuery->Insert("dtb_customer", $arrRegist, "customer_id = '" .addslashes($array["customer_id"]). "'");
-
-	$objConn->query("COMMIT");
-}
-
-
-//----　取得文字列の変換
-function lfConvertParam($array, $arrRegistColumn) {
-	/*
-	 *	文字列の変換
-	 *	K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
-	 *	C :  「全角ひら仮名」を「全角かた仮名」に変換
-	 *	V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します	
-	 *	n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
-	 *  a :  全角英数字を半角英数字に変換する
-	 */
-	// カラム名とコンバート情報
-	foreach ($arrRegistColumn as $data) {
-		$arrConvList[ $data["column"] ] = $data["convert"];
-	}
-	// 文字変換
-	foreach ($arrConvList as $key => $val) {
-		// POSTされてきた値のみ変換する。
-		if(strlen(($array[$key])) > 0) {
-			$array[$key] = mb_convert_kana($array[$key] ,$val);
-		}
-	}
-	return $array;
-}
-
-//---- 入力エラーチェック
-function lfErrorCheck($array) {
-
-	global $objConn;
-	$objErr = new SC_CheckError($array);
-
-	$objErr->doFunc(array("会員状態", 'status'), array("EXIST_CHECK"));
-	$objErr->doFunc(array("お名前（姓）", 'name01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("お名前（名）", 'name02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("フリガナ（姓）", 'kana01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
-	$objErr->doFunc(array("フリガナ（名）", 'kana02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
-	$objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-	$objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
-	$objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
-	$objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
-	$objErr->doFunc(array("ご住所（1）", "addr01", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("ご住所（2）", "addr02", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN) ,array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
-	
-	//現会員の判定 →　現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
-	if (strlen($array["email"]) > 0) {
-		$sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? escape '#' AND (status = 1 OR status = 2) AND del_flg = 0 AND customer_id <> ?";
-		$checkMail = ereg_replace( "_", "#_", $array["email"]);
-		$result = $objConn->getAll($sql, array($checkMail, $array["customer_id"]));
-		if (count($result) > 0) {
-			$objErr->arrErr["email"] .= "※ すでに登録されているメールアドレスです。";
-		} 
-	}
-	
-	$objErr->doFunc(array('メールアドレス(モバイル)', "email_mobile", MTEXT_LEN) ,array("EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
-	//現会員の判定 →　現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
-	if (strlen($array["email_mobile"]) > 0) {
-		$sql = "SELECT customer_id FROM dtb_customer WHERE email_mobile ILIKE ? escape '#' AND (status = 1 OR status = 2) AND del_flg = 0 AND customer_id <> ?";
-		$checkMail = ereg_replace( "_", "#_", $array["email_mobile"]);
-		$result = $objConn->getAll($sql, array($checkMail, $array["customer_id"]));
-		if (count($result) > 0) {
-			$objErr->arrErr["email_mobile"] .= "※ すでに登録されているメールアドレス(モバイル)です。";
-		} 
-	}
-	
-	
-	$objErr->doFunc(array("お電話番号1", 'tel01'), array("EXIST_CHECK"));
-	$objErr->doFunc(array("お電話番号2", 'tel02'), array("EXIST_CHECK"));
-	$objErr->doFunc(array("お電話番号3", 'tel03'), array("EXIST_CHECK"));
-	$objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
-	$objErr->doFunc(array("FAX番号", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
-	$objErr->doFunc(array("ご性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
-	$objErr->doFunc(array("ご職業", "job") ,array("NUM_CHECK"));
-	if ($array["password"] != DEFAULT_PASSWORD) {
-		$objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
-	}
-	$objErr->doFunc(array("パスワードを忘れたときのヒント 質問", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
-	$objErr->doFunc(array("パスワードを忘れたときのヒント 答え", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("メールマガジン", "mailmaga_flg") ,array("SELECT_CHECK", "NUM_CHECK"));
-	$objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
-	$objErr->doFunc(array("SHOP用メモ", 'note', LTEXT_LEN), array("MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("所持ポイント", "point", TEL_LEN) ,array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-	return $objErr->arrErr;
-	
-}
-
-//購入履歴情報の取得
-function lfPurchaseHistory($customer_id){
-		global $objQuery;
-		global $objPage;
-		
-		$objPage->tpl_pageno = $_POST['search_pageno'];
-		$objPage->edit_customer_id = $customer_id;
-
-		// ページ送りの処理
-		$page_max = SEARCH_PMAX;
-		//購入履歴の件数取得
-		$objPage->tpl_linemax = $objQuery->count("dtb_order","customer_id=? AND del_flg = 0 ", array($customer_id));
-		$linemax = $objPage->tpl_linemax;
-		
-		// ページ送りの取得
-		$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage2", NAVI_PMAX);
-		$objPage->arrPagenavi = $objNavi->arrPagenavi;
-		$objPage->arrPagenavi['mode'] = 'edit';
-		$startno = $objNavi->start_row;
-		
-		// 取得範囲の指定(開始行番号、行数のセット)
-		$objQuery->setlimitoffset($page_max, $startno);
-		// 表示順序
-		$order = "order_id DESC";
-		$objQuery->setorder($order);
-		//購入履歴情報の取得
-		$arrPurchaseHistory = $objQuery->select("*", "dtb_order", "customer_id=? AND del_flg = 0 ", array($customer_id));
-		
-		return $arrPurchaseHistory;
-}
-
-//確認ページ用パスワード表示用
-
-function lfPassLen($passlen){
-	$ret = "";
-	for ($i=0;$i<$passlen;true){
-		$ret.="*";
-		$i++;
-	}
-	return $ret;
-}
-
-
+$objPage = new LC_Page_Admin_Customer_Edit_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/html/admin/customer/index.php
===================================================================
--- /branches/feature-module-update/html/admin/customer/index.php	(revision 15532)
+++ /branches/feature-module-update/html/admin/customer/index.php	(revision 15568)
@@ -5,425 +5,15 @@
  * http://www.lockon.co.jp/
  */
-require_once("../require.php");
-require_once(DATA_PATH . "include/csv_output.inc");
 
-//---- ページ表示用クラス
-class LC_Page {
-	var $arrSession;
-	var $tpl_mode;
-	var $list_data;
-	var $search_data;
-	var $arrErr;
-	var $arrYear;
-	var $arrMonth;
-	var $arrDay;
-	var $arrJob;
-	var $arrSex;
-	var $arrPageMax;
-	var $count;
-	var $search_SQL;
-	
-	var $tpl_strnavi;
-	
-	var $arrHtmlmail;
+// {{{ requires
+require_once("../../require.php");
+require_once(CLASS_PATH . "page_extends/admin/customer/LC_Page_Admin_Customer_Ex.php");
 
-	function LC_Page() {
-		$this->tpl_mainpage = 'customer/index.tpl';
-		$this->tpl_mainno = 'customer';
-		$this->tpl_subnavi = 'customer/subnavi.tpl';
-		$this->tpl_subno = 'index';
-		$this->tpl_pager = DATA_PATH . 'Smarty/templates/admin/pager.tpl';
-		$this->tpl_subtitle = '顧客マスタ';
-		
-		global $arrPref;
-		$this->arrPref = $arrPref;
-		global $arrJob;
-		$arrJob["不明"] = "不明";
-		$this->arrJob = $arrJob;
-		global $arrSex;		
-		$this->arrSex = $arrSex;
-		global $arrPageRows;
-		$this->arrPageRows = $arrPageRows;
-		
-		global $arrMAILMAGATYPE;
-		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
-		$this->arrHtmlmail[''] = "すべて";
-		$this->arrHtmlmail[1] = $arrMAILMAGATYPE[1];
-		$this->arrHtmlmail[2] = $arrMAILMAGATYPE[2];		
-	}
-}
+// }}}
+// {{{ generate page
 
-//----　CSVダウンロード用
-$arrColumnCSV= array(
-						0  => array("sql" => "customer_id", "csv" => "customer_id", "header" => "顧客ID"),
-						1  => array("sql" => "name01", "csv" => "name01", "header" => "名前1"),
-						2  => array("sql" => "name02", "csv" => "name02", "header" => "名前2"),
-						3  => array("sql" => "kana01", "csv" => "kana01", "header" => "フリガナ1"),
-						4  => array("sql" => "kana02", "csv" => "kana02", "header" => "フリガナ2"),
-						5  => array("sql" => "zip01", "csv" => "zip01", "header" => "郵便番号1"),
-						6  => array("sql" => "zip02", "csv" => "zip02", "header" => "郵便番号2"),
-						7  => array("sql" => "pref", "csv" => "pref", "header" => "都道府県"),
-						8  => array("sql" => "addr01", "csv" => "addr01", "header" => "住所1"),
-						9  => array("sql" => "addr02", "csv" => "addr02", "header" => "住所2"),
-						10 => array("sql" => "email", "csv" => "email", "header" => "E-MAIL"),
-						11 => array("sql" => "tel01", "csv" => "tel01", "header" => "TEL1"),
-						12 => array("sql" => "tel02", "csv" => "tel02", "header" => "TEL2"),
-						13 => array("sql" => "tel03", "csv" => "tel03", "header" => "TEL3"),
-						14 => array("sql" => "fax01", "csv" => "fax01", "header" => "FAX1"),
-						15 => array("sql" => "fax02", "csv" => "fax02", "header" => "FAX2"),
-						16 => array("sql" => "fax03", "csv" => "fax03", "header" => "FAX3"),
-						17 => array("sql" => "CASE WHEN sex = 1 THEN '男性' ELSE '女性' END AS sex", "csv" => "sex", "header" => "性別"),
-						18 => array("sql" => "job", "csv" => "job", "header" => "職業"),
-						19 => array("sql" => "cast(birth as date) AS birth", "csv" => "birth", "header" => "誕生日"),
-						20 => array("sql" => "cast(first_buy_date as date) AS first_buy_date", "csv" => "first_buy_date", "header" => "初回購入日"),
-						21 => array("sql" => "cast(last_buy_date as date) AS last_buy_date", "csv" => "last_buy_date", "header" => "最終購入日"),
-						22 => array("sql" => "buy_times", "csv" => "buy_times", "header" => "購入回数"),
-						23 => array("sql" => "point", "csv" => "point", "header" => "ポイント残高"),
-						24 => array("sql" => "note", "csv" => "note", "header" => "備考"),
-						25 => array("sql" => "cast(create_date as date) AS create_date", "csv" => "create_date", "header" => "登録日"),
-						26 => array("sql" => "cast(update_date as date) AS update_date", "csv" => "update_date", "header" => "更新日")
-					);
-
-//---- ページ初期設定
-$objQuery = new SC_Query();
-$objPage = new LC_Page();
-$objView = new SC_AdminView();
-$objDate = new SC_Date(1901);
-$objPage->arrYear = $objDate->getYear();	//　日付プルダウン設定
-$objPage->arrMonth = $objDate->getMonth();
-$objPage->arrDay = $objDate->getDay();
-$objPage->objDate = $objDate;
-
-// 認証可否の判定
-$objSess = new SC_Session();
-sfIsSuccess($objSess);
-
-// POST値の引き継ぎ
-$objPage->arrForm = $_POST;
-
-// ページ送り用
-$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
-
-// 検索ワードの引き継ぎ
-foreach ($_POST as $key => $val) {
-	switch($key) {
-		case 'sex':
-			$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
-			if(!is_array($val)) {
-				$objPage->arrForm[$key] = split("-", $val);
-			}
-			break;
-		default:
-			$objPage->arrHidden[$key] = $val;
-			break;
-	}
-}
-
-// 顧客削除
-if ($_POST['mode'] == "delete") {
-	$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
-	$result_customer = $objQuery->conn->getAll($sql, array($_POST["edit_customer_id"]));
-
-	if ($result_customer[0]["status"] == 2) {			//本会員削除
-		$arrDel = array("del_flg" => 1, "update_date" => "NOW()"); 
-		$objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["edit_customer_id"]) );
-	} elseif ($result_customer[0]["status"] == 1) {		//仮会員削除
-		$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
-		$objQuery->conn->query($sql, array($_POST["edit_customer_id"]));
-	}
-}
-if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
-	// 入力文字の強制変換
-	lfConvertParam();
-	// エラーチェック
-	$objPage->arrErr = lfCheckError($objPage->arrForm);
-
-	$where = "del_flg = 0";
-
-	/* 入力エラーなし */
-	if (count($objPage->arrErr) == 0) {
-		
-		//-- 検索データ取得
-		$objSelect = new SC_CustomerList($objPage->arrForm, "customer");
-		
-		// 表示件数設定
-		$page_rows = $objPage->arrForm['page_rows'];
-		if(is_numeric($page_rows)) {	
-			$page_max = $page_rows;
-		} else {
-			$page_max = SEARCH_PMAX;
-		}
-		
-		if ($objPage->arrForm['search_pageno'] == 0){
-			$objPage->arrForm['search_pageno'] = 1;
-		}
-		
-		$offset = $page_max * ($objPage->arrForm['search_pageno'] - 1);
-		$objSelect->setLimitOffset($page_max, $offset);		
-		
-		if ($_POST["mode"] == 'csv') {
-			$searchSql = $objSelect->getListCSV($arrColumnCSV);
-		}else{
-			$searchSql = $objSelect->getList();
-		}
-		
-		$objPage->search_data = $objQuery->conn->getAll($searchSql, $objSelect->arrVal);
-		
-		switch($_POST['mode']) {
-		case 'csv':
-			$i = 0;
-			$header = "";
-			
-			// CSVカラム取得
-			$arrCsvOutput = (sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1"));
-
-			if (count($arrCsvOutput) <= 0) break;
-
-			foreach($arrCsvOutput as $data) {
-				$arrColumn[] = $data["col"];
-				if ($i != 0) $header .= ", ";
-				$header .= $data["disp_name"];
-				$i ++;
-			}
-			$header .= "\n";
-
-			//-　都道府県/職業の変換
-			for($i = 0; $i < count($objPage->search_data); $i ++) {
-				$objPage->search_data[$i]["pref"] = $arrPref[ $objPage->search_data[$i]["pref"] ];
-				$objPage->search_data[$i]["job"]  = $arrJob[ $objPage->search_data[$i]["job"] ];
-			}
-
-			//-　CSV出力
-			$data = lfGetCSVData($objPage->search_data, $arrColumn);
-			
-			sfCSVDownload($header.$data);
-			exit;
-			break;
-		case 'delete_all':
-			// 検索結果をすべて削除
-			$where = "product_id IN (SELECT product_id FROM vw_products_nonclass AS noncls WHERE $where)";
-			$sqlval['del_flg'] = 1;
-			$objQuery->update("dtb_products", $sqlval, $where, $arrval);
-
-			$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
-			$result_customer = $objQuery->conn->getAll($sql, array($_POST["del_customer_id"]));
-
-			if ($result_customer[0]["status"] == 2) {			//本会員削除
-				$arrDel = array("del_flg" => 1, "update_date" => "NOW()");
-				$objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["del_customer_id"]) );
-			} elseif ($result_customer[0]["status"] == 1) {		//仮会員削除
-				$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
-				$objQuery->conn->query($sql, array($_POST["del_customer_id"]));
-			}
-			
-			break;
-		default:
-
-			// 行数の取得
-			$linemax = $objQuery->conn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
-			$objPage->tpl_linemax = $linemax;				// 何件が該当しました。表示用
-
-			// ページ送りの取得
-			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnCustomerPage", NAVI_PMAX);
-			$startno = $objNavi->start_row;
-			$objPage->arrPagenavi = $objNavi->arrPagenavi;		
-		}
-	}
-}
-
-$objPage->arrCatList = sfGetCategoryList();
-
-//----　ページ表示
-$objView->assignobj($objPage);
-$objView->display(MAIN_FRAME);
-
-
-//--------------------------------------------------------------------------------------------------------------------------------------
-
-//----　取得文字列の変換
-function lfConvertParam() {
-	global $objPage;
-	
-	/*
-	 *	文字列の変換
-	 *	K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
-	 *	C :  「全角ひら仮名」を「全角かた仮名」に変換
-	 *	V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します	
-	 *	n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
-	 *  a :  全角英数字を半角英数字に変換する
-	 */
-	// カラム名とコンバート情報
-	$arrConvList['customer_id'] = "n" ;
-	$arrConvList['name'] = "aKV" ;
-	$arrConvList['pref'] = "n" ;
-	$arrConvList['kana'] = "CKV" ;
-	$arrConvList['b_start_year'] = "n" ;
-	$arrConvList['b_start_month'] = "n" ;
-	$arrConvList['b_start_day'] = "n" ;
-	$arrConvList['b_end_year'] = "n" ;
-	$arrConvList['b_end_month'] = "n" ;
-	$arrConvList['b_end_day'] = "n" ;
-	$arrConvList['tel'] = "n" ;
-	$arrConvList['birth_month'] = "n" ;
-	$arrConvList['email'] = "a" ;
-	$arrConvList['buy_total_from'] = "n" ;
-	$arrConvList['buy_total_to'] = "n" ;
-	$arrConvList['buy_times_from'] = "n" ;
-	$arrConvList['buy_times_to'] = "n" ;
-	$arrConvList['start_year'] = "n" ;
-	$arrConvList['start_month'] = "n" ;
-	$arrConvList['start_day'] = "n" ;
-	$arrConvList['end_year'] = "n" ;
-	$arrConvList['end_month'] = "n" ;
-	$arrConvList['end_day'] = "n" ;
-	$arrConvList['page_rows'] = "n" ;
-	$arrConvList['buy_start_year'] = "n" ;		//　最終購入日 START 年
-	$arrConvList['buy_start_month'] = "n" ;		//　最終購入日 START 月
-	$arrConvList['buy_start_day'] = "n" ;		//　最終購入日 START 日
-	$arrConvList['buy_end_year'] = "n" ;			//　最終購入日 END 年
-	$arrConvList['buy_end_month'] = "n" ;		//　最終購入日 END 月
-	$arrConvList['buy_end_day'] = "n" ;			//　最終購入日 END 日
-	$arrConvList['buy_product_name'] = "aKV" ;	//　購入商品名
-	$arrConvList['buy_product_code'] = "aKV" ;	//　購入商品コード
-	$arrConvList['category_id'] = "" ;			//　カテゴリ
-		
-	// 文字変換
-	foreach ($arrConvList as $key => $val) {
-		// POSTされてきた値のみ変換する。
-		if(isset($objPage->arrForm[$key])) {
-			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
-		}
-	}
-}
-
-
-//---- 入力エラーチェック
-function lfCheckError($array) {
-
-	$objErr = new SC_CheckError($array);
-	
-	$objErr->doFunc(array("顧客コード", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("都道府県", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("顧客名", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("顧客名(カナ)", "kana", STEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANABLANK_CHECK"));
-	$objErr->doFunc(array("誕生日(開始日)", "b_start_year", "b_start_month", "b_start_day"), array("CHECK_DATE"));
-	$objErr->doFunc(array("誕生日(終了日)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));
-	$objErr->doFunc(array("誕生日(開始日)","誕生日(終了日)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM"));
-	$objErr->doFunc(array("誕生月", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array('メールアドレス', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array('携帯メールアドレス', "email_mobile", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));	
-	$objErr->doFunc(array("電話番号", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("購入金額(開始)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("購入金額(終了)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && ($array["buy_total_from"] > $array["buy_total_to"]) ) $objErr->arrErr["buy_total_from"] .= "※ 購入金額の指定範囲が不正です。";
-	$objErr->doFunc(array("購入回数(開始)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	$objErr->doFunc(array("購入回数(終了)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
-	if ( (is_numeric($array["buy_times_from"]) && is_numeric($array["buy_times_to"]) ) && ($array["buy_times_from"] > $array["buy_times_to"]) ) $objErr->arrErr["buy_times_from"] .= "※ 購入回数の指定範囲が不正です。";
-	$objErr->doFunc(array("登録・更新日(開始日)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
-	$objErr->doFunc(array("登録・更新日(終了日)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));	
-	$objErr->doFunc(array("登録・更新日(開始日)","登録・更新日(終了日)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
-	$objErr->doFunc(array("表示件数", "page_rows", 3), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
-	$objErr->doFunc(array("最終購入日(開始日)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));	//最終購入日(開始日)
-	$objErr->doFunc(array("最終購入(終了日)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));			//最終購入日(終了日)
-	//購入金額(from) ＞ 購入金額(to) の場合はエラーとする
-	$objErr->doFunc(array("最終購入日(開始日)","登録・更新日(終了日)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM"));	
-	$objErr->doFunc(array("購入商品コード", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));						//購入商品コード
-	$objErr->doFunc(array("購入商品名", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));							//購入商品名称
-
-	return $objErr->arrErr;
-}
-
-function lfSetWhere($arrForm){
-	foreach ($arrForm as $key => $val) {
-		
-		$val = sfManualEscape($val);
-		
-		if($val == "") continue;
-		
-		switch ($key) {
-			case 'product_id':
-				$where .= " AND product_id = ?";
-				$arrval[] = $val;
-				break;
-			case 'product_class_id':
-				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
-				$arrval[] = $val;
-				break;
-			case 'name':
-				$where .= " AND name ILIKE ?";
-				$arrval[] = "%$val%";
-				break;
-			case 'category_id':
-				list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
-				if($tmp_where != "") {
-					$where.= " AND $tmp_where";
-					$arrval = array_merge($arrval, $tmp_arrval);
-				}
-				break;
-			case 'product_code':
-				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
-				$arrval[] = "%$val%";
-				break;
-			case 'startyear':
-				$date = sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
-				$where.= " AND update_date >= ?";
-				$arrval[] = $date;
-				break;
-			case 'endyear':
-				$date = sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
-				$where.= " AND update_date <= ?";
-				$arrval[] = $date;
-				break;
-			case 'product_flag':
-				global $arrSTATUS;
-				$product_flag = sfSearchCheckBoxes($val);
-				if($product_flag != "") {
-					$where.= " AND product_flag LIKE ?";
-					$arrval[] = $product_flag;					
-				}
-				break;
-			case 'status':
-				$tmp_where = "";
-				foreach ($val as $element){
-					if ($element != ""){
-						if ($tmp_where == ""){
-							$tmp_where.="AND (status LIKE ? "; 
-						}else{
-							$tmp_where.="OR status LIKE ? ";
-						}
-						$arrval[]=$element;
-					}
-				}
-				if ($tmp_where != ""){
-					$tmp_where.=")";
-					$where.= "$tmp_where";
-				}	
-				break;
-			default:
-				break;
-		}
-	}
-}
-
-//---- CSV出力用データ取得
-function lfGetCSVData( $array, $arrayIndex){	
-	
-	for ($i=0; $i<count($array); $i++){
-		
-		for ($j=0; $j<count($array[$i]); $j++ ){
-			if ( $j > 0 ) $return .= ",";
-			$return .= "\"";			
-			if ( $arrayIndex ){
-				$return .= mb_ereg_replace("<","＜",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
-			} else {
-				$return .= mb_ereg_replace("<","＜",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
-			}
-		}
-		$return .= "\n";			
-	}
-	
-	return $return;
-}
-
-
+$objPage = new LC_Page_Admin_Customer_Ex();
+$objPage->init();
+$objPage->process();
+register_shutdown_function(array($objPage, "destroy"));
 ?>
Index: /branches/feature-module-update/data/class/page_extends/admin/customer/LC_Page_Admin_Customer_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/admin/customer/LC_Page_Admin_Customer_Ex.php	(revision 15568)
+++ /branches/feature-module-update/data/class/page_extends/admin/customer/LC_Page_Admin_Customer_Ex.php	(revision 15568)
@@ -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/admin/customer/LC_Page_Admin_Customer.php");
+
+/**
+ * 顧客管理 のページクラス(拡張).
+ *
+ * LC_Page_Admin_Customer をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Customer_Ex extends LC_Page_Admin_Customer {
+
+    // }}}
+    // {{{ 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/admin/customer/LC_Page_Admin_Customer_Edit_Ex.php
===================================================================
--- /branches/feature-module-update/data/class/page_extends/admin/customer/LC_Page_Admin_Customer_Edit_Ex.php	(revision 15568)
+++ /branches/feature-module-update/data/class/page_extends/admin/customer/LC_Page_Admin_Customer_Edit_Ex.php	(revision 15568)
@@ -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/admin/customer/LC_Page_Admin_Customer_Edit.php");
+
+/**
+ * 顧客情報修正 のページクラス(拡張).
+ *
+ * LC_Page_Admin_Customer_Edit をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Customer_Edit_Ex extends LC_Page_Admin_Customer_Edit {
+
+    // }}}
+    // {{{ 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/pages/admin/customer/LC_Page_Admin_Customer.php
===================================================================
--- /branches/feature-module-update/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 15568)
+++ /branches/feature-module-update/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 15568)
@@ -0,0 +1,518 @@
+<?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_Admin_Customer extends LC_Page {
+
+    // {{{ properties
+
+    // TODO
+    var $arrSession;
+    var $tpl_mode;
+    var $list_data;
+    var $search_data;
+    var $arrErr;
+    var $arrYear;
+    var $arrMonth;
+    var $arrDay;
+    var $arrJob;
+    var $arrSex;
+    var $arrPageMax;
+    var $count;
+    var $search_SQL;
+    var $tpl_strnavi;
+    var $arrHtmlmail;
+
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'customer/index.tpl';
+        $this->tpl_mainno = 'customer';
+        $this->tpl_subnavi = 'customer/subnavi.tpl';
+        $this->tpl_subno = 'index';
+        $this->tpl_pager = DATA_PATH . 'Smarty/templates/admin/pager.tpl';
+        $this->tpl_subtitle = '顧客マスタ';
+
+        $masterData = new SC_DB_MasterData_Ex();
+        $this->arrPref = $masterData->getMasterData("mtb_pref",
+                             array("pref_id", "pref_name", "rank"));
+
+        $this->arrJob = $masterData->getMasterData("mtb_job");
+        $this->arrJob["不明"] = "不明";
+        $this->arrSex = $masterData->getMasterData("mtb_sex");
+        $this->arrPageRows = $masterData->getMasterData("mtb_page_rows");
+        $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type");
+        $this->arrHtmlmail[''] = "すべて";
+        $this->arrHtmlmail[1] = $this->arrMAILMAGATYPE[1];
+        $this->arrHtmlmail[2] = $this->arrMAILMAGATYPE[2];
+
+        //---- CSVダウンロード用
+        $this->arrColumnCSV = array(0  => array("sql" => "customer_id",
+                                                "csv" => "customer_id",
+                                                "header" => "顧客ID"),
+                                    1  => array("sql" => "name01",
+                                                "csv" => "name01",
+                                                "header" => "名前1"),
+                                    2  => array("sql" => "name02",
+                                                "csv" => "name02",
+                                                "header" => "名前2"),
+                                    3  => array("sql" => "kana01",
+                                                "csv" => "kana01",
+                                                "header" => "フリガナ1"),
+                                    4  => array("sql" => "kana02",
+                                                "csv" => "kana02",
+                                                "header" => "フリガナ2"),
+                                    5  => array("sql" => "zip01",
+                                                "csv" => "zip01",
+                                                "header" => "郵便番号1"),
+                                    6  => array("sql" => "zip02",
+                                                "csv" => "zip02",
+                                                "header" => "郵便番号2"),
+                                    7  => array("sql" => "pref",
+                                                "csv" => "pref",
+                                                "header" => "都道府県"),
+                                    8  => array("sql" => "addr01",
+                                                "csv" => "addr01",
+                                                "header" => "住所1"),
+                                    9  => array("sql" => "addr02",
+                                                "csv" => "addr02",
+                                                "header" => "住所2"),
+                                    10 => array("sql" => "email",
+                                                "csv" => "email",
+                                                "header" => "E-MAIL"),
+                                    11 => array("sql" => "tel01",
+                                                "csv" => "tel01",
+                                                "header" => "TEL1"),
+                                    12 => array("sql" => "tel02",
+                                                "csv" => "tel02",
+                                                "header" => "TEL2"),
+                                    13 => array("sql" => "tel03",
+                                                "csv" => "tel03",
+                                                "header" => "TEL3"),
+                                    14 => array("sql" => "fax01",
+                                                "csv" => "fax01",
+                                                "header" => "FAX1"),
+                                    15 => array("sql" => "fax02",
+                                                "csv" => "fax02",
+                                                "header" => "FAX2"),
+                                    16 => array("sql" => "fax03",
+                                                "csv" => "fax03",
+                                                "header" => "FAX3"),
+                                    17 => array("sql" => "CASE WHEN sex = 1 "
+                                                . " THEN '男性' "
+                                                . " ELSE '女性' END AS sex",
+                                                "csv" => "sex",
+                                                "header" => "性別"),
+                                    18 => array("sql" => "job",
+                                                "csv" => "job",
+                                                "header" => "職業"),
+                                    19 => array("sql" => "cast(birth as date) AS birth",
+                                                "csv" => "birth",
+                                                "header" => "誕生日"),
+                                    20 => array("sql" => "cast(first_buy_date as date) AS first_buy_date",
+                                                "csv" => "first_buy_date",
+                                                "header" => "初回購入日"),
+                                    21 => array("sql" => "cast(last_buy_date as date) AS last_buy_date",
+                                                "csv" => "last_buy_date",
+                                                "header" => "最終購入日"),
+                                    22 => array("sql" => "buy_times",
+                                                "csv" => "buy_times",
+                                                "header" => "購入回数"),
+                                    23 => array("sql" => "point",
+                                                "csv" => "point",
+                                                "header" => "ポイント残高"),
+                                    24 => array("sql" => "note",
+                                                "csv" => "note",
+                                                "header" => "備考"),
+                                    25 => array("sql" => "cast(create_date as date) AS create_date",
+                                                "csv" => "create_date",
+                                                "header" => "登録日"),
+                                    26 => array("sql" => "cast(update_date as date) AS update_date",
+                                                "csv" => "update_date",
+                                                "header" => "更新日")
+                                    );
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        //---- ページ初期設定
+        $objQuery = new SC_Query();
+        $objView = new SC_AdminView();
+        $objDate = new SC_Date(1901);
+        $objDb = new SC_Helper_DB_Ex();
+        $this->arrYear = $objDate->getYear();   //　日付プルダウン設定
+        $this->arrMonth = $objDate->getMonth();
+        $this->arrDay = $objDate->getDay();
+        $this->objDate = $objDate;
+
+        // 認証可否の判定
+        $objSess = new SC_Session();
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        // POST値の引き継ぎ
+        $this->arrForm = $_POST;
+
+        // ページ送り用
+        $this->arrHidden['search_pageno'] =
+                isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
+
+        // 検索ワードの引き継ぎ
+        foreach ($_POST as $key => $val) {
+            switch($key) {
+            case 'sex':
+                $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
+                if(!is_array($val)) {
+                    $this->arrForm[$key] = split("-", $val);
+                }
+                break;
+            default:
+                $this->arrHidden[$key] = $val;
+                break;
+            }
+        }
+
+        if (!isset($_POST['mode'])) $_POST['mode'] = "";
+
+        // 顧客削除
+        if ($_POST['mode'] == "delete") {
+            $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
+            $result_customer = $objQuery->conn->getAll($sql, array($_POST["edit_customer_id"]));
+
+            if ($result_customer[0]["status"] == 2) {           //本会員削除
+                $arrDel = array("del_flg" => 1, "update_date" => "NOW()");
+                $objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["edit_customer_id"]) );
+            } elseif ($result_customer[0]["status"] == 1) {     //仮会員削除
+                $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
+                $objQuery->conn->query($sql, array($_POST["edit_customer_id"]));
+            }
+        }
+        if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
+            // 入力文字の強制変換
+            $this->lfConvertParam();
+            // エラーチェック
+            $this->arrErr = $this->lfCheckError($this->arrForm);
+
+            $where = "del_flg = 0";
+
+            /* 入力エラーなし */
+            if (count($this->arrErr) == 0) {
+
+                //-- 検索データ取得
+                $objSelect = new SC_CustomerList($this->arrForm, "customer");
+
+                // 表示件数設定
+                $page_rows = $this->arrForm['page_rows'];
+                if(is_numeric($page_rows)) {
+                    $page_max = $page_rows;
+                } else {
+                    $page_max = SEARCH_PMAX;
+                }
+
+                if (!isset($this->arrForm['search_pageno'])) $this->arrForm['search_pageno'] = "";
+
+                if ($this->arrForm['search_pageno'] == 0){
+                    $this->arrForm['search_pageno'] = 1;
+                }
+
+                $offset = $page_max * ($this->arrForm['search_pageno'] - 1);
+                $objSelect->setLimitOffset($page_max, $offset);
+
+                if ($_POST["mode"] == 'csv') {
+                    $searchSql = $objSelect->getListCSV($arrColumnCSV);
+                }else{
+                    $searchSql = $objSelect->getList();
+                }
+
+                $this->search_data = $objQuery->conn->getAll($searchSql, $objSelect->arrVal);
+
+                switch($_POST['mode']) {
+                case 'csv':
+                    require_once(CLASS_PATH . "helper_extends/SC_Helper_CSV_Ex.php");
+
+                    $objCSV = new SC_Helper_CSV_Ex();
+                    $i = 0;
+                    $header = "";
+
+                    // CSVカラム取得
+                    $arrCsvOutput = ($objCSV->sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1"));
+
+                    if (count($arrCsvOutput) <= 0) break;
+
+                    foreach($arrCsvOutput as $data) {
+                        $arrColumn[] = $data["col"];
+                        if ($i != 0) $header .= ", ";
+                        $header .= $data["disp_name"];
+                        $i ++;
+                    }
+                    $header .= "\n";
+
+                    //-　都道府県/職業の変換
+                    for($i = 0; $i < count($this->search_data); $i ++) {
+                        $this->search_data[$i]["pref"] = $arrPref[ $this->search_data[$i]["pref"] ];
+                        $this->search_data[$i]["job"]  = $arrJob[ $this->search_data[$i]["job"] ];
+                    }
+
+                    //-　CSV出力
+                    $data = lfGetCSVData($this->search_data, $arrColumn);
+
+                    sfCSVDownload($header.$data);
+                    exit;
+                    break;
+                case 'delete_all':
+                    // 検索結果をすべて削除
+                    $where = "product_id IN (SELECT product_id FROM vw_products_nonclass AS noncls WHERE $where)";
+                    $sqlval['del_flg'] = 1;
+                    $objQuery->update("dtb_products", $sqlval, $where, $arrval);
+
+                    $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
+                    $result_customer = $objQuery->conn->getAll($sql, array($_POST["del_customer_id"]));
+
+                    if ($result_customer[0]["status"] == 2) {           //本会員削除
+                        $arrDel = array("del_flg" => 1, "update_date" => "NOW()");
+                        $objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["del_customer_id"]) );
+                    } elseif ($result_customer[0]["status"] == 1) {     //仮会員削除
+                        $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
+                        $objQuery->conn->query($sql, array($_POST["del_customer_id"]));
+                    }
+
+                    break;
+                default:
+
+                    // 行数の取得
+                    $linemax = $objQuery->conn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
+                    $this->tpl_linemax = $linemax;              // 何件が該当しました。表示用
+
+                    // ページ送りの取得
+                    $objNavi = new SC_PageNavi($this->arrHidden['search_pageno'],
+                                               $linemax, $page_max,
+                                               "fnCustomerPage", NAVI_PMAX);
+                    $startno = $objNavi->start_row;
+                    $this->arrPagenavi = $objNavi->arrPagenavi;
+                }
+            }
+        }
+
+        $this->arrCatList = $objDb->sfGetCategoryList();
+
+        //---- ページ表示
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    //----　取得文字列の変換
+    function lfConvertParam() {
+        /*
+         *  文字列の変換
+         *  K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
+         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
+         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
+         *  n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
+         *  a :  全角英数字を半角英数字に変換する
+         */
+        // カラム名とコンバート情報
+        $arrConvList['customer_id'] = "n" ;
+        $arrConvList['name'] = "aKV" ;
+        $arrConvList['pref'] = "n" ;
+        $arrConvList['kana'] = "CKV" ;
+        $arrConvList['b_start_year'] = "n" ;
+        $arrConvList['b_start_month'] = "n" ;
+        $arrConvList['b_start_day'] = "n" ;
+        $arrConvList['b_end_year'] = "n" ;
+        $arrConvList['b_end_month'] = "n" ;
+        $arrConvList['b_end_day'] = "n" ;
+        $arrConvList['tel'] = "n" ;
+        $arrConvList['birth_month'] = "n" ;
+        $arrConvList['email'] = "a" ;
+        $arrConvList['buy_total_from'] = "n" ;
+        $arrConvList['buy_total_to'] = "n" ;
+        $arrConvList['buy_times_from'] = "n" ;
+        $arrConvList['buy_times_to'] = "n" ;
+        $arrConvList['start_year'] = "n" ;
+        $arrConvList['start_month'] = "n" ;
+        $arrConvList['start_day'] = "n" ;
+        $arrConvList['end_year'] = "n" ;
+        $arrConvList['end_month'] = "n" ;
+        $arrConvList['end_day'] = "n" ;
+        $arrConvList['page_rows'] = "n" ;
+        $arrConvList['buy_start_year'] = "n" ;      //　最終購入日 START 年
+        $arrConvList['buy_start_month'] = "n" ;     //　最終購入日 START 月
+        $arrConvList['buy_start_day'] = "n" ;       //　最終購入日 START 日
+        $arrConvList['buy_end_year'] = "n" ;            //　最終購入日 END 年
+        $arrConvList['buy_end_month'] = "n" ;       //　最終購入日 END 月
+        $arrConvList['buy_end_day'] = "n" ;         //　最終購入日 END 日
+        $arrConvList['buy_product_name'] = "aKV" ;  //　購入商品名
+        $arrConvList['buy_product_code'] = "aKV" ;  //　購入商品コード
+        $arrConvList['category_id'] = "" ;          //　カテゴリ
+
+        // 文字変換
+        foreach ($arrConvList as $key => $val) {
+            // POSTされてきた値のみ変換する。
+            if(isset($this->arrForm[$key])) {
+                $this->arrForm[$key] = mb_convert_kana($this->arrForm[$key] ,$val);
+            }
+        }
+    }
+
+    //---- 入力エラーチェック
+    function lfCheckError($array) {
+
+        $objErr = new SC_CheckError($array);
+
+        $objErr->doFunc(array("顧客コード", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("都道府県", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("顧客名", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("顧客名(カナ)", "kana", STEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANABLANK_CHECK"));
+        $objErr->doFunc(array("誕生日(開始日)", "b_start_year", "b_start_month", "b_start_day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("誕生日(終了日)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("誕生日(開始日)","誕生日(終了日)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM"));
+        $objErr->doFunc(array("誕生月", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array('メールアドレス', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array('携帯メールアドレス', "email_mobile", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("電話番号", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("購入金額(開始)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("購入金額(終了)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && ($array["buy_total_from"] > $array["buy_total_to"]) ) $objErr->arrErr["buy_total_from"] .= "※ 購入金額の指定範囲が不正です。";
+        $objErr->doFunc(array("購入回数(開始)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("購入回数(終了)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        if ( (is_numeric($array["buy_times_from"]) && is_numeric($array["buy_times_to"]) ) && ($array["buy_times_from"] > $array["buy_times_to"]) ) $objErr->arrErr["buy_times_from"] .= "※ 購入回数の指定範囲が不正です。";
+        $objErr->doFunc(array("登録・更新日(開始日)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
+        $objErr->doFunc(array("登録・更新日(終了日)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("登録・更新日(開始日)","登録・更新日(終了日)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
+        $objErr->doFunc(array("表示件数", "page_rows", 3), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("最終購入日(開始日)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));   //最終購入日(開始日)
+        $objErr->doFunc(array("最終購入(終了日)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));            //最終購入日(終了日)
+        //購入金額(from) ＞ 購入金額(to) の場合はエラーとする
+        $objErr->doFunc(array("最終購入日(開始日)","登録・更新日(終了日)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM"));
+        $objErr->doFunc(array("購入商品コード", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));                     //購入商品コード
+        $objErr->doFunc(array("購入商品名", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));                         //購入商品名称
+
+        return $objErr->arrErr;
+    }
+
+    function lfSetWhere($arrForm){
+        foreach ($arrForm as $key => $val) {
+
+            $val = sfManualEscape($val);
+
+            if($val == "") continue;
+
+            switch ($key) {
+            case 'product_id':
+                $where .= " AND product_id = ?";
+                $arrval[] = $val;
+                break;
+            case 'product_class_id':
+                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
+                $arrval[] = $val;
+                break;
+            case 'name':
+                $where .= " AND name ILIKE ?";
+                $arrval[] = "%$val%";
+                break;
+            case 'category_id':
+                list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
+                if($tmp_where != "") {
+                    $where.= " AND $tmp_where";
+                    $arrval = array_merge($arrval, $tmp_arrval);
+                }
+                break;
+            case 'product_code':
+                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+                $arrval[] = "%$val%";
+                break;
+            case 'startyear':
+                $date = sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
+                $where.= " AND update_date >= ?";
+                $arrval[] = $date;
+                break;
+            case 'endyear':
+                $date = sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
+                $where.= " AND update_date <= ?";
+                $arrval[] = $date;
+                break;
+            case 'product_flag':
+                global $arrSTATUS;
+                $product_flag = sfSearchCheckBoxes($val);
+                if($product_flag != "") {
+                    $where.= " AND product_flag LIKE ?";
+                    $arrval[] = $product_flag;
+                }
+                break;
+            case 'status':
+                $tmp_where = "";
+                foreach ($val as $element){
+                    if ($element != ""){
+                        if ($tmp_where == ""){
+                            $tmp_where.="AND (status LIKE ? ";
+                        }else{
+                            $tmp_where.="OR status LIKE ? ";
+                        }
+                        $arrval[]=$element;
+                    }
+                }
+                if ($tmp_where != ""){
+                    $tmp_where.=")";
+                    $where.= "$tmp_where";
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    //---- CSV出力用データ取得
+    function lfGetCSVData( $array, $arrayIndex){
+
+        for ($i=0; $i<count($array); $i++){
+
+            for ($j=0; $j<count($array[$i]); $j++ ){
+                if ( $j > 0 ) $return .= ",";
+                $return .= "\"";
+                if ( $arrayIndex ){
+                    $return .= mb_ereg_replace("<","＜",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";
+                } else {
+                    $return .= mb_ereg_replace("<","＜",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+                }
+            }
+            $return .= "\n";
+        }
+
+        return $return;
+    }
+}
+?>
Index: /branches/feature-module-update/data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php
===================================================================
--- /branches/feature-module-update/data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php	(revision 15568)
+++ /branches/feature-module-update/data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php	(revision 15568)
@@ -0,0 +1,372 @@
+<?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_Admin_Customer_Edit extends LC_Page {
+
+    // {{{ properties
+    // TODO
+    var $arrSession;
+	var $tpl_mode;
+	var $list_data;
+
+	var $arrErr;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDay;
+	var $arrPref;
+	var $arrJob;
+	var $arrSex;
+	var $arrReminder;
+	var $count;
+
+	var $tpl_strnavi;
+
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'customer/edit.tpl';
+		$this->tpl_mainno = 'customer';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = DATA_PATH . 'Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '顧客マスタ';
+
+        $masterData = new SC_DB_MasterData_Ex();
+		$this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+		$this->arrJob = $masterData->getMasterData("mtb_job");
+		$this->arrSex = $masterData->getMasterData("mtb_sex");
+		$this->arrReminder = $masterData->getMasterData("mtb_reminder");
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+
+        // 認証可否の判定
+        $objSess = new SC_Session();
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        $this->objQuery = new SC_Query();
+        $this->objConn = new SC_DBConn();
+        $objView = new SC_AdminView();
+        $objDb = new SC_Helper_DB_Ex();
+        $objDate = new SC_Date(1901);
+        $this->arrYear = $objDate->getYear();	//　日付プルダウン設定
+        $this->arrMonth = $objDate->getMonth();
+        $this->arrDay = $objDate->getDay();
+
+        //---- 登録用カラム配列
+        $arrRegistColumn = array(
+                                 array(  "column" => "name01",		"convert" => "aKV" ),
+                                 array(  "column" => "name02",		"convert" => "aKV" ),
+                                 array(  "column" => "kana01",		"convert" => "CKV" ),
+                                 array(  "column" => "kana02",		"convert" => "CKV" ),
+                                 array(  "column" => "zip01",		"convert" => "n" ),
+                                 array(  "column" => "zip02",		"convert" => "n" ),
+                                 array(  "column" => "pref",		"convert" => "n" ),
+                                 array(  "column" => "addr01",		"convert" => "aKV" ),
+                                 array(  "column" => "addr02",		"convert" => "aKV" ),
+                                 array(  "column" => "email",		"convert" => "a" ),
+                                 array(  "column" => "email_mobile",	"convert" => "a" ),
+                                 array(  "column" => "tel01",		"convert" => "n" ),
+                                 array(  "column" => "tel02",		"convert" => "n" ),
+                                 array(  "column" => "tel03",		"convert" => "n" ),
+                                 array(  "column" => "fax01",		"convert" => "n" ),
+                                 array(  "column" => "fax02",		"convert" => "n" ),
+                                 array(  "column" => "fax03",		"convert" => "n" ),
+                                 array(  "column" => "sex",			"convert" => "n" ),
+                                 array(  "column" => "job",			"convert" => "n" ),
+                                 array(  "column" => "birth",		"convert" => "n" ),
+                                 array(  "column" => "password",	"convert" => "a" ),
+                                 array(  "column" => "reminder",	"convert" => "n" ),
+                                 array(  "column" => "reminder_answer", "convert" => "aKV" ),
+                                 array(  "column" => "mailmaga_flg", "convert" => "n" ),
+                                 array(  "column" => "note",		"convert" => "aKV" ),
+                                 array(  "column" => "point",		"convert" => "n" ),
+                                 array(  "column" => "status",		"convert" => "n" )
+                                 );
+
+        //---- 登録除外用カラム配列
+        $arrRejectRegistColumn = array("year", "month", "day");
+
+        // 検索条件を保持
+        if ($_POST['mode'] == "edit_search") {
+            $arrSearch = $_POST;
+        }else{
+            $arrSearch = $_POST['search_data'];
+        }
+        if(is_array($arrSearch)){
+            foreach($arrSearch as $key => $val){
+                $arrSearchData[$key] = $val;
+            }
+        }
+
+        $this->arrSearchData= $arrSearchData;
+
+        //----　顧客編集情報取得
+        if (($_POST["mode"] == "edit" || $_POST["mode"] == "edit_search") && is_numeric($_POST["edit_customer_id"])) {
+
+            //--　顧客データ取得
+            $sql = "SELECT * FROM dtb_customer WHERE del_flg = 0 AND customer_id = ?";
+            $result = $this->objConn->getAll($sql, array($_POST["edit_customer_id"]));
+            $this->list_data = $result[0];
+
+            $birth = split(" ", $this->list_data["birth"]);
+            $birth = split("-",$birth[0]);
+
+            $this->list_data["year"] = $birth[0];
+            $this->list_data["month"] = $birth[1];
+            $this->list_data["day"] = $birth[2];
+
+            $this->list_data["password"] = DEFAULT_PASSWORD;
+            //DB登録のメールアドレスを渡す
+            $this->tpl_edit_email = $result[0]['email'];
+            //購入履歴情報の取得
+            $this->arrPurchaseHistory = $this->lfPurchaseHistory($_POST['edit_customer_id']);
+            // 支払い方法の取得
+            $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+        }
+
+        //----　顧客情報編集
+        if ( $_POST["mode"] != "edit" && $_POST["mode"] != "edit_search" && is_numeric($_POST["customer_id"])) {
+
+            //-- POSTデータの引き継ぎ
+            $this->arrForm = $_POST;
+            $this->arrForm['email'] = strtolower($this->arrForm['email']);		// emailはすべて小文字で処理
+
+            //-- 入力データの変換
+            $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
+            //-- 入力チェック
+            $this->arrErr = $this->lfErrorCheck($this->arrForm);
+
+            //-- 入力エラー発生 or リターン時
+            if ($this->arrErr || $_POST["mode"] == "return") {
+                foreach($this->arrForm as $key => $val) {
+                    $this->list_data[ $key ] = $val;
+                }
+                //購入履歴情報の取得
+                $this->arrPurchaseHistory = $this->lfPurchaseHistory($_POST['customer_id']);
+                // 支払い方法の取得
+                $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+
+            } else {
+                //-- 確認
+                if ($_POST["mode"] == "confirm") {
+                    $this->tpl_mainpage = 'customer/edit_confirm.tpl';
+                    $passlen = strlen($this->arrForm['password']);
+                    $this->passlen = $this->lfPassLen($passlen);
+
+                }
+                //--　編集
+                if($_POST["mode"] == "complete") {
+                    $this->tpl_mainpage = 'customer/edit_complete.tpl';
+
+                    // 現在の会員情報を取得する
+                    $arrCusSts = $this->objQuery->getOne("SELECT status FROM dtb_customer WHERE customer_id = ?", array($_POST["customer_id"]));
+
+                    // 会員情報が変更されている場合にはシークレット№も更新する。
+                    if ($arrCusSts != $_POST['status']){
+                        $secret = SC_Utils_Ex::sfGetUniqRandomId("r");
+                        $this->arrForm['secret_key'] = $secret;
+                        array_push($arrRegistColumn, array('column' => 'secret_key', 'convert' => 'n'));
+                    }
+                    //-- 編集登録
+                    $objDb->sfEditCustomerData($this->arrForm, $arrRegistColumn);
+                }
+            }
+        }
+
+        //----　ページ表示
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+
+    // 編集登録
+    function lfRegisDatat($array, $arrRegistColumn) {
+
+        foreach ($arrRegistColumn as $data) {
+            if($array[$data["column"]] != "") {
+                $arrRegist[$data["column"]] = $array[$data["column"]];
+            } else {
+                $arrRegist[$data["column"]] = NULL;
+            }
+        }
+        if (strlen($array["year"]) > 0) {
+            $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+        }
+
+        //-- パスワードの更新がある場合は暗号化。（更新がない場合はUPDATE文を構成しない）
+        if ($array["password"] != DEFAULT_PASSWORD) {
+            $arrRegist["password"] = sha1($array["password"] . ":" . AUTH_MAGIC);
+        } else {
+            unset($arrRegist['password']);
+        }
+
+        $arrRegist["update_date"] = "Now()";
+
+        //-- 編集登録実行
+        $this->objConn->query("BEGIN");
+        $this->objQuery->Insert("dtb_customer", $arrRegist, "customer_id = '" .addslashes($array["customer_id"]). "'");
+
+        $this->objConn->query("COMMIT");
+    }
+
+
+    //----　取得文字列の変換
+    function lfConvertParam($array, $arrRegistColumn) {
+        /*
+         *	文字列の変換
+         *	K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
+         *	C :  「全角ひら仮名」を「全角かた仮名」に変換
+         *	V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
+         *	n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
+         *  a :  全角英数字を半角英数字に変換する
+         */
+        // カラム名とコンバート情報
+        foreach ($arrRegistColumn as $data) {
+            $arrConvList[ $data["column"] ] = $data["convert"];
+        }
+        // 文字変換
+        foreach ($arrConvList as $key => $val) {
+            // POSTされてきた値のみ変換する。
+            if(strlen(($array[$key])) > 0) {
+                $array[$key] = mb_convert_kana($array[$key] ,$val);
+            }
+        }
+        return $array;
+    }
+
+    //---- 入力エラーチェック
+    function lfErrorCheck($array) {
+
+        $objErr = new SC_CheckError($array);
+
+        $objErr->doFunc(array("会員状態", 'status'), array("EXIST_CHECK"));
+        $objErr->doFunc(array("お名前（姓）", 'name01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("お名前（名）", 'name02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("フリガナ（姓）", 'kana01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+        $objErr->doFunc(array("フリガナ（名）", 'kana02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+        $objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+        $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+        $objErr->doFunc(array("ご住所（1）", "addr01", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("ご住所（2）", "addr02", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN) ,array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+
+        //現会員の判定 →　現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
+        if (strlen($array["email"]) > 0) {
+            $sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? escape '#' AND (status = 1 OR status = 2) AND del_flg = 0 AND customer_id <> ?";
+            $checkMail = ereg_replace( "_", "#_", $array["email"]);
+            $result = $this->objConn->getAll($sql, array($checkMail, $array["customer_id"]));
+            if (count($result) > 0) {
+                $objErr->arrErr["email"] .= "※ すでに登録されているメールアドレスです。";
+            }
+        }
+
+        $objErr->doFunc(array('メールアドレス(モバイル)', "email_mobile", MTEXT_LEN) ,array("EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+        //現会員の判定 →　現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
+        if (strlen($array["email_mobile"]) > 0) {
+            $sql = "SELECT customer_id FROM dtb_customer WHERE email_mobile ILIKE ? escape '#' AND (status = 1 OR status = 2) AND del_flg = 0 AND customer_id <> ?";
+            $checkMail = ereg_replace( "_", "#_", $array["email_mobile"]);
+            $result = $this->objConn->getAll($sql, array($checkMail, $array["customer_id"]));
+            if (count($result) > 0) {
+                $objErr->arrErr["email_mobile"] .= "※ すでに登録されているメールアドレス(モバイル)です。";
+            }
+        }
+
+
+        $objErr->doFunc(array("お電話番号1", 'tel01'), array("EXIST_CHECK"));
+        $objErr->doFunc(array("お電話番号2", 'tel02'), array("EXIST_CHECK"));
+        $objErr->doFunc(array("お電話番号3", 'tel03'), array("EXIST_CHECK"));
+        $objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+        $objErr->doFunc(array("FAX番号", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
+        $objErr->doFunc(array("ご性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
+        $objErr->doFunc(array("ご職業", "job") ,array("NUM_CHECK"));
+        if ($array["password"] != DEFAULT_PASSWORD) {
+            $objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+        }
+        $objErr->doFunc(array("パスワードを忘れたときのヒント 質問", "reminder") ,array("SELECT_CHECK", "NUM_CHECK"));
+        $objErr->doFunc(array("パスワードを忘れたときのヒント 答え", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("メールマガジン", "mailmaga_flg") ,array("SELECT_CHECK", "NUM_CHECK"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("SHOP用メモ", 'note', LTEXT_LEN), array("MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("所持ポイント", "point", TEL_LEN) ,array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        return $objErr->arrErr;
+
+    }
+
+    //購入履歴情報の取得
+    function lfPurchaseHistory($customer_id){
+		$this->tpl_pageno = $_POST['search_pageno'];
+		$this->edit_customer_id = $customer_id;
+
+		// ページ送りの処理
+		$page_max = SEARCH_PMAX;
+		//購入履歴の件数取得
+		$this->tpl_linemax = $this->objQuery->count("dtb_order","customer_id=? AND del_flg = 0 ", array($customer_id));
+		$linemax = $this->tpl_linemax;
+
+		// ページ送りの取得
+		$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage2", NAVI_PMAX);
+		$this->arrPagenavi = $objNavi->arrPagenavi;
+		$this->arrPagenavi['mode'] = 'edit';
+		$startno = $objNavi->start_row;
+
+		// 取得範囲の指定(開始行番号、行数のセット)
+		$this->objQuery->setlimitoffset($page_max, $startno);
+		// 表示順序
+		$order = "order_id DESC";
+		$this->objQuery->setorder($order);
+		//購入履歴情報の取得
+		$arrPurchaseHistory = $this->objQuery->select("*", "dtb_order", "customer_id=? AND del_flg = 0 ", array($customer_id));
+
+		return $arrPurchaseHistory;
+    }
+
+    //確認ページ用パスワード表示用
+    function lfPassLen($passlen){
+        $ret = "";
+        for ($i=0;$i<$passlen;true){
+            $ret.="*";
+            $i++;
+        }
+        return $ret;
+    }
+}
+?>
