source: branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php @ 21866

Revision 21866, 7.7 KB checked in by h_yoshimoto, 12 years ago (diff)

#1831 Copyrightを更新を誤っているので戻します

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
RevLine 
[15596]1<?php
2/*
[16582]3 * This file is part of EC-CUBE
4 *
[21866]5 * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
[15596]6 *
7 * http://www.lockon.co.jp/
[16582]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.
[15596]22 */
23
24// {{{ requires
[20534]25require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
[15596]26
27/**
[21182]28 * 対応状況管理 のページクラス.
[15596]29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
[20345]34class LC_Page_Admin_Order_Status extends LC_Page_Admin_Ex {
[15596]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_mainno = 'order';
48        $this->tpl_subno = 'status';
[20911]49        $this->tpl_maintitle = '受注管理';
[21182]50        $this->tpl_subtitle = '対応状況管理';
[15596]51
52        $masterData = new SC_DB_MasterData_Ex();
[21481]53        $this->arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
54        $this->arrORDERSTATUS_COLOR = $masterData->getMasterData('mtb_order_status_color');
[15596]55    }
56
57    /**
58     * Page のプロセス.
59     *
60     * @return void
61     */
62    function process() {
[19661]63        $this->action();
64        $this->sendResponse();
65    }
66
67    /**
68     * Page のアクション.
69     *
70     * @return void
71     */
72    function action() {
[21592]73
[15596]74        $objDb = new SC_Helper_DB_Ex();
75
[20970]76        // パラメーター管理クラス
[20501]77        $objFormParam = new SC_FormParam_Ex();
[20970]78        // パラメーター情報の初期化
[20257]79        $this->lfInitParam($objFormParam);
80        $objFormParam->setParam($_POST);
81        // 入力値の変換
82        $objFormParam->convParam();
[15596]83
[20257]84        $this->arrForm = $objFormParam->getHashArray();
85        //        $this->arrForm = $_POST;
86
[15596]87        //支払方法の取得
[21481]88        $this->arrPayment = $objDb->sfGetIDValueList('dtb_payment', 'payment_id', 'payment_method');
[15596]89
[21441]90        switch ($this->getMode()) {
[20257]91            case 'update':
92                switch ($objFormParam->getValue('change_status')) {
93                    case '':
94                        break;
95                        // 削除
96                    case 'delete':
97                        $this->lfDelete($objFormParam->getValue('move'));
98                        break;
99                        // 更新
100                    default:
101                        $this->lfStatusMove($objFormParam->getValue('change_status'), $objFormParam->getValue('move'));
102                        break;
103                }
[20041]104
[21182]105                // 対応状況
[21515]106                $status = !is_null($objFormParam->getValue('status')) ? $objFormParam->getValue('status') : '';
[20257]107                break;
[20041]108
[20257]109            case 'search':
[21182]110                // 対応状況
[21515]111                $status = !is_null($_POST['status']) ? $objFormParam->getValue('status') : '';
[20257]112                break;
[20041]113
[20257]114            default:
[21182]115                // 対応状況
[20257]116                //デフォルトで新規受付一覧表示
117                $status = ORDER_NEW;
118                break;
[15596]119        }
120
[21182]121        // 対応状況
[17287]122        $this->SelectedStatus = $status;
123        //検索結果の表示
[20257]124        $this->lfStatusDisp($status, $objFormParam->getValue('search_pageno'));
[21591]125
[19661]126    }
[17287]127
[15596]128    /**
[20970]129     *  パラメーター情報の初期化
[20257]130     *  @param SC_FormParam
131     */
132    function lfInitParam(&$objFormParam) {
[21514]133        $objFormParam->addParam('注文番号', 'order_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
134        $objFormParam->addParam('変更前対応状況', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
135        $objFormParam->addParam('変更後対応状況', 'change_status', STEXT_LEN, 'KVa', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
136        $objFormParam->addParam('ページ番号', 'search_pageno', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
137        $objFormParam->addParam('移動注文番号', 'move', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
[20257]138    }
139
140    /**
141     *  入力内容のチェック
142     *  @param SC_FormParam
143     */
144    function lfCheckError(&$objFormParam) {
145        // 入力データを渡す。
146        $arrRet = $objFormParam->getHashArray();
147        $arrErr = $objFormParam->checkError();
[21441]148        if (is_null($objFormParam->getValue('search_pageno'))) {
[20257]149            $objFormParam->setValue('search_pageno', 1);
150        }
151
[21441]152        if ($this->getMode() == 'change') {
153            if (is_null($objFormParam->getValue('change_status'))) {
[21514]154                $objFormParam->setValue('change_status','');
[20257]155            }
156        }
157
158    }
159
160    /**
[15596]161     * デストラクタ.
162     *
163     * @return void
164     */
165    function destroy() {
166        parent::destroy();
167    }
168
[21182]169    // 対応状況一覧の表示
[21479]170    function lfStatusDisp($status,$pageno) {
[20507]171        $objQuery =& SC_Query_Ex::getSingletonInstance();
[15596]172
[21514]173        $select ='*';
[21481]174        $from = 'dtb_order';
[21514]175        $where = 'del_flg = 0 AND status = ?';
[21563]176        $arrWhereVal = array($status);
[21514]177        $order = 'order_id DESC';
[15596]178
[21563]179        $linemax = $objQuery->count($from, $where, $arrWhereVal);
[15596]180        $this->tpl_linemax = $linemax;
181
182        // ページ送りの処理
183        $page_max = ORDER_STATUS_MAX;
184
185        // ページ送りの取得
[20538]186        $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'fnNaviSearchOnlyPage', NAVI_PMAX);
[15596]187        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
188        $startno = $objNavi->start_row;
189
190        $this->tpl_pageno = $pageno;
191
192        // 取得範囲の指定(開始行番号、行数のセット)
[18675]193        $objQuery->setLimitOffset($page_max, $startno);
[15596]194
195        //表示順序
[18675]196        $objQuery->setOrder($order);
[15596]197
198        //検索結果の取得
[21563]199        $this->arrStatus = $objQuery->select($select, $from, $where, $arrWhereVal);
[15596]200    }
201
[18100]202    /**
[21182]203     * 対応状況の更新
[18100]204     */
205    function lfStatusMove($statusId, $arrOrderId) {
[20180]206        $objPurchase = new SC_Helper_Purchase_Ex();
[21750]207        $objQuery =& SC_Query_Ex::getSingletonInstance();
[20041]208
[18100]209        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
210            return false;
211        }
[15596]212        $masterData = new SC_DB_MasterData_Ex();
[21481]213        $arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
[20041]214
[18100]215        $objQuery->begin();
[20041]216
[18100]217        foreach ($arrOrderId as $orderId) {
[20180]218            $objPurchase->sfUpdateOrderStatus($orderId, $statusId);
[18100]219        }
[20041]220
[18100]221        $objQuery->commit();
[20041]222
[18100]223        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
224        return true;
225    }
[15596]226
[18100]227    /**
228     * 受注テーブルの論理削除
229     */
230    function lfDelete($arrOrderId) {
[21750]231        $objQuery =& SC_Query_Ex::getSingletonInstance();
[20041]232
[18100]233        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
234            return false;
[15596]235        }
[20041]236
[18100]237        $arrUpdate = array(
[21527]238            'del_flg'      => 1,
239            'update_date'  => 'CURRENT_TIMESTAMP',
[18100]240        );
[20041]241
[18100]242        $objQuery->begin();
[20041]243
[18100]244        foreach ($arrOrderId as $orderId) {
245            $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId));
[15596]246        }
[20041]247
[18100]248        $objQuery->commit();
[20041]249
[18100]250        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
251        return true;
[15596]252    }
253}
Note: See TracBrowser for help on using the repository browser.