Changeset 9905 for main/waeup.aaue


Ignore:
Timestamp:
22 Jan 2013, 08:55:00 (12 years ago)
Author:
Henrik Bettermann
Message:

Remove school fee installment payments and restricted course registration. Seems that all these customizations have been a waste of time.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r9755 r9905  
    5050        # Managers can add online payment tickets
    5151        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    52         self.app['configuration']['2004'].school_fee_base = 1234.0
     52        self.app['configuration']['2004'].school_fee = 1234.0
    5353        self.browser.open(self.payments_path)
    5454        IWorkflowState(self.student).setState('cleared')
    5555        self.browser.open(self.payments_path + '/addop')
    56         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     56        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    5757        self.browser.getControl("Create ticket").click()
    5858        self.assertMatches('...ticket created...',
     
    8181            'RETURN_TYPE=%s&'
    8282            'PROGRAMME_TYPE=CERT1&'
    83             'PAYMENT_TYPE=School Fee 1st instalment&'
     83            'PAYMENT_TYPE=School Fee&'
    8484            'ACADEMIC_SESSION=2004/2005&'
    8585            'MATRIC_NO=E1000000&'
  • main/waeup.aaue/trunk/src/waeup/aaue/interfaces.py

    r9319 r9905  
    3232    # Base fees, do not remove.
    3333
    34     school_fee_base = schema.Float(
    35         title = _(u'School Fee Instalments'),
     34    #school_fee_base = schema.Float(
     35    #    title = _(u'School Fee Instalments'),
     36    #    default = 0.0,
     37    #    required = False,
     38    #    )
     39
     40    school_fee = schema.Float(
     41        title = _(u'School Fee'),
    3642        default = 0.0,
    3743        required = False,
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r9853 r9905  
    2626
    2727from waeup.aaue.students.interfaces import (
    28     ICustomStudentOnlinePayment, ICustomCourseTicketAdd)
     28    ICustomStudentOnlinePayment)
    2929
    3030class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
     
    5353    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    5454    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    55 
    56 class CourseTicketAddFormPage2(CourseTicketAddFormPage):
    57     """Add a course ticket by student.
    58     """
    59     grok.name('ctadd')
    60     grok.require('waeup.handleStudent')
    61     form_fields = grok.AutoFields(ICustomCourseTicketAdd)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py

    r9537 r9905  
    3030from waeup.aaue.payments.interfaces import ICustomOnlinePayment
    3131from waeup.aaue.interfaces import MessageFactory as _
    32 
    33 class CourseSource(BasicContextualSourceFactory):
    34     """A course source delivers all courses inside the portal by looking
    35        up a catalog.
    36     """
    37     def getValues(self, context):
    38         catalog = getUtility(ICatalog, name='courses_catalog')
    39         courses = sorted(list(catalog.searchResults(
    40             code=(None, None))),key=lambda value: value.code)
    41         payments = context.student.getPaymentTuples()
    42         if (context.student.current_session, 'schoolfee_2', 'paid') in payments:
    43             pass
    44         else:
    45             courseslist = list(courses)
    46             for course in courseslist:
    47                 if course.semester == 2:
    48                     courses.remove(course)
    49         return courses
    50 
    51     def getToken(self, context, value):
    52         return value.code
    53 
    54     def getTitle(self, context, value):
    55         return "%s - %s (%d)" % (
    56             value.code, value.title[:64], value.semester)
    5732
    5833class ICustomStudentBase(INigeriaStudentBase):
     
    11994    """
    12095
    121 class ICustomCourseTicketAdd(IKofaObject):
    122     """An interface for adding course tickets.
    123 
    124     """
    125     course = schema.Choice(
    126         title = _(u'Course'),
    127         source = CourseSource(),
    128         readonly = False,
    129         )
    130 
    13196class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
    13297    """Representation of a student. Skip regular reg_number validation.
  • main/waeup.aaue/trunk/src/waeup/aaue/students/student.py

    r9502 r9905  
    3535    grok.provides(ICustomStudent)
    3636
    37     def getPaymentTuples(self):
    38         """Special AAUE method needed for selecting courses in semesters
    39         the student has paid for.
    40         """
    41         payments = [(p.p_session, p.p_category, p.p_state)
    42             for p in self['payments'].values()]
    43         return payments
    44 
    4537# Set all attributes of Student required in IStudent as field
    4638# properties. Doing this, we do not have to set initial attributes
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py

    r9692 r9905  
    3939    grok.provides(ICustomStudentStudyLevel)
    4040
    41     def addCertCourseTickets(self, cert):
    42         """Collect all certificate courses and create course
    43         tickets automatically.
    44 
    45         Add ticket only if student has paid for the course.semester.
    46         """
    47         payments = self.student.getPaymentTuples()
    48         if cert is not None:
    49             for key, val in cert.items():
    50                 if val.level != self.level:
    51                     continue
    52                 if val.course.semester == 2 and \
    53                     not (self.student.current_session,
    54                     'schoolfee_2', 'paid') in payments:
    55                     continue
    56                 ticket = createObject(u'waeup.CourseTicket')
    57                 ticket.automatic = True
    58                 ticket.mandatory = val.mandatory
    59                 ticket.carry_over = False
    60                 self.addCourseTicket(ticket, val.course)
    61         return
    62 
    6341CustomStudentStudyLevel = attrs_to_fields(
    6442    CustomStudentStudyLevel, omit=['total_credits', 'gpa'])
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r9755 r9905  
    9292        self.browser.open(self.payments_path)
    9393        self.browser.getLink("Add current session payment ticket").click()
    94         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     94        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    9595        self.browser.getControl("Create ticket").click()
    9696        self.assertMatches('...Wrong state...',
     
    101101        self.assertMatches('...Amount could not be determined...',
    102102                           self.browser.contents)
    103         self.app['configuration']['2004'].school_fee_base = 6666.0
    104         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     103        self.app['configuration']['2004'].school_fee = 6666.0
     104        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    105105        self.browser.getControl("Create ticket").click()
    106106        self.assertMatches('...ticket created...',
     
    119119        ticket.p_state = 'paid'
    120120        self.browser.open(self.payments_path + '/addop')
    121         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     121        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    122122        self.browser.getControl("Create ticket").click()
    123123        self.assertMatches('...This type of payment has already been made...',
     
    151151        self.assertMatches('...ticket created...',
    152152                           self.browser.contents)
    153         # Remove all payments so that we can add a school fee payment again
    154         keys = [i for i in self.student['payments'].keys()]
    155         for payment in keys:
    156             del self.student['payments'][payment]
     153
     154
     155    def deactivated_test_for_instalment_payments(self):
     156        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     157        self.browser.open(self.payments_path)
    157158        self.browser.open(self.payments_path + '/addop')
    158159        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     
    194195        configuration.academic_session = 2005
    195196        self.app['configuration'].addSessionConfiguration(configuration)
    196         self.app['configuration']['2005'].school_fee_base = 7777.0
     197        self.app['configuration']['2005'].school_base = 7777.0
    197198        self.browser.open(self.payments_path + '/addop')
    198199        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     
    239240        self.app['configuration']['2004'].maint_fee = 180.0
    240241        self.app['configuration']['2004'].clearance_fee = 1234.0
    241         self.app['configuration']['2004'].school_fee_base = 6666.0
     242        self.app['configuration']['2004'].school_fee = 6666.0
    242243        utils = getUtility(IStudentsUtils)
    243244
     
    245246        configuration.academic_session = 2005
    246247        self.app['configuration'].addSessionConfiguration(configuration)
    247         self.app['configuration']['2005'].school_fee_base = 7777.0
    248 
    249         error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     248        self.app['configuration']['2005'].school_fee = 7777.0
     249
     250        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    250251        self.assertEqual(payment, None)
    251252        self.assertEqual(error, u'Wrong state.')
    252253
    253254        IWorkflowState(self.student).setState('cleared')
    254         error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     255        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    255256        self.assertEqual(payment.p_level, 100)
    256257        self.assertEqual(payment.p_session, 2004)
     
    264265        # ... for returning
    265266        self.app['configuration']['2005'].penalty_ug = 88.0
    266         error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     267        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    267268        self.assertEqual(payment.amount_auth, 6765.0)
    268269        IWorkflowState(self.student).setState('returning')
    269         error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     270        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    270271        self.assertEqual(payment.p_level, 200)
    271272        self.assertEqual(payment.p_session, 2005)
     
    313314        return
    314315
    315     def test_student_course_registration(self):
     316    def deactivated_test_student_course_registration(self):
    316317
    317318        # Add more courses
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r9527 r9905  
    6767            return _(u'Session configuration object is not available.'), None
    6868        # Determine fee.
    69         if category == 'schoolfee':
    70             return _('School fee has to be paid by two instalments.'), None
    7169        if category == 'transfer':
    7270            amount = academic_session.transfer_fee
     
    8078            amount = academic_session.clearance_fee
    8179            p_item = student['studycourse'].certificate.code
    82         elif category == 'schoolfee_1':
     80        elif category == 'schoolfee':
    8381            try:
    8482                certificate = student['studycourse'].certificate
     
    8684            except (AttributeError, TypeError):
    8785                return _('Study course data are incomplete.'), None
    88             payment_allowed = False
    8986            if student.state == CLEARED:
    90                 payment_allowed = True
    91                 amount = academic_session.school_fee_base
     87                amount = academic_session.school_fee
    9288            elif student.state == RETURNING or\
    9389                (student.is_postgrad and student.state == PAID):
     
    10197                    # next session but their level always remains the same.
    10298                    p_session += 1
    103                 initial_instalment_made = False
    104                 for key in student['payments'].keys():
    105                     ticket = student['payments'][key]
    106                     if ticket.p_category == 'schoolfee_1' and \
    107                         ticket.p_state == 'paid':
    108                         initial_instalment_made = True
    109                     if ticket.p_state == 'paid' and\
    110                         ticket.p_category == 'schoolfee_2' and \
    111                         ticket.p_item == p_item and \
    112                         ticket.p_session == p_session-1: #  = current session
    113                         payment_allowed = True
    114                 if not initial_instalment_made:
    115                     payment_allowed = True
    11699                try:
    117100                    academic_session = grok.getSite()[
     
    119102                except KeyError:
    120103                    return _(u'Session configuration object is not available.'), None
    121                 amount = academic_session.school_fee_base
     104                amount = academic_session.school_fee
    122105            else:
    123106                return _('Wrong state.'), None
    124             if not payment_allowed:
    125                 return _('The previous 2nd school fee instalment '
    126                          'has not yet been paid.'), None
    127         elif category == 'schoolfee_2':
    128             try:
    129                 certificate = student['studycourse'].certificate
    130                 p_item = certificate.code
    131             except (AttributeError, TypeError):
    132                 return _('Study course data are incomplete.'), None
    133             payment_allowed = False
    134             for key in student['payments'].keys():
    135                 ticket = student['payments'][key]
    136                 if ticket.p_state == 'paid' and\
    137                    ticket.p_category == 'schoolfee_1' and \
    138                    ticket.p_item == p_item and \
    139                    ticket.p_session == p_session:
    140                    payment_allowed = True
    141             if not payment_allowed:
    142                 return _('The 1st school fee instalment '
    143                          'has not yet been paid or session has '
    144                          'not yet been started.'), None
    145             amount = academic_session.school_fee_base
    146107        if amount in (0.0, None):
    147108            return _(u'Amount could not be determined.'), None
    148109        # Add session specific penalty fee.
    149         if category == 'schoolfee_1' and student.is_postgrad:
     110        if category == 'schoolfee' and student.is_postgrad:
    150111            amount += academic_session.penalty_pg
    151         elif category == 'schoolfee_1':
     112        elif category == 'schoolfee':
    152113            amount += academic_session.penalty_ug
    153114        # Create ticket.
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r9755 r9905  
    4040
    4141    SELECTABLE_PAYMENT_CATEGORIES = {
    42         'schoolfee_1': 'School Fee 1st instalment',
    43         'schoolfee_2': 'School Fee 2nd instalment',
     42        'schoolfee': 'School Fee',
     43        #'schoolfee_1': 'School Fee 1st instalment',
     44        #'schoolfee_2': 'School Fee 2nd instalment',
    4445        'clearance': 'Acceptance Fee',
    4546        'hostel_maintenance': 'Hostel Maintenance Fee',
Note: See TracChangeset for help on using the changeset viewer.