CC-4454: Show deleting: if you do 'delete this instance and all following', it doesn't remove entries from cc_schedule table

-fixed
This commit is contained in:
Martin Konecny 2012-09-17 12:32:39 -04:00
parent ab99e64e8a
commit 5d0592c729
4 changed files with 20 additions and 24 deletions

View file

@ -192,6 +192,7 @@ class ScheduleController extends Zend_Controller_Action
try { try {
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
} catch (Exception $e) { } catch (Exception $e) {
Logging::info($e->getMessage());
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;

View file

@ -558,6 +558,7 @@ WHERE st.ends > :startTime1
AND st.starts < :endTime AND st.starts < :endTime
AND st.playout_status > 0 AND st.playout_status > 0
AND si.ends > :startTime2 AND si.ends > :startTime2
AND si.modified_instance = 'f'
ORDER BY st.starts ORDER BY st.starts
SQL; SQL;
@ -578,6 +579,7 @@ WHERE st.ends > :startTime1
AND st.starts < :rangeEnd AND st.starts < :rangeEnd
AND st.playout_status > 0 AND st.playout_status > 0
AND si.ends > :startTime2 AND si.ends > :startTime2
AND si.modified_instance = 'f'
ORDER BY st.starts LIMIT 3 ORDER BY st.starts LIMIT 3
SQL; SQL;

View file

@ -275,8 +275,6 @@ SQL;
public function cancelShow($day_timestamp) public function cancelShow($day_timestamp)
{ {
$con = Propel::getConnection();
$timeinfo = explode(" ", $day_timestamp); $timeinfo = explode(" ", $day_timestamp);
CcShowDaysQuery::create() CcShowDaysQuery::create()
@ -284,29 +282,22 @@ SQL;
->update(array('DbLastShow' => $timeinfo[0])); ->update(array('DbLastShow' => $timeinfo[0]));
$sql = <<<SQL $sql = <<<SQL
UPDATE cc_show_instances SELECT id from cc_show_instances
SET modified_instance = TRUE
WHERE starts >= :dayTimestamp::TIMESTAMP WHERE starts >= :dayTimestamp::TIMESTAMP
AND show_id = :showId AND show_id = :showId
SQL; SQL;
Application_Common_Database::prepareAndExecute( $sql, array( $rows = Application_Common_Database::prepareAndExecute( $sql, array(
':dayTimestamp' => $day_timestamp, ':dayTimestamp' => $day_timestamp,
':showId' => $this->getId()), 'execute'); ':showId' => $this->getId()), 'all');
// check if we can safely delete the show foreach ($rows as $row) {
$showInstancesRow = CcShowInstancesQuery::create() try {
->filterByDbShowId($this->_showId) $showInstance = new Application_Model_ShowInstance($row["id"]);
->filterByDbModifiedInstance(false) $showInstance->delete($rabbitmqPush = false);
->findOne(); } catch (Exception $e) {
Logging::info($e->getMessage());
if (is_null($showInstancesRow)) { }
$sql = <<<SQL
DELETE FROM cc_show WHERE id = :show_id
SQL;
Application_Common_Database::prepareAndExecute(
$sql, array( 'show_id' => $this->_showId ), "execute");
$con->exec($sql);
} }
Application_Model_RabbitMq::PushSchedule(); Application_Model_RabbitMq::PushSchedule();

View file

@ -518,7 +518,7 @@ SQL;
return false; return false;
} }
public function delete() public function delete($rabbitmqPush = true)
{ {
// see if it was recording show // see if it was recording show
$recording = $this->isRecorded(); $recording = $this->isRecorded();
@ -568,8 +568,10 @@ SQL;
} }
} }
if ($rabbitmqPush) {
Application_Model_RabbitMq::PushSchedule(); Application_Model_RabbitMq::PushSchedule();
} }
}
public function setRecordedFile($file_id) public function setRecordedFile($file_id)
{ {