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