/**
  * 受注データを取得して, SC_FormParam へ設定する.
  *
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param integer $order_id 取得元の受注ID
  * @return void
  */
 function setOrderToFormParam(&$objFormParam, $order_id)
 {
     $objPurchase = new SC_Helper_Purchase_Ex();
     // 受注詳細を設定
     $arrOrderDetail = $objPurchase->getOrderDetail($order_id, false);
     $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrOrderDetail));
     $arrShippingsTmp = $objPurchase->getShippings($order_id);
     $arrShippings = array();
     foreach ($arrShippingsTmp as $row) {
         // お届け日の処理
         if (!SC_Utils_Ex::isBlank($row['shipping_date'])) {
             $ts = strtotime($row['shipping_date']);
             $row['shipping_date_year'] = date('Y', $ts);
             $row['shipping_date_month'] = date('n', $ts);
             $row['shipping_date_day'] = date('j', $ts);
         }
         $arrShippings[$row['shipping_id']] = $row;
     }
     $objFormParam->setValue('shipping_quantity', count($arrShippings));
     $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrShippings));
     /*
      * 配送商品を設定
      *
      * $arrShipmentItem['shipment_(key)'][$shipping_id][$item_index] = 値
      * $arrProductQuantity[$shipping_id] = 配送先ごとの配送商品数量
      */
     $arrProductQuantity = array();
     $arrShipmentItem = array();
     foreach ($arrShippings as $shipping_id => $arrShipping) {
         $arrProductQuantity[$shipping_id] = count($arrShipping['shipment_item']);
         foreach ($arrShipping['shipment_item'] as $item_index => $arrItem) {
             foreach ($arrItem as $item_key => $item_val) {
                 $arrShipmentItem['shipment_' . $item_key][$shipping_id][$item_index] = $item_val;
             }
         }
     }
     $objFormParam->setValue('shipping_product_quantity', $arrProductQuantity);
     $objFormParam->setParam($arrShipmentItem);
     /*
      * 受注情報を設定
      * $arrOrderDetail と項目が重複しており, $arrOrderDetail は連想配列の値
      * が渡ってくるため, $arrOrder で上書きする.
      */
     $arrOrder = $objPurchase->getOrder($order_id);
     $objFormParam->setParam($arrOrder);
     // ポイントを設定
     list($db_point, $rollback_point) = SC_Helper_DB_Ex::sfGetRollbackPoint($order_id, $arrOrder['use_point'], $arrOrder['add_point'], $arrOrder['status']);
     $objFormParam->setValue('total_point', $db_point);
     $objFormParam->setValue('point', $rollback_point);
     if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) {
         $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($objFormParam->getValue('customer_id'));
         $objFormParam->setValue('customer_point', $arrCustomer['point']);
     }
 }
 /**
  * 会員を削除する処理
  *
  * @param  integer $customer_id 会員ID
  * @return boolean true:成功 false:失敗
  */
 public static function delete($customer_id)
 {
     $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id, 'del_flg = 0');
     if (SC_Utils_Ex::isBlank($arrData)) {
         //対象となるデータが見つからない。
         return false;
     }
     // XXXX: 仮会員は物理削除となっていたが論理削除に変更。
     $arrVal = array('del_flg' => '1');
     SC_Helper_Customer_Ex::sfEditCustomerData($arrVal, $customer_id);
     return true;
 }
 /**
  * 会員情報をフォームに設定する.
  *
  * @param integer $customer_id 会員ID
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @return void
  */
 function setCustomerTo($customer_id, &$objFormParam)
 {
     $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
     foreach ($arrCustomer as $key => $val) {
         $objFormParam->setValue('order_' . $key, $val);
     }
     $objFormParam->setValue('customer_id', $customer_id);
     $objFormParam->setValue('customer_point', $arrCustomer['point']);
 }
