Ignore:
Timestamp:
2007/09/05 16:10:26 (17 years ago)
Author:
nanasess
Message:

リファクタリング

  • Mail 関連のクラスを helper へ移動
Location:
branches/feature-module-update/data/class
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/util/SC_Utils.php

    r15615 r15618  
    325325 
    326326    /* 前のページで正しく登録が行われたか判定 */ 
    327     function sfIsPrePage($objSiteSess, $is_mobile = false) { 
     327    function sfIsPrePage(&$objSiteSess, $is_mobile = false) { 
    328328        $ret = $objSiteSess->isPrePage(); 
    329329        if($ret != true) { 
    330330            // エラーページの表示 
    331             sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile); 
    332         } 
    333     } 
    334  
    335     function sfCheckNormalAccess($objSiteSess, $objCartSess) { 
     331            SC_Utils::sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile); 
     332        } 
     333    } 
     334 
     335    function sfCheckNormalAccess(&$objSiteSess, $objCartSess) { 
    336336        // ユーザユニークIDの取得 
    337337        $uniqid = $objSiteSess->getUniqId(); 
     
    342342        if($ret != true) { 
    343343            // エラーページの表示 
    344             sfDispSiteError(CANCEL_PURCHASE, $objSiteSess); 
     344            SC_Utils_Ex::sfDispSiteError(CANCEL_PURCHASE, $objSiteSess); 
    345345        } 
    346346 
     
    350350        if($ret == true || !($quantity > 0)) { 
    351351            // カート情報表示に強制移動する 
    352             header("Location: ".URL_CART_TOP); 
     352            header("Location: ".URL_CART_TOP); // FIXME 
    353353            exit; 
    354354        } 
     
    944944    } 
    945945 
    946     /* DBに登録されたテンプレートメールの送信 */ 
    947     function sfSendTemplateMail($to, $to_name, $template_id, $objPage) { 
    948         global $arrMAILTPLPATH; 
    949         $objQuery = new SC_Query(); 
    950         // メールテンプレート情報の取得 
    951         $where = "template_id = ?"; 
    952         $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id)); 
    953         $objPage->tpl_header = $arrRet[0]['header']; 
    954         $objPage->tpl_footer = $arrRet[0]['footer']; 
    955         $tmp_subject = $arrRet[0]['subject']; 
    956  
    957         $objSiteInfo = new SC_SiteInfo(); 
    958         $arrInfo = $objSiteInfo->data; 
    959  
    960         $objMailView = new SC_SiteView(); 
    961         // メール本文の取得 
    962         $objMailView->assignobj($objPage); 
    963         $body = $objMailView->fetch($arrMAILTPLPATH[$template_id]); 
    964  
    965         // メール送信処理 
    966         $objSendMail = new GC_SendMail(); 
    967         $from = $arrInfo['email03']; 
    968         $error = $arrInfo['email04']; 
    969         $tosubject = $tmp_subject; 
    970         $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error); 
    971         $objSendMail->setTo($to, $to_name); 
    972         $objSendMail->sendMail();   // メール送信 
    973     } 
    974  
    975     /* 受注完了メール送信 */ 
    976     function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) { 
    977         global $arrMAILTPLPATH; 
    978  
    979         $objPage = new LC_Page(); 
    980         $objSiteInfo = new SC_SiteInfo(); 
    981         $arrInfo = $objSiteInfo->data; 
    982         $objPage->arrInfo = $arrInfo; 
    983  
    984         $objQuery = new SC_Query(); 
    985  
    986         if($subject == "" && $header == "" && $footer == "") { 
    987             // メールテンプレート情報の取得 
    988             $where = "template_id = ?"; 
    989             $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array('1')); 
    990             $objPage->tpl_header = $arrRet[0]['header']; 
    991             $objPage->tpl_footer = $arrRet[0]['footer']; 
    992             $tmp_subject = $arrRet[0]['subject']; 
    993         } else { 
    994             $objPage->tpl_header = $header; 
    995             $objPage->tpl_footer = $footer; 
    996             $tmp_subject = $subject; 
    997         } 
    998  
    999         // 受注情報の取得 
    1000         $where = "order_id = ?"; 
    1001         $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id)); 
    1002         $arrOrder = $arrRet[0]; 
    1003         $arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id)); 
    1004  
    1005         $objPage->Message_tmp = $arrOrder['message']; 
    1006  
    1007         // 顧客情報の取得 
    1008         $customer_id = $arrOrder['customer_id']; 
    1009         $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id)); 
    1010         $arrCustomer = $arrRet[0]; 
    1011  
    1012         $objPage->arrCustomer = $arrCustomer; 
    1013         $objPage->arrOrder = $arrOrder; 
    1014  
    1015         //その他決済情報 
    1016         if($arrOrder['memo02'] != "") { 
    1017             $arrOther = unserialize($arrOrder['memo02']); 
    1018  
    1019             foreach($arrOther as $other_key => $other_val){ 
    1020                 if(sfTrim($other_val["value"]) == ""){ 
    1021                     $arrOther[$other_key]["value"] = ""; 
    1022                 } 
    1023             } 
    1024  
    1025             $objPage->arrOther = $arrOther; 
    1026         } 
    1027  
    1028         // 都道府県変換 
    1029         global $arrPref; 
    1030         $objPage->arrOrder['deliv_pref'] = $arrPref[$objPage->arrOrder['deliv_pref']]; 
    1031  
    1032         $objPage->arrOrderDetail = $arrOrderDetail; 
    1033  
    1034         $objCustomer = new SC_Customer(); 
    1035         $objPage->tpl_user_point = $objCustomer->getValue('point'); 
    1036  
    1037         $objMailView = new SC_SiteView(); 
    1038         // メール本文の取得 
    1039         $objMailView->assignobj($objPage); 
    1040         $body = $objMailView->fetch($arrMAILTPLPATH[$template_id]); 
    1041  
    1042         // メール送信処理 
    1043         $objSendMail = new GC_SendMail(); 
    1044         $bcc = $arrInfo['email01']; 
    1045         $from = $arrInfo['email03']; 
    1046         $error = $arrInfo['email04']; 
    1047  
    1048         $tosubject = sfMakeSubject($tmp_subject); 
    1049  
    1050         $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); 
    1051         $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " ". $arrOrder["order_name02"] ." 様"); 
    1052  
    1053  
    1054         // 送信フラグ:trueの場合は、送信する。 
    1055         if($send) { 
    1056             if ($objSendMail->sendMail()) { 
    1057                 sfSaveMailHistory($order_id, $template_id, $tosubject, $body); 
    1058             } 
    1059         } 
    1060  
    1061         return $objSendMail; 
    1062     } 
    1063  
    1064     // テンプレートを使用したメールの送信 
    1065     function sfSendTplMail($to, $subject, $tplpath, $objPage) { 
    1066         $objMailView = new SC_SiteView(); 
    1067         $objSiteInfo = new SC_SiteInfo(); 
    1068         $arrInfo = $objSiteInfo->data; 
    1069         // メール本文の取得 
    1070         $objPage->tpl_shopname=$arrInfo['shop_name']; 
    1071         $objPage->tpl_infoemail = $arrInfo['email02']; 
    1072         $objMailView->assignobj($objPage); 
    1073         $body = $objMailView->fetch($tplpath); 
    1074         // メール送信処理 
    1075         $objSendMail = new GC_SendMail(); 
    1076         $to = mb_encode_mimeheader($to); 
    1077         $bcc = $arrInfo['email01']; 
    1078         $from = $arrInfo['email03']; 
    1079         $error = $arrInfo['email04']; 
    1080         $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); 
    1081         $objSendMail->sendMail(); 
    1082     } 
    1083  
    1084     // 通常のメール送信 
    1085     function sfSendMail($to, $subject, $body) { 
    1086         $objSiteInfo = new SC_SiteInfo(); 
    1087         $arrInfo = $objSiteInfo->data; 
    1088         // メール送信処理 
    1089         $objSendMail = new GC_SendMail(); 
    1090         $bcc = $arrInfo['email01']; 
    1091         $from = $arrInfo['email03']; 
    1092         $error = $arrInfo['email04']; 
    1093         $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); 
    1094         $objSendMail->sendMail(); 
    1095     } 
    1096  
    1097     //件名にテンプレートを用いる 
    1098     function sfMakeSubject($subject){ 
    1099  
    1100         $objQuery = new SC_Query(); 
    1101         $objMailView = new SC_SiteView(); 
    1102         $objPage = new LC_Page(); 
    1103  
    1104         $arrInfo = $objQuery->select("*","dtb_baseinfo"); 
    1105         $arrInfo = $arrInfo[0]; 
    1106         $objPage->tpl_shopname=$arrInfo['shop_name']; 
    1107         $objPage->tpl_infoemail=$subject; 
    1108         $objMailView->assignobj($objPage); 
    1109         $mailtitle = $objMailView->fetch('mail_templates/mail_title.tpl'); 
    1110         $ret = $mailtitle.$subject; 
    1111         return $ret; 
    1112     } 
    1113  
    1114     // メール配信履歴への登録 
    1115     function sfSaveMailHistory($order_id, $template_id, $subject, $body) { 
    1116         $sqlval['subject'] = $subject; 
    1117         $sqlval['order_id'] = $order_id; 
    1118         $sqlval['template_id'] = $template_id; 
    1119         $sqlval['send_date'] = "Now()"; 
    1120         if($_SESSION['member_id'] != "") { 
    1121             $sqlval['creator_id'] = $_SESSION['member_id']; 
    1122         } else { 
    1123             $sqlval['creator_id'] = '0'; 
    1124         } 
    1125         $sqlval['mail_body'] = $body; 
    1126  
    1127         $objQuery = new SC_Query(); 
    1128         $objQuery->insert("dtb_mail_history", $sqlval); 
    1129     } 
    1130  
    1131     /* 会員のメルマガ登録があるかどうかのチェック(仮会員を含まない) */ 
    1132     function sfCheckCustomerMailMaga($email) { 
    1133         $col = "email, mailmaga_flg, customer_id"; 
    1134         $from = "dtb_customer"; 
    1135         $where = "email = ? AND status = 2"; 
    1136         $objQuery = new SC_Query(); 
    1137         $arrRet = $objQuery->select($col, $from, $where, array($email)); 
    1138         // 会員のメールアドレスが登録されている 
    1139         if($arrRet[0]['customer_id'] != "") { 
    1140             return true; 
    1141         } 
    1142         return false; 
    1143     } 
    1144  
    1145946    // カードの処理結果を返す 
    1146947    function sfGetAuthonlyResult($dir, $file_name, $name01, $name02, $card_no, $card_exp, $amount, $order_id, $jpo_info = "10"){ 
Note: See TracChangeset for help on using the changeset viewer.