Updated preEditShowValidationCheck to behave properly when dealing with shows with cc_show_days rows in the past, updated serialized form data in add-show to accommodate the change
This commit is contained in:
parent
5ea27067e2
commit
00e85de3c8
2 changed files with 164 additions and 159 deletions
|
@ -362,33 +362,22 @@ class Application_Service_ShowFormService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Before we send the form data in for validation, there
|
* Before we send the form data in for validation, there
|
||||||
* are a few fields we may need to adjust first
|
* are a few fields we may need to adjust first
|
||||||
|
*
|
||||||
* @param $formData
|
* @param $formData
|
||||||
*/
|
*/
|
||||||
public function preEditShowValidationCheck($formData)
|
public function preEditShowValidationCheck($formData)
|
||||||
{
|
{
|
||||||
$validateStartDate = true;
|
// If the start date or time were disabled, don't validate them
|
||||||
$validateStartTime = true;
|
$validateStartDate = $formData['start_date_disabled'] === "false";
|
||||||
|
$validateStartTime = $formData['start_time_disabled'] === "false";
|
||||||
|
|
||||||
//CcShowDays object of the show currently being edited
|
//CcShowDays object of the show currently being edited
|
||||||
$currentShowDay = $this->ccShow->getFirstCcShowDay();
|
$currentShowDay = $this->ccShow->getFirstCcShowDay();
|
||||||
|
|
||||||
//DateTime object
|
//DateTime object
|
||||||
$dt = $currentShowDay->getLocalStartDateAndTime();
|
$dt = $currentShowDay->getLocalStartDateAndTime();
|
||||||
|
|
||||||
if (!array_key_exists('add_show_start_date', $formData)) {
|
|
||||||
//Changing the start date was disabled, since the
|
|
||||||
//array key does not exist. We need to repopulate this entry from the db.
|
|
||||||
$formData['add_show_start_date'] = $dt->format("Y-m-d");
|
|
||||||
|
|
||||||
if (!array_key_exists('add_show_start_time', $formData)) {
|
|
||||||
$formData['add_show_start_time'] = $dt->format("H:i");
|
|
||||||
$validateStartTime = false;
|
|
||||||
}
|
|
||||||
$validateStartDate = false;
|
|
||||||
}
|
|
||||||
$formData['add_show_record'] = $currentShowDay->getDbRecord();
|
$formData['add_show_record'] = $currentShowDay->getDbRecord();
|
||||||
|
|
||||||
//if the show is repeating, set the start date to the next
|
//if the show is repeating, set the start date to the next
|
||||||
|
|
|
@ -613,7 +613,23 @@ function setAddShowEvents(form) {
|
||||||
form.find("#add_show_record").attr("disabled", false);
|
form.find("#add_show_record").attr("disabled", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var startDateDisabled = false,
|
||||||
|
startTimeDisabled = false;
|
||||||
|
|
||||||
|
// Similarly, we need to re-enable start date and time if they're disabled
|
||||||
|
if (form.find("#add_show_start_date").prop("disabled") === true) {
|
||||||
|
form.find("#add_show_start_date").attr("disabled", false);
|
||||||
|
startDateDisabled = true;
|
||||||
|
}
|
||||||
|
if (form.find("#add_show_start_time").prop("disabled") === true) {
|
||||||
|
form.find("#add_show_start_time").attr("disabled", false);
|
||||||
|
startTimeDisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
var data = $("form").serializeArray();
|
var data = $("form").serializeArray();
|
||||||
|
// We need to notify the application if date and time were disabled
|
||||||
|
data.push({name: 'start_date_disabled', value: startDateDisabled});
|
||||||
|
data.push({name: 'start_time_disabled', value: startTimeDisabled});
|
||||||
|
|
||||||
var hosts = $('#add_show_hosts-element input').map(function() {
|
var hosts = $('#add_show_hosts-element input').map(function() {
|
||||||
if($(this).attr("checked")) {
|
if($(this).attr("checked")) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue