CC-3153: When cancelling a show that is currently on-air, the show-instance is not removed.

-fixed
This commit is contained in:
Martin Konecny 2011-12-05 12:56:16 -05:00
parent 162f11022b
commit 73c0408315
3 changed files with 11 additions and 13 deletions

View File

@ -143,13 +143,13 @@ class ScheduleController extends Zend_Controller_Action
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
try{ try{
$show = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$show->deleteShow(); $showInstance->delete();
} }
} }
@ -821,13 +821,13 @@ class ScheduleController extends Zend_Controller_Action
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
try{ try{
$show = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$show->clearShow(); $showInstance->clearShow();
$show->deleteShow(); $showInstance->delete();
// send 'cancel-current-show' command to pypo // send 'cancel-current-show' command to pypo
Application_Model_RabbitMq::SendMessageToPypo("cancel_current_show", array()); Application_Model_RabbitMq::SendMessageToPypo("cancel_current_show", array());
} }

View File

@ -106,7 +106,7 @@ class Application_Model_Show {
} }
//remove everything about this show. //remove everything about this show.
public function deleteShow() public function delete()
{ {
//usually we hide the show-instance, but in this case we are deleting the show template //usually we hide the show-instance, but in this case we are deleting the show template
//so delete all show-instances as well. //so delete all show-instances as well.

View File

@ -435,7 +435,7 @@ class Application_Model_ShowInstance {
$this->updateScheduledTime(); $this->updateScheduledTime();
} }
public function deleteShow() public function delete()
{ {
global $CC_DBC; global $CC_DBC;
@ -446,10 +446,9 @@ class Application_Model_ShowInstance {
$show = $this->getShow(); $show = $this->getShow();
$current_timestamp = gmdate("Y-m-d H:i"); $current_timestamp = gmdate("Y-m-d H:i:s");
if ($current_timestamp < $this->getShowInstanceStart()) {
if ($current_timestamp <= $this->getShowInstanceEnd()) {
if ($show->isRepeating()) { if ($show->isRepeating()) {
CcShowInstancesQuery::create() CcShowInstancesQuery::create()
@ -486,8 +485,7 @@ class Application_Model_ShowInstance {
} }
} }
else { else {
$show->delete();
$show->deleteShow();
} }
} }