From aacf45495f24ef4e1b6cf4dad86ab3e13a50dfce Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 6 Oct 2018 20:25:26 +0200 Subject: [PATCH] IDEMPIERE-3799 Avoid users re-running a process that is already being processed / Peer review --- .../src/org/compiere/model/MPInstance.java | 1 + .../org/compiere/model/MPInstancePara.java | 28 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPInstance.java b/org.adempiere.base/src/org/compiere/model/MPInstance.java index 8d810a1900..5edcdd135c 100644 --- a/org.adempiere.base/src/org/compiere/model/MPInstance.java +++ b/org.adempiere.base/src/org/compiere/model/MPInstance.java @@ -176,6 +176,7 @@ public class MPInstance extends X_AD_PInstance if (!instanceParameter.equalParameter(para)) { return false; } + break; } } } diff --git a/org.adempiere.base/src/org/compiere/model/MPInstancePara.java b/org.adempiere.base/src/org/compiere/model/MPInstancePara.java index 2d1665256f..2bc0a24665 100644 --- a/org.adempiere.base/src/org/compiere/model/MPInstancePara.java +++ b/org.adempiere.base/src/org/compiere/model/MPInstancePara.java @@ -238,18 +238,26 @@ public class MPInstancePara extends X_AD_PInstance_Para if (param == null) return false; - - if (!Objects.equals(getP_String(),param.getP_String()) && !Objects.equals(getP_String_To(),param.getP_String_To())) + + String str = getP_String() == null ? "" : getP_String(); + String strParam = param.getP_String() == null ? "" : param.getP_String(); + String str2 = getP_String_To() == null ? "" : getP_String_To(); + String str2Param = param.getP_String_To() == null ? "" : param.getP_String_To(); + if (!Objects.equals(str, strParam) || !Objects.equals(str2, str2Param)) return false; - - BigDecimal bd = (BigDecimal)get_Value("P_Number"); - BigDecimal bdParam = (BigDecimal)param.get_Value("P_Number"); - BigDecimal bd2 = (BigDecimal)get_Value("P_Number_To"); - BigDecimal bd2Param = (BigDecimal)param.get_Value("P_Number_To"); - if (!Objects.equals(bd,bdParam) && !Objects.equals(bd2,bd2Param)) + + BigDecimal bd = getP_Number(); + BigDecimal bdParam = param.getP_Number(); + BigDecimal bd2 = getP_Number_To(); + BigDecimal bd2Param = param.getP_Number_To(); + if (!Objects.equals(bd, bdParam) || !Objects.equals(bd2, bd2Param)) return false; - - if (!Objects.equals(getP_Date(),param.getP_Date()) && !Objects.equals(getP_Date_To(),param.getP_Date_To())) + + Timestamp ts = getP_Date(); + Timestamp tsParam = param.getP_Date(); + Timestamp ts2 = getP_Date_To(); + Timestamp ts2Param = param.getP_Date_To(); + if (!Objects.equals(ts, tsParam) || !Objects.equals(ts2, ts2Param)) return false; return true;