Index: /WAeUP_SRP/trunk/CHANGES.txt
===================================================================
--- /WAeUP_SRP/trunk/CHANGES.txt	(revision 3779)
+++ /WAeUP_SRP/trunk/CHANGES.txt	(revision 3780)
@@ -122,2 +122,6 @@
 -----------------
 - enable random bed booking order
+
+1.24 (2008-11-20)
+-----------------
+- get study_mode from certificates and ignore study_mode attribute of study_course objects
Index: /WAeUP_SRP/trunk/WAeUPImport.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPImport.py	(revision 3779)
+++ /WAeUP_SRP/trunk/WAeUPImport.py	(revision 3780)
@@ -742,5 +742,5 @@
                               'current_level',
                               'current_session',
-                              'current_mode',
+                              'current_mode',  #is no longer used and visible but can still be imported
                               'current_verdict',
                               'previous_verdict',
Index: /WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTables.py	(revision 3779)
+++ /WAeUP_SRP/trunk/WAeUPTables.py	(revision 3780)
@@ -867,5 +867,5 @@
                         'end_level', # from certificate
                         'level', # current_level
-                        'mode',  # current_mode
+                        'mode',  # from certificate
                         'session', # current_session
                         'verdict', # current_verdict
@@ -966,10 +966,21 @@
         return getattr(doc,'current_level',None)
 
+    #def get_from_doc_mode(self,doc,cached_data={}):
+    #    "return the students mode"
+    #    if doc is None:
+    #        return None
+    #    cm = getattr(doc,'current_mode',None)
+    #    return cm
+    
     def get_from_doc_mode(self,doc,cached_data={}):
         "return the students mode"
         if doc is None:
             return None
-        cm = getattr(doc,'current_mode',None)
-        return cm
+        if hasattr(self,"_v_certificates") and self._v_certificates.has_key(doc.study_course):
+            return self._v_certificates[doc.study_course]['study_mode']
+        certificate_res = self.portal_catalog(id = doc.study_course)
+        if len(certificate_res) != 1:
+            return None
+        return getattr(certificate_res[0].getObject().getContent(),'study_mode','unknown')    
 
 
Index: /WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTool.py	(revision 3779)
+++ /WAeUP_SRP/trunk/WAeUPTool.py	(revision 3780)
@@ -868,5 +868,5 @@
         dsc['current_level'] = level
         dsc['current_verdict'] = verdict
-        dsc['current_mode'] = em
+        dsc['current_mode'] = em   #no longer used
         dsc['current_session'] = '05'
         studycourse.getContent().edit(mapping=dsc)
@@ -1041,6 +1041,6 @@
         # because ug_ft has two different entry modes
                         
-        if brain.entry_mode:  
-            da['entry_mode'] = brain.entry_mode  
+        if brain.entry_mode:                      # does not happen because import_application 
+            da['entry_mode'] = brain.entry_mode   # schema has no field entry_mode
         elif brain.screening_type == 'pume':  
             da['entry_mode'] = 'ume_ft'  
@@ -1116,5 +1116,5 @@
         dsc['study_course'] = brain.course_admitted
         dsc['current_verdict'] = ''
-        dsc['current_mode'] = da['entry_mode']
+        dsc['current_mode'] = da['entry_mode'] # no longer used
         if da['entry_mode'].startswith('de'):
             dsc['current_level'] = '200'
Index: /WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml	(revision 3779)
+++ /WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml	(revision 3780)
@@ -119,7 +119,4 @@
    <cell name="current_level"/>
   </row>
-  <row>
-   <cell name="current_mode"/>
-  </row>
  </table>
 </object>
Index: /WAeUP_SRP/trunk/profiles/futminna/layouts/members.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/futminna/layouts/members.xml	(revision 3779)
+++ /WAeUP_SRP/trunk/profiles/futminna/layouts/members.xml	(revision 3780)
@@ -116,5 +116,5 @@
   <property name="display_width">20</property>
   <property name="size_max">0</property>
-  <property name="check_words">fceokene</property>
+  <property name="check_words">minna</property>
  </widget>
 <widget name="roles" meta_type="Generic MultiSelect Widget">
