CC-5090: Unscheduled tracks are still marked at Scheduled in linked show

This commit is contained in:
denise 2013-05-14 10:58:06 -04:00
parent bfd525395a
commit c173744929
4 changed files with 48 additions and 8 deletions

View file

@ -20,7 +20,7 @@ SQL;
return (is_numeric($count) && ($count != '0'));
}
public static function getAllFutureScheduledFiles()
public static function getAllFutureScheduledFiles($instanceId=null)
{
$sql = <<<SQL
SELECT distinct(file_id)
@ -29,6 +29,24 @@ WHERE ends > now() AT TIME ZONE 'UTC'
AND file_id is not null
SQL;
/* If an instance id gets passed into this function we need to check
* if it is a repeating show. If it is a repeating show, we need to
* check for any files scheduled in the future in the linked instances
* as well
*/
if (!is_null($instanceId)) {
$excludeIds = array();
$ccShow = CcShowInstancesQuery::create()
->findPk($instanceId)
->getCcShow();
if ($ccShow->isLinked()) {
foreach ($ccShow->getOtherInstances($instanceId) as $instance) {
$excludeIds[] = $instance->getDbId();
}
$sql .= " AND instance_id IN (".implode(",", $excludeIds).")";
}
}
$files = Application_Common_Database::prepareAndExecute( $sql, array());
$real_files = array();