Source for file LC_Page_Admin_Customer_Edit.php
Documentation is available at LC_Page_Admin_Customer_Edit.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH .
"pages/LC_Page.php");
* @author LOCKON CO.,LTD.
$this->tpl_subnavi =
'customer/subnavi.tpl';
$this->tpl_subno =
'index';
$this->tpl_pager =
TEMPLATE_DIR .
'admin/pager.tpl';
$this->tpl_subtitle =
'顧客マスタ';
$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");
$this->objConn =
new SC_DBConn();
$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['search_data'];
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"] = isset
($birth[1]) ?
$birth[1] :
"";
$this->list_data["day"] = isset
($birth[2]) ?
$birth[2] :
"";
$this->list_data["password"] =
DEFAULT_PASSWORD;
$this->tpl_edit_email =
$result[0]['email'];
$this->arrPayment =
$objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
if ( $_POST["mode"] !=
"edit" &&
$_POST["mode"] !=
"edit_search" &&
is_numeric($_POST["customer_id"])) {
$this->arrForm['email'] =
strtolower($this->arrForm['email']); // emailはすべて小文字で処理
$this->arrForm =
$this->lfConvertParam($this->arrForm, $arrRegistColumn);
if ($this->arrErr ||
$_POST["mode"] ==
"return") {
foreach($this->arrForm as $key =>
$val) {
$this->list_data[ $key ] =
$val;
$this->arrPayment =
$objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
if ($_POST["mode"] ==
"confirm") {
$passlen =
strlen($this->arrForm['password']);
if($_POST["mode"] ==
"complete") {
$arrCusSts =
$this->objQuery->getOne("SELECT status FROM dtb_customer WHERE customer_id = ?", array($_POST["customer_id"]));
// 会員情報が変更されている場合にはシークレット№も更新する。
if ($arrCusSts !=
$_POST['status']){
$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);
foreach ($arrRegistColumn as $data) {
if($array[$data["column"]] !=
"") {
$arrRegist[$data["column"]] =
$array[$data["column"]];
$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);
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");
* K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換
* C : 「全角ひら仮名」を「全角かた仮名」に変換
* V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します
* n : 「全角」数字を「半角(ハンカク)」に変換
foreach ($arrRegistColumn as $data) {
$arrConvList[ $data["column"] ] =
$data["convert"];
foreach ($arrConvList as $key =>
$val) {
if(strlen(($array[$key])) >
0) {
$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 <> ?";
$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) {
$array['email_mobile'] =
strtolower($array['email_mobile']);
$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"));
$this->tpl_pageno =
$_POST['search_pageno'];
$this->edit_customer_id =
$customer_id;
$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;
for ($i=
0;$i<
$passlen;true){
Documentation generated on Tue, 28 Apr 2009 18:11:02 +0900 by phpDocumentor 1.4.2