Ejemplo n.º 1
0
                 $resultInsertAttachFile = $resultAddAttachFile->isSuccess();
             }
             if (!$resultInsertAttachFile) {
                 break;
             }
         }
     }
     if (isset($TEMPLATE_ACTION_SAVE) && $TEMPLATE_ACTION_SAVE == 'Y') {
         if (!empty($TEMPLATE_ACTION_SAVE_NAME) && !empty($MESSAGE)) {
             $CONTENT = $MESSAGE;
             $useBlockEditor = false;
             if ($TEMPLATE_TYPE && $TEMPLATE_ID) {
                 \Bitrix\Main\Loader::includeModule('fileman');
                 $chainTemplate = \Bitrix\Sender\Preset\Template::getById($TEMPLATE_TYPE, $TEMPLATE_ID);
                 if ($chainTemplate && $chainTemplate['HTML']) {
                     $CONTENT = \Bitrix\Fileman\Block\Editor::fillTemplateBySliceContent($chainTemplate['HTML'], $CONTENT);
                     if ($CONTENT) {
                         $useBlockEditor = true;
                     }
                 }
             }
             $addResult = \Bitrix\Sender\TemplateTable::add(array('NAME' => $TEMPLATE_ACTION_SAVE_NAME, 'CONTENT' => $CONTENT));
             if ($useBlockEditor && $addResult->isSuccess()) {
                 \Bitrix\Sender\MailingChainTable::update(array('ID' => $ID), array('TEMPLATE_TYPE' => 'USER', 'TEMPLATE_ID' => $addResult->getId()));
             }
         }
     }
 }
 $step = 'chain_send_type';
 $isPostedFormProcessed = true;
 LocalRedirect('sender_mailing_wizard.php?IS_TRIGGER=N&step=' . $step . '&MAILING_ID=' . $MAILING_ID . "&MAILING_CHAIN_ID=" . $MAILING_CHAIN_ID . "&lang=" . LANGUAGE_ID);