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

Revision 19661, 6.2 KB checked in by nanasess, 13 years ago (diff)

source:branches/camp/camp-2_5-E のマージ

  • スマートフォン対応(#787)
  • プラグイン機能(#494)
  • Property svn:eol-style set to LF
  • Property svn:keywords set to "Id Revision Date"
  • 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_PATH . "pages/admin/LC_Page_Admin.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 {
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        $objSess = new SC_Session();
74        $objDb = new SC_Helper_DB_Ex();
75
76        // 認証可否の判定
77        $objSess = new SC_Session();
78        SC_Utils_Ex::sfIsSuccess($objSess);
79
80        $this->arrForm = $_POST;
81
82        //支払方法の取得
83        $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
84
85        if (!isset($_POST['mode'])) $_POST['mode'] = "";
86        if (!isset($_POST['search_pageno'])) $_POST['search_pageno'] = 1;
87
88        switch ($_POST['mode']){
89
90        case 'update':
91            if (!isset($_POST['change_status'])) $_POST['change_status'] = "";
92           
93            switch ($_POST['change_status']) {
94                case '':
95                    break;
96               
97                // 削除
98                case 'delete':
99                    $this->lfDelete($_POST['move']);
100                    break;
101               
102                // 更新
103                default:
104                    $this->lfStatusMove($_POST['change_status'], $_POST['move']);
105                    break;
106            }
107           
108            //ステータス情報
109            $status = isset($_POST['status']) ? $_POST['status'] : "";
110            break;
111
112        case 'search':
113            //ステータス情報
114            $status = isset($_POST['status']) ? $_POST['status'] : "";
115            break;
116
117        default:
118            //ステータス情報
119            //デフォルトで新規受付一覧表示
120            $status = ORDER_NEW;
121            break;
122        }
123
124        //ステータス情報
125        $this->SelectedStatus = $status;
126        //検索結果の表示
127        $this->lfStatusDisp($status, $_POST['search_pageno']);
128    }
129
130    /**
131     * デストラクタ.
132     *
133     * @return void
134     */
135    function destroy() {
136        parent::destroy();
137    }
138
139    //ステータス一覧の表示
140    function lfStatusDisp($status,$pageno){
141        $objQuery = new SC_Query();
142
143        $select ="*";
144        $from = "dtb_order";
145        $where = "del_flg = 0 AND status = ?";
146        $arrval[] = $status;
147        $order = "order_id DESC";
148
149        $linemax = $objQuery->count($from, $where, $arrval);
150        $this->tpl_linemax = $linemax;
151
152        // ページ送りの処理
153        $page_max = ORDER_STATUS_MAX;
154
155        // ページ送りの取得
156        $objNavi = new SC_PageNavi($pageno, $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
157        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
158        $startno = $objNavi->start_row;
159
160        $this->tpl_pageno = $pageno;
161
162        // 取得範囲の指定(開始行番号、行数のセット)
163        $objQuery->setLimitOffset($page_max, $startno);
164
165        //表示順序
166        $objQuery->setOrder($order);
167
168        //検索結果の取得
169        $this->arrStatus = $objQuery->select($select, $from, $where, $arrval);
170    }
171
172    /**
173     * ステータス情報の更新
174     */
175    function lfStatusMove($statusId, $arrOrderId) {
176        $objQuery = new SC_Query();
177       
178        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
179            return false;
180        }
181        $masterData = new SC_DB_MasterData_Ex();
182        $arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
183       
184        $objQuery->begin();
185       
186        foreach ($arrOrderId as $orderId) {
187            SC_Helper_DB_Ex::sfUpdateOrderStatus($orderId, $statusId);
188        }
189       
190        $objQuery->commit();
191       
192        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
193        return true;
194    }
195
196    /**
197     * 受注テーブルの論理削除
198     */
199    function lfDelete($arrOrderId) {
200        $objQuery = new SC_Query();
201       
202        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
203            return false;
204        }
205       
206        $arrUpdate = array(
207             'del_flg' => 1
208            ,'update_date' => 'Now()'
209        );
210       
211        $objQuery->begin();
212       
213        foreach ($arrOrderId as $orderId) {
214            $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId));
215        }
216       
217        $objQuery->commit();
218       
219        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
220        return true;
221    }
222}
223?>
Note: See TracBrowser for help on using the repository browser.