project QadFinancials > class BMfgCustomer > method UpdateCustomerLanguageSearchName
Description
Method to update customer record in mfgpro when business relation language is changed in financials
Parameters
iiBusinessRelation_ID | input | integer | |
icLngCode | input | character | |
icSearchName | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bmfgcustomer.p)
/* ============================================================================================ */
/* This method will update the language code of the customer for a business relation language */
/* change */
/* =============================================================================================*/
assign oiReturnStatus = -98
vcListCmMstr = ''
vccm_lang = <M-83 GetMfgLanguage (input icLngCode (icFinancialLanguage)) in BMfgCustomer>.
if icLngCode = ? then assign icLngCode = "":U.
if icSearchName = ? then assign icSearchName = "":U.
if iiBusinessRelation_ID = ? then assign iiBusinessRelation_ID = 0.
if iiBusinessRelation_ID = 0
then do:
assign oiReturnStatus = 0.
return.
end.
/* ======================================================================================= */
/* Retrieve all the cm_mstr records linked to the BusinessRelation */
/* BusinessRelation --> Debtor --> SharedSet --> Domains --> DomainSharedSet --> cm_mstr */
/* ======================================================================================= */
<Q-47 run GetcmmstrByBusinessRleation (all) (Read) (NoCache)
(input iiBusinessRelation_ID, (BusinessRelation_ID)
input ?, (CompanyId)
output dataset tqGetcmmstrByBusinessRleation) in BMfgCustomerQuery>
/* Build up the list fo all records that need to be changed */
for each tqGetcmmstrByBusinessRleation where
tqGetcmmstrByBusinessRleation.tiBusinessRelation_ID = iiBusinessRelation_ID and
(tqGetcmmstrByBusinessRleation.tcLngCode <> icLngCode or
tqGetcmmstrByBusinessRleation.tccm_sort <> icSearchName)
:
assign vcListCmMstr = vcListCmMstr +
(if vcListCmMstr = '':U
then '':U
else chr(4)) +
tqGetcmmstrByBusinessRleation.tccm_domain +
chr(2) +
tqGetcmmstrByBusinessRleation.tccm_addr.
end. /* for each tqGetcmmstrByBusinessRleation */
/* Do the DayaLoad */
if vcListCmMstr <> ? and vcListCmMstr <> ""
then do:
/* ========================= */
/* Load the tcm_mstr records */
/* ========================= */
<M-7 run DataLoad
(input '':U (icRowids),
input vcListCmMstr (icPkeys),
input '':U (icObjectIds),
input '':U (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BMfgCustomer>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* if vcListCmMstr <> ? */
if vlAutoGenACEdit = ? then
do:
<Q-4 run PricingControlByDomain (all) (Read) (NoCache)
(input vcDomainCode, (Domain)
output dataset tqPricingControlByDomain) in BMfgPricingControl>
find first tqPricingControlByDomain where tqPricingControlByDomain.tcpic_domain = Vcdomaincode no-error.
if available tqPricingControlByDomain and
substring(tqPricingControlByDomain.tcpic__qadc01,1,1,"CHARACTER":U) = "Y"
then vlAutoGenACEdit = true.
else vlAutoGenACEdit = false.
end.
/* Change the instance data */
for each tcm_mstr:
if vlAutoGenACEdit and tcm_mstr.cm_sort <> icSearchName then
do:
find first tAutoGenCustList where tAutoGenCustList.tcanx_domain = tcm_mstr.cm_domain and
tAutoGenCustList.tcanx_node = tcm_mstr.cm_addr
no-error.
if not available tAutoGenCustList
then do:
create tAutoGenCustList.
assign tAutoGenCustList.tcanx_domain = tcm_mstr.cm_domain
tAutoGenCustList.tcanx_node = tcm_mstr.cm_addr
tAutoGenCustList.tcanx_type = "9".
end.
end.
assign tcm_mstr.tc_Status = "C":U
tcm_mstr.cm_lang = vccm_lang
tcm_mstr.cm_sort = icSearchName.
end. /* for each tvd_mstr */
/* ========== */
/* ValidateBC */
/* ========== */
<M-12 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BMfgCustomer>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
/* ================== */
/* Additional Updates */
/* ================== */
<M-13 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BMfgCustomer>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
/* ======== */
/* DataSave */
/* ======== */
<M-14 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BMfgCustomer>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus = -98 then
assign oiReturnStatus = 0.