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

Revision 16582, 6.6 KB checked in by nanasess, 16 years ago (diff)

ライセンス表記変更

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