foreach ($arTriggerSettings as $item) {
        $arTriggerSettingsTmp[intval($item['ITEM_SORT'])] = $item;
    }
    ksort($arTriggerSettingsTmp);
    $arTriggerSettings = $arTriggerSettingsTmp;
    // format chain fields
    $arTriggerSettingsTmp = array();
    foreach ($arTriggerSettings as $item) {
        unset($item['ITEM_SORT']);
        $item['EMAIL_FROM'] = $mailing['EMAIL_FROM'];
        $item['CREATED_BY'] = $USER->GetID();
        $arTriggerSettingsTmp[] = $item;
    }
    $arTriggerSettings = $arTriggerSettingsTmp;
    // save chain
    $result = \Bitrix\Sender\MailingTable::updateChain($ID, $arTriggerSettings);
    $errorList = array_merge($errorList, $result->getErrorMessages());
    if (empty($errorList)) {
        if ($save != "") {
            LocalRedirect('/bitrix/admin/sender_mailing_trig_admin.php?lang=' . LANGUAGE_ID);
        } else {
            LocalRedirect('/bitrix/admin/sender_mailing_trig_edit.php?ID=' . $ID . '&lang=' . LANGUAGE_ID);
        }
    }
    $chainFieldsList = $arTriggerSettings;
} else {
    $chainFieldsList = \Bitrix\Sender\MailingTable::getChain($ID);
}
$numberChainItem = 0;
$chainFieldsListTmp = array();
foreach ($chainFieldsList as $chain) {
Exemple #2
0
         } else {
             $arError[] = GetMessage("sender_chain_edit_error_tmpl_no_found") . ' "' . $MAILING_TEMPLATE_CODE . '".';
         }
     }
     if (empty($arError)) {
         if ($MAILING_ID > 0) {
             $updateDb = \Bitrix\Sender\MailingTable::update($MAILING_ID, $arFields);
             if (!$updateDb->isSuccess()) {
                 $arError = array_merge($arError, $updateDb->getErrorMessages());
             }
         } else {
             $arFields['ACTIVE'] = 'N';
             $addDb = \Bitrix\Sender\MailingTable::add($arFields);
             if ($addDb->isSuccess()) {
                 $MAILING_ID = $addDb->getId();
                 $resultDb = \Bitrix\Sender\MailingTable::updateChain($MAILING_ID, $chainList);
                 $resultDb->isSuccess();
             } else {
                 $arError = array_merge($arError, $addDb->getErrorMessages());
             }
         }
     }
     if (empty($arError)) {
         $isPostedFormProcessed = true;
         $step = 'trig_mailing_group';
         LocalRedirect('sender_mailing_wizard.php?IS_TRIGGER=Y&step=' . $step . '&MAILING_ID=' . $MAILING_ID . "&lang=" . LANGUAGE_ID);
     } else {
     }
     $DB->InitTableVarsForEdit("b_sender_mailing", "", "str_");
 } else {
     ClearVars();