2014. december 18., csütörtök

LedgertransStatementDP.ProcessOffSetAccountInStaging has a copy-paste error

I found a bug in AX today in the data provider class of the Ledger trans statement report, and I will share it here, in case it helps anyone.


The task: lets fill the fields (OffsetAcct1, OffsetAcct2, and OffsetAcct3) with some data.
What happens: the code fills OffsetAcct1, OffsetAcct2 and for good measure fills OffsetAcct2 again, never using OffsetAcct3 despite the intention obvious from the comments.

The whole function is a nasty mess of a way of solving the task, but at least it doesn't even work.
Here is the original code snippet;

And here is my no- so-complicated fix for the offending paragraph