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

Revision 19945, 7.1 KB checked in by Seasoft, 10 years ago (diff)

#624(軽微な表示乱れを修正)

  • typo
  • ストレートな日本語表現に改める
  • 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_REALDIR . "pages/admin/LC_Page_Admin.php");
26require_once(CLASS_REALDIR . "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_Admin {
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        $this->action();
70        $this->sendResponse();
71    }
72
73    /**
74     * Page のアクション.
75     *
76     * @return void
77     */
78    function action() {
79        $objDb = new SC_Helper_DB_Ex();
80        $objSess = new SC_Session();
81
82        $objDate = new SC_Date(1901);
83        $objDate->setStartYear(RELEASE_YEAR);
84        $this->arrYear = $objDate->getYear();
85        $this->arrMonth = $objDate->getMonth();
86        $this->arrDay = $objDate->getDay();
87
88        // 認証可否の判定
89        SC_Utils_Ex::sfIsSuccess($objSess);
90
91        // 画面遷移の正当性チェック用にuniqidを埋め込む
92        $objPage->tpl_uniqid = $objSess->getUniqId();
93
94        // パラメータ管理クラス
95        $this->objFormParam = new SC_FormParam();
96        // パラメータ情報の初期化
97        $this->lfInitParam();
98        $this->objFormParam->setParam($_POST);
99
100        if (!isset($_POST['mode'])) $_POST['mode'] = "";
101        if (!isset($arrRet)) $arrRet = array();
102
103        switch($_POST['mode']) {
104        case "confirm":
105            // 入力値の変換
106            $this->objFormParam->convParam();
107            $this->arrErr = $this->lfCheckError($arrRet);
108            $arrRet = $this->objFormParam->getHashArray();
109            $this->arrForm = $arrRet;
110            // エラー入力なし
111            if (count($this->arrErr) == 0) {
112                $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']);
113                foreach ($arrRet['order_id'] AS $key => $val) {
114                    $arrPdfData = $arrRet;
115                    $arrPdfData['order_id'] = $val;
116                    $objFpdf->setData($arrPdfData);
117                }
118                $objFpdf->createPdf();
119                exit;
120            }
121            break;
122        default:
123            // タイトルをセット
124            $arrForm['title'] = "お買上げ明細書(納品書)";
125
126            // 今日の日付をセット
127            $arrForm['year']  = date("Y");
128            $arrForm['month'] = date("m");
129            $arrForm['day']   = date("d");
130
131            // メッセージ
132            $arrForm['msg1'] = 'このたびはお買上げいただきありがとうございます。';
133            $arrForm['msg2'] = '下記の内容にて納品させていただきます。';
134            $arrForm['msg3'] = 'ご確認くださいますよう、お願いいたします。';
135
136            // 注文番号があったら、セットする
137            if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
138                  $arrForm['order_id'][0] = $_GET['order_id'];
139            } elseif (is_array($_POST['pdf_order_id'])) {
140                sort($_POST['pdf_order_id']);
141                foreach ($_POST['pdf_order_id'] AS $key=>$val) {
142                      $arrForm['order_id'][] = $val;
143                }
144            }
145
146            $this->arrForm = $arrForm;
147            break;
148        }
149        $this->setTemplate($this->tpl_mainpage);
150    }
151
152    /**
153     * デストラクタ.
154     *
155     * @return void
156     */
157    function destroy() {
158        parent::destroy();
159    }
160
161    /* パラメータ情報の初期化 */
162    function lfInitParam() {
163        $this->objFormParam->addParam("注文番号", "order_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
164        $this->objFormParam->addParam("発行日", "year", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
165        $this->objFormParam->addParam("発行日", "month", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
166        $this->objFormParam->addParam("発行日", "day", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
167        $this->objFormParam->addParam("帳票の種類", "type", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
168        $this->objFormParam->addParam("ダウンロード方法", "download", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
169        $this->objFormParam->addParam("帳票タイトル", "title", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
170        $this->objFormParam->addParam("帳票メッセージ1行目", "msg1", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
171        $this->objFormParam->addParam("帳票メッセージ2行目", "msg2", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
172        $this->objFormParam->addParam("帳票メッセージ3行目", "msg3", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
173        $this->objFormParam->addParam("備考1行目", "etc1", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
174        $this->objFormParam->addParam("備考2行目", "etc2", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
175        $this->objFormParam->addParam("備考3行目", "etc3", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
176        $this->objFormParam->addParam("ポイント表記", "disp_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
177    }
178
179    /* 入力内容のチェック */
180    function lfCheckError() {
181        // 入力データを渡す。
182        $arrRet =  $this->objFormParam->getHashArray();
183        $objErr = new SC_CheckError($arrRet);
184        $objErr->arrErr = $this->objFormParam->checkError();
185
186        // 特殊項目チェック
187        $objErr->doFunc(array("発行日", "year", "month", "day"), array("CHECK_DATE"));
188
189        return $objErr->arrErr;
190    }
191
192
193}
194
195?>
Note: See TracBrowser for help on using the repository browser.