source: branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Disp.php @ 21419

Revision 21419, 16.3 KB checked in by Seasoft, 10 years ago (diff)

#1289 (用語に揺らぎ「会員」)

  • Property svn:eol-style set to native
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2011 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_REALDIR . 'pages/admin/order/LC_Page_Admin_Order_Edit.php';
26
27/**
28 * 受注情報表示 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id: LC_Page_Admin_Order_Disp.php 20767 2011-03-22 10:07:32Z nanasess $
33 */
34class LC_Page_Admin_Order_Disp extends LC_Page_Admin_Order_Ex {
35
36    var $arrShippingKeys = array(
37        'shipping_id',
38        'shipping_name01',
39        'shipping_name02',
40        'shipping_kana01',
41        'shipping_kana02',
42        'shipping_tel01',
43        'shipping_tel02',
44        'shipping_tel03',
45        'shipping_fax01',
46        'shipping_fax02',
47        'shipping_fax03',
48        'shipping_pref',
49        'shipping_zip01',
50        'shipping_zip02',
51        'shipping_addr01',
52        'shipping_addr02',
53        'shipping_date_year',
54        'shipping_date_month',
55        'shipping_date_day',
56        'time_id',
57    );
58
59    var $arrShipmentItemKeys = array(
60        'shipment_product_class_id',
61        'shipment_product_code',
62        'shipment_product_name',
63        'shipment_classcategory_name1',
64        'shipment_classcategory_name2',
65        'shipment_price',
66        'shipment_quantity',
67    );
68
69    // }}}
70    // {{{ functions
71
72    /**
73     * Page を初期化する.
74     *
75     * @return void
76     */
77    function init() {
78        parent::init();
79        $this->tpl_mainpage = 'order/disp.tpl';
80        $this->tpl_mainno = 'order';
81        $this->tpl_subnavi = '';
82        $this->tpl_subno = '';
83        $this->tpl_subtitle = '受注情報表示';
84
85        $masterData = new SC_DB_MasterData_Ex();
86        $this->arrPref = $masterData->getMasterData('mtb_pref');
87        $this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
88        $this->arrDeviceType = $masterData->getMasterData('mtb_device_type');
89
90        // 支払い方法の取得
91        $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
92
93        // 配送業者の取得
94        $this->arrDeliv = SC_Helper_DB_Ex::sfGetIDValueList("dtb_deliv", "deliv_id", 'name');
95    }
96
97    /**
98     * Page のプロセス.
99     *
100     * @return void
101     */
102    function process() {
103        $this->action();
104        $this->sendResponse();
105    }
106
107    /**
108     * Page のアクション.
109     *
110     * @return void
111     */
112    function action() {
113        $objPurchase = new SC_Helper_Purchase_Ex();
114        $objFormParam = new SC_FormParam_Ex();
115
116        // パラメータ情報の初期化
117        $this->lfInitParam($objFormParam);
118        $objFormParam->setParam($_REQUEST);
119        $objFormParam->convParam();
120        $order_id = $objFormParam->getValue('order_id');
121
122        // DBから受注情報を読み込む
123        $this->setOrderToFormParam($objFormParam, $order_id);
124
125        $this->arrForm = $objFormParam->getFormParamList();
126        $this->arrAllShipping = $objFormParam->getSwapArray(array_merge($this->arrShippingKeys, $this->arrShipmentItemKeys));
127        $this->arrDelivTime = $objPurchase->getDelivTime($objFormParam->getValue('deliv_id'));
128        $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
129
130        $this->setTemplate($this->tpl_mainpage);
131    }
132
133    /**
134     * デストラクタ.
135     * @return void
136     */
137    function destroy() {
138        parent::destroy();
139    }
140
141    /**
142     * パラメータ情報の初期化を行う.
143     *
144     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
145     * @return void
146     */
147    function lfInitParam(&$objFormParam) {
148        // 検索条件のパラメータを初期化
149        parent::lfInitParam($objFormParam);
150
151        // お客様情報
152        $objFormParam->addParam("会員名1", "order_name01", STEXT_LEN, 'KVa', array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
153        $objFormParam->addParam("会員名2", "order_name02", STEXT_LEN, 'KVa', array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
154        $objFormParam->addParam("会員名カナ1", "order_kana01", STEXT_LEN, 'KVCa', array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
155        $objFormParam->addParam("会員名カナ2", "order_kana02", STEXT_LEN, 'KVCa', array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
156        $objFormParam->addParam("メールアドレス", "order_email", null, 'KVCa', array("NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
157        $objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, 'n', array("NUM_CHECK", "NUM_COUNT_CHECK"));
158        $objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, 'n', array("NUM_CHECK", "NUM_COUNT_CHECK"));
159        $objFormParam->addParam("都道府県", "order_pref", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
160        $objFormParam->addParam("住所1", "order_addr01", MTEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
161        $objFormParam->addParam("住所2", "order_addr02", MTEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
162        $objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, 'n', array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
163        $objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, 'n', array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
164        $objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, 'n', array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
165
166        // 受注商品情報
167        $objFormParam->addParam("値引き", 'discount', INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
168        $objFormParam->addParam("送料", "deliv_fee", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
169        $objFormParam->addParam("手数料", 'charge', INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
170
171        // ポイント機能ON時のみ
172        if (USE_POINT !== false) {
173            $objFormParam->addParam("利用ポイント", "use_point", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
174        }
175
176        $objFormParam->addParam("配送業者", "deliv_id", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
177        $objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
178        $objFormParam->addParam("対応状況", 'status', INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
179        $objFormParam->addParam("お支払方法名称", "payment_method");
180
181        // 受注詳細情報
182        $objFormParam->addParam("商品種別ID", "product_type_id", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
183        $objFormParam->addParam("単価", 'price', INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
184        $objFormParam->addParam("数量", 'quantity', INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
185        $objFormParam->addParam("商品ID", "product_id", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
186        $objFormParam->addParam("商品規格ID", "product_class_id", INT_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
187        $objFormParam->addParam("ポイント付与率", "point_rate");
188        $objFormParam->addParam("商品コード", "product_code");
189        $objFormParam->addParam("商品名", "product_name");
190        $objFormParam->addParam("規格名1", "classcategory_name1");
191        $objFormParam->addParam("規格名2", "classcategory_name2");
192        $objFormParam->addParam("メモ", 'note', MTEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
193        $objFormParam->addParam("削除用項番", "delete_no", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
194
195        // DB読込用
196        $objFormParam->addParam("小計", 'subtotal');
197        $objFormParam->addParam("合計", 'total');
198        $objFormParam->addParam("支払い合計", "payment_total");
199        $objFormParam->addParam("加算ポイント", "add_point");
200        $objFormParam->addParam("お誕生日ポイント", "birth_point");
201        $objFormParam->addParam("消費税合計", 'tax');
202        $objFormParam->addParam("最終保持ポイント", "total_point");
203        $objFormParam->addParam("会員ID", "customer_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
204        $objFormParam->addParam("会員ID", "edit_customer_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
205        $objFormParam->addParam("現在のポイント", "customer_point");
206        $objFormParam->addParam("受注前ポイント", 'point');
207        $objFormParam->addParam("注文番号", "order_id");
208        $objFormParam->addParam("受注日", "create_date");
209        $objFormParam->addParam("発送日", "commit_date");
210        $objFormParam->addParam("備考", 'message');
211        $objFormParam->addParam("入金日", "payment_date");
212        $objFormParam->addParam("端末種別", "device_type_id");
213
214        // 複数情報
215        $objFormParam->addParam("配送数", "shipping_quantity", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
216        $objFormParam->addParam("配送ID", "shipping_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"), 0);
217        $objFormParam->addParam("お名前1", "shipping_name01", STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
218        $objFormParam->addParam("お名前2", "shipping_name02", STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
219        $objFormParam->addParam("お名前(フリガナ・姓)", "shipping_kana01", STEXT_LEN, 'KVCa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
220        $objFormParam->addParam("お名前(フリガナ・名)", "shipping_kana02", STEXT_LEN, 'KVCa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
221        $objFormParam->addParam("郵便番号1", "shipping_zip01", ZIP01_LEN, 'n', array("NUM_CHECK", "NUM_COUNT_CHECK"));
222        $objFormParam->addParam("郵便番号2", "shipping_zip02", ZIP02_LEN, 'n', array("NUM_CHECK", "NUM_COUNT_CHECK"));
223        $objFormParam->addParam("都道府県", "shipping_pref", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
224        $objFormParam->addParam("住所1", "shipping_addr01", MTEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
225        $objFormParam->addParam("住所2", "shipping_addr02", MTEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
226        $objFormParam->addParam("電話番号1", "shipping_tel01", TEL_ITEM_LEN, 'n', array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
227        $objFormParam->addParam("電話番号2", "shipping_tel02", TEL_ITEM_LEN, 'n', array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
228        $objFormParam->addParam("電話番号3", "shipping_tel03", TEL_ITEM_LEN, 'n', array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
229        $objFormParam->addParam("お届け時間ID", "time_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
230        $objFormParam->addParam("お届け日(年)", "shipping_date_year", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
231        $objFormParam->addParam("お届け日(月)", "shipping_date_month", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
232        $objFormParam->addParam("お届け日(日)", "shipping_date_day", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
233        $objFormParam->addParam("お届け日", "shipping_date", STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
234        $objFormParam->addParam("配送商品数量", "shipping_product_quantity", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
235
236        $objFormParam->addParam("商品規格ID", "shipment_product_class_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
237        $objFormParam->addParam("商品コード", "shipment_product_code");
238        $objFormParam->addParam("商品名", "shipment_product_name");
239        $objFormParam->addParam("規格名1", "shipment_classcategory_name1");
240        $objFormParam->addParam("規格名2", "shipment_classcategory_name2");
241        $objFormParam->addParam("単価", "shipment_price", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
242        $objFormParam->addParam("数量", "shipment_quantity", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
243
244        $objFormParam->addParam("商品項番", 'no', INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
245        $objFormParam->addParam("追加商品規格ID", "add_product_class_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
246        $objFormParam->addParam("修正商品規格ID", "edit_product_class_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK"));
247        $objFormParam->addParam("アンカーキー", "anchor_key", STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
248    }
249
250    /**
251     * 受注データを取得して, SC_FormParam へ設定する.
252     *
253     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
254     * @param integer $order_id 取得元の受注ID
255     * @return void
256     */
257    function setOrderToFormParam(&$objFormParam, $order_id) {
258        $objPurchase = new SC_Helper_Purchase_Ex();
259
260        // 受注詳細を設定
261        $arrOrderDetail = $objPurchase->getOrderDetail($order_id, false);
262        $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrOrderDetail));
263
264        $arrShippingsTmp = $objPurchase->getShippings($order_id);
265        $arrShippings = array();
266        foreach ($arrShippingsTmp as $row) {
267            // お届け日の処理
268            if (!SC_Utils_Ex::isBlank($row["shipping_date"])) {
269                $ts = strtotime($row["shipping_date"]);
270                $row['shipping_date_year'] = date('Y', $ts);
271                $row['shipping_date_month'] = date('n', $ts);
272                $row['shipping_date_day'] = date('j', $ts);
273            }
274            $arrShippings[$row['shipping_id']] = $row;
275        }
276        $objFormParam->setValue('shipping_quantity', count($arrShippings));
277        $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrShippings));
278
279        /*
280         * 配送商品を設定
281         *
282         * $arrShipmentItem['shipment_(key)'][$shipping_id][$item_index] = 値
283         * $arrProductQuantity[$shipping_id] = 配送先ごとの配送商品数量
284         */
285        $arrProductQuantity = array();
286        $arrShipmentItem = array();
287        foreach ($arrShippings as $shipping_id => $arrShipping) {
288            $arrProductQuantity[$shipping_id] = count($arrShipping['shipment_item']);
289            foreach ($arrShipping['shipment_item'] as $item_index => $arrItem) {
290                foreach ($arrItem as $item_key => $item_val) {
291                    $arrShipmentItem['shipment_' . $item_key][$shipping_id][$item_index] = $item_val;
292                }
293            }
294        }
295        $objFormParam->setValue('shipping_product_quantity', $arrProductQuantity);
296        $objFormParam->setParam($arrShipmentItem);
297
298        /*
299         * 受注情報を設定
300         * $arrOrderDetail と項目が重複しており, $arrOrderDetail は連想配列の値
301         * が渡ってくるため, $arrOrder で上書きする.
302         */
303        $arrOrder = $objPurchase->getOrder($order_id);
304        $objFormParam->setParam($arrOrder);
305
306        // ポイントを設定
307        list($db_point, $rollback_point) = SC_Helper_DB_Ex::sfGetRollbackPoint(
308            $order_id, $arrOrder['use_point'], $arrOrder['add_point'], $arrOrder['status']
309        );
310        $objFormParam->setValue('total_point', $db_point);
311        $objFormParam->setValue('point', $rollback_point);
312
313        if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) {
314            $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($objFormParam->getValue('customer_id'));
315            $objFormParam->setValue('customer_point', $arrCustomer['point']);
316        }
317    }
318
319}
320?>
Note: See TracBrowser for help on using the repository browser.