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

Revision 22205, 17.6 KB checked in by m_uehara, 8 years ago (diff)

#2004 郵便番号を2カラムから1カラムに変更しました。

  • Property svn:eol-style set to native
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2012 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_EX_REALDIR . 'page_extends/admin/order/LC_Page_Admin_Order_Ex.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_zipcode',
52        'shipping_addr01',
53        'shipping_addr02',
54        'shipping_date_year',
55        'shipping_date_month',
56        'shipping_date_day',
57        'time_id',
58    );
59
60    var $arrShipmentItemKeys = array(
61        'shipment_product_class_id',
62        'shipment_product_code',
63        'shipment_product_name',
64        'shipment_classcategory_name1',
65        'shipment_classcategory_name2',
66        'shipment_price',
67        'shipment_quantity',
68    );
69
70    // }}}
71    // {{{ functions
72
73    /**
74     * Page を初期化する.
75     *
76     * @return void
77     */
78    function init() {
79        parent::init();
80        $this->tpl_mainpage = 'order/disp.tpl';
81        $this->tpl_mainno = 'order';
82        $this->tpl_subnavi = '';
83        $this->tpl_subno = '';
84        $this->tpl_subtitle = t('LC_Page_Admin_Order_Disp_001');
85
86        $masterData = new SC_DB_MasterData_Ex();
87        $this->arrPref = $masterData->getMasterData('mtb_pref');
88        $this->arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
89        $this->arrDeviceType = $masterData->getMasterData('mtb_device_type');
90
91        // 支払い方法の取得
92        $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList('dtb_payment', 'payment_id', 'payment_method');
93
94        // 配送業者の取得
95        $this->arrDeliv = SC_Helper_DB_Ex::sfGetIDValueList('dtb_deliv', 'deliv_id', 'name');
96    }
97
98    /**
99     * Page のプロセス.
100     *
101     * @return void
102     */
103    function process() {
104        $this->action();
105        $this->sendResponse();
106    }
107
108    /**
109     * Page のアクション.
110     *
111     * @return void
112     */
113    function action() {
114
115        $objPurchase = new SC_Helper_Purchase_Ex();
116        $objFormParam = new SC_FormParam_Ex();
117
118        // パラメータ情報の初期化
119        $this->lfInitParam($objFormParam);
120        $objFormParam->setParam($_REQUEST);
121        $objFormParam->convParam();
122        $order_id = $objFormParam->getValue('order_id');
123
124        // DBから受注情報を読み込む
125        $this->setOrderToFormParam($objFormParam, $order_id);
126
127        $this->arrForm = $objFormParam->getFormParamList();
128        $this->arrAllShipping = $objFormParam->getSwapArray(array_merge($this->arrShippingKeys, $this->arrShipmentItemKeys));
129        $this->arrDelivTime = $objPurchase->getDelivTime($objFormParam->getValue('deliv_id'));
130        $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
131
132        $this->setTemplate($this->tpl_mainpage);
133
134    }
135
136    /**
137     * デストラクタ.
138     * @return void
139     */
140    function destroy() {
141        parent::destroy();
142    }
143
144    /**
145     * パラメータ情報の初期化を行う.
146     *
147     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
148     * @return void
149     */
150    function lfInitParam(&$objFormParam) {
151        // 検索条件のパラメータを初期化
152        parent::lfInitParam($objFormParam);
153
154        // お客様情報
155        $objFormParam->addParam(t('PARAM_LABEL_MEMBER_NAME1'), 'order_name01', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
156        $objFormParam->addParam(t('PARAM_LABEL_MEMBER_NAME2'), 'order_name02', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
157        $objFormParam->addParam(t('PARAM_LABEL_MEMBER_KANA1'), 'order_kana01', STEXT_LEN, 'KVCa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
158        $objFormParam->addParam(t('PARAM_LABEL_MEMBER_KANA2'), 'order_kana02', STEXT_LEN, 'KVCa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
159        $objFormParam->addParam(t('PARAM_LABEL_EMAIL'), 'order_email', null, 'KVCa', array('NO_SPTAB', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK'));
160//        $objFormParam->addParam(t('PARAM_LABEL_ZIP01'), 'order_zip01', ZIP01_LEN, 'n', array('NUM_CHECK', 'NUM_COUNT_CHECK'));
161//        $objFormParam->addParam(t('PARAM_LABEL_ZIP02'), 'order_zip02', ZIP02_LEN, 'n', array('NUM_CHECK', 'NUM_COUNT_CHECK'));
162        $objFormParam->addParam(t('PARAM_LABEL_ZIP'), 'order_zipcode', ZIPCODE_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
163        $objFormParam->addParam(t('PARAM_LABEL_PREF'), 'order_pref', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
164        $objFormParam->addParam(t('PARAM_LABEL_ADDR1'), 'order_addr01', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
165        $objFormParam->addParam(t('PARAM_LABEL_ADDR2'), 'order_addr02', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
166        $objFormParam->addParam(t('PARAM_LABEL_TEL1'), 'order_tel01', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
167        $objFormParam->addParam(t('PARAM_LABEL_TEL2'), 'order_tel02', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
168        $objFormParam->addParam(t('PARAM_LABEL_TEL3'), 'order_tel03', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
169
170        // 受注商品情報
171        $objFormParam->addParam(t('PARAM_LABEL_DISCOUNT'), 'discount', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
172        $objFormParam->addParam(t('PARAM_LABEL_DELIV_FEE'), 'deliv_fee', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
173        $objFormParam->addParam(t('PARAM_LABEL_CHARGE'), 'charge', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
174
175        // ポイント機能ON時のみ
176        if (USE_POINT !== false) {
177            $objFormParam->addParam(t('PARAM_LABEL_USE_POINT'), 'use_point', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
178        }
179
180        $objFormParam->addParam(t('PARAM_LABEL_DELIV'), 'deliv_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
181        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_PAYMENT_METHOD'), 'payment_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
182        $objFormParam->addParam(t('PARAM_LABEL_ORDER_STATUS'), 'status', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
183        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_PAYMENT_METHOD_NAME'), 'payment_method');
184
185        // 受注詳細情報
186        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_TYPE_ID'), 'product_type_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
187        $objFormParam->addParam(t('PARAM_LABEL_PRICE'), 'price', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
188        $objFormParam->addParam(t('PARAM_LABEL_QUANTITY'), 'quantity', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
189        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_ID'), 'product_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
190        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_CLASS_ID'), 'product_class_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
191        $objFormParam->addParam(t('PARAM_LABEL_POINT_RATE'), 'point_rate');
192        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_CODE'), 'product_code');
193        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_NAME'), 'product_name');
194        $objFormParam->addParam(t('PARAM_LABEL_CLASS_NAME1'), 'classcategory_name1');
195        $objFormParam->addParam(t('PARAM_LABEL_CLASS_NAME2'), 'classcategory_name2');
196        $objFormParam->addParam(t('PARAM_LABEL_NOTE'), 'note', MTEXT_LEN, 'KVa', array('MAX_LENGTH_CHECK'));
197        $objFormParam->addParam(t('PARAM_LABEL_DELETE_NO'), 'delete_no', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
198
199        // DB読込用
200        $objFormParam->addParam(t('PARAM_LABEL_SUBTOTAL'), 'subtotal');
201        $objFormParam->addParam(t('PARAM_LABEL_TOTAL'), 'total');
202        $objFormParam->addParam(t('PARAM_LABEL_PAYMENT_TOTAL'), 'payment_total');
203        $objFormParam->addParam(t('PARAM_LABEL_ADD_POINT'), 'add_point');
204        $objFormParam->addParam(t('PARAM_LABEL_BIRTH_POINT'), 'birth_point');
205        $objFormParam->addParam(t('PARAM_LABEL_TAX_TOTAL'), 'tax');
206        $objFormParam->addParam(t('PARAM_LABEL_TOTAL_POINT'), 'total_point');
207        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_ID'), 'customer_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
208        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_ID'), 'edit_customer_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
209        $objFormParam->addParam(t('PARAM_LABEL_NOW_POINT'), 'customer_point');
210        $objFormParam->addParam(t('PARAM_LABEL_BEFORE_POINT'), 'point');
211        $objFormParam->addParam(t('PARAM_LABEL_ORDER_NUMBER'), 'order_id');
212        $objFormParam->addParam(t('PARAM_LABEL_ORDER_DATE'), 'create_date');
213        $objFormParam->addParam(t('PARAM_LABEL_SHIPPING_DATE'), 'commit_date');
214        $objFormParam->addParam(t('PARAM_LABEL_REMARKS'), 'message');
215        $objFormParam->addParam(t('PARAM_LABEL_PAYMENT_DATE'), 'payment_date');
216        $objFormParam->addParam(t('PARAM_LABEL_DEVICE_TYPE'), 'device_type_id');
217
218        // 複数情報
219        $objFormParam->addParam(t('PARAM_LABEL_SHIPPING_QUANTITY'), 'shipping_quantity', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), 1);
220        $objFormParam->addParam(t('PARAM_LABEL_SHIPPING_ID'), 'shipping_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), 0);
221        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_NAME1'), 'shipping_name01', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
222        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_NAME2'), 'shipping_name02', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
223        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_LASTKANA'), 'shipping_kana01', STEXT_LEN, 'KVCa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
224        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_FIRSTKANA'), 'shipping_kana02', STEXT_LEN, 'KVCa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
225//        $objFormParam->addParam(t('PARAM_LABEL_ZIP01'), 'shipping_zip01', ZIP01_LEN, 'n', array('NUM_CHECK', 'NUM_COUNT_CHECK'));
226//        $objFormParam->addParam(t('PARAM_LABEL_ZIP02'), 'shipping_zip02', ZIP02_LEN, 'n', array('NUM_CHECK', 'NUM_COUNT_CHECK'));
227        $objFormParam->addParam(t('PARAM_LABEL_ZIP'), 'shipping_zipcode', ZIPCODE_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
228        $objFormParam->addParam(t('PARAM_LABEL_PREF'), 'shipping_pref', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
229        $objFormParam->addParam(t('PARAM_LABEL_ADDR1'), 'shipping_addr01', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
230        $objFormParam->addParam(t('PARAM_LABEL_ADDR2'), 'shipping_addr02', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
231        $objFormParam->addParam(t('PARAM_LABEL_TEL1'), 'shipping_tel01', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
232        $objFormParam->addParam(t('PARAM_LABEL_TEL2'), 'shipping_tel02', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
233        $objFormParam->addParam(t('PARAM_LABEL_TEL3'), 'shipping_tel03', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
234        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_DELIV_TIME_ID'), 'time_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
235        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_DELIV_DATE_YEAR'), 'shipping_date_year', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
236        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_DELIV_DATE_MONTH'), 'shipping_date_month', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
237        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_DELIV_DATE_DAY'), 'shipping_date_day', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
238        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_DELIV_DATE'), 'shipping_date', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
239        $objFormParam->addParam(t('PARAM_LABEL_SHIPPING_PRODUCT_QUANTITY'), 'shipping_product_quantity', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
240
241        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_CLASS_ID'), 'shipment_product_class_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
242        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_CODE'), 'shipment_product_code');
243        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_NAME'), 'shipment_product_name');
244        $objFormParam->addParam(t('PARAM_LABEL_CLASS_NAME1'), 'shipment_classcategory_name1');
245        $objFormParam->addParam(t('PARAM_LABEL_CLASS_NAME2'), 'shipment_classcategory_name2');
246        $objFormParam->addParam(t('PARAM_LABEL_PRICE'), 'shipment_price', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
247        $objFormParam->addParam(t('PARAM_LABEL_QUANTITY'), 'shipment_quantity', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), '0');
248
249        $objFormParam->addParam(t('PARAM_LABEL_PRODUCT_NO'), 'no', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
250        $objFormParam->addParam(t('PARAM_LABEL_ADD_PRODUCT_CLASS_ID'), 'add_product_class_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
251        $objFormParam->addParam(t('PARAM_LABEL_EDIT_PRODUCT_CLASS_ID'), 'edit_product_class_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
252        $objFormParam->addParam(t('PARAM_LABEL_ANCHOR_KEY'), 'anchor_key', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
253    }
254
255    /**
256     * 受注データを取得して, SC_FormParam へ設定する.
257     *
258     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
259     * @param integer $order_id 取得元の受注ID
260     * @return void
261     */
262    function setOrderToFormParam(&$objFormParam, $order_id) {
263        $objPurchase = new SC_Helper_Purchase_Ex();
264
265        // 受注詳細を設定
266        $arrOrderDetail = $objPurchase->getOrderDetail($order_id, false);
267        $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrOrderDetail));
268
269        $arrShippingsTmp = $objPurchase->getShippings($order_id);
270        $arrShippings = array();
271        foreach ($arrShippingsTmp as $row) {
272            // お届け日の処理
273            if (!SC_Utils_Ex::isBlank($row['shipping_date'])) {
274                $ts = strtotime($row['shipping_date']);
275                $row['shipping_date_year'] = date('Y', $ts);
276                $row['shipping_date_month'] = date('n', $ts);
277                $row['shipping_date_day'] = date('j', $ts);
278            }
279            $arrShippings[$row['shipping_id']] = $row;
280        }
281        $objFormParam->setValue('shipping_quantity', count($arrShippings));
282        $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrShippings));
283
284        /*
285         * 配送商品を設定
286         *
287         * $arrShipmentItem['shipment_(key)'][$shipping_id][$item_index] = 値
288         * $arrProductQuantity[$shipping_id] = 配送先ごとの配送商品数量
289         */
290        $arrProductQuantity = array();
291        $arrShipmentItem = array();
292        foreach ($arrShippings as $shipping_id => $arrShipping) {
293            $arrProductQuantity[$shipping_id] = count($arrShipping['shipment_item']);
294            foreach ($arrShipping['shipment_item'] as $item_index => $arrItem) {
295                foreach ($arrItem as $item_key => $item_val) {
296                    $arrShipmentItem['shipment_' . $item_key][$shipping_id][$item_index] = $item_val;
297                }
298            }
299        }
300        $objFormParam->setValue('shipping_product_quantity', $arrProductQuantity);
301        $objFormParam->setParam($arrShipmentItem);
302
303        /*
304         * 受注情報を設定
305         * $arrOrderDetail と項目が重複しており, $arrOrderDetail は連想配列の値
306         * が渡ってくるため, $arrOrder で上書きする.
307         */
308        $arrOrder = $objPurchase->getOrder($order_id);
309        $objFormParam->setParam($arrOrder);
310
311        // ポイントを設定
312        list($db_point, $rollback_point) = SC_Helper_DB_Ex::sfGetRollbackPoint(
313            $order_id, $arrOrder['use_point'], $arrOrder['add_point'], $arrOrder['status']
314        );
315        $objFormParam->setValue('total_point', $db_point);
316        $objFormParam->setValue('point', $rollback_point);
317
318        if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) {
319            $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($objFormParam->getValue('customer_id'));
320            $objFormParam->setValue('customer_point', $arrCustomer['point']);
321        }
322    }
323
324}
Note: See TracBrowser for help on using the repository browser.