source: main/waeup.uniben/trunk/src/waeup/uniben/students/export.py @ 15554

Last change on this file since 15554 was 15048, checked in by Henrik Bettermann, 6 years ago

Rename StudentPaymentsOverviewExporter.

File size: 3.8 KB
RevLine 
[12856]1## $Id: export.py 12084 2014-11-28 09:54:10Z henrik $
2##
3## Copyright (C) 2015 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Exporters for student related stuff.
19"""
[15025]20from datetime import datetime
[12856]21from waeup.uniben.students.interfaces import (
22    ICustomStudent,
23    ICustomStudentStudyCourse,
24    ICustomStudentStudyLevel,
25    ICustomCourseTicket,
26    ICustomStudentOnlinePayment)
27from kofacustom.nigeria.students.export import (
28    NigeriaStudentExporter,
29    NigeriaStudentStudyCourseExporter,
30    NigeriaStudentStudyLevelExporter,
31    NigeriaCourseTicketExporter,
[14856]32    NigeriaStudentPaymentExporter,
[15025]33    NigeriaDataForBursaryExporter,
34    )
[15048]35from waeup.kofa.students.export import SchoolFeePaymentsOverviewExporter
[12856]36from waeup.kofa.utils.helpers import iface_names
37
38class CustomStudentExporter(NigeriaStudentExporter):
39    """Exporter for Students.
40    """
41
42    fields = tuple(sorted(iface_names(
43        ICustomStudent, omit=['loggerInfo']))) + (
44        'password', 'state', 'history', 'certcode', 'is_postgrad',
45        'current_level', 'current_session')
46
47class CustomStudentStudyCourseExporter(NigeriaStudentStudyCourseExporter):
48    """Exporter for StudentStudyCourses.
49    """
50
51    fields = tuple(
52        sorted(iface_names(ICustomStudentStudyCourse))) + ('student_id',)
53
54class CustomStudentStudyLevelExporter(NigeriaStudentStudyLevelExporter):
55    """Exporter for StudentStudyLevels.
56    """
57    #: Fieldnames considered by this exporter
58    fields = tuple(sorted(iface_names(
[12879]59        ICustomStudentStudyLevel))) + (
[12856]60        'student_id', 'number_of_tickets','certcode')
61
62class CustomCourseTicketExporter(NigeriaCourseTicketExporter):
63    """Exporter for CourseTickets.
64    """
65
66    fields = tuple(sorted(iface_names(ICustomCourseTicket) +
67        ['level', 'code', 'level_session'])) + ('student_id',
68        'certcode', 'display_fullname')
69
[12879]70class CustomStudentPaymentExporter(NigeriaStudentPaymentExporter):
[12856]71    """Exporter for OnlinePayment instances.
72    """
73
74    fields = tuple(
75        sorted(iface_names(
76            ICustomStudentOnlinePayment, exclude_attribs=False,
[13621]77            omit=['display_item']))) + (
[12856]78            'student_id','state','current_session')
79
[14856]80class CustomDataForBursaryExporter(NigeriaDataForBursaryExporter):
81    """
82    """
83
84    fields = tuple(
85        sorted(iface_names(
86            ICustomStudentOnlinePayment, exclude_attribs=False,
87            omit=['display_item', 'certificate', 'student']))) + (
88            'student_id','matric_number','reg_number',
89            'firstname', 'middlename', 'lastname',
90            'state','current_session',
91            'entry_session', 'entry_mode',
92            'faccode', 'depcode','certcode')
[15025]93
[15048]94class CustomSchoolFeePaymentsOverviewExporter(SchoolFeePaymentsOverviewExporter):
[15025]95
96    curr_year = datetime.now().year
[15044]97    year_range = range(curr_year - 14, curr_year + 1) # 3 more years in Uniben
[15025]98    year_range_tuple = tuple([str(year) for year in year_range])
99
100    fields = ('student_id', 'matric_number', 'display_fullname',
101        'state', 'certcode', 'faccode', 'depcode', 'is_postgrad',
102        'current_level', 'current_session', 'current_mode',
103        'entry_session', 'reg_number'
104        ) + year_range_tuple
Note: See TracBrowser for help on using the repository browser.