diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 2cb298e51..d3fab07b8 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -622,10 +622,22 @@ class ScheduleController extends Zend_Controller_Action $who = $formWho->isValid($data); $style = $formStyle->isValid($data); - $record = $formRecord->isValid($data); + + //If show is a new show (not updated), then get + //isRecorded from POST data. Otherwise get it from + //the database since the user is not allowed to + //update this option. + $record = false; + if ($data['add_show_id'] != -1){ + $show = new Show($data['add_show_id']); + $data['add_show_record'] = $show->isRecorded(); + $record = $formRecord->isValid($data); + $formRecord->getElement('add_show_record')->setOptions(array('disabled' => true)); + } else { + $record = $formRecord->isValid($data); + } if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) { - $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new User($userInfo->id); if ($user->isAdmin()) { diff --git a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php index 0053425cc..062b959d2 100644 --- a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php +++ b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php @@ -38,6 +38,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm $valid = true; $day = $formData['add_show_rebroadcast_date_absolute_'.$i]; + $time = $formData['add_show_rebroadcast_time_absolute_'.$i]; if(trim($day) == "" && trim($time) == "") { continue; @@ -48,7 +49,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm $valid = false; } - $time = $formData['add_show_rebroadcast_time_absolute_'.$i]; + if (trim($time) == ""){ $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified")); $valid = false; diff --git a/airtime_mvc/application/forms/AddShowRebroadcastDates.php b/airtime_mvc/application/forms/AddShowRebroadcastDates.php index c31f4fde6..015662463 100644 --- a/airtime_mvc/application/forms/AddShowRebroadcastDates.php +++ b/airtime_mvc/application/forms/AddShowRebroadcastDates.php @@ -43,6 +43,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm $valid = true; $days = $formData['add_show_rebroadcast_date_'.$i]; + $time = $formData['add_show_rebroadcast_time_'.$i]; if(trim($days) == "" && trim($time) == "") { continue; @@ -53,7 +54,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm $valid = false; } - $time = $formData['add_show_rebroadcast_time_'.$i]; + if (trim($time) == ""){ $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified")); $valid = false; diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php index ed3f076a2..ee5fd7396 100644 --- a/airtime_mvc/application/models/Shows.php +++ b/airtime_mvc/application/models/Shows.php @@ -661,16 +661,7 @@ class Show { $showId = $ccShow->getDbId(); $show = new Show($showId); - //If show is a new show (not updated), then get - //isRecorded from POST data. Otherwise get it from - //the database since the user is not allowed to - //update this option. - if ($data['add_show_id'] == -1){ - $isRecorded = ($data['add_show_record']) ? 1 : 0; - } else { - $isRecorded = $show->isRecorded(); - } - + $isRecorded = ($data['add_show_record']) ? 1 : 0; if ($data['add_show_id'] != -1){ Show::deletePossiblyInvalidInstances($data, $show, $endDate, $isRecorded, $repeatType);