Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUAL: deleteObjectLinked() element value matching add_object_linked() #32886

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

altairis-noe
Copy link
Contributor

FIX: deleteObjectLinked() element value matching add_object_linked()

CommonObject::add_object_linked() uses CommonObject::getElementType() to set element type in db. So should CommonObject::deleteObjectLinked(), or we might not delete previously created links

@eldy
Copy link
Member

eldy commented Feb 2, 2025

Can you describe how to reproduce the bug from screen ?
If you can't from screen, PR must be pushed into develop as it means it is a code quality enhancement.

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Feb 2, 2025
@altairis-noe
Copy link
Contributor Author

I wouldn’t say code quality enhancement, but it wouldn’t show in Dolibarr screen either.
I’ll try and describe the use case.
I have a module in custom named module, with an object in it. I use $object->add_object_link() in, let’s say, an order.
In table llx_element_element, I will have

sourcetype => module_object, targettype => commande

If I delete my object, or call deleteObjectLink() for some reason, as $element is object and not module_object, the entry in element_element will stay there, causing unwanted (and potentially misleading) information to rot in the database.
This PR corrects that.
So this is not QUAL, imo, this is FIX!

@altairis-noe
Copy link
Contributor Author

Does it make sense for you, @eldy ?

@eldy
Copy link
Member

eldy commented Feb 4, 2025

Does it make sense for you, @eldy ?

As this affect only external module, this can't be categorized as a bug of dolibarr, but as an enhancement to allow a use case provided by external modules that is not yet possible. So you must push it into develop.

@altairis-noe altairis-noe changed the base branch from 20.0 to develop February 6, 2025 08:19
@altairis-noe
Copy link
Contributor Author

I would’n’t say I agree, @eldy but I won’t argue 😉 Thankfully, the PR works on develop, so I just changed the target branch!

@altairis-noe
Copy link
Contributor Author

Is it all good for you now, @eldy?

@altairis-noe altairis-noe changed the title FIX: deleteObjectLinked() element value matching add_object_linked() QUAL: deleteObjectLinked() element value matching add_object_linked() Feb 10, 2025
@altairis-noe
Copy link
Contributor Author

Hey there @eldy are we OK to merge this ?

@eldy eldy merged commit 5e47f63 into Dolibarr:develop Feb 10, 2025
6 checks passed
@altairis-noe altairis-noe deleted the element_type branch February 10, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants