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:
Duncan Sommerville 2014-10-28 17:18:11 -04:00
parent 5ea27067e2
commit 00e85de3c8
2 changed files with 164 additions and 159 deletions

View file

@ -362,33 +362,22 @@ class Application_Service_ShowFormService
}
/**
*
* Before we send the form data in for validation, there
* are a few fields we may need to adjust first
*
* @param $formData
*/
public function preEditShowValidationCheck($formData)
{
$validateStartDate = true;
$validateStartTime = true;
// If the start date or time were disabled, don't validate them
$validateStartDate = $formData['start_date_disabled'] === "false";
$validateStartTime = $formData['start_time_disabled'] === "false";
//CcShowDays object of the show currently being edited
$currentShowDay = $this->ccShow->getFirstCcShowDay();
//DateTime object
$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();
//if the show is repeating, set the start date to the next