diff --git a/base/src/org/compiere/model/MResourceType.java b/base/src/org/compiere/model/MResourceType.java
index 96ba7000df..7e4df95b7e 100644
--- a/base/src/org/compiere/model/MResourceType.java
+++ b/base/src/org/compiere/model/MResourceType.java
@@ -18,11 +18,13 @@ package org.compiere.model;
import java.sql.ResultSet;
import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
+import org.adempiere.exceptions.FillMandatoryException;
import org.compiere.util.CCache;
import org.compiere.util.TimeUtil;
@@ -36,6 +38,7 @@ import org.compiere.util.TimeUtil;
* @author Teo Sarca, www.arhipac.ro
*
FR [ 2051056 ] MResource[Type] should be cached
* added manufacturing related methods (getDayStart, getDayEnd etc)
+ * BF [ 2431049 ] If Time Slot then Time Slot Start/End should be mandatory
*/
public class MResourceType extends X_S_ResourceType
{
@@ -89,7 +92,13 @@ public class MResourceType extends X_S_ResourceType
{
if (isTimeSlot())
{
- if (getTimeSlotStart().compareTo(getTimeSlotEnd()) >= 0)
+ Timestamp start = getTimeSlotStart();
+ if (start == null)
+ throw new FillMandatoryException(COLUMNNAME_TimeSlotStart);
+ Timestamp end = getTimeSlotEnd();
+ if (end == null)
+ throw new FillMandatoryException(COLUMNNAME_TimeSlotEnd);
+ if (start.compareTo(end) >= 0)
{
throw new AdempiereException("@TimeSlotStart@ > @TimeSlotEnd@");
}
@@ -219,4 +228,36 @@ public class MResourceType extends X_S_ResourceType
return isOnMonday() || isOnTuesday() || isOnWednesday() || isOnThursday() || isOnFriday()
|| isOnSaturday() || isOnSunday();
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("MResourceType[")
+ .append(get_ID())
+ .append(",Value=").append(getValue())
+ .append(",Name=").append(getName());
+ if (isTimeSlot())
+ {
+ SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
+ sb.append(",TimeSlot=");
+ Timestamp start = getTimeSlotStart();
+ Timestamp end = getTimeSlotEnd();
+ sb.append(start != null ? df.format(start) : " - ");
+ sb.append("-");
+ sb.append(end != null ? df.format(end) : " - ");
+ }
+ if (isDateSlot())
+ {
+ sb.append(",DaySlot=")
+ .append(isOnMonday() ? "M" : "-")
+ .append(isOnTuesday() ? "T" : "-")
+ .append(isOnWednesday() ? "W" : "-")
+ .append(isOnThursday() ? "T" : "-")
+ .append(isOnFriday() ? "F" : "-")
+ .append(isOnSaturday() ? "S" : "-")
+ .append(isOnSunday() ? "S" : "-");
+ }
+ return sb.append("]").toString();
+ }
} // MResourceType
diff --git a/migration/352a-trunk/360_BF2431049.sql b/migration/352a-trunk/360_BF2431049.sql
new file mode 100644
index 0000000000..71e790cde1
--- /dev/null
+++ b/migration/352a-trunk/360_BF2431049.sql
@@ -0,0 +1,10 @@
+-- 15.12.2008 16:46:02 EET
+--
+UPDATE AD_Field SET IsMandatory='Y',Updated=TO_DATE('2008-12-15 16:46:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=5584
+;
+
+-- 15.12.2008 16:46:08 EET
+--
+UPDATE AD_Field SET IsMandatory='Y',Updated=TO_DATE('2008-12-15 16:46:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=5579
+;
+
diff --git a/migration/352a-trunk/postgresql/360_BF2431049.sql b/migration/352a-trunk/postgresql/360_BF2431049.sql
new file mode 100644
index 0000000000..258bd1eea8
--- /dev/null
+++ b/migration/352a-trunk/postgresql/360_BF2431049.sql
@@ -0,0 +1,10 @@
+-- 15.12.2008 16:46:02 EET
+--
+UPDATE AD_Field SET IsMandatory='Y',Updated=TO_TIMESTAMP('2008-12-15 16:46:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=5584
+;
+
+-- 15.12.2008 16:46:08 EET
+--
+UPDATE AD_Field SET IsMandatory='Y',Updated=TO_TIMESTAMP('2008-12-15 16:46:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=5579
+;
+