Quintiq file version 2.0
|
#parent: #root
|
Method SetShadowOperationCostRetainUserValues (
|
Operation operation
|
) id:Method_DialogCreateEditOperationCost_SetShadowOperationCostRetainUserValues
|
{
|
#keys: '[144528.2.91510074]'
|
Body:
|
[*
|
// Create shadow operation cost and retrieve values from UI elements
|
// e.g when changing unit from dropdown, we do not want overwrite the previous values)
|
|
// NOTE: This cannot be call before Show modal as it slows down dialog display (as the shadow creation below refers to UI elements)
|
|
createCostForSingleOperation := DataHolderOperations.Data().Size() = 1;
|
|
if( createCostForSingleOperation )
|
{
|
// As we using DataHolderSelectedOperation.OnDataChanged to workaround DropDownListOperation.OnUserSelectionChanged & enabled/disabled software bug
|
// Check if user switched operation before re-creating shadow unit cost
|
hasOperationChanged := not DataHolderOperations.Data().Find( operation ) >= 0;
|
|
if( hasOperationChanged )
|
{
|
// All values except ID and Operation, we want to preserve user values after user switch operation from dropdown
|
obj := operation.OperationCost ( relshadow,
|
ID := MacroPlan.IDHolder().GetOperationCostID(),
|
AccountName := DropDownListAccount.Data().Name(),
|
Account_MP := DropDownListAccount.Data(),
|
CostDriver := DropDownStringListCostDriver.Text(),
|
Cost := ApplicationMacroPlanner.FormatStringToReal( EditFieldCost.Text() ),
|
LengthOfTime := ApplicationMacroPlanner.FormatStringToNumber( EditFieldLengthOfTime.Text() ),
|
TimeUnit := DropDownStringListTimeUnit.Text(),
|
Start := DateSelectorCostStart.Date() );
|
|
DataHolderDialogData.Data( & obj );
|
}
|
|
// Only if single operation cost creation, we want to replace the operation in dataholder (e.g on change operation in dropdown)
|
DataHolderOperations.Data().Flush();
|
DataHolderOperations.Data().Add( operation );
|
}
|
*]
|
}
|