示例#4
0
 /**
  * 登録メールを送信する。
  *
  * @param string $secret_key 会員固有キー
  * @param integer $customer_id 顧客ID
  * @param boolean $is_mobile false(default):PCアドレスにメールを送る true:携帯アドレスにメールを送る
  * @return boolean true:成功 false:失敗
  */
 function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = false)
 {
     // 会員データの取得
     if (SC_Utils_Ex::sfIsInt($customer_id)) {
         $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
     } else {
         $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId('', "secret_key = ?", array($secret_key));
     }
     if (SC_Utils_Ex::isBlank($arrCustomerData)) {
         return false;
     }
     $CONF = SC_Helper_DB_Ex::sfGetBasisData();
     $objMailText = new SC_SiteView_Ex();
     $objMailText->assign('CONF', $CONF);
     $objMailText->assign("name01", $arrCustomerData['name01']);
     $objMailText->assign("name02", $arrCustomerData['name02']);
     $objMailText->assign('uniqid', $arrCustomerData['secret_key']);
     $objMailText->assignobj($arrCustomerData);
     $objMailText->assignobj($this);
     $objHelperMail = new SC_Helper_Mail_Ex();
     // 仮会員が有効の場合
     if (CUSTOMER_CONFIRM_MAIL == true and $arrCustomerData['status'] == 1) {
         $subject = $objHelperMail->sfMakeSubject('会員登録のご確認', $objMailText);
         $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
     } else {
         $subject = $objHelperMail->sfMakeSubject('会員登録のご完了', $objMailText);
         $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
     }
     $objMail = new SC_SendMail();
     $objMail->setItem('', $subject, $toCustomerMail, $CONF["email03"], $CONF["shop_name"], $CONF["email03"], $CONF["email04"], $CONF["email04"], $CONF["email01"]);
     // 宛先の設定
     if ($is_mobile) {
         $to_addr = $arrCustomerData["email_mobile"];
     } else {
         $to_addr = $arrCustomerData['email'];
     }
     $objMail->setTo($to_addr, $arrCustomerData["name01"] . $arrCustomerData["name02"] . " 様");
     $objMail->sendMail();
     return true;
 }
 /**
  * 会員情報をフォームに設定する.
  *
  * @param  integer      $customer_id  会員ID
  * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
  * @return void
  */
 public function setCustomerTo($customer_id, &$objFormParam)
 {
     $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
     foreach ($arrCustomer as $key => $val) {
         $objFormParam->setValue('order_' . $key, $val);
     }
     // 誕生日の処理
     if (!SC_Utils_Ex::isBlank($objFormParam->getValue('order_birth'))) {
         $order_birth = substr($objFormParam->getValue('order_birth'), 0, 10);
         $arrOrderBirth = explode("-", $order_birth);
         $objFormParam->setValue('order_birth_year', intval($arrOrderBirth[0]));
         $objFormParam->setValue('order_birth_month', intval($arrOrderBirth[1]));
         $objFormParam->setValue('order_birth_day', intval($arrOrderBirth[2]));
     }
     $objFormParam->setValue('customer_id', $customer_id);
     $objFormParam->setValue('customer_point', $arrCustomer['point']);
 }
 /**
  *
  * @deprecated 重複決済される
  * @param unknown $accountDay
  */
 function doContBillResult($accountDay)
 {
     if ($accountDay == null) {
         $accountDay = $this->getAccountDay();
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $curl = $this->curl_init();
     do {
         $zip_file = CSV_TEMP_REALDIR . "auone/" . date("Y/m/d/His") . ".zip";
         if (file_exists($zip_file)) {
             sleep(5);
         }
     } while (file_exists($zip_file));
     SC_Utils_Ex::recursiveMkdir(dirname($zip_file));
     $fp = fopen($zip_file, "w");
     // FIXME 決済認可
     $curl = $this->curl_init(false, true);
     // $post_history = array ();
     $post = $this->getPost("ContBillResult", $this->config, compact("accountDay"));
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     curl_setopt($curl, CURLOPT_HEADER, FALSE);
     curl_setopt($curl, CURLOPT_FILE, $fp);
     curl_exec($curl);
     $zip = new ZipArchive();
     if (!$zip->open($zip_file)) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
     }
     $extr = dirname($zip_file) . "/" . basename($zip_file, ".zip") . "/";
     SC_Utils_Ex::recursiveMkdir($extr);
     if (!$zip->extractTo($extr)) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
     }
     $files = glob($extr . "*.csv");
     foreach ($files as $file) {
         $enc_filepath = SC_Utils_Ex::sfEncodeFile($file, CHAR_CODE, dirname($file) . DIRECTORY_SEPARATOR);
         $fp2 = fopen($enc_filepath, "r");
         fgetcsv($fp2);
         while ($arrCsv = fgetcsv($fp2)) {
             if (count($arrCsv) == 0) {
                 // 空の列
                 continue;
             }
             if ($arrCsv[4] != $this->config["serviceId"]) {
                 // 別サービス・チェック
                 continue;
             }
             if ($arrCsv[8] != 'MPL01000') {
                 // 取消レコード
                 continue;
             }
             $pay_info_no = $arrCsv[1];
             $amount_in_tax = $arrCsv[2];
             $service_id = $arrCsv[4];
             $au_open_id = $arrCsv[5];
             $member_manage_no = $arrCsv[6];
             $process_day = $arrCsv[11];
             $cont_bill_regst_day = $arrCsv[13];
             $continue_account_id = $arrCsv[19];
             $amount = $amount_in_tax - $amount_in_tax % 100;
             $add_point = $amount;
             $where = "au_open_id =? AND status = 2 AND del_flg = 0";
             $arrWhereVal = (array) $au_open_id;
             $customer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId(null, $where, $arrWhereVal);
             if (SC_Utils_Ex::isBlank($customer)) {
                 // ユーザー復旧は手動の方がいいかもしれない。
                 continue;
             }
             $name = "継続(" . $amount_in_tax . "円)";
             $customer_id = $customer["customer_id"];
             if ($add_point) {
                 $lost_point = 0;
                 // 更新後ポイント
                 $updatePoint = array("point" => min($customer["point"] + $add_point, AU_MAXPOINT));
                 // 最大ポイントへ変更している場合は失効ポイントを計算
                 if ($updatePoint["point"] == AU_MAXPOINT) {
                     $lost_point = max($customer["point"] + $add_point, AU_MAXPOINT) - AU_MAXPOINT;
                 }
                 SC_Helper_Customer_Ex::sfEditCustomerData($updatePoint, $customer_id);
                 $objQuery->insert("cp_dtb_point_history", array("id" => $objQuery->nextVal("cp_dtb_point_history_id"), "customer_id" => $customer_id, "add_point" => $add_point, "use_point" => 0, "lost_point" => $lost_point, "order_id" => 0, "name" => $name, "create_date" => "NOW()", "update_date" => "NOW()"));
                 $arrWhereVal[] = $continue_account_id;
                 if ($objQuery->exists("cp_dtb_customer_transaction", "au_open_id=? AND del_flg=0 AND continue_account_id =?", $arrWhereVal)) {
                     // 何かしらの影響で削除された場合後続処理を行う
                     continue;
                 }
                 $objQuery->insert("cp_dtb_customer_transaction", array("id" => $objQuery->nextVal("cp_dtb_customer_transaction_id"), "customer_id" => $customer_id, "au_open_id" => $au_open_id, "transaction_id" => "", "transaction_status" => "40", "pay_info_no" => $pay_info_no, "pay_status" => 20, "continue_account_id" => $continue_account_id, "member_manage_no" => $member_manage_no, "process_day" => $process_day, "process_time" => "000000", "cont_bill_regst_day" => $cont_bill_regst_day, "cont_bill_regst_time" => "000000", "ammount" => $amount, "ammount_in_tax" => $amount_in_tax, "del_flg" => 0, "contents_id" => sprintf("%05d%09d", $service_id, $add_point), "status" => 0));
             }
         }
     }
 }
 /**
  * 会員に登録メールを再送する処理
  *
  * @param  integer $customer_id 会員ID
  * @return boolean true:成功 false:失敗
  */
 public function lfDoResendMail($customer_id)
 {
     $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
     if (SC_Utils_Ex::isBlank($arrData) or $arrData['del_flg'] == 1) {
         //対象となるデータが見つからない、または削除済み
         return false;
     }
     //仮登録メール再送
     $resend_flg = true;
     // 登録メール再送
     $objHelperMail = new SC_Helper_Mail_Ex();
     $objHelperMail->setPage($this);
     $objHelperMail->sfSendRegistMail($arrData['secret_key'], $customer_id, null, $resend_flg);
     return true;
 }
 /**
  * 退会手続き完了メール送信する
  *
  * @access private
  * @param integer $customer_id 会員ID
  * @return void
  */
 public function lfSendRefusalMail($customer_id)
 {
     // 会員データの取得
     if (SC_Utils_Ex::sfIsInt($customer_id)) {
         $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
     }
     if (SC_Utils_Ex::isBlank($arrCustomerData)) {
         return false;
     }
     $CONF = SC_Helper_DB_Ex::sfGetBasisData();
     $objMailText = new SC_SiteView_Ex();
     $objMailText->setPage($this);
     $objMailText->assign('CONF', $CONF);
     $objMailText->assign('name01', $arrCustomerData['name01']);
     $objMailText->assign('name02', $arrCustomerData['name02']);
     $objMailText->assignobj($this);
     $objHelperMail = new SC_Helper_Mail_Ex();
     $objHelperMail->setPage($this);
     $subject = $objHelperMail->sfMakeSubject('退会手続きのご完了', $objMailText);
     $toCustomerMail = $objMailText->fetch('mail_templates/customer_refusal_mail.tpl');
     $objMail = new SC_SendMail_Ex();
     $objMail->setItem('', $subject, $toCustomerMail, $CONF['email03'], $CONF['shop_name'], $CONF['email03'], $CONF['email04'], $CONF['email04'], $CONF['email01']);
     $objMail->setTo($arrCustomerData['email'], $arrCustomerData['name01'] . $arrCustomerData['name02'] . ' 様');
     $objMail->sendMail();
 }
 /**
  * 登録メールを送信する。
  *
  * @param string $secret_key 会員固有キー
  * @param integer $customer_id 会員ID
  * @param boolean $is_mobile false(default):PCアドレスにメールを送る true:携帯アドレスにメールを送る
  * @return boolean true:成功 false:失敗
  */
 function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = false)
 {
     // 会員データの取得
     if (SC_Utils_Ex::sfIsInt($customer_id)) {
         $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
     } else {
         $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId('', 'secret_key = ?', array($secret_key));
     }
     if (SC_Utils_Ex::isBlank($arrCustomerData)) {
         return false;
     }
     $CONF = SC_Helper_DB_Ex::sfGetBasisData();
     $objMailText = new SC_SiteView_Ex();
     $objMailText->setPage($this->getPage());
     $objMailText->assign('CONF', $CONF);
     $objMailText->assign('name01', $arrCustomerData['name01']);
     $objMailText->assign('name02', $arrCustomerData['name02']);
     $objMailText->assign('uniqid', $arrCustomerData['secret_key']);
     $objMailText->assignobj($arrCustomerData);
     $objMailText->assignobj($this);
     $objHelperMail = new SC_Helper_Mail_Ex();
     // 仮会員が有効の場合
     if (CUSTOMER_CONFIRM_MAIL == true and $arrCustomerData['status'] == 1) {
         $subject = $objHelperMail->sfMakeSubject(t('c_Confirmation of member registration_01'), $objMailText);
         $toCustomerMail = $objMailText->fetch('mail_templates/customer_mail.tpl');
     } else {
         $subject = $objHelperMail->sfMakeSubject(t('c_Completion of member registration_01'), $objMailText);
         $toCustomerMail = $objMailText->fetch('mail_templates/customer_regist_mail.tpl');
     }
     $objMail = new SC_SendMail_Ex();
     $objMail->setItem('', $subject, $toCustomerMail, $CONF['email03'], $CONF['shop_name'], $CONF['email03'], $CONF['email04'], $CONF['email04'], $CONF['email01']);
     // 宛先の設定
     if ($is_mobile) {
         $to_addr = $arrCustomerData['email_mobile'];
     } else {
         $to_addr = $arrCustomerData['email'];
     }
     $objMail->setTo($to_addr, t('f_NAME_FULL_SIR_01', array('T_ARG1' => $arrCustomerData['name01'], 'T_ARG2' => $arrCustomerData['name02'])));
     $objMail->sendMail();
     return true;
 }