Ignore:
Timestamp:
2013/02/26 20:55:22 (11 years ago)
Author:
pineray
Message:

#2164 pageクラスからdtb_mailtemplateテーブルを直接指定している箇所をなくす

Location:
branches/version-2_12-dev/data/class
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Mail.php

    r22567 r22584  
    7676    { 
    7777 
    78         $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    7978        // メールテンプレート情報の取得 
    80         $where = 'template_id = ?'; 
    81         $arrRet = $objQuery->select('subject, header, footer', 'dtb_mailtemplate', $where, array($template_id)); 
    82         $objPage->tpl_header = $arrRet[0]['header']; 
    83         $objPage->tpl_footer = $arrRet[0]['footer']; 
    84         $tmp_subject = $arrRet[0]['subject']; 
     79        $objMailtemplate = new SC_Helper_Mailtemplate_Ex(); 
     80        $mailtemplate = $objMailtemplate->get($template_id); 
     81        $objPage->tpl_header = $mailtemplate['header']; 
     82        $objPage->tpl_footer = $mailtemplate['footer']; 
     83        $tmp_subject = $mailtemplate['subject']; 
    8584 
    8685        $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); 
     
    117116        if ($subject == '' && $header == '' && $footer == '') { 
    118117            // メールテンプレート情報の取得 
    119             $where = 'template_id = ?'; 
    120             $arrRet = $objQuery->select('subject, header, footer', 'dtb_mailtemplate', $where, array($template_id)); 
    121             $arrTplVar->tpl_header = $arrRet[0]['header']; 
    122             $arrTplVar->tpl_footer = $arrRet[0]['footer']; 
    123             $tmp_subject = $arrRet[0]['subject']; 
     118            $objMailtemplate = new SC_Helper_Mailtemplate_Ex(); 
     119            $mailtemplate = $objMailtemplate->get($template_id); 
     120            $arrTplVar->tpl_header = $mailtemplate['header']; 
     121            $arrTplVar->tpl_footer = $mailtemplate['footer']; 
     122            $tmp_subject = $mailtemplate['subject']; 
    124123        } else { 
    125124            $arrTplVar->tpl_header = $header; 
  • branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php

    r22567 r22584  
    7373 
    7474        $masterData = new SC_DB_MasterData_Ex(); 
     75        $objMailtemplate = new SC_Helper_Mailtemplate_Ex(); 
    7576 
    7677        $mode = $this->getMode(); 
     
    9091        switch ($mode) { 
    9192            case 'id_set': 
    92                     $result = $this->lfGetMailTemplateByTemplateID($post['template_id']); 
    93                     if ($result) { 
    94                         $this->arrForm = $result[0]; 
     93                    $mailtemplate = $objMailtemplate->get($post['template_id']); 
     94                    if ($mailtemplate) { 
     95                        $this->arrForm = $mailtemplate; 
    9596                    } else { 
    9697                        $this->arrForm['template_id'] = $post['template_id']; 
     
    106107                    } else { 
    107108                        // 正常 
    108                         $this->lfRegistMailTemplate($this->arrForm, $_SESSION['member_id']); 
     109                        $this->lfRegistMailTemplate($this->arrForm, $_SESSION['member_id'], $objMailtemplate); 
    109110 
    110111                        // 完了メッセージ 
     
    129130    } 
    130131 
    131     function lfGetMailTemplateByTemplateID($template_id) 
     132    function lfRegistMailTemplate($post, $member_id, SC_Helper_Mailtemplate_Ex $objMailtemplate) 
    132133    { 
    133         $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    134  
    135         $sql = 'SELECT * FROM dtb_mailtemplate WHERE template_id = ?'; 
    136         return $objQuery->getAll($sql, array($template_id)); 
    137     } 
    138  
    139     function lfRegistMailTemplate($post, $member_id) 
    140     { 
    141         $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    142  
    143134        $post['creator_id'] = $member_id; 
    144         $post['update_date'] = 'CURRENT_TIMESTAMP'; 
    145  
    146         $sql = 'SELECT * FROM dtb_mailtemplate WHERE template_id = ?'; 
    147         $template_data = $objQuery->getAll($sql, array($post['template_id'])); 
    148         if ($template_data) { 
    149             $sql_where = 'template_id = ?'; 
    150             $objQuery->update('dtb_mailtemplate', $post, $sql_where, array(addslashes($post['template_id']))); 
    151         } else { 
    152             $objQuery->insert('dtb_mailtemplate', $post); 
    153         } 
    154  
     135        $objMailtemplate->save($post); 
    155136    } 
    156137 
  • branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php

    r22567 r22584  
    227227    function changeData(&$objFormParam) 
    228228    { 
    229         $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    230  
    231229        $template_id = $objFormParam->getValue('template_id'); 
    232230 
     
    237235        // 有効選択時 
    238236        elseif (SC_Utils_Ex::sfIsInt($template_id)) { 
    239             $where = 'template_id = ?'; 
    240             $arrWhereVal = array($template_id); 
    241             $mailTemplates = $objQuery->getRow('subject, header, footer', 'dtb_mailtemplate', $where, $arrWhereVal); 
     237            $objMailtemplate = new SC_Helper_Mailtemplate_Ex(); 
     238            $mailTemplates = $objMailtemplate->get($template_id); 
    242239        } 
    243240        // 不正選択時 
Note: See TracChangeset for help on using the changeset viewer.