Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0044108Openbravo ERP02. Master data managementpublic2020-05-19 16:412020-05-29 13:55
ngarcia 
cberner 
highmajoralways
closedfixed 
5
 
PR20Q3 
alostale
Core
No
0044108: In Discounts and Promotions window, unclear error shown when trying to upload products from a file if they are duplicated
In Discounts and Promotions window, unclear error shown when trying to upload products from a file if they are duplicated
As group admin role:
   Go to Discounts and promotions window
   Create a header and add a name and a starting date
   Go to Products tab
   Click on the toolbar button "Upload a file to import products into the discount"
   Choose the attached file
   Import Mode: Import and Add
   Import Error Handling: Stop on Error

   Check the following error is shown
      org.hibernate.exception.ConstraintViolationException: could not execute batch

   The log shows:
      ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch - HHH000315: Exception executing batch [java.sql.BatchUpdateException: Batch entry 1 insert into M_Offer_Product (...) was aborted: ERROR: duplicate key value violates unique constraint "m_offer_product_unique"
  Detail: Key (m_product_id, m_offer_id)=(..., ...) already exists

   After that, the button keeps loading and it is not active until the window is opened again
No tags attached.
txt prodDisc.txt (16) 2020-05-19 16:45
https://issues.openbravo.com/file_download.php?file_id=14503&type=bug
Issue History
2020-05-19 16:41ngarciaNew Issue
2020-05-19 16:41ngarciaAssigned To => Triage Finance
2020-05-19 16:41ngarciaModules => Core
2020-05-19 16:41ngarciaTriggers an Emergency Pack => No
2020-05-19 16:42ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=21071#r21071
2020-05-19 16:44ngarciaIssue Monitored: networkb
2020-05-19 16:45ngarciaFile Added: prodDisc.txt
2020-05-20 08:48ngarciaResolution time => 1560117600
2020-05-20 08:48ngarciaSeverityminor => major
2020-05-20 08:48ngarciaResolution time1560117600 => 1591740000
2020-05-20 11:28inigo_lergaStatusnew => scheduled
2020-05-21 09:44inigo_lergaAssigned ToTriage Finance => inigo_lerga
2020-05-21 12:58inigo_lergaAssigned Toinigo_lerga => platform
2020-05-21 12:59inigo_lergaStatusscheduled => acknowledged
2020-05-21 13:06inigo_lergaNote Added: 0120131
2020-05-21 13:06inigo_lergaNote Edited: 0120131bug_revision_view_page.php?bugnote_id=0120131#r21087
2020-05-21 13:06inigo_lergaStatusacknowledged => scheduled
2020-05-21 13:08inigo_lergaNote Edited: 0120131bug_revision_view_page.php?bugnote_id=0120131#r21088
2020-05-21 13:35dmiguelezStatusscheduled => acknowledged
2020-05-28 10:03cbernerAssigned Toplatform => cberner
2020-05-28 11:17cbernerNote Added: 0120390
2020-05-28 11:17cbernerStatusacknowledged => scheduled
2020-05-29 10:36hgbotCheckin
2020-05-29 10:36hgbotNote Added: 0120454
2020-05-29 10:36hgbotStatusscheduled => resolved
2020-05-29 10:36hgbotResolutionopen => fixed
2020-05-29 10:36hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/8513209a597a49d0834cfbc0017ab970c10de0be [^]
2020-05-29 13:55alostaleReview Assigned To => alostale
2020-05-29 13:55alostaleStatusresolved => closed
2020-05-29 13:55alostaleFixed in Version => 3.0PR20Q3

Notes
(0120131)
inigo_lerga   
2020-05-21 13:06   
(edited on: 2020-05-21 13:08)
-- This Issue has been assigned to Platform --
BBDD raises an error due to constraint infraction.
Specifically "m_offer_product_unique".

The proper message for this constraint error is already defined in Application Dictionary, but for an some reason it is not picking up the already defined message and using the default "org.hibernate.exception.ConstraintViolationException: could not execute batch" error message from the BBDD.

The error is thrown in the CommitAndClose call in uploadFile method of ProcessUploadedFile.java
The message defined in AD has the constraint as searchkey and the exception raised in java contains the proper constraintName (info obtained via debugging)

(0120390)
cberner   
2020-05-28 11:17   
Merge Request: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/77 [^]
(0120454)
hgbot   
2020-05-29 10:36   
Repository: erp/devel/pi
Changeset: 8513209a597a49d0834cfbc0017ab970c10de0be
Author: Cristian Berner <cristian.berner <at> openbravo.com>
Date: Thu May 28 11:08:54 2020 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/8513209a597a49d0834cfbc0017ab970c10de0be [^]

Fixes ISSUE-44108: Show non-generic DB error message on exception in UploadFile

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/ProcessUploadedFile.java
---