Index: /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/browser/pages.py
===================================================================
--- /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/browser/pages.py	(revision 10805)
+++ /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/browser/pages.py	(revision 10806)
@@ -56,5 +56,5 @@
     """
     form_fields = grok.AutoFields(ICertificate).select(
-        'title', 'code', 'application_category')
+        'title', 'code', 'application_category', 'school_fee_1')
 
 class CustomCertificatePage(CertificatePage):
@@ -62,5 +62,5 @@
     """
     form_fields = grok.AutoFields(ICertificate).select(
-        'title', 'code', 'application_category')
+        'title', 'code', 'application_category', 'school_fee_1')
 
 class CustomCertificateManageFormPage(CertificateManageFormPage):
@@ -69,3 +69,3 @@
 
     form_fields = grok.AutoFields(ICertificate).select(
-        'title', 'application_category')
+        'title', 'application_category', 'school_fee_1')
Index: /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/locales/en/LC_MESSAGES/waeup.kofa.po
===================================================================
--- /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/locales/en/LC_MESSAGES/waeup.kofa.po	(revision 10805)
+++ /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/locales/en/LC_MESSAGES/waeup.kofa.po	(revision 10806)
@@ -310,5 +310,5 @@
 
 msgid "admitted"
-msgstr "approved"
+msgstr "contract approved"
 
 msgid "Start new session"
@@ -324,2 +324,8 @@
 msgstr "Subscription Slip"
 
+msgid "Initial School Fee"
+msgstr "Annual Meter Charge"
+
+msgid "school fee paid"
+msgstr "meter fee paid"
+
Index: /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/utils.py
===================================================================
--- /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/utils.py	(revision 10805)
+++ /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/utils.py	(revision 10806)
@@ -30,2 +30,59 @@
     # refix
     STUDENT_ID_PREFIX = u'X'
+
+    def setPaymentDetails(self, category, student,
+            previous_session, previous_level):
+        """Create Payment object and set the payment data of a student for
+        the payment category specified.
+
+        """
+        p_item = u''
+        amount = 0.0
+        if previous_session:
+            if previous_session < student['studycourse'].entry_session:
+                return _('The previous session must not fall below '
+                         'your entry session.'), None
+            if category == 'schoolfee':
+                # School fee is always paid for the following session
+                if previous_session > student['studycourse'].current_session:
+                    return _('This is not a previous session.'), None
+            else:
+                if previous_session > student['studycourse'].current_session - 1:
+                    return _('This is not a previous session.'), None
+            p_session = previous_session
+            p_level = previous_level
+            p_current = False
+        else:
+            p_session = student['studycourse'].current_session
+            p_level = student['studycourse'].current_level
+            p_current = True
+        academic_session = self._getSessionConfiguration(p_session)
+        if academic_session == None:
+            return _(u'Session configuration object is not available.'), None
+        # Determine fee.
+        if category == 'schoolfee':
+            try:
+                certificate = student['studycourse'].certificate
+                p_item = certificate.code
+            except (AttributeError, TypeError):
+                return _('Contract data are incomplete.'), None
+            amount = getattr(certificate, 'school_fee_1', 0.0)
+        if amount in (0.0, None):
+            return _('Amount could not be determined.'), None
+        for key in student['payments'].keys():
+            ticket = student['payments'][key]
+            if ticket.p_state == 'paid' and\
+               ticket.p_category == category and \
+               ticket.p_item == p_item and \
+               ticket.p_session == p_session:
+                  return _('This type of payment has already been made.'), None
+        payment = createObject(u'waeup.StudentOnlinePayment')
+        timestamp = ("%d" % int(time()*10000))[1:]
+        payment.p_id = "p%s" % timestamp
+        payment.p_category = category
+        payment.p_item = p_item
+        payment.p_session = p_session
+        payment.p_level = p_level
+        payment.p_current = p_current
+        payment.amount_auth = amount
+        return None, payment
Index: /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/workflow.py
===================================================================
--- /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/workflow.py	(revision 10806)
+++ /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/students/workflow.py	(revision 10806)
@@ -0,0 +1,72 @@
+"""Workflow for students.
+"""
+import grok
+from datetime import datetime
+from zope.component import getUtility
+from hurry.workflow.workflow import Transition, WorkflowState, NullCondition
+from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
+from waeup.kofa.interfaces import (
+    IObjectHistory, IKofaWorkflowInfo, IKofaUtils,
+    CREATED, ADMITTED, CLEARANCE, REQUESTED, CLEARED, PAID, RETURNING,
+    REGISTERED, VALIDATED, GRADUATED, TRANSCRIPT)
+from waeup.kofa.interfaces import MessageFactory as _
+from waeup.kofa.workflow import KofaWorkflow, KofaWorkflowInfo
+from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
+from waeup.kofa.students.workflow import RegistrationWorkflowInfo
+
+
+REGISTRATION_TRANSITIONS = (
+    Transition(
+        transition_id = 'create',
+        title = _('Create customer'),
+        source = None,
+        condition = NullCondition,
+        msg = _('Record created'),
+        destination = CREATED),
+
+    Transition(
+        transition_id = 'admit',
+        title = _('Approve contract'),
+        msg = _('Contract approved'),
+        source = CREATED,
+        destination = ADMITTED),
+
+    Transition(
+        transition_id = 'reset1',
+        title = _('Reset customer to initial state'),
+        msg = _('Reset to initial state'),
+        source = ADMITTED,
+        destination = CREATED),
+
+    Transition(
+        transition_id = 'pay_meter_fee',
+        title = _('Pay meter fee'),
+        msg = _('Meter fee paid'),
+        source = ADMITTED,
+        destination = PAID),
+
+    Transition(
+        transition_id = 'approve_meter_fee_payment',
+        title = _('Approve meter fee payment'),
+        msg = _('Meter fee payment approved'),
+        source = ADMITTED,
+        destination = PAID),
+
+    Transition(
+        transition_id = 'reset2',
+        title = _("Reset customer to state 'contract approved'"),
+        msg = _("Reset to state 'contract approved'"),
+        source = PAID,
+        destination = ADMITTED),
+    )
+
+
+registration_workflow = KofaWorkflow(REGISTRATION_TRANSITIONS)
+
+class CustomRegistrationWorkflowInfo(RegistrationWorkflowInfo):
+    """Adapter to adapt Student objects to workflow info objects.
+    """
+
+    def __init__(self, context):
+        self.context = context
+        self.wf = registration_workflow
Index: /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/utils/utils.py
===================================================================
--- /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/utils/utils.py	(revision 10805)
+++ /main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/utils/utils.py	(revision 10806)
@@ -39,7 +39,6 @@
 
     PAYMENT_CATEGORIES = {
-        'electricity': 'Electricity',
+        'schoolfee': 'Meter Charge',
         'application': 'Not applicable',
-        'schoolfee': 'Not applicable',
         }
 
