Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0046167
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Multi UPC/EAN for Productmajoralways2021-03-26 15:332021-04-09 12:01
ReporterlbressanView Statuspublic 
Assigned Toranjith_qualiantech_com 
PriorityurgentResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionRR20Q3.1SCM revision 
Review Assigned To
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0046167: The "Multi UPC/EAN for Products" module does not recalculate the EM_Obmupc_Multiupc_Desc field

Descriptionhe "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.
Steps To Reproduce  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.

Proposed SolutionDelete 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';
TagsNOR
Attached Files? file icon ImportProductJavaPropertyMappingHandler.java [^] (26,530 bytes) 2021-03-26 15:33
? file icon error.mkv [^] (4,254,114 bytes) 2021-03-26 16:03

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0127051)
hgbot (developer)
2021-03-31 07:42

Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/1 [^]
(0127125)
hgbot (developer)
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 (developer)
2021-04-07 10:50

Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/1 [^]
(0127143)
hgbot (developer)
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 (developer)
2021-04-07 17:50

Reverted fix as it was causing problems in integration
(0127196)
hgbot (developer)
2021-04-09 12:01

Merge Request created: https://gitlab.com/openbravo/ci/modules/org.openbravo.test.mobile.sampledata/-/merge_requests/12 [^]
(0127197)
hgbot (developer)
2021-04-09 12:01

Merge Request created: https://gitlab.com/openbravo/ci/modules/org.openbravo.retail.testsampledata/-/merge_requests/9 [^]
(0127198)
hgbot (developer)
2021-04-09 12:01

Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.multiupc/-/merge_requests/2 [^]

- Issue History
Date Modified Username Field Change
2021-03-26 15:33 lbressan New Issue
2021-03-26 15:33 lbressan Assigned To => Retail
2021-03-26 15:33 lbressan File Added: ImportProductJavaPropertyMappingHandler.java
2021-03-26 15:33 lbressan Triggers an Emergency Pack => No
2021-03-26 16:03 lbressan File Added: error.mkv
2021-03-26 16:15 rafaroda Tag Attached: NOR
2021-03-30 10:10 ranjith_qualiantech_com Assigned To Retail => ranjith_qualiantech_com
2021-03-31 07:42 hgbot Note Added: 0127051
2021-04-07 10:50 hgbot Resolution open => fixed
2021-04-07 10:50 hgbot Status new => closed
2021-04-07 10:50 hgbot Note Added: 0127125
2021-04-07 10:50 hgbot Note Added: 0127126
2021-04-07 17:50 hgbot Note Added: 0127143
2021-04-07 17:50 marvintm Note Added: 0127144
2021-04-07 17:50 marvintm Status closed => new
2021-04-07 17:50 marvintm Resolution fixed => open
2021-04-09 12:01 hgbot Note Added: 0127196
2021-04-09 12:01 hgbot Note Added: 0127197
2021-04-09 12:01 hgbot Note Added: 0127198


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker