You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: purchase_date wire format; skip Configurator order info
Two fixes for syncing order info to Snipe-IT's native purchase_date and
order_number fields (introduced in v1.7.0):
1. purchase_date serialization
Upstream go-snipeit's SnipeTime.MarshalJSON unconditionally emits
"YYYY-MM-DD HH:MM:SS" (datetime), but Snipe-IT's purchase_date validator
only accepts "YYYY-MM-DD" (date-only). Every PATCH was rejected with
"The purchase date must be a valid date in YYYY-MM-DD format".
Routed purchase_date through asset.CustomFields["purchase_date"] as a
plain "YYYY-MM-DD" string. Upstream Asset.MarshalJSON flattens
CustomFields to top-level keys *after* the native PurchaseDate line, so
the plain string overrides the bad SnipeTime serialization. Snipe-IT
still routes the "purchase_date" key to its native column.
Will be removed once upstream serializes date-only fields correctly.
2. Configurator-enrolled devices overwrite real purchase data
Devices added to ABM via Apple Configurator have
purchaseSourceType=MANUALLY_ADDED. ABM returns a synthetic order number
like "CE-2024-12-13-04-11-12-826" and the enrollment date as
orderDateTime — NOT the real purchase data. Syncing these overwrote
real reseller order numbers and purchase dates that were already
correct in Snipe-IT.
Skip order_date and order_number for MANUALLY_ADDED devices by default.
New opt-in flag sync.sync_configurator_order_info bypasses the skip
if you actually want the Configurator metadata synced.
Bonus: new flag sync.preserve_order_info_on_update never overwrites
existing purchase_date / order_number on update (first-time syncs still
write them), so manual corrections in Snipe-IT survive future re-runs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|`sync.field_mapping`| Map Snipe-IT fields to ABM/AppleCare source values |
183
+
|`sync.preserve_order_info_on_update`| Never overwrite existing `purchase_date` / `order_number` on update. First-time syncs still populate them. (default: false) |
184
+
|`sync.sync_configurator_order_info`| Sync ABM's `order_date` / `order_number` for devices added via Apple Configurator (`purchaseSourceType=MANUALLY_ADDED`). Off by default because ABM emits a synthetic `CE-YYYY-MM-DD-...` enrollment ID, not the real purchase info. (default: false) |
183
185
|`snipe_it.computer_category_id`| Category ID for Mac models (overrides `category_id` for Macs) |
184
186
|`snipe_it.mobile_category_id`| Category ID for iPhone/iPad/Watch/Vision models |
185
187
|`snipe_it.custom_fieldset_id`| Fieldset ID to attach to auto-created models |
Copy file name to clipboardExpand all lines: config/config.go
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,8 @@ type SyncConfig struct {
65
65
MDMOnlyCachebool`yaml:"mdm_only_cache"`// also exclude non-MDM devices from cache (requires mdm_only)
66
66
SupplierMappingmap[string]int`yaml:"supplier_mapping"`// ABM purchaseSourceId or purchaseSourceType -> snipe supplier ID
67
67
ModelImagesbool`yaml:"model_images"`// fetch device images from appledb.dev for newly created models
68
+
PreserveOrderInfoOnUpdatebool`yaml:"preserve_order_info_on_update"`// never overwrite existing purchase_date / order_number on update
69
+
SyncConfiguratorOrderInfobool`yaml:"sync_configurator_order_info"`// sync order_date / order_number even for MANUALLY_ADDED devices (default: skip, since ABM's values for these are Configurator enrollment metadata, not real purchase data)
68
70
}
69
71
70
72
// Load reads configuration from a YAML file and applies environment variable overrides.
0 commit comments