Ignore:
Timestamp:
4 Jun 2019, 08:17:06 (6 years ago)
Author:
Henrik Bettermann
Message:

Use CustomKofaUtils?.selectable_payment_categories for customization instead of customizing the view.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r15433 r15451  
    308308    form_fields[
    309309        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    310 
    311 class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage):
    312     """ Page to add an online payment ticket
    313     """
    314     form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
    315         'p_category')
    316 
    317     ALUMNI_PAYMENT_CATS =  {
    318         'transcript_local': 'Transcript Fee Local',
    319         'transcript_inter': 'Transcript Fee International',
    320         }
    321 
    322     REDUCED_PAYMENT_CATS =  {
    323         'clearance': 'Acceptance Fee',
    324         'schoolfee': 'School Fee',
    325         }
    326 
    327     IJMBE_PAYMENT_CATS =  {
    328         'clearance': 'Acceptance Fee',
    329         'schoolfee': 'School Fee',
    330         'schoolfee_1': 'School Fee (1st instalment)',
    331         'schoolfee_2': 'School Fee (2nd instalment)',
    332         }
    333 
    334     PT_AND_DSH_PAYMENT_CATS =  {
    335         'clearance_incl': 'Acceptance Fee Plus',
    336         'schoolfee_incl': 'School Fee Plus',
    337         'ent_registration_1': 'Registration Fee ENT201',
    338         'ent_text_book_1': 'Text Book Fee ENT201',
    339         'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
    340         'gst_registration_2': 'Registration Fee GST222',
    341         'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
    342         'gst_text_book_1': 'Text Book Fee GST101 GST102',
    343         'gst_text_book_2': 'Text Book Fee GST111 GST112',
    344         'gst_text_book_3': 'Text Book Fee GST222',
    345         }
    346 
    347     @property
    348     def selectable_categories(self):
    349         if 'alumni' in self.application_url():
    350             return sorted(
    351                 self.ALUMNI_PAYMENT_CATS.items(), key=lambda value: value[1])
    352         if self.context.student.current_mode in (
    353             'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
    354             return sorted(
    355                 self.REDUCED_PAYMENT_CATS.items(), key=lambda value: value[1])
    356         if self.context.student.current_mode in (
    357             'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
    358             return sorted(
    359                 self.PT_AND_DSH_PAYMENT_CATS.items(),
    360                 key=lambda value: value[1])
    361         if self.context.student.current_mode == 'ijmbe':
    362             return sorted(
    363                 self.IJMBE_PAYMENT_CATS.items(), key=lambda value: value[1])
    364         student = self.context.__parent__
    365         categories = getUtility(
    366             IKofaUtils).selectable_payment_categories(student)
    367         return sorted(categories.items(), key=lambda value: value[1])
    368310
    369311class CustomPaymentsManageFormPage(PaymentsManageFormPage):
Note: See TracChangeset for help on using the changeset viewer.