function replace_order_email($oID, $email_order, $email_template_id)
{
    return replace_status_email($oID, $email_order, $email_template_id);
}
 function orders($notifier, $redirect = null, $order_id = null, $language_id = null)
 {
     global $messageStack;
     global $request_type;
     if (is_null($order_id)) {
         $order_id = isset($_GET['oID']) ? $_GET['oID'] : null;
     }
     if (is_null($redirect)) {
         $redirect = zen_href_link($this->pagename, zen_get_all_get_params(array('action')) . 'action=edit', $request_type);
     }
     switch ($notifier) {
         case 'NOTIFY_BEFORE_CREATE_HEADER':
             if (!empty($_POST['email_template_id']) && is_numeric($_POST['email_template_id'])) {
                 // template本文取得
                 $id = $_POST['email_template_id'];
                 $subject = get_email_template_contents($id, $order_id, $language_id, 'subject');
                 if ($subject === false) {
                     // template取得できなければredirect
                     $messageStack->add_session(TEXT_EMAIL_TEMPLATE_NO_TEMPLATE, 'warning');
                     zen_redirect($redirect);
                 }
                 if (strpos($GLOBALS['phpmailer']['Subject'], SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT) !== false) {
                     // admin 宛のメールはsubjectにprefixを付ける
                     $GLOBALS['phpmailer']['Subject'] = SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . zen_db_prepare_input($subject) . ' #' . $GLOBALS['oID'];
                 } else {
                     $GLOBALS['phpmailer']['Subject'] = zen_db_prepare_input($subject) . ' #' . $GLOBALS['oID'];
                 }
             } else {
                 // idが無効ならredirect
                 $messageStack->add_session(TEXT_EMAIL_TEMPLATE_NO_TEMPLATE, 'warning');
                 zen_redirect($redirect);
             }
             break;
         case 'NOTIFY_BEFORE_CREATE_BODY':
             if (!empty($_POST['email_template_id']) && is_numeric($_POST['email_template_id'])) {
                 // template本文取得
                 $id = $_POST['email_template_id'];
                 $contents = get_email_template_contents($id, $order_id, $language_id, 'contents');
                 if ($contents === false) {
                     // template取得できなければredirect
                     $messageStack->add_session(TEXT_EMAIL_TEMPLATE_NO_TEMPLATE, 'warning');
                     zen_redirect($redirect);
                 }
                 // 注文ステータス変更時にコメントがあれば置換
                 $GLOBALS['phpmailer']['Body'] = zen_db_prepare_input($contents);
                 if (!empty($GLOBALS['phpmailer']['AltBody'])) {
                     $GLOBALS['phpmailer']['AltBody'] = zen_db_prepare_input($contents);
                 }
                 // 置換開始
                 $GLOBALS['phpmailer']['Body'] = replace_status_email($GLOBALS['oID'], $GLOBALS['phpmailer']['Body'], $id);
                 $GLOBALS['phpmailer']['Body'] = $this->_cleanup_email($GLOBALS['phpmailer']['Body']);
                 if (!empty($GLOBALS['phpmailer']['AltBody'])) {
                     $GLOBALS['phpmailer']['AltBody'] = replace_status_email($GLOBALS['oID'], $GLOBALS['phpmailer']['AltBody'], $id);
                     $GLOBALS['phpmailer']['AltBody'] = $this->_cleanup_email($GLOBALS['phpmailer']['AltBody']);
                 }
                 if ($this->pagename == 'orders') {
                     // DBへのログ記録用に置換後のコメントをセット(orders.php)
                     $GLOBALS['comments'] = zen_db_prepare_input($_POST['comments']);
                 }
             } else {
                 // idが無効ならredirect
                 $messageStack->add_session(TEXT_EMAIL_TEMPLATE_NO_TEMPLATE, 'warning');
                 zen_redirect($redirect);
             }
             break;
     }
 }