- Timestamp:
- 24 Nov 2026, 11:38:03 (less than one hour ago)
- Location:
- main/kofacustom.unidel/trunk/src/kofacustom/unidel
- Files:
-
- 5 edited
-
browser/pages.py (modified) (1 diff)
-
students/browser.py (modified) (1 diff)
-
students/tests/test_utils.py (modified) (2 diffs)
-
students/utils.py (modified) (1 diff)
-
students/viewlets.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/browser/pages.py
r18305 r18366 20 20 SessionConfigurationAddFormPage, SessionConfigurationManageFormPage, 21 21 LoginPage, CertificatePage, CertificateManageFormPage, 22 DatacenterImportStep2) 22 DatacenterImportStep2, ConfigurationContainerManageFormPage) 23 from waeup.kofa.interfaces import IConfigurationContainer 23 24 from waeup.kofa.university.interfaces import ICertificate 24 25 from kofacustom.unidel.interfaces import ( 25 26 ICustomSessionConfiguration, ICustomSessionConfigurationAdd) 27 28 class CustomConfigurationContainerManageFormPage( 29 ConfigurationContainerManageFormPage): 30 31 form_fields = grok.AutoFields(IConfigurationContainer).omit( 32 'next_matric_integer_2', 33 'next_matric_integer_3', 34 'next_matric_integer_4', 35 ) 36 form_fields['maintmode_enabled_by'].for_display = True 26 37 27 38 class CustomSessionConfigurationAddFormPage(SessionConfigurationAddFormPage): -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py
r18358 r18366 949 949 super(CustomAddStudyLevelFormPage, self).update() 950 950 return 951 952 class StudentGetMatricNumberPage(UtilityView, grok.View): 953 """ Construct and set the matriculation number. 954 """ 955 grok.context(ICustomStudent) 956 grok.name('get_matric_number') 957 grok.require('waeup.viewStudent') 958 959 def update(self): 960 students_utils = getUtility(IStudentsUtils) 961 msg, mnumber = students_utils.setMatricNumber(self.context) 962 if msg: 963 self.flash(msg, type="danger") 964 else: 965 self.flash(_('Matriculation number %s assigned.' % mnumber)) 966 self.context.writeLogMessage(self, '%s assigned' % mnumber) 967 self.redirect(self.url(self.context)) 968 return 969 970 def render(self): 971 return -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_utils.py
r18237 r18366 2 2 import grok 3 3 from waeup.kofa.testing import FunctionalTestCase 4 from zope.component import getUtility 4 5 from hurry.workflow.interfaces import IWorkflowState 5 6 from zope.component import getUtility, createObject … … 36 37 self.assertEqual(warning, None) 37 38 return 39 40 def test_setMatricNumber(self): 41 site = grok.getSite() 42 utils = getUtility(IStudentsUtils) 43 site['configuration'].next_matric_integer = 12345 44 self.student.matric_number = None 45 msg, mnumber = utils.setMatricNumber(self.student) 46 self.assertEqual(msg, 'Matriculation number cannot be set.') 47 IWorkflowState(self.student).setState('school fee paid') 48 msg, mnumber = utils.setMatricNumber(self.student) 49 self.assertEqual(self.student.matric_number, 'fac10412345') 50 return -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/utils.py
r18341 r18366 523 523 # return 5, self.GPABoundaries()[5][1] 524 524 # return 525 526 def constructMatricNumber(self, student): 527 faccode = student.faccode 528 #depcode = student.depcode 529 #certcode = student.certcode 530 if not student.state in (PAID, ) or not student.is_fresh: 531 return _('Matriculation number cannot be set.'), None 532 year = unicode(student.entry_session)[2:] 533 next_integer = grok.getSite()['configuration'].next_matric_integer 534 if next_integer == 0: 535 return _('Matriculation number cannot be set.'), None 536 return None, "%s%s%05d" % (faccode, year, next_integer) -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/viewlets.py
r18328 r18366 18 18 19 19 import grok 20 from zope.component import getUtility 20 21 from waeup.kofa.interfaces import REQUESTED 21 22 from waeup.kofa.browser.viewlets import ManageActionButton 22 23 from kofacustom.unidel.students.interfaces import (ICustomStudent, 23 24 ICustomStudentStudyCourse, ICustomStudentStudyLevel) 25 from waeup.kofa.students.interfaces import IStudentsUtils 24 26 from waeup.kofa.students.fileviewlets import ( 25 27 StudentFileDisplay, StudentFileUpload, StudentImage) … … 31 33 32 34 from kofacustom.nigeria.interfaces import MessageFactory as _ 35 36 37 class GetMatricNumberActionButton(ManageActionButton): 38 grok.order(11) 39 grok.context(ICustomStudent) 40 grok.view(StudentBaseDisplayFormPage) 41 grok.require('waeup.viewStudent') 42 #grok.require('waeup.manageStudent') 43 icon = 'actionicon_count.png' 44 text = _('Get Matriculation Number') 45 46 @property 47 def target_url(self): 48 students_utils = getUtility(IStudentsUtils) 49 if self.context.matric_number: 50 return '' 51 error, matric_number = students_utils.constructMatricNumber( 52 self.context) 53 if error: 54 return '' 55 return self.view.url(self.view.context, 'get_matric_number') 33 56 34 57 class ExamClearanceSlipActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.
