IDEMPIERE-2901 Period Control Management / improve cache management (#1059)

This commit is contained in:
Carlos Ruiz 2021-12-19 07:08:54 +01:00 committed by GitHub
parent d748293553
commit 80ec1f9419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -98,35 +98,40 @@ public class PeriodStatus extends SvrProcess
}
StringBuilder sql = new StringBuilder ("UPDATE C_PeriodControl SET PeriodStatus=?, PeriodAction='N', Updated=getDate(), UpdatedBy=? WHERE ");
// WHERE
StringBuilder wherepc = new StringBuilder();
if (p_C_Period_IDs != null && p_C_Period_IDs.size() > 0) {
sql.append("C_Period_ID IN (");
wherepc.append("C_Period_ID IN (");
boolean addComma = false;
for (int id : p_C_Period_IDs) {
if (addComma)
sql.append(",");
wherepc.append(",");
else
addComma = true;
sql.append(id);
wherepc.append(id);
}
} else if (p_C_PeriodControl_IDs != null && p_C_PeriodControl_IDs.size() > 0) {
sql.append("C_PeriodControl_ID IN (");
wherepc.append("C_PeriodControl_ID IN (");
boolean addComma = false;
for (int id : p_C_PeriodControl_IDs) {
if (addComma)
sql.append(",");
wherepc.append(",");
else
addComma = true;
sql.append(id);
wherepc.append(id);
}
}
sql.append(") AND PeriodStatus<>'P' AND PeriodStatus<>?");
wherepc.append(") AND PeriodStatus<>'P' AND PeriodStatus<>?");
sql.append(wherepc);
StringBuilder sqlPeriods = new StringBuilder("SELECT DISTINCT C_Period_ID FROM C_PeriodControl WHERE ").append(wherepc);
int[] periods = DB.getIDsEx(get_TrxName(), sqlPeriods.toString(), p_PeriodAction);
no += DB.executeUpdateEx(sql.toString(), new Object[] {p_PeriodAction, getAD_User_ID(), p_PeriodAction}, get_TrxName());
if (p_C_Period_IDs != null && p_C_Period_IDs.size() > 0) {
for (int id : p_C_Period_IDs) {
if (periods != null && periods.length > 0) {
for (int id : periods) {
CacheMgt.get().reset("C_Period", id);
}
} else if (p_C_PeriodControl_IDs != null && p_C_PeriodControl_IDs.size() > 0) {
}
if (p_C_PeriodControl_IDs != null && p_C_PeriodControl_IDs.size() > 0) {
for (int id : p_C_PeriodControl_IDs) {
CacheMgt.get().reset("C_PeriodControl", id);
}