project QadFinancials > class BDomain > method ValidateComponentSharedSetChange
Description
Validates whether the shared set can be changed for a domain.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bdomain.p)
assign oiReturnStatus = -98.
/* If the changes were done from Shared Set Merge, all validations *
* have to be skipped */
if not vlIsValSharedSetChangeActive
then do:
assign oiReturnStatus = 0.
return.
end.
for each t_sDomainSharedSet where
t_sDomainSharedSet.tc_Status = "N":U:
/* Check if the business relation for the creditors in this shared set are not domain dependant */
/* if so, we can't use that shared set in another domain */
if t_sDomainSharedSet.tcSharedSetTypeCode = {&SHAREDSETTYPE-CREDITOR}
then do:
<Q-208 assign vlFcQueryRecordsAvailable = CreditorForDomainCheck (NoCache)
(input t_sDomainSharedSet.SharedSet_ID, (SharedSetID)
input true, (BusinessRelationIsDomRestr)) in BCreditor >
if vlFcQueryRecordsAvailable <> false
then do:
assign vcMessage = trim(#T-210'Some of the suppliers for this shared set are linked to a business relation that is restricted to one domain.':255(69680)T-210#)
viLocalReturnStatus = -1.
<M-209 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tDomainSharedSet.tcSharedsetCode':U (icFieldName),
input t_sDomainSharedSet.tcSharedSetCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDomainSharedSet.tc_Rowid (icRowid),
input 'QadFin-8255':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end.
end.
/* Check if the business relation for the debtors in this shared set are not domain dependant */
/* if so, we can't use that shared set in another domain */
if t_sDomainSharedSet.tcSharedSetTypeCode = {&SHAREDSETTYPE-DEBTOR}
then do:
<Q-214 assign vlFcQueryRecordsAvailable = DebtorForDomainCheck (NoCache)
(input t_sDomainSharedSet.SharedSet_ID, (SharedSetID)
input true, (BusinessRelationDomRestr)) in BDebtor >
if vlFcQueryRecordsAvailable <> false
then do:
assign vcMessage = trim(#T-213'Some of the customers for this shared set are linked to a business relation that is restricted to one domain.':255(69681)T-213#)
viLocalReturnStatus = -1.
<M-212 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tDomainSharedSet.tcSharedsetCode':U (icFieldName),
input t_sDomainSharedSet.tcSharedSetCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDomainSharedSet.tc_Rowid (icRowid),
input 'QadFin-8256':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end.
end.
end. /* for each t_sDomainSharedSet where */
for each t_sDomainSharedSet where
t_sDomainSharedSet.tc_Status = "C":U:
/* Skip those that haven't been changed... */
find first t_iDomainSharedSet where
t_iDomainSharedSet.tc_Rowid = t_sDomainSharedSet.tc_Rowid
no-error.
if not available t_iDomainSharedSet
then next.
if t_sDomainSharedSet.SharedSet_ID = t_iDomainSharedSet.SharedSet_ID
then next.
if vlStartCompanyByDomain = false
then do:
<Q-206 run CompanyByDomain (Start) in BCompany >
assign vlStartCompanyByDomain = true.
end. /* if vlStartCompanyByDomain = false */
<Q-207 run CompanyByDomain (all) (Read) (NoCache)
(input ?, (CompanyId)
input t_sDomainSharedSet.Domain_ID, (DomainId)
input ?, (Active)
output dataset tqCompanyByDomain) in BCompany >
for each tqCompanyByDomain:
case t_sDomainSharedSet.tcSharedSetTypeCode:
/* Validate whether the journal shared set can be changed */
when {&SHAREDSETTYPECODE-JOURNAL}
then do:
/* Check Allocation Table */
<Q-2 assign vlFcQueryRecordsAvailable = AllocationPrim (NoCache) (input tqCompanyByDomain.tiCompany_ID, (CompanyId)
input ?, (AllocationId)
input ?, (AllocationCode)) in BAllocation >
/* The query returns false if there are no records, true is there is no record and ? is there are multiple records */
/* So if the query returns <> false, it means that there are 1 or more records */
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-9'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-9#,
#T-6'Daybook':10(332026863)T-6#,
#T-7'Allocation':20(227609303)T-7#,
tqCompanyByDomain.tcCompanyCode).
<M-91 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
/* Check CDocumentStatus Table */
<Q-116 assign vlFcQueryRecordsAvailable = CDocumentStatusPrim (NoCache) (input '':U, (CDocumentStatusID)
input '':U, (CDocumentStatusStatus)
input '':U, (CDocumentStatusDocumentType)
input tqCompanyByDomain.tiCompany_ID, (CompanyId)
input '':U, (BankGLCode)) in BCDocumentStatus >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-12'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-12#,
#T-13'Daybook':10(14857)T-13#,
#T-14'Supplier Payment Status':30(825478449)T-14#,
tqCompanyByDomain.tcCompanyCode).
<M-92 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
/* Check DDocumentStatus Table */
<Q-119 assign vlFcQueryRecordsAvailable = DDocumentStatusPrim (NoCache) (input 0, (DDocumentStatusID)
input '':U, (DDocumentStatusStatus)
input '':U, (DDocumentStatusDocumentType)
input '':U, (BankGLCode)
input tqCompanyByDomain.tiCompany_ID, (CompanyId)) in BDDocumentStatus >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-20'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-20#,
#T-21'Daybook':10(583949932)T-21#,
#T-22'Customer Payment Status':27(606016648)T-22#,
tqCompanyByDomain.tcCompanyCode).
<M-93 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
/* Check RecEntry Table */
<Q-123 assign vlFcQueryRecordsAvailable = RecEntryPrim (NoCache) (input tqCompanyByDomain.tiCompany_ID, (CompanyId)
input '':U, (RecEntryCode)
input 0, (RecEntryID)) in BRecurringEntry >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-26'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-26#,
#T-27'Daybook':10(52786308)T-27#,
#T-28'Recurring Entries':30(915863472)T-28#,
tqCompanyByDomain.tcCompanyCode).
<M-94 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
/* Check FABookType Table */
<Q-125 assign vlFcQueryRecordsAvailable = FABookTypePrim (NoCache)
(input tqCompanyByDomain.tiCompany_ID, (CompanyId)
input 0, (FABookTypeID)
input '':U, (FABookTypeCode)) in BFixedAssetBookType >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-31'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-31#,
#T-32'Daybook':10(14857)T-32#,
#T-33'Fixed Asset Book Type':100(31358)T-33#,
tqCompanyByDomain.tcCompanyCode).
<M-95 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
end. /* when {&SHAREDSETTYPECODE-JOURNAL} */
/* ====================================================== */
/* Validate whether the account shared set can be changed */
/* ====================================================== */
when {&SHAREDSETTYPECODE-GL}
then do:
/* Check FAAssetType Table */
<Q-130 assign vlFcQueryRecordsAvailable = FAAssetTypePrim (NoCache) (input tqCompanyByDomain.tiCompany_ID, (CompanyId)
input '', (FAAssetTypeID)
input '', (FAAssetTypeCode)) in BFixedAssetAssetType >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-139'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-139#,
#T-140'Account':20(20115)T-140#,
#T-141'Fixed Assets Asset Type':50(31377)T-141#,
tqCompanyByDomain.tcCompanyCode).
<M-131 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
/* Check FACapital Table */
<Q-132 assign vlFcQueryRecordsAvailable = FACapitalByFACapitalID (NoCache) (input tqCompanyByDomain.tiCompany_ID, (CompanyId)
input '', (FACapital_ID)
input '', (PostingLine_ID)
input '', (AccYear)
input '', (AccPeriod)
input '', (JournalCode)
input '', (Voucher)
input '', (Sequence)) in BFixedAssetCapital >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-142'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-142#,
#T-143'Account':20(20115)T-143#,
#T-144'Fixed Asset Capitalization':40(31316)T-144#,
tqCompanyByDomain.tcCompanyCode).
<M-133 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
end. /* when {&SHAREDSETTYPECODE-GL} */
/* Validate whether the Cost Center shared set can be changed */
when {&SHAREDSETTYPECODE-COSTCENTRE}
then do:
/* Check ConsolidCycle Table */
<Q-176 assign vlFcQueryRecordsAvailable = ConsolidCycleByCompanyID (NoCache) (input tqCompanyByDomain.tiCompany_ID, (CompanyId)) in BConsolidCycle >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-171'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-171#,
#T-172'Cost Center':40(20365)T-172#,
#T-173'Consolidation Cycle':30(5136)T-173#,
tqCompanyByDomain.tcCompanyCode).
<M-168 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
end. /* when {&SHAREDSETTYPECODE-COSTCENTRE} */
/* Validate whether the Creditor shared set can be changed */
when {&SHAREDSETTYPECODE-CREDITOR}
then do:
/* Check Employee Table */
<Q-180 assign vlFcQueryRecordsAvailable = EmployeePrim (NoCache) (input ?, (EmployeeId)
input ?, (EmployeeCode)
input tqCompanyByDomain.tiCompany_ID, (CompanyId)) in BEmployee >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-182'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-182#,
#T-183'Supplier':40(20551)T-183#,
#T-184'Employee':20(5063)T-184#,
tqCompanyByDomain.tcCompanyCode).
<M-181 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
end. /* when {&SHAREDSETTYPECODE-CREDITOR} */
/* Validate whether the Project shared set can be changed */
when {&SHAREDSETTYPECODE-PROJECT}
then do:
/* Check ConsolidCycle Table */
<Q-193 assign vlFcQueryRecordsAvailable = ConsolidCycleByCompanyID (NoCache) (input tqCompanyByDomain.tiCompany_ID, (CompanyId)) in BConsolidCycle >
if vlFcQueryRecordsAvailable <> false
then do:
assign viLocalReturnStatus = -1
vcMessage = substitute(
#T-189'&1 shared set cannot be modified. There are existing records in the &2 table for the entity &3.':100(31357)T-189#,
#T-190'Project':20(8836)T-190#,
#T-191'Consolidation Cycle':30(5136)T-191#,
tqCompanyByDomain.tcCompanyCode).
<M-188 run ValidateComponentSharedSetChangeMessage (input vcMessage (icMessage),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlFcQueryRecordsAvailable <> false */
end. /* when {&SHAREDSETTYPECODE-PROJECT} */
end. /* case t_sDomainSharedSet.tcSharedSetTypeCode */
end. /* for each tqCompanyDomain */
end. /* for each t_sDomainSharedSet */
/* ================ */
/* Stop the queries */
/* ================ */
if vlStartCompanyByDomain = true
then do:
<Q-114 run CompanyByDomain (Stop) in BCompany >
assign vlStartCompanyByDomain = false.
end. /* if vlStartCompanyByDomain = true */
assign oiReturnStatus = viLocalReturnStatus.