Index: /main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- /main/waeup.kofa/trunk/CHANGES.txt	(revision 15663)
+++ /main/waeup.kofa/trunk/CHANGES.txt	(revision 15664)
@@ -4,4 +4,6 @@
 1.6.1.dev0 (unreleased)
 =======================
+
+* Implement combi payments.
 
 * Make max file size customizable.
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py	(revision 15664)
@@ -288,8 +288,8 @@
         cdate = str('%s#' % self.applicant['p120'].creation_date)
         self.assertEqual(
-            'ac,amount_auth,creation_date,p_category,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
             'p_item,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
-            ',0.0,%s,application,p120,,2012,paid,,0.0,,,dp2011_654321,'
+            ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
             '123456,Anna M. Tester\r\n' % cdate, result)
         return
@@ -302,8 +302,8 @@
         cdate = str('%s#' % self.applicant['p120'].creation_date)
         self.assertEqual(
-            'ac,amount_auth,creation_date,p_category,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
             'p_item,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
-            ',0.0,%s,application,p120,,2012,paid,,0.0,,,dp2011_654321,'
+            ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
             '123456,Anna M. Tester\r\n' % cdate, result)
         return
@@ -317,8 +317,8 @@
         cdate = str('%s#' % self.applicant['p120'].creation_date)
         self.assertEqual(
-            'ac,amount_auth,creation_date,p_category,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
             'p_item,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
-            ',0.0,%s,application,p120,,2012,paid,,0.0,,,dp2011_654321,'
+            ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
             '123456,Anna M. Tester\r\n' % cdate, result)
         return
Index: /main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py	(revision 15664)
@@ -303,5 +303,5 @@
     """A zope.schema-like field for usage in interfaces.
 
-    Marker interface to distuingish result entries from ordinary
+    Marker interface to distuingish referee entries from ordinary
     object fields. Needed for registration of widgets.
     """
Index: /main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py	(revision 15664)
@@ -37,4 +37,11 @@
     DICT_NAME = 'PAYMENT_CATEGORIES'
 
+class CombiPaymentCategorySource(ContextualDictSourceFactoryBase):
+    """A payment category source delivers all categories of payments.
+
+    """
+    #: name of dict to deliver from kofa utils.
+    DICT_NAME = 'COMBI_PAYMENT_CATEGORIES'
+
 class IPaymentsContainer(IKofaObject):
     """A container for all kind of payment objects.
@@ -59,4 +66,13 @@
         default = None,
         required = False,
+        )
+
+    p_combi = schema.List(
+        title = _(u'Combi Payment'),
+        value_type = schema.Choice(
+            source = CombiPaymentCategorySource(),
+            ),
+        required = False,
+        defaultFactory=list,
         )
 
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 15664)
@@ -1985,6 +1985,5 @@
     grok.template('onlinepaymentaddform')
     grok.require('waeup.payStudent')
-    form_fields = grok.AutoFields(IStudentOnlinePayment).select(
-        'p_category')
+    form_fields = grok.AutoFields(IStudentOnlinePayment).select('p_combi')
     label = _('Add online payment')
     pnav = 4
@@ -1999,7 +1998,9 @@
     @action(_('Create ticket'), style='primary')
     def createTicket(self, **data):
-        p_category = data['p_category']
-        previous_session = data.get('p_session', None)
-        previous_level = data.get('p_level', None)
+        form = self.request.form
+        p_category = form.get('form.p_category', None)
+        p_combi = form.get('form.p_combi', None)
+        if isinstance(form.get('form.p_combi', None), unicode):
+            p_combi = [p_combi,]
         student = self.context.__parent__
         # The hostel_application payment category is temporarily used
@@ -2020,10 +2021,10 @@
         students_utils = getUtility(IStudentsUtils)
         error, payment = students_utils.setPaymentDetails(
-            p_category, student, previous_session, previous_level)
+            p_category, student, None, None, p_combi)
         if error is not None:
             self.flash(error, type="danger")
             return
         if p_category == 'transfer':
-            payment.p_item = self.request.form['new_programme']
+            payment.p_item = form['new_programme']
         self.context[payment.p_id] = payment
         self.flash(_('Payment ticket created.'))
@@ -2061,5 +2062,5 @@
         students_utils = getUtility(IStudentsUtils)
         error, payment = students_utils.setPaymentDetails(
-            p_category, student, previous_session, previous_level)
+            p_category, student, previous_session, previous_level, None)
         if error is not None:
             self.flash(error, type="danger")
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/onlinepaymentaddform.pt
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/onlinepaymentaddform.pt	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/onlinepaymentaddform.pt	(revision 15664)
@@ -10,5 +10,5 @@
         <td>
           <select id="form.p_category" name="form.p_category" size="1"
-                  class="form-control half" onclick="test()">
+                  class="form-control half" onclick="further()">
             <option tal:repeat="item view/selectable_categories"
                     tal:attributes="value python:item[0]">
@@ -18,4 +18,10 @@
         </td>
       </tr>
+    </tbody>
+  </table>
+
+  <table id="widgets" class="form-table" style="display: none;">
+    <tbody>
+      <tal:widgets content="structure provider:widgets" />
     </tbody>
   </table>
@@ -47,5 +53,5 @@
 
 <script type="text/javascript">
-  function test() {
+  function further() {
       if (document.getElementById('form.p_category').value == 'transfer') {
           document.getElementById('p_item').style.display = 'block';
@@ -53,4 +59,9 @@
           document.getElementById('p_item').style.display = 'none';
       }
+      if (document.getElementById('form.p_category').value == 'combi') {
+          document.getElementById('widgets').style.display = 'block';
+      } else {
+          document.getElementById('widgets').style.display = 'none';
+      }
   }
 </script>
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py	(revision 15664)
@@ -83,5 +83,5 @@
 
     def setPaymentDetails(category, student, previous_session=None,
-            previous_level=None,):
+            previous_level=None, combi=None):
         """Create Payment object and set the payment data of a student for
         the payment category specified.
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 15664)
@@ -3834,5 +3834,5 @@
             self.browser.headers['content-disposition'])
         self.assertTrue(
-            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
+            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
             'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
@@ -3880,5 +3880,5 @@
             self.browser.headers['content-disposition'])
         self.assertTrue(
-            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
+            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
             'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
@@ -4237,5 +4237,5 @@
             self.browser.headers['content-disposition'])
         self.assertTrue(
-            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
+            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
             'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
@@ -4263,5 +4263,5 @@
             self.browser.headers['content-disposition'])
         self.assertTrue(
-            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
+            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
             'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py	(revision 15664)
@@ -823,9 +823,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            ',0.0,2012-04-01 13:12:01#,,1,,,,,unpaid,,0.0,,,,,\r\n'
+            ',0.0,2012-04-01 13:12:01#,,[],1,,,,,unpaid,,0.0,,,,,\r\n'
             )
         return
