Changeset 16309 for main/kofacustom.dspg/trunk/src/kofacustom/dspg/students
- Timestamp:
- 10 Nov 2020, 14:33:53 (4 years ago)
- Location:
- main/kofacustom.dspg/trunk/src/kofacustom/dspg/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_utils.py
r15360 r16309 88 88 self.assertEqual(payment.p_session, 2005) 89 89 self.assertEqual(payment.amount_auth, 3150.0) 90 # Students can pay school fee if dep_sug hasbeen paid first.90 # Students can pay school fee if dep_sug and gns dues have been paid first. 91 91 error, payment = utils.setPaymentDetails('schoolfee',self.student) 92 self.assertEqual(error, u'You have to pay NADESU/SA/SUG Dues first.')92 self.assertEqual(error, u'You have to pay NADESU/SA/SUG and GNS Dues first.') 93 93 error, payment = utils.setPaymentDetails('dep_sug',self.student) 94 94 self.student['payments']['any_key'] = payment 95 95 error, payment = utils.setPaymentDetails('schoolfee',self.student) 96 self.assertEqual(error, u'You have to pay NADESU/SA/SUG Dues first.') 96 self.assertEqual(error, u'You have to pay NADESU/SA/SUG and GNS Dues first.') 97 98 configuration.gns_1_fee = 1150.0 99 error, payment2 = utils.setPaymentDetails('gns_1',self.student) 100 self.student['payments']['any_key2'] = payment2 101 self.assertEqual(payment2.p_level, 200) 102 self.assertEqual(payment2.p_session, 2005) 103 self.assertEqual(payment2.amount_auth, 1150.0) 104 error, payment = utils.setPaymentDetails('schoolfee',self.student) 105 97 106 self.student['payments']['any_key'].p_state = 'paid' 107 self.student['payments']['any_key2'].p_state = 'paid' 98 108 error, payment = utils.setPaymentDetails('schoolfee',self.student) 99 109 self.assertEqual(error, None) -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py
r16155 r16309 38 38 STUDENT_ID_PREFIX = u'P' 39 39 40 def _dep_sug_ paymentMade(self, student, session):40 def _dep_sug_gns_paymentMade(self, student, session): 41 41 if student.state == RETURNING: 42 42 session += 1 43 dep_sug = False 44 gns = False 43 45 if len(student['payments']): 44 46 for ticket in student['payments'].values(): … … 46 48 ticket.p_category == 'dep_sug' and \ 47 49 ticket.p_session == session: 50 dep_sug = True 51 if ticket.p_state == 'paid' and \ 52 ticket.p_category.startswith('gns') and \ 53 ticket.p_session == session: 54 gns = True 55 if dep_sug and gns: 48 56 return True 49 57 return False … … 163 171 else: 164 172 # Students are only allowed to pay school fee 165 # if current session dep_sug payment has been made.166 if student.faccode != 'SPAT' and not self._dep_sug_ paymentMade(173 # if current session dep_sug_gns payment has been made. 174 if student.faccode != 'SPAT' and not self._dep_sug_gns_paymentMade( 167 175 student, student.current_session): 168 return _('You have to pay NADESU/SA/SUG Dues first.'), None176 return _('You have to pay NADESU/SA/SUG and GNS Dues first.'), None 169 177 penalty = getattr(academic_session, 'lsfp_penalty_fee') 170 178 if penalty and not self._lsfp_penalty_paymentMade( … … 257 265 if student.state == RETURNING and not previous_session: 258 266 p_session, p_level = self.getReturningData(student) 267 elif category.startswith('gns'): 268 if student.state == RETURNING and not previous_session: 269 p_session, p_level = self.getReturningData(student) 270 fee_name = category + '_fee' 271 academic_session = self._getSessionConfiguration(p_session) 272 amount = getattr(academic_session, fee_name, 0.0) 259 273 else: 260 274 fee_name = category + '_fee'
Note: See TracChangeset for help on using the changeset viewer.