Changeset 12971
- Timestamp:
- 21 May 2015, 07:38:15 (10 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r12960 r12971 4 4 1.3.2.dev0 (unreleased) 5 5 ======================= 6 7 * Add StudentUnpaidPaymentExporter to export only unpaid tickets. 8 This exporter is designed for finding and finally purging outdated 9 payment ticket. 6 10 7 11 * Remove deprecated xml importer and exporter components. -
main/waeup.kofa/trunk/docs/source/userdocs/datacenter/export.rst
r12953 r12971 213 213 .. automethod:: waeup.kofa.students.export.StudentPaymentExporter.mangle_value() 214 214 215 Student Unpaid Payment Exporter 216 ------------------------------- 217 218 .. autoclass:: waeup.kofa.students.export.StudentUnpaidPaymentExporter() 219 220 .. autoattribute:: waeup.kofa.students.export.StudentUnpaidPaymentExporter.title 221 215 222 Bed Ticket Exporter 216 223 ------------------- -
main/waeup.kofa/trunk/docs/source/userdocs/students.rst
r12969 r12971 39 39 The `Student` class is a container class which means, there are not only attributes describing the student but also content. Each student container contains exactly three sub-containers: ``studycourse`` (instance of `StudentStudyCourse`), ``payments`` (instance of `StudentPaymentsContainer`) ``accommodation`` (instance of `StudentAccommodation`). The purposes of them are described further below. 40 40 41 Let's talk about the attributes and methods belonging to the `Student` class, the so-called 'external behaviour' of student objects . The data stored with each student object are subdivided into three parts: base data, personal data and clearance data.41 Let's talk about the attributes and methods belonging to the `Student` class, the so-called 'external behaviour' of student objects specified in Zope 'interfaces'. The data stored with each student object are subdivided into three parts: base data, personal data and clearance data. Each part has its own interface. 42 42 43 Now comes the point where we have to briefly introduce Zope's (see :ref:`prerequisites`) concept of 'interfaces'. 43 .. note:: 44 45 Interfaces are one of the pillars of Zope's Component Architecture (ZCA, see also :ref:`prerequisites`). They document the 'external behaviour' of objects. In Kofa interfaces are used to specify the attributes, methods and schema fields of objects. The first two are well-known Python concepts. A Zope schema field is a bit more complicated. It's a detailed description of a field to be submitted via forms to the server, or which is processed by a batch processor. In both cases the input data are being validated against the schema. In Kofa, schema fields in interfaces are also used to automtically add `FieldProperty` attributes of the same name to most content classes. This is done by a function called :py:func:`attrs_to_fields<waeup.kofa.utils.helpers.attrs_to_fields>`. These class attributes ensure that corresponding attributes of instances of this class - when being added or changed - always meet the requirements of the schema. Another big advantage of such class attributes is, that attributes with a `FieldProperty` do not need to be set in `__init__` methods. 44 46 45 47 -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportconfig.pt
r11730 r12971 74 74 function test() { 75 75 if (document.getElementById('exporter').value == 'bursary' || 76 document.getElementById('exporter').value == 'studentpayments') { 76 document.getElementById('exporter').value == 'studentpayments' || 77 document.getElementById('exporter').value == 'studentunpaidpayments') { 77 78 document.getElementById('payment_dates').style.display = 'block'; 78 79 } else { -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportconfig_certificate.pt
r11730 r12971 64 64 function test() { 65 65 if (document.getElementById('exporter').value == 'bursary' || 66 document.getElementById('exporter').value == 'studentpayments') { 66 document.getElementById('exporter').value == 'studentpayments' || 67 document.getElementById('exporter').value == 'studentunpaidpayments') { 67 68 document.getElementById('payment_dates').style.display = 'block'; 68 69 } else { -
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r12873 r12971 86 86 return tickets 87 87 88 def get_payments(students, p aid=False, **kw):88 def get_payments(students, p_state=None, **kw): 89 89 """Get all payments of `students` within given payment_date period. 90 90 """ … … 100 100 payments_start = tz.localize(payments_start) 101 101 payments_end = tz.localize(payments_end) 102 if p aid:103 # Only paid tickets in payment period are considered102 if p_state: 103 # Only paid or unpaid tickets in payment period are considered 104 104 for student in students: 105 105 for payment in student.get('payments', {}).values(): 106 if payment.payment_date and payment.p_state == 'paid':106 if payment.payment_date and payment.p_state == p_state: 107 107 payment_date = to_timezone(payment.payment_date, tz) 108 108 if payment_date > payments_start and \ … … 120 120 else: 121 121 # Payment period not given 122 if p aid:122 if p_state: 123 123 # Only paid tickets are considered 124 124 for student in students: 125 125 for payment in student.get('payments', {}).values(): 126 if payment.p_state == 'paid':126 if payment.p_state == p_state: 127 127 payments.append(payment) 128 128 else: … … 382 382 value, name, context=context) 383 383 384 class StudentUnpaidPaymentExporter(StudentPaymentExporter): 385 """The Student Unpaid Payment Exporter works just like the 386 Student Payments Exporter but it exports only unpaid tickets. 387 This exporter is designed for finding and finally purging outdated 388 payment ticket. 389 """ 390 grok.name('studentunpaidpayments') 391 392 title = _(u'Student Unpaid Payments') 393 394 def filter_func(self, x, **kw): 395 return get_payments(x, p_state='unpaid', **kw) 396 384 397 class DataForBursaryExporter(StudentPaymentExporter): 385 398 """The DataForBursary Exporter works just like the Student Payments Exporter … … 392 405 393 406 def filter_func(self, x, **kw): 394 return get_payments(x, p aid=True, **kw)407 return get_payments(x, p_state='paid', **kw) 395 408 396 409 fields = tuple( -
main/waeup.kofa/trunk/src/waeup/kofa/students/student.py
r12104 r12971 421 421 """ 422 422 423 STUDENT_ EXPORTER_NAMES = getUtility(424 IStudentsUtils).STUDENT_ EXPORTER_NAMES425 426 for name in STUDENT_ EXPORTER_NAMES:423 STUDENT_BACKUP_EXPORTER_NAMES = getUtility( 424 IStudentsUtils).STUDENT_BACKUP_EXPORTER_NAMES 425 426 for name in STUDENT_BACKUP_EXPORTER_NAMES: 427 427 exporter = getUtility(ICSVStudentExporter, name=name) 428 428 csv_data = exporter.export_student(student) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r12865 r12971 32 32 StudentPaymentsOverviewExporter, StudentStudyLevelsOverviewExporter, 33 33 ComboCardDataExporter, DataForBursaryExporter, 34 StudentUnpaidPaymentExporter, 34 35 get_students,) 35 36 from waeup.kofa.students.accommodation import BedTicket … … 895 896 result = open(self.outfile, 'rb').read() 896 897 898 return 899 900 class StudentUnpaidPaymentExporterTest(StudentImportExportSetup): 901 902 layer = FunctionalLayer 903 904 def setUp(self): 905 super(StudentUnpaidPaymentExporterTest, self).setUp() 906 self.setup_for_export() 907 return 908 909 def test_export_all(self): 910 # we can really export all payments 911 # set values we can expect in export file 912 self.setup_student(self.student) 913 exporter = StudentUnpaidPaymentExporter() 914 exporter.export_all(self.app, self.outfile) 915 result = open(self.outfile, 'rb').read() 916 # No unpaid ticket exists 917 self.assertEqual( 918 result, 919 'ac,amount_auth,creation_date,p_category,p_current,p_id,' 920 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 921 'r_code,r_desc,student_id,state,current_session\r\n' 922 ) 923 # Make ticket unpaid 924 self.payment.p_state = 'unpaid' 925 exporter.export_all(self.app, self.outfile) 926 result = open(self.outfile, 'rb').read() 927 self.assertEqual( 928 result, 929 'ac,amount_auth,creation_date,p_category,p_current,p_id,' 930 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 931 'r_code,r_desc,student_id,state,current_session\r\n' 932 933 '666,12.12,2012-04-01 13:12:01#,schoolfee,1,my-id,' 934 'p-item,100,2012,unpaid,2012-04-01 14:12:01#,12.12,' 935 'r-code,,A111111,created,2012\r\n' 936 ) 897 937 return 898 938 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_student.py
r12104 r12971 182 182 183 183 # The student data were put into CSV files 184 STUDENT_ EXPORTER_NAMES = getUtility(185 IStudentsUtils).STUDENT_ EXPORTER_NAMES186 187 for name in STUDENT_ EXPORTER_NAMES:184 STUDENT_BACKUP_EXPORTER_NAMES = getUtility( 185 IStudentsUtils).STUDENT_BACKUP_EXPORTER_NAMES 186 187 for name in STUDENT_BACKUP_EXPORTER_NAMES: 188 188 csv_path = os.path.join(del_dir, '%s.csv' % name) 189 189 self.assertTrue(os.path.isfile(csv_path)) -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r12902 r12971 954 954 STUDENT_EXPORTER_NAMES = ('students', 'studentstudycourses', 955 955 'studentstudylevels', 'coursetickets', 956 'studentpayments', 'bedtickets', 'paymentsoverview', 956 'studentpayments', 'studentunpaidpayments', 957 'bedtickets', 'paymentsoverview', 957 958 'studylevelsoverview', 'combocard', 'bursary') 959 960 #: A tuple containing all exporter names needed for backing 961 #: up student data 962 STUDENT_BACKUP_EXPORTER_NAMES = ('students', 'studentstudycourses', 963 'studentstudylevels', 'coursetickets', 964 'studentpayments', 'bedtickets') 958 965 959 966 #: A prefix used when generating new student ids. Each student id will -
main/waeup.kofa/trunk/src/waeup/kofa/university/department.py
r12906 r12971 31 31 from waeup.kofa.utils.batching import VirtualExportJobContainer 32 32 from waeup.kofa.interfaces import IKofaUtils, IKofaPluggable 33 from waeup.kofa.utils.helpers import attrs_to_fields34 33 from waeup.kofa.university.interfaces import IDepartment 35 34
Note: See TracChangeset for help on using the changeset viewer.