Changeset 7021


Ignore:
Timestamp:
7 Nov 2011, 17:20:24 (13 years ago)
Author:
Henrik Bettermann
Message:

Adjust customisation and base package.

Location:
main
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.custom/trunk/buildout-windows.cfg

    r6817 r7021  
    5252# This creates only the paster script in bin/.
    5353recipe = zc.recipe.egg
    54 eggs = waeup.sirp
     54eggs = waeup.custom
    5555       z3c.evalexception>=2.0
    5656       Paste
  • main/waeup.custom/trunk/src/waeup/custom/interfaces.py

    r6950 r7021  
    22## interfaces.py
    33from zope import schema
    4 from waeup.sirp.interfaces import IWAeUPObject, academic_sessions_vocab
     4from waeup.sirp.interfaces import (
     5    IWAeUPObject, ISessionConfiguration, academic_sessions_vocab)
    56
    6 class ISessionConfiguration(IWAeUPObject):
     7# It's recommended to replicate all fields from the base package here.
     8class ISessionConfiguration(ISessionConfiguration):
    79    """A session configuration object.
    810    """
    911
    10     academic_session = schema.Choice(
    11         title = u'Academic Session',
    12         source = academic_sessions_vocab,
    13         default = None,
    14         required = True,
    15         readonly = True
    16         )
    17 
    18     fee_1 = schema.Int(
     12    school_fee_base = schema.Int(
    1913        title = u'School Fee',
    2014        default = 0,
     
    3125        )
    3226
     27    surcharge_3 = schema.Int(
     28        title = u'Surcharge 3',
     29        default = 0,
     30        )
     31
     32    clearance = schema.Int(
     33        title = u'Clearance Fee',
     34        default = 0,
     35        )
     36
     37    booking_fee = schema.Int(
     38        title = u'Booking Fee',
     39        default = 0,
     40        )
     41
     42    maint_fee = schema.Int(
     43        title = u'Maintenance Fee',
     44        default = 0,
     45        )
     46
    3347    gown = schema.Int(
    3448        title = u'Gown Fee',
     
    3852    transfer = schema.Int(
    3953        title = u'Transfer Fee',
    40         default = 0,
    41         )
    42 
    43     hostelmaintenance = schema.Int(
    44         title = u'Hostel Maintenance Fee',
    45         default = 0,
    46         )
    47 
    48     clearance = schema.Int(
    49         title = u'Clearance Fee',
    5054        default = 0,
    5155        )
  • main/waeup.custom/trunk/src/waeup/custom/students/tests.py

    r6950 r7021  
    99
    1010    def test_manage_payments(self):
     11        # Add missing configuration data
     12        self.app['configuration']['2004'].gown_fee = 150
     13        self.app['configuration']['2004'].transfer_fee = 90
     14        self.app['configuration']['2004'].clearance_fee = 120
     15        self.app['configuration']['2004'].maint_fee = 180
    1116
    1217        # Managers can add online payment tickets
    1318        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    14         self.browser.open(self.payments_student_path)
    15         self.browser.getControl("Add online payment ticket").click()
    16         self.browser.getControl("Create ticket").click()
    17         self.assertMatches('...Session configuration object is not available...',
    18                            self.browser.contents)
    19 
    20         # Set up SessionConfiguration object
    21         configuration = SessionConfiguration()
    22         configuration.academic_session = 2004
    23         configuration.fee_1 = 20000
    24         self.app['configuration'].addSessionConfiguration(configuration)
    25 
    2619        self.browser.open(self.payments_student_path)
    2720        self.browser.getControl("Add online payment ticket").click()
     
    4336                           self.browser.contents)
    4437        self.browser.open(self.manage_student_path)
    45         self.browser.getControl(name="transition").value = ['pay_first_school_fee']
     38        self.browser.getControl(
     39            name="transition").value = ['pay_first_school_fee']
    4640        self.browser.getControl("Save").click()
    4741        self.browser.getControl(name="transition").value = ['reset6']
     
    5852        self.browser.getControl("Create ticket").click()
    5953        self.browser.open(self.payments_student_path + '/addop')
    60         self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
     54        self.browser.getControl(
     55            name="form.p_category").value = ['bed_allocation']
     56        self.browser.getControl("Create ticket").click()
     57        self.browser.open(self.payments_student_path + '/addop')
     58        self.browser.getControl(
     59            name="form.p_category").value = ['hostel_maintenance']
    6160        self.browser.getControl("Create ticket").click()
    6261        self.browser.open(self.payments_student_path + '/addop')
     
    7069                           self.browser.contents)
    7170
     71        # If the session configuration doesn't exist and error message will
     72        # be shown
     73        del self.app['configuration']['2004']
     74        self.browser.open(self.payments_student_path)
     75        self.browser.getControl("Add online payment ticket").click()
     76        self.browser.getControl("Create ticket").click()
     77        self.assertMatches('...Session configuration object is not...',
     78                           self.browser.contents)
    7279
     80
  • main/waeup.custom/trunk/src/waeup/custom/students/utils.py

    r6950 r7021  
    44
    55def getPaymentDetails(category, student):
    6 
    7     surcharge_1 = surcharge_2 = surcharge_3 = 0
    8     p_item = u''
    9     amount = 0
    10     error = u''
    11     p_session = student['studycourse'].current_session
    12     session = str(p_session)
     6    d = {}
     7    d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0
     8    d['p_item'] = u''
     9    d['amount'] = 0
     10    d['error'] = u''
     11    d['p_session'] = student['studycourse'].current_session
     12    session = str(d['p_session'])
    1313    try:
    1414        academic_session = getSite()['configuration'][session]
    1515    except KeyError:
    16         error = u'Session configuration object is not available.'
    17         return (amount, p_item, p_session,
    18             surcharge_1, surcharge_2, surcharge_3, error)
     16        d['error'] = u'Session configuration object is not available.'
     17        return d
    1918    if category == 'transfer':
    20         amount = academic_session.transfer
     19        d['amount'] = academic_session.transfer_fee
    2120    elif category == 'gown':
    22         amount = academic_session.gown
     21        d['amount'] = academic_session.gown_fee
     22    elif category == 'bed_allocation':
     23        d['amount'] = academic_session.booking_fee
    2324    elif category == 'hostel_maintenance':
    24         amount = academic_session.hostelmaintenance
     25        d['amount'] = academic_session.maint_fee
    2526    elif category == 'clearance':
    26         p_item = student['studycourse'].certificate.code
    27         amount = academic_session.clearance
     27        d['p_item'] = student['studycourse'].certificate.code
     28        d['amount'] = academic_session.clearance_fee
    2829    elif category == 'schoolfee':
    29         surcharge_1 = academic_session.surcharge_1
    30         surcharge_2 = academic_session.surcharge_2
    31         amount = getSchoolFee(student, surcharge_1 + surcharge_2)
     30        d['surcharge_1'] = academic_session.surcharge_1
     31        d['surcharge_2'] = academic_session.surcharge_2
     32        d['amount'] = getSchoolFee(student, d['surcharge_1'] + d['surcharge_2'])
    3233        code = student['studycourse'].certificate.code
    3334        #session_string = academic_sessions_vocab.by_value[p_session + 1].title
    34         p_item = code
    35         p_session += 1
    36     if amount ==0:
    37         error = u'Amount could not be determined.'
    38     return (amount, p_item, p_session,
    39         surcharge_1, surcharge_2, surcharge_3, error)
     35        d['p_item'] = code
     36        d['p_session'] += 1
     37    if d['amount'] == 0:
     38        d['error'] = u'Amount could not be determined.'
     39    return d
    4040
    4141def getSchoolFee(student, surcharge):
    4242    study_mode = student['studycourse'].certificate.study_mode
    43     entry_mode = student.entry_mode
     43    entry_mode = student['studycourse'].entry_mode
    4444    state = student.state
    4545    #lga = student.lga
  • main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py

    r6993 r7021  
    277277        )
    278278
    279     fee_1 = schema.Int(
     279    school_fee_base = schema.Int(
    280280        title = u'School Fee',
    281281        default = 0,
     
    297297        )
    298298
    299     fee_2 = schema.Int(
     299    clearance = schema.Int(
    300300        title = u'Clearance Fee',
    301301        default = 0,
     
    304304    booking_fee = schema.Int(
    305305        title = u'Booking Fee',
    306         default = 0,
    307         )
    308 
    309     maint_fee = schema.Int(
    310         title = u'Maintenance Fee',
    311306        default = 0,
    312307        )
  • main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py

    r7019 r7021  
    3434    return
    3535
    36 # To be specified in customization packages, see also view which
     36# To be specified in customization packages, see also the view which
    3737# calls the function.
    38 # This function is for demonstration and testing only.
    3938def getPaymentDetails(category, student):
    4039    d = {}
     
    5352    d['surcharge_3'] = academic_session.surcharge_3
    5453    if category == 'schoolfee':
    55         d['amount'] = academic_session.fee_1
     54        d['amount'] = academic_session.school_fee_base
    5655        d['p_item'] = student['studycourse'].certificate.code
    5756    elif category == 'clearance':
    5857        d['p_item'] = student['studycourse'].certificate.code
    59         d['amount'] = academic_session.fee_2
     58        d['amount'] = academic_session.clearance_fee
    6059    elif category == 'bed_allocation':
    6160        d['p_item'] = getAccommodationDetails(student)['bt']
     
    6362    return d
    6463
    65 # To be specified in customization packages, see also view which
     64# To be specified in customization packages, see also the view which
    6665# calls the function.
    67 # This function is for demonstration and testing only.
    6866def getAccommodationDetails(student):
    6967    d = {}
Note: See TracChangeset for help on using the changeset viewer.