Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.47k stars 2.8k forks source link

Bug: adding variant error is not shown to user #14677

Closed dpriskorn closed 3 years ago

dpriskorn commented 4 years ago

Bug

I cannot add a variant

Environment

Expected and actual behavior

Variant added succesfully

Nothing added

Steps to reproduce the behavior

enable variants create product create variant attribute and value add variant to product

Error:

2020-09-09 07:20:41 DEBUG   127.0.0.1           sql=UPDATE llx_product SET label = 'Giant Fathom 29 2 Pure Red Crest', ref = 'test', ref_ext = null, default_vat_code = null, tva_tx = 25.000, recuperableonly = 0, localtax1_tx = 0.000, localtax2_tx = 0.000, localtax1_type = '0', localtax2_type = '0', barcode = null, fk_barcode_type = null, tosell = 1, tobuy = 1, tobatch = 0, finished = null, net_measure = null, net_measure_units = null, weight = '0', weight_units = '0', length = null, length_units = '0', width= null, width_units = '0', height = null, height_units = '0', surface = null, surface_units = '0', volume = null, volume_units = '0', fk_default_warehouse = null, seuil_stock_alerte = 0, description = '<strong>Storlek:</strong> (Giant) Large', url = null, customcode = '', fk_country = null, note = '', duration = '', accountancy_code_buy = '4000', accountancy_code_buy_intra = '4535', accountancy_code_buy_export = '4545', accountancy_code_sell= '3000', accountancy_code_sell_intra= '3000', accountancy_code_sell_export= '3000', desiredstock = 0, cost_price = null, fk_unit= NULL, price_autogen = 0, fk_price_expression = NULL, fk_user_modif = 1 WHERE rowid = 1528
2020-09-09 07:20:41 DEBUG   127.0.0.1           sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,printable,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llx_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-09-09 07:20:41 DEBUG   127.0.0.1            Product::insertExtraFields delete then insert
2020-09-09 07:20:41 DEBUG   127.0.0.1            sql=DELETE FROM llx_product_extrafields WHERE fk_object = 1528
2020-09-09 07:20:41 DEBUG   127.0.0.1            sql=INSERT INTO llx_product_extrafields (fk_object,expired,restock_date,stock,main_supplier_codename,postnord,schenker,sello_id,sello_desc_sv,sello_tosell,sello_label_sv,ms_ref,jv_ref,jo_ref,sh_ref,csn_ref,va_ref,nt_ref,pricedate_fiskekroken,pricedate_intersport,market_survey_description,price_intersport,price_fiskekroken,market_survey_date,alternative1,alternative2,picture_url,product_url,original,script_created,ean,label_en) VALUES (1528,null,null,null,'JV',null,null,null,null,null,null,null,'2001068406',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null)
2020-09-09 07:20:41 ERR     127.0.0.1            DoliDBPgsql::query SQL Error message: ERROR:  23505: duplicate key value violates unique constraint "uk_product_extrafields_jv_ref"
DETAIL:  Key (jv_ref)=(2001068406) already exists.
SCHEMA NAME:  public
TABLE NAME:  llx_product_extrafields
CONSTRAINT NAME:  uk_product_extrafields_jv_ref
LOCATION:  _bt_check_unique, nbtinsert.c:563 (DB_ERROR_RECORD_ALREADY_EXISTS)
2020-09-09 07:20:41 ERR     127.0.0.1            DoliDBPgsql::query SQL Error usesavepoint = 0
2020-09-09 07:20:41 WARNING 127.0.0.1        Try to add a message in stack with empty message
2020-09-09 07:20:41 DEBUG   127.0.0.1       ROLLBACK Transaction
dpriskorn commented 4 years ago

I read the error, and I think it is triggered by an extrafield that must be unique. I will remove the value of the extrafield to avoid this error. This error should be displayed to the user IMO.

dpriskorn commented 4 years ago

Removing it from the main product worked. I added the ref on the variant instead.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 10 days (you should still be able to re-open it if required).