Example #1
0
 /**
  * @param Entity\Event $event
  * @return Entity\EventResult
  */
 public static function onAfterDelete(Entity\Event $event)
 {
     $result = new Entity\EventResult();
     $data = $event->getParameters();
     $primary = array('GROUP_ID' => $data['primary']['ID']);
     GroupConnectorTable::delete($primary);
     return $result;
 }
Example #2
0
    }
}
//Edit/Add part
ClearVars();
$str_SORT = 100;
$str_ACTIVE = "Y";
$str_VISIBLE = "Y";
if ($ID > 0) {
    $rubric = new CDBResult(\Bitrix\Sender\GroupTable::getById($ID));
    if (!$rubric->ExtractFields("str_")) {
        $ID = 0;
    }
}
$endpointList = array();
if ($ID > 0) {
    $groupConnectorDb = \Bitrix\Sender\GroupConnectorTable::getList(array('filter' => array('GROUP_ID' => $ID)));
    while ($groupConnector = $groupConnectorDb->fetch()) {
        if (!empty($groupConnector['ENDPOINT'])) {
            $endpointList[] = $groupConnector['ENDPOINT'];
        }
    }
}
if ($bVarsFromForm) {
    $DB->InitTableVarsForEdit("b_sender_group", "", "str_");
}
if (isset($CONNECTOR_SETTING)) {
    $arConnectorSettings = $CONNECTOR_SETTING;
} else {
    $arConnectorSettings = array();
}
if (count($endpointList) > 0) {
Example #3
0
            }
        } else {
            $arError[] = GetMessage('sender_group_conn_not_selected');
        }
        if ($res) {
            if (is_array($CONNECTOR_SETTING)) {
                $groupConnectorsDataCount = 0;
                \Bitrix\Sender\GroupConnectorTable::delete(array('GROUP_ID' => $ID));
                $arEndpointList = \Bitrix\Sender\ConnectorManager::getEndpointFromFields($CONNECTOR_SETTING);
                foreach ($arEndpointList as $endpoint) {
                    $connector = \Bitrix\Sender\ConnectorManager::getConnector($endpoint);
                    if ($connector) {
                        $connector->setFieldValues($endpoint['FIELDS']);
                        $connectorDataCount = $connector->getDataCount();
                        $arGroupConnectorAdd = array('GROUP_ID' => $ID, 'NAME' => $connector->getName(), 'ENDPOINT' => $endpoint, 'ADDRESS_COUNT' => $connectorDataCount);
                        $groupConnectorAddDb = \Bitrix\Sender\GroupConnectorTable::add($arGroupConnectorAdd);
                        if ($groupConnectorAddDb->isSuccess()) {
                            $groupConnectorsDataCount += $connectorDataCount;
                        }
                    }
                }
                \Bitrix\Sender\GroupTable::update($ID, array('ADDRESS_COUNT' => $groupConnectorsDataCount));
            }
        }
        if (empty($arError)) {
            $step = 'mailing_group';
            $isPostedFormProcessed = true;
            if (isset($popup_create_group) && $popup_create_group == 'Y') {
                ?>
				<script type="text/javascript">
					top.BX.WindowManager.Get().Close();