IDEMPIERE-5454 : Issue on TimeUtil.getBusinessDaysBetween with country based on language (#1534)

https://idempiere.atlassian.net/browse/IDEMPIERE-5454
This commit is contained in:
Nicolas Micoud 2022-10-20 11:36:11 +02:00 committed by GitHub
parent 45a1b4ba4d
commit 9b46986596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -831,8 +831,14 @@ public class TimeUtil
return retValue;
}
/** Returns number of non business days between 2 dates */
/** Returns number of non business days between 2 dates for the country based on current tenant language */
public static int getBusinessDaysBetween(Timestamp startDate, Timestamp endDate, int clientID, String trxName)
{
return getBusinessDaysBetween(startDate, endDate, clientID, MCountry.getDefault().getC_Country_ID(), trxName);
}
/** Returns number of non business days between 2 dates for a specified country */
public static int getBusinessDaysBetween(Timestamp startDate, Timestamp endDate, int clientID, int countryID, String trxName)
{
int retValue = 0;
@ -848,7 +854,7 @@ public class TimeUtil
}
final String sql = "SELECT Date1 FROM C_NonBusinessDay WHERE IsActive='Y' AND AD_Client_ID=? AND Date1 BETWEEN ? AND ? AND COALESCE(C_Country_ID,0) IN (0, ?)";
List<Object> nbd = DB.getSQLValueObjectsEx(trxName, sql, clientID, startDate, endDate, MCountry.getDefault().getC_Country_ID());
List<Object> nbd = DB.getSQLValueObjectsEx(trxName, sql, clientID, startDate, endDate, countryID);
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(startDate);