Changeset 12514 for main/waeup.uniben/trunk/src/waeup/uniben/browser
- Timestamp:
- 24 Jan 2015, 13:26:53 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/browser/pages.py
r10202 r12514 17 17 ## 18 18 import grok 19 from zope.component import getUtility 20 from zope.catalog.interfaces import ICatalog 19 21 from waeup.kofa.browser.pages import ( 20 22 SessionConfigurationAddFormPage, SessionConfigurationManageFormPage, 21 23 LoginPage, CertificatePage, CertificateManageFormPage) 22 24 from waeup.kofa.university.interfaces import ICertificate 25 from waeup.kofa.interfaces import IUniversity 23 26 from waeup.uniben.interfaces import ( 24 27 ICustomSessionConfiguration, ICustomSessionConfigurationAdd) 28 29 30 class ShowDuplicatePayments(grok.View): 31 """List (in plain text format) payment ids which have been 32 imported several times for different students. 33 """ 34 35 grok.context(IUniversity) 36 grok.name('replicated_payments') 37 grok.require('waeup.managePortal') 38 39 def search_replicated_payments(self): 40 cat = getUtility(ICatalog, name='payments_catalog') 41 all = list(cat.searchResults(p_id=(None, None))) 42 output = '' 43 hitlist = [] 44 for item in all: 45 if not getattr(item,'student', None) or item.p_id in hitlist: 46 continue 47 replicates = cat.searchResults(p_id=(item.p_id, item.p_id)) 48 if len(replicates) > 1: 49 hitlist.append(item.p_id) 50 replicates_line = '' 51 for p in replicates: 52 student = getattr(p,'student', None) 53 if student is not None: 54 replicates_line += '%s (%s),' % ( 55 student.student_id, 56 student.matric_number) 57 output += "%s,%s\n" % (item.p_id, replicates_line) 58 return output 59 60 def render(self): 61 return self.search_replicated_payments() 62 25 63 26 64 class CustomSessionConfigurationAddFormPage(SessionConfigurationAddFormPage):
Note: See TracChangeset for help on using the changeset viewer.