Ignore:
Timestamp:
1 May 2015, 05:45:41 (10 years ago)
Author:
Henrik Bettermann
Message:

Add StudentsUtils.increaseMatricInteger method which allows to use various
matric number counters when computing the matric number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r12448 r12896  
    516516        return None, payment
    517517
     518    def increaseMatricInteger(self, student):
     519        """Increase counter for matric numbers.
     520
     521        This counter can be a centrally stored attribute or an attribute of
     522        faculties, departments or certificates. In the base package the counter
     523        is as an attribute of the site configuration object.
     524        """
     525        grok.getSite()['configuration'].next_matric_integer += 1
     526        return
     527
    518528    def constructMatricNumber(self, student):
     529        """Fetch the matric number counter which fits the student and
     530        construct the new matric number of the student.
     531
     532        In the base package the counter value is returned.
     533        """
    519534        next_integer = grok.getSite()['configuration'].next_matric_integer
    520535        if next_integer == 0:
     
    526541
    527542        If the student's matric number is unset a new matric number is
    528         constructed using the next_matric_integer attribute of
    529         the site configuration container and according to the
    530         matriculation number construction rules defined in the
    531         constructMatricNumber method. The new matric number is set,
    532         the students catalog updated and next_matric_integer
    533         increased by one.
     543        constructed according to the matriculation number construction rules
     544        defined in the constructMatricNumber method. The new matric number is
     545        set, the students catalog updated. The corresponding matric number
     546        counter is increased by one.
    534547
    535548        This method is tested but not used in the base package. It can
    536549        be used in custom packages by adding respective views
    537         and by customizing constructMatricNumber according to the
    538         university's matriculation number construction rules.
    539 
    540         The method can be disabled by setting next_matric_integer to zero.
     550        and by customizing increaseMatricInteger and constructMatricNumber
     551        according to the university's matriculation number construction rules.
     552
     553        The method can be disabled by setting the counter to zero.
    541554        """
    542555        if student.matric_number is not None:
     
    552565            return _('Matriculation number exists.'), None
    553566        notify(grok.ObjectModifiedEvent(student))
    554         grok.getSite()['configuration'].next_matric_integer += 1
     567        self.increaseMatricInteger(student)
    555568        return None, matric_number
    556569
Note: See TracChangeset for help on using the changeset viewer.