Compile function Override_Log_Services(@Service, @Params)
#pragma precomp SRP_PreCompiler

$insert LOGICAL
$Insert OVERRIDE_LOG_EQUATES

Declare function   Datetime, NextKey, Error_Services
Declare subroutine Database_Services

GoToService

Return Response or ""

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Service Parameter Options
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Options OVERRIDE_TYPES     = 'ROTR_BLOCK,UNSIGN,CLEAN_INSP,REACTOR_PROVE_IN,REACTOR_LOG_PM'

//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------

Service Create(Table, Key, OverrideUser, OverrideComment, OverrideType=OVERRIDE_TYPES, OverrideCause='')
    RecKey = Nextkey('OVERRIDE_LOG')
    
    orRec                         = ''
    orRec<OVERRIDE_LOG_TABLE$>    = Table
    orRec<OVERRIDE_LOG_KEY$>      = Key
    orRec<OVERRIDE_LOG_USER$>     = OverrideUser
    orRec<OVERRIDE_LOG_COMMENT$>  = OverrideComment
    orRec<OVERRIDE_LOG_DTM$>      = Datetime()
    orRec<OVERRIDE_LOG_CATEGORY$> = OverrideType
    orRec<OVERRIDE_LOG_CAUSE$>	  = OverrideCause
    
    Database_Services('WriteDataRow', 'OVERRIDE_LOG', RecKey, orRec)
    
    If Error_Services('NoError') then
        Response = RecKey
    end else
        Response = ''
    end
    
End Service


