project QadFinancials > class BPosting > method ValidateComponentPostCheckLayer
Description
Validate if a posting can be changed in this layer
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bposting.p)
/* ===================== */
/* Exception handling */
/* ===================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
/* ========================================================= */
/* Only updates of analytical info on non-transient postings */
/* No deletes on non-transient postings */
/* ========================================================= */
CHECKLAYERBLOCK:
do:
find t_iPosting where
t_iPosting.tc_Rowid = t_sPosting.tc_Rowid and
t_iPosting.tcLayerTypeCode <> {&LAYERTYPECODE-TRANSIENT}
no-error.
if not available t_iPosting
then leave CHECKLAYERBLOCK.
if t_sPosting.tc_Status = "D":U
then do:
assign vcMsgExplanation = <M-34 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
<M-3 run SetMessage
(input trim(#T-5'You can only delete transient postings ($1/$2/$3).':250(3211)t-5#) (icMessage),
input string(t_sPosting.PostingYear) + chr(2) + t_sPosting.tcJournalCode + chr(2) + string(t_sPosting.PostingVoucher) (icArguments),
input 't_sPosting.tcLayerTypeCode':U (icFieldName),
input t_sPosting.tcLayerTypeCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-7284':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
assign viLocalReturnStatus = -1.
leave CHECKLAYERBLOCK.
end.
assign vlModified = false.
if t_sPosting.tc_Status = "C":U or
can-find(first t_sPostingLine where
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid and
t_sPostingLine.tc_Status <> "":U)
then do:
BUFFER-COMPARE t_sPosting
EXCEPT PostingApproveStatus PostingApproveComments PostingApprovedDate PostingApprovedTime LastApprovedUsr_ID
PostingVerifyStatus PostingVerifyComments PostingVerifiedDate PostingVerifiedTime LastVerifiedUsr_ID
PostingOriginatorReference PostingIsReplacement PostingIsReversing tlJournalAccessAllowed
tc_status LastModifiedDate LastModifiedTime LastModifiedUser PostingSystemDate
PostingOriginAddressCode PostingOriginDocument PostingOriginDocumentType
PostingIsReplacement PostingIsReversing PostingOriginatorReference
tcLocalCurrency tcTemplateCode tlSaveAsTemplate
TO t_iPosting
SAVE Result in vlPostingIsTheSame.
if vlPostingIsTheSame <> true
then assign vlModified = true.
if not vlModified
then do:
if can-find(first t_sPostingLine where
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid and
t_sPostingLine.tc_Status <> "":U)
then assign vlModified = true.
else for each t_sPostingLine where
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid:
if can-find(first t_sPostingSaf where
t_sPostingSaf.tc_ParentRowid = t_sPostingLine.tc_Rowid and
t_sPostingSaf.tc_Status <> "":U) or
can-find(first t_sPostingVat where
t_sPostingVat.tc_ParentRowid = t_sPostingLine.tc_Rowid and
t_sPostingVat.tc_Status <> "":U) or
can-find(first t_sPostingVatDelay where
t_sPostingVatDelay.tc_ParentRowid = t_sPostingLine.tc_Rowid and
t_sPostingVatDelay.tc_Status <> "":U)
then do:
assign vlModified = true.
leave.
end.
end.
end.
end.
if vlModified
then do:
assign vcMsgExplanation = <M-70 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
<M-4 run SetMessage
(input trim(#T-6'You can only modify transient postings ($1/$2/$3).':250(19836)t-6#) (icMessage),
input string(t_sPosting.PostingYear) + chr(2) + t_sPosting.tcJournalCode + chr(2) + string(t_sPosting.PostingVoucher) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-7285':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
assign viLocalReturnStatus = -1.
leave CHECKLAYERBLOCK.
end.
end. /* CHECKLAYERBLOCK */
/* ===================== */
/* Exception handling */
/* ===================== */
assign oiReturnStatus = viLocalReturnStatus.