source: branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php @ 22856

Revision 22856, 7.1 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 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
24require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
25
26/**
27 * 対応状況管理 のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_Admin_Order_Status extends LC_Page_Admin_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43        $this->tpl_mainpage = 'order/status.tpl';
44        $this->tpl_mainno = 'order';
45        $this->tpl_subno = 'status';
46        $this->tpl_maintitle = '受注管理';
47        $this->tpl_subtitle = '対応状況管理';
48
49        $masterData = new SC_DB_MasterData_Ex();
50        $this->arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
51        $this->arrORDERSTATUS_COLOR = $masterData->getMasterData('mtb_order_status_color');
52    }
53
54    /**
55     * Page のプロセス.
56     *
57     * @return void
58     */
59    function process()
60    {
61        $this->action();
62        $this->sendResponse();
63    }
64
65    /**
66     * Page のアクション.
67     *
68     * @return void
69     */
70    function action()
71    {
72        $objDb = new SC_Helper_DB_Ex();
73
74        // パラメーター管理クラス
75        $objFormParam = new SC_FormParam_Ex();
76        // パラメーター情報の初期化
77        $this->lfInitParam($objFormParam);
78        $objFormParam->setParam($_POST);
79        // 入力値の変換
80        $objFormParam->convParam();
81
82        $this->arrForm = $objFormParam->getHashArray();
83
84        //支払方法の取得
85        $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
86
87        switch ($this->getMode()) {
88            case 'update':
89                switch ($objFormParam->getValue('change_status')) {
90                    // 削除
91                    case 'delete':
92                        $this->lfDelete($objFormParam->getValue('move'));
93                        break;
94                    // 更新
95                    default:
96                        $this->lfStatusMove($objFormParam->getValue('change_status'), $objFormParam->getValue('move'));
97                        break;
98                }
99                break;
100
101            case 'search':
102            default:
103                break;
104        }
105
106        // 対応状況
107        $status = $objFormParam->getValue('status');
108        if (strlen($status) === 0) {
109                //デフォルトで新規受付一覧表示
110                $status = ORDER_NEW;
111        }
112        $this->SelectedStatus = $status;
113        //検索結果の表示
114        $this->lfStatusDisp($status, $objFormParam->getValue('search_pageno'));
115
116    }
117
118    /**
119     *  パラメーター情報の初期化
120     *  @param SC_FormParam
121     */
122    function lfInitParam(&$objFormParam)
123    {
124        $objFormParam->addParam('注文番号', 'order_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
125        $objFormParam->addParam('変更前対応状況', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
126        $objFormParam->addParam('ページ番号', 'search_pageno', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
127        if ($this->getMode() == 'update') {
128            $objFormParam->addParam('変更後対応状況', 'change_status', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
129            $objFormParam->addParam('移動注文番号', 'move', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
130        }
131    }
132
133    /**
134     *  入力内容のチェック
135     *  @param SC_FormParam
136     */
137    function lfCheckError(&$objFormParam)
138    {
139        // 入力データを渡す。
140        $arrRet = $objFormParam->getHashArray();
141        $arrErr = $objFormParam->checkError();
142        if (is_null($objFormParam->getValue('search_pageno'))) {
143            $objFormParam->setValue('search_pageno', 1);
144        }
145    }
146
147    /**
148     * デストラクタ.
149     *
150     * @return void
151     */
152    function destroy()
153    {
154        parent::destroy();
155    }
156
157    // 対応状況一覧の表示
158    function lfStatusDisp($status,$pageno)
159    {
160        $objQuery =& SC_Query_Ex::getSingletonInstance();
161
162        $select ='*';
163        $from = 'dtb_order';
164        $where = 'del_flg = 0 AND status = ?';
165        $arrWhereVal = array($status);
166        $order = 'order_id DESC';
167
168        $linemax = $objQuery->count($from, $where, $arrWhereVal);
169        $this->tpl_linemax = $linemax;
170
171        // ページ送りの処理
172        $page_max = ORDER_STATUS_MAX;
173
174        // ページ送りの取得
175        $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'fnNaviSearchOnlyPage', NAVI_PMAX);
176        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
177        $startno = $objNavi->start_row;
178
179        $this->tpl_pageno = $pageno;
180
181        // 取得範囲の指定(開始行番号、行数のセット)
182        $objQuery->setLimitOffset($page_max, $startno);
183
184        //表示順序
185        $objQuery->setOrder($order);
186
187        //検索結果の取得
188        $this->arrStatus = $objQuery->select($select, $from, $where, $arrWhereVal);
189    }
190
191    /**
192     * 対応状況の更新
193     */
194    function lfStatusMove($statusId, $arrOrderId)
195    {
196        $objPurchase = new SC_Helper_Purchase_Ex();
197        $objQuery =& SC_Query_Ex::getSingletonInstance();
198
199        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
200            return false;
201        }
202        $masterData = new SC_DB_MasterData_Ex();
203        $arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
204
205        $objQuery->begin();
206
207        foreach ($arrOrderId as $orderId) {
208            $objPurchase->sfUpdateOrderStatus($orderId, $statusId);
209        }
210
211        $objQuery->commit();
212
213        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
214
215        return true;
216    }
217
218    /**
219     * 受注テーブルの論理削除
220     */
221    function lfDelete($arrOrderId)
222    {
223        $objQuery =& SC_Query_Ex::getSingletonInstance();
224
225        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
226            return false;
227        }
228
229        $objPurchase = new SC_Helper_Purchase_Ex();
230        foreach ($arrOrderId as $orderId) {
231            $objPurchase->cancelOrder($orderId, ORDER_CANCEL, true);
232        }
233
234        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
235
236        return true;
237    }
238}
Note: See TracBrowser for help on using the repository browser.