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

Revision 17234, 6.5 KB checked in by satou, 16 years ago (diff)

納品書発行機能 文字数制限を修正。

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