open-insight/FRAMEWORKS/STPROC/AUDIT_MANAGER_MFS.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

265 lines
6.7 KiB
Plaintext

Function Audit_Manager_MFS(Code, BFS, Handle, Name, FMC, Record, Status)
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//
// This program is proprietary and is not to be used by or disclosed to others, nor is it to
// be copied without written permission from SRP Computer Solutions, Inc.
//
// Name : Audit_Manager_MFS
//
// Description: MFS for tracking the audit history of a particular record.
//
// Notes: This routine primarily passes all essential information into the Audit_Manager
// stored procedure. This way changes to the core functionality can be made
// without having to restart OpenInsight (which is necessary for changes directly
// in MFS procedures.)
//
// A check is first made to see if corresponding audit table exists for the
// database table that triggered this MFS. Audit tables use a naming convention
// of AUDIT_Tablename. therefore, if the CUSTOMERS table is being audited then
// there should be an AUDIT_CUSTOMERS table available. Audit features are managed
// by the DBW_AUDIT_MANAGER form.
//
// Parameters:
// Code [in] -- An integer value indicating the operation to be performed (1 = read a
// record, 4 = delete a record, 11 = open a file, etc.)
// BFS [in] -- The list of MFSs and the BFS name for the current file or volume. This
// is a subvalue mark-delimited array, with the current MFS name as the
// first value in the array, and the BFS name as the last value.
// Handle [in] -- The file handle of the file or media map being accessed.
// Name [in] -- The name (key) of the record or file being accessed.
// FMC [in] -- Various functions.
// Record [in] -- The entire record (for record-oriented functions) or a newly-created
// handle (for "get handle" functions).
// Status [in] -- A return code indicating the success or failure of an operation.
//
// History (Date, Initials, Notes)
// 01/04/00 pcs Original programmer
// 01/20/00 pcs CLEARFILE requires the Arev table name to be removed before processing
// 05/20/05 axf Process will now also track the accessing of records.
// 11/26/07 dmb Code clean-up. No functional changes were made.
//
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
$insert APP_INSERTS
$INSERT FILE.SYSTEM.EQUATES
$INSERT FSERRORS_HDR
Declare Subroutine Msg, Audit_Manager
ON CODE GOSUB READ.RECORD,READO.RECORD,WRITE.RECORD,DELETE.RECORD,LOCK.RECORD,UNLOCK.RECORD,SELECT,READNEXT,CLEARSELECT,CLEARFILE,OPEN.FILE,CREATE.FILE,RENAME.FILE,MOVE.FILE,DELETE.FILE,OPEN.MEDIA,CREATE.MEDIA,READ.MEDIA,WRITE.MEDIA,UNLOCK.ALL,FLUSH,INSTALL,RESERVED,RESERVED,RESERVED,OMNI.SCRIPT,CLOSE.MEDIA,RECORD.COUNT, REMAKE.FILE,CREATE.INDEX,DELETE.INDEX,UPDATE.INDEX,SELECT.INDEX,READNEXT.INDEX
Return
READ.RECORD:
// Added Check_Update_History Gosub
Activity = "Read"
GoSub Check_Update_History
GoSub Remove_Arev_Table_Name
return
READO.RECORD:
// Added Check_Update_History Gosub
Activity = "Read"
GoSub Check_Update_History
GoSub Remove_Arev_Table_Name
return
CREATE.MEDIA:
GoSub Call_NextFS
return
OPEN.MEDIA:
GoSub Call_NextFS
return
READ.MEDIA:
GoSub Call_NextFS
return
WRITE.MEDIA:
GoSub Call_NextFS
return
CLOSE.MEDIA:
GoSub Call_NextFS
return
CLEARFILE:
GoSub Remove_Arev_Table_Name
return
CREATE.FILE:
GoSub Call_NextFS
return
DELETE.FILE:
GoSub Call_NextFS
return
MOVE.FILE:
GoSub Call_NextFS
return
OPEN.FILE:
// Attaching Arev Table name to Handle for checking purposes
GoSub Call_NextFS
If Index(RECORD, @TM, 1) EQ 0 then
RECORD = NAME:@TM:RECORD
end
return
REMAKE.FILE:
GoSub Call_NextFS
return
RENAME.FILE:
GoSub Call_NextFS
return
SELECT:
GoSub Remove_Arev_Table_Name
return
READNEXT:
GoSub Remove_Arev_Table_Name
return
CLEARSELECT:
GoSub Remove_Arev_Table_Name
return
LOCK.RECORD:
GoSub Remove_Arev_Table_Name
return
UNLOCK.RECORD:
GoSub Remove_Arev_Table_Name
return
CREATE.INDEX:
GoSub Remove_Arev_Table_Name
return
UPDATE.INDEX:
GoSub Remove_Arev_Table_Name
return
DELETE.INDEX:
GoSub Remove_Arev_Table_Name
return
SELECT.INDEX:
GoSub Remove_Arev_Table_Name
return
READNEXT.INDEX:
GoSub Remove_Arev_Table_Name
return
RESERVED:
GoSub Call_NextFS
return
OMNI.SCRIPT:
GoSub Remove_Arev_Table_Name
return
RECORD.COUNT:
GoSub Remove_Arev_Table_Name
return
LOCK.SEMAPHORE:
GoSub Call_NextFS
return
UNLOCK.SEMAPHORE:
GoSub Call_NextFS
return
SET.USER.SEMAPHORE:
GoSub Call_NextFS
return
WRITE.RECORD:
GoSub Prep_Vars
Activity = "Write"
GoSub Check_Update_History
GoSub Remove_Arev_Table_Name
return
DELETE.RECORD:
Activity = "Delete"
GoSub Check_Update_History
GoSub Remove_Arev_Table_Name
return
NEXT_FS:
GoSub Call_NextFS
return
// Install, unlock all and flush are called directly, no need to call next FS.
INSTALL:
STATUS = TRUE$
return
FLUSH:
STATUS = TRUE$
return
UNLOCK.ALL:
STATUS = TRUE$
return
Prep_Vars:
TempUseTable = Field(HANDLE, @TM, 1)
UseTable = Field(TempUseTable, "*", 1)
UseID = Name
return
Check_Update_History:
Temp_File_Name = Field(HANDLE, @TM, 1)
FileName = Field(Temp_File_Name, "*", 1)
Real_Handle = Field(HANDLE, @TM, 2)
History_table = "AUDIT_":FileName
Open History_table to HistoryCheck then
GoSub Get_Original_Record
Audit_Manager(Name, FileName, Record, OrigRecord, Activity)
end
return
Get_Original_Record:
OrigRecord = ""
CALL RTP57(READO.RECORD, "RTP57", Real_Handle, NAME, FMC, OrigRecord, Temp_status)
// If Temp_status is Null then it is a new record or an error reading.
return
Call_NextFS:
FS = DELETE(BFS, 1, 1, 1)
NEXTFS = FS<1, 1, 1>
@FILE.ERROR = ""
CALL @NEXTFS(CODE, FS, HANDLE, NAME, FMC, RECORD, STATUS)
return
Remove_Arev_Table_Name:
* FileName = Field(HANDLE, @TM, 1)
* If FileName EQ HANDLE then
* Real_Handle = HANDLE
* end else
* Real_Handle = Field(HANDLE, @TM, 2)
* end
FS = DELETE(BFS, 1, 1, 1)
NEXTFS = FS<1, 1, 1>
@FILE.ERROR = ""
If Index(FS, @SVM, 1) GT 0 then
Real_Handle = HANDLE
end else
Real_Handle = Field(HANDLE, @TM, 2)
end
CALL @NEXTFS(CODE, FS, Real_Handle, NAME, FMC, RECORD, STATUS)
return