Changeset 15277
- Timestamp:
- 19 Dec 2018, 22:50:36 (6 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r15250 r15277 4 4 1.6.1.dev0 (unreleased) 5 5 ======================= 6 7 * Add `AccommodationPaymentsExporter` which can be used by 8 accommodation officers. 6 9 7 10 * Add ReleaseExpiredAllocationsActionButton which has previously -
main/waeup.kofa/trunk/docs/source/userdocs/datacenter/export.rst
r15163 r15277 265 265 .. automethod:: waeup.kofa.students.export.DataForBursaryExporter.mangle_value() 266 266 267 Accommodation Payments Exporter 268 ------------------------------- 269 270 .. autoclass:: waeup.kofa.students.export.AccommodationPaymentsExporter() 271 272 .. autoattribute:: waeup.kofa.students.export.AccommodationPaymentsExporter.fields 273 .. autoattribute:: waeup.kofa.students.export.AccommodationPaymentsExporter.title 274 .. automethod:: waeup.kofa.students.export.AccommodationPaymentsExporter.mangle_value() 275 267 276 School Fee Payments Overview Exporter 268 277 ------------------------------------- -
main/waeup.kofa/trunk/docs/source/userdocs/security.rst
r15163 r15277 83 83 :noindex: 84 84 85 .. autoclass:: waeup.kofa.permissions.ExportPaymentsOverview() 86 :noindex: 87 88 .. autoclass:: waeup.kofa.permissions.ExportBursaryData() 89 :noindex: 90 85 91 .. autoclass:: waeup.kofa.reports.HandleReports() 86 92 :noindex: 87 93 88 94 .. autoclass:: waeup.kofa.reports.ManageReports() 95 :noindex: 96 97 Accommodation Section Permissions 98 --------------------------------- 99 100 .. autoclass:: waeup.kofa.hostels.permissions.ViewHostels() 101 :noindex: 102 103 .. autoclass:: waeup.kofa.hostels.permissions.ManageHostels() 104 :noindex: 105 106 .. autoclass:: waeup.kofa.hostels.permissions.ExportAccommodationData() 89 107 :noindex: 90 108 … … 184 202 :noindex: 185 203 204 .. autoclass:: waeup.kofa.permissions.BursaryOfficer() 205 :noindex: 206 186 207 .. autoclass:: waeup.kofa.reports.ReportsOfficer() 187 208 :noindex: … … 197 218 198 219 .. autoclass:: waeup.kofa.permissions.CCOfficer() 220 :noindex: 221 222 Global Accommodation Section Roles 223 ---------------------------------- 224 225 .. autoclass:: waeup.kofa.hostels.permissions.AccommodationOfficer() 199 226 :noindex: 200 227 -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/permissions.py
r7195 r15277 24 24 25 25 class ViewHostels(grok.Permission): 26 """The ViewHostels permission is applied to all views of the 27 Accommodation Section. Users with this permission can view but not edit 28 data in the Accommodation Section. 29 """ 26 30 grok.name('waeup.viewHostels') 27 31 28 32 class ManageHostels(grok.Permission): 33 """The ManageHostels permission is applied to manage pages in the 34 Accommodation Section. 35 """ 29 36 grok.name('waeup.manageHostels') 37 38 class ExportAccommodationData(grok.Permission): 39 """Accommodation Officers don't have the general exportData 40 permission and are only allowed to export accommodation data 41 (accommodation payment tickets and bed tickets). 42 The ExportAccommodationData permission is only used to filter the 43 respective exporters in the ExportJobContainerJobConfig view. 44 """ 45 grok.name('waeup.exportAccommodationData') 30 46 31 47 # Site Roles 32 48 class AccommodationOfficer(grok.Role): 49 """Accommodation Officers can view and manage hostels. They can also export 50 accommodation data (filtered payment tickets and beds). 51 They can't access the Data Center but see student data export buttons 52 in the Academic Section. 53 """ 33 54 grok.name('waeup.AccommodationOfficer') 34 55 grok.title(u'Accommodation Officer') 35 grok.permissions('waeup.viewHostels', 'waeup.manageHostels') 56 grok.permissions('waeup.viewHostels', 57 'waeup.manageHostels', 58 'waeup.showStudents', 59 'waeup.viewAcademics', 60 'waeup.exportAccommodationData') -
main/waeup.kofa/trunk/src/waeup/kofa/permissions.py
r15163 r15277 148 148 149 149 class ExportPaymentsOverview(grok.Permission): 150 """Department Officers don't have the general exportData 151 permission and are only allowed to export payments overviews. 152 The ExportPaymentsOverview permission is only used to filter the 153 respective exporters in the ExportJobContainerJobConfig view. 154 """ 150 155 grok.name('waeup.exportPaymentsOverview') 151 156 152 157 153 158 class ExportBursaryData(grok.Permission): 159 """Bursary Officers don't have the general exportData 160 permission and are only allowed to export bursary data. 161 The ExportBursaryData permission is only used to filter the 162 respective exporter in the ExportJobContainerJobConfig view. 163 """ 154 164 grok.name('waeup.exportBursaryData') 155 165 … … 204 214 """The local DepartmentOfficer role can be assigned at faculty or 205 215 department level. The role allows to list all student data within the 206 faculty/department the local role is assigned. 216 faculty/department the local role is assigned. And it allows to export 217 payment data overviews. 207 218 """ 208 219 grok.name('waeup.local.DepartmentOfficer') -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15254 r15277 3567 3567 def _set_exporter_values(self): 3568 3568 # We provide all student exporters, nothing else, yet. 3569 # Bursary or Department Officers don't have the general exportData 3570 # permission and are only allowed to export bursary or payments 3571 # overview data respectively. This is the only place where 3569 # Bursary, Department or Accommodation Officers don't 3570 # have the general exportData 3571 # permission and are only allowed to export bursary, payments 3572 # overview or accommodation data respectively. 3573 # This is the only place where waeup.exportAccommodationData, 3572 3574 # waeup.exportBursaryData and waeup.exportPaymentsOverview 3573 3575 # are used. … … 3581 3583 ('Session Payments Overview', 3582 3584 'sessionpaymentsoverview')] 3585 if checkPermission('waeup.exportAccommodationData', self.context): 3586 exporters += [('Bed Tickets', 'bedtickets'), 3587 ('Accommodation Payments', 3588 'accommodationpayments')] 3583 3589 self.exporters = exporters 3584 3590 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r15062 r15277 508 508 value, name, context=context) 509 509 510 class AccommodationPaymentsExporter(DataForBursaryExporter): 511 """The AccommodationPayments Exporter works just like the Student 512 Payment Exporter but it exports much more information about the student. 513 It combines payment and student data in one table in order to spare 514 postprocessing of two seperate export files. The exporter is primarily 515 used by bursary officers who have exclusively access to this exporter. 516 The exporter exports ``paid`` and ``waived`` payment tickets with category 517 ``bed_allocation`` or ``hostel_maintenance``. 518 """ 519 grok.name('accommodationpayments') 520 521 def filter_func(self, x, **kw): 522 kw['paycat'] = 'bed_allocation' 523 payments = get_payments(x, p_states=('paid', 'waived'), **kw) 524 kw['paycat'] = 'hostel_maintenance' 525 payments += get_payments(x, p_states=('paid', 'waived'), **kw) 526 return payments 527 528 title = _(u'Accommodation Payments') 529 510 530 class BedTicketExporter(grok.GlobalUtility, StudentExporterBase): 511 531 """The Bed Ticket Exporter first filters the set of students -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15250 r15277 4181 4181 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 4182 4182 4183 def test_export_accommodation_officers(self): 4184 # Create bursary officer 4185 self.app['users'].addUser('mracco', 'mraccosecret') 4186 self.app['users']['mracco'].email = 'mracco@foo.ng' 4187 self.app['users']['mracco'].title = 'Carlo Pitter' 4188 prmglobal = IPrincipalRoleManager(self.app) 4189 prmglobal.assignRoleToPrincipal('waeup.AccommodationOfficer', 'mracco') 4190 # Login as bursary officer 4191 self.browser.open(self.login_path) 4192 self.browser.getControl(name="form.login").value = 'mracco' 4193 self.browser.getControl(name="form.password").value = 'mraccosecret' 4194 self.browser.getControl("Login").click() 4195 self.assertMatches('...You logged in...', self.browser.contents) 4196 self.browser.getLink("Academics").click() 4197 self.browser.getLink("Export student data").click() 4198 self.browser.getControl("Configure new export").click() 4199 # accommodationpayments and beds exporters are available 4200 # not only at facultiescontainer level ... 4201 self.assertFalse('<option value="students">' in self.browser.contents) 4202 self.assertTrue('<option value="accommodationpayments">' 4203 in self.browser.contents) 4204 self.assertTrue('<option value="bedtickets">' in self.browser.contents) 4205 self.browser.getControl( 4206 name="exporter").value = ['accommodationpayments'] 4207 self.browser.getControl(name="session").value = ['2004'] 4208 self.browser.getControl(name="level").value = ['100'] 4209 self.browser.getControl("Create CSV file").click() 4210 self.assertTrue('Export started' in self.browser.contents) 4211 # ... but also at other levels 4212 self.browser.open('http://localhost/app/faculties/fac1/dep1') 4213 self.browser.getLink("Export student data").click() 4214 self.browser.getControl("Configure new export").click() 4215 self.assertFalse('<option value="students">' in self.browser.contents) 4216 self.assertTrue('<option value="accommodationpayments">' 4217 in self.browser.contents) 4218 self.assertTrue('<option value="bedtickets">' in self.browser.contents) 4219 # Thew job can be discarded 4220 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 4221 self.wait_for_export_job_completed() 4222 self.browser.open('http://localhost/app/faculties/exports') 4223 self.browser.getControl("Discard").click() 4224 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 4225 4183 4226 4184 4227 UPLOAD_CSV_TEMPLATE = ( -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r15203 r15277 33 33 ComboCardDataExporter, DataForBursaryExporter, 34 34 StudentUnpaidPaymentExporter, SessionPaymentsOverviewExporter, 35 get_students,)35 AccommodationPaymentsExporter, get_students,) 36 36 from waeup.kofa.students.accommodation import BedTicket 37 37 from waeup.kofa.students.interfaces import ICSVStudentExporter … … 1043 1043 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1044 1044 % (curr_year-6, curr_year-6, curr_year-6) 1045 ) 1046 return 1047 1048 class AccommodationPaymentsExporterTest(StudentImportExportSetup): 1049 1050 layer = FunctionalLayer 1051 1052 def setUp(self): 1053 super(AccommodationPaymentsExporterTest, self).setUp() 1054 self.setup_for_export() 1055 return 1056 1057 def test_export_all(self): 1058 self.setup_student(self.student) 1059 # add accommodation payments 1060 payment = StudentOnlinePayment() 1061 payment.creation_date = datetime.datetime(curr_year-6, 4, 1, 13, 12, 1) 1062 payment.p_id = 'id1' 1063 payment.p_category = u'bed_allocation' 1064 payment.p_state = 'paid' 1065 payment.ac = u'abc' 1066 payment.p_item = u'xyz' 1067 payment.p_level = 100 1068 payment.p_session = curr_year - 6 1069 payment.payment_date = datetime.datetime(curr_year-6, 4, 1, 14, 12, 1) 1070 payment.amount_auth = 12.12 1071 payment.r_amount_approved = 12.12 1072 payment.r_code = u'cde' 1073 payment2 = StudentOnlinePayment() 1074 payment2.creation_date = datetime.datetime(curr_year-6, 4, 1, 13, 12, 1) 1075 payment2.p_id = 'id2' 1076 payment2.p_category = u'hostel_maintenance' 1077 payment2.p_state = 'paid' 1078 payment2.ac = u'abc' 1079 payment2.p_item = u'xyz' 1080 payment2.p_level = 100 1081 payment2.p_session = curr_year - 6 1082 payment2.payment_date = datetime.datetime(curr_year-6, 4, 1, 14, 12, 1) 1083 payment2.amount_auth = 12.12 1084 payment2.r_amount_approved = 12.12 1085 payment2.r_code = u'cde' 1086 # XXX: there is no addPayment method to give predictable names 1087 self.payment = self.student['payments']['id1'] = payment 1088 self.payment = self.student['payments']['id2'] = payment2 1089 exporter = AccommodationPaymentsExporter() 1090 exporter.export_all(self.app, self.outfile) 1091 result = open(self.outfile, 'rb').read() 1092 # only accommodation payments are exported 1093 self.assertEqual( 1094 result, 1095 'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,' 1096 'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,' 1097 'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,' 1098 'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n' 1099 'abc,12.12,%s-04-01 13:12:01#,bed_allocation,1,id1,xyz,100,%s,' 1100 'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,' 1101 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1102 'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,1,id2,xyz,100,%s,' 1103 'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,' 1104 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1105 % (curr_year-6, curr_year-6, curr_year-6, 1106 curr_year-6, curr_year-6, curr_year-6) 1045 1107 ) 1046 1108 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r15246 r15277 1114 1114 'studentpayments', 'studentunpaidpayments', 1115 1115 'bedtickets', 'sfpaymentsoverview', 'sessionpaymentsoverview', 1116 'studylevelsoverview', 'combocard', 'bursary') 1116 'studylevelsoverview', 'combocard', 'bursary', 1117 'accommodationpayments') 1117 1118 1118 1119 #: A tuple containing all exporter names needed for backing
Note: See TracChangeset for help on using the changeset viewer.