polish
This commit is contained in:
@@ -178,20 +178,20 @@ public class Booking implements Serializable {
|
||||
this.creditCardExpiryYear = creditCardExpiryYear;
|
||||
}
|
||||
|
||||
public boolean validateEnterBookingDetails(MessageContext context) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||
boolean valid = true;
|
||||
if (checkinDate.before(calendar.getTime())) {
|
||||
public void validateEnterBookingDetails(MessageContext context) {
|
||||
if (checkinDate.before(today())) {
|
||||
context.addMessage(new MessageBuilder().error().source("checkinDate").defaultText(
|
||||
"Check in date must be a future date").build());
|
||||
valid = false;
|
||||
"The Check In Date must be a future date").build());
|
||||
} else if (!checkinDate.before(checkoutDate)) {
|
||||
context.addMessage(new MessageBuilder().error().source("checkoutDate").defaultText(
|
||||
"Check out date must be later than check in date").build());
|
||||
valid = false;
|
||||
"The Check Out Date must be later than the Check In Date").build());
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
private Date today() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -176,20 +176,20 @@ public class Booking implements Serializable {
|
||||
this.creditCardExpiryYear = creditCardExpiryYear;
|
||||
}
|
||||
|
||||
public boolean validateEnterBookingDetails(MessageContext context) {
|
||||
public void validateEnterBookingDetails(MessageContext context) {
|
||||
if (checkinDate.before(today())) {
|
||||
context.addMessage(new MessageBuilder().error().source("checkinDate").code("checkinDate.beforeToday")
|
||||
.build());
|
||||
} else if (checkoutDate.before(checkinDate)) {
|
||||
context.addMessage(new MessageBuilder().error().source("checkoutDate").code(
|
||||
"checkoutDate.beforeCheckinDate").build());
|
||||
}
|
||||
}
|
||||
|
||||
private Date today() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||
boolean valid = true;
|
||||
if (checkinDate.before(calendar.getTime())) {
|
||||
context.addMessage(new MessageBuilder().error().source("checkinDate").defaultText(
|
||||
"Check in date must be a future date").build());
|
||||
valid = false;
|
||||
} else if (!checkinDate.before(checkoutDate)) {
|
||||
context.addMessage(new MessageBuilder().error().source("checkoutDate").defaultText(
|
||||
"Check out date must be later than check in date").build());
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
checkinDate.beforeToday=The Check In Date must be a future date
|
||||
checkoutDate.beforeCheckinDate=The Check Out date must be later than the Check In Date
|
||||
booking.checkinDate.typeMismatch=The Check In Date must be in the format dd/mm/yy
|
||||
booking.checkoutDate.typeMismatch=The Check Out Date must be in the format dd/mm/yy
|
||||
Reference in New Issue
Block a user