예제 #1
0
             }
             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);
     } else {
         $DB->InitTableVarsForEdit("b_sender_mailing_chain", "", "str_");
     }
 } else {
 }
 $arMailngChainAttachment = array();
예제 #2
0
                 if (strlen($file["name"]) > 0 and intval($file["size"]) > 0) {
                     $resultInsertAttachFile = false;
                     $file["MODULE_ID"] = "main";
                     $fid = intval(CFile::SaveFile($file, "sender", true));
                     if ($fid > 0) {
                         $resultAddAttachFile = \Bitrix\Sender\MailingAttachmentTable::add(array('CHAIN_ID' => $ID, 'FILE_ID' => $fid));
                         $resultInsertAttachFile = $resultAddAttachFile->isSuccess();
                     }
                     if (!$resultInsertAttachFile) {
                         break;
                     }
                 }
             }
             if (isset($TEMPLATE_ACTION_SAVE) && $TEMPLATE_ACTION_SAVE == 'Y') {
                 if (!empty($TEMPLATE_ACTION_SAVE_NAME) && !empty($MESSAGE)) {
                     \Bitrix\Sender\TemplateTable::add(array('NAME' => $TEMPLATE_ACTION_SAVE_NAME, 'CONTENT' => $MESSAGE));
                 }
             }
         }
         $step = 'chain_send_type';
         $isPostedFormProcessed = true;
         LocalRedirect('sender_mailing_wizard.php?step=' . $step . '&MAILING_ID=' . $MAILING_ID . "&MAILING_CHAIN_ID=" . $MAILING_CHAIN_ID . "&lang=" . LANGUAGE_ID);
     } else {
         $DB->InitTableVarsForEdit("b_sender_mailing_chain", "", "str_");
     }
 } else {
 }
 $arMailngChainAttachment = array();
 if ($ID > 0) {
     $attachmentFileDb = \Bitrix\Sender\MailingAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('CHAIN_ID' => $ID)));
     while ($ar = $attachmentFileDb->fetch()) {
예제 #3
0
     }
     $MESSAGE = CMain::ProcessLPA($MESSAGE, $MESSAGE_OLD);
 }
 $CONTENT = '';
 if (!empty($MESSAGE)) {
     $CONTENT = $MESSAGE;
 }
 $arFields = array("ACTIVE" => $ACTIVE != "Y" ? "N" : "Y", "CONTENT" => $CONTENT, "NAME" => $NAME);
 if ($ID > 0) {
     $mailingUpdateDb = \Bitrix\Sender\TemplateTable::update($ID, $arFields);
     $res = $mailingUpdateDb->isSuccess();
     if (!$res) {
         $arError = $mailingUpdateDb->getErrorMessages();
     }
 } else {
     $mailingAddDb = \Bitrix\Sender\TemplateTable::add($arFields);
     if ($mailingAddDb->isSuccess()) {
         $ID = $mailingAddDb->getId();
         $res = $ID > 0;
     } else {
         $arError = $mailingAddDb->getErrorMessages();
     }
 }
 if ($res) {
     if ($apply != "") {
         LocalRedirect("/bitrix/admin/sender_template_edit.php?ID=" . $ID . "&lang=" . LANG . "&" . $tabControl->ActiveTabParam());
     } else {
         LocalRedirect("/bitrix/admin/sender_template_admin.php?lang=" . LANG);
     }
 } else {
     if (!empty($arError)) {