CBPAllStateService :: DeleteStateParameter: Bitrix method

      
<?php 
//  CBPAllStateService :: DeleteStateParameter()
//  /dist/bitrix/modules/bizproc/classes/general/stateservice.php:611

    
public function DeleteStateParameter($workflowId$name)
    {
        global 
$DB;

        
$workflowId trim($workflowId);
        if (
strlen($workflowId) <= 0)
            throw new 
Exception("workflowId");

        
$dbResult $DB->Query(
            
"SELECT STATE_PARAMETERS ".
            
"FROM b_bp_workflow_state ".
            
"WHERE ID = '".$DB->ForSql($workflowId)."' "
        
);

        if (
$arResult $dbResult->Fetch())
        {
            
$stateParameters = array();
            if (
strlen($arResult["STATE_PARAMETERS"]) > 0)
                
$stateParameters unserialize($arResult["STATE_PARAMETERS"]);

            
$ar = array();
            foreach (
$stateParameters as $v)
            {
                if (
$v["NAME"] != $name)
                    
$ar[] = $v;
            }

            
$stateParameters "";
            if (
count($ar) > 0)
                
$stateParameters serialize($ar);

            
$DB->Query(
                
"UPDATE b_bp_workflow_state SET ".
                
"    STATE_PARAMETERS = ".(strlen($stateParameters) > "'".$DB->ForSql($stateParameters)."'" "NULL").", ".
                
"    MODIFIED = ".$DB->CurrentTimeFunction()." ".
                
"WHERE ID = '".$DB->ForSql($workflowId)."' "
            
);
        }
    }