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

FIX supplier price duplicate entry on update supplier product ref #29290

Merged

Conversation

lvessiller-opendsi
Copy link
Contributor

FIX supplier price duplicate entry on update supplier product ref

  • when you edit an existing supplier price and when you update en empty supplier product reference with a new one, you got a duplicate entry SQL error

To reproduce
You have this product supplier price :
image

You edit this supplier price and set a new product supplier reference : "PROD1FOURN1"

Then when you save this product supplier price, you got this error :
image

Remarks
This fix is only for products with no supplier reference : the supplier reference of product is empty in database.
The field of "ref_fourn" is not mandatory in database and can be NULL.
So you can have a database with this case.

And for an update you don't need to use 'add_fournisseur()" method because you know the rowid of "product_supplier_price" table. And no need to check if the unique key for supplier reference already exist : it will be return by the SQL server such as "mysql".

@eldy eldy merged commit 22244a9 into Dolibarr:14.0 Apr 9, 2024
2 checks passed
@lvessiller-opendsi lvessiller-opendsi deleted the 14.0_fix-supplier-price-duplicate-entry branch April 11, 2024 06:54
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.

None yet

2 participants