Skip to content

FIX refuse to delete a variant parent product - #37

Open
Pichinov-Jose wants to merge 1 commit into
SplashSync:2.0from
Pichinov-Jose:fix/variant-base-delete-guard
Open

Pichinov-Jose wants to merge 1 commit into
SplashSync:2.0from
Pichinov-Jose:fix/variant-base-delete-guard

Conversation

@Pichinov-Jose

Copy link
Copy Markdown

Bug

load() already refuses to open a variant parent (ProductIsVariantBase). delete() has no such guard.

A parent carries no order line of its own, so isObjectUsed() believes it is free, and Product::delete() removes it together with every variant hanging from it. One delete instruction from the source, and a whole family is gone — including variants that are used on real orders.

Fix

Apply the same guard as load(), at the top of delete() before anything is fetched.

Fixes #23. Running in production on a Dolibarr 23.0.0 shop.

🤖 Generated with Claude Code

load() already refuses to open a variant parent, but delete() has no such
guard. A parent carries no order line of its own, so isObjectUsed() believes
it is free and Dolibarr deletes it together with every variant hanging from
it — a whole family lost on a single delete instruction from the source.

Apply the same guard as load().

Closes SplashSync#23

Co-Authored-By: Claude Opus 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.

delete() can destroy a whole variant family — the variant-base guard is missing

1 participant