- Timestamp:
- 2009/02/13 22:05:12 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_4/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php
r17395 r17773 27 27 /* GMO決済モジュール連携用 */ 28 28 if (file_exists(MODULE_PATH . 'mdl_gmopg/inc/include.php') === TRUE) { 29 29 require_once(MODULE_PATH . 'mdl_gmopg/inc/include.php'); 30 30 } 31 31 32 32 /* ペイジェント決済モジュール連携用 */ 33 33 if (file_exists(MODULE_PATH . 'mdl_paygent/include.php') === TRUE) { 34 34 require_once(MODULE_PATH . 'mdl_paygent/include.php'); 35 35 } 36 36 … … 71 71 parent::init(); 72 72 $this->tpl_mainpage = 'order/edit.tpl'; 73 $this->tpl_subnavi = 'order/subnavi.tpl'; 74 $this->tpl_mainno = 'order'; 75 $this->tpl_subno = 'index'; 76 $this->tpl_subtitle = '受注管理'; 73 $this->tpl_subnavi = 'order/subnavi.tpl'; 74 $this->tpl_mainno = 'order'; 75 $this->tpl_subno = 'index'; 76 $this->tpl_subtitle = '受注管理'; 77 if (empty($_GET['order_id']) && empty($_POST['order_id'])) { 78 $this->tpl_subno = 'add'; 79 $this->tpl_mode = 'add'; 80 $this->tpl_subtitle = '新規受注入力'; 81 } 77 82 78 83 $masterData = new SC_DB_MasterData_Ex(); 79 84 $this->arrPref = $masterData->getMasterData("mtb_pref", 80 85 array("pref_id", "pref_name", "rank")); 81 86 $this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status"); 82 87 83 88 /* ペイジェント決済モジュール連携用 */ 84 89 if(function_exists("sfPaygentOrderPage")) { 85 $this->arr DispKind = sfPaygentOrderPage();90 $this->arrFormKind = sfPaygentOrderPage(); 86 91 } 87 92 … … 141 146 break; 142 147 case 'edit': 148 case 'add': 143 149 // POST情報で上書き 144 150 $this->objFormParam->setParam($_POST); … … 146 152 // 入力値の変換 147 153 $this->objFormParam->convParam(); 154 $this->arrErr = $this->lfCheek($arrInfo); 148 155 $this->arrErr = $this->lfCheckError(); 149 156 if(count($this->arrErr) == 0) { 150 $this->arrErr = $this->lfCheek($arrInfo); 151 if(count($this->arrErr) == 0) { 152 $this->lfRegistData($_POST['order_id']); 157 #if(count($this->arrErr) == 0) { 158 if ($_POST['mode'] == 'add') { 159 $this->lfRegistNewData(); 160 $text = "'新規受注を登録しました。'"; 161 } else { 162 $this->lfRegistData($_POST['order_id']); 163 $text = "'受注履歴を編集しました。'"; 164 } 153 165 // DBから受注情報を再読込 154 166 $this->lfGetOrderData($order_id); 155 $this->tpl_onload = "window.alert( '受注履歴を編集しました。');";156 }167 $this->tpl_onload = "window.alert(".$text.");"; 168 #} 157 169 } 158 170 break; … … 171 183 case 'paygent_order': 172 184 $this->paygent_return = sfPaygentOrder($_POST['paygent_type'], $order_id); 185 break; 186 /* 商品削除*/ 187 case 'delete_product': 188 $delete_no = $_POST['delete_no']; 189 foreach ($_POST AS $key=>$val) { 190 if (is_array($val)) { 191 foreach ($val AS $k=>$v) { 192 if ($k != $delete_no) { 193 $arrData[$key][] = $v; 194 } 195 } 196 } else { 197 $arrData[$key] = $val; 198 } 199 } 200 $this->lfReCheek($arrData, $arrInfo); 201 break; 202 /* 商品追加ポップアップより商品選択後、商品情報取得*/ 203 case 'select_product_detail': 204 // POST情報で上書き 205 $this->objFormParam->setParam($_POST); 206 if (!empty($_POST['add_product_id'])) { 207 $this->lfInsertProduct($_POST['add_product_id'], $_POST['add_classcategory_id1'], $_POST['add_classcategory_id2']); 208 } elseif (!empty($_POST['edit_product_id'])) { 209 $this->lfUpdateProduct($_POST['edit_product_id'], $_POST['edit_classcategory_id1'], $_POST['edit_classcategory_id2'], $_POST['no']); 210 } 211 $arrData = $_POST; 212 foreach ($this->arrForm AS $key=>$val) { 213 if (is_array($val)) { 214 $arrData[$key] = $this->arrForm[$key]['value']; 215 } else { 216 $arrData[$key] = $val; 217 } 218 } 219 $this->lfReCheek($arrData, $arrInfo); 173 220 break; 174 221 /* F-REGI決済モジュール連携用 */ … … 218 265 219 266 $this->arrForm = $this->objFormParam->getFormParamList(); 267 $this->product_count = count($this->arrForm['quantity']['value']); 268 269 // アンカーを設定 270 if (isset($_POST['anchor_key']) && !empty($_POST['anchor_key'])) { 271 $anchor_hash = "location.hash='#" . $_POST['anchor_key'] . "'"; 272 } else { 273 $anchor_hash = ""; 274 } 275 $this->tpl_onload .= $anchor_hash; 220 276 221 277 $this->arrInfo = $arrInfo; … … 254 310 /* パラメータ情報の初期化 */ 255 311 function lfInitParam() { 312 313 // お客様情報 314 $this->objFormParam->addParam("顧客名1", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 315 $this->objFormParam->addParam("顧客名2", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 316 $this->objFormParam->addParam("顧客名カナ1", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 317 $this->objFormParam->addParam("顧客名カナ2", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 318 $this->objFormParam->addParam("メールアドレス", "order_email", MTEXT_LEN, "KVCa", array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); 319 $this->objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 320 $this->objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 321 $this->objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 322 $this->objFormParam->addParam("住所1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 323 $this->objFormParam->addParam("住所2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 324 $this->objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 325 $this->objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 326 $this->objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 327 256 328 // 配送先情報 257 329 $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); … … 267 339 $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 268 340 $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 341 342 269 343 // 受注商品情報 270 344 $this->objFormParam->addParam("値引き", "discount", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); 271 $this->objFormParam->addParam("送料", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK") , '0');345 $this->objFormParam->addParam("送料", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 272 346 $this->objFormParam->addParam("手数料", "charge", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 273 347 $this->objFormParam->addParam("利用ポイント", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); … … 301 375 $this->objFormParam->addParam("顧客ID", "customer_id"); 302 376 $this->objFormParam->addParam("現在のポイント", "point"); 377 $this->objFormParam->addParam("受注番号", "order_id"); 378 $this->objFormParam->addParam("受注日", "create_date"); 303 379 } 304 380 … … 314 390 $this->objFormParam->setValue('total_point', $total_point); 315 391 $this->objFormParam->setValue('point', $point); 316 $this->arr Disp= $arrRet[0];392 $this->arrForm = $arrRet[0]; 317 393 // 受注詳細データの取得 318 394 $arrRet = $this->lfGetOrderDetail($order_id); 319 395 $arrRet = SC_Utils_Ex::sfSwapArray($arrRet); 320 $this->arr Disp = array_merge($this->arrDisp, $arrRet);396 $this->arrForm = array_merge($this->arrForm, $arrRet); 321 397 $this->objFormParam->setParam($arrRet); 322 398 323 399 // その他支払い情報を表示 324 if($this->arr Disp["memo02"] != "") $this->arrDisp["payment_info"] = unserialize($this->arrDisp["memo02"]);325 if($this->arr Disp["memo01"] == PAYMENT_CREDIT_ID){326 $this->arr Disp["payment_type"] = "クレジット決済";327 }elseif($this->arr Disp["memo01"] == PAYMENT_CONVENIENCE_ID){328 $this->arr Disp["payment_type"] = "コンビニ決済";400 if($this->arrForm["memo02"] != "") $this->arrForm["payment_info"] = unserialize($this->arrForm["memo02"]); 401 if($this->arrForm["memo01"] == PAYMENT_CREDIT_ID){ 402 $this->arrForm["payment_type"] = "クレジット決済"; 403 }elseif($this->arrForm["memo01"] == PAYMENT_CONVENIENCE_ID){ 404 $this->arrForm["payment_type"] = "コンビニ決済"; 329 405 }else{ 330 $this->arr Disp["payment_type"] = "お支払い";406 $this->arrForm["payment_type"] = "お支払い"; 331 407 } 332 408 } … … 403 479 } 404 480 481 function lfReCheek($arrData, $arrInfo) { 482 // 情報上書き 483 $this->objFormParam->setParam($arrData); 484 // 入力値の変換 485 $this->objFormParam->convParam(); 486 #if(count($this->arrErr) == 0) { 487 $this->arrErr = $this->lfCheek($arrInfo); 488 #} 489 $this->arrErr = $this->lfCheckError(); 490 } 405 491 /* DB登録処理 */ 406 492 function lfRegistData($order_id) { … … 476 562 $objQuery->commit(); 477 563 } 564 565 /* DB登録処理(追加) */ 566 function lfRegistNewData() { 567 $objQuery = new SC_Query(); 568 569 $objQuery->begin(); 570 571 // 入力データを渡す。 572 $arrRet = $this->objFormParam->getHashArray(); 573 foreach($arrRet as $key => $val) { 574 // 配列は登録しない 575 if(!is_array($val)) { 576 $sqlval[$key] = $val; 577 } 578 } 579 $order_id = $objQuery->nextval('dtb_order', 'order_id'); 580 $sqlval['order_id'] = $order_id; 581 $sqlval['create_date'] = "Now()"; 582 583 // 注文ステータス:指定が無ければ新規受付に設定 584 if($sqlval["status"] == ""){ 585 $sqlval['status'] = '1'; 586 } 587 588 // customer_id 589 if($sqlval["customer_id"] == ""){ 590 $sqlval['customer_id'] = '0'; 591 } 592 593 unset($sqlval['total_point']); 594 unset($sqlval['point']); 595 596 $where = "order_id = ?"; 597 598 // 受注ステータスの判定 599 if ($sqlval['status'] == ODERSTATUS_COMMIT) { 600 // 受注テーブルの発送済み日を更新する 601 $sqlval['commit_date'] = "Now()"; 602 } 603 604 // 受注テーブルの登録 605 $objQuery->insert("dtb_order", $sqlval); 606 607 $sql = ""; 608 $sql .= " UPDATE"; 609 $sql .= " dtb_order"; 610 $sql .= " SET"; 611 $sql .= " payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)"; 612 $sql .= " ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))"; 613 $sql .= " WHERE order_id = ?"; 614 615 if ($arrRet['deliv_time_id'] == "") { 616 $deliv_time_id = 0; 617 } else { 618 $deliv_time_id = $arrRet['deliv_time_id']; 619 } 620 $arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id); 621 $objQuery->query($sql, $arrUpdData); 622 623 // 受注詳細データの更新 624 $arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2")); 625 $objQuery->delete("dtb_order_detail", $where, array($order_id)); 626 627 $max = count($arrDetail); 628 for($i = 0; $i < $max; $i++) { 629 $sqlval = array(); 630 $sqlval['order_id'] = $order_id; 631 $sqlval['product_id'] = $arrDetail[$i]['product_id']; 632 $sqlval['product_code'] = $arrDetail[$i]['product_code']; 633 $sqlval['product_name'] = $arrDetail[$i]['product_name']; 634 $sqlval['price'] = $arrDetail[$i]['price']; 635 $sqlval['quantity'] = $arrDetail[$i]['quantity']; 636 $sqlval['point_rate'] = $arrDetail[$i]['point_rate']; 637 $sqlval['classcategory_id1'] = $arrDetail[$i]['classcategory_id1']; 638 $sqlval['classcategory_id2'] = $arrDetail[$i]['classcategory_id2']; 639 $sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1']; 640 $sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2']; 641 $objQuery->insert("dtb_order_detail", $sqlval); 642 } 643 $objQuery->commit(); 644 } 645 646 function lfInsertProduct($product_id, $classcategory_id1, $classcategory_id2) { 647 $arrProduct = $this->lfGetProductsClass($product_id, $classcategory_id1, $classcategory_id2); 648 $this->arrForm = $this->objFormParam->getFormParamList(); 649 $this->lfSetProductData($arrProduct); 650 } 651 652 function lfUpdateProduct($product_id, $classcategory_id1, $classcategory_id2, $no) { 653 $arrProduct = $this->lfGetProductsClass($product_id, $classcategory_id1, $classcategory_id2); 654 $this->arrForm = $this->objFormParam->getFormParamList(); 655 $this->lfSetProductData($arrProduct, $no); 656 } 657 658 function lfSetProductData($arrProduct, $no = null) { 659 foreach ($arrProduct AS $key=>$val) { 660 if (!is_array($this->arrForm[$key]['value'])) { 661 unset($this->arrForm[$key]['value']); 662 } 663 if ($no === null) { 664 $this->arrForm[$key]['value'][] = $arrProduct[$key]; 665 } else { 666 $this->arrForm[$key]['value'][$no] = $arrProduct[$key]; 667 } 668 } 669 } 670 671 function lfGetProductsClass($product_id, $classcategory_id1, $classcategory_id2) { 672 $objDb = new SC_Helper_DB_Ex(); 673 $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 674 $arrRet = $objDb->sfGetProductsClass(array($product_id, $classcategory_id1, $classcategory_id2)); 675 676 $arrProduct['price'] = $arrRet['price02']; 677 $arrProduct['quantity'] = 1; 678 $arrProduct['product_id'] = $arrRet['product_id']; 679 $arrProduct['point_rate'] = $arrRet['point_rate']; 680 $arrProduct['product_code'] = $arrRet['product_code']; 681 $arrProduct['product_name'] = $arrRet['name']; 682 $arrProduct['classcategory_id1'] = $arrRet['classcategory_id1']; 683 $arrProduct['classcategory_id2'] = $arrRet['classcategory_id2']; 684 $arrProduct['classcategory_name1'] = $arrClassCatName[$arrRet['classcategory_id1']]; 685 $arrProduct['classcategory_name2'] = $arrClassCatName[$arrRet['classcategory_id2']]; 686 687 return $arrProduct; 688 } 478 689 } 479 690 ?>
Note: See TracChangeset
for help on using the changeset viewer.