Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Admin_Order_Status.php

Documentation is available at LC_Page_Admin_Order_Status.php

  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: LC_Page_Admin_Order_Status.php 21185 2011-08-11 10:37:10Z shutta $
  33.  */
  34. class LC_Page_Admin_Order_Status 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/status.tpl';
  47.         $this->tpl_mainno = 'order';
  48.         $this->tpl_subno = 'status';
  49.         $this->tpl_maintitle = '受注管理';
  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.         $this->action();
  64.         $this->sendResponse();
  65.     }
  66.  
  67.     /**
  68.      * Page のアクション.
  69.      *
  70.      * @return void 
  71.      */
  72.     function action() {
  73.         $objDb = new SC_Helper_DB_Ex();
  74.  
  75.         // パラメーター管理クラス
  76.         $objFormParam = new SC_FormParam_Ex();
  77.         // パラメーター情報の初期化
  78.         $this->lfInitParam($objFormParam);
  79.         $objFormParam->setParam($_POST);
  80.         // 入力値の変換
  81.         $objFormParam->convParam();
  82.  
  83.         $this->arrForm = $objFormParam->getHashArray();
  84.         //        $this->arrForm = $_POST;
  85.  
  86.         //支払方法の取得
  87.         $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
  88.  
  89.         switch ($this->getMode()){
  90.             case 'update':
  91.                 switch ($objFormParam->getValue('change_status')) {
  92.                     case '':
  93.                         break;
  94.                         // 削除
  95.                     case 'delete':
  96.                         $this->lfDelete($objFormParam->getValue('move'));
  97.                         break;
  98.                         // 更新
  99.                     default:
  100.                         $this->lfStatusMove($objFormParam->getValue('change_status'), $objFormParam->getValue('move'));
  101.                         break;
  102.                 }
  103.  
  104.                 // 対応状況
  105.                 $status = !is_null($objFormParam->getValue('status')) ? $objFormParam->getValue('status') : "";
  106.                 break;
  107.  
  108.             case 'search':
  109.                 // 対応状況
  110.                 $status = !is_null($_POST['status']) ? $objFormParam->getValue('status') : "";
  111.                 break;
  112.  
  113.             default:
  114.                 // 対応状況
  115.                 //デフォルトで新規受付一覧表示
  116.                 $status = ORDER_NEW;
  117.                 break;
  118.         }
  119.  
  120.         // 対応状況
  121.         $this->SelectedStatus = $status;
  122.         //検索結果の表示
  123.         $this->lfStatusDisp($status, $objFormParam->getValue('search_pageno'));
  124.     }
  125.  
  126.     /**
  127.      *  パラメーター情報の初期化
  128.      *  @param SC_FormParam 
  129.      */
  130.     function lfInitParam(&$objFormParam) {
  131.         $objFormParam->addParam("注文番号", "order_id", INT_LEN, 'n', array( "MAX_LENGTH_CHECK", "NUM_CHECK"));
  132.         $objFormParam->addParam("変更前対応状況", 'status', INT_LEN, 'n', array( "MAX_LENGTH_CHECK", "NUM_CHECK"));
  133.         $objFormParam->addParam("変更後対応状況", "change_status", STEXT_LEN, 'KVa', array( "MAX_LENGTH_CHECK", "NUM_CHECK"));
  134.         $objFormParam->addParam("ページ番号", "search_pageno", INT_LEN, 'n', array( "MAX_LENGTH_CHECK", "NUM_CHECK"));
  135.         $objFormParam->addParam("移動注文番号", 'move', INT_LEN, 'n', array( "MAX_LENGTH_CHECK", "NUM_CHECK"));
  136.     }
  137.  
  138.     /**
  139.      *  入力内容のチェック
  140.      *  @param SC_FormParam 
  141.      */
  142.     function lfCheckError(&$objFormParam) {
  143.         // 入力データを渡す。
  144.         $arrRet = $objFormParam->getHashArray();
  145.         $arrErr = $objFormParam->checkError();
  146.         if(is_null($objFormParam->getValue('search_pageno'))){
  147.             $objFormParam->setValue('search_pageno', 1);
  148.         }
  149.  
  150.         if($this->getMode() == 'change'){
  151.             if(is_null($objFormParam->getValue('change_status'))){
  152.                 $objFormParam->setValue('change_status',"");
  153.             }
  154.         }
  155.  
  156.     }
  157.  
  158.     /**
  159.      * デストラクタ.
  160.      *
  161.      * @return void 
  162.      */
  163.     function destroy() {
  164.         parent::destroy();
  165.     }
  166.  
  167.     // 対応状況一覧の表示
  168.     function lfStatusDisp($status,$pageno){
  169.         $objQuery =& SC_Query_Ex::getSingletonInstance();
  170.  
  171.         $select ="*";
  172.         $from = "dtb_order";
  173.         $where = "del_flg = 0 AND status = ?";
  174.         $arrval[] = $status;
  175.         $order = "order_id DESC";
  176.  
  177.         $linemax = $objQuery->count($from, $where, $arrval);
  178.         $this->tpl_linemax = $linemax;
  179.  
  180.         // ページ送りの処理
  181.         $page_max = ORDER_STATUS_MAX;
  182.  
  183.         // ページ送りの取得
  184.         $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'fnNaviSearchOnlyPage', NAVI_PMAX);
  185.         $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
  186.         $startno = $objNavi->start_row;
  187.  
  188.         $this->tpl_pageno = $pageno;
  189.  
  190.         // 取得範囲の指定(開始行番号、行数のセット)
  191.         $objQuery->setLimitOffset($page_max, $startno);
  192.  
  193.         //表示順序
  194.         $objQuery->setOrder($order);
  195.  
  196.         //検索結果の取得
  197.         $this->arrStatus = $objQuery->select($select, $from, $where, $arrval);
  198.     }
  199.  
  200.     /**
  201.      * 対応状況の更新
  202.      */
  203.     function lfStatusMove($statusId, $arrOrderId) {
  204.         $objPurchase = new SC_Helper_Purchase_Ex();
  205.         $objQuery = new SC_Query_Ex();
  206.  
  207.         if (!isset($arrOrderId) || !is_array($arrOrderId)) {
  208.             return false;
  209.         }
  210.         $masterData = new SC_DB_MasterData_Ex();
  211.         $arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
  212.  
  213.         $objQuery->begin();
  214.  
  215.         foreach ($arrOrderId as $orderId) {
  216.             $objPurchase->sfUpdateOrderStatus($orderId, $statusId);
  217.         }
  218.  
  219.         $objQuery->commit();
  220.  
  221.         $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
  222.         return true;
  223.     }
  224.  
  225.     /**
  226.      * 受注テーブルの論理削除
  227.      */
  228.     function lfDelete($arrOrderId) {
  229.         $objQuery = new SC_Query_Ex();
  230.  
  231.         if (!isset($arrOrderId) || !is_array($arrOrderId)) {
  232.             return false;
  233.         }
  234.  
  235.         $arrUpdate = array(
  236.              'del_flg'      => 1,
  237.              'update_date'  => 'CURRENT_TIMESTAMP'
  238.         );
  239.  
  240.         $objQuery->begin();
  241.  
  242.         foreach ($arrOrderId as $orderId) {
  243.             $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId));
  244.         }
  245.  
  246.         $objQuery->commit();
  247.  
  248.         $this->tpl_onload = "window.alert('選択項目を削除しました。');";
  249.         return true;
  250.     }
  251. }
  252. ?>

Documentation generated on Fri, 24 Feb 2012 14:01:30 +0900 by Seasoft