source: trunk/data/class/pages/admin/customer/LC_Page_Admin_Customer.php @ 18758

Revision 18758, 26.9 KB checked in by kajiwara, 14 years ago (diff)

EC-CUBE Ver2.4.4 分コミット。詳細はこちら( http://www.ec-cube.net/release/detail.php?release_id=223

  • 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-2010 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 * 顧客管理 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Customer extends LC_Page {
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';
50        $this->tpl_pager = TEMPLATE_DIR . 'admin/pager.tpl';
51        $this->tpl_subtitle = '顧客マスタ';
52
53        $masterData = new SC_DB_MasterData_Ex();
54        $this->arrPref = $masterData->getMasterData("mtb_pref",
55                             array("pref_id", "pref_name", "rank"));
56
57        $this->arrJob = $masterData->getMasterData("mtb_job");
58        $this->arrJob["不明"] = "不明";
59        $this->arrSex = $masterData->getMasterData("mtb_sex");
60        $this->arrPageRows = $masterData->getMasterData("mtb_page_rows");
61        $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type");
62        $this->arrHtmlmail[''] = "すべて";
63        $this->arrHtmlmail[1] = $this->arrMAILMAGATYPE[1];
64        $this->arrHtmlmail[2] = $this->arrMAILMAGATYPE[2];
65
66        $this->arrStatus[1] = "仮会員";
67        $this->arrStatus[2] = "本会員";
68
69        //---- CSVダウンロード用
70        $this->arrColumnCSV = array(0  => array("sql" => "customer_id",
71                                                "csv" => "customer_id",
72                                                "header" => "顧客ID"),
73                                    1  => array("sql" => "name01",
74                                                "csv" => "name01",
75                                                "header" => "名前1"),
76                                    2  => array("sql" => "name02",
77                                                "csv" => "name02",
78                                                "header" => "名前2"),
79                                    3  => array("sql" => "kana01",
80                                                "csv" => "kana01",
81                                                "header" => "フリガナ1"),
82                                    4  => array("sql" => "kana02",
83                                                "csv" => "kana02",
84                                                "header" => "フリガナ2"),
85                                    5  => array("sql" => "zip01",
86                                                "csv" => "zip01",
87                                                "header" => "郵便番号1"),
88                                    6  => array("sql" => "zip02",
89                                                "csv" => "zip02",
90                                                "header" => "郵便番号2"),
91                                    7  => array("sql" => "pref",
92                                                "csv" => "pref",
93                                                "header" => "都道府県"),
94                                    8  => array("sql" => "addr01",
95                                                "csv" => "addr01",
96                                                "header" => "住所1"),
97                                    9  => array("sql" => "addr02",
98                                                "csv" => "addr02",
99                                                "header" => "住所2"),
100                                    10 => array("sql" => "email",
101                                                "csv" => "email",
102                                                "header" => "E-MAIL"),
103                                    11 => array("sql" => "tel01",
104                                                "csv" => "tel01",
105                                                "header" => "TEL1"),
106                                    12 => array("sql" => "tel02",
107                                                "csv" => "tel02",
108                                                "header" => "TEL2"),
109                                    13 => array("sql" => "tel03",
110                                                "csv" => "tel03",
111                                                "header" => "TEL3"),
112                                    14 => array("sql" => "fax01",
113                                                "csv" => "fax01",
114                                                "header" => "FAX1"),
115                                    15 => array("sql" => "fax02",
116                                                "csv" => "fax02",
117                                                "header" => "FAX2"),
118                                    16 => array("sql" => "fax03",
119                                                "csv" => "fax03",
120                                                "header" => "FAX3"),
121                                    17 => array("sql" => "CASE WHEN sex = 1 "
122                                                . " THEN '男性' "
123                                                . " ELSE '女性' END AS sex",
124                                                "csv" => "sex",
125                                                "header" => "性別"),
126                                    18 => array("sql" => "job",
127                                                "csv" => "job",
128                                                "header" => "職業"),
129                                    19 => array("sql" => "cast(birth as date) AS birth",
130                                                "csv" => "birth",
131                                                "header" => "誕生日"),
132                                    20 => array("sql" => "cast(first_buy_date as date) AS first_buy_date",
133                                                "csv" => "first_buy_date",
134                                                "header" => "初回購入日"),
135                                    21 => array("sql" => "cast(last_buy_date as date) AS last_buy_date",
136                                                "csv" => "last_buy_date",
137                                                "header" => "最終購入日"),
138                                    22 => array("sql" => "buy_times",
139                                                "csv" => "buy_times",
140                                                "header" => "購入回数"),
141                                    23 => array("sql" => "point",
142                                                "csv" => "point",
143                                                "header" => "ポイント残高"),
144                                    24 => array("sql" => "note",
145                                                "csv" => "note",
146                                                "header" => "備考"),
147                                    25 => array("sql" => "cast(create_date as date) AS create_date",
148                                                "csv" => "create_date",
149                                                "header" => "登録日"),
150                                    26 => array("sql" => "cast(update_date as date) AS update_date",
151                                                "csv" => "update_date",
152                                                "header" => "更新日")
153                                    );
154    }
155
156    /**
157     * Page のプロセス.
158     *
159     * @return void
160     */
161    function process() {
162        //---- ページ初期設定
163        $objQuery = new SC_Query();
164        $objView = new SC_AdminView();
165        $objDate = new SC_Date(1901);
166        $objDb = new SC_Helper_DB_Ex();
167        $this->arrYear = $objDate->getYear();   // 日付プルダウン設定
168        $this->arrMonth = $objDate->getMonth();
169        $this->arrDay = $objDate->getDay();
170        $this->objDate = $objDate;
171
172        // 認証可否の判定
173        $objSess = new SC_Session();
174        SC_Utils_Ex::sfIsSuccess($objSess);
175
176        // POST値の引き継ぎ
177        $this->arrForm = $_POST;
178
179        // ページ送り用
180        $this->arrHidden['search_pageno'] =
181                isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
182
183        // 検索ワードの引き継ぎ
184        foreach ($_POST as $key => $val) {
185            switch($key) {
186            case 'sex':
187            case 'status':
188                $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
189                if(!is_array($val)) {
190                    $this->arrForm[$key] = split("-", $val);
191                }
192                break;
193            default:
194                $this->arrHidden[$key] = $val;
195                break;
196            }
197        }
198
199        if (!isset($_POST['mode'])) $_POST['mode'] = "";
200
201        // 顧客削除
202        if ($_POST['mode'] == "delete") {
203            $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
204            $result_customer = $objQuery->conn->getAll($sql, array($_POST["edit_customer_id"]));
205
206            if ($result_customer[0]["status"] == 2) {           //本会員削除
207                $arrDel = array("del_flg" => 1, "update_date" => "NOW()");
208                $objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " . SC_Utils_Ex::sfQuoteSmart($_POST["edit_customer_id"]) );
209            } elseif ($result_customer[0]["status"] == 1) {     //仮会員削除
210                $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
211                $objQuery->conn->query($sql, array($_POST["edit_customer_id"]));
212            }
213        }
214        //if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
215        // 登録メール再送
216        if ($_POST['mode'] == "resend_mail") {
217            $arrRet = $objQuery->select("name01, name02, secret_key, email, email_mobile", "dtb_customer","customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
218            if( is_array($arrRet) === true && count($arrRet) > 0 ){
219
220                $CONF = $objDb->sf_getBasisData();
221                $this->CONF = $CONF;
222                /**
223                 * 携帯メールアドレスが登録されていれば携帯サイトから仮会員登録したものと判定する。
224                 * TODO: とりあえずの簡易的な判定なので、将来的には判定ルーチンを修正した方が良い。
225                 */
226                if (!empty($arrRet[0]['email_mobile'])) {
227                    $objMailText = new SC_MobileView(false);
228                    $this->to_name01 = $arrRet[0]['name01'];
229                    $this->to_name02 = $arrRet[0]['name02'];
230                } else {
231                    $objMailText = new SC_SiteView(false);
232                }
233                $objMailText->assignobj($this);
234                $mailHelper = new SC_Helper_Mail_Ex();
235
236                $this->name01 = $arrRet[0]['name01'];
237                $this->name02 = $arrRet[0]['name02'];
238                $this->uniqid = $arrRet[0]['secret_key'];
239
240                $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
241                $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
242
243                $objMail = new SC_SendMail();
244                $objMail->setItem(
245                                    ''                  // 宛先
246                                    , $subject          // サブジェクト
247                                    , $toCustomerMail   // 本文
248                                    , $CONF["email03"]  // 配送元アドレス
249                                    , $CONF["shop_name"]// 配送元 名前
250                                    , $CONF["email03"]  // reply_to
251                                    , $CONF["email04"]  // return_path
252                                    , $CONF["email04"]  //  Errors_to
253                                 );
254                // 宛先の設定
255                $name = $this->name01 . $this->name02 ." 様";
256                $objMail->setTo($arrRet[0]["email"], $name);
257                $objMail->sendMail();
258            }
259
260        }
261        if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "resend_mail") {
262
263            // 入力文字の強制変換
264            $this->lfConvertParam();
265            // エラーチェック
266            $this->arrErr = $this->lfCheckError($this->arrForm);
267
268            $where = "del_flg = 0";
269
270            /* 入力エラーなし */
271            if (count($this->arrErr) == 0) {
272
273                //-- 検索データ取得
274                $objSelect = new SC_CustomerList($this->arrForm, "customer");
275
276                // 表示件数設定
277                $page_rows = $this->arrForm['page_rows'];
278                if(is_numeric($page_rows)) {
279                    $page_max = $page_rows;
280                } else {
281                    $page_max = SEARCH_PMAX;
282                }
283
284                if (!isset($this->arrForm['search_pageno'])) $this->arrForm['search_pageno'] = "";
285
286                if ($this->arrForm['search_pageno'] == 0){
287                    $this->arrForm['search_pageno'] = 1;
288                }
289
290                $offset = $page_max * ($this->arrForm['search_pageno'] - 1);
291                $objSelect->setLimitOffset($page_max, $offset);
292
293                if ($_POST["mode"] == 'csv') {
294                    $searchSql = $objSelect->getListCSV($this->arrColumnCSV);
295                }else{
296                    $searchSql = $objSelect->getList();
297                }
298
299                $this->search_data = $objQuery->conn->getAll($searchSql, $objSelect->arrVal);
300
301                switch($_POST['mode']) {
302                case 'csv':
303                    require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php");
304
305                    $objCSV = new SC_Helper_CSV_Ex();
306                    $i = 0;
307                    $header = "";
308
309                    // CSVカラム取得
310                    $arrCsvOutput = ($objCSV->sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1"));
311
312                    if (count($arrCsvOutput) <= 0) break;
313
314                    foreach($arrCsvOutput as $data) {
315                        $arrColumn[] = $data["col"];
316                        if ($i != 0) $header .= ", ";
317                        $header .= $data["disp_name"];
318                        $i ++;
319                    }
320                    $header .= "\n";
321
322                    //- 都道府県/職業の変換
323                    for($i = 0; $i < count($this->search_data); $i ++) {
324                        $this->search_data[$i]["pref"] = $this->arrPref[ $this->search_data[$i]["pref"] ];
325                        $this->search_data[$i]["job"]  = $this->arrJob[ $this->search_data[$i]["job"] ];
326                    }
327
328                    //- CSV出力
329                    $data = SC_Utils_Ex::getCSVData($this->search_data, $arrColumn);
330
331                    SC_Utils_Ex::sfCSVDownload($header.$data);
332                    exit;
333                    break;
334                case 'delete_all':
335                    // 検索結果をすべて削除
336                    $where = "product_id IN (SELECT product_id FROM vw_products_nonclass AS noncls WHERE $where)";
337                    $sqlval['del_flg'] = 1;
338                    $objQuery->update("dtb_products", $sqlval, $where, $arrval);
339
340                    $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
341                    $result_customer = $objQuery->conn->getAll($sql, array($_POST["del_customer_id"]));
342
343                    if ($result_customer[0]["status"] == 2) {           //本会員削除
344                        $arrDel = array("del_flg" => 1, "update_date" => "NOW()");
345                        $objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " . SC_Utils_Ex::sfQuoteSmart($_POST["del_customer_id"]) );
346                    } elseif ($result_customer[0]["status"] == 1) {     //仮会員削除
347                        $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
348                        $objQuery->conn->query($sql, array($_POST["del_customer_id"]));
349                    }
350
351                    break;
352                default:
353
354                    // 行数の取得
355                    $linemax = $objQuery->conn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
356                    $this->tpl_linemax = $linemax;              // 何件が該当しました。表示用
357
358                    // ページ送りの取得
359                    $objNavi = new SC_PageNavi($this->arrHidden['search_pageno'],
360                                               $linemax, $page_max,
361                                               "fnCustomerPage", NAVI_PMAX);
362                    $startno = $objNavi->start_row;
363                    $this->arrPagenavi = $objNavi->arrPagenavi;
364                }
365            }
366        }
367
368        $this->arrCatList = $objDb->sfGetCategoryList();
369
370        //---- ページ表示
371        $objView->assignobj($this);
372        $objView->display(MAIN_FRAME);
373    }
374
375    /**
376     * デストラクタ.
377     *
378     * @return void
379     */
380    function destroy() {
381        parent::destroy();
382    }
383
384    //---- 取得文字列の変換
385    function lfConvertParam() {
386        /*
387         *  文字列の変換
388         *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
389         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
390         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
391         *  n :  「全角」数字を「半角(ハンカク)」に変換
392         *  a :  全角英数字を半角英数字に変換する
393         */
394        // カラム名とコンバート情報
395        $arrConvList['customer_id'] = "n" ;
396        $arrConvList['name'] = "aKV" ;
397        $arrConvList['pref'] = "n" ;
398        $arrConvList['kana'] = "CKV" ;
399        $arrConvList['b_start_year'] = "n" ;
400        $arrConvList['b_start_month'] = "n" ;
401        $arrConvList['b_start_day'] = "n" ;
402        $arrConvList['b_end_year'] = "n" ;
403        $arrConvList['b_end_month'] = "n" ;
404        $arrConvList['b_end_day'] = "n" ;
405        $arrConvList['tel'] = "n" ;
406        $arrConvList['birth_month'] = "n" ;
407        $arrConvList['email'] = "a" ;
408        $arrConvList['buy_total_from'] = "n" ;
409        $arrConvList['buy_total_to'] = "n" ;
410        $arrConvList['buy_times_from'] = "n" ;
411        $arrConvList['buy_times_to'] = "n" ;
412        $arrConvList['start_year'] = "n" ;
413        $arrConvList['start_month'] = "n" ;
414        $arrConvList['start_day'] = "n" ;
415        $arrConvList['end_year'] = "n" ;
416        $arrConvList['end_month'] = "n" ;
417        $arrConvList['end_day'] = "n" ;
418        $arrConvList['page_rows'] = "n" ;
419        $arrConvList['buy_start_year'] = "n" ;      // 最終購入日 START 年
420        $arrConvList['buy_start_month'] = "n" ;     // 最終購入日 START 月
421        $arrConvList['buy_start_day'] = "n" ;       // 最終購入日 START 日
422        $arrConvList['buy_end_year'] = "n" ;            // 最終購入日 END 年
423        $arrConvList['buy_end_month'] = "n" ;       // 最終購入日 END 月
424        $arrConvList['buy_end_day'] = "n" ;         // 最終購入日 END 日
425        $arrConvList['buy_product_name'] = "aKV" ;  // 購入商品名
426        $arrConvList['buy_product_code'] = "aKV" ;  // 購入商品コード
427        $arrConvList['category_id'] = "" ;          // カテゴリ
428
429        // 文字変換
430        foreach ($arrConvList as $key => $val) {
431            // POSTされてきた値のみ変換する。
432            if(isset($this->arrForm[$key])) {
433                $this->arrForm[$key] = mb_convert_kana($this->arrForm[$key] ,$val);
434            }
435        }
436    }
437
438    //---- 入力エラーチェック
439    function lfCheckError($array) {
440
441        $objErr = new SC_CheckError($array);
442
443        $objErr->doFunc(array("顧客コード", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
444        $objErr->doFunc(array("都道府県", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
445        $objErr->doFunc(array("顧客名", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
446        $objErr->doFunc(array("顧客名(カナ)", "kana", STEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANABLANK_CHECK"));
447        $objErr->doFunc(array("誕生日(開始日)", "b_start_year", "b_start_month", "b_start_day"), array("CHECK_DATE"));
448        $objErr->doFunc(array("誕生日(終了日)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));
449        $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"));
450        $objErr->doFunc(array("誕生月", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
451        $objErr->doFunc(array('メールアドレス', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
452        $objErr->doFunc(array('携帯メールアドレス', "email_mobile", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
453        $objErr->doFunc(array("電話番号", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
454        $objErr->doFunc(array("購入金額(開始)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
455        $objErr->doFunc(array("購入金額(終了)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
456        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"] .= "※ 購入金額の指定範囲が不正です。";
457        $objErr->doFunc(array("購入回数(開始)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
458        $objErr->doFunc(array("購入回数(終了)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
459        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"] .= "※ 購入回数の指定範囲が不正です。";
460        $objErr->doFunc(array("登録・更新日(開始日)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
461        $objErr->doFunc(array("登録・更新日(終了日)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));
462        $objErr->doFunc(array("登録・更新日(開始日)","登録・更新日(終了日)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
463        $objErr->doFunc(array("表示件数", "page_rows", 3), array("NUM_CHECK","MAX_LENGTH_CHECK"));
464        $objErr->doFunc(array("最終購入日(開始日)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));   //最終購入日(開始日)
465        $objErr->doFunc(array("最終購入(終了日)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));            //最終購入日(終了日)
466        //購入金額(from) > 購入金額(to) の場合はエラーとする
467        $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"));
468        $objErr->doFunc(array("購入商品コード", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));                     //購入商品コード
469        $objErr->doFunc(array("購入商品名", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));                         //購入商品名称
470
471        return $objErr->arrErr;
472    }
473
474    function lfSetWhere($arrForm){
475        foreach ($arrForm as $key => $val) {
476
477            $val = sfManualEscape($val);
478
479            if($val == "") continue;
480
481            switch ($key) {
482            case 'product_id':
483                $where .= " AND product_id = ?";
484                $arrval[] = $val;
485                break;
486            case 'product_class_id':
487                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
488                $arrval[] = $val;
489                break;
490            case 'name':
491                $where .= " AND name ILIKE ?";
492                $arrval[] = "%$val%";
493                break;
494            case 'category_id':
495                list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
496                if($tmp_where != "") {
497                    $where.= " AND $tmp_where";
498                    $arrval = array_merge($arrval, $tmp_arrval);
499                }
500                break;
501            case 'product_code':
502                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
503                $arrval[] = "%$val%";
504                break;
505            case 'startyear':
506                $date = sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
507                $where.= " AND update_date >= ?";
508                $arrval[] = $date;
509                break;
510            case 'endyear':
511                $date = sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
512                $where.= " AND update_date <= ?";
513                $arrval[] = $date;
514                break;
515            case 'product_flag':
516                global $arrSTATUS;
517                $product_flag = sfSearchCheckBoxes($val);
518                if($product_flag != "") {
519                    $where.= " AND product_flag LIKE ?";
520                    $arrval[] = $product_flag;
521                }
522                break;
523            case 'status':
524                $tmp_where = "";
525                foreach ($val as $element){
526                    if ($element != ""){
527                        if ($tmp_where == ""){
528                            $tmp_where.="AND (status LIKE ? ";
529                        }else{
530                            $tmp_where.="OR status LIKE ? ";
531                        }
532                        $arrval[]=$element;
533                    }
534                }
535                if ($tmp_where != ""){
536                    $tmp_where.=")";
537                    $where.= "$tmp_where";
538                }
539                break;
540            default:
541                break;
542            }
543        }
544    }
545}
546?>
Note: See TracBrowser for help on using the repository browser.