Changeset 20213
- Timestamp:
- 2011/02/19 22:29:14 (13 years ago)
- Location:
- branches/version-2_5-dev/data/class/pages/admin/order
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php
r20154 r20213 72 72 function action() { 73 73 SC_Utils_Ex::sfIsSuccess(new SC_Session()); 74 75 74 // 検索パラメータの引き継ぎ 76 75 $this->arrSearchHidden = SC_Utils_Ex::sfFilterKey($_POST,"^search_"); 77 78 76 $this->tpl_order_id = $_POST['order_id']; 79 80 77 // パラメータ管理クラス 81 78 $objFormParam = new SC_FormParam(); 82 79 // パラメータ情報の初期化 83 80 $this->lfInitParam($objFormParam); 84 85 $objMail = new SC_Helper_Mail_Ex();86 81 87 82 switch($this->getMode()) { … … 93 88 break; 94 89 case 'send': 95 // POST値の取得 96 $objFormParam->setParam($_POST); 97 // 入力値の変換 98 $objFormParam->convParam(); 99 $this->arrErr = $objFormParam->checkerror(); 100 // メールの送信 101 if (count($this->arrErr) == 0) { 102 // 注文受付メール 103 $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']); 104 } 105 SC_Response_Ex::sendRedirect(ADMIN_ORDER_URLPATH); 90 $this->send($objFormParam); 106 91 exit; 107 break;108 92 case 'confirm': 109 // POST値の取得 110 $objFormParam->setParam($_POST); 111 // 入力値の変換 112 $objFormParam->convParam(); 113 // 入力値の引き継ぎ 114 $this->arrHidden = $objFormParam->getHashArray(); 115 $this->arrErr = $objFormParam->checkerror(); 116 // メールの送信 117 if (count($this->arrErr) == 0) { 118 // 注文受付メール(送信なし) 119 $objSendMail = $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false); 120 // 確認ページの表示 121 $this->tpl_subject = $_POST['subject']; 122 $this->tpl_body = mb_convert_encoding( $objSendMail->body, CHAR_CODE, "auto" ); 123 $this->tpl_to = $objSendMail->tpl_to; 124 $this->tpl_mainpage = 'order/mail_confirm.tpl'; 125 return; 126 } 93 $this->confirm($objFormParam); 127 94 break; 128 95 case 'change': 129 96 // POST値の取得 130 $objFormParam->setValue('template_id', $_POST['template_id']); 131 if(SC_Utils_Ex::sfIsInt($_POST['template_id'])) { 132 $objQuery = new SC_Query(); 133 $where = "template_id = ?"; 134 $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id'])); 135 $objFormParam->setParam($arrRet[0]); 136 } 97 $this->changeData($objFormParam); 137 98 break; 138 99 } … … 150 111 } 151 112 152 /** 153 * TODO これ色々なところでやっていそうなので、どこかに共通化した方がよいんちゃうかな 154 * 検索パラメータを配列で返す 155 * 156 */ 157 function getSearchParameters($post){ 158 // 検索パラメータの引き継ぎ 159 $searchHiddenParams = array(); 160 foreach ($post as $key => $val) { 161 if (preg_match("/^search_/", $key)) { 162 $searchHiddenParams[$key] = $val; 163 } 113 function send(&$objFormParam){ 114 // POST値の取得 115 $objFormParam->setParam($_POST); 116 // 入力値の変換 117 $objFormParam->convParam(); 118 $this->arrErr = $objFormParam->checkerror(); 119 // メールの送信 120 if (count($this->arrErr) == 0) { 121 // 注文受付メール 122 $objMail = new SC_Helper_Mail_Ex(); 123 $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']); 164 124 } 165 return $searchHiddenParams; 125 SC_Response_Ex::sendRedirect(ADMIN_ORDER_URLPATH); 126 } 127 128 function confirm(&$objFormParam){ 129 // POST値の取得 130 $objFormParam->setParam($_POST); 131 // 入力値の変換 132 $objFormParam->convParam(); 133 // 入力値の引き継ぎ 134 $this->arrHidden = $objFormParam->getHashArray(); 135 $this->arrErr = $objFormParam->checkerror(); 136 // メールの送信 137 if (count($this->arrErr) == 0) { 138 // 注文受付メール(送信なし) 139 $objMail = new SC_Helper_Mail_Ex(); 140 $objSendMail = $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false); 141 // 確認ページの表示 142 $this->tpl_subject = $_POST['subject']; 143 $this->tpl_body = mb_convert_encoding( $objSendMail->body, CHAR_CODE, "auto" ); 144 $this->tpl_to = $objSendMail->tpl_to; 145 $this->tpl_mainpage = 'order/mail_confirm.tpl'; 146 return; 147 } 148 } 149 150 function changeData(&$objFormParam){ 151 $objFormParam->setValue('template_id', $_POST['template_id']); 152 if(SC_Utils_Ex::sfIsInt($_POST['template_id'])) { 153 $objQuery =& SC_Query::getSingletonInstance(); 154 $where = "template_id = ?"; 155 $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id'])); 156 $objFormParam->setParam($arrRet[0]); 157 } 166 158 } 167 159 -
branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_MailView.php
r20116 r20213 64 64 */ 65 65 function action() { 66 $objSess = new SC_Session();67 68 66 // 認証可否の判定 69 SC_Utils_Ex::sfIsSuccess( $objSess);67 SC_Utils_Ex::sfIsSuccess(new SC_Session()); 70 68 71 69 if(SC_Utils_Ex::sfIsInt($_GET['send_id'])) { 72 $objQuery = new SC_Query();70 $objQuery =& SC_Query::getSingletonInstance(); 73 71 $col = "subject, mail_body"; 74 72 $where = "send_id = ?"; -
branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php
r20116 r20213 97 97 $this->lfInitParam(); 98 98 $this->objFormParam->setParam($_POST); 99 99 100 // どんな状態の時に isset($arrRet) == trueになるんだ? 100 101 if (!isset($arrRet)) $arrRet = array(); 101 102 102 103 switch($this->getMode()) { 103 case "confirm": 104 // 入力値の変換 105 $this->objFormParam->convParam(); 106 $this->arrErr = $this->lfCheckError($arrRet); 107 $arrRet = $this->objFormParam->getHashArray(); 108 $this->arrForm = $arrRet; 109 // エラー入力なし 110 if (count($this->arrErr) == 0) { 111 $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']); 112 foreach ($arrRet['order_id'] AS $key => $val) { 113 $arrPdfData = $arrRet; 114 $arrPdfData['order_id'] = $val; 115 $objFpdf->setData($arrPdfData); 104 case "confirm": 105 // 入力値の変換 106 $this->confirm($this->objFormParam); 107 break; 108 default: 109 // ここが$arrFormの初登場ということを明示するため宣言する。 110 $arrForm = array(); 111 // タイトルをセット 112 $arrForm['title'] = "お買上げ明細書(納品書)"; 113 114 // 今日の日付をセット 115 $arrForm['year'] = date("Y"); 116 $arrForm['month'] = date("m"); 117 $arrForm['day'] = date("d"); 118 119 // メッセージ 120 $arrForm['msg1'] = 'このたびはお買上げいただきありがとうございます。'; 121 $arrForm['msg2'] = '下記の内容にて納品させていただきます。'; 122 $arrForm['msg3'] = 'ご確認くださいますよう、お願いいたします。'; 123 124 // 注文番号があったら、セットする 125 if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) { 126 $arrForm['order_id'][0] = $_GET['order_id']; 127 } elseif (is_array($_POST['pdf_order_id'])) { 128 sort($_POST['pdf_order_id']); 129 foreach ($_POST['pdf_order_id'] AS $key=>$val) { 130 $arrForm['order_id'][] = $val; 131 } 116 132 } 117 $objFpdf->createPdf(); 118 exit; 119 } 120 break; 121 default: 122 // タイトルをセット 123 $arrForm['title'] = "お買上げ明細書(納品書)"; 124 125 // 今日の日付をセット 126 $arrForm['year'] = date("Y"); 127 $arrForm['month'] = date("m"); 128 $arrForm['day'] = date("d"); 129 130 // メッセージ 131 $arrForm['msg1'] = 'このたびはお買上げいただきありがとうございます。'; 132 $arrForm['msg2'] = '下記の内容にて納品させていただきます。'; 133 $arrForm['msg3'] = 'ご確認くださいますよう、お願いいたします。'; 134 135 // 注文番号があったら、セットする 136 if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) { 137 $arrForm['order_id'][0] = $_GET['order_id']; 138 } elseif (is_array($_POST['pdf_order_id'])) { 139 sort($_POST['pdf_order_id']); 140 foreach ($_POST['pdf_order_id'] AS $key=>$val) { 141 $arrForm['order_id'][] = $val; 142 } 143 } 144 145 $this->arrForm = $arrForm; 146 break; 133 134 $this->arrForm = $arrForm; 135 break; 147 136 } 148 137 $this->setTemplate($this->tpl_mainpage); 149 138 } 139 140 function confirm(&$objFormParam){ 141 $this->objFormParam->convParam(); 142 $this->arrErr = $this->lfCheckError($arrRet); 143 $arrRet = $this->objFormParam->getHashArray(); 144 145 $this->arrForm = $arrRet; 146 // エラー入力なし 147 if (count($this->arrErr) == 0) { 148 $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']); 149 foreach ($arrRet['order_id'] AS $key => $val) { 150 $arrPdfData = $arrRet; 151 $arrPdfData['order_id'] = $val; 152 $objFpdf->setData($arrPdfData); 153 } 154 $objFpdf->createPdf(); 155 exit; 156 } 157 } 158 159 150 160 151 161 /** … … 176 186 } 177 187 178 /* 入力内容のチェック */ 179 function lfCheckError() { 188 /** 189 * 入力内容のチェック 190 * @var SC_FormParam 191 */ 192 193 function lfCheckError(&$objFormParam) { 180 194 // 入力データを渡す。 181 $arrRet = $this->objFormParam->getHashArray(); 195 $arrRet = $objFormParam->getHashArray(); 196 $objFormParam-> 182 197 $objErr = new SC_CheckError($arrRet); 198 183 199 $objErr->arrErr = $this->objFormParam->checkError(); 184 200 185 201 // 特殊項目チェック 186 202 $objErr->doFunc(array("発行日", "year", "month", "day"), array("CHECK_DATE")); … … 192 208 } 193 209 194 ?> -
branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php
r20116 r20213 1 2 1 <?php 3 2 /* … … 84 83 85 84 switch ($this->getMode()) { 86 case 'search': 87 // POST値の引き継ぎ 88 $this->arrForm = $_POST; 89 // 入力文字の強制変換 90 $this->lfConvertParam(); 91 92 $where = "alldtl.del_flg = 0"; 93 $arrval = array(); 94 95 /* 入力エラーなし */ 96 foreach ($this->arrForm as $key => $val) { 97 if($val == "") { 98 continue; 99 } 100 101 switch ($key) { 102 case 'search_name': 103 $where .= " AND name ILIKE ?"; 104 $arrval[] = "%$val%"; 105 break; 106 case 'search_category_id': 107 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val); 108 if($tmp_where != "") { 109 $where.= " AND alldtl.product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")"; 110 $arrval = array_merge((array)$arrval, (array)$tmp_arrval); 85 case 'search': 86 // 入力文字の強制変換とPOST値の引き継ぎ 87 SC_FormParam::convParam(); 88 $this->arrForm = $this->lfConvertParam($_POST,$this->getConvertRule()); 89 90 $where = "alldtl.del_flg = 0"; 91 $arrval = array(); 92 93 /* 入力エラーなし */ 94 foreach ($this->arrForm as $key => $val) { 95 if($val == "") { 96 continue; 111 97 } 112 break; 113 case 'search_product_code': 114 $where .= " AND alldtl.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)"; 115 $arrval[] = "$val%"; 116 break; 117 default: 118 break; 119 } 120 } 121 122 // 検索結果対象となる商品の数を取得 123 $objQuery =& SC_Query::getSingletonInstance(); 124 $objQuery->setWhere($where); 125 $objProduct = new SC_Product(); 126 $linemax = $objProduct->findProductCount($objQuery, $arrval); 127 $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 128 129 // ページ送りの処理 130 if(isset($_POST['search_page_max']) 131 && is_numeric($_POST['search_page_max'])) { 132 $page_max = $_POST['search_page_max']; 133 } else { 134 $page_max = SEARCH_PMAX; 135 } 136 137 // ページ送りの取得 138 $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); 139 $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 140 $startno = $objNavi->start_row; 141 142 $objProduct = new SC_Product(); 143 $objQuery =& SC_Query::getSingletonInstance(); 144 $objQuery->setWhere($where); 145 146 // 取得範囲の指定(開始行番号、行数のセット) 147 $objQuery->setLimitOffset($page_max, $startno); 148 // 表示順序 149 $objQuery->setOrder($order); 150 151 // 検索結果の取得 152 $arrProduct_id = $objProduct->findProductIdsOrder($objQuery, $arrval); 153 154 $where = ""; 155 if (is_array($arrProduct_id) && !empty($arrProduct_id)) { 156 $where = 'product_id IN (' . implode(',', $arrProduct_id) . ')'; 157 } else { 158 // 一致させない 159 $where = '0<>0'; 160 } 161 $objQuery =& SC_Query::getSingletonInstance(); 162 $objQuery->setWhere($where); 163 $arrProducts = $objProduct->lists($objQuery, $arrProduct_id); 164 165 //取得している並び順で並び替え 166 $arrProducts2 = array(); 167 foreach($arrProducts as $item) { 168 $arrProducts2[ $item['product_id'] ] = $item; 169 } 170 $this->arrProducts = array(); 171 foreach($arrProduct_id as $product_id) { 172 $this->arrProducts[] = $arrProducts2[$product_id]; 173 } 174 175 $objProduct->setProductsClassByProductIds($arrProduct_id); 176 $objJson = new Services_JSON(); 177 $this->tpl_javascript .= 'productsClassCategories = ' . $objJson->encode($objProduct->classCategories) . '; '; 178 179 foreach ($this->arrProducts as $arrProduct) { 180 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});\n"; 181 } 182 183 $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}'; 184 $this->tpl_onload .= 'fnOnLoad(); '; 185 186 // 規格1クラス名 187 $this->tpl_class_name1 = $objProduct->className1; 188 189 // 規格2クラス名 190 $this->tpl_class_name2 = $objProduct->className2; 191 192 // 規格1 193 $this->arrClassCat1 = $objProduct->classCats1; 194 195 // 規格1が設定されている 196 $this->tpl_classcat_find1 = $objProduct->classCat1_find; 197 // 規格2が設定されている 198 $this->tpl_classcat_find2 = $objProduct->classCat2_find; 199 $this->tpl_product_class_id = $objProduct->product_class_id; 200 $this->tpl_stock_find = $objProduct->stock_find; 201 break; 202 default: 203 break; 98 99 switch ($key) { 100 case 'search_name': 101 $where .= " AND name ILIKE ?"; 102 $arrval[] = "%$val%"; 103 break; 104 case 'search_category_id': 105 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val); 106 if($tmp_where != "") { 107 $where.= " AND alldtl.product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")"; 108 $arrval = array_merge((array)$arrval, (array)$tmp_arrval); 109 } 110 break; 111 case 'search_product_code': 112 $where .= " AND alldtl.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)"; 113 $arrval[] = "$val%"; 114 break; 115 default: 116 break; 117 } 118 } 119 120 // 検索結果対象となる商品の数を取得 121 $objQuery =& SC_Query::getSingletonInstance(); 122 $objQuery->setWhere($where); 123 $objProduct = new SC_Product(); 124 $linemax = $objProduct->findProductCount($objQuery, $arrval); 125 $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 126 127 // ページ送りの処理 128 if(isset($_POST['search_page_max']) 129 && is_numeric($_POST['search_page_max'])) { 130 $page_max = $_POST['search_page_max']; 131 } else { 132 $page_max = SEARCH_PMAX; 133 } 134 135 // ページ送りの取得 136 $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); 137 $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 138 $startno = $objNavi->start_row; 139 140 $objProduct = new SC_Product(); 141 $objQuery =& SC_Query::getSingletonInstance(); 142 $objQuery->setWhere($where); 143 144 // 取得範囲の指定(開始行番号、行数のセット) 145 $objQuery->setLimitOffset($page_max, $startno); 146 // 表示順序 147 $objQuery->setOrder($order); 148 149 // 検索結果の取得 150 $arrProduct_id = $objProduct->findProductIdsOrder($objQuery, $arrval); 151 152 $where = ""; 153 if (is_array($arrProduct_id) && !empty($arrProduct_id)) { 154 $where = 'product_id IN (' . implode(',', $arrProduct_id) . ')'; 155 } else { 156 // 一致させない 157 $where = '0<>0'; 158 } 159 $objQuery =& SC_Query::getSingletonInstance(); 160 $objQuery->setWhere($where); 161 $arrProducts = $objProduct->lists($objQuery, $arrProduct_id); 162 163 //取得している並び順で並び替え 164 $arrProducts2 = array(); 165 foreach($arrProducts as $item) { 166 $arrProducts2[ $item['product_id'] ] = $item; 167 } 168 $this->arrProducts = array(); 169 foreach($arrProduct_id as $product_id) { 170 $this->arrProducts[] = $arrProducts2[$product_id]; 171 } 172 173 $objProduct->setProductsClassByProductIds($arrProduct_id); 174 $objJson = new Services_JSON(); 175 $this->tpl_javascript .= 'productsClassCategories = ' . $objJson->encode($objProduct->classCategories) . '; '; 176 177 foreach ($this->arrProducts as $arrProduct) { 178 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});\n"; 179 } 180 181 $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}'; 182 $this->tpl_onload .= 'fnOnLoad(); '; 183 184 // 規格1クラス名 185 $this->tpl_class_name1 = $objProduct->className1; 186 187 // 規格2クラス名 188 $this->tpl_class_name2 = $objProduct->className2; 189 190 // 規格1 191 $this->arrClassCat1 = $objProduct->classCats1; 192 193 // 規格1が設定されている 194 $this->tpl_classcat_find1 = $objProduct->classCat1_find; 195 // 規格2が設定されている 196 $this->tpl_classcat_find2 = $objProduct->classCat2_find; 197 $this->tpl_product_class_id = $objProduct->product_class_id; 198 $this->tpl_stock_find = $objProduct->stock_find; 199 break; 200 default: 201 break; 204 202 } 205 203 … … 218 216 } 219 217 220 /* 取得文字列の変換 */ 221 function lfConvertParam() { 218 /** 219 * 文字列の変換ルールを返す 220 */ 221 function getConvertRule(){ 222 222 /* 223 223 * 文字列の変換 … … 227 227 * n : 「全角」数字を「半角(ハンカク)」に変換 228 228 */ 229 $arrConvList = array(); 229 230 $arrConvList['search_name'] = "KVa"; 230 231 $arrConvList['search_product_code'] = "KVa"; 231 232 // 文字変換 233 foreach ($arrConvList as $key => $val) { 234 // POSTされてきた値のみ変換する。 235 if(isset($this->arrForm[$key])) { 236 $this->arrForm[$key] = mb_convert_kana($this->arrForm[$key] ,$val); 232 return $arrConvList; 233 } 234 235 /** 236 * 取得文字列の変換 237 * @param Array $param 取得文字列 238 * @param Array $convList 変換ルール 239 */ 240 function lfConvertParam($param,$convList){ 241 $convedParam = array(); 242 foreach ($convList as $key => $value){ 243 if(isset($param[$key])) { 244 $convedParam[$key] = mb_convert_kana($param[$key],$value); 245 }else{ 246 $convedParam[$key] = $param[$key]; 237 247 } 238 248 } 249 return $convedParam; 239 250 } 240 251 } -
branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php
r20180 r20213 71 71 */ 72 72 function action() { 73 $objSess = new SC_Session();74 73 $objDb = new SC_Helper_DB_Ex(); 75 74 76 75 // 認証可否の判定 77 $objSess = new SC_Session(); 78 SC_Utils_Ex::sfIsSuccess($objSess); 76 SC_Utils_Ex::sfIsSuccess(new SC_Session()); 79 77 80 78 $this->arrForm = $_POST; … … 137 135 //ステータス一覧の表示 138 136 function lfStatusDisp($status,$pageno){ 139 $objQuery = new SC_Query();137 $objQuery =& SC_Query::getSingletonInstance(); 140 138 141 139 $select ="*";
Note: See TracChangeset
for help on using the changeset viewer.