Openbravo Issue Tracking System - Retail Modules
View Issue Details
0046167Retail ModulesMulti UPC/EAN for Productpublic2021-03-26 15:332021-04-19 16:04
lbressan 
ranjith_qualiantech_com 
urgentmajoralways
closedfixed 
5
RR20Q3.1 
 
approved
Gold
22652
No
0046167: The "Multi UPC/EAN for Products" module does not recalculate the EM_Obmupc_Multiupc_Desc field
he "Multi UPC/EAN for Products" module does not recalculate the EM_Obmupc_Multiupc_Desc field when deleting/updating/inserting a record per database script.
The EM_Obmupc_Multiupc_Desc field is not recalculated when a record is deleted/updated/inserted by database script or when a java process is created as follows:
 
  private int updateUPCOccurrencesByProductOrg(Product product, String upcItem,
      Organization organization) {
  //@formatter:off
    String hql =
            "update Product " +
            "set uPCEAN = null " +
            " where id <> :productId " +
            " and organization.id = :orgId " +
            " and uPCEAN = :upc ";
    //@formatter:on

    return OBDal.getInstance()
        .getSession()
        .createQuery(hql)
        .setParameter("productId", product.getId())
        .setParameter("orgId", organization.getId())
        .setParameter("upc", upcItem)
        .executeUpdate();
  }

  private int deleteMultiUPCOccurrencesByProductOrg(Product product, String upcItem) {
  //@formatter:off
    String hql =
            "delete from obmupc_prod_multiupc " +
            " where product.id <> :productId " +
            " and upc = :upc ";
    //@formatter:on

    return OBDal.getInstance()
        .getSession()
        .createQuery(hql)
        .setParameter("productId", product.getId())
        .setParameter("upc", upcItem)
        .executeUpdate();
  }
  In these cases the event handler "UpdateMultiUpcDescHandler" is not executed. Then the EM_Obmupc_Multiupc_Desc field is out of date with incorrect values.
  From BO:
Select a product "X", in the "Multi UPC" tab, add several records with different UPC:
 upc= 3425901109121
 upc= 1234
 upc= 456
2. Delete the first record with upc= 3425901109121 by database script:
delete from obmupc_prod_multiupc where m_product_id='productX';
3.Select product "Y", add from BO the following upc:
 upc= 3425901109121
 upc= 123455
 upc= 45677

From the POS:
When filtering by searching for UPC 3425901109121, it first shows product "X" and when re-entering the same upc it selects product "Y",
attached is a sample video.
I attach an example of a process that modifies the upc and the eventhandler is not executed when this process is executed.

Delete the event handler and create a trigger to be executed after an insert/update/delete in the "obmupc_prod_multiupc" table, the following query can be used to update the "EM_Obmupc_Multiupc_Desc" field of the m_product table:

select coalesce(array_to_string(array_agg(upc), ','),'') into v_multiupc
from obmupc_prod_multiupc
where m_product_id= 'ProductoID';
update m_product set EM_Obmupc_Multiupc_Desc= v_multiupc where m_product_id='ProductoID';
NOR
causes defect 0049492 closed ranjith_qualiantech_com cannot install org.openbravo.multiupc without retail 
? ImportProductJavaPropertyMappingHandler.java (26,530) 2021-03-26 15:33
https://issues.openbravo.com/file_download.php?file_id=15471&type=bug
? error.mkv (4,254,114) 2021-03-26 16:03
https://issues.openbravo.com/file_download.php?file_id=15472&type=bug
Issue History
2021-03-26 15:33lbressanNew Issue
2021-03-26 15:33lbressanAssigned To => Retail
2021-03-26 15:33lbressanFile Added: ImportProductJavaPropertyMappingHandler.java
2021-03-26 15:33lbressanOBNetwork customer => No
2021-03-26 15:33lbressanSupport ticket => 22652
2021-03-26 15:33lbressanResolution time => 1618524000
2021-03-26 15:33lbressanTriggers an Emergency Pack => No
2021-03-26 16:03lbressanFile Added: error.mkv
2021-03-26 16:15rafarodaOBNetwork customerNo => Gold
2021-03-26 16:15rafarodaTag Attached: NOR
2021-03-30 10:10ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2021-03-31 07:42hgbotMerge Request Status => open
2021-03-31 07:42hgbotNote Added: 0127051
2021-04-07 10:49hgbotMerge Request Statusopen => approved
2021-04-07 10:50hgbotResolutionopen => fixed
2021-04-07 10:50hgbotStatusnew => closed
2021-04-07 10:50hgbotNote Added: 0127125
2021-04-07 10:50hgbotNote Added: 0127126
2021-04-07 17:50hgbotNote Added: 0127143
2021-04-07 17:50marvintmNote Added: 0127144
2021-04-07 17:50marvintmStatusclosed => new
2021-04-07 17:50marvintmResolutionfixed => open
2021-04-09 12:01hgbotNote Added: 0127196
2021-04-09 12:01hgbotNote Added: 0127197
2021-04-09 12:01hgbotNote Added: 0127198
2021-04-19 08:32hgbotResolutionopen => fixed
2021-04-19 08:32hgbotStatusnew => closed
2021-04-19 08:32hgbotNote Added: 0127360
2021-04-19 08:32hgbotNote Added: 0127361
2021-04-19 08:34marvintmNote Added: 0127362
2021-04-19 16:04hgbotNote Added: 0127369
2021-04-19 16:04hgbotNote Added: 0127370
2021-04-19 16:04hgbotNote Added: 0127371
2021-04-19 16:04hgbotNote Added: 0127372
2022-06-07 07:06alostaleRelationship addedcauses 0049492

