Ignore:
Timestamp:
26 Jun 2020, 07:11:51 (4 years ago)
Author:
Henrik Bettermann
Message:

Configure transcript applications.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r16119 r16131  
    129129    'fst_sit_results', 'scd_sit_results')
    130130
     131TRANS_OMIT_FIELDS = ('locked', 'suspended', 'applicant_id',)
     132
     133TRANS_SHORT_OMIT_FIELDS = TRANS_OMIT_FIELDS + (
     134    'date_of_birth',
     135    'sex',
     136    'place_of_birth',
     137    'nationality',
     138    'entry_mode',
     139    'entry_session',
     140    'end_session',
     141    'course_studied',
     142    'course_changed',
     143    'change_level',
     144    )
     145
    131146class CustomApplicantsContainerPage(ApplicantsContainerPage):
    132147    """The standard view for regular applicant containers.
     
    209224    @property
    210225    def form_fields(self):
    211         if self.target is not None and self.target == 'trans':
    212             form_fields = grok.AutoFields(ITranscriptApplicant).omit(
    213                 'locked', 'suspended')
     226        if self.target is not None and self.target == 'transfull':
     227            form_fields = grok.AutoFields(ITranscriptApplicant)
     228            for field in TRANS_OMIT_FIELDS:
     229                form_fields = form_fields.omit(field)
     230            form_fields['dispatch_address'].custom_widget = BytesDisplayWidget
     231            form_fields['perm_address'].custom_widget = BytesDisplayWidget
     232            return form_fields
     233        if self.target is not None and self.target == 'transshort':
     234            form_fields = grok.AutoFields(ITranscriptApplicant)
     235            for field in TRANS_SHORT_OMIT_FIELDS:
     236                form_fields = form_fields.omit(field)
    214237            form_fields['dispatch_address'].custom_widget = BytesDisplayWidget
    215238            form_fields['perm_address'].custom_widget = BytesDisplayWidget
     
    380403    @property
    381404    def form_fields(self):
    382         if self.target is not None and self.target == 'trans':
     405        if self.target is not None and self.target == 'transfull':
    383406            form_fields = grok.AutoFields(ITranscriptApplicant)
    384             form_fields['applicant_id'].for_display = True
     407            for field in TRANS_OMIT_FIELDS:
     408                form_fields = form_fields.omit(field)
     409            return form_fields
     410        if self.target is not None and self.target == 'transshort':
     411            form_fields = grok.AutoFields(ITranscriptApplicant)
     412            for field in TRANS_SHORT_OMIT_FIELDS:
     413                form_fields = form_fields.omit(field)
    385414            return form_fields
    386415        if self.target == 'ictwk':
     
    444473    @property
    445474    def form_fields(self):
    446         if self.target is not None and self.target == 'trans':
    447             form_fields = grok.AutoFields(ITranscriptApplicant).omit(
    448                 'locked', 'suspended')
    449             form_fields['applicant_id'].for_display = True
    450             form_fields['reg_number'].for_display = True
    451             form_fields['place_of_birth'].field.required = True
    452             form_fields['date_of_birth'].field.required = True
    453             form_fields['nationality'].field.required = True
    454             form_fields['email'].field.required = True
    455             form_fields['phone'].field.required = True
    456             form_fields['perm_address'].field.required = True
    457             form_fields['dispatch_address'].field.required = True
    458             form_fields['entry_mode'].field.required = True
    459             form_fields['entry_session'].field.required = True
    460             form_fields['end_session'].field.required = True
    461             form_fields['course_studied'].field.required = True
     475        if self.target is not None and self.target == 'transfull':
     476            form_fields = grok.AutoFields(ITranscriptApplicant)
     477            for field in TRANS_OMIT_FIELDS:
     478                form_fields = form_fields.omit(field)
     479            return form_fields
     480        if self.target is not None and self.target == 'transshort':
     481            form_fields = grok.AutoFields(ITranscriptApplicant)
     482            for field in TRANS_SHORT_OMIT_FIELDS:
     483                form_fields = form_fields.omit(field)
    462484            return form_fields
    463485        if self.target == 'ictwk':
     
    701723    websites = (('Uniben Alumni Portal', 'https://uniben-alumni.waeup.org/'),
    702724                ('Uniben Student Portal', 'https://uniben.waeup.org/'),)
    703     appl_url1 = 'https://uniben-alumni.waeup.org/documents/transcript/display'
    704     appl_url2 = 'https://uniben-alumni.waeup.org/documents/transcript/display'
     725    appl_url1 = 'https://uniben-alumni.waeup.org/applicants/transfull1/register'
     726    appl_url2 = 'https://uniben-alumni.waeup.org/applicants/transshort1/register'
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r16078 r16131  
    3535from waeup.kofa.interfaces import (
    3636    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
    37     IKofaObject)
     37    IKofaObject, ContextualDictSourceFactoryBase)
    3838from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
    3939from waeup.kofa.students.vocabularies import (
     
    7979            REGISTRATION_CATS[value][1])
    8080
     81DESTINATION_COST = {
     82    'none': ('To the moon', 1000000000.0, 1),
     83    #'nigeria': ('Nigeria', 2000.0, 1),
     84    #'africa': ('Africa ', 3000.0, 2),
     85    #'eurasia': ('Europe/Asia ', 3000.0, 3),
     86    }
     87
     88class DestinationCostSource(BasicSourceFactory):
     89    """A source that delivers continents and shipment costs.
     90    """
     91    def getValues(self):
     92        sorted_items = sorted(DESTINATION_COST.items(),
     93                              key=lambda element: element[1][2])
     94        return [item[0] for item in sorted_items]
     95
     96    def getTitle(self, value):
     97        return u"%s (₦ %s)" % (
     98            DESTINATION_COST[value][0],
     99            DESTINATION_COST[value][1])
     100
    81101class IUnibenRegistration(IKofaObject):
    82102    """A Uniben registrant.
     
    204224
    205225    applicant_id = schema.TextLine(
    206         title = _(u'Application Id'),
    207         required = False,
    208         readonly = False,
    209         )
    210 
    211     reg_number = TextLineChoice(
    212         title = _(u'Kofa Registration Number'),
    213         readonly = False,
    214         required = True,
    215         source = contextual_reg_num_source,
     226        title = _(u'Transcript Application Id'),
     227        required = False,
     228        readonly = False,
     229        )
     230
     231    student_id = schema.TextLine(
     232        title = _(u'Kofa Student Id'),
     233        required = False,
     234        readonly = False,
     235        )
     236
     237    #reg_number = schema.TextLine(
     238    #    title = _(u'Registration Number'),
     239    #    readonly = False,
     240    #    required = False,
     241    #    )
     242
     243    matric_number = schema.TextLine(
     244        title = _(u'Matriculation Number'),
     245        readonly = False,
     246        required = True,
    216247        )
    217248
     
    228259    lastname = schema.TextLine(
    229260        title = _(u'Last Name (Surname)'),
    230         required = True,
    231         )
    232 
    233     matric_number = schema.TextLine(
    234         title = _(u'Matriculation Number'),
    235         readonly = False,
    236261        required = True,
    237262        )
     
    282307    dispatch_address = schema.Text(
    283308        title = _(u'Dispatch Addresses'),
    284         description = u'Addresses to which transcript should be posted.',
    285         required = False,
    286         readonly = False,
     309        description = u'Addresses to which transcripts should be posted. '
     310                       'Addresses must involve same courier charges.',
     311        required = False,
     312        readonly = False,
     313        )
     314
     315    charge = schema.Choice(
     316        title = _(u'Courier Charge'),
     317        source = DestinationCostSource(),
     318        required = True,
    287319        )
    288320
     
    313345        required = False,
    314346        readonly = False,
    315         )
    316 
    317     purpose = schema.TextLine(
    318         title = _(u'Purpose of this Application'),
    319         readonly = False,
    320         required = False,
    321347        )
    322348
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py

    r16078 r16131  
    2424from waeup.kofa.applicants.workflow import (INITIALIZED,
    2525    STARTED, PAID, ADMITTED, NOT_ADMITTED, SUBMITTED, CREATED)
    26 from waeup.uniben.applicants.interfaces import REGISTRATION_CATS
     26from waeup.uniben.applicants.interfaces import REGISTRATION_CATS, DESTINATION_COST
    2727from waeup.uniben.interfaces import MessageFactory as _
    2828
     
    6060                 '(2nd supplementary advert)', 'ASE'],
    6161        'spft': ['Special Full-Time Programmes', 'SP'],
    62         'trans': ['Transcript Application', 'TR'],
     62        'transfull': ['Transcript Application (without student record)', 'TRF'],
     63        'transshort': ['Transcript Application (with student record)', 'TRS'],
    6364        }
    6465
     
    122123            for cat in applicant.registration_cats:
    123124                payment.amount_auth += REGISTRATION_CATS[cat][1]
     125        elif applicant.container_code.startswith('trans'):
     126            cost = DESTINATION_COST[applicant.charge][1]
     127            payment.amount_auth = applicant.no_copies * cost
     128            payment.p_category = 'transcript'
    124129        else:
    125130            payment.p_category = 'application'
  • main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py

    r16025 r16131  
    5757        'special_ft': 'Special Full-Time',
    5858        'cdl': 'Center For Distance Learning',
     59        }
     60
     61    DESTINATION_COST_DICT = {
     62        'nigeria_2000': 'Nigeria (N2000)',
     63        'africa_2000': 'Africa (N3000)',
    5964        }
    6065
Note: See TracChangeset for help on using the changeset viewer.