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.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
2 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):
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r15433 r15451  
    2121import string
    2222from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
     23from waeup.kofa.students.workflow  import ALUMNI_STATES
    2324
    2425class CustomKofaUtils(NigeriaKofaUtils):
     
    99100        }
    100101
     102    ALUMNI_PAYMENT_CATS =  {
     103        'transcript_local': 'Transcript Fee Local',
     104        'transcript_inter': 'Transcript Fee International',
     105        }
     106
     107    REDUCED_PAYMENT_CATS =  {
     108        'clearance': 'Acceptance Fee',
     109        'schoolfee': 'School Fee',
     110        }
     111
     112    IJMBE_PAYMENT_CATS =  {
     113        'clearance': 'Acceptance Fee',
     114        'schoolfee': 'School Fee',
     115        'schoolfee_1': 'School Fee (1st instalment)',
     116        'schoolfee_2': 'School Fee (2nd instalment)',
     117        }
     118
     119    PT_AND_DSH_PAYMENT_CATS =  {
     120        'clearance_incl': 'Acceptance Fee Plus',
     121        'schoolfee_incl': 'School Fee Plus',
     122        'ent_registration_1': 'Registration Fee ENT201',
     123        'ent_text_book_1': 'Text Book Fee ENT201',
     124        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
     125        'gst_registration_2': 'Registration Fee GST222',
     126        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
     127        'gst_text_book_1': 'Text Book Fee GST101 GST102',
     128        'gst_text_book_2': 'Text Book Fee GST111 GST112',
     129        'gst_text_book_3': 'Text Book Fee GST222',
     130        }
     131
    101132    def selectable_payment_categories(self, student):
     133        if student.state in ALUMNI_STATES:
     134            return self.ALUMNI_PAYMENT_CATS
     135        if student.current_mode in (
     136            'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
     137            return self.REDUCED_PAYMENT_CATS
     138        if student.current_mode in (
     139            'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
     140            return self.PT_AND_DSH_PAYMENT_CATS
     141        if student.current_mode == 'ijmbe':
     142            return self.IJMBE_PAYMENT_CATS
    102143        return self.SELECTABLE_PAYMENT_CATEGORIES
    103144
Note: See TracChangeset for help on using the changeset viewer.