Changeset 15131 for main/kofacustom.edopoly/trunk
- Timestamp:
- 7 Sep 2018, 09:01:25 (6 years ago)
- Location:
- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/applicant.py
r15123 r15131 21 21 from waeup.kofa.applicants.applicant import ApplicantFactory 22 22 from waeup.kofa.utils.helpers import attrs_to_fields 23 from waeup.kofa.interfaces import IObjectHistory 24 from waeup.kofa.applicants.workflow import ( 25 application_states_dict, ADMITTED, NOT_ADMITTED, CREATED) 23 26 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant 24 27 from kofacustom.edopoly.applicants.interfaces import( … … 47 50 return False 48 51 52 @property 53 def history(self): 54 # We do not provide a history 55 if self.state in (ADMITTED, NOT_ADMITTED, CREATED) \ 56 and not self.admchecking_fee_paid(): 57 return 58 history = IObjectHistory(self) 59 return history 60 61 @property 62 def translated_state(self): 63 if self.state in (ADMITTED, NOT_ADMITTED, CREATED) \ 64 and not self.admchecking_fee_paid(): 65 return 66 try: 67 state = application_states_dict[self.state] 68 except LookupError: # in unit tests 69 return 70 return state 71 49 72 # Set all attributes of CustomApplicant required in ICustomApplicant as field 50 73 # properties. Doing this, we do not have to set initial attributes -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/browser.py
r15124 r15131 42 42 PG_OMIT_EDIT_FIELDS, 43 43 ) 44 from waeup.kofa.applicants.workflow import ADMITTED, PAID, STARTED 44 from waeup.kofa.applicants.workflow import ( 45 ADMITTED, PAID, STARTED, NOT_ADMITTED, CREATED) 45 46 from kofacustom.edopoly.applicants.interfaces import ( 46 47 ICustomUGApplicantEdit, ICustomUGApplicant, … … 107 108 @property 108 109 def admission_checking_info(self): 109 if self.context.state == ADMITTEDand \110 if self.context.state in (ADMITTED, NOT_ADMITTED, CREATED) and \ 110 111 not self.context.admchecking_fee_paid(): 111 112 return _('You must pay the admission checking fee ' … … 116 117 state = IWorkflowState(self.context).getState() 117 118 actions = [] 118 if state == ADMITTED and not self.context.admchecking_fee_paid(): 119 if state in (ADMITTED, NOT_ADMITTED, CREATED) \ 120 and not self.context.admchecking_fee_paid(): 119 121 actions = [_('Add admission checking payment ticket')] 120 122 return actions … … 186 188 def update(self): 187 189 super(CustomExportPDFPageApplicationSlip, self).update() 188 if self.context.state == ADMITTEDand \190 if self.context.state in (ADMITTED, NOT_ADMITTED, CREATED) and \ 189 191 not self.context.admchecking_fee_paid(): 190 192 self.flash( -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/browser_templates/applicantdisplaypage.pt
r15123 r15131 1 <h2 i18n:domain="waeup.kofa" >1 <h2 i18n:domain="waeup.kofa" tal:condition="context/translated_state"> 2 2 ... 3 3 <span tal:replace="context/translated_state">APPLICATIONSTATE … … 9 9 </h2> 10 10 11 <div class="workflow" >11 <div class="workflow" tal:condition="context/history"> 12 12 <div tal:repeat="msg context/history/messages"> 13 13 <span tal:replace="msg">MESSAGE</span><br /> -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/payment.py
r15000 r15131 25 25 from waeup.kofa.utils.helpers import attrs_to_fields 26 26 from kofacustom.edopoly.applicants.interfaces import ICustomApplicantOnlinePayment 27 from kofacustom.edopoly.interfaces import MessageFactory as _ 27 28 28 29 class CustomApplicantOnlinePayment(ApplicantOnlinePayment): … … 40 41 super(CustomApplicantOnlinePayment, self).__init__() 41 42 return 43 44 def doAfterApplicantPaymentApproval(self): 45 """Process applicant after payment was approved. 46 """ 47 if not (self.__parent__.special and self.__parent__.state == PAID) \ 48 and self.p_category != 'admission_checking': 49 wf_info = IWorkflowInfo(self.__parent__) 50 try: 51 wf_info.fireTransition('approve') 52 except InvalidTransitionError: 53 msg = log = 'Error: %s' % sys.exc_info()[1] 54 return 'danger', msg, log 55 log = 'approved: %s' % self.p_id 56 msg = _('Payment approved') 57 flashtype = 'success' 58 return flashtype, msg, log 59 60 def doAfterApplicantPayment(self): 61 """Process applicant after payment was made. 62 """ 63 if not (self.__parent__.special and self.__parent__.state == PAID) \ 64 and self.p_category != 'admission_checking': 65 wf_info = IWorkflowInfo(self.__parent__) 66 try: 67 wf_info.fireTransition('pay') 68 except InvalidTransitionError: 69 msg = log = 'Error: %s' % sys.exc_info()[1] 70 return 'danger', msg, log 71 log = 'successful payment: %s' % self.p_id 72 msg = _('Successful payment') 73 flashtype = 'success' 74 return flashtype, msg, log 42 75 43 76 CustomApplicantOnlinePayment = attrs_to_fields( -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/tests/test_browser.py
r15123 r15131 74 74 'Please pay admission checking fee before trying to download' 75 75 in self.browser.contents) 76 # History and state is also missing 77 self.assertFalse('...' in self.browser.contents) 78 self.assertFalse('Application initialized' in self.browser.contents) 76 79 # Pay admission checking fee. 77 80 self.browser.getControl("Add admission checking").click() … … 84 87 self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents) 85 88 self.assertTrue('<span>55</span>' in self.browser.contents) 89 # History and state are visible 90 self.assertTrue('...' in self.browser.contents) 91 self.assertTrue('Application initialized' in self.browser.contents) 86 92 # Application slip can be downloaded again. 87 93 self.browser.getLink("Download application slip").click() -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/viewlets.py
r15123 r15131 20 20 from waeup.kofa.browser.viewlets import ManageActionButton 21 21 from waeup.kofa.applicants.viewlets import PDFActionButton 22 from waeup.kofa.applicants.workflow import ( 23 INITIALIZED, ADMITTED, PAID, STARTED, NOT_ADMITTED, CREATED) 22 24 from kofacustom.edopoly.applicants.interfaces import ICustomApplicant 23 25 from kofacustom.edopoly.interfaces import MessageFactory as _ … … 29 31 """Get a URL to the target... 30 32 """ 31 if self.context.state in ( 'initialized', 'started', 'paid') \33 if self.context.state in (INITIALIZED, STARTED, PAID) \ 32 34 or self.context.special: 33 35 return 34 if self.context.state == 'admitted'and \36 if self.context.state in (ADMITTED, NOT_ADMITTED, CREATED) and \ 35 37 not self.context.admchecking_fee_paid(): 36 38 return
Note: See TracChangeset for help on using the changeset viewer.