Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6943)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6944)
@@ -43,5 +43,5 @@
     )
 from waeup.sirp.students.catalog import search
-from waeup.sirp.students.workflow import CLEARANCE
+from waeup.sirp.students.workflow import CLEARANCE, RETURNING, CLEARED
 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket
 from waeup.sirp.students.vocabularies import StudyLevelSource
@@ -1222,4 +1222,70 @@
         return
 
+class CourseRegistrationStartActionButton(ManageActionButton):
+    grok.order(1)
+    grok.context(IStudentStudyCourse)
+    grok.view(StudyCourseDisplayFormPage)
+    grok.require('waeup.handleStudent')
+    icon = 'actionicon_start.png'
+    text = 'Start course registration'
+    target = 'start_course_registration'
+
+    @property
+    def target_url(self):
+        if not self.context.getStudent().state in (CLEARED,RETURNING):
+            return ''
+        return self.view.url(self.view.context, self.target)
+
+class StartCourseRegistrationPage(WAeUPPage):
+    grok.context(IStudentStudyCourse)
+    grok.name('start_course_registration')
+    grok.require('waeup.handleStudent')
+    grok.template('enterpin')
+    title = 'Start course registration'
+    label = 'Start course registration'
+    ac_prefix = 'SFE'
+    notice = ''
+    pnav = 4
+    buttonname = 'Start course registration now'
+
+    def update(self, SUBMIT=None):
+        if not self.context.getStudent().state in (CLEARED,RETURNING):
+            self.flash("Wrong state.")
+            self.redirect(self.url(self.context))
+            return
+        self.ac_series = self.request.form.get('ac_series', None)
+        self.ac_number = self.request.form.get('ac_number', None)
+
+        if SUBMIT is None:
+            return
+        pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number)
+        code = get_access_code(pin)
+        if not code:
+            self.flash('Activation code is invalid.')
+            return
+        # Mark pin as used (this also fires a pin related transition)
+        # and fire transition start_clearance
+        if code.state == USED:
+            self.flash('Activation code has already been used.')
+            return
+        else:
+            comment = u"AC invalidated for %s" % self.context.getStudent().student_id
+            # Here we know that the ac is in state initialized so we do not
+            # expect an exception, but the owner might be different
+            if not invalidate_accesscode(
+                pin,comment,self.context.getStudent().student_id):
+                self.flash('You are not the owner of this access code.')
+                return
+        if self.context.getStudent().state == CLEARED:
+            IWorkflowInfo(self.context.getStudent()).fireTransition(
+                'pay_first_school_fee')
+        elif self.context.getStudent().state == RETURNING:
+            IWorkflowInfo(self.context.getStudent()).fireTransition(
+                'pay_school_fee')
+        self.flash('Course registration has been started.')
+        self.redirect(self.url(self.context))
+        return
+
+
 class AddStudyLevelActionButton(AddActionButton):
     grok.order(1)
