Changeset 11599 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 24 Apr 2014, 06:17:10 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r11580 r11599 491 491 def form_fields(self): 492 492 if self.context.special: 493 form_fields = grok.AutoFields(ISpecialApplicant) 493 form_fields = grok.AutoFields(ISpecialApplicant).omit('locked') 494 494 else: 495 495 form_fields = grok.AutoFields(IApplicant).omit( … … 728 728 729 729 def render(self): 730 #if self.context.p_state != 'paid': 731 # self.flash(_('Ticket not yet paid.')) 732 # self.redirect(self.url(self.context)) 733 # return 730 if self.context.__parent__.special \ 731 and self.context.__parent__.state != SUBMITTED: 732 self.flash(_('Please pay and submit before ' 733 'trying to download payment slips.')) 734 self.redirect(self.url(self.context)) 735 return 734 736 applicantview = ApplicantBaseDisplayFormPage(self.context.__parent__, 735 737 self.request) … … 948 950 def form_fields(self): 949 951 if self.context.special: 950 form_fields = grok.AutoFields(ISpecialApplicant) 952 form_fields = grok.AutoFields(ISpecialApplicant).omit('locked') 951 953 form_fields['applicant_id'].for_display = True 952 954 else: … … 965 967 if state == STARTED: 966 968 actions = [[_('Save')], 969 [_('Add online payment ticket'),_('Remove selected tickets')]] 970 elif self.context.special and state == PAID: 971 actions = [[_('Save'), _('Final Submit')], 967 972 [_('Add online payment ticket'),_('Remove selected tickets')]] 968 973 elif state == PAID: -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicantdisplaypage.pt
r11254 r11599 38 38 </tbody> 39 39 </table> 40 <h3 41 Application FeePayment Tickets40 <h3 i18n:domain="waeup.kofa" i18n:translate=""> 41 Payment Tickets 42 42 </h3> 43 43 <table i18n:domain="waeup.kofa" class="table table-condensed"> -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt
r11578 r11599 89 89 <br /><br /> 90 90 <h3 i18n:translate=""> 91 Application FeePayment Tickets91 Payment Tickets 92 92 </h3> 93 93 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py
r10846 r11599 490 490 ) 491 491 492 locked = schema.Bool( 493 title = _(u'Form locked'), 494 default = False, 495 required = False, 496 ) 497 492 498 applicant_id = schema.TextLine( 493 499 title = _(u'Applicant Id'), -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/payment.py
r11580 r11599 29 29 from waeup.kofa.payments.interfaces import IPayer 30 30 from waeup.kofa.applicants.interfaces import IApplicantOnlinePayment 31 from waeup.kofa.applicants.workflow import PAID 31 32 from waeup.kofa.utils.helpers import attrs_to_fields 32 33 … … 44 45 """Process applicant after payment was approved. 45 46 """ 46 if not self.__parent__.special:47 if not (self.__parent__.special and self.__parent__.state == PAID): 47 48 wf_info = IWorkflowInfo(self.__parent__) 48 49 try: … … 59 60 """Process applicant after payment was made. 60 61 """ 61 if not self.__parent__.special:62 if not (self.__parent__.special and self.__parent__.state == PAID): 62 63 wf_info = IWorkflowInfo(self.__parent__) 63 64 try: -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r11575 r11599 55 55 container_name_2 = u'app%s' % session_2 56 56 57 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 58 57 59 class ApplicantsFullSetup(FunctionalTestCase): 58 60 # A test case that only contains a setup and teardown … … 976 978 '<span>200.0</span>' in self.browser.contents) 977 979 self.assertEqual(len(self.special_applicant.keys()), 1) 978 # The applicant's workflow remain started ...980 # The applicant's workflow state is paid ... 979 981 self.special_applicant.values()[0].approveApplicantPayment() 980 self.assertEqual(self.special_applicant.state, ' started')982 self.assertEqual(self.special_applicant.state, 'paid') 981 983 self.browser.open(applicant_path + '/edit') 982 # ... so that he can create further tickets.984 # ... but he can create further tickets. 983 985 self.browser.getControl(name="form.special_application").value = [ 984 986 'clearance'] … … 991 993 '<td>Acceptance Fee</td>' in self.browser.contents) 992 994 self.assertEqual(len(self.special_applicant.keys()), 2) 995 # Second payment can also be approved wthout error message 996 flashtype, msg, log = self.special_applicant.values()[1].approveApplicantPayment() 997 self.assertEqual(flashtype, 'success') 998 self.assertEqual(msg, 'Payment approved') 999 # Payment slips can't be downloaded ... 1000 payment_id = self.special_applicant.keys()[0] 1001 self.browser.open(applicant_path + '/' + payment_id) 1002 self.browser.getLink("Download payment slip").click() 1003 self.assertTrue( 1004 'Please pay and submit before trying to download payment slips.' 1005 in self.browser.contents) 1006 # ... unless form is submitted. 1007 self.browser.open(applicant_path + '/edit') 1008 image = open(SAMPLE_IMAGE, 'rb') 1009 ctrl = self.browser.getControl(name='form.passport') 1010 file_ctrl = ctrl.mech_control 1011 file_ctrl.add_file(image, filename='myphoto.jpg') 1012 self.browser.getControl(name="confirm_passport").value = True 1013 self.browser.getControl("Final Submit").click() 1014 self.browser.open(applicant_path + '/' + payment_id) 1015 self.browser.getLink("Download payment slip").click() 1016 self.assertEqual(self.browser.headers['Content-Type'], 1017 'application/pdf') 993 1018 return 994 1019 … … 1022 1047 self.assertTrue( 1023 1048 'No passport picture uploaded' in self.browser.contents) 1024 # Create a pseudoimage file and select it to be uploaded in form1025 pseudo_image = StringIO('I pretend to be a graphics file')1049 # Use a real image file and select it to be uploaded in form 1050 image = open(SAMPLE_IMAGE, 'rb') 1026 1051 ctrl = self.browser.getControl(name='form.passport') 1027 1052 file_ctrl = ctrl.mech_control 1028 file_ctrl.add_file( pseudo_image, filename='myphoto.jpg')1053 file_ctrl.add_file(image, filename='myphoto.jpg') 1029 1054 self.browser.getControl("Final Submit").click() # (finally) submit form 1030 1055 # The picture has been uploaded but the form cannot be submitted -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/viewlets.py
r10802 r11599 214 214 """Get a URL to the target... 215 215 """ 216 if self.context.state in ('initialized', 'started', 'paid'): 216 if self.context.state in ('initialized', 'started', 'paid') \ 217 or self.context.special: 217 218 return 218 219 return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.