ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Codeunit 99000854 "Inventory Profile Offsetting": Inventory Profiles not passed via reference

Open AndyF2k25 opened this issue 6 years ago • 6 comments

Hello,

I think I found two bugs:

First

In the above named codeunit is a function called PostInvChgReminder. You can find two Publisher in this function:

  • OnBeforePostInvChgReminder(TempReminderInvtProfile, InvProfile, PostOnlyMinimum);
  • OnAfterPostInvChgReminder(TempReminderInvtProfile, InvProfile, PostOnlyMinimum);

Both publisher passes InvProfile per refence, but the function itself does not receive the parameter InvProfile via reference which is pretty bad because you cannot access the temporary table in the publisher. Here is the function signature:

PostInvChgReminder(var TempReminderInvtProfile: Record "Inventory Profile" temporary; InvProfile: Record "Inventory Profile"; PostOnlyMinimum: Boolean)

Second

There is a publisher called OnMaintainPlanningLineOnBeforeReqLineInsert which accepts the temporary DemandInvtProfile record. The problem is that the parameters isn't passed via reference from the publisher to the subscriber. OnMaintainPlanningLineOnBeforeReqLineInsert(var RequisitionLine: Record "Requisition Line"; var SupplyInvtProfile: Record "Inventory Profile"; PlanToDate: Date; CurrentForecast: Code[10]; NewPhase: Option " ","Line Created","Routing Created",Exploded,Obsolete; Direction: Option Forward,Backward; DemandInvtProfile: Record "Inventory Profile")

I cannot imagine that this is on purpose. Can you fix this?

Thanks Andreas

AndyF2k25 avatar May 28 '20 14:05 AndyF2k25

...and again why marked as "event-request"? Are all issues marked as event-request when they have something to do with events?

AndyF2k25 avatar May 28 '20 16:05 AndyF2k25

@AndreasGloeckner Fixes of or additions to events are also marked as event-request :-) The label only ensures that it's passed to the correct team.

NKarolak avatar May 29 '20 09:05 NKarolak

Exactly, @NKarolak :-)

JesperSchulz avatar May 29 '20 10:05 JesperSchulz

Hi @AndreasGloeckner .

  1. Agree
  2. Not fully clear what you are talking about. OnMaintainPlanningLineOnBeforeReqLineInsert() is called from MaintainPlanningLine() where DemandInvtProfile parameter came without var. So I can pass this record as var to the publisher but not clear why?

RomanZanizdra avatar Jun 15 '20 19:06 RomanZanizdra

Hi @AndreasGloeckner .

  1. Agree
  2. Not fully clear what you are talking about. OnMaintainPlanningLineOnBeforeReqLineInsert() is called from MaintainPlanningLine() where DemandInvtProfile parameter came without var. So I can pass this record as var to the publisher but not clear why?

Hi @RomanZanizdra,

yes, missed that point. While 1st seems to be a bug, 2nd would need to be discussed. To be honest, I was trying to solve a problem and came across this publisher and thought I would need it in a way. In the end, I found another way to implement the requirement. So for now, I think it's okay, if only 1st will be solved :)

AndyF2k25 avatar Jun 18 '20 05:06 AndyF2k25

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.

bc-ghost avatar Jun 19 '20 07:06 bc-ghost