## $Id: utils.py 8020 2012-04-02 11:05:40Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import grok from waeup.kofa.students.workflow import CLEARED, RETURNING from waeup.kofa.students.utils import StudentsUtils from waeup.kofa.students.interfaces import IStudentsUtils from waeup.uniben.interfaces import MessageFactory as _ def get_school_fee(student, surcharge): study_mode = student['studycourse'].certificate.study_mode entry_mode = student['studycourse'].entry_mode state = student.state #lga = student.lga lga = 'nothing' current_level = student['studycourse'].current_level if study_mode.endswith('_ft'): # fresh if state == CLEARED: return 40000.0 - surcharge # returning elif state == RETURNING: return 20000.0 - surcharge else: return 0.0 else: return 0.0 class StudentsUtils(StudentsUtils): """A collection of customized methods. """ grok.implements(IStudentsUtils) # not yet changed def setReturningData(self, student): student['studycourse'].current_level += 100 student['studycourse'].current_session += 1 verdict = student['studycourse'].current_verdict student['studycourse'].current_verdict = '0' student['studycourse'].previous_verdict = verdict return def getPaymentDetails(self, category, student): d = {} d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0.0 d['p_item'] = u'' d['amount'] = 0.0 d['error'] = u'' d['p_session'] = student['studycourse'].current_session session = str(d['p_session']) try: academic_session = grok.getSite()['configuration'][session] except KeyError: d['error'] = _(u'Session configuration object is not available.') return d if category == 'transfer': d['amount'] = academic_session.transfer_fee elif category == 'gown': d['amount'] = academic_session.gown_fee elif category == 'bed_allocation': d['amount'] = academic_session.booking_fee elif category == 'hostel_maintenance': d['amount'] = academic_session.maint_fee elif category == 'clearance': d['p_item'] = student['studycourse'].certificate.code d['amount'] = academic_session.clearance_fee elif category == 'schoolfee': d['surcharge_1'] = academic_session.surcharge_1 d['surcharge_2'] = academic_session.surcharge_2 d['amount'] = get_school_fee(student, d['surcharge_1'] + d['surcharge_2']) code = student['studycourse'].certificate.code d['p_item'] = code d['p_session'] += 1 if d['amount'] == 0.0: d['error'] = _(u'Amount could not be determined.') return d VERDICTS_DICT = { '0': 'not yet', 'A': 'Successful student', 'B': 'Student with carryover courses', 'C': 'Student on probation', 'D': 'Withdrawn from the faculty', 'E': 'Student who were previously on probation', 'F': 'Medical case', 'G': 'Absent from examination', 'H': 'Withheld results', 'I': 'Expelled/rusticated/suspended student', 'J': 'Temporary withdrawn from the university', 'K': 'Unregistered student', 'L': 'Referred student', 'M': 'Reinstatement', 'N': 'Student on transfer', 'O': 'NCE-III repeater', 'Y': 'No previous verdict', 'X': 'New 300 level student', 'Z': 'Successful student (provisional)', 'A1': 'First Class', 'A2': 'Second Class Upper', 'A3': 'Second Class Lower', 'A4': 'Third Class', 'A5': 'Pass', 'A6': 'Distinction', 'A7': 'Credit', 'A8': 'Merit', }