From 6f95213e45844181c908ccf562ccd8042a767b90 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Thu, 19 Oct 2006 16:36:56 +0000
Subject: [PATCH] Fix to show courses with null current generation

---
 application/models/tables/CourseCrosslistings.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/application/models/tables/CourseCrosslistings.php b/application/models/tables/CourseCrosslistings.php
index 0df18fb4..d59af381 100644
--- a/application/models/tables/CourseCrosslistings.php
+++ b/application/models/tables/CourseCrosslistings.php
@@ -37,11 +37,13 @@ class CourseCrosslistings extends Local_Db_CourseTableMany
         $select->join('creq_course_crosslistings',
                       'creq_course_codes.id = creq_course_crosslistings.course_code',
                       'id');
-        $select->join('creq_courses',
-                      'creq_course_crosslistings.generation = creq_courses.current_generation');
+        $select->join('creq_course_generations',
+                      'creq_course_crosslistings.generation = creq_course_generations.id');
+        $select->where('creq_course_generations.type = "official"');
         $select->where($db->quoteInto('subject = ?', $subject));
         $select->where($db->quoteInto('course_number = ?', $number));
         $select->where($db->quoteInto('course_letter = ?', $letter));
+        $select->order('created DESC');
 
         $row = $db->fetchRow($select);
         $result = $me->find($row['id']);
-- 
GitLab