Revert "Fixed issue-44579: Product should be filtered before Import in M_Offer_Product table"
authorAdrián Romero <adrian.romero@openbravo.com>
Fri, 17 Jul 2020 14:40:46 +0200
changeset 37499 762a3b290f85
parent 37498 00803f99592b
child 37500 c6a76f903725
Revert "Fixed issue 44579: Product should be filtered before Import in M_Offer_Product table"

This reverts commit 2b70f9471dbbf6ed818e366101d551f4b0729c79.
modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/ImportProductInDiscount.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/ImportProductInDiscount.java	Fri Jul 17 13:01:27 2020 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/ImportProductInDiscount.java	Fri Jul 17 14:40:46 2020 +0200
@@ -73,8 +73,7 @@
 
         uploadResult.incTotalCount();
 
-        final List<String> productIds = getProductIds(discount.getClient().getId(),
-            discount.getOrganization().getId(), productKey);
+        final List<String> productIds = getProductIds(productKey);
         if (productIds.size() == 0) {
           uploadResult.incErrorCount();
           uploadResult.addErrorMessage(productKey + " --> " + errorMsgProductNotFound + "\n");
@@ -112,14 +111,11 @@
   }
 
   @SuppressWarnings("unchecked")
-  protected List<String> getProductIds(String clientId, String orgId, String productKey) {
-    String sql = "SELECT m_product_id from m_product where ad_client_id=:clientId and ad_org_id=:orgId and value=:value";
+  protected List<String> getProductIds(String productKey) {
+    String sql = "SELECT m_product_id from m_product where value=:value";
     Session session = OBDal.getInstance().getSession();
     @SuppressWarnings("rawtypes")
-    NativeQuery qry = session.createNativeQuery(sql);
-    qry.setParameter("clientId", clientId);
-    qry.setParameter("orgId", orgId);
-    qry.setParameter("value", productKey);
+    NativeQuery qry = session.createNativeQuery(sql).setParameter("value", productKey);
     // only need max 2 to identify that there is more than one
     qry.setMaxResults(2);
     return (List<String>) qry.list();