source: branches/version-2_5-dev/data/class/helper/SC_Helper_Customer.php @ 19864

Revision 19864, 3.5 KB checked in by fukuda, 13 years ago (diff)

SC_Helper_DB内の顧客編集に関する部分は、SC_Helper_Customerを新規作成して
そちらで共通化するように変更

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/**
25 * 会員情報の登録・編集・検索ヘルパークラス.
26 *
27 *
28 * @package Helper
29 * @author Hirokazu Fukuda
30 * @version $Id$
31 */
32class SC_Helper_Customer {
33   
34   
35    /**
36     * 会員編集登録処理を行う.
37     *
38     * @param array $array パラメータの配列
39     * @param array $arrRegistColumn 登録するカラムの配列
40     * @return void
41     */
42    function sfEditCustomerData($array, $arrRegistColumn) {
43        $objQuery =& SC_Query::getSingletonInstance();
44
45        foreach ($arrRegistColumn as $data) {
46            if ($data["column"] != "password") {
47                if($array[ $data['column'] ] != "") {
48                    $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
49                } else {
50                    $arrRegist[ $data['column'] ] = NULL;
51                }
52            }
53        }
54        if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) {
55            $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
56        } else {
57            $arrRegist["birth"] = NULL;
58        }
59
60        //-- パスワードの更新がある場合は暗号化。(更新がない場合はUPDATE文を構成しない)
61        if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = sha1($array["password"] . ":" . AUTH_MAGIC);
62        $arrRegist["update_date"] = "NOW()";
63
64        //-- 編集登録実行
65        $objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id']));
66    }
67   
68    /**
69     * 注文番号、利用ポイント、加算ポイントから最終ポイントを取得する.
70     *
71     * @param integer $order_id 注文番号
72     * @param integer $use_point 利用ポイント
73     * @param integer $add_point 加算ポイント
74     * @return array 最終ポイントの配列
75     */
76    function sfGetCustomerPoint($order_id, $use_point, $add_point) {
77        $objQuery =& SC_Query::getSingletonInstance();
78        $arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id));
79        $customer_id = $arrRet[0]['customer_id'];
80        if ($customer_id != "" && $customer_id >= 1) {
81            if (USE_POINT !== false) {
82                $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
83                $point = $arrRet[0]['point'];
84                $total_point = $arrRet[0]['point'] - $use_point + $add_point;
85            } else {
86                $total_point = 0;
87                $point = 0;
88            }
89        } else {
90            $total_point = "";
91            $point = "";
92        }
93        return array($point, $total_point);
94    }
95   
96}
Note: See TracBrowser for help on using the repository browser.