[15568] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[18701] | 5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
---|
[15568] | 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
[15568] | 22 | */ |
---|
| 23 | |
---|
| 24 | // {{{ requires |
---|
[20345] | 25 | require_once(CLASS_EX_REALDIR . "page_extends/admin/LC_Page_Admin_Ex.php"); |
---|
[15568] | 26 | |
---|
| 27 | /** |
---|
| 28 | * 顧客管理 のページクラス. |
---|
| 29 | * |
---|
| 30 | * @package Page |
---|
| 31 | * @author LOCKON CO.,LTD. |
---|
| 32 | * @version $Id$ |
---|
| 33 | */ |
---|
[20345] | 34 | class LC_Page_Admin_Customer extends LC_Page_Admin_Ex { |
---|
[15568] | 35 | |
---|
| 36 | // }}} |
---|
| 37 | // {{{ functions |
---|
| 38 | |
---|
| 39 | /** |
---|
| 40 | * Page を初期化する. |
---|
| 41 | * |
---|
| 42 | * @return void |
---|
| 43 | */ |
---|
| 44 | function init() { |
---|
| 45 | parent::init(); |
---|
| 46 | $this->tpl_mainpage = 'customer/index.tpl'; |
---|
| 47 | $this->tpl_mainno = 'customer'; |
---|
| 48 | $this->tpl_subnavi = 'customer/subnavi.tpl'; |
---|
| 49 | $this->tpl_subno = 'index'; |
---|
[20128] | 50 | $this->tpl_pager = 'pager.tpl'; |
---|
[15568] | 51 | $this->tpl_subtitle = '顧客マスタ'; |
---|
| 52 | |
---|
| 53 | $masterData = new SC_DB_MasterData_Ex(); |
---|
[19773] | 54 | $this->arrPref = $masterData->getMasterData('mtb_pref'); |
---|
[15568] | 55 | $this->arrJob = $masterData->getMasterData("mtb_job"); |
---|
| 56 | $this->arrJob["不明"] = "不明"; |
---|
| 57 | $this->arrSex = $masterData->getMasterData("mtb_sex"); |
---|
[20411] | 58 | $this->arrPageRows = $masterData->getMasterData("mtb_page_max"); |
---|
[20160] | 59 | $this->arrStatus = $masterData->getMasterData("mtb_customer_status"); |
---|
[20232] | 60 | $this->arrMagazineType = $masterData->getMasterData("mtb_magazine_type"); |
---|
[15568] | 61 | |
---|
[20160] | 62 | // 日付プルダウン設定 |
---|
| 63 | $objDate = new SC_Date(BIRTH_YEAR); |
---|
| 64 | $this->arrYear = $objDate->getYear(); |
---|
| 65 | $this->arrMonth = $objDate->getMonth(); |
---|
| 66 | $this->arrDay = $objDate->getDay(); |
---|
| 67 | $this->objDate = $objDate; |
---|
[17369] | 68 | |
---|
[20160] | 69 | // カテゴリ一覧設定 |
---|
| 70 | $objDb = new SC_Helper_DB_Ex(); |
---|
| 71 | $this->arrCatList = $objDb->sfGetCategoryList(); |
---|
| 72 | |
---|
[18187] | 73 | $this->httpCacheControl('nocache'); |
---|
[15568] | 74 | } |
---|
| 75 | |
---|
| 76 | /** |
---|
| 77 | * Page のプロセス. |
---|
| 78 | * |
---|
| 79 | * @return void |
---|
| 80 | */ |
---|
| 81 | function process() { |
---|
[19661] | 82 | $this->action(); |
---|
| 83 | $this->sendResponse(); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | /** |
---|
| 87 | * Page のアクション. |
---|
| 88 | * |
---|
| 89 | * @return void |
---|
| 90 | */ |
---|
| 91 | function action() { |
---|
[20160] | 92 | // パラメータ管理クラス |
---|
| 93 | $objFormParam = new SC_FormParam(); |
---|
| 94 | // パラメータ設定 |
---|
| 95 | $this->lfInitParam($objFormParam); |
---|
| 96 | $objFormParam->setParam($_POST); |
---|
| 97 | $objFormParam->convParam(); |
---|
| 98 | // パラメーター読み込み |
---|
[20285] | 99 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
[15568] | 100 | // 検索ワードの引き継ぎ |
---|
[20285] | 101 | $this->arrHidden = $objFormParam->getSearchArray(); |
---|
| 102 | |
---|
[20160] | 103 | // 入力パラメーターチェック |
---|
| 104 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
| 105 | if(!SC_Utils_Ex::isBlank($this->arrErr)) { |
---|
| 106 | return; |
---|
[15568] | 107 | } |
---|
[20160] | 108 | |
---|
| 109 | // モードによる処理切り替え |
---|
[20044] | 110 | switch ($this->getMode()) { |
---|
| 111 | case 'delete': |
---|
[20160] | 112 | $this->is_delete = $this->lfDoDeleteCustomer($objFormParam->getValue('edit_customer_id')); |
---|
[20285] | 113 | list($this->tpl_linemax, $this->arrData, $this->objNavi) = $this->lfDoSearch($objFormParam->getHashArray()); |
---|
[20160] | 114 | $this->arrPagenavi = $this->objNavi->arrPagenavi; |
---|
[20044] | 115 | break; |
---|
| 116 | case 'resend_mail': |
---|
[20160] | 117 | $this->is_resendmail = $this->lfDoResendMail($objFormParam->getValue('edit_customer_id')); |
---|
[20285] | 118 | list($this->tpl_linemax, $this->arrData, $this->objNavi) = $this->lfDoSearch($objFormParam->getHashArray()); |
---|
[20160] | 119 | $this->arrPagenavi = $this->objNavi->arrPagenavi; |
---|
[20044] | 120 | break; |
---|
[20160] | 121 | case 'search': |
---|
[20285] | 122 | list($this->tpl_linemax, $this->arrData, $this->objNavi) = $this->lfDoSearch($objFormParam->getHashArray()); |
---|
[20160] | 123 | $this->arrPagenavi = $this->objNavi->arrPagenavi; |
---|
[20044] | 124 | break; |
---|
| 125 | case 'csv': |
---|
[20285] | 126 | $this->lfDoCSV($objFormParam->getHashArray()); |
---|
[20160] | 127 | exit; |
---|
[20044] | 128 | break; |
---|
| 129 | default: |
---|
| 130 | break; |
---|
[15568] | 131 | } |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | /** |
---|
| 135 | * デストラクタ. |
---|
| 136 | * |
---|
| 137 | * @return void |
---|
| 138 | */ |
---|
| 139 | function destroy() { |
---|
| 140 | parent::destroy(); |
---|
| 141 | } |
---|
| 142 | |
---|
[20160] | 143 | /** |
---|
| 144 | * パラメーター情報の初期化 |
---|
| 145 | * |
---|
| 146 | * @param array $objFormParam フォームパラメータークラス |
---|
| 147 | * @return void |
---|
| 148 | */ |
---|
| 149 | function lfInitParam(&$objFormParam) { |
---|
[20232] | 150 | SC_Helper_Customer_Ex::sfSetSearchParam($objFormParam); |
---|
[20285] | 151 | $objFormParam->addParam('編集対象顧客ID', 'edit_customer_id', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); |
---|
[15568] | 152 | } |
---|
| 153 | |
---|
[20160] | 154 | /** |
---|
| 155 | * エラーチェック |
---|
| 156 | * |
---|
| 157 | * @param array $objFormParam フォームパラメータークラス |
---|
| 158 | * @return array エラー配列 |
---|
| 159 | */ |
---|
| 160 | function lfCheckError(&$objFormParam) { |
---|
[20232] | 161 | return SC_Helper_Customer_Ex::sfCheckErrorSearchParam($objFormParam); |
---|
[15568] | 162 | } |
---|
[20160] | 163 | |
---|
| 164 | /** |
---|
| 165 | * 顧客を削除する処理 |
---|
| 166 | * |
---|
| 167 | * @param integer $customer_id 顧客ID |
---|
| 168 | * @return boolean true:成功 false:失敗 |
---|
| 169 | */ |
---|
| 170 | function lfDoDeleteCustomer($customer_id) { |
---|
| 171 | $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id, "del_flg = 0"); |
---|
| 172 | if(SC_Utils_Ex::isBlank($arrData)) { |
---|
| 173 | //対象となるデータが見つからない。 |
---|
| 174 | return false; |
---|
| 175 | } |
---|
| 176 | // XXXX: 仮会員は物理削除となっていたが論理削除に変更。 |
---|
| 177 | $arrVal["del_flg"] = "1"; |
---|
| 178 | $arrVal["update_date"] ="now()"; |
---|
| 179 | SC_Helper_Customer_Ex::sfEditCustomerData($arrVal, $customer_id); |
---|
| 180 | return true; |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | /** |
---|
| 184 | * 顧客に登録メールを再送する処理 |
---|
| 185 | * |
---|
| 186 | * @param integer $customer_id 顧客ID |
---|
| 187 | * @return boolean true:成功 false:失敗 |
---|
| 188 | */ |
---|
[20359] | 189 | function lfDoResendMail($customer_id) { |
---|
[20160] | 190 | $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id); |
---|
| 191 | if(SC_Utils_Ex::isBlank($arrData) or $arrData['del_flg'] == 1) { |
---|
| 192 | //対象となるデータが見つからない、または削除済み |
---|
| 193 | return false; |
---|
| 194 | } |
---|
| 195 | // 登録メール再送 |
---|
| 196 | $objHelperMail = new SC_Helper_Mail_Ex(); |
---|
| 197 | $objHelperMail->sfSendRegistMail($arrData['secret_key'], $customer_id); |
---|
| 198 | return true; |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | /** |
---|
| 202 | * 顧客一覧を検索する処理 |
---|
| 203 | * |
---|
| 204 | * @param array $arrParam 検索パラメーター連想配列 |
---|
| 205 | * @return array( integer 全体件数, mixed 顧客データ一覧配列, mixed SC_PageNaviオブジェクト) |
---|
| 206 | */ |
---|
| 207 | function lfDoSearch($arrParam) { |
---|
[20285] | 208 | return SC_Helper_Customer_Ex::sfGetSearchData($arrParam); |
---|
[20160] | 209 | } |
---|
| 210 | |
---|
| 211 | /** |
---|
| 212 | * 顧客一覧CSVを検索してダウンロードする処理 |
---|
| 213 | * |
---|
| 214 | * @param array $arrParam 検索パラメーター連想配列 |
---|
| 215 | * @return boolean true:成功 false:失敗 |
---|
| 216 | */ |
---|
| 217 | function lfDoCSV($arrParam) { |
---|
[20489] | 218 | $objSelect = new SC_CustomerList_Ex($arrParam, "customer"); |
---|
[20160] | 219 | $order = "update_date DESC, customer_id DESC"; |
---|
[20285] | 220 | |
---|
[20160] | 221 | require_once(CLASS_EX_REALDIR . "helper_extends/SC_Helper_CSV_Ex.php"); |
---|
| 222 | $objCSV = new SC_Helper_CSV_Ex(); |
---|
| 223 | list($where, $arrVal) = $objSelect->getWhere(); |
---|
[20285] | 224 | return $objCSV->sfDownloadCsv('2', $where, $arrVal, $order, true); |
---|
[20160] | 225 | } |
---|
[15568] | 226 | } |
---|
| 227 | ?> |
---|