CAdvType :: Delete: Bitrix method

      
<?php 
//  CAdvType :: Delete()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:5304

    
public static function Delete($TYPE_SID$CHECK_RIGHTS="Y")
    {
        
$err_mess = (CAdvType_all::err_mess())."<br>Function: Delete<br>Line: ";
        global 
$DB$strError;
        if (
strlen($TYPE_SID)<=0) return false;
        if (
$CHECK_RIGHTS=="Y")
        {
            
$isAdmin CAdvContract::IsAdmin();
        }
        else
        {
            
$isAdmin true;
        }
        if (
$isAdmin)
        {
            
$strSql "SELECT ID FROM b_adv_banner WHERE TYPE_SID = '".$DB->ForSql($TYPE_SID,255)."'";
            
$rs $DB->Query($strSqlfalse$err_mess.__LINE__);
            while (
$ar $rs->Fetch()) CAdvBanner::Delete($ar["ID"], "N");

            
CAdvType::DeleteContractLink($TYPE_SID);

            
$strSql "DELETE FROM b_adv_type WHERE SID = '".$DB->ForSql($TYPE_SID,255)."'";
            
$DB->Query($strSqlfalse$err_mess.__LINE__);
            return 
true;
        }
        else
            
$strError .= GetMessage("AD_ERROR_NOT_ENOUGH_PERMISSIONS_TYPE")."<br>";
        return 
false;

    }