public static function GetLastIssue(Publication $publication, $p_langId = null, $p_isPublished = true)
{
global $g_ado_db;
if (!$publication->exists()) {
return null;
}
if (empty($p_langId)) {
$p_langId = $publication->getDefaultLanguageId();
}
$sql = 'SELECT MAX(Number) AS Number FROM Issues ' . 'WHERE IdPublication = ' . (int) $publication->getPublicationId() . ' AND IdLanguage = ' . (int) $p_langId;
if ($p_isPublished == true) {
$sql .= " AND Published = 'Y'";
}
$issueNo = $g_ado_db->GetOne($sql);
if (empty($issueNo)) {
return null;
}
return array($issueNo, $p_langId);
}