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

Revision 20538, 7.7 KB checked in by Seasoft, 13 years ago (diff)

#627(ソース整形・ソースコメントの改善)
#628(未使用処理・定義などの削除)

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