source: branches/dev/html/admin/order/mail.php @ 13802

Revision 13802, 4.9 KB checked in by matsumoto, 19 years ago (diff)
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9class LC_Page {
10    var $list_data;
11
12    function LC_Page() {
13        $this->tpl_mainpage = 'order/mail.tpl';
14        $this->tpl_subnavi = 'order/subnavi.tpl';
15        $this->tpl_mainno = 'order';       
16        $this->tpl_subno = 'index';
17        $this->tpl_subtitle = '¼õÃí´ÉÍý';
18        global $arrMAILTEMPLATE;
19        $this->arrMAILTEMPLATE = $arrMAILTEMPLATE;
20    }
21}
22
23$objPage = new LC_Page();
24$objView = new SC_AdminView();
25$objSess = new SC_Session();
26sfIsSuccess($objSess);
27
28// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
29foreach ($_POST as $key => $val) {
30    if (ereg("^search_", $key)) {
31        $objPage->arrSearchHidden[$key] = $val;
32    }
33}
34
35// ɽ¼¨¥â¡¼¥ÉȽÄê
36if(sfIsInt($_GET['order_id'])) {
37    $objPage->disp_mode = true;
38    $order_id = $_GET['order_id'];
39} else {
40    $order_id = $_POST['order_id'];
41}
42$objPage->tpl_order_id = order_id;
43print_r($_POST);
44// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
45$objFormParam = new SC_FormParam();
46// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
47lfInitParam();
48
49switch($_POST['mode']) {
50case 'pre_edit':
51    break;
52case 'return':
53    // POSTÃͤμèÆÀ
54    $objFormParam->setParam($_POST);
55    break;
56case 'send':
57    // POSTÃͤμèÆÀ
58    $objFormParam->setParam($_POST);
59    // ÆþÎÏÃͤÎÊÑ´¹
60    $objFormParam->convParam();
61    $objPage->arrErr = $objFormParam->checkerror();
62    // ¥á¡¼¥ë¤ÎÁ÷¿®
63    if (count($objPage->arrErr) == 0) {
64        // Ãíʸ¼õÉե᡼¥ë
65        sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']);
66    }
67    header("Location: " . URL_SEARCH_ORDER);
68    exit;
69    break; 
70case 'confirm':
71    // POSTÃͤμèÆÀ
72    $objFormParam->setParam($_POST);
73    // ÆþÎÏÃͤÎÊÑ´¹
74    $objFormParam->convParam();
75    // ÆþÎÏÃͤΰú¤­·Ñ¤®
76    $objPage->arrHidden = $objFormParam->getHashArray();
77    $objPage->arrErr = $objFormParam->checkerror();
78    // ¥á¡¼¥ë¤ÎÁ÷¿®
79    if (count($objPage->arrErr) == 0) {
80        // Ãíʸ¼õÉե᡼¥ë(Á÷¿®¤Ê¤·)
81        $objSendMail = sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false);
82        // ³Îǧ¥Ú¡¼¥¸¤Îɽ¼¨
83        $objPage->tpl_subject = $objSendMail->subject;
84        $objPage->tpl_body = mb_convert_encoding( $objSendMail->body, "EUC-JP", "auto" );       
85        $objPage->tpl_to = $objSendMail->tpl_to;
86        $objPage->tpl_mainpage = 'order/mail_confirm.tpl';
87       
88        $objView->assignobj($objPage);
89        $objView->display(MAIN_FRAME);
90       
91        exit;   
92    }
93    break;
94case 'change':
95    // POSTÃͤμèÆÀ
96    $objFormParam->setValue('template_id', $_POST['template_id']);
97    if(sfIsInt($_POST['template_id'])) {
98        $objQuery = new SC_Query();
99        $where = "template_id = ?";
100        $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id']));
101        $objFormParam->setParam($arrRet[0]);
102    }
103    break;
104}
105
106
107$objQuery = new SC_Query();
108$col = "send_date, subject, template_id, send_id";
109$where = "order_id = ?";
110$objQuery->setorder("send_date DESC");
111
112if(sfIsInt($_POST['order_id'])) {
113    $objPage->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
114}
115
116$objPage->arrForm = $objFormParam->getFormParamList();
117$objView->assignobj($objPage);
118$objView->display(MAIN_FRAME);
119//-----------------------------------------------------------------------------------------------------------------------------------
120/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
121function lfInitParam() {
122    global $objFormParam;
123    $objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
124    $objFormParam->addParam("¥á¡¼¥ë¥¿¥¤¥È¥ë", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
125    $objFormParam->addParam("¥Ø¥Ã¥À¡¼", "header", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
126    $objFormParam->addParam("¥Õ¥Ã¥¿¡¼", "footer", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
127}
128
129function lfGetOrderData($order_id) {
130    global $objFormParam;
131    global $objPage;
132    if(sfIsInt($order_id)) {
133        // DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
134        $objQuery = new SC_Query();
135        $where = "order_id = ?";
136        $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
137        $objFormParam->setParam($arrRet[0]);
138        list($point, $total_point) = sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
139        $objFormParam->setValue('total_point', $total_point);
140        $objFormParam->setValue('point', $point);
141        $objPage->arrDisp = $arrRet[0];
142        // ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
143        $arrRet = lfGetOrderDetail($order_id);
144        $arrRet = sfSwapArray($arrRet);
145        $objPage->arrDisp = array_merge($objPage->arrDisp, $arrRet);
146        $objFormParam->setParam($arrRet);
147       
148        // ¤½¤Î¾»Ùʧ¤¤¾ðÊó¤òɽ¼¨
149        if($objPage->arrDisp["memo02"] != "") $objPage->arrDisp["payment_info"] = unserialize($objPage->arrDisp["memo02"]);
150        if($objPage->arrDisp["memo01"] == PAYMENT_CREDIT_ID){
151            $objPage->arrDisp["payment_type"] = "¥¯¥ì¥¸¥Ã¥È·èºÑ";
152        }elseif($objPage->arrDisp["memo01"] == PAYMENT_CONVENIENCE_ID){
153            $objPage->arrDisp["payment_type"] = "¥³¥ó¥Ó¥Ë·èºÑ";
154        }else{
155            $objPage->arrDisp["payment_type"] = "¤ª»Ùʧ¤¤";
156        }
157    }
158}
Note: See TracBrowser for help on using the repository browser.