Notes
(0127051)
hgbot   
2021-03-31 07:42   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/1 [^]
(0127125)
hgbot   
2021-04-07 10:50   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc [^]
Changeset: 1a0b4707c53c10a9aedbeeb085e3657880a8d61a
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 2021-04-07T12:59:05+05:30
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/commit/1a0b4707c53c10a9aedbeeb085e3657880a8d61a [^]

Fixed ISSUE-46167: Replaced EventHandler with Trigger for updating Product UPC Desc

---
A src-db/database/model/triggers/OBMUPC_PROD_MULTIUPC_TRG.xml
R src/org/openbravo/multiupc/event/UpdateMultiUpcDescHandler.java
---
(0127126)
hgbot   
2021-04-07 10:50   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/1 [^]
(0127143)
hgbot   
2021-04-07 17:50   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc [^]
Changeset: 431292835eb75e4501af6f7bc0d897efcfdd0b29
Author: Antonio Moreno <antonio.moreno@openbravo.com>
Date: 2021-04-07T15:50:05+00:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/commit/431292835eb75e4501af6f7bc0d897efcfdd0b29 [^]

Revert "Fixed ISSUE-46167: Replaced EventHandler with Trigger for updating Product UPC Desc"

This reverts commit 1a0b4707c53c10a9aedbeeb085e3657880a8d61a
---
A src/org/openbravo/multiupc/event/UpdateMultiUpcDescHandler.java
R src-db/database/model/triggers/OBMUPC_PROD_MULTIUPC_TRG.xml
---
(0127144)
marvintm   
2021-04-07 17:50   
Reverted fix as it was causing problems in integration
(0127196)
hgbot   
2021-04-09 12:01   
Merge Request created: https://gitlab.com/openbravo/ci/modules/org.openbravo.test.mobile.sampledata/-/merge_requests/12 [^]
(0127197)
hgbot   
2021-04-09 12:01   
Merge Request created: https://gitlab.com/openbravo/ci/modules/org.openbravo.retail.testsampledata/-/merge_requests/9 [^]
(0127198)
hgbot   
2021-04-09 12:01   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/2 [^]
(0127360)
hgbot   
2021-04-19 08:32   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc [^]
Changeset: 867ca62708d566bbe4ee0c695665df0f98e462aa
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 2021-04-09T12:45:12+05:30
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/commit/867ca62708d566bbe4ee0c695665df0f98e462aa [^]

Fixed ISSUE-46167: Added Process to update Product UPC Description
* Updated EventHandler to update Product UPC Description

---
A src-db/database/sourcedata/AD_MENU.xml
A src-db/database/sourcedata/AD_MODEL_OBJECT.xml
A src-db/database/sourcedata/AD_PROCESS.xml
A src-db/database/sourcedata/AD_PROCESS_PARA.xml
A src-db/database/sourcedata/AD_TREENODE.xml
A src/org/openbravo/multiupc/process/UpdateProductUPCDescription.java
A src/org/openbravo/multiupc/utility/MultiUPCUtils.java
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/multiupc/event/UpdateMultiUpcDescHandler.java
---
(0127361)
hgbot   
2021-04-19 08:32   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/2 [^]
(0127362)
marvintm   
2021-04-19 08:34   
Finally we did not create a trigger, as that was causing problems with other flows and with Oracle. Instead, we have created a process, "Update Product UPC description". This process can be used to update the UPC description of a particular assortment or all products in the system.
(0127369)
hgbot   
2021-04-19 16:04   
Repository: https://gitlab.com/openbravo/ci/modules/org.openbravo.retail.testsampledata [^]
Changeset: f1d99f5ed67db8c1b6fecf84c1d0fb905fda4b5b
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 2021-04-09T11:31:59+05:30
URL: https://gitlab.com/openbravo/ci/modules/org.openbravo.retail.testsampledata/-/commit/f1d99f5ed67db8c1b6fecf84c1d0fb905fda4b5b [^]

Related to ISSUE-46167: Added ProcessAccess to Process UpdateProductUPCDesc

---
M referencedata/sampledata/Retail_Test/AD_PROCESS_ACCESS.xml
---
(0127370)
hgbot   
2021-04-19 16:04   
Merge request merged: https://gitlab.com/openbravo/ci/modules/org.openbravo.retail.testsampledata/-/merge_requests/9 [^]
(0127371)
hgbot   
2021-04-19 16:04   
Repository: https://gitlab.com/openbravo/ci/modules/org.openbravo.test.mobile.sampledata [^]
Changeset: 893ac9e1a8f1c84b6fdb900ba8073f2b52a704b4
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 2021-04-09T11:32:25+05:30
URL: https://gitlab.com/openbravo/ci/modules/org.openbravo.test.mobile.sampledata/-/commit/893ac9e1a8f1c84b6fdb900ba8073f2b52a704b4 [^]

Related to ISSUE-46167: Added ProcessAccess to Process UpdateProductUPCDesc

---
M referencedata/sampledata/The_White_Valley_Group/AD_PROCESS_ACCESS.xml
---
(0127372)
hgbot   
2021-04-19 16:04   
Merge request merged: https://gitlab.com/openbravo/ci/modules/org.openbravo.test.mobile.sampledata/-/merge_requests/12 [^]