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/bmfgaddress.p)
/* Ancestor code is commented because of the performance */
/*
<ANCESTOR-CODE>
*/
for each t_sad_mstr where
t_sad_mstr.tc_Status = "N" or
t_sad_mstr.tc_Status = "C":
/* Check, if the record is unique */
if t_sad_mstr.tc_Status = "N"
then do:
<Q-81 assign vlFcQueryRecordsAvailable = AdMstrByDomainByCode (NoCache)
(input t_sad_mstr.ad_domain, (Domain)
input t_sad_mstr.ad_addr, (Code)) in BMfgAddress >
if vlFcQueryRecordsAvailable <> false
then do:
assign vcMessage = #T-83'Address record with code &1 in the Domain &2 already exists.':255(555015635)T-83#
vcMessage = substitute(vcMessage, t_sad_mstr.ad_addr, t_sad_mstr.ad_domain).
<M-60 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'ad_mstr.ad_addr':U (icFieldName),
input t_sad_mstr.ad_addr (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sad_mstr.tc_Rowid (icRowid),
input 'qadfin-796303':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>
assign oiReturnStatus = -1.
end.
end.
end.
/*
Check if an ad_mstr record is being deleted and its of type ?DOCK? (ad_type = ?DOCK?)
ensure no Sales Orders/Quotes etc are using the dock.
*/
for each t_sad_mstr
where t_sad_mstr.tc_Status = 'D'
and t_sad_mstr.ad_type = "DOCK":U:
<Q-1 run SalesOrderByDock (all) (Read) (NoCache)
(input t_sad_mstr.ad_domain, (DomainCode)
input t_sad_mstr.ad_addr, (Dock)
output dataset tqSalesOrderByDock) in BMfgSalesOrder >
for first tqSalesOrderByDock:
assign
vcMessageText = #T-19'Dock ($2) could not be deleted. It is used by sales order $1.':60(65098)t-19#
oiReturnStatus = -1.
<M-17 run SetMessage
(input vcMessageText (icMessage),
input tqSalesOrderByDock.tcso_nbr + chr(2) + t_sad_mstr.ad_addr (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6903':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>.
end.
<Q-3 run SalesOrderByShipto (all) (Read) (NoCache)
(input t_sad_mstr.ad_addr, (ShiptoCode)
input t_sad_mstr.ad_domain, (Domain)
output dataset tqSalesOrderByShipto) in BMfgSalesOrder >
for first tqSalesOrderByShipto:
assign
oiReturnStatus = -1
vcMessageText = #T-20'Dock ($2) could not be deleted. It is used by sales order $1.':60(65099)t-20#.
<M-15 run SetMessage
(input vcMessageText (icMessage),
input tqSalesOrderByShipto.tcso_nbr + chr(2) + t_sad_mstr.ad_addr (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6902':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>.
end.
<Q-6 run SalesQuoteByShipto (all) (Read) (NoCache)
(input t_sad_mstr.ad_domain, (domain)
input t_sad_mstr.ad_addr, (shipto)
output dataset tqSalesQuoteByShipto) in BMfgSalesQuote >
for first tqSalesQuoteByShipto:
assign
oiReturnStatus = -1
vcMessageText = #T-21'Dock ($2) could not be deleted. It is used sales quote $1.':60(65100)t-21#.
<M-7 run SetMessage
(input vcMessageText (icMessage),
input tqSalesQuoteByShipto.tcqo_nbr + chr(2) + t_sad_mstr.ad_addr (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6862':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>.
end.
<Q-9 run ServiceRepairOrderByShipto (all) (Read) (NoCache)
(input t_sad_mstr.ad_domain, (domain)
input t_sad_mstr.ad_addr, (shipto)
output dataset tqServiceRepairOrderByShipto) in BMfgServiceRepairOrder >
for first tqServiceRepairOrderByShipto:
assign
vcmessagetext = #T-22'Dock ($2) could not be deleted. It is used by service repair order $1.':70(65102)t-22#
oiReturnStatus = -1.
<M-10 run SetMessage
(input vcMessageText (icMessage),
input tqServiceRepairOrderByShipto.tcsro_nbr + chr(2) + t_sad_mstr.ad_addr (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6863':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>.
end.
<Q-12 run SiteByShiptoForShippers (all) (Read) (NoCache)
(input t_sad_mstr.ad_domain, (DomainCode)
input t_sad_mstr.ad_addr, (ShiptoCode)
output dataset tqSiteByShiptoForShippers) in BMfgSite >
for first tqSiteByShiptoForShippers:
assign
vcMessageText = #T-23'Dock ($2) could not be deleted. It is used by shipper $1.':60(65103)t-23#
oiReturnStatus = -1.
<M-13 run SetMessage
(input vcMessageText (icMessage),
input t_sad_mstr.ad_addr (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6865':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>.
end.
end.