Index: main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py
===================================================================
--- main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py	(revision 9500)
+++ main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py	(revision 9525)
@@ -93,5 +93,5 @@
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
         self.browser.open(self.payments_path)
-        self.browser.getControl("Add online payment ticket").click()
+        self.browser.getLink("Add current session payment ticket").click()
         self.browser.getControl("Create ticket").click()
         self.assertMatches('...Amount could not be determined...',
@@ -164,6 +164,14 @@
         self.browser.getControl(name="form.p_category").value = ['schoolfee']
         self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
+        # Uups, we forgot to add a session configuration for next session
+        self.assertTrue('Session configuration object is not available.'
+            in self.browser.contents)
+        configuration = createObject('waeup.SessionConfiguration')
+        configuration.academic_session = 2005
+        self.app['configuration'].addSessionConfiguration(configuration)
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+
         # In state admitted school fee can't be determined
         IWorkflowState(self.student).setState('admitted')
@@ -174,12 +182,17 @@
                            self.browser.contents)
 
-        # If the session configuration doesn't exist an error message will
-        # be shown. No other requirement is being checked.
-        del self.app['configuration']['2004']
-        self.browser.open(self.payments_path)
-        self.browser.getControl("Add online payment ticket").click()
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Session configuration object is not...',
-                           self.browser.contents)
+    def test_student_payments(self):
+        # Login
+        IWorkflowState(self.student).setState('returning')
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        self.browser.open(self.student_path + '/payments')
+        self.assertTrue(
+          'Add current session payment ticket' in self.browser.contents)
+        self.assertFalse(
+          'Add previous session payment ticket' in self.browser.contents)
+        return
 
     def test_get_returning_data(self):
@@ -214,4 +227,9 @@
 
         IWorkflowState(self.student).setState('returning')
+        error, payment = utils.setPaymentDetails('schoolfee',self.student)
+        self.assertEqual('Session configuration object is not available.', error)
+        configuration = createObject('waeup.SessionConfiguration')
+        configuration.academic_session = 2005
+        self.app['configuration'].addSessionConfiguration(configuration)
         error, payment = utils.setPaymentDetails('schoolfee',self.student)
         self.assertEqual(payment.p_level, 200)
Index: main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py
===================================================================
--- main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py	(revision 9500)
+++ main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py	(revision 9525)
@@ -71,9 +71,8 @@
         p_level = student['studycourse'].current_level
         p_current = True
-        session = str(p_session)
-        try:
-            academic_session = grok.getSite()['configuration'][session]
-        except KeyError:
+        academic_session = self._getSessionConfiguration(p_session)
+        if academic_session == None:
             return _(u'Session configuration object is not available.'), None
+        # Determine fee.
         if category == 'transfer':
             amount = academic_session.transfer_fee
@@ -202,5 +201,9 @@
                         amount = 17400
             if student.state == RETURNING:
+                # Override p_session and p_level
                 p_session, p_level = self.getReturningData(student)
+                academic_session = self._getSessionConfiguration(p_session)
+                if academic_session == None:
+                    return _(u'Session configuration object is not available.'), None
 
         if amount in (0.0, None):
Index: main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py
===================================================================
--- main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py	(revision 9525)
+++ main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py	(revision 9525)
@@ -0,0 +1,25 @@
+## $Id$
+##
+## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+
+from waeup.kofa.students.viewlets import AddPreviousPaymentActionButton
+
+class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
+
+    @property
+    def target_url(self):
+        return ''
