Changeset 9574 for main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
- Timestamp:
- 8 Nov 2012, 13:25:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r9427 r9574 19 19 """ 20 20 import grok 21 from datetime import datetime 21 22 from zope.catalog.interfaces import ICatalog 22 23 from zope.component import queryUtility … … 320 321 def export_student(self, student, filepath=None): 321 322 return self.export(get_bedtickets([student]), filepath) 323 324 class StudentPaymentsOverviewExporter(StudentsExporter): 325 """Exporter for students with payment overview. 326 """ 327 grok.name('paymentsoverview') 328 329 curr_year = datetime.now().year 330 year_range = range(curr_year - 9, curr_year + 1) 331 year_range_tuple = tuple([str(year) for year in year_range]) 332 333 #: Fieldnames considered by this exporter 334 fields = ('student_id', ) + ( 335 'state', 'certcode', 'faccode', 'depcode', 'is_postgrad', 336 'current_level', 'current_session', 337 ) + year_range_tuple 338 339 #: The title under which this exporter will be displayed 340 title = _(u'Student Payments Overview') 341 342 def mangle_value(self, value, name, context=None): 343 if name in self.year_range_tuple and context is not None: 344 value = '' 345 for ticket in context['payments'].values(): 346 if ticket.p_state == 'paid' and \ 347 ticket.p_category == 'schoolfee' and \ 348 ticket.p_session == int(name): 349 value = ticket.amount_auth 350 break 351 return super( 352 StudentsExporter, self).mangle_value( 353 value, name, context=context)
Note: See TracChangeset for help on using the changeset viewer.