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

Revision 22926, 7.0 KB checked in by Seasoft, 11 years ago (diff)

#2287 (環境によりデストラクタが正しく動作しないケースがある)
#2288 (リクエスト単位で実行されるべきログ出力がブロックにも適用されている)
#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 不明確な仕様にコメントを残した。
  • 親デストラクタを呼ぶだけの記述は可読性が悪くなると考え削除した。(上述のチケットで OS の仕様に依存したデストラクタとなるため、敢えてアプリケーション側で記述しておく意義は薄れたという認識のもと。)
  • 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     *  @param SC_FormParam
120     */
121    function lfInitParam(&$objFormParam)
122    {
123        $objFormParam->addParam('注文番号', 'order_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
124        $objFormParam->addParam('変更前対応状況', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
125        $objFormParam->addParam('ページ番号', 'search_pageno', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
126        if ($this->getMode() == 'update') {
127            $objFormParam->addParam('変更後対応状況', 'change_status', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
128            $objFormParam->addParam('移動注文番号', 'move', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
129        }
130    }
131
132    /**
133     *  入力内容のチェック
134     *  @param SC_FormParam
135     */
136    function lfCheckError(&$objFormParam)
137    {
138        // 入力データを渡す。
139        $arrRet = $objFormParam->getHashArray();
140        $arrErr = $objFormParam->checkError();
141        if (is_null($objFormParam->getValue('search_pageno'))) {
142            $objFormParam->setValue('search_pageno', 1);
143        }
144    }
145
146    // 対応状況一覧の表示
147    function lfStatusDisp($status,$pageno)
148    {
149        $objQuery =& SC_Query_Ex::getSingletonInstance();
150
151        $select ='*';
152        $from = 'dtb_order';
153        $where = 'del_flg = 0 AND status = ?';
154        $arrWhereVal = array($status);
155        $order = 'order_id DESC';
156
157        $linemax = $objQuery->count($from, $where, $arrWhereVal);
158        $this->tpl_linemax = $linemax;
159
160        // ページ送りの処理
161        $page_max = ORDER_STATUS_MAX;
162
163        // ページ送りの取得
164        $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'fnNaviSearchOnlyPage', NAVI_PMAX);
165        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
166        $startno = $objNavi->start_row;
167
168        $this->tpl_pageno = $pageno;
169
170        // 取得範囲の指定(開始行番号、行数のセット)
171        $objQuery->setLimitOffset($page_max, $startno);
172
173        //表示順序
174        $objQuery->setOrder($order);
175
176        //検索結果の取得
177        $this->arrStatus = $objQuery->select($select, $from, $where, $arrWhereVal);
178    }
179
180    /**
181     * 対応状況の更新
182     */
183    function lfStatusMove($statusId, $arrOrderId)
184    {
185        $objPurchase = new SC_Helper_Purchase_Ex();
186        $objQuery =& SC_Query_Ex::getSingletonInstance();
187
188        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
189            return false;
190        }
191        $masterData = new SC_DB_MasterData_Ex();
192        $arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
193
194        $objQuery->begin();
195
196        foreach ($arrOrderId as $orderId) {
197            $objPurchase->sfUpdateOrderStatus($orderId, $statusId);
198        }
199
200        $objQuery->commit();
201
202        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
203
204        return true;
205    }
206
207    /**
208     * 受注テーブルの論理削除
209     */
210    function lfDelete($arrOrderId)
211    {
212        $objQuery =& SC_Query_Ex::getSingletonInstance();
213
214        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
215            return false;
216        }
217
218        $objPurchase = new SC_Helper_Purchase_Ex();
219        foreach ($arrOrderId as $orderId) {
220            $objPurchase->cancelOrder($orderId, ORDER_CANCEL, true);
221        }
222
223        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
224
225        return true;
226    }
227}
Note: See TracBrowser for help on using the repository browser.