Changeset 2857


Ignore:
Timestamp:
4 Dec 2007, 16:28:13 (17 years ago)
Author:
joachim
Message:
 
Location:
WAeUP_SRP
Files:
3 added
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTables.py

    r2845 r2857  
    490490    def searchAndReserveBed(self, student_id,bed_type):
    491491        #records = self.searchResults({'student' : student_id})
    492         import pdb;pdb.set_trace()
     492        #import pdb;pdb.set_trace()
    493493        records = self.evalAdvancedQuery(Eq('student',student_id))
    494494        if len(records) > 0:
  • WAeUP_SRP/base/skins/waeup_accommodation/reserve_accommodation.py

    r2454 r2857  
     1## Script (Python) "reserve_accommodation.py"
     2##bind container=container
     3##bind context=context
     4##bind namespace=
     5##bind script=script
     6##bind subpath=traverse_subpath
    17##parameters=REQUEST
    28# $Id$
     
    410process the the accommodation reservation
    511"""
     12try:
     13    from Products.zdb import set_trace
     14except:
     15    def set_trace():
     16        pass
    617import DateTime
    718current = DateTime.DateTime()
     
    2637    return context.REQUEST.RESPONSE.redirect("%s/no_booking_allowed" % info['student'].absolute_url())
    2738student = info['student']
     39student_id = info['student_id']
    2840acco_id = info['acco_id']
    29 session = info['session'][1]
     41#session = info['session'][1]
     42session = info['session']
    3043#session = acco_id[-4:]
    3144validate = REQUEST.has_key("cpsdocument_create_button")
    3245if info.has_key('acco') and info['acco']:
    3346    validate = REQUEST.has_key("cpsdocument_edit_button")
    34     if info['acco_review_state'] == "maintenance_fee_paid":
     47    if info['maintenance_paid']:
    3548        return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url())
     49    elif info['online_payment']:
     50        return context.REQUEST.RESPONSE.redirect("%s/pay_interswitch_acco?paytype=HOM" % info['student'].absolute_url())
    3651    else:
    3752        mode = 'edit'
     
    6176    else:
    6277        psm = "Error in data, unable to reserve bed."
    63     return context.accommodation_pin_edit_form(rendered = res,
     78    return context.accommodation_edit_form(rendered = res,
    6479                                 psm = psm,
    6580                                 #psm = "%s, %s" % (psm,ds),
     
    6883                                 )
    6984elif psm == '':
    70     return context.accommodation_pin_edit_form(rendered = res,
     85    return context.accommodation_edit_form(rendered = res,
    7186                                 psm = None,
    7287                                 mode = mode,
     
    7489                                 )
    7590elif psm == 'valid':
    76     s_id = ds.get('s_id')
    7791    if mode == 'create':
     92        set_trace()
    7893        pin = str(ds.get('acco_res_sc_pin'))
    79         pa = context.portal_accommodation
    80         already = pa(student=s_id)
    81         if not already:
    82             code,bed = pa.searchAndReserveBed(s_id,"%s" % (info['student_status']))
    83             #code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
     94        code,bed = context.portal_accommodation.searchAndReserveBed(student_id,
     95                                                                    "%s" % (info['student_status']))
     96        while True:
     97            if code == 1:
     98                break
    8499            if code == -1:
    85                 return context.accommodation_pin_edit_form(rendered = res,
    86                                      psm = "%s" % bed,
    87                                      mode = mode,
    88                                      ds = ds,
    89                                      )
     100                return context.accommodation_edit_form(rendered = res,
     101                                        psm = "%s" % bed,
     102                                        mode = mode,
     103                                        ds = ds,
     104                                        )
    90105            elif code == -2:
    91                 return context.accommodation_pin_edit_form(rendered = res,
    92                                      psm = "No bed available. Your category is already fully booked.",
    93                                      mode = mode,
    94                                      ds = ds,
    95                                      )
    96         else:
    97             bed = already[0].bed
     106                return context.accommodation_edit_form(rendered = res,
     107                                        psm = "No bed available. Your category is already fully booked.",
     108                                        mode = mode,
     109                                        ds = ds,
     110                                        )
     111            else: # unknown error
     112                return context.accommodation_edit_form(rendered = res,
     113                                        psm = "Unexpected Error!",
     114                                        mode = mode,
     115                                        ds = ds,
     116                                        )
    98117        student.invokeFactory('StudentAccommodation',acco_id)
    99         acco = getattr(student,acco_id)
    100         acco_info = context.waeup_tool.getHallInfo(bed)
    101         ds.set('acco_maint_code', acco_info.get('maintenance_code'))
    102         ds.set('acco_maint_fee', acco_info.get('maintenance_fee'))
     118        hall_info = context.waeup_tool.getHallInfo(bed)
     119        ds.set('acco_maint_code', hall_info.get('maintenance_code'))
     120        ds.set('acco_maint_fee', hall_info.get('maintenance_fee'))
    103121        ds.set('acco_res_date', current)
    104122        ds.set('bed', bed)
    105123        ds.set('session', session)
    106124        ds.set('student_status',info['student_status'])
     125        acco = getattr(student,acco_id)
    107126        acco.getContent().edit(mapping=ds)
    108127        #wftool.doActionFor(acco,'pay_maintenance_fee',dest_container=acco)
  • WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py

    r2836 r2857  
    1 ## Script (Python) "interswitch_cb"
     1## Script (Python) "interswitch_acco_cb"
    22##bind container=container
    33##bind context=context
     
    1818        pass
    1919import logging
    20 logger = logging.getLogger('Skins.interswitch_cb')
     20logger = logging.getLogger('Skins.interswitch_acco_cb')
    2121from AccessControl import Unauthorized
    2222import DateTime
     23current = DateTime.DateTime()
     24
    2325if context.portal_membership.isAnonymousUser():
    2426    return None
     
    5254    pd[pdk] = request.get(rc,'')
    5355
    54 ## for testing purposes
    55 #pd['resp_desc'] = 'Simulated Callback'
    56 #pd['resp_pay_reference'] = 'XXXX'
    57 #pd['resp_code'] = '00'
    58 #pd['resp_card_num'] = '0000'
    59 #pd['resp_approved_amount'] = '10000'
    60 
    6156if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4:
    6257    pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2]
     
    6964    wftool.doActionFor(context,'close')
    7065    return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
    71 context.getContent().edit(mapping = pd)
     66pay_doc = context.getContent()
     67pay_doc.edit(mapping = pd)
    7268resp = pd['resp_code']
    7369
     
    7672#next_session, next_session_str = context.getNextSessionId(session)
    7773
    78 next_info = context.getNextInfo(s_brain)
    79 next_session_id = next_info['next_session_id']
    80 next_session_str = next_info['next_session_str']
    81 next_level_id = next_info['next_level_id']
    82 next_transition = next_info['next_transition']
    83 next_verdict = next_info['next_verdict']
    84 next_previous_verdict = next_info['next_previous_verdict']
     74if pay_doc.subject == 'hostel_maintenance':
     75    if  resp == '00':
     76        d = {}
     77        acco_info = context.getAccommodationInfo()
     78        d['acco_maint_date'] = pay_doc.date
     79        d['acco_maint_fee'] = pay_doc.amount
     80        d['acco_maint_pay_id'] = context.getId()
     81        acco_info['acco_doc'].edit(mapping=d)
     82        referer = request.get('HTTP_REFERER','none')
     83        logger.info('%s valid callback referer = %s' % (student_id,referer))
     84        real_ip = request.get('HTTP_X_REAL_IP',"none")
     85        logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
     86    else:
     87        logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
     88    try:
     89        wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
     90        return request.RESPONSE.redirect("%s/accommodation_view" % acco_info['student'].absolute_url())
     91    except:
     92        logger.info('%s no workflow action pay_maintainance_fee' % student_id)
     93        return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
     94   
     95else:       
     96    next_info = context.getNextInfo(s_brain)
     97    next_session_id = next_info['next_session_id']
     98    next_session_str = next_info['next_session_str']
     99    next_level_id = next_info['next_level_id']
     100    next_transition = next_info['next_transition']
     101    next_verdict = next_info['next_verdict']
     102    next_previous_verdict = next_info['next_previous_verdict']
     103   
     104    if  resp == '00':
     105        if context.getStudentReviewState() == "school_fee_paid":
     106            logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
     107        else:
     108            study_course = getattr(student,'study_course')
     109            try:
     110                wftool.doActionFor(study_course,'open')
     111            except:
     112                pass
     113            verdict = s_brain.verdict
     114            if next_previous_verdict == 'N/A':
     115                next_previous_verdict = ''
     116            study_course.getContent().edit(mapping= {'current_level': next_level_id,
     117                                                    'current_session': next_session_id,
     118                                                    'current_verdict': next_verdict,
     119                                                    'previous_verdict': next_previous_verdict,
     120                                                    })
     121            if next_transition:
     122                wftool.doActionFor(student,next_transition)
     123   
     124        logger.info('%s received valid callback' % student_id)
     125        referer = request.get('HTTP_REFERER','none')
     126        logger.info('%s valid callback referer = %s' % (student_id,referer))
     127        real_ip = request.get('HTTP_X_REAL_IP',"none")
     128        logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
     129    else:
     130        logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
     131    try:
     132        wftool.doActionFor(context,'close')
     133    except:
     134        logger.info('%s no workflow action close' % student_id)
     135   
    85136
    86 if  resp == '00':
    87     if context.getStudentReviewState() == "school_fee_paid":
    88         logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
    89     else:
    90         study_course = getattr(student,'study_course')
    91         try:
    92             wftool.doActionFor(study_course,'open')
    93         except:
    94             pass
    95         verdict = s_brain.verdict
    96         if next_previous_verdict == 'N/A':
    97             next_previous_verdict = ''
    98         study_course.getContent().edit(mapping= {'current_level': next_level_id,
    99                                                  'current_session': next_session_id,
    100                                                  'current_verdict': next_verdict,
    101                                                  'previous_verdict': next_previous_verdict,
    102                                                  })
    103         if next_transition:
    104             wftool.doActionFor(student,next_transition)
    105 
    106     logger.info('%s received valid callback' % student_id)
    107     referer = request.get('HTTP_REFERER','none')
    108     logger.info('%s valid callback referer = %s' % (student_id,referer))
    109     real_ip = request.get('HTTP_X_REAL_IP',"none")
    110     logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
    111 
    112 else:
    113     logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
    114 try:
    115     wftool.doActionFor(context,'close')
    116 except:
    117     logger.info('%s no workflow action close' % student_id)
    118 
    119 
    120 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
  • WAeUP_SRP/base/skins/waeup_layout/layout_student_acco_create.pt

    r2243 r2857  
    1 <tal:block define="global creation python:1;
    2                    global formaction string:apply_admission" />
     1<tal:block define="global creation python:1" />
    32<!-- a layout_lib macro -->
    43<!-- $Id: layout_student_acco_create.pt 805 2006-11-09 09:38:29Z joachim $ -->
     
    1413  ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
    1514  cpsmcat nocall:here/translation_service;
    16   apply request/apply_button|nothing;
    1715  widgets python:context.getRenderedWidgets(layout);
    1816  ">
     
    119117  </table>
    120118  <br />
    121   <input type="submit" class="standalone" name="cpsdocument_edit_button"
    122          value="Save"
    123          id="cpsdocument_edit_button"
    124          tal:condition="not:creation" />
    125   <input type="submit" class="standalone" name="apply_admission"
    126          value="apply for admission"
    127          id="cpsdocument_edit_and_view_button"
    128          tal:condition="apply"
    129          tal:attributes="value apply"/>
    130119  <input type="submit"
    131120         class="standalone"
    132121         name="cpsdocument_create_button"
    133          value="apply"
    134122         tal:attributes="value options/button"
    135123         tal:condition="creation" />
  • WAeUP_SRP/base/skins/waeup_student/accommodation_slip.pt

    r2829 r2857  
    1919            <tr>
    2020              <td width="180px">Student ID:</td>
    21               <td><span tal:content="info_acco/id" /></td>
     21              <td><span tal:content="info_acco/student_id" /></td>
    2222            </tr>
    2323            <tr tal:condition="info_acco/matric_no">
  • WAeUP_SRP/base/skins/waeup_student/accommodation_view.pt

    r1783 r2857  
    2929         <tr>
    3030          <td width="220px">Level:</td><td tal:content="info/level" />
    31          </tr>
    32          </table>
    33       </span>
    34     </metal:main>
     31        </tr>
     32        <tr tal:condition="not: info/maintenance_paid">
     33          <form action="pay_interswitch_acco" method="post"
     34                enctype="multipart/form-data" class="workflow"
     35                >
     36        <td colspan="2"> 
     37            <input type="submit"
     38                   class="standalone"
     39                   name="cpsdocument_create_button"
     40                   value="apply"
     41                   tal:attributes="value options/button"
     42                   tal:condition="creation" />
     43            </td>
     44          </form>
     45        </tr>
     46      </table>
     47    </span>
     48  </metal:main>
    3549</metal:body>
    3650
  • WAeUP_SRP/fceokene/profiles/default/layouts/payment.xml

    r2845 r2857  
    2121  <property name="hidden_readonly_layout_modes"/>
    2222 </widget>
    23  <widget name="date" meta_type="DateTime Widget">
     23 <widget name="surcharge" meta_type="String Widget">
     24  <property name="title">Surcharge</property>
     25  <property name="fields">
     26   <element value="surcharge"/>
     27  </property>
     28  <property name="label">Surcharge</property>
     29  <property name="label_edit">Surcharge</property>
     30  <property name="readonly_layout_modes">
     31   <element value="edit"/>
     32  </property>
     33  <property name="hidden_layout_modes"/>
     34  <property name="hidden_readonly_layout_modes"/>
     35 </widget>
     36  <widget name="date" meta_type="DateTime Widget">
    2437  <property name="title">Transaction Date</property>
    2538  <property name="fields">
  • WAeUP_SRP/fceokene/profiles/default/layouts/student_accommodation.xml

    r1571 r2857  
    6868  <property name="hidden_readonly_layout_modes"/>
    6969  <property name="prefix">HMU</property>
     70 </widget>
     71 <widget name="acco_maint_pay_id" meta_type="String Widget">
     72  <property name="title">Online Payment Id</property>
     73  <property name="fields">
     74   <element value="acco_maint_pay_id"/>
     75  </property>
     76  <property name="label">Online Payment Id</property>
     77  <property name="label_edit">Online Payment Id</property>
     78  <property name="readonly_layout_modes">
     79   <element value="create"/>
     80   <element value="edit"/>
     81  </property>
     82  <property name="hidden_layout_modes">
     83   <element value="create"/>
     84  </property>
     85  <property name="hidden_readonly_layout_modes"/>
    7086 </widget>
    7187 <widget name="acco_res_date" meta_type="DateTime Widget">
  • WAeUP_SRP/fceokene/profiles/default/layouts/student_accommodation_fe.xml

    r2829 r2857  
    3434  </property>
    3535  <property name="hidden_readonly_layout_modes"/>
    36   <property name="prefix">@getMaintenancePrefix</property>
     36  <property name="prefix">HOM</property>
     37 </widget>
     38 <widget name="acco_maint_pay_id" meta_type="String Widget">
     39  <property name="title">Online Payment Id</property>
     40  <property name="fields">
     41   <element value="acco_maint_pay_id"/>
     42  </property>
     43  <property name="label">Online Payment Id</property>
     44  <property name="label_edit">Online Payment Id</property>
     45  <property name="readonly_layout_modes">
     46   <element value="create"/>
     47   <element value="edit"/>
     48  </property>
     49  <property name="hidden_layout_modes">
     50   <element value="create"/>
     51  </property>
     52  <property name="hidden_readonly_layout_modes"/>
    3753 </widget>
    3854 <widget name="acco_res_date" meta_type="DateTime Widget">
     
    5167  <property name="hidden_readonly_layout_modes"/>
    5268 </widget>
    53 
    5469 <widget name="bed" meta_type="Method Widget">
    5570  <property name="title">Bed</property>
     
    106121  </row>
    107122  <row>
    108    <cell name="acco_maint_sc_pin"/>
     123   <cell name="acco_maint_pay_id"/>
    109124  </row>
    110125  <row>
  • WAeUP_SRP/fceokene/profiles/default/schemas/payment.xml

    r2852 r2857  
    99  </field>
    1010  <field name="amount" meta_type="CPS String Field"/>
     11  <field name="surcharge" meta_type="CPS String Field"/>
    1112  <field name="description" meta_type="CPS String Field"/>
    1213  <field name="subject" meta_type="CPS String Field"/>
  • WAeUP_SRP/fceokene/profiles/default/schemas/student_accommodation.xml

    r1399 r2857  
    66 <field name="acco_maint_fee" meta_type="CPS String Field"/>
    77 <field name="acco_maint_sc_pin" meta_type="CPS String Field"/>
     8 <field name="acco_maint_pay_id" meta_type="CPS String Field"/>
    89 <field name="acco_res_date" meta_type="CPS DateTime Field"/>
    910 <field name="acco_res_sc_pin" meta_type="CPS String Field"/>
  • WAeUP_SRP/fceokene/profiles/default/vocabularies/payment_subjects.xml

    r2854 r2857  
    88
    99    <item key="" msgid="">None</item>
     10    <item key="hostel_maintenance" msgid="">Hostel Maintainance</item>
    1011    <item key="schoolfee" msgid="">School Fee</item>
    1112    <item key="transfer" msgid="">Transfer</item>
  • WAeUP_SRP/fceokene/waeup_custom/getAccommodationInfo.py

    r2829 r2857  
    5656students_object = context.portal_url.getPortalObject().campus.students
    5757student = getattr(students_object, student_id)
    58 info['id'] = student_id
     58info['student_id'] = student_id
    5959info['student'] = student
    6060
     
    7070
    7171info['booking_allowed'] = booking_allowed
     72info['online_payment'] = True  # for Okene
    7273if not booking_allowed:
    7374    info['acco'] = None
     
    7980
    8081bt = 're'
     82info['maintenance_paid'] = False
    8183if acco is not None:
    8284    info['acco_doc'] = acco.getContent()
    8385    info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None)
     86    info['maintenance_paid'] = info['acco_review_state'] == "maintenance_fee_paid"
    8487d = {}
    8588if review_state == "cleared_and_validated":
  • WAeUP_SRP/fceokene/waeup_custom/layout_student_acco_view_slip.pt

    r2829 r2857  
    66              widgets python:context.getRenderedWidgets(layout);
    77              fields python:('bed',
    8 
    9                                  'acco_res_date',
    10                                  'acco_maint_sc_pin',
     8                              'acco_res_date',
     9                                 'acco_maint_pay_id',
    1110                                 'acco_maint_date',
    1211                                 )"
Note: See TracChangeset for help on using the changeset viewer.