Index: WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 748)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 750)
@@ -88,5 +88,6 @@
         row['s_edit_link'] = "%s/%s" % (student.absolute_url(),se_link)
     row['review_state'] = so.review_state
-    row['display'] = so.review_state in ('opened','closed',) or so.portal_type == "StudentAccommodation"
+    row['display'] = so.review_state in ('opened','closed',) or\
+                     so.portal_type in ("StudentAccommodation","StudentStudyCourse")
     items.append(row)
 info['items'] = items
Index: WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py	(revision 748)
+++ WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py	(revision 750)
@@ -13,5 +13,5 @@
 """
 try:
-    from Products.AdvancedQuery import Eq, Between, Le
+    from Products.AdvancedQuery import Eq, Between, Le,In
     evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery
 except:
@@ -21,5 +21,11 @@
 form = request.form
 fget = form.get
+student_subobjects = ("StudentApplication",
+                      "StudentPersonal",
+                      "StudentStudyCourse",
+                      "StudentAccommodation",
+                      "StudentStudyLevel",)
 info = {}
+items = []
 wf = context.portal_workflow
 catalog = context.portal_catalog
@@ -32,5 +38,4 @@
 is_manager = context.isManager
 validate = request.has_key("cpsdocument_edit_button")
-items = []
 default = {'search_mode': 'name',
         'review_state': 'all',
@@ -59,8 +64,8 @@
 with_review = state != "all"
 onlyreview = with_review and not term
-with_level_results = state.startswith("category") or\
-                     state in ('content_addable',) and\
-                     evalAdvancedQuery is not None
-bools = "with_review = %s<br\> onlyreview = %s<br\> with_level_results = %s" % (with_review,onlyreview,with_level_results)
+##with_level_results = state.startswith("category") or\
+##                     state in ('content_addable',) and\
+##                     evalAdvancedQuery is not None
+bools = "with_review = %s<br\> onlyreview = %s<br\>" % (with_review,onlyreview)
 if not term and not with_review:
     psm = "You must specify a search string when searching 'all states'."
@@ -81,15 +86,9 @@
 st_queries = ('jamb_reg_no','matric_no','name')
 query_step = 0
-if onlyreview and not with_level_results:
+review_query = None
+if onlyreview:
     query_step = 1
-    query =  Eq('portal_type','Student') & Eq('review_state',state) 
-    res = evalAdvancedQuery(query)
-##    res = catalog(portal_type='Student',
-##                  review_state=state)
-elif onlyreview and with_level_results:
-    query_step = 2
-    query =  (Eq('portal_type','StudentStudyLevel') | 
-             Eq('portal_type','StudentStudyCourse')) & Eq('review_state',state) 
-    res = evalAdvancedQuery(query)
+    query =   In('portal_type',student_subobjects) & Eq('review_state',state) 
+    #res = evalAdvancedQuery(query)
 elif what == "student_id":
     if with_review:
@@ -102,12 +101,12 @@
         res = catalog(portal_type='Student',
                       id = term.strip())
-elif what in st_queries and not with_level_results:
+elif what in st_queries:
     if what == "jamb_reg_no":
         query_step = 5
-        pt = 'StudentApplication'
+        pt = ('StudentApplication',)
         st = "%s*" % term.strip().lower()
     elif what == "matric_no":
         query_step = 6
-        pt = 'StudentClearance'
+        pt = ('StudentClearance',)
         st = "%s*" % term.strip().lower()
     elif what == "name":
@@ -115,61 +114,72 @@
         pt = portal_type_query
         st = "%s*" % term.strip()
-    try:
-        res = catalog(portal_type=pt,SearchableText=st)
-    except:
-        return context.students_manager_view(rendered = rend,
-                             psm = 'Search string "%s" not allowed.' % term,
-                             #psm = "%s, %s" % (psm,ds),
-                             students = items,
-                             is_manager = is_manager,
-                             )
-elif what in st_queries and with_level_results and evalAdvancedQuery:
-    if what == "jamb_reg_no":
-        query_step = 8
-        pt = 'StudentApplication'
-        st = "%s*" % term.strip().lower()
-    elif what == "matric_no":
-        query_step = 9
-        pt = 'StudentClearance'
-        st = "%s*" % term.strip().lower()
-    elif what == "name":
-        query_step = 10
-        pt = portal_type_query
-        st = "%s*" % term.strip()
-    query = Eq('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip().lower())\
-                | ((Eq('portal_type','StudentStudyLevel') | 
-                   Eq('portal_type','StudentStudyCourse')) & Eq('review_state',state))
-    try:
-        res = evalAdvancedQuery(query)
-    except:
-        return context.students_manager_view(rendered = rend,
-                             psm = 'Advanced Query failed' % term,
-                             #psm = "%s, %s" % (psm,ds),
-                             students = items,
-                             is_manager = is_manager,
-                             )
+    if with_review:
+        review_query = In('portal_type',student_subobjects) & Eq('review_state',state)
+    query = (In('portal_type',pt) & Eq('SearchableText',st))
+##    try:
+##        res = catalog(portal_type=pt,SearchableText=st)
+##    except:
+##        return context.students_manager_view(rendered = rend,
+##                             psm = 'Search string "%s" not allowed.' % term,
+##                             #psm = "%s, %s" % (psm,ds),
+##                             students = items,
+##                             is_manager = is_manager,
+##                             )
+##elif what in st_queries and with_level_results and evalAdvancedQuery:
+##    if what == "jamb_reg_no":
+##        query_step = 8
+##        pt = 'StudentApplication'
+##        st = "%s*" % term.strip().lower()
+##    elif what == "matric_no":
+##        query_step = 9
+##        pt = 'StudentClearance'
+##        st = "%s*" % term.strip().lower()
+##    elif what == "name":
+##        query_step = 10
+##        pt = portal_type_query
+##        st = "%s*" % term.strip()
+##    query = Eq('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip().lower())\
+##                | ((Eq('portal_type','StudentStudyLevel') | 
+##                   Eq('portal_type','StudentStudyCourse')) & Eq('review_state',state))
+if review_query:
+    res = evalAdvancedQuery(query | review_query)
+else:
+    res = evalAdvancedQuery(query)
+##try:
+##    if review_query:
+##        res = evalAdvancedQuery(query) & evalAdvancedQuery(review_query)
+##    else:
+##        res = evalAdvancedQuery(query)
+##except:
+##    return context.students_manager_view(rendered = rend,
+##                         psm = 'Advanced Query failed' % term,
+##                         #psm = "%s, %s" % (psm,ds),
+##                         students = items,
+##                         is_manager = is_manager,
+##                         )
 students = []
 raw_res = len(res)
+all = []
 if res:
     for r in res:
-        if r.portal_type in ("StudentApplication","StudentPersonal","StudentStudyCourse",):
+        if r.portal_type in ("StudentStudyLevel",):
+            student = r.getObject().aq_parent.aq_parent
+        elif r.portal_type in student_subobjects:
             student = r.getObject().aq_parent
-        elif r.portal_type in ("StudentStudyLevel",):
-            student = r.getObject().aq_parent.aq_parent
-##            pp = '/'.join(r.getPath().split('/')[:-1])
-##            student_cat = catalog(pathindex=pp,portal_type='Student')[0]
-##            student_rs = student_cat.review_state
-##            student = student_cat.getObject()
         else:
             student = r.getObject()
-        student_rs = wf.getInfoFor(student,'review_state','keiner')
-        if (with_review and student_rs != state and not with_level_results) or student in items:
+        if student in all:
+            items.append(student)
             continue
-        items.append(student)
+        all.append(student)
+if onlyreview:
+    items = all
 if items:
     for item in items:
-        students.append(context.getStudentInfo(item))
+        info = context.getStudentInfo(item)
+        students.append(info)
     return context.students_manager_view(rendered = rend,
                              psm = "%d matching Students found QS = %s" % (len(items),query_step),
+                             #psm = "%d found QS = %s items: %s" % (len(items),query_step,items),
                              students = students,
                              is_manager = is_manager,
Index: WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt	(revision 748)
+++ WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt	(revision 750)
@@ -52,16 +52,18 @@
         <table class="contentListing" width="100%">
           <span tal:repeat="rows batches" tal:omit-tag="">
-            <tr tal:repeat="student rows"
-                tal:attributes="class python:test(repeat['student'].even(), 'even ajaxtd', 'odd ajaxtd')">
-              <td><a href="id" tal:attributes="href string:${student/student/absolute_url}"
-                     tal:content="student/id"></a></td>    
-              <td>
-                <span tal:replace="python: student['per_doc'].firstname" />
-                <span tal:replace="python: student['per_doc'].middlename" />
-                <span tal:replace="python: student['per_doc'].lastname" />
-              </td>    
-              <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td>    
-              <td><span tal:replace="student/review_state" /></td>    
-            </tr>
+            <span tal:repeat="student rows">
+              <tr tal:condition="student" 
+                  tal:attributes="class python:test(repeat['student'].even(), 'even ajaxtd', 'odd ajaxtd')">
+                <td><a href="id" tal:attributes="href string:${student/student/absolute_url}"
+                       tal:content="student/id"></a></td>    
+                <td>
+                  <span tal:replace="python: student['per_doc'].firstname" />
+                  <span tal:replace="python: student['per_doc'].middlename" />
+                  <span tal:replace="python: student['per_doc'].lastname" />
+                </td>    
+                <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td>    
+                <td><span tal:replace="student/review_state" /></td>   
+              </tr>
+            </span>
           </span>
         </table>
