- Timestamp:
- 20 Sep 2012, 08:49:37 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/students/workflow.py
r8471 r9209 2 2 """ 3 3 import grok 4 from datetime import datetime 4 5 from zope.component import getUtility 5 6 from hurry.workflow.workflow import Transition, WorkflowState, NullCondition … … 12 13 from waeup.kofa.workflow import KofaWorkflow, KofaWorkflowInfo 13 14 from waeup.kofa.students.interfaces import IStudent, IStudentsUtils 15 from waeup.kofa.utils.helpers import get_current_principal 14 16 15 17 16 18 IMPORTABLE_STATES = (ADMITTED, CLEARANCE, REQUESTED, CLEARED, PAID, RETURNING, 17 19 REGISTERED, VALIDATED) 20 21 FORBIDDEN_POSTGRAD_STATES = (RETURNING, REGISTERED, VALIDATED) 18 22 19 23 REGISTRATION_TRANSITIONS = ( … … 23 27 source = None, 24 28 condition = NullCondition, 25 msg = _(' Student record created'),29 msg = _('Record created'), 26 30 destination = CREATED), 27 31 … … 29 33 transition_id = 'admit', 30 34 title = _('Admit student'), 31 msg = _(' Student admitted'),35 msg = _('Admitted'), 32 36 source = CREATED, 33 37 destination = ADMITTED), … … 63 67 Transition( 64 68 transition_id = 'reset3', 65 title = _('Reset to clearance '),66 msg = _("Reset to 'clearance '"),69 title = _('Reset to clearance started'), 70 msg = _("Reset to 'clearance started'"), 67 71 source = REQUESTED, 68 72 destination = CLEARANCE), … … 77 81 Transition( 78 82 transition_id = 'reset4', 79 title = _('Reset to clearance '),80 msg = _("Reset to 'clearance '"),83 title = _('Reset to clearance started'), 84 msg = _("Reset to 'clearance started'"), 81 85 source = CLEARED, 82 86 destination = CLEARANCE), … … 85 89 transition_id = 'pay_first_school_fee', 86 90 title = _('Pay school fee'), 87 msg = _(' School fee paid'),91 msg = _('First school fee payment made'), 88 92 source = CLEARED, 89 93 destination = PAID), … … 92 96 transition_id = 'approve_first_school_fee', 93 97 title = _('Approve payment'), 94 msg = _(' School fee payment approved'),98 msg = _('First school fee payment approved'), 95 99 source = CLEARED, 96 100 destination = PAID), … … 106 110 transition_id = 'pay_school_fee', 107 111 title = _('Pay school fee'), 108 msg = _(' Payment made'),112 msg = _('School fee payment made'), 109 113 source = RETURNING, 110 114 destination = PAID), … … 112 116 Transition( 113 117 transition_id = 'pay_pg_fee', 114 title = _('Pay postgraduateschool fee'),115 msg = _('P ayment made'),118 title = _('Pay PG school fee'), 119 msg = _('PG school fee payment made'), 116 120 source = PAID, 117 121 destination = PAID), … … 119 123 Transition( 120 124 transition_id = 'approve_school_fee', 121 title = _('Approve payment'),125 title = _('Approve school fee payment'), 122 126 msg = _('School fee payment approved'), 123 127 source = RETURNING, … … 126 130 Transition( 127 131 transition_id = 'approve_pg_fee', 128 title = _('Approve postgraduate payment'),129 msg = _(' School fee payment approved'),132 title = _('Approve PG school fee payment'), 133 msg = _('PG school fee payment approved'), 130 134 source = PAID, 131 135 destination = PAID), … … 147 151 Transition( 148 152 transition_id = 'reset7', 149 title = _('Reset to paid'),150 msg = _("Reset to ' paid'"),153 title = _('Reset to school fee paid'), 154 msg = _("Reset to 'school fee paid'"), 151 155 source = REGISTERED, 152 156 destination = PAID), … … 161 165 Transition( 162 166 transition_id = 'reset8', 163 title = _('Reset to paid'),164 msg = _("Reset to ' paid'"),167 title = _('Reset to school fee paid'), 168 msg = _("Reset to 'school fee paid'"), 165 169 source = VALIDATED, 166 170 destination = PAID), … … 175 179 Transition( 176 180 transition_id = 'reset9', 177 title = _('Reset to validated'),178 msg = _("Reset to ' validated'"),181 title = _('Reset to courses validated'), 182 msg = _("Reset to 'courses validated'"), 179 183 source = RETURNING, 180 184 destination = VALIDATED), … … 183 187 IMPORTABLE_TRANSITIONS = [i.transition_id for i in REGISTRATION_TRANSITIONS] 184 188 189 FORBIDDEN_POSTGRAD_TRANS = ['reset6', 'register_courses'] 185 190 LOCK_CLEARANCE_TRANS = ('reset2', 'request_clearance') 186 191 UNLOCK_CLEARANCE_TRANS = ('reset3', 'reset4', 'start_clearance') … … 212 217 213 218 Lock and unlock clearance form. 214 Trig er actions after school fee payment.219 Trigger actions after school fee payment. 215 220 """ 216 221 … … 231 236 new_session = obj['studycourse'].current_session + 1 232 237 obj['studycourse'].current_session = new_session 238 elif event.transition.transition_id == 'validate_courses': 239 current_level = obj['studycourse'].current_level 240 level_object = obj['studycourse'].get(str(current_level), None) 241 if level_object is not None: 242 user = get_current_principal() 243 if user is None: 244 usertitle = 'system' 245 else: 246 usertitle = getattr(user, 'public_name', None) 247 if not usertitle: 248 usertitle = user.title 249 level_object.validated_by = usertitle 250 level_object.validation_date = datetime.utcnow() 251 elif event.transition.transition_id == 'reset8': 252 current_level = obj['studycourse'].current_level 253 level_object = obj['studycourse'].get(str(current_level), None) 254 if level_object is not None: 255 level_object.validated_by = None 256 level_object.validation_date = None 233 257 # In some tests we don't have a students container 234 258 try:
Note: See TracChangeset for help on using the changeset viewer.