Ignore:
Timestamp:
12 Nov 2019, 22:16:57 (5 years ago)
Author:
Henrik Bettermann
Message:

Implement automatic matric number assignment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py

    r15780 r15802  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
     18import grok
    1819from time import time
    1920from zope.component import createObject, getUtility
     
    185186        payment.p_combi = combi
    186187        return None, payment
     188
     189    def constructMatricNumber(self, student):
     190        """Fetch the matric number counter which fits the student and
     191        construct the new matric number of the student.
     192        """
     193        next_integer = grok.getSite()['configuration'].next_matric_integer
     194        if next_integer == 0:
     195            return _('Matriculation number cannot be set.'), None
     196        year = unicode(student.entry_session)[2:]
     197        return None, "%s/%06d" % (year, next_integer)
Note: See TracChangeset for help on using the changeset viewer.