CC-2336: Some Show Editing Features Seem to have been lost

-fixed shows in the past being edited!
This commit is contained in:
martin 2011-06-02 15:56:54 -04:00
parent 413c752b22
commit 308efaeadc
1 changed files with 13 additions and 10 deletions

View File

@ -887,6 +887,9 @@ class Show {
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
$date = new DateHelper();
$currentTimestamp = $date->getTimestamp();
$show = new Show($show_id);
if ($show->hasInstance()){
$ccShowInstance = $show->getInstance();
@ -896,8 +899,8 @@ class Show {
$ccShowInstance = new CcShowInstances();
$newInstance = true;
}
if ($start > $currentTimestamp){
if ($newInstance || $ccShowInstance->getDbStarts() > $currentTimestamp){
$ccShowInstance->setDbShowId($show_id);
$ccShowInstance->setDbStarts($start);
$ccShowInstance->setDbEnds($end);
@ -912,9 +915,6 @@ class Show {
$showInstance->correctScheduleStartTimes();
}
$date = new DateHelper();
$currentTimestamp = $date->getTimestamp();
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id={$show_id}";
$rebroadcasts = $CC_DBC->GetAll($sql);
@ -960,6 +960,9 @@ class Show {
$rebroadcasts = $CC_DBC->GetAll($sql);
$show = new Show($show_id);
$date = new DateHelper();
$currentTimestamp = $date->getTimestamp();
while(strtotime($next_date) <= strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) {
$start = $next_date;
@ -967,9 +970,6 @@ class Show {
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
$date = new DateHelper();
$currentTimestamp = $date->getTimestamp();
if ($show->hasInstanceOnDate($start)){
$ccShowInstance = $show->getInstanceOnDate($start);
$newInstance = false;
@ -977,8 +977,11 @@ class Show {
$ccShowInstance = new CcShowInstances();
$newInstance = true;
}
if ($start > $currentTimestamp){
/* When editing the start/end time of a repeating show, we don't want to
* change shows that started in the past. So check the start time.
*/
if ($newInstance || $ccShowInstance->getDbStarts() > $currentTimestamp){
$ccShowInstance->setDbShowId($show_id);
$ccShowInstance->setDbStarts($start);
$ccShowInstance->setDbEnds($end);