Changeset 15664 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 13 Oct 2019, 19:15:33 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15642 r15664 1985 1985 grok.template('onlinepaymentaddform') 1986 1986 grok.require('waeup.payStudent') 1987 form_fields = grok.AutoFields(IStudentOnlinePayment).select( 1988 'p_category') 1987 form_fields = grok.AutoFields(IStudentOnlinePayment).select('p_combi') 1989 1988 label = _('Add online payment') 1990 1989 pnav = 4 … … 1999 1998 @action(_('Create ticket'), style='primary') 2000 1999 def createTicket(self, **data): 2001 p_category = data['p_category'] 2002 previous_session = data.get('p_session', None) 2003 previous_level = data.get('p_level', None) 2000 form = self.request.form 2001 p_category = form.get('form.p_category', None) 2002 p_combi = form.get('form.p_combi', None) 2003 if isinstance(form.get('form.p_combi', None), unicode): 2004 p_combi = [p_combi,] 2004 2005 student = self.context.__parent__ 2005 2006 # The hostel_application payment category is temporarily used … … 2020 2021 students_utils = getUtility(IStudentsUtils) 2021 2022 error, payment = students_utils.setPaymentDetails( 2022 p_category, student, previous_session, previous_level)2023 p_category, student, None, None, p_combi) 2023 2024 if error is not None: 2024 2025 self.flash(error, type="danger") 2025 2026 return 2026 2027 if p_category == 'transfer': 2027 payment.p_item = self.request.form['new_programme']2028 payment.p_item = form['new_programme'] 2028 2029 self.context[payment.p_id] = payment 2029 2030 self.flash(_('Payment ticket created.')) … … 2061 2062 students_utils = getUtility(IStudentsUtils) 2062 2063 error, payment = students_utils.setPaymentDetails( 2063 p_category, student, previous_session, previous_level )2064 p_category, student, previous_session, previous_level, None) 2064 2065 if error is not None: 2065 2066 self.flash(error, type="danger") -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/onlinepaymentaddform.pt
r13577 r15664 10 10 <td> 11 11 <select id="form.p_category" name="form.p_category" size="1" 12 class="form-control half" onclick=" test()">12 class="form-control half" onclick="further()"> 13 13 <option tal:repeat="item view/selectable_categories" 14 14 tal:attributes="value python:item[0]"> … … 18 18 </td> 19 19 </tr> 20 </tbody> 21 </table> 22 23 <table id="widgets" class="form-table" style="display: none;"> 24 <tbody> 25 <tal:widgets content="structure provider:widgets" /> 20 26 </tbody> 21 27 </table> … … 47 53 48 54 <script type="text/javascript"> 49 function test() {55 function further() { 50 56 if (document.getElementById('form.p_category').value == 'transfer') { 51 57 document.getElementById('p_item').style.display = 'block'; … … 53 59 document.getElementById('p_item').style.display = 'none'; 54 60 } 61 if (document.getElementById('form.p_category').value == 'combi') { 62 document.getElementById('widgets').style.display = 'block'; 63 } else { 64 document.getElementById('widgets').style.display = 'none'; 65 } 55 66 } 56 67 </script> -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r15609 r15664 83 83 84 84 def setPaymentDetails(category, student, previous_session=None, 85 previous_level=None, ):85 previous_level=None, combi=None): 86 86 """Create Payment object and set the payment data of a student for 87 87 the payment category specified. -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15624 r15664 3834 3834 self.browser.headers['content-disposition']) 3835 3835 self.assertTrue( 3836 '666,12.12,2012-12-13 00:00:00#,schoolfee, 1,my-id,p-item,100,2013,'3836 '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,' 3837 3837 'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,' 3838 3838 'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents) … … 3880 3880 self.browser.headers['content-disposition']) 3881 3881 self.assertTrue( 3882 '666,12.12,2012-12-13 00:00:00#,schoolfee, 1,my-id,p-item,100,2013,'3882 '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,' 3883 3883 'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,' 3884 3884 'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents) … … 4237 4237 self.browser.headers['content-disposition']) 4238 4238 self.assertTrue( 4239 '666,12.12,2012-12-13 00:00:00#,schoolfee, 1,my-id,p-item,100,2013,'4239 '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,' 4240 4240 'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,' 4241 4241 'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents) … … 4263 4263 self.browser.headers['content-disposition']) 4264 4264 self.assertTrue( 4265 '666,12.12,2012-12-13 00:00:00#,schoolfee, 1,my-id,p-item,100,2013,'4265 '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,' 4266 4266 'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,' 4267 4267 'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r15609 r15664 823 823 self.assertEqual( 824 824 result, 825 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'825 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 826 826 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 827 827 'r_code,r_desc,student_id,state,current_session\r\n' 828 828 829 ',0.0,2012-04-01 13:12:01#,, 1,,,,,unpaid,,0.0,,,,,\r\n'829 ',0.0,2012-04-01 13:12:01#,,[],1,,,,,unpaid,,0.0,,,,,\r\n' 830 830 ) 831 831 return … … 841 841 self.assertEqual( 842 842 result, 843 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'843 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 844 844 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 845 845 'r_code,r_desc,student_id,state,current_session\r\n' 846 846 847 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,'847 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,' 848 848 'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,' 849 849 'r-code,,A111111,created,2012\r\n' … … 861 861 self.assertEqual( 862 862 result, 863 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'863 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 864 864 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 865 865 'r_code,r_desc,student_id,state,current_session\r\n' 866 866 867 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,'867 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,' 868 868 'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,' 869 869 'r-code,,A111111,created,2012\r\n' … … 881 881 self.assertEqual( 882 882 result, 883 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'883 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 884 884 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 885 885 'r_code,r_desc,student_id,state,current_session\r\n' 886 886 887 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,'887 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,' 888 888 'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,' 889 889 'r-code,,A111111,created,2012\r\n' … … 904 904 self.assertEqual( 905 905 result, 906 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'906 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 907 907 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 908 908 'r_code,r_desc,student_id,state,current_session\r\n' 909 909 910 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,'910 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,' 911 911 'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,' 912 912 'r-code,,A111111,created,2012\r\n' … … 942 942 self.assertEqual( 943 943 result, 944 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'944 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 945 945 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 946 946 'r_code,r_desc,student_id,state,current_session\r\n' 947 947 948 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,'948 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,' 949 949 'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,' 950 950 'r-code,,A111111,created,2012\r\n' … … 960 960 self.assertEqual( 961 961 result, 962 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'962 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 963 963 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 964 964 'r_code,r_desc,student_id,state,current_session\r\n' … … 971 971 self.assertEqual( 972 972 result, 973 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'973 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 974 974 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 975 975 'r_code,r_desc,student_id,state,current_session\r\n' … … 984 984 self.assertEqual( 985 985 result, 986 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'986 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 987 987 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 988 988 'r_code,r_desc,student_id,state,current_session\r\n' … … 1009 1009 self.assertEqual( 1010 1010 result, 1011 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'1011 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 1012 1012 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 1013 1013 'r_code,r_desc,student_id,state,current_session\r\n' … … 1019 1019 self.assertEqual( 1020 1020 result, 1021 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,'1021 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,' 1022 1022 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 1023 1023 'r_code,r_desc,student_id,state,current_session\r\n' 1024 1024 1025 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,'1025 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,' 1026 1026 'p-item,100,%s,unpaid,%s-04-01 14:12:01#,12.12,' 1027 1027 'r-code,,A111111,created,2012\r\n' … … 1048 1048 self.assertEqual( 1049 1049 result, 1050 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,p_item,'1050 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,p_item,' 1051 1051 'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,' 1052 1052 'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,' 1053 1053 'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n' 1054 1054 1055 '666,12.12,%s-04-01 13:12:01#,schoolfee, 1,my-id,p-item,100,%s,'1055 '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,p-item,100,%s,' 1056 1056 'paid,%s-04-01 14:12:01#,12.12,r-code,,A111111,234,123,' 1057 1057 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' … … 1107 1107 self.assertEqual( 1108 1108 result, 1109 'ac,amount_auth,creation_date,p_category,p_c urrent,p_id,p_item,'1109 'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,p_item,' 1110 1110 'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,' 1111 1111 'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,' 1112 1112 'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n' 1113 'abc,12.12,%s-04-01 13:12:01#,bed_allocation, 1,id1,xyz,100,%s,'1113 'abc,12.12,%s-04-01 13:12:01#,bed_allocation,[],1,id1,xyz,100,%s,' 1114 1114 'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,' 1115 1115 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1116 'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance, 1,id2,xyz,100,%s,'1116 'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,[],1,id2,xyz,100,%s,' 1117 1117 'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,' 1118 1118 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r15662 r15664 403 403 404 404 def setPaymentDetails(self, category, student, 405 previous_session, previous_level ):405 previous_session, previous_level, combi): 406 406 """Create a payment ticket and set the payment data of a 407 407 student for the payment category specified. … … 493 493 else: 494 494 return _(u'No bed allocated.'), None 495 elif category == 'combi' and combi: 496 categories = getUtility(IKofaUtils).COMBI_PAYMENT_CATEGORIES 497 for cat in combi: 498 fee_name = cat + '_fee' 499 cat_amount = getattr(academic_session, fee_name, 0.0) 500 if not cat_amount: 501 return _('%s undefined.' % categories[cat]), None 502 amount += cat_amount 503 p_item += u'%s + ' % categories[cat] 504 p_item = p_item.strip(' + ') 495 505 else: 496 506 fee_name = category + '_fee'
Note: See TracChangeset for help on using the changeset viewer.