-
Notifications
You must be signed in to change notification settings - Fork 693
Open
Open
Task
Copy link
Labels
missing-infoThe issue misses information that prevents it from completion.The issue misses information that prevents it from completion.
Description
Why do you need this change?
Both procedures hardcode calls to: REPORT.RunModal(REPORT::"Post Bill Group", ...)
Partners need an extensibility point to redirect the report to a custom report without modifying base code.
Describe the request
Description
Add integration events to ReceivablePostOnly and ReceivablePostAndPrint in Codeunit 7000003 ("BG/PO-Post and Print") so partners can override the report execution and run a different report.
Current procedures
procedure ReceivablePostOnly(BillGr: Record "Bill Group")
begin
if BillGr."No. Printed" = 0 then begin
if not Confirm(Text1100000) then
Error(Text1100001);
end else
if not Confirm(Text1100002, false) then
Error(Text1100001);
BillGr.SetRecFilter();
REPORT.RunModal(REPORT::"Post Bill Group", BillGr."Dealing Type" = BillGr."Dealing Type"::Discount, false, BillGr);
end;
procedure ReceivablePostAndPrint(BillGr: Record "Bill Group")
var
PostedBillGr: Record "Posted Bill Group";
begin
BillGr.SetRecFilter();
REPORT.RunModal(REPORT::"Post Bill Group", BillGr."Dealing Type" = BillGr."Dealing Type"::Discount, false, BillGr);
Commit();
if PostedBillGr.Get(BillGr."No.") then begin
PostedBillGr.SetRecFilter();
CarteraReportSelection.Reset();
CarteraReportSelection.SetRange(Usage, CarteraReportSelection.Usage::"Posted Bill Group");
CarteraReportSelection.Find('-');
repeat
CarteraReportSelection.TestField("Report ID");
REPORT.Run(CarteraReportSelection."Report ID", false, false, PostedBillGr);
until CarteraReportSelection.Next() = 0;
end;
end;Requested events
[IntegrationEvent(false, false)]
local procedure OnBeforeReceivablePostOnly(var BillGr: Record "Bill Group"; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeReceivablePostAndPrint(var BillGr: Record "Bill Group"; var IsHandled: Boolean)
begin
end;Proposed Code Change
procedure ReceivablePostOnly(BillGr: Record "Bill Group")
begin
OnBeforeReceivablePostOnly(BillGr, IsHandled);
If IsHandled then
exit;
if BillGr."No. Printed" = 0 then begin
if not Confirm(Text1100000) then
Error(Text1100001);
end else
if not Confirm(Text1100002, false) then
Error(Text1100001);
BillGr.SetRecFilter();
REPORT.RunModal(REPORT::"Post Bill Group", BillGr."Dealing Type" = BillGr."Dealing Type"::Discount, false, BillGr);
end;
procedure ReceivablePostAndPrint(BillGr: Record "Bill Group")
var
PostedBillGr: Record "Posted Bill Group";
begin
OnBeforeReceivablePostAndPrint(BillGr, IsHandled);
If IsHandled then
exit;
BillGr.SetRecFilter();
REPORT.RunModal(REPORT::"Post Bill Group", BillGr."Dealing Type" = BillGr."Dealing Type"::Discount, false, BillGr);
Commit();
if PostedBillGr.Get(BillGr."No.") then begin
PostedBillGr.SetRecFilter();
CarteraReportSelection.Reset();
CarteraReportSelection.SetRange(Usage, CarteraReportSelection.Usage::"Posted Bill Group");
CarteraReportSelection.Find('-');
repeat
CarteraReportSelection.TestField("Report ID");
REPORT.Run(CarteraReportSelection."Report ID", false, false, PostedBillGr);
until CarteraReportSelection.Next() = 0;
end;
end;Expected behavior
- Partners can subscribe to these events and set
IsHandled = trueto skip the default report call and run an alternative report.
Reason
This provides the same extensibility pattern already available for payable procedures, without modifying base code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
missing-infoThe issue misses information that prevents it from completion.The issue misses information that prevents it from completion.