source: branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php @ 18772

Revision 18772, 7.0 KB checked in by nanasess, 14 years ago (diff)

r18700 の続き

  • SC_DbConn のインスタンスを直接使用している個所を SC_Query に変更(#565)
    • 削除予定の機能については未対応
  • Property svn:eol-style set to LF
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 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
25require_once(CLASS_PATH . "pages/LC_Page.php");
26require_once(CLASS_PATH . "SC_Fpdf.php");
27
28/**
29 * 帳票出力 のページクラス.
30 *
31 * @package Page
32 * @author LOCKON CO.,LTD.
33 * @version $Id$
34 */
35class LC_Page_Admin_Order_Pdf extends LC_Page {
36
37    // }}}
38    // {{{ functions
39
40    /**
41     * Page を初期化する.
42     *
43     * @return void
44     */
45    function init() {
46        parent::init();
47        $this->tpl_mainpage = 'order/pdf_input.tpl';
48        $this->tpl_subnavi = 'order/subnavi.tpl';
49        $this->tpl_mainno = 'order';
50        $this->tpl_subno = 'pdf';
51        $this->tpl_subtitle = '帳票出力';
52
53        $this->SHORTTEXT_MAX = STEXT_LEN;
54        $this->MIDDLETEXT_MAX = MTEXT_LEN;
55        $this->LONGTEXT_MAX = LTEXT_LEN;
56
57        $this->arrType[0]  = "納品書";
58
59        $this->arrDownload[0] = "ブラウザに開く";
60        $this->arrDownload[1] = "ファイルに保存";
61    }
62
63    /**
64     * Page のプロセス.
65     *
66     * @return void
67     */
68    function process() {
69        $objView = new SC_AdminView();
70        $objDb = new SC_Helper_DB_Ex();
71        $objSess = new SC_Session();
72
73        $objDate = new SC_Date(1901);
74        $objDate->setStartYear(RELEASE_YEAR);
75        $this->arrYear = $objDate->getYear();
76        $this->arrMonth = $objDate->getMonth();
77        $this->arrDay = $objDate->getDay();
78
79        // 認証可否の判定
80        SC_Utils_Ex::sfIsSuccess($objSess);
81
82        // 画面遷移の正当性チェック用にuniqidを埋め込む
83        $objPage->tpl_uniqid = $objSess->getUniqId();
84
85        // パラメータ管理クラス
86        $this->objFormParam = new SC_FormParam();
87        // パラメータ情報の初期化
88        $this->lfInitParam();
89        $this->objFormParam->setParam($_POST);
90
91        if (!isset($_POST['mode'])) $_POST['mode'] = "";
92        if (!isset($arrRet)) $arrRet = array();
93
94        switch($_POST['mode']) {
95        case "confirm":
96            // 入力値の変換
97            $this->objFormParam->convParam();
98            $this->arrErr = $this->lfCheckError($arrRet);
99            $arrRet = $this->objFormParam->getHashArray();
100            $this->arrForm = $arrRet;
101            // エラー入力なし
102            if (count($this->arrErr) == 0) {
103                $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']);
104                foreach ($arrRet['order_id'] AS $key => $val) {
105                    $arrPdfData = $arrRet;
106                    $arrPdfData['order_id'] = $val;
107                    $objFpdf->setData($arrPdfData);
108                }
109                $objFpdf->createPdf();
110                exit;
111            }
112            break;
113        default:
114            // タイトルをセット
115            $arrForm['title'] = "お買上げ明細書(納品書)";
116
117            // 今日の日付をセット
118            $arrForm['year']  = date("Y");
119            $arrForm['month'] = date("m");
120            $arrForm['day']   = date("d");
121
122            // メッセージ
123            $arrForm['msg1'] = 'このたびはお買上げいただきありがとうございます。';
124            $arrForm['msg2'] = '下記の内容にて納品させていただきます。';
125            $arrForm['msg3'] = 'ご確認いただきますよう、お願いいたします。';
126
127            // 注文番号があったら、セットする
128            if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
129                  $arrForm['order_id'][0] = $_GET['order_id'];
130            } elseif (is_array($_POST['pdf_order_id'])) {
131                sort($_POST['pdf_order_id']);
132                foreach ($_POST['pdf_order_id'] AS $key=>$val) {
133                      $arrForm['order_id'][] = $val;
134                }
135            }
136
137            $this->arrForm = $arrForm;
138            break;
139        }
140
141        $objView->assignobj($this);
142        $objView->display($this->tpl_mainpage);
143    }
144
145    /**
146     * デストラクタ.
147     *
148     * @return void
149     */
150    function destroy() {
151        parent::destroy();
152    }
153
154    /* パラメータ情報の初期化 */
155    function lfInitParam() {
156        $this->objFormParam->addParam("注文番号", "order_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
157        $this->objFormParam->addParam("発行日", "year", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
158        $this->objFormParam->addParam("発行日", "month", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
159        $this->objFormParam->addParam("発行日", "day", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
160        $this->objFormParam->addParam("帳票の種類", "type", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
161        $this->objFormParam->addParam("ダウンロード方法", "download", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
162        $this->objFormParam->addParam("帳票タイトル", "title", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
163        $this->objFormParam->addParam("帳票メッセージ1行目", "msg1", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
164        $this->objFormParam->addParam("帳票メッセージ2行目", "msg2", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
165        $this->objFormParam->addParam("帳票メッセージ3行目", "msg3", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
166        $this->objFormParam->addParam("備考1行目", "etc1", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
167        $this->objFormParam->addParam("備考2行目", "etc2", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
168        $this->objFormParam->addParam("備考3行目", "etc3", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
169        $this->objFormParam->addParam("ポイント表記", "disp_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
170    }
171
172    /* 入力内容のチェック */
173    function lfCheckError() {
174        // 入力データを渡す。
175        $arrRet =  $this->objFormParam->getHashArray();
176        $objErr = new SC_CheckError($arrRet);
177        $objErr->arrErr = $this->objFormParam->checkError();
178
179        // 特殊項目チェック
180        $objErr->doFunc(array("発行日", "year", "month", "day"), array("CHECK_DATE"));
181
182        return $objErr->arrErr;
183    }
184
185
186}
187
188?>
Note: See TracBrowser for help on using the repository browser.