/**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objFormParam = new SC_FormParam_Ex();
     // パラメーター情報の初期化
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $order_id = $objFormParam->getValue('order_id');
     $arrValuesBefore = array();
     // DBから受注情報を読み込む
     if (!SC_Utils_Ex::isBlank($order_id)) {
         $this->setOrderToFormParam($objFormParam, $order_id);
         $this->tpl_subno = 'index';
         $arrValuesBefore['deliv_id'] = $objFormParam->getValue('deliv_id');
         $arrValuesBefore['payment_id'] = $objFormParam->getValue('payment_id');
         $arrValuesBefore['payment_method'] = $objFormParam->getValue('payment_method');
     } else {
         $this->tpl_subno = 'add';
         $this->tpl_mode = 'add';
         $arrValuesBefore['deliv_id'] = NULL;
         $arrValuesBefore['payment_id'] = NULL;
         $arrValuesBefore['payment_method'] = NULL;
         // お届け先情報を空情報で表示
         $arrShippingIds[] = null;
         $objFormParam->setValue('shipping_id', $arrShippingIds);
         // 新規受注登録で入力エラーがあった場合の画面表示用に、会員の現在ポイントを取得
         if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) {
             $customer_id = $objFormParam->getValue('customer_id');
             $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
             $objFormParam->setValue('customer_point', $arrCustomer['point']);
             // 新規受注登録で、ポイント利用できるように現在ポイントを設定
             $objFormParam->setValue('point', $arrCustomer['point']);
         }
     }
     $this->arrSearchHidden = $objFormParam->getSearchArray();
     switch ($this->getMode()) {
         case 'pre_edit':
         case 'order_id':
             break;
         case 'edit':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             //複数配送時に各商品の総量を設定
             $this->setProductsQuantity($objFormParam);
             $this->arrErr = $this->lfCheckError($objFormParam);
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $message = '受注を編集しました。';
                 $order_id = $this->doRegister($order_id, $objPurchase, $objFormParam, $message, $arrValuesBefore);
                 if ($order_id >= 0) {
                     $this->setOrderToFormParam($objFormParam, $order_id);
                 }
                 $this->tpl_onload = "window.alert('" . $message . "');";
             }
             break;
         case 'add':
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 $objFormParam->setParam($_POST);
                 $objFormParam->convParam();
                 //複数配送時に各商品の総量を設定
                 $this->setProductsQuantity($objFormParam);
                 $this->arrErr = $this->lfCheckError($objFormParam);
                 if (SC_Utils_Ex::isBlank($this->arrErr)) {
                     $message = '受注を登録しました。';
                     $order_id = $this->doRegister(null, $objPurchase, $objFormParam, $message, $arrValuesBefore);
                     if ($order_id >= 0) {
                         $this->tpl_mode = 'edit';
                         $objFormParam->setValue('order_id', $order_id);
                         $this->setOrderToFormParam($objFormParam, $order_id);
                     }
                     $this->tpl_onload = "window.alert('" . $message . "');";
                 }
             }
             break;
             // 再計算
         // 再計算
         case 'recalculate':
             //支払い方法の選択
         //支払い方法の選択
         case 'payment':
             // 配送業者の選択
         // 配送業者の選択
         case 'deliv':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             //複数配送時に各商品の総量を設定
             $this->setProductsQuantity($objFormParam);
             $this->arrErr = $this->lfCheckError($objFormParam);
             break;
             // 商品削除
         // 商品削除
         case 'delete_product':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $delete_no = $objFormParam->getValue('delete_no');
             $this->doDeleteProduct($delete_no, $objFormParam);
             //複数配送時に各商品の総量を設定
             $this->setProductsQuantity($objFormParam);
             $this->arrErr = $this->lfCheckError($objFormParam);
             break;
             // 商品追加ポップアップより商品選択
         // 商品追加ポップアップより商品選択
         case 'select_product_detail':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $this->doRegisterProduct($objFormParam);
             //複数配送時に各商品の総量を設定
             $this->setProductsQuantity($objFormParam);
             $this->arrErr = $this->lfCheckError($objFormParam);
             break;
             // 会員検索ポップアップより会員指定
         // 会員検索ポップアップより会員指定
         case 'search_customer':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $this->setProductsQuantity($objFormParam);
             $this->setCustomerTo($objFormParam->getValue('edit_customer_id'), $objFormParam);
             $customer_birth = $objFormParam->getValue('order_birth');
             // 加算ポイントの計算
             if (USE_POINT === true && $this->tpl_mode == 'add') {
                 $birth_point = 0;
                 if ($customer_birth) {
                     $arrRet = preg_split('|[- :/]|', $customer_birth);
                     $birth_date = intval($arrRet[1]);
                     $now_date = intval(date('m'));
                     // 誕生日月であった場合
                     if ($birth_date == $now_date) {
                         $birth_point = BIRTH_MONTH_POINT;
                     }
                 }
                 $objFormParam->setValue("birth_point", $birth_point);
             }
             $this->arrErr = $this->lfCheckError($objFormParam);
             break;
             // 複数配送設定表示
         // 複数配送設定表示
         case 'multiple':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $this->setProductsQuantity($objFormParam);
             $this->arrErr = $this->lfCheckError($objFormParam);
             break;
             // 複数配送設定を反映
         // 複数配送設定を反映
         case 'multiple_set_to':
             $this->lfInitMultipleParam($objFormParam);
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $this->setProductsQuantity($objFormParam);
             $this->setMultipleItemTo($objFormParam);
             break;
             // お届け先の追加
         // お届け先の追加
         case 'append_shipping':
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $this->setProductsQuantity($objFormParam);
             $this->addShipping($objFormParam);
             break;
         default:
             break;
     }
     $this->arrForm = $objFormParam->getFormParamList();
     $this->arrAllShipping = $objFormParam->getSwapArray(array_merge($this->arrShippingKeys, $this->arrShipmentItemKeys));
     $this->tpl_shipping_quantity = count($this->arrAllShipping);
     $this->top_shipping_id = array_shift(array_keys($this->arrAllShipping));
     $this->arrDelivTime = SC_Helper_Delivery_Ex::getDelivTime($objFormParam->getValue('deliv_id'));
     $this->tpl_onload .= $this->getAnchorKey($objFormParam);
     if ($arrValuesBefore['deliv_id']) {
         // 受注当時の配送業者名はdtb_orderにないので、
         // 削除済みの配送業者も含めて情報を取得。
         $objDelivery = new SC_Helper_Delivery_Ex();
         $arrDelivery = $objDelivery->get($arrValuesBefore['deliv_id'], true);
         $this->arrDeliv[$arrValuesBefore['deliv_id']] = $arrDelivery['name'];
     }
     if ($arrValuesBefore['payment_id']) {
         $this->arrPayment[$arrValuesBefore['payment_id']] = $arrValuesBefore['payment_method'];
     }
 }
 public function lfGetDelivData(&$objFormParam)
 {
     $objDelivery = new SC_Helper_Delivery_Ex();
     $deliv_id = $objFormParam->getValue('deliv_id');
     // パラメーター情報の初期化
     $this->lfInitParam('edit', $objFormParam);
     $arrDeliv = $objDelivery->get($deliv_id);
     // お届け時間
     $deliv_times = array();
     foreach ($arrDeliv['deliv_time'] as $value) {
         $deliv_times[]['deliv_time'] = $value;
     }
     $objFormParam->setParamList($deliv_times, 'deliv_time');
     unset($arrDeliv['deliv_time']);
     // 配送料金
     $deliv_fee = array();
     foreach ($arrDeliv['deliv_fee'] as $value) {
         $deliv_fee[]['fee'] = $value['fee'];
     }
     $objFormParam->setParamList($deliv_fee, 'fee');
     unset($arrDeliv['deliv_fee']);
     // 支払方法
     $objFormParam->setValue('payment_ids', $arrDeliv['payment_ids']);
     unset($arrDeliv['payment_ids']);
     // 配送業者
     $objFormParam->setParam($arrDeliv);
 }