source: branches/comu-ver2/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php @ 17422

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