Changeset 2857
- Timestamp:
- 4 Dec 2007, 16:28:13 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 3 added
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTables.py
r2845 r2857 490 490 def searchAndReserveBed(self, student_id,bed_type): 491 491 #records = self.searchResults({'student' : student_id}) 492 import pdb;pdb.set_trace()492 #import pdb;pdb.set_trace() 493 493 records = self.evalAdvancedQuery(Eq('student',student_id)) 494 494 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 1 7 ##parameters=REQUEST 2 8 # $Id$ … … 4 10 process the the accommodation reservation 5 11 """ 12 try: 13 from Products.zdb import set_trace 14 except: 15 def set_trace(): 16 pass 6 17 import DateTime 7 18 current = DateTime.DateTime() … … 26 37 return context.REQUEST.RESPONSE.redirect("%s/no_booking_allowed" % info['student'].absolute_url()) 27 38 student = info['student'] 39 student_id = info['student_id'] 28 40 acco_id = info['acco_id'] 29 session = info['session'][1] 41 #session = info['session'][1] 42 session = info['session'] 30 43 #session = acco_id[-4:] 31 44 validate = REQUEST.has_key("cpsdocument_create_button") 32 45 if info.has_key('acco') and info['acco']: 33 46 validate = REQUEST.has_key("cpsdocument_edit_button") 34 if info[' acco_review_state'] == "maintenance_fee_paid":47 if info['maintenance_paid']: 35 48 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()) 36 51 else: 37 52 mode = 'edit' … … 61 76 else: 62 77 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, 64 79 psm = psm, 65 80 #psm = "%s, %s" % (psm,ds), … … 68 83 ) 69 84 elif psm == '': 70 return context.accommodation_ pin_edit_form(rendered = res,85 return context.accommodation_edit_form(rendered = res, 71 86 psm = None, 72 87 mode = mode, … … 74 89 ) 75 90 elif psm == 'valid': 76 s_id = ds.get('s_id')77 91 if mode == 'create': 92 set_trace() 78 93 pin = str(ds.get('acco_res_sc_pin')) 79 pa = context.portal_accommodation80 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 84 99 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 ) 90 105 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 ) 98 117 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')) 103 121 ds.set('acco_res_date', current) 104 122 ds.set('bed', bed) 105 123 ds.set('session', session) 106 124 ds.set('student_status',info['student_status']) 125 acco = getattr(student,acco_id) 107 126 acco.getContent().edit(mapping=ds) 108 127 #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" 2 2 ##bind container=container 3 3 ##bind context=context … … 18 18 pass 19 19 import logging 20 logger = logging.getLogger('Skins.interswitch_ cb')20 logger = logging.getLogger('Skins.interswitch_acco_cb') 21 21 from AccessControl import Unauthorized 22 22 import DateTime 23 current = DateTime.DateTime() 24 23 25 if context.portal_membership.isAnonymousUser(): 24 26 return None … … 52 54 pd[pdk] = request.get(rc,'') 53 55 54 ## for testing purposes55 #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 61 56 if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4: 62 57 pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2] … … 69 64 wftool.doActionFor(context,'close') 70 65 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url()) 71 context.getContent().edit(mapping = pd) 66 pay_doc = context.getContent() 67 pay_doc.edit(mapping = pd) 72 68 resp = pd['resp_code'] 73 69 … … 76 72 #next_session, next_session_str = context.getNextSessionId(session) 77 73 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'] 74 if 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 95 else: 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 85 136 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 pass95 verdict = s_brain.verdict96 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" /> 3 2 <!-- a layout_lib macro --> 4 3 <!-- $Id: layout_student_acco_create.pt 805 2006-11-09 09:38:29Z joachim $ --> … … 14 13 ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None); 15 14 cpsmcat nocall:here/translation_service; 16 apply request/apply_button|nothing;17 15 widgets python:context.getRenderedWidgets(layout); 18 16 "> … … 119 117 </table> 120 118 <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"/>130 119 <input type="submit" 131 120 class="standalone" 132 121 name="cpsdocument_create_button" 133 value="apply"134 122 tal:attributes="value options/button" 135 123 tal:condition="creation" /> -
WAeUP_SRP/base/skins/waeup_student/accommodation_slip.pt
r2829 r2857 19 19 <tr> 20 20 <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> 22 22 </tr> 23 23 <tr tal:condition="info_acco/matric_no"> -
WAeUP_SRP/base/skins/waeup_student/accommodation_view.pt
r1783 r2857 29 29 <tr> 30 30 <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> 35 49 </metal:body> 36 50 -
WAeUP_SRP/fceokene/profiles/default/layouts/payment.xml
r2845 r2857 21 21 <property name="hidden_readonly_layout_modes"/> 22 22 </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"> 24 37 <property name="title">Transaction Date</property> 25 38 <property name="fields"> -
WAeUP_SRP/fceokene/profiles/default/layouts/student_accommodation.xml
r1571 r2857 68 68 <property name="hidden_readonly_layout_modes"/> 69 69 <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"/> 70 86 </widget> 71 87 <widget name="acco_res_date" meta_type="DateTime Widget"> -
WAeUP_SRP/fceokene/profiles/default/layouts/student_accommodation_fe.xml
r2829 r2857 34 34 </property> 35 35 <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"/> 37 53 </widget> 38 54 <widget name="acco_res_date" meta_type="DateTime Widget"> … … 51 67 <property name="hidden_readonly_layout_modes"/> 52 68 </widget> 53 54 69 <widget name="bed" meta_type="Method Widget"> 55 70 <property name="title">Bed</property> … … 106 121 </row> 107 122 <row> 108 <cell name="acco_maint_ sc_pin"/>123 <cell name="acco_maint_pay_id"/> 109 124 </row> 110 125 <row> -
WAeUP_SRP/fceokene/profiles/default/schemas/payment.xml
r2852 r2857 9 9 </field> 10 10 <field name="amount" meta_type="CPS String Field"/> 11 <field name="surcharge" meta_type="CPS String Field"/> 11 12 <field name="description" meta_type="CPS String Field"/> 12 13 <field name="subject" meta_type="CPS String Field"/> -
WAeUP_SRP/fceokene/profiles/default/schemas/student_accommodation.xml
r1399 r2857 6 6 <field name="acco_maint_fee" meta_type="CPS String Field"/> 7 7 <field name="acco_maint_sc_pin" meta_type="CPS String Field"/> 8 <field name="acco_maint_pay_id" meta_type="CPS String Field"/> 8 9 <field name="acco_res_date" meta_type="CPS DateTime Field"/> 9 10 <field name="acco_res_sc_pin" meta_type="CPS String Field"/> -
WAeUP_SRP/fceokene/profiles/default/vocabularies/payment_subjects.xml
r2854 r2857 8 8 9 9 <item key="" msgid="">None</item> 10 <item key="hostel_maintenance" msgid="">Hostel Maintainance</item> 10 11 <item key="schoolfee" msgid="">School Fee</item> 11 12 <item key="transfer" msgid="">Transfer</item> -
WAeUP_SRP/fceokene/waeup_custom/getAccommodationInfo.py
r2829 r2857 56 56 students_object = context.portal_url.getPortalObject().campus.students 57 57 student = getattr(students_object, student_id) 58 info[' id'] = student_id58 info['student_id'] = student_id 59 59 info['student'] = student 60 60 … … 70 70 71 71 info['booking_allowed'] = booking_allowed 72 info['online_payment'] = True # for Okene 72 73 if not booking_allowed: 73 74 info['acco'] = None … … 79 80 80 81 bt = 're' 82 info['maintenance_paid'] = False 81 83 if acco is not None: 82 84 info['acco_doc'] = acco.getContent() 83 85 info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None) 86 info['maintenance_paid'] = info['acco_review_state'] == "maintenance_fee_paid" 84 87 d = {} 85 88 if review_state == "cleared_and_validated": -
WAeUP_SRP/fceokene/waeup_custom/layout_student_acco_view_slip.pt
r2829 r2857 6 6 widgets python:context.getRenderedWidgets(layout); 7 7 fields python:('bed', 8 9 'acco_res_date', 10 'acco_maint_sc_pin', 8 'acco_res_date', 9 'acco_maint_pay_id', 11 10 'acco_maint_date', 12 11 )"
Note: See TracChangeset for help on using the changeset viewer.