source: branches/version-2_4/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php @ 17876

Revision 17876, 6.8 KB checked in by kajiwara, 15 years ago (diff)

#292 顧客検索機能の追加。編集画面にて発送日が表示されない不具合を修正。(管理画面>受注管理にて新規受注が登録できる対応)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to "Id Revision Date"
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    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    function process()
57    {
58        $objView = new SC_AdminView();
59        // POSTのモードがsearchなら顧客検索開始
60        if($_POST['mode'] == 'search'){
61            $this->objFormParam = new SC_FormParam();
62            // 値の初期化
63            $this->lfInitParam();
64            // POST値の取得
65            $this->objFormParam->setParam($_POST);
66            // 入力値の変換
67            $this->objFormParam->convParam();
68
69            // 入力された値を取得する
70            $arrForm = $this->objFormParam->getHashArray();
71
72            // エラーチェック
73            $this->arrErr = $this->lfCheckError();
74            if( is_array($this->arrErr) === true && 0 < count($this->arrErr) ){
75                $is_select = false;
76            }else{
77                $where = "del_flg = 0";
78
79                // 検索
80                foreach($arrForm as $tmp_key => $val){
81                    if( is_array($val) === false && 0 < strlen($val)){
82                        $key = strtr($tmp_key , array('search_' => ''));
83                        switch($key){
84                            case 'customer_id':
85                                $where .= " AND customer_id = ? ";
86                                $sqlval[$key] = $val;
87                                break;
88                            case 'name01':
89                                    $where .= " AND name01 ILIKE ? ";
90                                    $sqlval[$key] = '%'.$val.'%';
91                                break;
92                            case 'name02':
93                                    $where .= " AND name02 ILIKE ? ";
94                                    $sqlval[$key] = '%'.$val.'%';
95                                break;
96                            case 'kana01':
97                                    $where .= " AND kana01 ILIKE ? ";
98                                    $sqlval[$key] = '%'.$val.'%';
99                                break;
100                            case 'kana02':
101                                    $where .= " AND kana02 ILIKE ? ";
102                                    $sqlval[$key] = '%'.$val.'%';
103                                break;
104                            default :
105                                break;
106                        }
107                    }
108                }
109
110                $is_select = true;
111            }
112
113
114            if( $is_select === true ){
115                $objQuery = new SC_Query();
116
117                // 既に購入した事がある顧客を取得
118                $col = '*';
119                $from = 'dtb_customer';
120                $order = 'customer_id';
121                $arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
122
123                // 顧客情報を取得できたら、テンプレートに
124                if( is_array($arrCustomer) === true && count($arrCustomer) > 0){
125                    $customer_count = count($arrCustomer);
126                    if( $customer_count != 0 ){
127                        $this->tpl_linemax = $customer_count;
128                    }
129                } else {
130                    $this->tpl_linemax = null;
131                }
132
133                // ページ送りの処理
134                if(isset($_POST['search_page_max'])
135                   && is_numeric($_POST['search_page_max'])) {
136                    $page_max = $_POST['search_page_max'];
137                } else {
138                    $page_max = SEARCH_PMAX;
139                }
140
141                // ページ送りの取得
142                $objNavi = new SC_PageNavi($_POST['search_pageno'], $customer_count, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
143                $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
144                $startno = $objNavi->start_row;
145
146                // 取得範囲の指定(開始行番号、行数のセット)
147                $objQuery->setlimitoffset($page_max, $startno);
148                // 表示順序
149                $objQuery->setorder($order);
150                // 検索結果の取得
151                $this->arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
152            }
153
154        }
155        // 画面の表示
156        $this->arrForm = $arrForm;
157        $objView->assignobj($this);
158        $objView->display($this->tpl_mainpage);
159    }
160
161    /**
162     * デストラクタ.
163     *
164     * @return void
165     */
166    function destroy()
167    {
168        parent::destroy();
169    }
170
171    /* パラメータ情報の初期化 */
172    function lfInitParam() {
173        $this->objFormParam->addParam("顧客ID", "search_customer_id", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
174        $this->objFormParam->addParam("顧客名(姓)", "search_name01", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
175        $this->objFormParam->addParam("顧客名(名)", "search_name02", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
176        $this->objFormParam->addParam("顧客名(カナ)", 'search_kana01', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
177        $this->objFormParam->addParam("顧客名(カナ/名)", 'search_kana02', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
178    }
179
180    /* 入力内容のチェック */
181    function lfCheckError() {
182        // 入力データを渡す。
183        $arrRet =  $this->objFormParam->getHashArray();
184        $objErr = new SC_CheckError($arrRet);
185        $objErr->arrErr = $this->objFormParam->checkError();
186
187        return $objErr->arrErr;
188    }
189}
190?>
Note: See TracBrowser for help on using the repository browser.