Skip to content

Keep the current ThirdParty when the source sends an unresolvable customer link - #27

Draft
Pichinov-Jose wants to merge 1 commit into
SplashSync:2.0from
Pichinov-Jose:fix/keep-customer-on-unresolved-link
Draft

Pichinov-Jose wants to merge 1 commit into
SplashSync:2.0from
Pichinov-Jose:fix/keep-customer-on-unresolved-link

Conversation

@Pichinov-Jose

Copy link
Copy Markdown

Problem

When the remote source cannot resolve an order/invoice customer — its ThirdParty object is not linked/synced on the source side — the connector writes the unresolved value anyway: setCustomerFields('socid') stores objects()->id($fieldData) even when that resolves to nothing, so socid becomes null and the update then dies with:

Order::update() => Error : Column 'fk_soc' cannot be null
Unable to Update Customer Order (…)

The whole object sync is blocked, even though the local order already has a perfectly valid customer that nobody asked to change.

Fix

Only overwrite socid when the incoming link actually resolves to a local ThirdParty:

  • resolved → written, as before;
  • unresolved on an object that has a customer → keep the current ThirdParty, log a warning;
  • unresolved on an object with no customer (creation case) → same ErrLocalFieldMissing error as doCustomerDetection().

Same protection philosophy as #25: what the source cannot express must not destroy local data.

Reproduced and verified on a live Dolibarr 24.0 + WooCommerce pair: a full-field push with an unlinked customer now completes with a warning and the order keeps its ThirdParty.

🤖 Generated with Claude Code

…tomer link

When the remote source cannot resolve an order/invoice customer (the
ThirdParty is not linked on its side), the socid write stores the raw
unresolved value as null and Commande::update() then fails with
"Column 'fk_soc' cannot be null" — blocking the whole object sync.

Only overwrite socid when the incoming link resolves to a local
ThirdParty; otherwise keep the current one with a warning, and raise an
error only when the object has no customer at all (creation case).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant