bcquality/microsoft/knowledge/data-modeling/report-barcodes-must-use-barcode-module-and-production-font-name.good.al
Michael Dieringer eb9cae0af4 Fix 5 merge-critical issues from Jesper's 2026-09-24 review round
- activate-new-price-calculation-handler-via-onfindsupportedsetup: Default
  := true is required only for the fallback branch of PriceCalculationMgt's
  two-stage FindSetup - a handler reachable via a specific Dtld. Price
  Calculation Setup row needs no Default. Softened the article and its
  worklist cue accordingly. Also fixed an undefined "Sample Price Calc -
  Special" codeunit referenced but never declared in the eval fixtures -
  added a real implementation of interface "Price Calculation" with stub
  methods.
- new-price-source-must-add-candidate-and-trigger-recalculation: the good
  fixture called UpdateUnitPriceByField directly, which is a silent no-op
  without a prior PlanPriceCalcByField call (FieldCausedPriceCalculation
  gating, verified against SalesLine.Table.al). Switched to the public
  UpdateUnitPrice wrapper, matching real BCApps usage in
  ItemReferenceManagement.Codeunit.al.
- report-barcodes-must-use-barcode-module-and-production-font-name: split
  the 1D (ValidateInput + EncodeFont) and 2D (EncodeFont only) Barcode Font
  Provider interfaces, which the article previously conflated. Reframed the
  Code 39 anti-pattern around demonstrable encoding/checksum mismatch
  (verified against IDA1DCode39Encoder.Codeunit.al's real '(value)' output)
  rather than rejecting all manual delimiter use, since '*' is a legitimate
  Code 39 start/stop character. Also fixed extend-find-entries-navigate-
  for-new-document-types' eval fixtures, which referenced an undefined
  "Sample Posted Document Header" table/page - declared both.

All claims re-verified against live microsoft/BCApps source. Validators:
frontmatter 0/0, review-fixtures 126/20 domains PASSED, knowledge-index
342/575 PASSED, skill-index 19 leaves PASSED.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-24 21:10:19 +02:00

54 lines
2.1 KiB
AL

report 50110 "Sample Item Barcode Label"
{
UsageCategory = Tasks;
ApplicationArea = All;
Caption = 'Sample Item Barcode Label';
dataset
{
dataitem(Item; Item)
{
column(No_; "No.") { }
column(Barcode1D; BarcodeText) { }
column(Barcode2D; QRCodeText) { }
trigger OnAfterGetRecord()
var
BarcodeFontProvider: Interface "Barcode Font Provider";
BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
begin
// One-dimensional: "Barcode Font Provider" declares both
// ValidateInput and EncodeFont - call both.
BarcodeFontProvider := Enum::"Barcode Font Provider"::IDAutomation1D;
BarcodeFontProvider.ValidateInput("No.", BarcodeSymbology);
BarcodeText := BarcodeFontProvider.EncodeFont("No.", BarcodeSymbology);
// Two-dimensional: "Barcode Font Provider 2D" declares only
// EncodeFont - there is no ValidateInput to call here.
BarcodeFontProvider2D := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
QRCodeText := BarcodeFontProvider2D.EncodeFont("No.", BarcodeSymbology2D);
end;
}
}
var
BarcodeSymbology: Enum "Barcode Symbology";
BarcodeSymbology2D: Enum "Barcode Symbology 2D";
BarcodeText: Text;
QRCodeText: Text;
trigger OnInitReport()
begin
BarcodeSymbology := Enum::"Barcode Symbology"::Code39;
BarcodeSymbology2D := Enum::"Barcode Symbology 2D"::"QR-Code";
end;
// Layout requirement (can't be enforced in AL, so it's stated here):
// the Barcode1D column's text box must use the real, purchased font
// name - IDAutomationHC39M for Code 39 - never an evaluation name
// like "IDAutomationSHC39M Demo". Per Microsoft Learn, using the
// evaluation name in a Business Central online production
// environment means "the barcode won't render" at all. The
// Barcode2D column's font name is IDAutomation2D (IDAutomation2D
// MaxiCode for Maxicode specifically).
}