Ignore:
Timestamp:
6 May 2015, 10:13:38 (10 years ago)
Author:
Henrik Bettermann
Message:

Implement automatic matric_number assignment. Students can induce the
assignment if they have paid school fees by clicking the
'Get Matriculation Number' button. Numbering is per department and session.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/viewlets.py

    r11931 r12907  
    1818
    1919import grok
     20from zope.component import getUtility
    2021from waeup.kofa.students.viewlets import (
    2122    AddPreviousPaymentActionButton, AddBalancePaymentActionButton,
    2223    ManageActionButton)
    23 from waeup.kofa.students.interfaces import IStudent
     24from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
    2425from waeup.kofa.students.browser import StudentBaseDisplayFormPage
    2526from waeup.kofa.students.workflow import (
     
    8687            return ''
    8788        return self.view.url(self.view.context, self.target)
     89
     90
     91class GetMatricNumberActionButton(ManageActionButton):
     92    grok.order(10)
     93    grok.context(IStudent)
     94    grok.view(StudentBaseDisplayFormPage)
     95    grok.require('waeup.viewStudent')
     96    icon = 'actionicon_count.png'
     97    text = _('Get Matriculation Number')
     98
     99    @property
     100    def target_url(self):
     101        students_utils = getUtility(IStudentsUtils)
     102        if self.context.matric_number:
     103            return ''
     104        error, matric_number = students_utils.constructMatricNumber(
     105            self.context)
     106        if error:
     107            return ''
     108        return self.view.url(self.view.context, 'get_matric_number')
Note: See TracChangeset for help on using the changeset viewer.