project QadFinancials > class BPosting > method ValidateComponentPostJournalRole
validation procedure
Description
Validates the user can post to the journal they are attempting to post to.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bposting.p)
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
if can-do({&SECUREJOURNALTYPES}, t_sPosting.tcJournalTypeCode)
then do:
assign vhFcComponent = ?.
<M-13 run CheckJournalRole
(input viUsrId (iiUserID),
input ? (icUserCode),
input t_sPosting.Journal_ID (iiJournalID),
input ? (icJournalCode),
input t_sPosting.Company_ID (iiCompanyID),
input ? (icCompanyCode),
input viSessionID (iiSessionID),
output vcMessage (ocErrorMessage),
output vlJournalAccessAllowed (olJournalAccessAllowed),
output viFcReturnSuper (oiReturnStatus)) in TJournalRole>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
run gipr_DeleteProcedure in vhFcComponent.
delete procedure vhFcComponent.
if viLocalReturnStatus <> 0
then do:
assign vcMsgExplanation = <M-12 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
<M-71 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 't_sPosting.tcJournalCode':U (icFieldName),
input t_sPosting.tcJournalCode (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-103447':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
end.
if vlJournalAccessAllowed <> true
then do:
<Q-68 run CompanyPrim (all) (Read) (Cache)
(input t_sPosting.Company_ID, (LookupCompanyId)
input ?, (CompanyCode)
output dataset tqCompanyPrim) in BCompany >
find tqCompanyPrim where
tqCompanyPrim.tiCompany_ID = t_sPosting.Company_ID
no-lock no-error.
if available tqCompanyPrim
then assign vcMessage = trim(subst(#T-35'You are not authorized to use daybook &1 in entity &2':100(827961670)T-35#,
t_sPosting.tcJournalCode,
tqCompanyPrim.tcCompanyCode)).
assign vcMsgExplanation = <M-38 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
<M-63 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 't_sPosting.tcJournalCode':U (icFieldName),
input t_sPosting.tcJournalCode (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-240800':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
assign viLocalReturnStatus = -1.
end.
end. /* if can-do({&SECUREJOURNALTYPES}, t_sPosting.tcJournalTypeCode) */
/* ================== */
/* Return */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.