toga-ai 1.0.154 → 1.0.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/knowledge/clients/compass-usa/INDEX.md +1 -0
- package/knowledge/clients/compass-usa/features/mits-po-to-so-item-linking.md +1 -0
- package/knowledge/clients/compass-usa/features/mits-po-transmission-to-vendors.md +89 -0
- package/knowledge/clients/compass-usa/workflows/order-lifecycle-and-data-integrity.md +1 -0
- package/package.json +1 -1
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
| [Compass ASN → ItemFulfillment Auto-Creation](features/asn-to-item-fulfillment.md) | 2.0 | For Compass USA, posting an AdvanceShippingNotice (ASN) auto-creates the ItemFulfillment (IF) on the upstream SalesOrder. | _underscore/Model/Compass/AdvanceShippingNotice.php, _underscore/Model/Compass/PurchaseOrder.php, api2/Component/Api/Cxml/Cxml.php, dbchanges2/Client_Compass/2026-06-11 - AsnItemTrackingNumberAcl.sql, dbchanges2/Client_Compass/2026-06-15b - BackfillSA132781ItemFulfillmentTracking.sql, dbchanges2/Client_Compass/2026-06-16 - CleanupSA132763CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16b - CleanupSA132743CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16c - BackfillSA132763C40QYUCTracking.sql, dbchanges2/Client_Compass/2026-06-18a - CleanupSA132898DuplicateTracking.sql, dbchanges2/Client_Compass/2026-06-18b - CleanupSA132881DuplicateTracking.sql |
|
|
6
6
|
| [Compass: Item-Fulfillment TableViews (for-sales-order-items & for-sales-orders, tracking via bridge)](features/item-fulfillment-tracking-tableview.md) | 2.0 | Two sibling Compass TableViews in `Client_Compass` display fulfilled items in toga2-supply, both driven by `TableViews` / `TableViewJoins` / `TableViewFields` c | dbchanges2/Client_Compass/2026-06-10 - ItemFulfillmentsForSalesOrderItemsTableView.sql, dbchanges2/Client_Compass/2026-06-11 - ItemFulfillmentsForSalesOrdersTableView.sql, dbchanges2/Client_Compass/2026-06-15a - FixItemFulfillmentTrackingNumberJoins.sql |
|
|
7
7
|
| [Compass MITS PO → SO Item Linking](features/mits-po-to-so-item-linking.md) | 2.0 | MITS sends Compass inbound Purchase Orders (`POST /v2/purchase-orders`) against a Sales Order (`mitsSalesOrder`). | _underscore/Model/Compass/PurchaseOrder.php, worker/crons/toga2/compass/workflow/3a_import_office_depot_purchase_orders.php |
|
|
8
|
+
| [Compass MITS PO Transmission to Vendors](features/mits-po-transmission-to-vendors.md) | 2.0 | The 1.0 worker cron `2_transmit_mits_purchase_orders_to_vendors.php` transmits Compass PurchaseOrders to their vendors (Office Depot, Strategic Systems, Compass | worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php, library/app/client/compass.php |
|
|
8
9
|
| [Compass USA](profile.md) | 2.0 | Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. | |
|
|
9
10
|
| [Compass Order Lifecycle & Data-Integrity Invariants](workflows/order-lifecycle-and-data-integrity.md) | 2.0 | End-to-end map of how a Compass order flows through the `Client_Compass` (2.0) database and the **expected raw-data shape** at each link/ASN/IF level. | |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Compass MITS PO Transmission to Vendors
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
project: _Underscore
|
|
5
|
+
client: compass-usa
|
|
6
|
+
type: client-feature
|
|
7
|
+
status: active
|
|
8
|
+
updated: 2026-06-22
|
|
9
|
+
owners: ["rgirish"]
|
|
10
|
+
files:
|
|
11
|
+
- worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php
|
|
12
|
+
- library/app/client/compass.php
|
|
13
|
+
related:
|
|
14
|
+
- mits-po-to-so-item-linking.md
|
|
15
|
+
- order-lifecycle-and-data-integrity.md
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Summary
|
|
19
|
+
The 1.0 worker cron `2_transmit_mits_purchase_orders_to_vendors.php` transmits Compass
|
|
20
|
+
PurchaseOrders to their vendors (Office Depot, Strategic Systems, Compass, Presidio). Each
|
|
21
|
+
vendor's `Integration` decides the channel: **CXML** (HTTP POST of a cXML OrderRequest) or
|
|
22
|
+
**EMAIL** (a generated PDF emailed via `App_Email`). On success it writes "transmitted to
|
|
23
|
+
Vendor" log rows and stamps `PurchaseOrders.dtSubmitted`.
|
|
24
|
+
|
|
25
|
+
## Key files / entry points
|
|
26
|
+
- `worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php` — the cron.
|
|
27
|
+
- `library/app/client/compass.php` — `App_Client_Compass` constants:
|
|
28
|
+
`CUSTOMER_ID__COMPASS = 2`, `CUSTOMER_ID__OFFICE_DEPOT = 1`, `CUSTOMER_ID__AGILANT = 3`;
|
|
29
|
+
`VENDOR_ID__OFFICE_DEPOT = 1`, `VENDOR_ID__STRATEGIC_SYSTEMS = 25`, `VENDOR_ID__COMPASS = 26`,
|
|
30
|
+
`VENDOR_ID__PRESIDIO = 4`.
|
|
31
|
+
|
|
32
|
+
## How it works
|
|
33
|
+
1. **Outer query** selects POs to send: `customerId = CUSTOMER_ID__COMPASS (2)`,
|
|
34
|
+
`dtSubmitted IS NULL`, and `vendorId IN (1, 25, 26, 4)`. (So it only ever transmits
|
|
35
|
+
`customerId = 2` POs — `customerId = 1` ODP-as-customer POs are out of scope here.)
|
|
36
|
+
2. **Per PO**, an inner query loads `PurchaseOrderItems` and groups them by integration
|
|
37
|
+
(`VendorItems.overridePoSubmissionIntegrationId` else the vendor's
|
|
38
|
+
`defaultPoSubmissionIntegrationId`).
|
|
39
|
+
3. **Per integration group** (the `foreach`): build + send the cXML POST or the PDF email,
|
|
40
|
+
then INSERT two `Logs_Compass.Record` rows
|
|
41
|
+
(`"Purchase Order <number> transmitted to Vendor via <CXML|EMAIL>. Part numbers: ..."`,
|
|
42
|
+
recordId 17 = PO and 14 = SO).
|
|
43
|
+
4. **After the integration loop**, `UPDATE PurchaseOrders SET dtSubmitted = NOW()` and `sleep(10)`.
|
|
44
|
+
|
|
45
|
+
Routing note: Office Depot (vendor 1) `defaultPoSubmissionIntegrationId = 2`, which is an
|
|
46
|
+
**EMAIL** integration ("Office Depot / Yes") — so ODP POs are emailed PDFs by default, not
|
|
47
|
+
cXML, unless a `VendorItem` overrides it. There is also a CXML integration (id 1,
|
|
48
|
+
"Office Depot / No") that is NOT the default.
|
|
49
|
+
|
|
50
|
+
## Data model
|
|
51
|
+
- `Client_Compass.PurchaseOrders.dtSubmitted` — set by step 4; the outer query's `IS NULL`
|
|
52
|
+
guard means a PO is only ever picked up once.
|
|
53
|
+
- `Logs_Compass.Record` — `recordId` 17 (PurchaseOrder) / 14 (SalesOrder), `primaryKeyId` =
|
|
54
|
+
the PO/SO `id`. The "transmitted to Vendor" note is the success marker.
|
|
55
|
+
|
|
56
|
+
## Client variations
|
|
57
|
+
Compass Canada has a parallel `compasscanada/workflow/2_transmit_...` keyed on
|
|
58
|
+
`CUSTOMER_ID__COMPASS_CANADA`.
|
|
59
|
+
|
|
60
|
+
## Gotchas / known issues
|
|
61
|
+
- **Item-less PO is silently marked submitted without being sent (the "logs show not sent
|
|
62
|
+
but dtSubmitted is set" symptom).** The `dtSubmitted = NOW()` UPDATE runs **unconditionally
|
|
63
|
+
after** the per-integration `foreach`, not inside it. If a PO has **zero
|
|
64
|
+
`PurchaseOrderItems`**, the inner items query returns nothing, `$itemsToSubmitByIntegration`
|
|
65
|
+
stays empty, the `foreach` body never runs — so **nothing is transmitted and no
|
|
66
|
+
"transmitted to Vendor" `Record` row is written** — yet `dtSubmitted` still gets stamped.
|
|
67
|
+
The PO then never re-qualifies for transmission (`dtSubmitted IS NULL` no longer matches).
|
|
68
|
+
**Diagnostic signature:** PO has `dtSubmitted` set but there is NO
|
|
69
|
+
`Logs_Compass.Record` "transmitted to Vendor" note (only "received from MITS") → the PO had
|
|
70
|
+
no line items. Confirmed on MR241298 / PO 50298575-1 (2026-06-21): `dtSubmitted` 23:20:04,
|
|
71
|
+
zero PurchaseOrderItems, no transmit log, no outbound Api log.
|
|
72
|
+
- **Root cause is upstream at MITS, not this cron.** MITS created the order header-only:
|
|
73
|
+
`POST /v2/sales-orders` and `POST /v2/purchase-orders` were both received with
|
|
74
|
+
`"salesOrderItems":[]` / `"purchaseOrderItems":[]` (both 201). The V2 API accepts an order
|
|
75
|
+
with no items (no empty-items rejection), TOGA stored exactly that, and the cron then masked
|
|
76
|
+
it. To confirm what MITS actually sent, read the inbound `requestPayload` in `Logs_Compass.Api`
|
|
77
|
+
(`direction = 'IN'`, `route` `/v2/purchase-orders` or `/v2/sales-orders`, `apiId = 2`).
|
|
78
|
+
- **No try/catch around the log INSERTs or the dtSubmitted UPDATE**, and they write to
|
|
79
|
+
different DBs (`Logs_Compass` vs `Client_Compass`) — a `Logs_Compass` failure can still leave
|
|
80
|
+
`dtSubmitted` stamped without a log (separate, previously-observed failure mode).
|
|
81
|
+
|
|
82
|
+
## Change history
|
|
83
|
+
- 2026-06-22 — Documented the cron and the unconditional-`dtSubmitted` gotcha: item-less POs
|
|
84
|
+
get marked submitted without transmitting or logging; diagnosed via MR241298 inbound MITS
|
|
85
|
+
payload showing empty item arrays. No code change made (diagnosis only). (rgirish)
|
|
86
|
+
|
|
87
|
+
## Related docs
|
|
88
|
+
- [Compass MITS PO → SO Item Linking](mits-po-to-so-item-linking.md)
|
|
89
|
+
- [Compass Order Lifecycle & Data-Integrity Invariants](../workflows/order-lifecycle-and-data-integrity.md)
|
|
@@ -13,6 +13,7 @@ related:
|
|
|
13
13
|
- clients/compass-usa/features/asn-to-item-fulfillment.md
|
|
14
14
|
- clients/compass-usa/features/mits-po-to-so-item-linking.md
|
|
15
15
|
- clients/compass-usa/features/item-fulfillment-tracking-tableview.md
|
|
16
|
+
- clients/compass-usa/features/mits-po-transmission-to-vendors.md
|
|
16
17
|
---
|
|
17
18
|
|
|
18
19
|
## Summary
|
package/package.json
CHANGED