diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 1e71510d7..ef2521ad5 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -754,22 +754,17 @@ SQL; public static function GetLastShowInstance($p_timeNow) { - global $CC_CONFIG; - $con = Propel::getConnection(); + $sql = << $p_timeNow ), 'column' ); - $sql = "SELECT si.id" - ." FROM $CC_CONFIG[showInstances] si" - ." WHERE si.ends < TIMESTAMP '$p_timeNow'" - ." AND si.modified_instance = 'f'" - ." ORDER BY si.ends DESC" - ." LIMIT 1"; - - $id = $con->query($sql)->fetchColumn(0); - if ($id) { - return new Application_Model_ShowInstance($id); - } else { - return null; - } + return ($id ? new Application_Model_ShowInstance($id) : null ); } public static function GetCurrentShowInstance($p_timeNow)