codeunit 99000787 "Create Prod. Order Lines" wrong return value
jreuter2022 opened this issue · comments
In codeunit "Create Prod. Order Lines", procedure Copy() the return value ist set to true, if function is handled by subscriber "OnBeforeCopy" and "ErrorOccured" is true. But return value should only be true, if NOT ErrorOccured, like it is handled by standard code at the end of procedure.
--------------------- BEFORE ---------------------------------------
procedure Copy(ProdOrder2: Record "Production Order"; Direction: Option Forward,Backward; VariantCode: Code[10]; LetDueDateDecrease: Boolean): Boolean
var
ErrorOccured: Boolean;
IsHandled: Boolean;
begin
OnBeforeCopy(ProdOrder2, Direction, VariantCode, LetDueDateDecrease, ErrorOccured, IsHandled);
if IsHandled then
exit(ErrorOccured); // WRONG
MfgSetup.Get();
ProdOrder2.TestField("Source No.");
ProdOrder2.TestField("Starting Time");
ProdOrder2.TestField("Starting Date");
ProdOrder2.TestField("Ending Time");
ProdOrder2.TestField("Ending Date");
if Direction = Direction::Backward then
ProdOrder2.TestField("Due Date");
ProdOrder := ProdOrder2;
CreateProdOrderLine(ProdOrder, VariantCode, ErrorOccured);
if not ProcessProdOrderLines(Direction, LetDueDateDecrease) then
ErrorOccured := true;
CheckMultiLevelStructure(Direction, true, LetDueDateDecrease);
OnAfterCopy(ProdOrder, ErrorOccured);
exit(not ErrorOccured); // RIGHT
end;
----------------------- AFTER ----------------------------------
OnBeforeCopy(ProdOrder2, Direction, VariantCode, LetDueDateDecrease, ErrorOccured, IsHandled);
if IsHandled then
exit(not ErrorOccured);
Look also to call of procedure in report 99001025 "Refresh Production Order".
@JesperSchulz is this the right place? Where do we find the repository to create a PR?
No, this isn't the right place. BaseApp contributions can be done here: https://github.com/microsoft/BusinessCentralApps. But before you can access the repo, I need to create you as users. Please send me direct message on Yammer with the users you'd like to get created (name, partner name and GitHub name), and I'll get you started :-) This issue should get closed.