CC-3837: Calendar -> Add Show: Show's duration check does actually allow to create less than 25 hours' show.
-fixed to only allow 24h or less
This commit is contained in:
parent
25ff2b3c3a
commit
19d5655779
|
@ -99,12 +99,16 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
|
||||
$hours = intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h')));
|
||||
$minutes = intval(substr($formData["add_show_duration"], -3, -1));
|
||||
if( $formData["add_show_duration"] == "00h 00m" ) {
|
||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m'));
|
||||
$valid = false;
|
||||
}elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 24) {
|
||||
}elseif(strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) {
|
||||
if ($hours > 24 || ($hours == 24 && $minutes > 0)) {
|
||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h'));
|
||||
$valid = false;
|
||||
}
|
||||
}elseif( strstr($formData["add_show_duration"], '-') ){
|
||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
|
||||
$valid = false;
|
||||
|
|
Loading…
Reference in New Issue