Description
Write here all tests on database update (new / modify / delete) that cannot be coded with a validation mask.
The type of update can be found in tc_status (N/C/D).
If you find incorrect data, you must write an entry in tFcMessages (using SetMessage) and set the return status of this method to either +1 or -1.
Return status +1 = data will still be accepted.
Return status -1 = data will not be accepted.
This method is run from SetPublicTables, before transferring the received data into the class temp-tables.
Parameters
| oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bsafconcept.p)
<ANCESTOR-CODE>
if oiReturnStatus < 0
then return.
for each t_sSafConcept where
t_sSafConcept.tc_Status <> "":U:
/* Validate that deactivated concept is not associated with an active SAF structure */
if t_sSafConcept.tc_Status = "C":U and not t_sSafConcept.SafConceptIsActive then do:
<Q-10 assign vlFcQueryRecordsAvailable = GetActiveSafStrctrBySafConcept (NoCache) (input t_sSafConcept.SafConcept_ID, (SafConceptID)) in BSafConcept >
if(vlFcQueryRecordsAvailable=? or vlFcQueryRecordsAvailable=true) then do:
assign
vcMessage = #T-11'You cannot deactivate a SAF concept associated with an active SAF structure.':80(42798)t-11#
oiReturnStatus = -1.
<M-12 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-4986':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafConcept>
return.
end. /* if(vlFcQueryRecordsAvailabl) */
end.
/*initially loaded data, known only for Changed and Deleted records*/
if t_sSafConcept.tc_Status <> "N":U
then do:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sSafConcept.tc_Rowid no-error.
if available tFcRowidConvert
then find first t_iSafConcept where
t_iSafConcept.tc_Rowid = tFcRowidConvert.tcFcNewRowid no-error.
else find first t_iSafConcept where
t_iSafConcept.tc_Rowid = t_sSafConcept.tc_Rowid no-error.
if not available t_iSafConcept
then do:
assign vcMessage = "t_iSafConcept not available.":U + chr(10) + program-name(1)
oiReturnStatus = -1.
<M-4 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-4':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafConcept>
return.
end.
if t_sSafConcept.tc_Status = "D":U and t_iSafConcept.SafConceptIsSystem = true
then do:
assign vcMessage = #T-6'You cannot delete a system SAF concept.':150(31946)t-6#
oiReturnStatus = -1.
<M-7 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4915':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafConcept>
return.
end.
if t_sSafConcept.SafConceptIsSystem <> t_iSafConcept.SafConceptIsSystem then do:
assign vcMessage = #T-8'You cannot change the system-owned field for the SAF concept.':150(31947)t-8#
oiReturnStatus = -1.
<M-9 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4916':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafConcept>
return.
end.
end.
/*check the existence of a link to Saf, SafStructureLine tables
if the t_sSafConcept.SafConceptIsActive changed from true to false*/
if available t_iSafConcept and
t_iSafConcept.SafConceptIsActive = true and
t_sSafConcept.SafConceptIsActive = false and
t_sSafConcept.tc_Status = "C":U
then do:
assign vcMessage = "":U.
/*Saf*/
<Q-1 assign vlFcQueryRecordsAvailable = SafByIdCodeConceptID (NoCache)
(input t_sSafConcept.SafConcept_ID, (SafConcept_ID)
input ?, (SafCode)
input ?, (SafID)) in BSaf >
if vlFcQueryRecordsAvailable or
vlFcQueryRecordsAvailable = ?
then assign vcMessage = if vcMessage = "":U
then "Saf":U
else vcMessage + ", Saf":U.
/*SafStructureLine*/
<Q-3 assign vlFcQueryRecordsAvailable = SafStructureLineByConceptID (NoCache) (input t_sSafConcept.SafConcept_ID, (SafConcept_ID)) in BSafStructure >
if vlFcQueryRecordsAvailable or
vlFcQueryRecordsAvailable = ?
then assign vcMessage = if vcMessage = "":U
then "SafStructureLine":U
else vcMessage + ", SafStructureLine":U.
if vcMessage <> "":U
then do:
assign vcMessage = substitute (#T-5'The SAF concept &1 you want to make inactive is used in these tables:':200(3653)t-5#, t_sSafConcept.SafConceptCode)
+ chr(10) + vcMessage + chr(10) + program-name(1)
oiReturnStatus = if oiReturnStatus < 0
then oiReturnStatus
else 1.
<M-2 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9534':U:U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafConcept>
end.
end.
end.