CC-3864: Calendar -> Edit show: Can edit the start time of current playing show
- fixed
This commit is contained in:
parent
ec6ff4c9e6
commit
2bf6408d90
3 changed files with 13 additions and 5 deletions
|
@ -760,7 +760,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$data['add_show_record'] = $show->isRecorded();
|
$data['add_show_record'] = $show->isRecorded();
|
||||||
|
|
||||||
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate);
|
$origianlShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
|
||||||
|
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate, $origianlShowStartDateTime);
|
||||||
|
|
||||||
if ($success){
|
if ($success){
|
||||||
$this->view->addNewShow = true;
|
$this->view->addNewShow = true;
|
||||||
|
|
|
@ -83,7 +83,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData, $validateStartDate) {
|
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=false) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||||
|
@ -91,12 +91,19 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
//DateTime stores $start_time in the current timezone
|
//DateTime stores $start_time in the current timezone
|
||||||
$nowDateTime = new DateTime();
|
$nowDateTime = new DateTime();
|
||||||
$showStartDateTime = new DateTime($start_time);
|
$showStartDateTime = new DateTime($start_time);
|
||||||
|
|
||||||
if ($validateStartDate){
|
if ($validateStartDate){
|
||||||
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
// if edit action, check if original show start time is in the past. CC-3864
|
||||||
|
if($originalStartDate){
|
||||||
|
if($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started'));
|
||||||
|
$this->disableStartDateAndTime();
|
||||||
|
$valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern = '/([0-9][0-9])h ([0-9][0-9])m/';
|
$pattern = '/([0-9][0-9])h ([0-9][0-9])m/';
|
||||||
|
|
|
@ -750,7 +750,7 @@ class Application_Model_Schedule {
|
||||||
* Another clean-up is to move all the form manipulation to the proper form class.....
|
* Another clean-up is to move all the form manipulation to the proper form class.....
|
||||||
* -Martin
|
* -Martin
|
||||||
*/
|
*/
|
||||||
public static function addUpdateShow($data, $controller, $validateStartDate){
|
public static function addUpdateShow($data, $controller, $validateStartDate, $originalStartDate=null){
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
@ -777,7 +777,7 @@ class Application_Model_Schedule {
|
||||||
$when = $formWhen->isValid($data);
|
$when = $formWhen->isValid($data);
|
||||||
$live = $formLive->isValid($data);
|
$live = $formLive->isValid($data);
|
||||||
if($when) {
|
if($when) {
|
||||||
$when = $formWhen->checkReliantFields($data, $validateStartDate);
|
$when = $formWhen->checkReliantFields($data, $validateStartDate, $originalStartDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
//The way the following code works is that is parses the hour and
|
//The way the following code works is that is parses the hour and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue