Ignore:
Timestamp:
2012/03/27 11:12:18 (12 years ago)
Author:
eoogle
Message:

#1516 (複数受注でまとめてメール送信)

Location:
branches/version-2_12-dev/data
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/Smarty/templates/admin/order/index.tpl

    r21539 r21687  
    7676        fm.action = tmpAction; 
    7777    } 
     78     
     79     
     80    function fnSelectMailCheckSubmit(action){ 
     81 
     82        var fm = document.form1; 
     83 
     84        if (!fm["mail_order_id[]"]) { 
     85            return false; 
     86        } 
     87 
     88        var checkflag = false; 
     89        var max = fm["mail_order_id[]"].length; 
     90 
     91        if (max) { 
     92            for (var i=0; i<max; i++) { 
     93                if(fm["mail_order_id[]"][i].checked == true){ 
     94                    checkflag = true; 
     95                } 
     96            } 
     97        } else { 
     98            if(fm["mail_order_id[]"].checked == true) { 
     99                checkflag = true; 
     100            } 
     101        } 
     102 
     103        if(!checkflag){ 
     104            alert('チェックボックスが選択されていません'); 
     105            return false; 
     106        } 
     107         
     108        fm.mode.value="mail_select"; 
     109        fm.action=action; 
     110        fm.submit(); 
     111    } 
     112 
     113 
    78114//--> 
    79115</script> 
     
    305341        <a class="btn-normal" href="../contents/csv.php?tpl_subno_csv=order">CSV 出力項目設定</a> 
    306342        <a class="btn-normal" href="javascript:;" onclick="fnSelectCheckSubmit('pdf.php'); return false;"><span>PDF一括出力</span></a> 
     343        <a class="btn-normal" href="javascript:;" onclick="fnSelectMailCheckSubmit('mail.php'); return false;"><span>メール一括通知</span></a> 
    307344    </div> 
    308345    <!--{if count($arrResults) > 0}--> 
     
    313350        <table class="list"> 
    314351        <col width="10%" /> 
    315         <col width="10%" /> 
     352        <col width="8%" /> 
    316353        <col width="15%" /> 
    317         <col width="10%" /> 
     354        <col width="8%" /> 
    318355        <col width="10%" /> 
    319356        <col width="10%" /> 
     
    321358        <col width="10%" /> 
    322359        <col width="5%" /> 
    323         <col width="5%" /> 
     360        <col width="9%" /> 
    324361        <col width="5%" /> 
    325362        <!--{* ペイジェントモジュール連携用 *}--> 
     
    338375            <th><label for="pdf_check">帳票</label> <input type="checkbox" name="pdf_check" id="pdf_check" onclick="fnAllCheck(this, 'input[name=pdf_order_id[]]')" /></th> 
    339376            <th>編集</th> 
    340             <th>メール</th> 
     377            <th>メール <input type="checkbox" name="mail_check" id="mail_check" onclick="fnAllCheck(this, 'input[name=mail_order_id[]]')" /></th> 
    341378            <th>削除</th> 
    342379        </tr> 
     
    360397            <td class="center"> 
    361398                <!--{if $arrResults[cnt].order_email|strlen >= 1}--> 
    362                     <a href="?" onclick="fnChangeAction('<!--{$smarty.const.ADMIN_ORDER_MAIL_URLPATH}-->'); fnModeSubmit('pre_edit', 'order_id', '<!--{$arrResults[cnt].order_id}-->'); return false;"><span class="icon_mail">通知</span></a> 
     399                    <input type="checkbox" name="mail_order_id[]" value="<!--{$arrResults[cnt].order_id}-->" id="mail_order_id_<!--{$arrResults[cnt].order_id}-->"/><label for="mail_order_id_<!--{$arrResults[cnt].order_id}-->">一括通知</label><br> 
     400                    <a href="?" onclick="fnChangeAction('<!--{$smarty.const.ADMIN_ORDER_MAIL_URLPATH}-->'); fnModeSubmit('pre_edit', 'order_id', '<!--{$arrResults[cnt].order_id}-->'); return false;"><span class="icon_mail">個別通知</span></a> 
    363401                <!--{/if}--> 
    364402            </td> 
  • branches/version-2_12-dev/data/Smarty/templates/admin/order/mail.tpl

    r21539 r21687  
    2626<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
    2727<input type="hidden" name="mode" value="confirm" /> 
    28 <input type="hidden" name="order_id" value="<!--{$tpl_order_id}-->" /> 
     28<input type="hidden" name="order_id_array" value="<!--{$order_id_array}-->" /> 
    2929<!--{foreach key=key item=item from=$arrSearchHidden}--> 
    3030    <!--{if is_array($item)}--> 
     
    3838<div id="order" class="contents-main"> 
    3939    <h2>メール配信</h2> 
     40     
     41    <!--{if $order_id_count == 1}--> 
    4042    <table class="list"> 
    4143        <tr> 
     
    5355        <!--{/section}--> 
    5456    </table> 
     57    <!--{/if}--> 
    5558 
    5659    <table class="form"> 
  • branches/version-2_12-dev/data/Smarty/templates/admin/order/mail_confirm.tpl

    r21539 r21687  
    2626<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
    2727<input type="hidden" name="mode" value="send" /> 
    28 <input type="hidden" name="order_id" value="<!--{$tpl_order_id}-->" /> 
     28<input type="hidden" name="order_id_array" value="<!--{$order_id_array}-->" /> 
    2929<!--{foreach key=key item=item from=$arrHidden}--> 
    3030<input type="hidden" name="<!--{$key}-->" value="<!--{$item|h}-->" /> 
     
    4141<div id="order" class="contents-main"> 
    4242    <h2>メール配信</h2> 
    43  
     43     
     44     
     45    <!--{if $order_id_count != 1}--> 
     46    <span class="red">※本文は1通分の例です。受注情報は各メールごとに異なります</span><br /><br /> 
     47    <!--{/if}--> 
    4448    <table class="form"> 
    4549        <tr> 
  • branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php

    r21591 r21687  
    7474        $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance(); 
    7575        $objPlugin->doAction('lc_page_admin_order_mail_action_start', array($this)); 
    76  
     76         
     77        //一括送信用の処理 
     78        if(array_key_exists("mail_order_id",$_POST) and $_POST['mode'] == 'mail_select'){ 
     79            $_POST['order_id_array'] = implode(",",$_POST['mail_order_id']); 
     80        }else if(!array_key_exists("order_id_array",$_POST)){ 
     81            $_POST['order_id_array'] = $_POST['order_id']; 
     82        } 
     83         
     84         
     85        //一括送信処理変数チェック(ここですべきかは課題) 
     86        if(preg_match("/^[0-9|\,]*$/",$_POST['order_id_array'])){ 
     87            $this->order_id_array = $_POST['order_id_array']; 
     88        }else{ 
     89            //エラーで元に戻す 
     90            SC_Response_Ex::sendRedirect(ADMIN_ORDER_URLPATH); 
     91            exit; 
     92        } 
     93         
     94        //メール本文の確認例は初めの1受注とする 
     95        if($this->order_id_array){ 
     96            $order_id_array = split(",",$this->order_id_array); 
     97            $_POST['order_id'] = intval($order_id_array[0]); 
     98            $this->order_id_count = count($order_id_array); 
     99        } 
     100         
    77101        // パラメーター管理クラス 
    78102        $objFormParam = new SC_FormParam_Ex(); 
     
    90114        switch ($this->getMode()) { 
    91115            case 'pre_edit': 
     116            case 'mail_select': 
    92117                break; 
    93118            case 'return': 
     
    154179    function doSend(&$objFormParam) { 
    155180        $arrErr = $objFormParam->checkerror(); 
    156  
     181         
    157182        // メールの送信 
    158183        if (count($arrErr) == 0) { 
    159             // 注文受付メール 
    160             $objMail = new SC_Helper_Mail_Ex(); 
    161             $objSendMail = $objMail->sfSendOrderMail($objFormParam->getValue('order_id'), 
    162             $objFormParam->getValue('template_id'), 
    163             $objFormParam->getValue('subject'), 
    164             $objFormParam->getValue('header'), 
    165             $objFormParam->getValue('footer')); 
     184            // 注文受付メール(複数受注ID対応) 
     185            $order_id_array = explode(",",$this->order_id_array); 
     186            foreach($order_id_array as $order_id){ 
     187                $objMail = new SC_Helper_Mail_Ex(); 
     188                $objSendMail = $objMail->sfSendOrderMail($order_id, 
     189                $objFormParam->getValue('template_id'), 
     190                $objFormParam->getValue('subject'), 
     191                $objFormParam->getValue('header'), 
     192                $objFormParam->getValue('footer')); 
     193            } 
    166194            // TODO $SC_SendMail から送信がちゃんと出来たか確認できたら素敵。 
    167195            return true; 
     
    236264        // 検索条件のパラメーターを初期化 
    237265        parent::lfInitParam($objFormParam); 
    238  
    239         $objFormParam->addParam('オーダーID', 'order_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); 
    240266        $objFormParam->addParam('テンプレート', 'template_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); 
    241267        $objFormParam->addParam('メールタイトル', 'subject', STEXT_LEN, 'KVa',  array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'SPTAB_CHECK')); 
Note: See TracChangeset for help on using the changeset viewer.