FIX category links cleanup before deleting commercial objects#38970
Open
mapiolca wants to merge 6 commits into
Open
FIX category links cleanup before deleting commercial objects#38970mapiolca wants to merge 6 commits into
mapiolca wants to merge 6 commits into
Conversation
Ensure category links are removed when deleting proposals, supplier proposals and supplier invoices by adding DELETE queries for categorie_propal, categorie_supplier_proposal and categorie_supplier_invoice and handling DB errors. Reorganize supplier invoice delete logic so category cleanup occurs before discount freeing. Update PHPUnit tests (PropalTest, SupplierProposalTest, FactureFournisseurTest) to create a category link, assert deletion of the category row after object delete, and require the categorie class.
Remove the surrounding if(!$error) guard so the DELETE from categorie_supplier_invoice runs regardless of prior errors. This ensures linked categories are always cleaned up for the supplier invoice; preserved existing error handling to record DB failures.
….com/mapiolca/dolibarr into 23.0-fix-delete-propal-with-category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FIX Category links cleanup before deleting commercial objects
Delete native category links before deleting categorized commercial objects to avoid foreign key constraint failures.
This fixes deletion of:
categorie_propalcategorie_supplier_proposalcategorie_supplier_invoiceIt also removes the incorrect supplier invoice cleanup against
categorie_invoice, which belongs to customer invoices.