Changeset 11782 for main/waeup.uniben/trunk/src
- Timestamp:
- 29 Aug 2014, 05:31:07 (10 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r11771 r11782 19 19 """ 20 20 import grok 21 from zope.component import getUtility 21 from zope.component import getUtility, createObject 22 22 from zope.security import checkPermission 23 23 from waeup.kofa.interfaces import IExtFileStore 24 24 from waeup.kofa.applicants.browser import ( 25 25 ApplicantRegistrationPage, ApplicantsContainerPage, 26 ApplicationFeePaymentAddPage) 26 ApplicationFeePaymentAddPage, 27 OnlinePaymentApprovePage) 28 from waeup.kofa.applicants.interfaces import ( 29 ISpecialApplicant, IApplicantsUtils) 27 30 from kofacustom.nigeria.applicants.browser import ( 28 31 NigeriaApplicantDisplayFormPage, 29 32 NigeriaApplicantManageFormPage, 30 33 NigeriaPDFApplicationSlip) 34 from waeup.uniben.applicants.interfaces import ( 35 ICustomApplicant) 31 36 32 37 from waeup.uniben.interfaces import MessageFactory as _ … … 106 111 return self.target.startswith('pude') \ 107 112 and self.context.state in ('paid', 'submitted') 113 114 # customizations for admission checking payments 115 @property 116 def form_fields(self): 117 if self.context.special: 118 form_fields = grok.AutoFields(ISpecialApplicant).omit('locked') 119 else: 120 form_fields = grok.AutoFields(ICustomApplicant).omit( 121 'locked', 'course_admitted', 'password', 'suspended') 122 return form_fields 108 123 109 124 class CustomNigeriaPDFApplicationSlip(NigeriaPDFApplicationSlip): … … 129 144 store = getUtility(IExtFileStore) 130 145 if not store.getFileByContext(self.context, attr=u'passport.jpg'): 131 return _('Upload your 1"x1" Red 146 return _('Upload your 1"x1" Red background passport photo before making payment.') 132 147 return '' 133 148 134 135 class ApplicantManageFormPage(NigeriaApplicantManageFormPage): 149 # customizations for admission checking payments 150 def update(self): 151 # Additional requirements in custom packages. 152 if self.custom_requirements: 153 self.flash( 154 self.custom_requirements, 155 type='danger') 156 self.redirect(self.url(self.context)) 157 return 158 if not self.context.special: 159 for key in self.context.keys(): 160 ticket = self.context[key] 161 if ticket.p_state == 'paid': 162 self.flash( 163 _('This type of payment has already been made.'), 164 type='warning') 165 self.redirect(self.url(self.context)) 166 return 167 applicants_utils = getUtility(IApplicantsUtils) 168 container = self.context.__parent__ 169 payment = createObject(self.factory) 170 failure = applicants_utils.setPaymentDetails( 171 container, payment, self.context) 172 if failure is not None: 173 self.flash(failure[0], type='danger') 174 self.redirect(self.url(self.context)) 175 return 176 self.context[payment.p_id] = payment 177 self.flash(_('Payment ticket created.')) 178 self.redirect(self.url(payment)) 179 return 180 181 182 class CustomApplicantManageFormPage(NigeriaApplicantManageFormPage): 136 183 137 184 @property … … 139 186 if not checkPermission('waeup.uploadPassportPictures', self.context): 140 187 return _('You are not entitled to upload passport pictures.') 188 189 class CustomOnlinePaymentApprovePage(OnlinePaymentApprovePage): 190 """ Approval view 191 """ 192 193 # customizations for admission checking payments 194 def update(self): 195 flashtype, msg, log = self.context.approveApplicantPayment() 196 if log is not None: 197 applicant = self.context.__parent__ 198 # Add log message to applicants.log 199 applicant.writeLogMessage(self, log) 200 # Add log message to payments.log 201 self.context.logger.info( 202 '%s,%s,%s,%s,%s,,,,,,' % ( 203 applicant.applicant_id, 204 self.context.p_id, self.context.p_category, 205 self.context.amount_auth, self.context.r_code)) 206 self.flash(msg, type=flashtype) 207 return -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py
r11434 r11782 19 19 """ 20 20 21 from time import time 22 import grok 21 23 from kofacustom.nigeria.applicants.utils import NigeriaApplicantsUtils 22 24 from waeup.kofa.applicants.workflow import (INITIALIZED, … … 26 28 27 29 28 class ApplicantsUtils(NigeriaApplicantsUtils):30 class CustomApplicantsUtils(NigeriaApplicantsUtils): 29 31 """A collection of parameters and methods subject to customization. 30 32 """ … … 49 51 } 50 52 53 # customizations for admission checking payments 54 def setPaymentDetails(self, container, payment, applicant): 55 """Set the payment data of an applicant. 56 """ 57 timestamp = ("%d" % int(time()*10000))[1:] 58 session = str(container.year) 59 try: 60 session_config = grok.getSite()['configuration'][session] 61 except KeyError: 62 return _(u'Session configuration object is not available.'), None 63 payment.p_id = "p%s" % timestamp 64 payment.p_item = container.title 65 payment.p_session = container.year 66 payment.amount_auth = 0.0 67 if applicant.special: 68 if applicant.special_application: 69 fee_name = applicant.special_application + '_fee' 70 payment.amount_auth = getattr(session_config, fee_name, 0.0) 71 payment.p_category = applicant.special_application 72 return 73 payment.p_category = 'application' 74 container_fee = container.application_fee 75 if container_fee: 76 payment.amount_auth = container_fee 77 return 78 payment.amount_auth = session_config.application_fee 79 if payment.amount_auth in (0.0, None): 80 return _('Amount could not be determined.'), None 81 return 82 51 83 52 84 # Temporarily disabled -
main/waeup.uniben/trunk/src/waeup/uniben/interfaces.py
r10469 r11782 94 94 ) 95 95 96 admchecking_fee = schema.Float( 97 title = _(u'Admission Checking Fee'), 98 default = 0.0, 99 required = False, 100 ) 101 96 102 def getSessionString(): 97 103 """Returns the session string from the vocabulary. -
main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py
r11669 r11782 63 63 'application': 'Application Fee', 64 64 'transcript': 'Transcript Fee', 65 'admission_checking': 'Admission Checking Fee', 65 66 } 66 67
Note: See TracChangeset for help on using the changeset viewer.