Index: /WAeUP_SRP/trunk/skins/waeup_futminna/getSchoolFee.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_futminna/getSchoolFee.py	(revision 3780)
+++ /WAeUP_SRP/trunk/skins/waeup_futminna/getSchoolFee.py	(revision 3780)
@@ -0,0 +1,46 @@
+## Script (Python) "getSchoolFee"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=brain=None
+##title=
+##
+# $Id: getSchoolFee.py 2534 2007-11-05 06:37:12Z henrik $
+"""
+return SchoolFee
+"""
+
+
+d = {}
+
+if brain.mode.endswith('_ft'):
+    # fresh remedial
+    if str(brain.level) == '000' and brain.review_state == 'cleared_and_validated':
+        d['all'] = 70000
+    # fresh
+    elif str(brain.level) == '100' and brain.review_state == 'cleared_and_validated':
+        if brain.lga == 'foreigner':
+            d['all'] = 131500
+        else:
+            d['all'] = 41500
+    # returning
+    elif brain.review_state == 'returning':
+        if brain.lga == 'foreigner':
+            d['all'] = 109500
+        else:
+            d['all'] = 19500
+    else:
+        d['all'] = 0
+else:
+    d['all'] = 0
+
+
+next_info = context.getNextInfo(brain)
+next_session_str = next_info['next_session_str']
+d['next_session_id'] = next_info['next_session_id']
+d['description'] = "School Fee for Session %s" % next_session_str
+
+return d
+
Index: /WAeUP_SRP/trunk/skins/waeup_futminna/pay_interswitch.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_futminna/pay_interswitch.py	(revision 3780)
+++ /WAeUP_SRP/trunk/skins/waeup_futminna/pay_interswitch.py	(revision 3780)
@@ -0,0 +1,182 @@
+## Script (Python) "pay_online"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: pay_interswitch.py 2619 2007-11-10 17:39:36Z henrik $
+"""
+pay online
+"""
+from urllib import urlencode
+import logging
+logger = logging.getLogger('Skins.pay_interswitch')
+import DateTime
+
+if context.portal_membership.isAnonymousUser():
+    return None
+
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+request = context.REQUEST
+wftool = context.portal_workflow
+students = context.portal_url.getPortalObject().campus.students
+
+
+student_id = context.getStudentId()
+student = getattr(students,student_id)
+
+student_record = context.students_catalog.getRecordByKey(student_id)
+#amount,description = context.getSchoolFee(student_record.faculty,student_record.session,student_record.course)
+info = {}
+info['student'] = student_record
+info['payment_possible'] = False
+info['amount'] = '0'
+info['bank'] = ''
+info['type_description'] = ''
+info['pay_bill_to'] = ''
+fee_dict = context.getSchoolFee(student_record)
+fulltime = student_record.mode.endswith('_ft')
+
+if not fee_dict:
+    return context.interswitch_form(info=info)
+
+info['site_id'] = '117'
+info['currency_id'] = '566'
+pay_item_id = "11700"
+
+info['bank'] = ''
+info['payment_possible'] = True
+info['type_description'] = fee_dict['description']
+info['pay_bill_to'] = student_record.name
+info['student_id'] = student_id
+info['student_name'] = student_record.name
+info['type'] = 'online'
+info['status'] = 'started'
+info['session_id'] = fee_dict['next_session_id']
+info['item'] = student_record.course
+info['category'] = 'schoolfee'
+info['student_email'] = student_record.email
+now = DateTime.DateTime()
+info['date'] = now
+info['pay_ship_to'] = "Federal University of Technology, Minna, Nigeria"
+timestamp = "%d" % int(now.timeTime()*1000)
+info['order_id'] = "%s%s" % (student_id[1:],timestamp)
+p_id = "p%s" % timestamp
+
+
+info['surcharge'] = interswitch_amount = '300'
+info['amount'] = amount = fee_dict['all']
+total_amount = 100*int(amount) + 100*int(interswitch_amount)
+
+
+if student_id is None:
+    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
+
+if True:
+    info['action'] = "https://webpay.interswitchng.com/paydirect/webpay/pay.aspx"
+else:
+    info['action'] = "%s/payments/%s/simulate_callback" % (student.absolute_url(),p_id)
+
+
+if "payments" not in student.objectIds():
+    student.invokeFactory('PaymentsFolder','payments')
+    payments = getattr(student,'payments')
+    d = {}
+    d['Title'] = 'Payments'
+    payments.getContent().edit(mapping=d)
+    wftool.doActionFor(payments,'open')
+else:
+    payments = getattr(student,'payments')
+if request.has_key('epayment'):
+    return context.interswitch_form(info=info)
+
+
+payments.invokeFactory('Payment', p_id)
+payment = getattr(payments,p_id)
+wftool.doActionFor(payment,'open')
+d = {}
+d.update(info)
+payment.getContent().edit(mapping=d)
+
+
+info['callback_url'] = "%s/payments/%s/interswitch_cb?echo=%s" % (student.absolute_url(),
+                                                                  p_id,
+                                                                  p_id)
+
+logger.info('%(student_id)s initiated online school fee payment with order_id %(order_id)s and callback url %(callback_url)s' % info)
+payment_fields = (('product_id','site_id'),
+                  ('site_redirect_url','callback_url'),
+                  ('Currency','currency_id'),
+                  ('cust_id','student_id'),
+                  ('cust_id_desc','type_description'),
+                  ('cust_name','student_name'),
+                  ('txn_ref','order_id'),
+                  ('Amount','amount'),
+                  )
+args = {}
+for arg,field in payment_fields:
+    args[arg] = info[field]
+
+bt_amount = 1200
+#fut_split = 0000
+fut_amount = amount - bt_amount 
+
+xmldict = {}
+xmldict['detail_ref'] = args['txn_ref']
+xmldict['department'] = student_record.department
+xmldict['level'] = student_record.level
+xmldict['faculty'] = student_record.faculty
+xmldict['fut_amount'] = "%d" % int(100*fut_amount)
+xmldict['bt_amount'] = "%d" % int(100*bt_amount)
+#xmldict['fut_split'] = "%d" % int(100*fut_split)
+
+#students at all levels pay their school fees to different banks
+if student_record.review_state == 'cleared_and_validated' and student_record.level in ('100'):
+    xmldict['fut_acct'] = "6013803345"
+    xmldict['bank_id'] = '7' #check for Zenith Bank code
+elif student_record.review_state == 'returning' and student_record.level in ('100'):    
+    xmldict['fut_acct'] = "0030001000017110"
+    xmldict['bank_id'] = '89' #Intercontinental Bank code
+elif student_record.level in ('200'):
+    xmldict['fut_acct'] = "2522040000134"
+    xmldict['bank_id'] = '8' #check for First Bank code 
+elif student_record.level in ('300','400'):
+    xmldict['fut_acct'] = "0591201005146"
+    xmldict['bank_id'] = '8' #check for Oceanic Bank code 
+#remedial students
+elif student_record.level in ('000'):
+    xmldict['fut_acct'] = "00000000000"
+    xmldict['bank_id'] = '8' #check for Bank code & account number for remedial          
+else:
+    xmldict['fut_acct'] = "0000000000000"
+    xmldict['bank_id'] = '0'
+
+
+xmltext = """<payment_item_detail>
+<item_details detail_ref="%(detail_ref)s" college="FUT Minna" department="%(department)s" faculty="%(faculty)s">
+<item_detail item_id="1" item_name="FUT Minna School Fee" item_amt="%(fut_amount)s" bank_id="%(bank_id)s" acct_num="%(fceokene_acct)s" />
+<item_detail item_id="2" item_name="BT" item_amt="%(bt_amount)s" bank_id="89" acct_num="0061001000021095" />
+</item_details>
+</payment_item_detail>""" % xmldict
+
+info['xml_data'] = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
+
+args['Amount'] = "%d" % (total_amount)
+args['site_name'] = "futminna.waeup.org"
+args['cust_name_desc'] = "Student Name"
+args['pay_item_id'] = pay_item_id
+args['pay_item_name'] = "FUT Minna Tuition Payments"
+args['payment_params'] = 'college_split'
+#args['xml_data'] = ''
+#args['xml_data'] = xmltext   # info['xml_data']can be used instead
+info['args'] = args
+
+return context.goto_interswitch_form(info=info)
+
Index: /WAeUP_SRP/trunk/skins/waeup_utilities/ti_507_resolve.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_utilities/ti_507_resolve.py	(revision 3779)
+++ /WAeUP_SRP/trunk/skins/waeup_utilities/ti_507_resolve.py	(revision 3780)
@@ -69,7 +69,8 @@
             d['study_course'] = student.course
             d['matric_no'] = student.matric_no
+            d['entry_mode'] = student.entry_mode
             wrong[student.id] = d
             if (student.mode,study_mode) not in (('ume_ft', 'ug_ft'),('de_pt', 'ug_pt'),('de_ft', 'ug_ft')):
-                logger.info("; %(student_id)s;  %(matric_no)s ; %(study_course)s ; %(current_mode_old)s ; %(current_mode)s" % d)
+                logger.info("; %(student_id)s;  %(matric_no)s ; %(study_course)s ; %(entry_mode)s ; %(current_mode_old)s ; %(current_mode)s" % d)
     # if wrong and not (len(wrong) % commit_after):
     #     logger.info('found %d wrong of %d' % (len(wrong),count))
@@ -81,4 +82,7 @@
 
 return
+
+# the following must not be done because I've changed get_from_doc_mode in WAeUPTables. The current_mode field
+# of the study_course object is no longer used
 
 for student_id,d in wrong.items():
