source: branches/feature-module-update/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php @ 16903

Revision 16903, 6.7 KB checked in by satou, 16 years ago (diff)
  • Property svn:eol-style set to LF
  • Property svn:keywords set to "Id Revision Date"
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 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/LC_Page.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 {
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
51        $masterData = new SC_DB_MasterData_Ex();
52        $this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
53        $this->arrORDERSTATUS_COLOR = $masterData->getMasterData("mtb_order_status_color");
54    }
55
56    /**
57     * Page のプロセス.
58     *
59     * @return void
60     */
61    function process() {
62        $objView = new SC_AdminView();
63        $objSess = new SC_Session();
64        $objDb = new SC_Helper_DB_Ex();
65        $objQuery = new SC_Query();
66
67        // 認証可否の判定
68        $objSess = new SC_Session();
69        SC_Utils_Ex::sfIsSuccess($objSess);
70
71        $this->arrForm = $_POST;
72
73        //支払方法の取得
74        $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
75
76        if (!isset($_POST['mode'])) $_POST['mode'] = "";
77        if (!isset($_POST['search_pageno'])) $_POST['search_pageno'] = 1;
78
79        switch ($_POST['mode']){
80
81        case 'search':
82            if (!isset($_POST['change_status'])) $_POST['change_status'] = "";
83            switch($_POST['change_status']){
84
85            default:
86                break;
87
88                //新規受付
89            case ORDER_NEW:
90                $this->lfStatusMove(ORDER_NEW, $_POST['move']);
91                break;
92
93                //入金待ち
94            case ORDER_PAY_WAIT:
95                $this->lfStatusMove(ORDER_PAY_WAIT, $_POST['move']);
96                break;
97
98                //キャンセル
99            case ORDER_CANCEL:
100                $this->lfStatusMove(ORDER_CANCEL, $_POST['move']);
101                break;
102
103                //取り寄せ中
104            case ORDER_BACK_ORDER:
105                $this->lfStatusMove(ORDER_BACK_ORDER, $_POST['move']);
106                break;
107
108                //発送済み
109            case ORDER_DELIV:
110                $this->lfStatusMove(ORDER_DELIV, $_POST['move']);
111                break;
112
113                //入金済み
114            case ORDER_PRE_END:
115                $this->lfStatusMove(ORDER_PRE_END, $_POST['move']);
116                break;
117
118                //削除
119            case 'delete':
120                $this->lfStatusMove("delete",$_POST['move']);
121                break;
122            }
123           
124            //ステータス情報
125            $this->SelectedStatus = isset($_POST['status']) ? $_POST['status'] : "";
126            //検索結果の表示
127            $this->lfStatusDisp($_POST['status'],$_POST['search_pageno']);
128            break;
129
130        default:
131            //ステータス情報
132            $this->SelectedStatus = ORDER_NEW;
133            //デフォルトで新規受付一覧表示
134            $this->lfStatusDisp(ORDER_NEW, $_POST['search_pageno']);
135            break;
136        }
137
138        $objView->assignobj($this);
139        $objView->display(MAIN_FRAME);
140    }
141    /**
142     * デストラクタ.
143     *
144     * @return void
145     */
146    function destroy() {
147        parent::destroy();
148    }
149
150    //ステータス一覧の表示
151    function lfStatusDisp($status,$pageno){
152        $objQuery = new SC_Query();
153
154        $select ="*";
155        $from = "dtb_order";
156        $where="del_flg=0 AND status=?";
157        $order = "order_id DESC";
158
159        $linemax = $objQuery->count("dtb_order", "del_flg = 0 AND status=?", array($status));
160        $this->tpl_linemax = $linemax;
161
162        // ページ送りの処理
163        $page_max = ORDER_STATUS_MAX;
164
165        // ページ送りの取得
166        $objNavi = new SC_PageNavi($pageno, $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
167        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
168        $startno = $objNavi->start_row;
169
170        $this->tpl_pageno = $pageno;
171
172        // 取得範囲の指定(開始行番号、行数のセット)
173        $objQuery->setlimitoffset($page_max, $startno);
174
175        //表示順序
176        $objQuery->setorder($order);
177
178        //検索結果の取得
179        $this->arrStatus = $objQuery->select($select, $from, $where, array($status));
180    }
181
182    //ステータス情報の更新(削除)
183    function lfStatusMove($status_id, $arrMove){
184        $objQuery = new SC_Query();
185        $masterData = new SC_DB_MasterData_Ex();
186        $arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
187
188        $table = 'dtb_order';
189        $where = 'order_id = ?';
190        $arrUpdate = array('update_date' => 'NOW()');
191
192        $delflg  = '1'; // 削除フラグ
193        $message = '';  // ステータス変更後にポップアップするメッセージの内容
194
195        if ( $status_id == 'delete' ) {
196            $arrUpdate['del_flg'] = $delflg;
197            $message = '削除';
198        }
199        // ステータスが発送済みの時は発送日を更新
200        elseif ( $status_id == ORDER_DELIV ) {
201            $arrUpdate['status'] = $status_id;
202            $arrUpdate['commit_date'] = 'NOW()';
203            $message = $arrORDERSTATUS[$status_id] . 'へ移動';
204        }
205        else {
206            $arrUpdate['status'] = $status_id;
207            $message = $arrORDERSTATUS[$status_id] . 'へ移動';
208        }
209
210        if ( isset($arrMove) ){
211            foreach ( $arrMove as $val ){
212                if ( $val != "" ) {
213                    $objQuery->update($table, $arrUpdate, $where, array($val));
214                }
215
216            }
217        }
218
219        $this->tpl_onload = "window.alert('選択項目を" . $message . "しました。');";
220    }
221}
222?>
Note: See TracBrowser for help on using the repository browser.