Skip to content

Commit bd6f72d

Browse files
auto: collect candidates from microsoft/BCApps
1 parent ef4f466 commit bd6f72d

6 files changed

Lines changed: 188 additions & 0 deletions

File tree

dataset/bcbench.jsonl

Lines changed: 5 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# [E-Document] Data Exchange v2 import handler (bridge pattern)
2+
3+
## Summary
4+
- Add `IStructuredFormatReader` implementation for Data Exchange format (codeunit 6407)
5+
- Bridge existing Data Exchange Definition infrastructure to v2 import pipeline staging tables
6+
- Register as enum value 5 "Data Exchange" on `E-Doc. Read into Draft`
7+
- Namespace-based definition matching (replaces v1 trial-and-error auto-detection)
8+
- Run Data Handling Codeunit only (skip Pre-Mapping codeunit 6156 — vendor/GL resolution deferred to Prepare Draft)
9+
- Map Intermediate Data Import records to `E-Document Purchase Header` / `E-Document Purchase Line` via field-ID bridge
10+
- Process base64 attachments from Document Attachment intermediate records
11+
- XPath supplement for Company Information fields not in intermediate data
12+
- Integration events for partner extensibility
13+
14+
### New codeunit
15+
| ID | Name | Purpose |
16+
|----|------|---------|
17+
| 6407 | E-Document Data Exch. Handler | IStructuredFormatReader for Data Exchange format |
18+
19+
### Key design decisions
20+
- **No Commit()** — ReadIntoDraft runs inside pipeline try-function context
21+
- **No EDocument.Modify()** — record passed by value; local variables used
22+
- **Namespace matching** — matches XML root namespace against DataExchLineDef.Namespace instead of v1's trial-and-error (which requires Commit())
23+
- **Data Handling only** — runs codeunit 1214 to populate Intermediate Data Import, skips Pre-Mapping (6156) since v2 Prepare Draft handles vendor/item resolution
24+
25+
## Test plan
26+
- [x] Invoice ReadIntoDraft: header fields mapped (vendor name, invoice no, dates, amounts)
27+
- [x] Invoice ReadIntoDraft: line fields mapped (description, quantity, unit price, line numbers)
28+
- [x] Invoice returns "Purchase Invoice" process draft type
29+
- [x] CreditNote returns "Purchase Credit Memo" process draft type
30+
- [x] Total VAT computed correctly
31+
- [x] Attachments decoded from base64 and stored
32+
- [x] Currency code blank when matching LCY
33+
34+
[AB#630822](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/630822)
35+
[AB#599123](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/599123)
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# [Shopify] Refresh cached plan before order sync
2+
3+
## Summary
4+
5+
Bug 635878: When a merchant downgrades their Shopify plan from Plus / Advanced to a standard plan, the connector keeps requesting the `staffMember { id }` field in the order GraphQL query. The lower plan does not grant `read_users` scope, so Shopify returns `ACCESS_DENIED` and order sync is fully broken until the user manually toggles the **Enabled** field off and on again on the Shop Card.
6+
7+
`Shop."Advanced Shopify Plan"` (field 207) is the cached flag that gates the staff member field. It was only refreshed when the user toggled Enabled or when a scope change was detected on Shop Card open — never before an order sync.
8+
9+
## Fix
10+
11+
Auto-refresh the cached plan via the existing `Shop.GetShopSettings()` helper (one cheap GraphQL query for `shop { plan { ... } weightUnit }`) before both order-import entry points:
12+
13+
1. **Bulk sync** — Report `30104 Shpfy Sync Orders from Shopify` (also the scheduled auto-sync path). One refresh call per shop per batch run.
14+
2. **Single-order reimport**`ShpfyImportOrder.ReimportExistingOrderConfirmIfConflicting` (manual reimport action on the Order Header page).
15+
16+
The refresh is deliberately not placed in `ShpfyImportOrder.SetShop()` because that runs per order; for a 100-order batch it would mean 100 extra GraphQL round-trips.
17+
18+
## Tests
19+
20+
Two regression tests added to the existing `ShpfyOrdersAPITest.Codeunit.al` (139608):
21+
22+
- `TestGetShopSettingsClearsStaleAdvancedShopifyPlanFlag` — sets stale `"Advanced Shopify Plan" = true`, calls `GetShopSettings`, asserts the flag becomes `false`.
23+
- `TestSyncOrdersFromShopifyReportRefreshesAdvancedShopifyPlanFlag` — sets stale flag, runs Report 30104, asserts the persisted Shop record has the flag refreshed to `false`.
24+
25+
Existing `OrdersAPIHttpHandler` extended with a one-shot `PlanRefreshExpected` flag returning a downgraded-plan JSON for the first request, then falling through to the prior empty-data behavior.
26+
27+
Both tests verified locally.
28+
29+
Fixes [AB#635878](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/635878)
30+
31+
32+
33+
34+
35+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# [Shopify] Auto Create Catalog: always visible, validate plan on enable
2+
3+
## Summary
4+
5+
Re-fix for **bug 630316** after PM verification of [PR #7605](https://github.com/microsoft/BCApps/pull/7605).
6+
7+
PR #7605 made B2B features unconditional on all Shopify plans, but the `Auto Create Catalog` toggle on the **Customers and Companies** group of the Shop Card stayed hidden for non-Advanced shops because its `Visible = Rec."Advanced Shopify Plan"` binding is not re-evaluated after `GetShopSettings()` flips the flag at runtime.
8+
9+
Per PM Andrei Pankos guidance:
10+
- Drop the dynamic visibility on the `Auto Create Catalog` field so its always visible in the Companies group.
11+
- Gate the field at the table layer instead: an `OnValidate` trigger raises a field error if the user tries to enable `Auto Create Catalog` on a shop whose plan does not support B2B catalogs (Plus, Plus Trial, Development, or Advanced).
12+
13+
The error uses the existing `ErrorInfo` / `FieldNo` pattern already used elsewhere in `ShpfyShop.Table.al` (e.g. field 21 `Auto Create Orders`).
14+
15+
## What is NOT changed
16+
17+
- `action(Catalogs)` (B2B Catalogs action) and `action(StaffMembers)` visibility on the Shop Card PM only flagged the field control.
18+
- The runtime `Shop."Auto Create Catalog"` checks in `ShpfyCompanyAPI.Codeunit.al` / `ShpfyCompanyExport.Codeunit.al` the table guard prevents the boolean from being set to `true` on an unsupported plan, so no runtime check is needed.
19+
- The `B2B Enabled` obsoletion and upgrade code from PR #7605 already accepted by PM.
20+
- `app.json` versions intentionally untouched.
21+
22+
## Test
23+
24+
Adds `TestAutoCreateCatalogRequiresAdvancedPlan` to `ShpfyStaffTest` (codeunit 139551, which is already the home for `Advanced Shopify Plan`-gated tests). Verified both passes locally:
25+
26+
```
27+
PASS TestStaffMembersActionVisibleOnlyForSupportedPlans (513ms)
28+
PASS TestAutoCreateCatalogRequiresAdvancedPlan (23ms)
29+
```
30+
31+
Fixes [AB#630316](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/630316)
32+
33+
34+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Add VAT rate resolution and VAT amount difference for E-Document purchases
2+
3+
## Why
4+
5+
When importing e-documents for purchase processing, the system did not automatically resolve VAT Product Posting Groups from extracted VAT rates. Users had to manually identify and assign the correct VAT posting group for each line, which was error-prone and time-consuming. Additionally, rounding differences between the document's total VAT and the computed line-level VAT amounts were not reconciled, leading to posting discrepancies.
6+
7+
## Summary
8+
9+
- **Added** VAT Product Posting Group resolution during Prepare Draft — matches the extracted VAT rate against VAT Posting Setup entries (Normal VAT and Reverse Charge VAT only) for the vendor's VAT Bus. Posting Group
10+
- **Added** `[BC] VAT Prod. Posting Group` and `[BC] VAT Rate Mismatch` fields on E-Document Purchase Line with OnValidate/OnLookup support
11+
- **Added** VAT amount difference computation and application to purchase lines when finalizing drafts, respecting Allow VAT Difference and Max. VAT Difference Allowed settings
12+
- **Added** "Resolve VAT Group Purch EDoc" and "Apply VAT Diff. For Purch EDoc" toggles on Purchases & Payables Setup
13+
- **Improved** ADI handler to prefer the unambiguous `taxRate` field and properly disambiguate the `tax` field between percentage and monetary values
14+
- **Added** comprehensive test codeunit `E-Doc Purch. VAT Tests` covering resolution, mismatch detection, OnValidate behavior, and VAT calculation type filtering
15+
- **Updated** existing structured validation tests to reflect corrected VAT rate expectations
16+
17+
Fixes [AB#619564](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/619564)
18+
19+
20+
21+
22+
23+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# (Bug 633226): [Subcontracting] Standard Task not propagated from Routing to Prod. Order Routing or Subcontracting Worksheet; prices not picked up
2+
3+
## Summary
4+
5+
The Subcontracting Worksheet flow was dropping `Standard Task Code` between the Prod. Order Routing Line and the Requisition Line, the field on the worksheet was read-only, and Subcontractor Prices keyed on a Standard Task were therefore never applied. This change:
6+
7+
- Propagates `Standard Task Code` from `Prod. Order Routing Line` to `Requisition Line` in both worksheet-population paths (Calculate Subcontracts… on the worksheet, and direct PO creation from a Prod. Order Routing line).
8+
- Makes the `Standard Task Code` field editable on the Subcontracting Worksheet so users can override it.
9+
- Causes the standard-task-bound subcontractor price to flow through to the Subcontracting Purchase Order's `Direct Unit Cost`.
10+
11+
The bug enumerated four symptoms (Routing → Prod. Order Routing, Prod. Order Routing → Worksheet, field not editable, prices not picked up). Routing → Prod. Order Routing was already handled by `Prod. Order Routing Line.CopyFromRoutingLine`; no change there. The remaining three are addressed below.
12+
13+
## Changes
14+
15+
### `SubcCalcSubcontractsExt.Codeunit.al`
16+
Extended the existing `OnAfterTransferProdOrderRoutingLine` subscriber on report `Subc. Calculate Subcontracts` to also `Validate("Standard Task Code", ProdOrderRoutingLine."Standard Task Code")` on the new requisition line. Using `Validate` (not direct assignment) fires the field's OnValidate trigger in `Subc. RequisitionLine`, which calls `UpdateSubcontractorPrice``Subc. Price Management.GetSubcPriceForReqLine`. The price lookup already filters `Subcontractor Price` by `RequisitionLine."Standard Task Code"` exactly, so the standard-task-bound price is applied immediately.
17+
18+
### `SubcPurchaseOrderCreator.Codeunit.al`
19+
Same fix in `InsertReqWkshLine`, which is the alternate worksheet-line builder used when a Subcontracting PO is created directly from a Prod. Order Routing Line (bypassing the worksheet UI).
20+
21+
### `SubcSubcontractingWorksheet.Page.al`
22+
Removed `Editable = false` from the `Standard Task Code` field and added a tooltip clarifying that editing the value re-applies the matching subcontractor price. The field's OnValidate already triggers price re-lookup, so manual edits/clears on the worksheet immediately update `Direct Unit Cost`.
23+
24+
Fixes [AB#633226](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/633226)
25+

0 commit comments

Comments
 (0)