[Svn-src-all:2788] [version-2_12-dev 21687] #1516 (複数受注でまとめてメール送信)
eoogle
admin @ mail.ec-cube.net
2012年 3月 27日 (火) 11:12:19 JST
Subversion committed to /home/svn/open 21687
http://svn.ec-cube.net/open_trac/changeset/21687
┌────────────────────────────┐
│更新者 : eoogle │
│更新日時: 2012-03-27 11:12:18 +0900 (火, 27 3月 2012)│
└────────────────────────────┘
Log:
--------------------------------------------------------
#1516 (複数受注でまとめてメール送信)
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
U branches/version-2_12-dev/data/Smarty/templates/admin/order/index.tpl
U branches/version-2_12-dev/data/Smarty/templates/admin/order/mail.tpl
U branches/version-2_12-dev/data/Smarty/templates/admin/order/mail_confirm.tpl
U branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php
変更: branches/version-2_12-dev/data/Smarty/templates/admin/order/index.tpl
===================================================================
--- branches/version-2_12-dev/data/Smarty/templates/admin/order/index.tpl 2012-03-26 12:56:25 UTC (rev 21686)
+++ branches/version-2_12-dev/data/Smarty/templates/admin/order/index.tpl 2012-03-27 02:12:18 UTC (rev 21687)
@@ -75,6 +75,42 @@
fm.mode.value = tmpMode;
fm.action = tmpAction;
}
+
+
+ function fnSelectMailCheckSubmit(action){
+
+ var fm = document.form1;
+
+ if (!fm["mail_order_id[]"]) {
+ return false;
+ }
+
+ var checkflag = false;
+ var max = fm["mail_order_id[]"].length;
+
+ if (max) {
+ for (var i=0; i<max; i++) {
+ if(fm["mail_order_id[]"][i].checked == true){
+ checkflag = true;
+ }
+ }
+ } else {
+ if(fm["mail_order_id[]"].checked == true) {
+ checkflag = true;
+ }
+ }
+
+ if(!checkflag){
+ alert('チェックボックスが選択されていません');
+ return false;
+ }
+
+ fm.mode.value="mail_select";
+ fm.action=action;
+ fm.submit();
+ }
+
+
//-->
</script>
<div id="order" class="contents-main">
@@ -304,6 +340,7 @@
<a class="btn-normal" href="javascript:;" onclick="fnModeSubmit('csv','',''); return false;">CSV ダウンロード</a>
<a class="btn-normal" href="../contents/csv.php?tpl_subno_csv=order">CSV 出力項目設定</a>
<a class="btn-normal" href="javascript:;" onclick="fnSelectCheckSubmit('pdf.php'); return false;"><span>PDF一括出力</span></a>
+ <a class="btn-normal" href="javascript:;" onclick="fnSelectMailCheckSubmit('mail.php'); return false;"><span>メール一括通知</span></a>
</div>
<!--{if count($arrResults) > 0}-->
@@ -312,16 +349,16 @@
<!--{* 検索結果表示テーブル *}-->
<table class="list">
<col width="10%" />
- <col width="10%" />
+ <col width="8%" />
<col width="15%" />
+ <col width="8%" />
<col width="10%" />
<col width="10%" />
<col width="10%" />
<col width="10%" />
- <col width="10%" />
<col width="5%" />
+ <col width="9%" />
<col width="5%" />
- <col width="5%" />
<!--{* ペイジェントモジュール連携用 *}-->
<!--{assign var=path value=`$smarty.const.MODULE_REALDIR`mdl_paygent/paygent_order_index.tpl}-->
<!--{if file_exists($path)}-->
@@ -337,7 +374,7 @@
<th>対応状況</th>
<th><label for="pdf_check">帳票</label> <input type="checkbox" name="pdf_check" id="pdf_check" onclick="fnAllCheck(this, 'input[name=pdf_order_id[]]')" /></th>
<th>編集</th>
- <th>メール</th>
+ <th>メール <input type="checkbox" name="mail_check" id="mail_check" onclick="fnAllCheck(this, 'input[name=mail_order_id[]]')" /></th>
<th>削除</th>
</tr>
@@ -359,7 +396,8 @@
<td class="center"><a href="?" onclick="fnChangeAction('<!--{$smarty.const.ADMIN_ORDER_EDIT_URLPATH}-->'); fnModeSubmit('pre_edit', 'order_id', '<!--{$arrResults[cnt].order_id}-->'); return false;"><span class="icon_edit">編集</span></a></td>
<td class="center">
<!--{if $arrResults[cnt].order_email|strlen >= 1}-->
- <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>
+ <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>
+ <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>
<!--{/if}-->
</td>
<td class="center"><a href="?" onclick="fnModeSubmit('delete_order', 'order_id', <!--{$arrResults[cnt].order_id}-->); return false;"><span class="icon_delete">削除</span></a></td>
変更: branches/version-2_12-dev/data/Smarty/templates/admin/order/mail.tpl
===================================================================
--- branches/version-2_12-dev/data/Smarty/templates/admin/order/mail.tpl 2012-03-26 12:56:25 UTC (rev 21686)
+++ branches/version-2_12-dev/data/Smarty/templates/admin/order/mail.tpl 2012-03-27 02:12:18 UTC (rev 21687)
@@ -25,7 +25,7 @@
<form name="form1" id="form1" method="post" action="?">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="confirm" />
-<input type="hidden" name="order_id" value="<!--{$tpl_order_id}-->" />
+<input type="hidden" name="order_id_array" value="<!--{$order_id_array}-->" />
<!--{foreach key=key item=item from=$arrSearchHidden}-->
<!--{if is_array($item)}-->
<!--{foreach item=c_item from=$item}-->
@@ -37,6 +37,8 @@
<!--{/foreach}-->
<div id="order" class="contents-main">
<h2>メール配信</h2>
+
+ <!--{if $order_id_count == 1}-->
<table class="list">
<tr>
<th>処理日</th>
@@ -52,6 +54,7 @@
</tr>
<!--{/section}-->
</table>
+ <!--{/if}-->
<table class="form">
<tr>
変更: branches/version-2_12-dev/data/Smarty/templates/admin/order/mail_confirm.tpl
===================================================================
--- branches/version-2_12-dev/data/Smarty/templates/admin/order/mail_confirm.tpl 2012-03-26 12:56:25 UTC (rev 21686)
+++ branches/version-2_12-dev/data/Smarty/templates/admin/order/mail_confirm.tpl 2012-03-27 02:12:18 UTC (rev 21687)
@@ -25,7 +25,7 @@
<form name="form1" id="form1" method="post" action="?">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="send" />
-<input type="hidden" name="order_id" value="<!--{$tpl_order_id}-->" />
+<input type="hidden" name="order_id_array" value="<!--{$order_id_array}-->" />
<!--{foreach key=key item=item from=$arrHidden}-->
<input type="hidden" name="<!--{$key}-->" value="<!--{$item|h}-->" />
<!--{/foreach}-->
@@ -40,7 +40,11 @@
<!--{/foreach}-->
<div id="order" class="contents-main">
<h2>メール配信</h2>
-
+
+
+ <!--{if $order_id_count != 1}-->
+ <span class="red">※本文は1通分の例です。受注情報は各メールごとに異なります</span><br /><br />
+ <!--{/if}-->
<table class="form">
<tr>
<th>件名</th>
変更: branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php
===================================================================
--- branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php 2012-03-26 12:56:25 UTC (rev 21686)
+++ branches/version-2_12-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php 2012-03-27 02:12:18 UTC (rev 21687)
@@ -73,7 +73,31 @@
// フックポイント.
$objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance();
$objPlugin->doAction('lc_page_admin_order_mail_action_start', array($this));
-
+
+ //一括送信用の処理
+ if(array_key_exists("mail_order_id",$_POST) and $_POST['mode'] == 'mail_select'){
+ $_POST['order_id_array'] = implode(",",$_POST['mail_order_id']);
+ }else if(!array_key_exists("order_id_array",$_POST)){
+ $_POST['order_id_array'] = $_POST['order_id'];
+ }
+
+
+ //一括送信処理変数チェック(ここですべきかは課題)
+ if(preg_match("/^[0-9|\,]*$/",$_POST['order_id_array'])){
+ $this->order_id_array = $_POST['order_id_array'];
+ }else{
+ //エラーで元に戻す
+ SC_Response_Ex::sendRedirect(ADMIN_ORDER_URLPATH);
+ exit;
+ }
+
+ //メール本文の確認例は初めの1受注とする
+ if($this->order_id_array){
+ $order_id_array = split(",",$this->order_id_array);
+ $_POST['order_id'] = intval($order_id_array[0]);
+ $this->order_id_count = count($order_id_array);
+ }
+
// パラメーター管理クラス
$objFormParam = new SC_FormParam_Ex();
// パラメーター情報の初期化
@@ -89,6 +113,7 @@
switch ($this->getMode()) {
case 'pre_edit':
+ case 'mail_select':
break;
case 'return':
break;
@@ -153,16 +178,19 @@
*/
function doSend(&$objFormParam) {
$arrErr = $objFormParam->checkerror();
-
+
// メールの送信
if (count($arrErr) == 0) {
- // 注文受付メール
- $objMail = new SC_Helper_Mail_Ex();
- $objSendMail = $objMail->sfSendOrderMail($objFormParam->getValue('order_id'),
- $objFormParam->getValue('template_id'),
- $objFormParam->getValue('subject'),
- $objFormParam->getValue('header'),
- $objFormParam->getValue('footer'));
+ // 注文受付メール(複数受注ID対応)
+ $order_id_array = explode(",",$this->order_id_array);
+ foreach($order_id_array as $order_id){
+ $objMail = new SC_Helper_Mail_Ex();
+ $objSendMail = $objMail->sfSendOrderMail($order_id,
+ $objFormParam->getValue('template_id'),
+ $objFormParam->getValue('subject'),
+ $objFormParam->getValue('header'),
+ $objFormParam->getValue('footer'));
+ }
// TODO $SC_SendMail から送信がちゃんと出来たか確認できたら素敵。
return true;
}
@@ -235,8 +263,6 @@
function lfInitParam(&$objFormParam) {
// 検索条件のパラメーターを初期化
parent::lfInitParam($objFormParam);
-
- $objFormParam->addParam('オーダーID', 'order_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
$objFormParam->addParam('テンプレート', 'template_id', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
$objFormParam->addParam('メールタイトル', 'subject', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'SPTAB_CHECK'));
$objFormParam->addParam('ヘッダー', 'header', LTEXT_LEN, 'KVa', array('MAX_LENGTH_CHECK', 'SPTAB_CHECK'));
Svn-src-all メーリングリストの案内