source: branches/comu-ver2/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php @ 18234

Revision 18234, 6.9 KB checked in by Seasoft, 15 years ago (diff)

#528(改行コードが混在している)

  • SVN属性の変更。ただし、以下は除外。
    • /data/module
    • /data/pdf
    • /html/test
  • Property svn:eol-style set to LF
  • Property svn:keywords set to "Id Revision Date"
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
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.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/LC_Page.php");
26
27/**
28 * Admin_Customer_SearchCustomer のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Customer_SearchCustomer extends LC_Page
35{
36
37    // }}}
38    // {{{ functions
39
40    /**
41     * Page を初期化する.
42     *
43     * @return void
44     */
45    function init()
46    {
47        parent::init();
48        $this->tpl_mainpage = 'customer/search_customer.tpl';
49        $this->httpCacheControl('nocache');
50    }
51
52    /**
53     * Page のプロセス.
54     *
55     * @return void
56     */
57    function process()
58    {
59        $objView = new SC_AdminView();
60        // POSTのモードがsearchなら顧客検索開始
61        if($_POST['mode'] == 'search'){
62            $this->objFormParam = new SC_FormParam();
63            // 値の初期化
64            $this->lfInitParam();
65            // POST値の取得
66            $this->objFormParam->setParam($_POST);
67            // 入力値の変換
68            $this->objFormParam->convParam();
69
70            // 入力された値を取得する
71            $arrForm = $this->objFormParam->getHashArray();
72
73            // エラーチェック
74            $this->arrErr = $this->lfCheckError();
75            if( is_array($this->arrErr) === true && 0 < count($this->arrErr) ){
76                $is_select = false;
77            }else{
78                $where = "del_flg = 0";
79
80                // 検索
81                foreach($arrForm as $tmp_key => $val){
82                    if( is_array($val) === false && 0 < strlen($val)){
83                        $key = strtr($tmp_key , array('search_' => ''));
84                        switch($key){
85                            case 'customer_id':
86                                $where .= " AND customer_id = ? ";
87                                $sqlval[$key] = $val;
88                                break;
89                            case 'name01':
90                                    $where .= " AND name01 ILIKE ? ";
91                                    $sqlval[$key] = '%'.$val.'%';
92                                break;
93                            case 'name02':
94                                    $where .= " AND name02 ILIKE ? ";
95                                    $sqlval[$key] = '%'.$val.'%';
96                                break;
97                            case 'kana01':
98                                    $where .= " AND kana01 ILIKE ? ";
99                                    $sqlval[$key] = '%'.$val.'%';
100                                break;
101                            case 'kana02':
102                                    $where .= " AND kana02 ILIKE ? ";
103                                    $sqlval[$key] = '%'.$val.'%';
104                                break;
105                            default :
106                                break;
107                        }
108                    }
109                }
110
111                $is_select = true;
112            }
113
114
115            if( $is_select === true ){
116                $objQuery = new SC_Query();
117
118                // 既に購入した事がある顧客を取得
119                $col = '*';
120                $from = 'dtb_customer';
121                $order = 'customer_id';
122                $arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
123
124                // 顧客情報を取得できたら、テンプレートに
125                if( is_array($arrCustomer) === true && count($arrCustomer) > 0){
126                    $customer_count = count($arrCustomer);
127                    if( $customer_count != 0 ){
128                        $this->tpl_linemax = $customer_count;
129                    }
130                } else {
131                    $this->tpl_linemax = null;
132                }
133
134                // ページ送りの処理
135                if(isset($_POST['search_page_max'])
136                   && is_numeric($_POST['search_page_max'])) {
137                    $page_max = $_POST['search_page_max'];
138                } else {
139                    $page_max = SEARCH_PMAX;
140                }
141
142                // ページ送りの取得
143                $objNavi = new SC_PageNavi($_POST['search_pageno'], $customer_count, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
144                $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
145                $startno = $objNavi->start_row;
146
147                // 取得範囲の指定(開始行番号、行数のセット)
148                $objQuery->setlimitoffset($page_max, $startno);
149                // 表示順序
150                $objQuery->setorder($order);
151                // 検索結果の取得
152                $this->arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
153            }
154
155        }
156        // 画面の表示
157        $this->arrForm = $arrForm;
158        $objView->assignobj($this);
159        $objView->display($this->tpl_mainpage);
160    }
161
162    /**
163     * デストラクタ.
164     *
165     * @return void
166     */
167    function destroy()
168    {
169        parent::destroy();
170    }
171
172    /* パラメータ情報の初期化 */
173    function lfInitParam() {
174        $this->objFormParam->addParam("顧客ID", "search_customer_id", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
175        $this->objFormParam->addParam("顧客名(姓)", "search_name01", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
176        $this->objFormParam->addParam("顧客名(名)", "search_name02", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
177        $this->objFormParam->addParam("顧客名(カナ)", 'search_kana01', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
178        $this->objFormParam->addParam("顧客名(カナ/名)", 'search_kana02', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
179    }
180
181    /* 入力内容のチェック */
182    function lfCheckError() {
183        // 入力データを渡す。
184        $arrRet =  $this->objFormParam->getHashArray();
185        $objErr = new SC_CheckError($arrRet);
186        $objErr->arrErr = $this->objFormParam->checkError();
187
188        return $objErr->arrErr;
189    }
190}
191?>
Note: See TracBrowser for help on using the repository browser.