Ignore:
Timestamp:
2 Nov 2016, 14:42:04 (8 years ago)
Author:
Henrik Bettermann
Message:

Customize IUGStudentClearance instead of INigeriaUGStudentClearance. Some IUGStudentClearance fields must be required.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_applicantcopier.py

    r13977 r14250  
    5656        self.browser.getControl(name="form.fst_sit_no").value = '123'
    5757        self.browser.getControl(name="form.fst_sit_type").value = ['ssce']
     58        self.browser.getControl(name="form.fst_sit_date").value = '01/01/2014'
    5859        self.browser.getControl(name="form.scd_sit_fname").value = 'John'
    5960        self.browser.getControl(name="form.scd_sit_no").value = '456'
     
    7273        self.assertEqual(student.fst_sit_no, '123')
    7374        self.assertEqual(student.fst_sit_type, 'ssce')
     75        self.assertEqual(student.fst_sit_date.isoformat(), '2014-01-01')
    7476        self.assertEqual(student.scd_sit_fname, 'John')
    7577        self.assertEqual(student.scd_sit_no, '456')
  • main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py

    r14206 r14250  
    1818
    1919from zope import schema
    20 from zope.interface import Attribute
     20from zope.interface import Attribute, invariant
    2121from zc.sourcefactory.contextual import BasicContextualSourceFactory
    2222from zope.catalog.interfaces import ICatalog
    2323from zope.component import getUtility
     24from waeup.kofa.schoolgrades import ResultEntryField
    2425from waeup.kofa.interfaces import (IKofaObject, academic_sessions_vocab)
    2526from waeup.kofa.students.vocabularies import (
    26     StudyLevelSource, contextual_reg_num_source
     27    StudyLevelSource, contextual_reg_num_source, nats_vocab,
    2728    )
     29from waeup.kofa.students.interfaces import IUGStudentClearance
    2830from waeup.kofa.schema import PhoneNumber, FormattedDate, TextLineChoice
    29 from kofacustom.nigeria.interfaces import LGASource
     31from kofacustom.nigeria.interfaces import (
     32    LGASource, exam_types, high_qual, high_grade)
    3033from kofacustom.nigeria.students.interfaces import (
    3134    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
     
    214217        )
    215218
    216 class ICustomUGStudentClearance(INigeriaUGStudentClearance):
     219class ICustomUGStudentClearance(IUGStudentClearance):
    217220    """Representation of ug student clearance data.
    218221
    219222    """
    220223
    221     #date_of_birth = FormattedDate(
    222     #    title = _(u'Date of Birth'),
    223     #    required = True,
    224     #    show_year = True,
    225     #    )
     224    officer_comment = schema.Text(
     225        title = _(u"Officer's Comment"),
     226        required = False,
     227        )
     228
     229    physical_clearance_date = schema.TextLine(
     230        title = _(u"Physical Clearance Date"),
     231        required = False,
     232        )
     233
     234    clr_code = schema.TextLine(
     235        title = _(u'CLR Activation Code'),
     236        required = False,
     237        readonly = False,
     238        )
     239
     240    date_of_birth = FormattedDate(
     241        title = _(u'Date of Birth'),
     242        required = False,
     243        show_year = True,
     244        )
     245
     246    nationality = schema.Choice(
     247        source = nats_vocab,
     248        title = _(u'Nationality'),
     249        required = True,
     250        )
    226251
    227252    lga = schema.Choice(
     
    231256        )
    232257
     258    def_adm = schema.Bool(
     259        title = _(u'Deferment of Admission'),
     260        required = False,
     261        readonly = False,
     262        default = False,
     263        )
     264
     265    fst_sit_fname = schema.TextLine(
     266        title = _(u'Full Name'),
     267        required = True,
     268        readonly = False,
     269        )
     270    fst_sit_no = schema.TextLine(
     271        title = _(u'Exam Number'),
     272        required = True,
     273        readonly = False,
     274        )
     275
    233276    fst_sit_sc_pin = schema.TextLine(
    234277        title = _(u'Scratch Card Pin'),
    235         required = False,
     278        required = True,
    236279        readonly = False,
    237280        )
     
    239282    fst_sit_sc_serial_number = schema.TextLine(
    240283        title = _(u'Scratch Card Serial Number'),
     284        required = True,
     285        readonly = False,
     286        )
     287
     288    fst_sit_date = FormattedDate(
     289        title = _(u'Exam Date'),
     290        required = True,
     291        readonly = False,
     292        show_year = True,
     293        )
     294
     295    fst_sit_type = schema.Choice(
     296        title = _(u'Exam Type'),
     297        required = True,
     298        readonly = False,
     299        vocabulary = exam_types,
     300        )
     301
     302    fst_sit_results = schema.List(
     303        title = _(u'Exam Results'),
     304        value_type = ResultEntryField(),
     305        required = True,
     306        readonly = False,
     307        defaultFactory=list,
     308        )
     309
     310    scd_sit_fname = schema.TextLine(
     311        title = _(u'Full Name'),
     312        required = False,
     313        readonly = False,
     314        )
     315    scd_sit_no = schema.TextLine(
     316        title = _(u'Exam Number'),
    241317        required = False,
    242318        readonly = False,
     
    255331        )
    256332
    257 ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[
    258     'lga'].order
    259 #ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[
    260 #    'date_of_birth'].order
    261 ICustomUGStudentClearance['fst_sit_sc_pin'].order = INigeriaUGStudentClearance['fst_sit_date'].order
    262 ICustomUGStudentClearance['scd_sit_sc_pin'].order = INigeriaUGStudentClearance['scd_sit_date'].order
    263 ICustomUGStudentClearance['fst_sit_sc_serial_number'].order = INigeriaUGStudentClearance['fst_sit_date'].order
    264 ICustomUGStudentClearance['scd_sit_sc_serial_number'].order = INigeriaUGStudentClearance['scd_sit_date'].order
    265 ICustomUGStudentClearance['scd_sit_date'].order = ICustomUGStudentClearance['scd_sit_type'].order
    266 ICustomUGStudentClearance['fst_sit_date'].order = ICustomUGStudentClearance['fst_sit_type'].order
     333    scd_sit_date = FormattedDate(
     334        title = _(u'Exam Date'),
     335        required = False,
     336        readonly = False,
     337        show_year = True,
     338        )
     339
     340    scd_sit_type = schema.Choice(
     341        title = _(u'Exam Type'),
     342        required = False,
     343        readonly = False,
     344        vocabulary = exam_types,
     345        )
     346
     347    scd_sit_results = schema.List(
     348        title = _(u'Exam Results'),
     349        value_type = ResultEntryField(),
     350        required = False,
     351        readonly = False,
     352        defaultFactory=list,
     353        )
     354
     355
     356    alr_fname = schema.TextLine(
     357        title = _(u'Full Name'),
     358        required = False,
     359        readonly = False,
     360        )
     361    alr_no = schema.TextLine(
     362        title = _(u'Exam Number'),
     363        required = False,
     364        readonly = False,
     365        )
     366
     367    alr_date = FormattedDate(
     368        title = _(u'Exam Date'),
     369        required = False,
     370        readonly = False,
     371        show_year = True,
     372        )
     373
     374    alr_results = schema.List(
     375        title = _(u'Exam Results'),
     376        value_type = ResultEntryField(),
     377        required = False,
     378        readonly = False,
     379        defaultFactory=list,
     380        )
     381
     382    hq_type = schema.Choice(
     383        title = _(u'Qualification Obtained'),
     384        required = False,
     385        readonly = False,
     386        vocabulary = high_qual,
     387        )
     388
     389    hq_fname = schema.TextLine(
     390        title = _(u'Full Name'),
     391        required = False,
     392        readonly = False,
     393        )
     394
     395    hq_matric_no = schema.TextLine(
     396        title = _(u'Former Matric Number'),
     397        required = False,
     398        readonly = False,
     399        )
     400
     401    hq_degree = schema.Choice(
     402        title = _(u'Class of Degree'),
     403        required = False,
     404        readonly = False,
     405        vocabulary = high_grade,
     406        )
     407
     408    hq_school = schema.TextLine(
     409        title = _(u'Institution Attended'),
     410        required = False,
     411        readonly = False,
     412        )
     413
     414    hq_session = schema.TextLine(
     415        title = _(u'Years Attended'),
     416        required = False,
     417        readonly = False,
     418        )
     419
     420    hq_disc = schema.TextLine(
     421        title = _(u'Discipline'),
     422        required = False,
     423        readonly = False,
     424        )
     425
     426    @invariant
     427    def check_lga_nationality(student):
     428        if student.nationality != 'NG' and student.lga not in ('foreigner', None):
     429            raise Invalid(_('Nationalty and LGA are contradictory.'))
     430        if student.nationality == 'NG' and student.lga == 'foreigner':
     431            raise Invalid(_('Nationalty and LGA are contradictory.'))
    267432
    268433
Note: See TracChangeset for help on using the changeset viewer.