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

Revision 22537, 7.1 KB checked in by pineray, 11 years ago (diff)

pageクラスからdtb_paymentテーブルを直接指定している箇所をなくす

以下のファイルが残っている.
LC_Page_Shopping_LoadPaymentModule.php
LC_Page_Admin_Home.php

  • 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 *
[22206]5 * Copyright(c) 2000-2013 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
[15596]86        //支払方法の取得
[22537]87        $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
[15596]88
[21441]89        switch ($this->getMode()) {
[20257]90            case 'update':
91                switch ($objFormParam->getValue('change_status')) {
[22114]92                    // 削除
[20257]93                    case 'delete':
94                        $this->lfDelete($objFormParam->getValue('move'));
95                        break;
[22114]96                    // 更新
[20257]97                    default:
98                        $this->lfStatusMove($objFormParam->getValue('change_status'), $objFormParam->getValue('move'));
99                        break;
100                }
101                break;
[20041]102
[20257]103            case 'search':
[22114]104            default:
[20257]105                break;
[22114]106        }
[20041]107
[22114]108        // 対応状況
109        $status = $objFormParam->getValue('status');
110        if (strlen($status) === 0) {
[20257]111                //デフォルトで新規受付一覧表示
112                $status = ORDER_NEW;
[15596]113        }
[17287]114        $this->SelectedStatus = $status;
115        //検索結果の表示
[20257]116        $this->lfStatusDisp($status, $objFormParam->getValue('search_pageno'));
[21591]117
[19661]118    }
[17287]119
[15596]120    /**
[20970]121     *  パラメーター情報の初期化
[20257]122     *  @param SC_FormParam
123     */
124    function lfInitParam(&$objFormParam) {
[21514]125        $objFormParam->addParam('注文番号', 'order_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
126        $objFormParam->addParam('変更前対応状況', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
127        $objFormParam->addParam('ページ番号', 'search_pageno', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
[22114]128        if ($this->getMode() == 'update') {
129            $objFormParam->addParam('変更後対応状況', 'change_status', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
130            $objFormParam->addParam('移動注文番号', 'move', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
131        }
[20257]132    }
133
134    /**
135     *  入力内容のチェック
136     *  @param SC_FormParam
137     */
138    function lfCheckError(&$objFormParam) {
139        // 入力データを渡す。
140        $arrRet = $objFormParam->getHashArray();
141        $arrErr = $objFormParam->checkError();
[21441]142        if (is_null($objFormParam->getValue('search_pageno'))) {
[20257]143            $objFormParam->setValue('search_pageno', 1);
144        }
145    }
146
147    /**
[15596]148     * デストラクタ.
149     *
150     * @return void
151     */
152    function destroy() {
153        parent::destroy();
154    }
155
[21182]156    // 対応状況一覧の表示
[21479]157    function lfStatusDisp($status,$pageno) {
[20507]158        $objQuery =& SC_Query_Ex::getSingletonInstance();
[15596]159
[21514]160        $select ='*';
[21481]161        $from = 'dtb_order';
[21514]162        $where = 'del_flg = 0 AND status = ?';
[21563]163        $arrWhereVal = array($status);
[21514]164        $order = 'order_id DESC';
[15596]165
[21563]166        $linemax = $objQuery->count($from, $where, $arrWhereVal);
[15596]167        $this->tpl_linemax = $linemax;
168
169        // ページ送りの処理
170        $page_max = ORDER_STATUS_MAX;
171
172        // ページ送りの取得
[20538]173        $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'fnNaviSearchOnlyPage', NAVI_PMAX);
[15596]174        $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
175        $startno = $objNavi->start_row;
176
177        $this->tpl_pageno = $pageno;
178
179        // 取得範囲の指定(開始行番号、行数のセット)
[18675]180        $objQuery->setLimitOffset($page_max, $startno);
[15596]181
182        //表示順序
[18675]183        $objQuery->setOrder($order);
[15596]184
185        //検索結果の取得
[21563]186        $this->arrStatus = $objQuery->select($select, $from, $where, $arrWhereVal);
[15596]187    }
188
[18100]189    /**
[21182]190     * 対応状況の更新
[18100]191     */
192    function lfStatusMove($statusId, $arrOrderId) {
[20180]193        $objPurchase = new SC_Helper_Purchase_Ex();
[21750]194        $objQuery =& SC_Query_Ex::getSingletonInstance();
[20041]195
[18100]196        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
197            return false;
198        }
[15596]199        $masterData = new SC_DB_MasterData_Ex();
[21481]200        $arrORDERSTATUS = $masterData->getMasterData('mtb_order_status');
[20041]201
[18100]202        $objQuery->begin();
[20041]203
[18100]204        foreach ($arrOrderId as $orderId) {
[20180]205            $objPurchase->sfUpdateOrderStatus($orderId, $statusId);
[18100]206        }
[20041]207
[18100]208        $objQuery->commit();
[20041]209
[18100]210        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
211        return true;
212    }
[15596]213
[18100]214    /**
215     * 受注テーブルの論理削除
216     */
217    function lfDelete($arrOrderId) {
[21750]218        $objQuery =& SC_Query_Ex::getSingletonInstance();
[20041]219
[18100]220        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
221            return false;
[15596]222        }
[20041]223
[22306]224        $objPurchase = new SC_Helper_Purchase_Ex();
[18100]225        foreach ($arrOrderId as $orderId) {
[22306]226            $objPurchase->cancelOrder($orderId, ORDER_CANCEL, true);
[15596]227        }
[20041]228
[18100]229        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
230        return true;
[15596]231    }
232}
Note: See TracBrowser for help on using the repository browser.