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

Revision 22796, 7.3 KB checked in by h_yoshimoto, 11 years ago (diff)

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

  • 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
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_mainno = 'order';
48        $this->tpl_subno = 'status';
49        $this->tpl_maintitle = '受注管理';
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
74        $objDb = new SC_Helper_DB_Ex();
75
76        // パラメーター管理クラス
77        $objFormParam = new SC_FormParam_Ex();
78        // パラメーター情報の初期化
79        $this->lfInitParam($objFormParam);
80        $objFormParam->setParam($_POST);
81        // 入力値の変換
82        $objFormParam->convParam();
83
84        $this->arrForm = $objFormParam->getHashArray();
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                    // 削除
93                    case 'delete':
94                        $this->lfDelete($objFormParam->getValue('move'));
95                        break;
96                    // 更新
97                    default:
98                        $this->lfStatusMove($objFormParam->getValue('change_status'), $objFormParam->getValue('move'));
99                        break;
100                }
101                break;
102
103            case 'search':
104            default:
105                break;
106        }
107
108        // 対応状況
109        $status = $objFormParam->getValue('status');
110        if (strlen($status) === 0) {
111                //デフォルトで新規受付一覧表示
112                $status = ORDER_NEW;
113        }
114        $this->SelectedStatus = $status;
115        //検索結果の表示
116        $this->lfStatusDisp($status, $objFormParam->getValue('search_pageno'));
117
118    }
119
120    /**
121     *  パラメーター情報の初期化
122     *  @param SC_FormParam
123     */
124    function lfInitParam(&$objFormParam) {
125        $objFormParam->addParam('注文番号', 'order_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
126        $objFormParam->addParam('変更前対応状況', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
127        $objFormParam->addParam('ページ番号', 'search_pageno', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
128        if ($this->getMode() == 'update') {
129            $objFormParam->addParam('変更後対応状況', 'change_status', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
130            $objFormParam->addParam('移動注文番号', 'move', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
131        }
132    }
133
134    /**
135     *  入力内容のチェック
136     *  @param SC_FormParam
137     */
138    function lfCheckError(&$objFormParam) {
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        parent::destroy();
154    }
155
156    // 対応状況一覧の表示
157    function lfStatusDisp($status,$pageno) {
158        $objQuery =& SC_Query_Ex::getSingletonInstance();
159
160        $select ='*';
161        $from = 'dtb_order';
162        $where = 'del_flg = 0 AND status = ?';
163        $arrWhereVal = array($status);
164        $order = 'order_id DESC';
165
166        $linemax = $objQuery->count($from, $where, $arrWhereVal);
167        $this->tpl_linemax = $linemax;
168
169        // ページ送りの処理
170        $page_max = ORDER_STATUS_MAX;
171
172        // ページ送りの取得
173        $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'fnNaviSearchOnlyPage', NAVI_PMAX);
174        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
175        $startno = $objNavi->start_row;
176
177        $this->tpl_pageno = $pageno;
178
179        // 取得範囲の指定(開始行番号、行数のセット)
180        $objQuery->setLimitOffset($page_max, $startno);
181
182        //表示順序
183        $objQuery->setOrder($order);
184
185        //検索結果の取得
186        $this->arrStatus = $objQuery->select($select, $from, $where, $arrWhereVal);
187    }
188
189    /**
190     * 対応状況の更新
191     */
192    function lfStatusMove($statusId, $arrOrderId) {
193        $objPurchase = new SC_Helper_Purchase_Ex();
194        $objQuery =& SC_Query_Ex::getSingletonInstance();
195
196        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
197            return false;
198        }
199        $masterData = new SC_DB_MasterData_Ex();
200        $arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
201
202        $objQuery->begin();
203
204        foreach ($arrOrderId as $orderId) {
205            $objPurchase->sfUpdateOrderStatus($orderId, $statusId);
206        }
207
208        $objQuery->commit();
209
210        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
211        return true;
212    }
213
214    /**
215     * 受注テーブルの論理削除
216     */
217    function lfDelete($arrOrderId) {
218        $objQuery =& SC_Query_Ex::getSingletonInstance();
219
220        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
221            return false;
222        }
223
224        $arrUpdate = array(
225            'del_flg'      => 1,
226            'update_date'  => 'CURRENT_TIMESTAMP',
227        );
228
229        $objQuery->begin();
230
231        foreach ($arrOrderId as $orderId) {
232            $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId));
233        }
234
235        $objQuery->commit();
236
237        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
238        return true;
239    }
240}
Note: See TracBrowser for help on using the repository browser.