Example #1
0
    CFile::DisableJSFunction(true);
}
$intSubPropValue = intval($intSubPropValue);
$strSubTMP_ID = intval($strSubTMP_ID);
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/iblock/admin/iblock_element_admin.php");
IncludeModuleLangFile(__FILE__);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/iblock/classes/general/subelement.php';
$dbrFProps = CIBlockProperty::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("IBLOCK_ID" => $intSubIBlockID, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "N"));
$arProps = array();
while ($arProp = $dbrFProps->GetNext()) {
    $arProp["PROPERTY_USER_TYPE"] = 0 < strlen($arProp["USER_TYPE"]) ? CIBlockProperty::GetUserType($arProp["USER_TYPE"]) : array();
    $arProps[] = $arProp;
}
$sTableID = "tbl_iblock_sub_element_" . md5($strSubIBlockType . "." . $intSubIBlockID);
$arHideFields = array('PROPERTY_' . $arCatalog['SKU_PROPERTY_ID']);
$lAdmin = new CAdminSubList($sTableID, false, $strSubElementAjaxPath, $arHideFields);
// only sku property filter
$arFilterFields = array("find_el_property_" . $arCatalog['SKU_PROPERTY_ID']);
$find_section_section = -1;
//We have to handle current section in a special way
$section_id = intval($find_section_section);
$lAdmin->InitFilter($arFilterFields);
$find_section_section = $section_id;
//This is all parameters needed for proper navigation
//$sThisSectionUrl = '&type='.urlencode($strSubIBlockType).'&lang='.LANG.'&IBLOCK_ID='.$intSubIBlockID.'&find_section_section='.intval($find_section_section);
$sThisSectionUrl = '';
// simple filter
$arFilter = array("IBLOCK_ID" => $intSubIBlockID);
if (0 < $intSubPropValue) {
    $arFilter["=PROPERTY_" . $arSubCatalog['SKU_PROPERTY_ID']] = $intSubPropValue;
} else {
    $saleModulePermissions = $APPLICATION->GetGroupRight('sale');
    $couponsReadOnly = $saleModulePermissions < 'W';
}
if (!isset($discountID) || $discountID <= 0 || !isset($couponsAjaxPath) || empty($couponsAjaxPath)) {
    return;
}
if (isset($_REQUEST['mode']) && ($_REQUEST['mode'] == 'list' || $_REQUEST['mode'] == 'frame')) {
    CFile::DisableJSFunction(true);
}
$canViewUserList = $USER->CanDoOperation('view_subordinate_users') || $USER->CanDoOperation('view_all_users') || $USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users');
Loc::loadMessages(__FILE__);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/iblock/classes/general/subelement.php';
$adminListTableID = 'tbl_sale_sub_coupons_' . md5($discountID);
$hideFields = array('DISCOUNT_ID');
$adminSort = new CAdminSubSorting($adminListTableID, 'ID', 'ASC', 'by', 'order', $couponsAjaxPath);
$adminList = new CAdminSubList($adminListTableID, $adminSort, $couponsAjaxPath, $hideFields);
unset($hideFields);
if (!isset($by)) {
    $by = 'ID';
}
if (!isset($order)) {
    $order = 'ASC';
}
$filter = array('=DISCOUNT_ID' => $discountID);
$filterFields = array('find_discount_id');
$adminList->InitFilter($filterFields);
if (!$couponsReadOnly && $adminList->EditAction()) {
    if (isset($FIELDS) && is_array($FIELDS)) {
        $conn = Application::getConnection();
        Internals\DiscountCouponTable::disableCheckCouponsUse();
        foreach ($FIELDS as $couponID => $fields) {
}
if (false == defined('B_ADMIN_SUBCOUPONS_LIST')) {
    return '';
}
$strSubElementAjaxPath = trim($strSubElementAjaxPath);
if ($_REQUEST['mode'] == 'list' || $_REQUEST['mode'] == 'frame') {
    CFile::DisableJSFunction(true);
}
$intDiscountID = intval($intDiscountID);
$strSubTMP_ID = intval($strSubTMP_ID);
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/catalog/admin/cat_discount_coupon.php");
IncludeModuleLangFile(__FILE__);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/iblock/classes/general/subelement.php';
$sTableID = "tbl_catalog_sub_coupon_" . md5($strSubIBlockType . "." . $intSubIBlockID);
$arHideFields = array('DISCOUNT_ID');
$lAdmin = new CAdminSubList($sTableID, false, $strSubElementAjaxPath, $arHideFields);
$arFilterFields = array("find_discount_id");
$lAdmin->InitFilter($arFilterFields);
$arFilter = array("DISCOUNT_ID" => $intDiscountID);
if (!($USER->CanDoOperation('catalog_read') || $USER->CanDoOperation('catalog_discount'))) {
    return '';
}
$boolCouponsReadOnly = isset($boolCouponsReadOnly) && false === $boolCouponsReadOnly ? false : true;
if ($lAdmin->EditAction() && !$boolCouponsReadOnly) {
    foreach ($_POST['FIELDS'] as $ID => $arFields) {
        $DB->StartTransaction();
        $ID = intval($ID);
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        if (!CCatalogDiscountCoupon::Update($ID, $arFields)) {