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 |
---|
25 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * ステータス管理 のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class 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 | |
---|
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 'update': |
---|
82 | if (!isset($_POST['change_status'])) $_POST['change_status'] = ""; |
---|
83 | |
---|
84 | switch ($_POST['change_status']) { |
---|
85 | case '': |
---|
86 | break; |
---|
87 | |
---|
88 | // 削除 |
---|
89 | case 'delete': |
---|
90 | $this->lfDelete($_POST['move']); |
---|
91 | break; |
---|
92 | |
---|
93 | // 更新 |
---|
94 | default: |
---|
95 | $this->lfStatusMove($_POST['change_status'], $_POST['move']); |
---|
96 | break; |
---|
97 | } |
---|
98 | |
---|
99 | //ステータス情報 |
---|
100 | $status = isset($_POST['status']) ? $_POST['status'] : ""; |
---|
101 | break; |
---|
102 | |
---|
103 | case 'search': |
---|
104 | //ステータス情報 |
---|
105 | $status = isset($_POST['status']) ? $_POST['status'] : ""; |
---|
106 | break; |
---|
107 | |
---|
108 | default: |
---|
109 | //ステータス情報 |
---|
110 | //デフォルトで新規受付一覧表示 |
---|
111 | $status = ORDER_NEW; |
---|
112 | break; |
---|
113 | } |
---|
114 | |
---|
115 | //ステータス情報 |
---|
116 | $this->SelectedStatus = $status; |
---|
117 | //検索結果の表示 |
---|
118 | $this->lfStatusDisp($status, $_POST['search_pageno']); |
---|
119 | |
---|
120 | $objView->assignobj($this); |
---|
121 | $objView->display(MAIN_FRAME); |
---|
122 | } |
---|
123 | /** |
---|
124 | * デストラクタ. |
---|
125 | * |
---|
126 | * @return void |
---|
127 | */ |
---|
128 | function destroy() { |
---|
129 | parent::destroy(); |
---|
130 | } |
---|
131 | |
---|
132 | //ステータス一覧の表示 |
---|
133 | function lfStatusDisp($status,$pageno){ |
---|
134 | $objQuery = new SC_Query(); |
---|
135 | |
---|
136 | $select ="*"; |
---|
137 | $from = "dtb_order"; |
---|
138 | $where = "del_flg = 0 AND status = ?"; |
---|
139 | $arrval[] = $status; |
---|
140 | $order = "order_id DESC"; |
---|
141 | |
---|
142 | $linemax = $objQuery->count($from, $where, $arrval); |
---|
143 | $this->tpl_linemax = $linemax; |
---|
144 | |
---|
145 | // ページ送りの処理 |
---|
146 | $page_max = ORDER_STATUS_MAX; |
---|
147 | |
---|
148 | // ページ送りの取得 |
---|
149 | $objNavi = new SC_PageNavi($pageno, $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); |
---|
150 | $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 |
---|
151 | $startno = $objNavi->start_row; |
---|
152 | |
---|
153 | $this->tpl_pageno = $pageno; |
---|
154 | |
---|
155 | // 取得範囲の指定(開始行番号、行数のセット) |
---|
156 | $objQuery->setlimitoffset($page_max, $startno); |
---|
157 | |
---|
158 | //表示順序 |
---|
159 | $objQuery->setorder($order); |
---|
160 | |
---|
161 | //検索結果の取得 |
---|
162 | $this->arrStatus = $objQuery->select($select, $from, $where, $arrval); |
---|
163 | } |
---|
164 | |
---|
165 | /** |
---|
166 | * ステータス情報の更新 |
---|
167 | */ |
---|
168 | function lfStatusMove($statusId, $arrOrderId) { |
---|
169 | $objQuery = new SC_Query(); |
---|
170 | |
---|
171 | if (!isset($arrOrderId) || !is_array($arrOrderId)) { |
---|
172 | return false; |
---|
173 | } |
---|
174 | $masterData = new SC_DB_MasterData_Ex(); |
---|
175 | $arrORDERSTATUS = $masterData->getMasterData("mtb_order_status"); |
---|
176 | |
---|
177 | $objQuery->begin(); |
---|
178 | |
---|
179 | foreach ($arrOrderId as $orderId) { |
---|
180 | SC_Helper_DB_Ex::sfUpdateOrderStatus($orderId, $statusId); |
---|
181 | } |
---|
182 | |
---|
183 | $objQuery->commit(); |
---|
184 | |
---|
185 | $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');"; |
---|
186 | return true; |
---|
187 | } |
---|
188 | |
---|
189 | /** |
---|
190 | * 受注テーブルの論理削除 |
---|
191 | */ |
---|
192 | function lfDelete($arrOrderId) { |
---|
193 | $objQuery = new SC_Query(); |
---|
194 | |
---|
195 | if (!isset($arrOrderId) || !is_array($arrOrderId)) { |
---|
196 | return false; |
---|
197 | } |
---|
198 | |
---|
199 | $arrUpdate = array( |
---|
200 | 'del_flg' => 1 |
---|
201 | ,'update_date' => 'Now()' |
---|
202 | ); |
---|
203 | |
---|
204 | $objQuery->begin(); |
---|
205 | |
---|
206 | foreach ($arrOrderId as $orderId) { |
---|
207 | $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId)); |
---|
208 | } |
---|
209 | |
---|
210 | $objQuery->commit(); |
---|
211 | |
---|
212 | $this->tpl_onload = "window.alert('選択項目を削除しました。');"; |
---|
213 | return true; |
---|
214 | } |
---|
215 | } |
---|
216 | ?> |
---|