1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2011 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_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php'; |
---|
26 | |
---|
27 | /** |
---|
28 | * 受注管理 のページクラス |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Admin_Order extends LC_Page_Admin_Ex { |
---|
35 | |
---|
36 | // }}} |
---|
37 | // {{{ functions |
---|
38 | |
---|
39 | /** |
---|
40 | * Page を初期化する. |
---|
41 | * |
---|
42 | * @return void |
---|
43 | */ |
---|
44 | function init() { |
---|
45 | parent::init(); |
---|
46 | $this->tpl_mainpage = 'order/index.tpl'; |
---|
47 | $this->tpl_mainno = 'order'; |
---|
48 | $this->tpl_subno = 'index'; |
---|
49 | $this->tpl_pager = 'pager.tpl'; |
---|
50 | $this->tpl_maintitle = '受注管理'; |
---|
51 | $this->tpl_subtitle = '受注管理'; |
---|
52 | |
---|
53 | $masterData = new SC_DB_MasterData_Ex(); |
---|
54 | $this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status"); |
---|
55 | $this->arrORDERSTATUS_COLOR = $masterData->getMasterData("mtb_order_status_color"); |
---|
56 | $this->arrSex = $masterData->getMasterData("mtb_sex"); |
---|
57 | $this->arrPageMax = $masterData->getMasterData("mtb_page_max"); |
---|
58 | |
---|
59 | $objDate = new SC_Date_Ex(); |
---|
60 | // 登録・更新日検索用 |
---|
61 | $objDate->setStartYear(RELEASE_YEAR); |
---|
62 | $objDate->setEndYear(DATE('Y')); |
---|
63 | $this->arrRegistYear = $objDate->getYear(); |
---|
64 | // 生年月日検索用 |
---|
65 | $objDate->setStartYear(BIRTH_YEAR); |
---|
66 | $objDate->setEndYear(DATE('Y')); |
---|
67 | $this->arrBirthYear = $objDate->getYear(); |
---|
68 | // 月日の設定 |
---|
69 | $this->arrMonth = $objDate->getMonth(); |
---|
70 | $this->arrDay = $objDate->getDay(); |
---|
71 | |
---|
72 | // 支払い方法の取得 |
---|
73 | $this->arrPayments = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); |
---|
74 | |
---|
75 | $this->httpCacheControl('nocache'); |
---|
76 | } |
---|
77 | |
---|
78 | /** |
---|
79 | * Page のプロセス. |
---|
80 | * |
---|
81 | * @return void |
---|
82 | */ |
---|
83 | function process() { |
---|
84 | $this->action(); |
---|
85 | $this->sendResponse(); |
---|
86 | } |
---|
87 | |
---|
88 | /** |
---|
89 | * Page のアクション. |
---|
90 | * |
---|
91 | * @return void |
---|
92 | */ |
---|
93 | function action() { |
---|
94 | $objFormParam = new SC_FormParam_Ex(); |
---|
95 | $this->lfInitParam($objFormParam); |
---|
96 | $objFormParam->setParam($_POST); |
---|
97 | $this->arrHidden = $objFormParam->getSearchArray(); |
---|
98 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
99 | |
---|
100 | switch($this->getMode()) { |
---|
101 | // 削除 |
---|
102 | case 'delete': |
---|
103 | $this->doDelete('order_id = ?', |
---|
104 | array($objFormParam->getValue('order_id'))); |
---|
105 | // 削除後に検索結果を表示するため breakしない |
---|
106 | |
---|
107 | // 検索パラメーター生成後に処理実行するため breakしない |
---|
108 | case 'csv': |
---|
109 | case 'delete_all': |
---|
110 | |
---|
111 | // 検索パラメーターの生成 |
---|
112 | case 'search': |
---|
113 | $objFormParam->convParam(); |
---|
114 | $objFormParam->trimParam(); |
---|
115 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
116 | $arrParam = $objFormParam->getHashArray(); |
---|
117 | |
---|
118 | if (count($this->arrErr) == 0) { |
---|
119 | $where = "del_flg = 0"; |
---|
120 | foreach ($arrParam as $key => $val) { |
---|
121 | if($val == "") { |
---|
122 | continue; |
---|
123 | } |
---|
124 | $this->buildQuery($key, $where, $arrval, $objFormParam); |
---|
125 | } |
---|
126 | |
---|
127 | $order = "update_date DESC"; |
---|
128 | |
---|
129 | /* ----------------------------------------------- |
---|
130 | * 処理を実行 |
---|
131 | * ----------------------------------------------- */ |
---|
132 | switch($this->getMode()) { |
---|
133 | // CSVを送信する。 |
---|
134 | case 'csv': |
---|
135 | $this->doOutputCSV($where, $arrval,$order); |
---|
136 | exit; |
---|
137 | break; |
---|
138 | |
---|
139 | // 全件削除(ADMIN_MODE) |
---|
140 | case 'delete_all': |
---|
141 | $this->doDelete($where, $arrval); |
---|
142 | break; |
---|
143 | |
---|
144 | // 検索実行 |
---|
145 | default: |
---|
146 | // 行数の取得 |
---|
147 | $this->tpl_linemax = $this->getNumberOfLines($where, $arrval); |
---|
148 | // ページ送りの処理 |
---|
149 | $page_max = SC_Utils_Ex::sfGetSearchPageMax($objFormParam->getValue('search_page_max')); |
---|
150 | // ページ送りの取得 |
---|
151 | $objNavi = new SC_PageNavi_Ex($this->arrHidden['search_pageno'], |
---|
152 | $this->tpl_linemax, $page_max, |
---|
153 | 'fnNaviSearchPage', NAVI_PMAX); |
---|
154 | $this->arrPagenavi = $objNavi->arrPagenavi; |
---|
155 | |
---|
156 | // 検索結果の取得 |
---|
157 | $this->arrResults = $this->findOrders($where, $arrval, |
---|
158 | $page_max, $objNavi->start_row, $order); |
---|
159 | } |
---|
160 | } |
---|
161 | break; |
---|
162 | default: |
---|
163 | } |
---|
164 | } |
---|
165 | |
---|
166 | /** |
---|
167 | * デストラクタ. |
---|
168 | * |
---|
169 | * @return void |
---|
170 | */ |
---|
171 | function destroy() { |
---|
172 | parent::destroy(); |
---|
173 | } |
---|
174 | |
---|
175 | /** |
---|
176 | * パラメーター情報の初期化を行う. |
---|
177 | * |
---|
178 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
179 | * @return void |
---|
180 | */ |
---|
181 | function lfInitParam(&$objFormParam) { |
---|
182 | $objFormParam->addParam("注文番号1", "search_order_id1", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
183 | $objFormParam->addParam("注文番号2", "search_order_id2", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
184 | $objFormParam->addParam("対応状況", "search_order_status", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
185 | $objFormParam->addParam("注文者 お名前", "search_order_name", STEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK")); |
---|
186 | $objFormParam->addParam("注文者 お名前(フリガナ)", "search_order_kana", STEXT_LEN, 'KVCa', array("KANA_CHECK","MAX_LENGTH_CHECK")); |
---|
187 | $objFormParam->addParam("性別", "search_order_sex", INT_LEN, 'n', array("MAX_LENGTH_CHECK")); |
---|
188 | $objFormParam->addParam("年齢1", "search_age1", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
189 | $objFormParam->addParam("年齢2", "search_age2", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
190 | $objFormParam->addParam("メールアドレス", "search_order_email", STEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK")); |
---|
191 | $objFormParam->addParam('TEL', "search_order_tel", STEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK")); |
---|
192 | $objFormParam->addParam("支払い方法", "search_payment_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
193 | $objFormParam->addParam("購入金額1", "search_total1", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
194 | $objFormParam->addParam("購入金額2", "search_total2", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
195 | $objFormParam->addParam("表示件数", "search_page_max", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
196 | // 受注日 |
---|
197 | $objFormParam->addParam("開始年", "search_sorderyear", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
198 | $objFormParam->addParam("開始月", "search_sordermonth", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
199 | $objFormParam->addParam("開始日", "search_sorderday", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
200 | $objFormParam->addParam("終了年", "search_eorderyear", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
201 | $objFormParam->addParam("終了月", "search_eordermonth", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
202 | $objFormParam->addParam("終了日", "search_eorderday", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
203 | // 更新日 |
---|
204 | $objFormParam->addParam("開始年", "search_supdateyear", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
205 | $objFormParam->addParam("開始月", "search_supdatemonth", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
206 | $objFormParam->addParam("開始日", "search_supdateday", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
207 | $objFormParam->addParam("終了年", "search_eupdateyear", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
208 | $objFormParam->addParam("終了月", "search_eupdatemonth", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
209 | $objFormParam->addParam("終了日", "search_eupdateday", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
210 | // 生年月日 |
---|
211 | $objFormParam->addParam("開始年", "search_sbirthyear", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
212 | $objFormParam->addParam("開始月", "search_sbirthmonth", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
213 | $objFormParam->addParam("開始日", "search_sbirthday", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
214 | $objFormParam->addParam("終了年", "search_ebirthyear", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
215 | $objFormParam->addParam("終了月", "search_ebirthmonth", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
216 | $objFormParam->addParam("終了日", "search_ebirthday", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
217 | $objFormParam->addParam("購入商品","search_product_name",STEXT_LEN,'KVa',array("MAX_LENGTH_CHECK")); |
---|
218 | $objFormParam->addParam("ページ送り番号","search_pageno", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
219 | $objFormParam->addParam("受注ID", "order_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
220 | } |
---|
221 | |
---|
222 | /** |
---|
223 | * 入力内容のチェックを行う. |
---|
224 | * |
---|
225 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
226 | * @return void |
---|
227 | */ |
---|
228 | function lfCheckError(&$objFormParam) { |
---|
229 | $objErr = new SC_CheckError_Ex($objFormParam->getHashArray()); |
---|
230 | $objErr->arrErr = $objFormParam->checkError(); |
---|
231 | |
---|
232 | // 相関チェック |
---|
233 | $objErr->doFunc(array("注文番号1", "注文番号2", "search_order_id1", "search_order_id2"), array("GREATER_CHECK")); |
---|
234 | $objErr->doFunc(array("年齢1", "年齢2", "search_age1", "search_age2"), array("GREATER_CHECK")); |
---|
235 | $objErr->doFunc(array("購入金額1", "購入金額2", "search_total1", "search_total2"), array("GREATER_CHECK")); |
---|
236 | // 受注日 |
---|
237 | $objErr->doFunc(array("開始", "search_sorderyear", "search_sordermonth", "search_sorderday"), array("CHECK_DATE")); |
---|
238 | $objErr->doFunc(array("終了", "search_eorderyear", "search_eordermonth", "search_eorderday"), array("CHECK_DATE")); |
---|
239 | $objErr->doFunc(array("開始", "終了", "search_sorderyear", "search_sordermonth", "search_sorderday", "search_eorderyear", "search_eordermonth", "search_eorderday"), array("CHECK_SET_TERM")); |
---|
240 | // 更新日 |
---|
241 | $objErr->doFunc(array("開始", "search_supdateyear", "search_supdatemonth", "search_supdateday"), array("CHECK_DATE")); |
---|
242 | $objErr->doFunc(array("終了", "search_eupdateyear", "search_eupdatemonth", "search_eupdateday"), array("CHECK_DATE")); |
---|
243 | $objErr->doFunc(array("開始", "終了", "search_supdateyear", "search_supdatemonth", "search_supdateday", "search_eupdateyear", "search_eupdatemonth", "search_eupdateday"), array("CHECK_SET_TERM")); |
---|
244 | // 生年月日 |
---|
245 | $objErr->doFunc(array("開始", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday"), array("CHECK_DATE")); |
---|
246 | $objErr->doFunc(array("終了", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_DATE")); |
---|
247 | $objErr->doFunc(array("開始", "終了", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_SET_TERM")); |
---|
248 | |
---|
249 | return $objErr->arrErr; |
---|
250 | } |
---|
251 | |
---|
252 | /** |
---|
253 | * クエリを構築する. |
---|
254 | * |
---|
255 | * 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する. |
---|
256 | * クエリパラメーターは, SC_FormParam の入力値から取得する. |
---|
257 | * |
---|
258 | * 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される. |
---|
259 | * |
---|
260 | * @param string $key 検索条件のキー |
---|
261 | * @param string $where 構築する WHERE 句 |
---|
262 | * @param array $arrValues 構築するクエリパラメーター |
---|
263 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
264 | * @return void |
---|
265 | */ |
---|
266 | function buildQuery($key, &$where, &$arrValues, &$objFormParam) { |
---|
267 | $dbFactory = SC_DB_DBFactory_Ex::getInstance(); |
---|
268 | switch ($key) { |
---|
269 | |
---|
270 | case 'search_product_name': |
---|
271 | $where .= " AND EXISTS (SELECT 1 FROM dtb_order_detail od WHERE od.order_id = dtb_order.order_id AND od.product_name LIKE ?)"; |
---|
272 | $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key)); |
---|
273 | break; |
---|
274 | case 'search_order_name': |
---|
275 | $where .= " AND " . $dbFactory->concatColumn(array("order_name01", "order_name02")) . " LIKE ?"; |
---|
276 | $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key)); |
---|
277 | break; |
---|
278 | case 'search_order_kana': |
---|
279 | $where .= " AND " . $dbFactory->concatColumn(array("order_kana01", "order_kana02")) . " LIKE ?"; |
---|
280 | $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key)); |
---|
281 | break; |
---|
282 | case 'search_order_id1': |
---|
283 | $where .= " AND order_id >= ?"; |
---|
284 | $arrValues[] = sprintf('%d', $objFormParam->getValue($key)); |
---|
285 | break; |
---|
286 | case 'search_order_id2': |
---|
287 | $where .= " AND order_id <= ?"; |
---|
288 | $arrValues[] = sprintf('%d', $objFormParam->getValue($key)); |
---|
289 | break; |
---|
290 | case 'search_order_sex': |
---|
291 | $tmp_where = ""; |
---|
292 | foreach($objFormParam->getValue($key) as $element) { |
---|
293 | if($element != "") { |
---|
294 | if(SC_Utils_Ex::isBlank($tmp_where)) { |
---|
295 | $tmp_where .= " AND (order_sex = ?"; |
---|
296 | } else { |
---|
297 | $tmp_where .= " OR order_sex = ?"; |
---|
298 | } |
---|
299 | $arrValues[] = $element; |
---|
300 | } |
---|
301 | } |
---|
302 | |
---|
303 | if(!SC_Utils_Ex::isBlank($tmp_where)) { |
---|
304 | $tmp_where .= ")"; |
---|
305 | $where .= " $tmp_where "; |
---|
306 | } |
---|
307 | break; |
---|
308 | case 'search_order_tel': |
---|
309 | $where .= " AND (" . $dbFactory->concatColumn(array("order_tel01", "order_tel02", "order_tel03")) . " LIKE ?)"; |
---|
310 | $arrValues[] = sprintf('%%%d%%', preg_replace('/[()-]+/','', $objFormParam->getValue($key))); |
---|
311 | break; |
---|
312 | case 'search_order_email': |
---|
313 | $where .= " AND order_email LIKE ?"; |
---|
314 | $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key)); |
---|
315 | break; |
---|
316 | case 'search_payment_id': |
---|
317 | $tmp_where = ""; |
---|
318 | foreach($objFormParam->getValue($key) as $element) { |
---|
319 | if($element != "") { |
---|
320 | if($tmp_where == "") { |
---|
321 | $tmp_where .= " AND (payment_id = ?"; |
---|
322 | } else { |
---|
323 | $tmp_where .= " OR payment_id = ?"; |
---|
324 | } |
---|
325 | $arrValues[] = $element; |
---|
326 | } |
---|
327 | } |
---|
328 | |
---|
329 | if(!SC_Utils_Ex::isBlank($tmp_where)) { |
---|
330 | $tmp_where .= ")"; |
---|
331 | $where .= " $tmp_where "; |
---|
332 | } |
---|
333 | break; |
---|
334 | case 'search_total1': |
---|
335 | $where .= " AND total >= ?"; |
---|
336 | $arrValues[] = sprintf('%d', $objFormParam->getValue($key)); |
---|
337 | break; |
---|
338 | case 'search_total2': |
---|
339 | $where .= " AND total <= ?"; |
---|
340 | $arrValues[] = sprintf('%d', $objFormParam->getValue($key)); |
---|
341 | break; |
---|
342 | case 'search_sorderyear': |
---|
343 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_sorderyear'), |
---|
344 | $objFormParam->getValue('search_sordermonth'), |
---|
345 | $objFormParam->getValue('search_sorderday')); |
---|
346 | $where.= " AND create_date >= ?"; |
---|
347 | $arrValues[] = $date; |
---|
348 | break; |
---|
349 | case 'search_eorderyear': |
---|
350 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_eorderyear'), |
---|
351 | $objFormParam->getValue('search_eordermonth'), |
---|
352 | $objFormParam->getValue('search_eorderday'), true); |
---|
353 | $where.= " AND create_date <= ?"; |
---|
354 | $arrValues[] = $date; |
---|
355 | break; |
---|
356 | case 'search_supdateyear': |
---|
357 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_supdateyear'), |
---|
358 | $objFormParam->getValue('search_supdatemonth'), |
---|
359 | $objFormParam->getValue('search_supdateday')); |
---|
360 | $where.= " AND update_date >= ?"; |
---|
361 | $arrValues[] = $date; |
---|
362 | break; |
---|
363 | case 'search_eupdateyear': |
---|
364 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_eupdateyear'), |
---|
365 | $objFormParam->getValue('search_eupdatemonth'), |
---|
366 | $objFormParam->getValue('search_eupdateday'), true); |
---|
367 | $where.= " AND update_date <= ?"; |
---|
368 | $arrValues[] = $date; |
---|
369 | break; |
---|
370 | case 'search_sbirthyear': |
---|
371 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_sbirthyear'), |
---|
372 | $objFormParam->getValue('search_sbirthmonth'), |
---|
373 | $objFormParam->getValue('search_sbirthday')); |
---|
374 | $where.= " AND order_birth >= ?"; |
---|
375 | $arrValues[] = $date; |
---|
376 | break; |
---|
377 | case 'search_ebirthyear': |
---|
378 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_ebirthyear'), |
---|
379 | $objFormParam->getValue('search_ebirthmonth'), |
---|
380 | $objFormParam->getValue('search_ebirthday'), true); |
---|
381 | $where.= " AND order_birth <= ?"; |
---|
382 | $arrValues[] = $date; |
---|
383 | break; |
---|
384 | case 'search_order_status': |
---|
385 | $where.= " AND status = ?"; |
---|
386 | $arrValues[] = $objFormParam->getValue($key); |
---|
387 | break; |
---|
388 | default: |
---|
389 | } |
---|
390 | } |
---|
391 | |
---|
392 | /** |
---|
393 | * 受注を削除する. |
---|
394 | * |
---|
395 | * @param string $where 削除対象の WHERE 句 |
---|
396 | * @param array $arrParam 削除対象の値 |
---|
397 | * @return void |
---|
398 | */ |
---|
399 | function doDelete($where, $arrParam = array()) { |
---|
400 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
401 | $sqlval['del_flg'] = 1; |
---|
402 | $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
403 | $objQuery->update("dtb_order", $sqlval, $where, $arrParam); |
---|
404 | } |
---|
405 | |
---|
406 | /** |
---|
407 | * CSV データを構築して取得する. |
---|
408 | * |
---|
409 | * 構築に成功した場合は, ファイル名と出力内容を配列で返す. |
---|
410 | * 構築に失敗した場合は, false を返す. |
---|
411 | * |
---|
412 | * @param string $where 検索条件の WHERE 句 |
---|
413 | * @param array $arrVal 検索条件のパラメーター |
---|
414 | * @param string $order 検索結果の並び順 |
---|
415 | * @return void |
---|
416 | */ |
---|
417 | function doOutputCSV($where, $arrVal, $order) { |
---|
418 | require_once CLASS_EX_REALDIR . 'helper_extends/SC_Helper_CSV_Ex.php'; |
---|
419 | if($where != "") { |
---|
420 | $where = " WHERE $where "; |
---|
421 | } |
---|
422 | |
---|
423 | $objCSV = new SC_Helper_CSV_Ex(); |
---|
424 | $objCSV->sfDownloadCsv("3", $where, $arrVal, $order, true); |
---|
425 | } |
---|
426 | |
---|
427 | /** |
---|
428 | * 検索結果の行数を取得する. |
---|
429 | * |
---|
430 | * @param string $where 検索条件の WHERE 句 |
---|
431 | * @param array $arrValues 検索条件のパラメーター |
---|
432 | * @return integer 検索結果の行数 |
---|
433 | */ |
---|
434 | function getNumberOfLines($where, $arrValues) { |
---|
435 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
436 | return $objQuery->count('dtb_order', $where, $arrValues); |
---|
437 | } |
---|
438 | |
---|
439 | /** |
---|
440 | * 受注を検索する. |
---|
441 | * |
---|
442 | * @param string $where 検索条件の WHERE 句 |
---|
443 | * @param array $arrValues 検索条件のパラメーター |
---|
444 | * @param integer $limit 表示件数 |
---|
445 | * @param integer $offset 開始件数 |
---|
446 | * @param string $order 検索結果の並び順 |
---|
447 | * @return array 受注の検索結果 |
---|
448 | */ |
---|
449 | function findOrders($where, $arrValues, $limit, $offset, $order) { |
---|
450 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
451 | $objQuery->setLimitOffset($limit, $offset); |
---|
452 | $objQuery->setOrder($order); |
---|
453 | return $objQuery->select('*', 'dtb_order', $where, $arrValues); |
---|
454 | } |
---|
455 | } |
---|