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