[Bug][SubscriptionBilling] Usage Data Generic Import OnModify assigns wrong Customer ID and never fills Customer Name
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend
Direzione di ricerca
Apri UsageDataGenericImport.Table.al in src/Apps/W1/Subscription Billing/App/Usage Based Billing/Tables/ e leggi OnModify, InitRecord e il trigger OnValidate di Customer ID; l'attuale FindFirst su "Usage Data Supp. Customer" filtra solo per Supplier No.. Poi controlla UsageDataSuppCustomer.Table.al, dove "Customer Name" è un FlowField, e nota che CreateUsageDataCustomers in GenericConnectorProcessing.Codeunit.al chiama TestField("Customer ID"). Fatto significa che un Customer ID vuoto sopravvive a una modifica invariato, e che un Customer Name viene compilato dal record che corrisponde a Supplier Reference = il Customer ID della riga, verificato tramite i passaggi di riproduzione nella pagina Usage Data Generic Import.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the issue
When imported generic usage data lines are changed afterwards, the system can silently attach a line to the wrong customer.
If a line was imported without a customer identifier, any later change to that line (for example, correcting the quantity on the imported lines page) fills in the identifier of the first customer set up for that usage data supplier. That customer has nothing to do with the line. No message is shown. If the supplier is set up to create customers automatically, processing the imported lines then creates and processes usage data for that wrong customer, and the usage ends up billed to the wrong customer.
The customer name on imported lines is never filled either. A changed line gets the name of the same unrelated first customer instead of the customer it belongs to. When the identifier is entered or changed, the name stays empty even if a matching customer is set up.
This happens every time a line is saved with triggers, both on a user edit in the page and when an extension modifies the line with triggers.
Affected objects:
src/Apps/W1/Subscription Billing/App/Usage Based Billing/Tables/UsageDataGenericImport.Table.al
Expected behavior
1 — Empty Customer ID must stay empty on modify
An empty Customer ID must not be filled by OnModify. It should stay empty, so that Process Imported Lines reports the missing customer. With "Create Customers" enabled, CreateUsageDataCustomers in GenericConnectorProcessing.Codeunit.al already runs TestField("Customer ID") for this.
Where it breaks: OnModify (L322) calls InitRecord (L334). InitRecord filters table 8012 "Usage Data Supp. Customer" only by "Supplier No." and takes the first record (L346):
if ("Customer ID" = '') or ("Customer Name" = '') then begin
UsageDataCustomer.Reset();
UsageDataCustomer.SetRange("Supplier No.", UsageDataSupplier."No.");
if UsageDataCustomer.FindFirst() then begin
if "Customer ID" = '' then
"Customer ID" := UsageDataCustomer."Supplier Reference";
if "Customer Name" = '' then
"Customer Name" := UsageDataCustomer."Customer Name";
end;
end;
- An empty
"Customer ID"gets the"Supplier Reference"of the supplier's first usage data customer. - An empty
"Customer Name"is taken from that same first record, not from the record whose"Supplier Reference"equals the line's"Customer ID".
2 — Customer Name must be filled from the matching usage data customer
"Customer Name" should come from the "Usage Data Supp. Customer" record with "Supplier No." = the import's supplier and "Supplier Reference" = the line's "Customer ID". This applies in both InitRecord and OnValidate of "Customer ID".
Where it breaks: "Customer Name" (field 5) in UsageDataSuppCustomer.Table.al is a FlowField. Neither InitRecord nor OnValidate of "Customer ID" (L90) calculates it, so the value copied is always empty.
Proposed fix
InitRecord exits when "Customer ID" is empty or "Customer Name" is already filled; otherwise it filters "Usage Data Supp. Customer" by "Supplier No." and "Supplier Reference" = "Customer ID", uses SetAutoCalcFields("Customer Name") and copies the name. OnValidate of "Customer ID" gets SetAutoCalcFields("Customer Name") before its FindFirst().
Steps to reproduce
- Open Usage Data Suppliers and create supplier
GENERICwith Type =Generic. - Open Generic Import Settings for
GENERICand leave Create Customers turned off. - Open Usage Data Customers for
GENERICand create two entries:- Supplier Reference
CUST-A→ Customer No.10000 - Supplier Reference
CUST-B→ Customer No.20000
- Supplier Reference
- Create a usage data import for
GENERICand import a file with two lines:- Line 1: Customer ID empty, Quantity
5 - Line 2: Customer ID
CUST-B, Customer Name empty, Quantity5
- Line 1: Customer ID empty, Quantity
- Open the Usage Data Generic Import page for the import.
- Change Quantity on line 1 to
6.
→ Expected: Customer ID stays empty. Actual: Customer ID =CUST-A. - Change Quantity on line 2 to
6.
→ Expected: Customer Name = name of customer20000. Actual: Customer Name stays empty.
Additional context
Reproduced on BC 29.1 and earlier versions, and on current main.
Workaround: assign Customer ID / Customer Name directly and save with Modify(false), and do not edit lines with an empty Customer ID on the page.
I will provide a fix for a bug
- I will provide a fix for a bug
- Lingua principale
- AL
- Stelle
- 730
- Fork
- 514
- Merge medio
- 2g 23h
- PR unite (30g)
- 601
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/BCApps
-
[Bug]: Cannot add sales line item to sales order, on an on-prem installation with basic licenseApertaTeam: SCM
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/BCApps#14569 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
BCIdea Team: Finance
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
microsoft/BCApps#14478 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Contribution Process Bug]: Incorrect Spanish translation for Billing Line Document Type enum value "Invoice"Forse già presa @JesperSchulz l’ha presa 2 giorni fa. ApertaApproved Ownership: Needs Review Team: Other
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
microsoft/BCApps#14391 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Approved Team: Integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/BCApps#14386 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Team: Integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
microsoft/BCApps#14336 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/BCApps
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
micronaut-projects/micronaut-core#14585 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
langgenius/graphon#443 ·
I maintainer di solito rispondono entro 2 giorni
-
bug new
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
moodle-an-hochschulen/moodle-theme_boost_union#1500 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: Management endpoints /v1/memory/stats and /v1/memory/counts bypass API key authenticationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
docling-project/docling-serve#788 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
HaxeFoundation/haxe#13246 ·
I maintainer di solito rispondono entro 1 giorno