CC-2336 Some Show Editing Features Seem to have been lost
This commit is contained in:
parent
1bca5208e7
commit
f5e6082ee7
|
@ -18,6 +18,15 @@ class DateHelper
|
||||||
return date("Y-m-d H:i:s", $this->_timestamp);
|
return date("Y-m-d H:i:s", $this->_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get date of object construction in the format
|
||||||
|
* YY:mm:dd
|
||||||
|
*/
|
||||||
|
function getDate()
|
||||||
|
{
|
||||||
|
return date("Y-m-d", $this->_timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get time of object construction in the format
|
* Get time of object construction in the format
|
||||||
* HH:mm:ss
|
* HH:mm:ss
|
||||||
|
|
|
@ -318,14 +318,19 @@ class Show {
|
||||||
* certain date.
|
* certain date.
|
||||||
*
|
*
|
||||||
* @param string $p_date
|
* @param string $p_date
|
||||||
* The date which to delete after
|
* The date which to delete after, if null deletes from the current timestamp.
|
||||||
*/
|
*/
|
||||||
public function removeAllInstancesFromDate($p_date){
|
public function removeAllInstancesFromDate($p_date=null){
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
$date = new DateHelper;
|
$date = new DateHelper;
|
||||||
$timestamp = $date->getTimestamp();
|
$timestamp = $date->getTimestamp();
|
||||||
|
|
||||||
|
if(is_null($p_date)) {
|
||||||
|
$date = new DateHelper;
|
||||||
|
$p_date = $date->getDate();
|
||||||
|
}
|
||||||
|
|
||||||
$showId = $this->getId();
|
$showId = $this->getId();
|
||||||
$sql = "DELETE FROM cc_show_instances "
|
$sql = "DELETE FROM cc_show_instances "
|
||||||
." WHERE date(starts) >= DATE '$p_date'"
|
." WHERE date(starts) >= DATE '$p_date'"
|
||||||
|
@ -333,6 +338,13 @@ class Show {
|
||||||
." AND show_id = $showId";
|
." AND show_id = $showId";
|
||||||
|
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
|
|
||||||
|
/*
|
||||||
|
CcShowInstancesQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbStartTime($p_date, Criteria::GREATER_EQUAL)
|
||||||
|
->delete();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -546,10 +558,13 @@ class Show {
|
||||||
|
|
||||||
public static function deletePossiblyInvalidInstances($p_data, $p_show, $p_endDate, $isRecorded, $repeatType)
|
public static function deletePossiblyInvalidInstances($p_data, $p_show, $p_endDate, $isRecorded, $repeatType)
|
||||||
{
|
{
|
||||||
if (($p_data['add_show_repeats'] != $p_show->isRepeating()) || $isRecorded){
|
if (($p_data['add_show_repeats'] != $p_show->isRepeating()) || ($isRecorded && !$p_data['add_show_repeats'])){
|
||||||
//repeat option was toggled or show is recorded.
|
//repeat option was toggled.
|
||||||
$p_show->deleteAllInstances();
|
$p_show->deleteAllInstances();
|
||||||
}
|
}
|
||||||
|
if($isRecorded && $p_data['add_show_repeats']) {
|
||||||
|
$p_show->removeAllInstancesFromDate();
|
||||||
|
}
|
||||||
|
|
||||||
if ($p_data['add_show_duration'] != $p_show->getDuration()){
|
if ($p_data['add_show_duration'] != $p_show->getDuration()){
|
||||||
//duration has changed
|
//duration has changed
|
||||||
|
@ -741,11 +756,11 @@ class Show {
|
||||||
if (($data['add_show_id'] != -1) && $data['add_show_rebroadcast']){
|
if (($data['add_show_id'] != -1) && $data['add_show_rebroadcast']){
|
||||||
CcShowRebroadcastQuery::create()
|
CcShowRebroadcastQuery::create()
|
||||||
->filterByDbShowId($data['add_show_id'])
|
->filterByDbShowId($data['add_show_id'])
|
||||||
->filterByDbStartTime($currentTimestamp, Criteria::GREATER_EQUAL)
|
//->filterByDbStartTime($currentTimestamp, Criteria::GREATER_EQUAL)
|
||||||
->delete();
|
->delete();
|
||||||
}
|
}
|
||||||
//adding rows to cc_show_rebroadcast
|
//adding rows to cc_show_rebroadcast
|
||||||
if (($isRecorded && $data['add_show_rebroadcast']) && $repeatType != -1) {
|
if (($isRecorded && $data['add_show_rebroadcast']) && ($repeatType != -1)) {
|
||||||
for ($i=1; $i<=10; $i++) {
|
for ($i=1; $i<=10; $i++) {
|
||||||
if ($data['add_show_rebroadcast_date_'.$i]) {
|
if ($data['add_show_rebroadcast_date_'.$i]) {
|
||||||
$showRebroad = new CcShowRebroadcast();
|
$showRebroad = new CcShowRebroadcast();
|
||||||
|
@ -864,13 +879,11 @@ class Show {
|
||||||
private static function populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $record, $end_timestamp)
|
private static function populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $record, $end_timestamp)
|
||||||
{
|
{
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
$next_date = $first_show." ".$start_time;
|
$next_date = $first_show." ".$start_time;
|
||||||
|
|
||||||
if (strtotime($next_date) < strtotime($end_timestamp)) {
|
if (strtotime($next_date) < strtotime($end_timestamp)) {
|
||||||
|
|
||||||
$start = $next_date;
|
$start = $next_date;
|
||||||
|
|
||||||
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
|
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
|
||||||
$end = $CC_DBC->GetOne($sql);
|
$end = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
@ -878,7 +891,8 @@ class Show {
|
||||||
if ($show->hasInstance()){
|
if ($show->hasInstance()){
|
||||||
$ccShowInstance = $show->getInstance();
|
$ccShowInstance = $show->getInstance();
|
||||||
$newInstance = false;
|
$newInstance = false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ccShowInstance = new CcShowInstances();
|
$ccShowInstance = new CcShowInstances();
|
||||||
$newInstance = true;
|
$newInstance = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue