fix 11984 No JS allows invalid dates in Event
This commit is contained in:
parent
f83b489837
commit
48f9687025
4 changed files with 32 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
7.10.7
|
||||
- added #11968: use the language override in the registration form (Jukka Raimovaara / Mentalhouse Oy)
|
||||
- Changed Carousel to use TinyMCE with WebGUI plugins
|
||||
- fixed #11984: No JS allows invalid dates in Event asset
|
||||
|
||||
7.10.6
|
||||
- fixed #11974: Toolbar icons unclickable in Webkit using HTML5
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use WebGUI::Asset::Event;
|
|||
|
||||
use Test::More; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
plan tests => 23;
|
||||
plan tests => 25;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -144,6 +144,14 @@ is ($event7->get('startDate'), '2000-09-01', 'startDate bumped by 1 day');
|
|||
is ($event7->get('endTime'), '00:00:00', 'endTime set to 00:00:00 if the hour is more than 23');
|
||||
is ($event7->get('endDate'), '2000-09-02', 'endDate bumped by 1 day');
|
||||
|
||||
#############################################################################
|
||||
# Valid dates
|
||||
$session->request->setup_body({ startDate => '0000-00-01', endDate => '1000-00-01' });
|
||||
my $event = $cal->addChild({ className => 'WebGUI::Asset::Event' }, undef, time()+10);
|
||||
my $output = $event->processPropertiesFromFormPost;
|
||||
is( ref $output, 'ARRAY', 'ppffp returns error array' );
|
||||
is( scalar @$output, 2, 'has two errors' );
|
||||
|
||||
#######################################
|
||||
#
|
||||
# duplicate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue