Пример #1
0
            $message = new CAdminMessage(GetMessage('SUP_CL_GENERATE_ERROR'), $e);
        }
    }
}
if (array_key_exists('SHOW_COUPON', $_GET) && $_GET['SHOW_COUPON'] == 'Y' && array_key_exists('BX_LAST_COUPON', $_SESSION)) {
    $message = new CAdminMessage(array('MESSAGE' => GetMessage('SUP_CL_GENERATE_MESS_OK', array('%COUPON%' => $_SESSION['BX_LAST_COUPON'])), 'TYPE' => 'OK'));
}
if ($bAdmin && $lAdmin->EditAction()) {
    $obSSC = new CSupportSuperCoupon();
    foreach ($FIELDS as $ID => $arFields) {
        $ID = intval($ID);
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        $arUpdate = array('COUNT_TICKETS' => $arFields['COUNT_TICKETS'], 'ACTIVE' => $arFields['ACTIVE']);
        if (!$obSSC->Update($ID, $arUpdate)) {
            $ex = $APPLICATION->GetException();
            $lAdmin->AddUpdateError($ex->GetString(), $ID);
        }
    }
}
if ($bAdmin && ($arID = $lAdmin->GroupAction())) {
    if ($_REQUEST['action_target'] == 'selected') {
        $rsData = CSupportSuperCoupon::GetList(array($by => $order), $arFilter);
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
Пример #2
0
IncludeModuleLangFile(__FILE__);
$bDemo = CTicket::IsDemo();
$bAdmin = CTicket::IsAdmin();
if (!$bAdmin && !$bDemo) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$LIST_URL = '/bitrix/admin/ticket_coupon_list.php';
$ID = intval($ID);
$message = false;
if ((strlen($save) > 0 || strlen($apply) > 0) && $REQUEST_METHOD == 'POST' && $bAdmin && check_bitrix_sessid()) {
    $obSSC = new CSupportSuperCoupon();
    $bOK = false;
    $new = false;
    $arFields = array("ACTIVE_FROM" => $_POST['ACTIVE_FROM'], "ACTIVE_TO" => $_POST['ACTIVE_TO'], "ACTIVE" => $_POST['ACTIVE'], "COUNT_TICKETS" => IntVal($_POST['COUNT_TICKETS']), "SLA_ID" => IntVal($_POST['SLA_ID']));
    if ($ID > 0) {
        $bOK = $obSSC->Update($ID, $arFields);
    } else {
        if ($COUPON = $obSSC->Generate($arFields)) {
            if ($COUPON !== false) {
                $_SESSION['BX_LAST_COUPON'] = $COUPON;
                $rsCoupons = $obSSC->GetList(false, array('COUPON' => $COUPON));
                $arCoupon = $rsCoupons->Fetch();
                $ID = intval($arCoupon['ID']);
                $bOK = true;
                $new = true;
            } else {
                $bOK = false;
            }
        }
    }
    if ($bOK) {