@@ -841,9 +841,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
             'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
             'r-code,,A111111,created,2012\r\n'
@@ -861,9 +861,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
             'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
             'r-code,,A111111,created,2012\r\n'
@@ -881,9 +881,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
             'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
             'r-code,,A111111,created,2012\r\n'
@@ -904,9 +904,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
             'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
             'r-code,,A111111,created,2012\r\n'
@@ -942,9 +942,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
             'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
             'r-code,,A111111,created,2012\r\n'
@@ -960,5 +960,5 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
@@ -971,5 +971,5 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
@@ -984,5 +984,5 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
@@ -1009,5 +1009,5 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
@@ -1019,9 +1019,9 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
             'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
             'r_code,r_desc,student_id,state,current_session\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
             'p-item,100,%s,unpaid,%s-04-01 14:12:01#,12.12,'
             'r-code,,A111111,created,2012\r\n'
@@ -1048,10 +1048,10 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,p_item,'
             'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,'
             'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,'
             'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n'
 
-            '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,p-item,100,%s,'
+            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,p-item,100,%s,'
             'paid,%s-04-01 14:12:01#,12.12,r-code,,A111111,234,123,'
             'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n'
@@ -1107,12 +1107,12 @@
         self.assertEqual(
             result,
-            'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,'
+            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,p_item,'
             'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,'
             'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,'
             'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n'
-            'abc,12.12,%s-04-01 13:12:01#,bed_allocation,1,id1,xyz,100,%s,'
+            'abc,12.12,%s-04-01 13:12:01#,bed_allocation,[],1,id1,xyz,100,%s,'
             'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,'
             'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n'
-            'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,1,id2,xyz,100,%s,'
+            'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,[],1,id2,xyz,100,%s,'
             'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,'
             'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n'
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py	(revision 15664)
@@ -403,5 +403,5 @@
 
     def setPaymentDetails(self, category, student,
-            previous_session, previous_level):
+            previous_session, previous_level, combi):
         """Create a payment ticket and set the payment data of a
         student for the payment category specified.
@@ -493,4 +493,14 @@
             else:
                 return _(u'No bed allocated.'), None
+        elif category == 'combi' and combi:
+            categories = getUtility(IKofaUtils).COMBI_PAYMENT_CATEGORIES
+            for cat in combi:
+                fee_name = cat + '_fee'
+                cat_amount = getattr(academic_session, fee_name, 0.0)
+                if not cat_amount:
+                    return _('%s undefined.' % categories[cat]), None
+                amount += cat_amount
+                p_item += u'%s + ' % categories[cat]
+            p_item = p_item.strip(' + ')
         else:
             fee_name = category + '_fee'
Index: /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py	(revision 15663)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py	(revision 15664)
@@ -183,5 +183,6 @@
         'app_balance': 'Application Fee Balance',
         'transcript': 'Transcript Fee',
-        'late_registration': 'Late Course Registration Fee'
+        'late_registration': 'Late Course Registration Fee',
+        'combi': 'Combi Payments',
         }
 
@@ -200,4 +201,10 @@
     BALANCE_PAYMENT_CATEGORIES = {
         'schoolfee': 'School Fee',
+        }
+
+    COMBI_PAYMENT_CATEGORIES = {
+        'gown': 'Gown Hire Fee',
+        'transcript': 'Transcript Fee',
+        'late_registration': 'Late Course Registration Fee',
         }
 
