Skip to content

Commit 6f687bc

Browse files
committed
Manual binding
1 parent fa8cc4d commit 6f687bc

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

Apps/DE/EDocumentDE/app/src/PEPPOL/EDocPEPPOLBIS30DE.Codeunit.al

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ codeunit 11035 "EDoc PEPPOL BIS 3.0 DE" implements "E-Document"
2020

2121
var
2222
EDocPEPPOLBIS30: Codeunit "EDoc PEPPOL BIS 3.0";
23+
EDocPEPPOLValidationDE: Codeunit "EDoc PEPPOL Validation DE";
2324
UBLInvoiceNamespaceTxt: Label 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', Locked = true;
2425
UBLCrMemoNamespaceTxt: Label 'urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2', Locked = true;
2526
UBLCACNamespaceTxt: Label 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2', Locked = true;
@@ -28,7 +29,9 @@ codeunit 11035 "EDoc PEPPOL BIS 3.0 DE" implements "E-Document"
2829
procedure Check(var SourceDocumentHeader: RecordRef; EDocumentService: Record "E-Document Service"; EDocumentProcessingPhase: Enum "E-Document Processing Phase")
2930
begin
3031
CheckBuyerReferenceMandatory(EDocumentService, SourceDocumentHeader);
32+
BindSubscription(EDocPEPPOLValidationDE);
3133
EDocPEPPOLBIS30.Check(SourceDocumentHeader, EDocumentService, EDocumentProcessingPhase);
34+
UnbindSubscription(EDocPEPPOLValidationDE);
3235
end;
3336

3437
procedure Create(EDocumentService: Record "E-Document Service"; var EDocument: Record "E-Document"; var SourceDocumentHeader: RecordRef; var SourceDocumentLines: RecordRef; var TempBlob: Codeunit "Temp Blob")
@@ -231,18 +234,6 @@ codeunit 11035 "EDoc PEPPOL BIS 3.0 DE" implements "E-Document"
231234
begin
232235
end;
233236

234-
[EventSubscriber(ObjectType::Codeunit, Codeunit::"PEPPOL Validation", 'OnCheckSalesDocumentOnBeforeCheckYourReference', '', false, false)]
235-
local procedure SkipCheckOnCheckSalesDocumentOnBeforeCheckYourReference(SalesHeader: Record "Sales Header"; var IsHandled: Boolean)
236-
begin
237-
IsHandled := true;
238-
end;
239-
240-
[EventSubscriber(ObjectType::Codeunit, Codeunit::"PEPPOL Validation", 'OnAfterCheckSalesDocument', '', false, false)]
241-
local procedure OnAfterCheckSalesDocument(SalesHeader: Record "Sales Header")
242-
begin
243-
SalesHeader.TestField("Sell-to E-Mail");
244-
end;
245-
246237
[EventSubscriber(ObjectType::Codeunit, Codeunit::"PEPPOL Management", 'OnAfterGetBuyerReference', '', false, false)]
247238
local procedure SetReferenceOnAfterGetBuyerReference(SalesHeader: Record "Sales Header"; var BuyerReference: Text)
248239
begin
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace Microsoft.eServices.EDocument.IO.Peppol;
2+
3+
using Microsoft.Sales.Document;
4+
using Microsoft.Sales.Peppol;
5+
6+
codeunit 13921 "EDoc PEPPOL Validation DE"
7+
{
8+
EventSubscriberInstance = Manual;
9+
10+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"PEPPOL Validation", 'OnCheckSalesDocumentOnBeforeCheckYourReference', '', false, false)]
11+
local procedure SkipCheckOnCheckSalesDocumentOnBeforeCheckYourReference(SalesHeader: Record "Sales Header"; var IsHandled: Boolean)
12+
begin
13+
IsHandled := true;
14+
end;
15+
16+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"PEPPOL Validation", 'OnAfterCheckSalesDocument', '', false, false)]
17+
local procedure OnAfterCheckSalesDocument(SalesHeader: Record "Sales Header")
18+
begin
19+
SalesHeader.TestField("Sell-to E-Mail");
20+
end;
21+
}

Apps/DE/EDocumentDE/app/src/XRechnung/XRechnungFormat.Codeunit.al

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ codeunit 13914 "XRechnung Format" implements "E-Document"
2020

2121
var
2222
EDocPEPPOLBIS30: Codeunit "EDoc PEPPOL BIS 3.0";
23+
EDocPEPPOLValidationDE: Codeunit "EDoc PEPPOL Validation DE";
2324
EDocImportXRechnung: Codeunit "Import XRechnung Document";
2425

2526
procedure Check(var SourceDocumentHeader: RecordRef; EDocumentService: Record "E-Document Service"; EDocumentProcessingPhase: Enum "E-Document Processing Phase")
2627
begin
2728
CheckCompanyInfoMandatory();
2829
CheckBuyerReferenceMandatory(EDocumentService, SourceDocumentHeader);
30+
BindSubscription(EDocPEPPOLValidationDE);
2931
EDocPEPPOLBIS30.Check(SourceDocumentHeader, EDocumentService, EDocumentProcessingPhase);
32+
UnbindSubscription(EDocPEPPOLValidationDE);
3033
end;
3134

3235
procedure Create(EDocumentService: Record "E-Document Service"; var EDocument: Record "E-Document"; var SourceDocumentHeader: RecordRef; var SourceDocumentLines: RecordRef; var TempBlob: Codeunit "Temp Blob")

Apps/DE/EDocumentDE/app/src/ZUGFeRD/ZUGFeRDFormat.Codeunit.al

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ codeunit 13920 "ZUGFeRD Format" implements "E-Document"
2020

2121
var
2222
EDocPEPPOLBIS30: Codeunit "EDoc PEPPOL BIS 3.0";
23+
EDocPEPPOLValidationDE: Codeunit "EDoc PEPPOL Validation DE";
2324
EDocImportZUGFeRD: Codeunit "Import ZUGFeRD Document";
2425

2526
procedure Check(var SourceDocumentHeader: RecordRef; EDocumentService: Record "E-Document Service"; EDocumentProcessingPhase: Enum "E-Document Processing Phase")
2627
begin
2728
CheckCompanyInfoMandatory();
2829
CheckBuyerReferenceMandatory(EDocumentService, SourceDocumentHeader);
30+
BindSubscription(EDocPEPPOLValidationDE);
2931
EDocPEPPOLBIS30.Check(SourceDocumentHeader, EDocumentService, EDocumentProcessingPhase);
32+
UnbindSubscription(EDocPEPPOLValidationDE);
3033
end;
3134

3235
procedure Create(EDocumentService: Record "E-Document Service"; var EDocument: Record "E-Document"; var SourceDocumentHeader: RecordRef; var SourceDocumentLines: RecordRef; var TempBlob: Codeunit "Temp Blob")

0 commit comments

Comments
 (0)