Ignore:
Timestamp:
8 Jan 2024, 17:02:40 (9 months ago)
Author:
Henrik Bettermann
Message:

Further customizations for the CDL portal.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada
Files:
4 edited

Legend:

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

    r17436 r17661  
    297297        )
    298298
     299    # CDL Portal Fess only
     300
     301    medical_fee = schema.Float(
     302        title = _(u'Medical Services Fee (CDL only)'),
     303        default = 0.0,
     304        required = False,
     305        )
     306
     307
     308    library_fee = schema.Float(
     309        title = _(u'Library Fee (CDL only)'),
     310        default = 0.0,
     311        required = False,
     312        )
     313
     314    ict_fee = schema.Float(
     315        title = _(u'ICT Fee (CDL only)'),
     316        default = 0.0,
     317        required = False,
     318        )
     319
     320    orientation_fee = schema.Float(
     321        title = _(u'Orientation Fee (CDL only'),
     322        default = 0.0,
     323        required = False,
     324        )
     325
     326    examination_fee = schema.Float(
     327        title = _(u'Examination Fee (CDL only)'),
     328        default = 0.0,
     329        required = False,
     330        )
     331
     332    course_fee = schema.Float(
     333        title = _(u'Course Fee (CDL only)'),
     334        default = 0.0,
     335        required = False,
     336        )
     337
     338
    299339    def getSessionString():
    300340        """Returns the session string from the vocabulary.
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py

    r16583 r17661  
    3131    """
    3232
    33     # prefix
    34     STUDENT_ID_PREFIX = u'I'
     33    @property
     34    def STUDENT_ID_PREFIX(self):
     35        if grok.getSite().__name__ == 'iuokada-cdl':
     36            return u'F'
     37        return u'I'
     38
    3539
    3640    SKIP_UPLOAD_VIEWLETS = (
     
    125129        student for the payment category specified.
    126130        """
     131        if grok.getSite().__name__ == 'iuokada-cdl':
     132            return self.setCDLPaymentDetails(category, student,
     133                previous_session, previous_level, combi)
    127134        p_item = u''
    128135        amount = 0.0
     
    282289        return None, payment
    283290
     291    def setCDLPaymentDetails(self, category, student,
     292            previous_session=None, previous_level=None, combi=[]):
     293        """Create a payment ticket and set the payment data of a
     294        student for the payment category specified.
     295        """
     296        p_item = u''
     297        amount = 0.0
     298        if previous_session:
     299            if previous_session < student['studycourse'].entry_session:
     300                return _('The previous session must not fall below '
     301                         'your entry session.'), None
     302            if category == 'schoolfee':
     303                # School fee is always paid for the following session
     304                if previous_session > student['studycourse'].current_session:
     305                    return _('This is not a previous session.'), None
     306            else:
     307                if previous_session > student['studycourse'].current_session - 1:
     308                    return _('This is not a previous session.'), None
     309            p_session = previous_session
     310            p_level = previous_level
     311            p_current = False
     312        else:
     313            p_session = student['studycourse'].current_session
     314            p_level = student['studycourse'].current_level
     315            p_current = True
     316            if category in self.REQUIRED_PAYMENTS_FRESH.keys() \
     317                + self.REQUIRED_PAYMENTS_RETURNING.keys() \
     318                + ['schoolfee','schoolfee40','secondinstal'] \
     319                and student.state == RETURNING:
     320                # In case of school fee or required sundry fee payments the
     321                # payment session is always next session if students are in
     322                # state returning.
     323                p_session, p_level = self.getReturningData(student)
     324        academic_session = self._getSessionConfiguration(p_session)
     325        if academic_session == None:
     326            return _(u'Session configuration object is not available.'), None
     327        # Determine fee.
     328        if category in ('schoolfee', 'schoolfee40', 'secondinstal'):
     329            rpm = self._requiredPaymentsMissing(student, p_session)
     330            if rpm:
     331                return rpm, None
     332            try:
     333                certificate = student['studycourse'].certificate
     334                p_item = certificate.code
     335            except (AttributeError, TypeError):
     336                return _('Study course data are incomplete.'), None
     337            if previous_session:
     338                # Students can pay for previous sessions in all
     339                # workflow states.  Fresh students are excluded by the
     340                # update method of the PreviousPaymentAddFormPage.
     341                if previous_level == 100:
     342                    amount = getattr(certificate, 'school_fee_1', 0.0)
     343                else:
     344                    amount = getattr(certificate, 'school_fee_2', 0.0)
     345                if category == 'schoolfee40':
     346                    amount = 0.4*amount
     347                elif category == 'secondinstal':
     348                    amount = 0.6*amount
     349            else:
     350                if category == 'secondinstal':
     351                    if student.is_fresh:
     352                        amount = 0.6 * getattr(certificate, 'school_fee_1', 0.0)
     353                    else:
     354                        amount = 0.6 * getattr(certificate, 'school_fee_2', 0.0)
     355                else:
     356                    if student.state in (CLEARANCE, REQUESTED, CLEARED):
     357                        amount = getattr(certificate, 'school_fee_1', 0.0)
     358                    elif student.state == RETURNING:
     359                        amount = getattr(certificate, 'school_fee_2', 0.0)
     360                    elif student.is_postgrad and student.state == PAID:
     361                        # Returning postgraduate students also pay for the
     362                        # next session but their level always remains the
     363                        # same.
     364                        p_session += 1
     365                        academic_session = self._getSessionConfiguration(p_session)
     366                        if academic_session == None:
     367                            return _(
     368                                u'Session configuration object is not available.'
     369                                ), None
     370                        amount = getattr(certificate, 'school_fee_2', 0.0)
     371                    if amount and category == 'schoolfee40':
     372                        amount = 0.4*amount
     373        elif category == 'clearance':
     374            try:
     375                p_item = student['studycourse'].certificate.code
     376            except (AttributeError, TypeError):
     377                return _('Study course data are incomplete.'), None
     378            amount = academic_session.clearance_fee
     379        elif category.startswith('cdlcourse'):
     380            amount = academic_session.course_fee
     381            number = int(category.strip('cdlcourse'))
     382            amount *= number
     383        elif category == 'combi' and combi:
     384            categories = getUtility(IKofaUtils).CDLPORTAL_PAYMENT_CATEGORIES
     385            for cat in combi:
     386                fee_name = cat + '_fee'
     387                cat_amount = getattr(academic_session, fee_name, 0.0)
     388                if not cat_amount:
     389                    return _('%s undefined.' % categories[cat]), None
     390                amount += cat_amount
     391                p_item += u'%s + ' % categories[cat]
     392            p_item = p_item.strip(' + ')
     393        else:
     394            fee_name = category + '_fee'
     395            amount = getattr(academic_session, fee_name, 0.0)
     396        if amount in (0.0, None):
     397            return _('Amount could not be determined.'), None
     398        if self.samePaymentMade(student, category, p_item, p_session):
     399            return _('This type of payment has already been made.'), None
     400        if self._isPaymentDisabled(p_session, category, student):
     401            return _('This category of payments has been disabled.'), None
     402        payment = createObject(u'waeup.StudentOnlinePayment')
     403        timestamp = ("%d" % int(time()*10000))[1:]
     404        if category in (
     405            'registration', 'required_combi', 'pg_other', 'jupeb_reg'):
     406            payment.provider_amt = 5000.0
     407        if category in (
     408            'schoolfee', 'schoolfee40') and student.is_jupeb:
     409            payment.provider_amt = 5000.0
     410        payment.p_id = "p%s" % timestamp
     411        payment.p_category = category
     412        payment.p_item = p_item
     413        payment.p_session = p_session
     414        payment.p_level = p_level
     415        payment.p_current = p_current
     416        payment.amount_auth = amount
     417        payment.p_combi = combi
     418        return None, payment
     419
    284420    def setBalanceDetails(self, category, student,
    285421            balance_session, balance_level, balance_amount):
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py

    r17573 r17661  
    3737from kofacustom.nigeria.interfaces import MessageFactory as _
    3838
     39class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
     40
     41    @property
     42    def target(self):
     43        if grok.getSite().__name__ == 'iuokada-cdl':
     44            return
     45        return 'addpp'
     46
    3947class StudentPersonalEditActionButton(StudentPersonalEditActionButton):
    4048    text = _('Edit registration bio data')
     
    110118        #if self.context.student.depcode == 'BMS':
    111119        #    return ''
     120        if grok.getSite().__name__ == 'iuokada-cdl':
     121            return
     122        return self.view.url(self.view.context, self.target)
     123
     124class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
     125
     126    @property
     127    def target_url(self):
     128        if grok.getSite().__name__ == 'iuokada-cdl':
     129            return
     130        student = self.view.context.student
     131        if student.before_payment or not self.target:
     132            return ''
    112133        return self.view.url(self.view.context, self.target)
    113134
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/utils/utils.py

    r17651 r17661  
    1919"""
    2020
     21import grok
    2122from copy import deepcopy
    2223from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
     
    6869        'resit4': '4 Make-Up Examination Courses',
    6970        'resit5': '5 Make-Up Examination Courses',
    70         'resit6': '6 Make-Up Examination Course',
     71        'resit6': '6 Make-Up Examination Courses',
    7172        'resit7': '7 Make-Up Examination Courses',
    7273        'resit8': '8 Make-Up Examination Courses',
     
    8485        'brought_fwd': 'Balance Brought Forward',
    8586        'health_insurance': 'Student Health Insurance',
     87        # CDL Portal Fees only
     88        'medical':'Medical Services',
     89        'library':'Library',
     90        'ict':'ICT Fees',
     91        'orientation':'Orientation Fee',
     92        'examination':'Examination Fee',
     93        'cdlcourse1': ' 1 Course',
     94        'cdlcourse2': ' 2 Courses',
     95        'cdlcourse3': ' 3 Courses',
     96        'cdlcourse4': ' 4 Courses',
     97        'cdlcourse5': ' 5 Courses',
     98        'cdlcourse6': ' 6 Courses',
     99        'cdlcourse7': ' 7 Courses',
     100        'cdlcourse8': ' 8 Courses',
     101        'cdlcourse9': ' 9 Courses',
     102        'cdlcourse10': '10 Courses',
     103        'cdlcourse11': '11 Courses',
     104        'cdlcourse12': '12 Courses',
     105        'cdlcourse13': '13 Courses',
     106        'cdlcourse14': '14 Courses',
     107        'cdlcourse15': '15 Courses',
    86108        }
    87109
     
    127149        #'resit4': '4 Make-Up Examination Courses',
    128150        #'resit5': '5 Make-Up Examination Courses',
    129         #'resit6': '6 Make-Up Examination Course',
     151        #'resit6': '6 Make-Up Examination Courses',
    130152        #'resit7': '7 Make-Up Examination Courses',
    131153        #'resit8': '8 Make-Up Examination Courses',
     
    144166        }
    145167
     168    CDLPORTAL_PAYMENT_CATEGORIES = {
     169        'clearance': 'Acceptance Fee',
     170        'id_card': 'Student ID Card',
     171        'waecneco': 'WAEC/NECO Verification',
     172        # CDL Portal fees only
     173        'medical':'Medical Services',
     174        'library':'Library',
     175        'ict':'ICT Fees',
     176        'orientation':'Orientation Fee',
     177        'examination':'Examination Fee',
     178        'cdlcourse1': ' 1 Course',
     179        'cdlcourse2': ' 2 Courses',
     180        'cdlcourse3': ' 3 Courses',
     181        'cdlcourse4': ' 4 Courses',
     182        'cdlcourse5': ' 5 Courses',
     183        'cdlcourse6': ' 6 Courses',
     184        'cdlcourse7': ' 7 Courses',
     185        'cdlcourse8': ' 8 Courses',
     186        'cdlcourse9': ' 9 Courses',
     187        'cdlcourse10': '10 Courses',
     188        'cdlcourse11': '11 Courses',
     189        'cdlcourse12': '12 Courses',
     190        'cdlcourse13': '13 Courses',
     191        'cdlcourse14': '14 Courses',
     192        'cdlcourse15': '15 Courses',
     193        }
     194
    146195    def selectable_payment_categories(self, student):
     196        if grok.getSite().__name__ == 'iuokada-cdl':
     197            spc = deepcopy(self.CDLPORTAL_PAYMENT_CATEGORIES)
     198            return spc
    147199        spc = deepcopy(self.SELECTABLE_PAYMENT_CATEGORIES)
    148200        if student.depcode == 'BMS':
Note: See TracChangeset for help on using the changeset viewer.