Source for file LC_Page_Admin_Customer.php
Documentation is available at LC_Page_Admin_Customer.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->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];
 
-         $this->arrStatus[1] - =  "仮会員";
 
-         $this->arrStatus[2] - =  "本会員";
 
-         $this->arrColumnCSV - =  array(0- =>  array("sql"- =>  "customer_id",
 
-                                     1  - =>  array("sql"- =>  "name01",
 
-                                     2  - =>  array("sql"- =>  "name02",
 
-                                     3  - =>  array("sql"- =>  "kana01",
 
-                                     4  - =>  array("sql"- =>  "kana02",
 
-                                     5  - =>  array("sql"- =>  "zip01",
 
-                                     6  - =>  array("sql"- =>  "zip02",
 
-                                     7  - =>  array("sql"- =>  "pref",
 
-                                     8  - =>  array("sql"- =>  "addr01",
 
-                                     9  - =>  array("sql"- =>  "addr02",
 
-                                     10 - =>  array("sql"- =>  "email",
 
-                                     11 - =>  array("sql"- =>  "tel01",
 
-                                     12 - =>  array("sql"- =>  "tel02",
 
-                                     13 - =>  array("sql"- =>  "tel03",
 
-                                     14 - =>  array("sql"- =>  "fax01",
 
-                                     15 - =>  array("sql"- =>  "fax02",
 
-                                     16 - =>  array("sql"- =>  "fax03",
 
-                                     17 - =>  array("sql"- =>  "CASE WHEN sex = 1 "
 
-                                                 .  " ELSE '女性' END AS sex",
-                                     18 - =>  array("sql"- =>  "job",
 
-                                     19 - =>  array("sql"- =>  "cast(birth as date) AS birth",
 
-                                     20 - =>  array("sql"- =>  "cast(first_buy_date as date) AS first_buy_date",
 
-                                                 "csv" - =>  "first_buy_date",
 
-                                     21 - =>  array("sql"- =>  "cast(last_buy_date as date) AS last_buy_date",
 
-                                                 "csv" - =>  "last_buy_date",
 
-                                     22 - =>  array("sql"- =>  "buy_times",
 
-                                     23 - =>  array("sql"- =>  "point",
 
-                                     24 - =>  array("sql"- =>  "note",
 
-                                     25 - =>  array("sql"- =>  "cast(create_date as date) AS create_date",
 
-                                     26 - =>  array("sql"- =>  "cast(update_date as date) AS update_date",
 
-         $this->arrYear - =  $objDate->getYear();   // 日付プルダウン設定
 
-         $this->arrMonth - =  $objDate->getMonth();
 
-         $this->arrDay - =  $objDate->getDay();
 
-         $this->objDate - =  $objDate;
 
-         $this->arrHidden['search_pageno'] - = 
 
-                 isset ($_POST['search_pageno'])- ?  $_POST['search_pageno']- :  "";
-         foreach ($_POST as $key - =>  $val) {
 
-                 $this->arrHidden[$key] - =  SC_Utils_Ex::sfMergeParamCheckBoxes($val);
 
-                     $this->arrForm[$key] - =  split("-", $val);
 
-                 $this->arrHidden[$key] - =  $val;
 
-         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 = " - .  SC_Utils_Ex::sfQuoteSmart($_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'] - ==  "resend_mail") {
 
-             $CONF - =  $objDb->sf_getBasisData();
 
-             $objMailText->assignobj($this); 
-             $arrRet - =  $objQuery->select("name01, name02, secret_key, email", "dtb_customer","customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
 
-             $this->name01 - =  $arrRet[0]['name01'];
 
-             $this->name02 - =  $arrRet[0]['name02'];
 
-             $this->uniqid - =  $arrRet[0]['secret_key'];
 
-             $subject - =  $mailHelper->sfMakesubject('会員登録のご確認');
 
-             $toCustomerMail - =  $objMailText->fetch("mail_templates/customer_mail.tpl");
 
-                                 , $CONF["email03"]          // 配送元アドレス 
-                                 , $CONF["shop_name"]        // 配送元 名前 
-                                 , $CONF["email03"]          // reply_to 
-                                 , $CONF["email04"]          // return_path 
-                                 , $CONF["email04"]          //  Errors_to 
-             $name - =  $this->name01- .  $this->name02- . " 様";
 
-             $objMail->setTo($arrRet[0]["email"], $name); 
-         if ($_POST['mode'] - ==  "search"- ||  $_POST['mode']- ==  "csv"- ||  $_POST['mode']- ==  "delete"- ||  $_POST['mode']- ==  "delete_all"- ||  $_POST['mode']- ==  "resend_mail") {
 
-             if (count($this->arrErr) - ==  0) {
 
-                 $page_rows - =  $this->arrForm['page_rows'];
 
-                 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($this->arrColumnCSV);
 
-                     $searchSql - =  $objSelect->getList();
 
-                 $this->search_data - =  $objQuery->conn->getAll($searchSql, $objSelect->arrVal);
 
-                     require_once(CLASS_EX_PATH - .  "helper_extends/SC_Helper_CSV_Ex.php");
 
-                     $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"];
 
-                     for($i - =  0; $i- <  count($this->search_data); $i- ++ ) {
 
-                         $this->search_data[$i]["pref"] - =  $this->arrPref[ $this->search_data[$i]["pref"] ];
 
-                         $this->search_data[$i]["job"]  - =  $this->arrJob[ $this->search_data[$i]["job"] ];
 
-                     $data - =  SC_Utils_Ex::getCSVData($this->search_data, $arrColumn);
 
-                     $where - =  "product_id IN (SELECT product_id FROM vw_products_nonclass AS noncls WHERE $where)";
 
-                     $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 = " - .  SC_Utils_Ex::sfQuoteSmart($_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"])); 
-                     $linemax - =  $objQuery->conn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
 
-                     $this->tpl_linemax - =  $linemax;              // 何件が該当しました。表示用
 
-                     $objNavi - =  new SC_PageNavi($this->arrHidden['search_pageno'],
 
-                                                "fnCustomerPage", NAVI_PMAX); 
-                     $startno - =  $objNavi->start_row;
 
-                     $this->arrPagenavi - =  $objNavi->arrPagenavi;
 
-         $this->arrCatList - =  $objDb->sfGetCategoryList();
 
-         $objView->assignobj($this); 
-         $objView->display(MAIN_FRAME); 
-          *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換 
-          *  C :  「全角ひら仮名」を「全角かた仮名」に変換 
-          *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します 
-          *  n :  「全角」数字を「半角(ハンカク)」に変換 
-         $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) {
 
-             if(- isset ($this->arrForm[$key])) {
 
-         $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"));                         //購入商品名称 
-         foreach ($arrForm as $key - =>  $val) {
 
-             $val - =  sfManualEscape($val);
 
-                 $where - .=  " AND product_id = ?";
 
-                 $where - .=  " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
 
-                 $where - .=  " AND name ILIKE ?";
 
-                 list ($tmp_where, $tmp_arrval)- =  sfGetCatWhere($val);
-                     $where- .=  " AND $tmp_where";
 
-                 $where - .=  " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
 
-                 $date - =  sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
 
-                 $where- .=  " AND update_date >= ?";
 
-                 $date - =  sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
 
-                 $where- .=  " AND update_date <= ?";
 
-                 $product_flag - =  sfSearchCheckBoxes($val);
 
-                 if($product_flag - !=  "") {
 
-                     $where- .=  " AND product_flag LIKE ?";
 
-                     $arrval[] - =  $product_flag;
 
-                 foreach ($val as $element){ 
-                             $tmp_where- .= "AND (status LIKE ? ";
 
-                             $tmp_where- .= "OR status LIKE ? ";
 
 
	
		Documentation generated on Tue, 28 Apr 2009 18:11:01 +0900 by phpDocumentor 1.4.2