fix 11984 No JS allows invalid dates in Event

This commit is contained in:
Doug Bell 2010-12-08 14:32:20 -06:00
parent f83b489837
commit 48f9687025
4 changed files with 32 additions and 2 deletions

View file

@ -1333,8 +1333,17 @@ sub processPropertiesFromFormPost {
### Verify the form was filled out correctly...
my @errors;
# If the start date is after the end date
my $i18n = WebGUI::International->new($session, 'Asset_Event');
# Verify we got valid dates
if ( !eval{ $self->getDateTimeStart; 1 } ) {
push @errors, $i18n->get('invalid start date');
}
if ( !eval{ $self->getDateTimeEnd; 1 } ) {
push @errors, $i18n->get('invalid end date');
}
# If the start date is after the end date
if ($self->get("startDate") gt $self->get("endDate")) {
push @errors, $i18n->get("The event end date must be after the event start date.");
}

View file

@ -821,6 +821,18 @@ be useful, others may not.|,
context => 'follows a select list with ordinals, first, second, etc. To form the phrase, First week on, Second week on',
},
'invalid start date' => {
message => 'Invalid start date. Please enter a valid date in the form "YYYY-MM-DD"',
lastUpdated => 0,
context => 'An error when we cant parse the date they give us',
},
'invalid end date' => {
message => 'Invalid end date. Please enter a valid date in the form "YYYY-MM-DD"',
lastUpdated => 0,
context => 'An error when we cant parse the date they give us',
},
};
1;