CC-2418: Show add: end time shown in display is not the time committed to DB
This commit is contained in:
parent
34ced48076
commit
50cde2f8b0
|
@ -543,8 +543,14 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
if($when) {
|
if($when) {
|
||||||
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
||||||
}
|
}
|
||||||
// format add_show_duration value to hh:mm so it can be compatible with
|
|
||||||
// existing code
|
|
||||||
|
//The way the following code works is that is parses the hour and
|
||||||
|
//minute from a string with the format "1h 20m" or "2h" or "36m".
|
||||||
|
//So we are detecting whether an hour or minute value exists via strpos
|
||||||
|
//and then parse appropriately. A better way to do this in the future is
|
||||||
|
//actually pass the format from javascript in the format hh:mm so we don't
|
||||||
|
//have to do this extra String parsing.
|
||||||
$hPos = strpos($data["add_show_duration"], 'h');
|
$hPos = strpos($data["add_show_duration"], 'h');
|
||||||
$mPos = strpos($data["add_show_duration"], 'm');
|
$mPos = strpos($data["add_show_duration"], 'm');
|
||||||
|
|
||||||
|
@ -555,7 +561,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||||
}
|
}
|
||||||
if($mPos !== false){
|
if($mPos !== false){
|
||||||
$mValue = trim(substr($data["add_show_duration"], $hPos+1, -1 ));
|
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
||||||
|
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
|
|
@ -321,10 +321,12 @@ function setAddShowEvents() {
|
||||||
// when start date/time changes, set end date/time to start date/time+1 hr
|
// when start date/time changes, set end date/time to start date/time+1 hr
|
||||||
$('#add_show_start_date, #add_show_start_time').change(function(){
|
$('#add_show_start_date, #add_show_start_time').change(function(){
|
||||||
var startDate = $('#add_show_start_date').val().split('-');
|
var startDate = $('#add_show_start_date').val().split('-');
|
||||||
var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val());
|
var startTime = $('#add_show_start_time').val().split(':');
|
||||||
|
var startDateTime = new Date(startDate[0], parseInt(startDate[1])-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||||
|
|
||||||
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
|
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
|
||||||
var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val());
|
var endTime = $('#add_show_end_time').val().split(':');
|
||||||
|
var endDateTime = new Date(endDate[0], parseInt(endDate[1])-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||||
|
|
||||||
if(startDateTime.getTime() > endDateTime.getTime()){
|
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||||
endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000));
|
endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000));
|
||||||
|
@ -343,10 +345,12 @@ function setAddShowEvents() {
|
||||||
// when end date/time changes, check if the changed date is in past of start date/time
|
// when end date/time changes, check if the changed date is in past of start date/time
|
||||||
$('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){
|
$('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){
|
||||||
var startDate = $('#add_show_start_date').val().split('-');
|
var startDate = $('#add_show_start_date').val().split('-');
|
||||||
var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val());
|
var startTime = $('#add_show_start_time').val().split(':');
|
||||||
|
var startDateTime = new Date(startDate[0], parseInt(startDate[1])-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||||
|
|
||||||
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
|
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
|
||||||
var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val());
|
var endTime = $('#add_show_end_time').val().split(':');
|
||||||
|
var endDateTime = new Date(endDate[0], parseInt(endDate[1])-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||||
|
|
||||||
if(startDateTime.getTime() > endDateTime.getTime()){
|
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||||
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
|
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
|
||||||
|
|
Loading…
Reference in New Issue