- Timestamp:
- 3 Aug 2017, 07:30:06 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py
r13585 r14755 36 36 # Buttons 37 37 38 def module_activated(session): 39 try: 40 return getattr(grok.getSite()['configuration'][str(session)], 41 'interswitch_enabled', True) 42 except KeyError: 43 return False 44 38 45 class InterswitchActionButtonStudent(ManageActionButton): 39 46 grok.order(1) … … 47 54 @property 48 55 def target_url(self): 56 if not module_activated(self.context.student.current_session): 57 return '' 49 58 if self.context.p_state != 'unpaid': 50 59 return '' … … 54 63 grok.view(OPDPApplicant) 55 64 grok.require('waeup.payApplicant') 65 66 @property 67 def target_url(self): 68 if not module_activated(self.context.__parent__.__parent__.year): 69 return '' 70 if self.context.p_state != 'unpaid': 71 return '' 72 return self.view.url(self.view.context, self.target) 56 73 57 74 class InterswitchRequestWebserviceActionButtonStudent(ManageActionButton): … … 66 83 @property 67 84 def target_url(self): 85 if not module_activated(self.context.student.current_session): 86 return '' 68 87 if self.context.p_state in ('paid', 'waived'): 69 88 return '' … … 74 93 grok.view(OPDPApplicant) 75 94 grok.require('waeup.payApplicant') 95 96 @property 97 def target_url(self): 98 if not module_activated(self.context.__parent__.__parent__.year): 99 return '' 100 if self.context.p_state in ('paid', 'waived'): 101 return '' 102 return self.view.url(self.view.context, self.target) 76 103 77 104 class InterswitchVerifyWebserviceActionButtonStudent(ManageActionButton): … … 86 113 @property 87 114 def target_url(self): 115 if not module_activated(self.context.student.current_session): 116 return '' 88 117 if self.context.p_state != 'paid' \ 89 118 or self.context.r_company != u'interswitch': … … 96 125 grok.require('waeup.manageApplication') 97 126 127 @property 128 def target_url(self): 129 if not module_activated(self.context.__parent__.__parent__.year): 130 return '' 131 if self.context.p_state != 'paid' \ 132 or self.context.r_company != u'interswitch': 133 return '' 134 return self.view.url(self.view.context, self.target) 98 135 99 136 # Webservice request views … … 113 150 114 151 def update(self): 152 if not module_activated(self.context.student.current_session): 153 return 115 154 if self.context.p_state in ('paid', 'waived'): 116 155 self.flash(_('This ticket has already been paid.'), type='danger') … … 150 189 151 190 def update(self): 191 if not module_activated(self.context.__parent__.__parent__.year): 192 return 152 193 if self.context.p_state == 'paid': 153 194 self.flash(_('This ticket has already been paid.'), type='danger') … … 187 228 188 229 def update(self): 230 if not module_activated(self.context.student.current_session): 231 return 189 232 if self.context.p_state != 'paid' \ 190 233 or self.context.r_company != u'interswitch': … … 221 264 222 265 def update(self): 266 if not module_activated(self.context.__parent__.__parent__.year): 267 return 223 268 if self.context.p_state != 'paid' \ 224 269 or self.context.r_company != u'interswitch': … … 299 344 300 345 def update(self): 346 if not module_activated(self.context.student.current_session): 347 return 301 348 error = self.init_update() 302 349 if error: … … 345 392 346 393 def update(self): 394 if not module_activated(self.context.__parent__.__parent__.year): 395 return 347 396 error = self.init_update() 348 397 if error:
Note: See TracChangeset for help on using the changeset viewer.