Changeset 10831 for main/waeup.kofa/trunk
- Timestamp:
- 10 Dec 2013, 06:24:03 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
r10092 r10831 89 89 history = IObjectHistory(self) 90 90 return history 91 92 @property 93 def special(self): 94 return self.__parent__.prefix.startswith('special') 91 95 92 96 @property -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r10655 r10831 60 60 from waeup.kofa.utils.helpers import string_from_bytes, file_size, now 61 61 from waeup.kofa.widgets.datewidget import ( 62 FriendlyDateDisplayWidget, FriendlyDateDisplayWidget,62 FriendlyDateDisplayWidget, 63 63 FriendlyDatetimeDisplayWidget) 64 64 from waeup.kofa.widgets.htmlwidget import HTMLDisplayWidget … … 522 522 grok.require('waeup.viewApplication') 523 523 grok.template('applicantdisplaypage') 524 form_fields = grok.AutoFields(IApplicant).omit(525 'locked', 'course_admitted', 'password', 'suspended')526 524 label = _('Applicant') 527 525 pnav = 3 528 526 hide_hint = False 527 528 @property 529 def form_fields(self): 530 if self.context.special: 531 form_fields = grok.AutoFields(IApplicant).select( 532 'applicant_id', 'firstname', 'middlename', 'lastname', 533 'reg_number', 'date_of_birth', 'email', 'special_application') 534 else: 535 form_fields = grok.AutoFields(IApplicant).omit( 536 'locked', 'course_admitted', 'password', 'suspended', 537 'special_application') 538 return form_fields 529 539 530 540 @property … … 650 660 container = self.context.__parent__ 651 661 payment = createObject(self.factory) 652 error = applicants_utils.setPaymentDetails(container, payment) 662 error = applicants_utils.setPaymentDetails( 663 container, payment, self.context) 653 664 if error is not None: 654 665 self.flash(error) … … 796 807 grok.name('manage') 797 808 grok.require('waeup.manageApplication') 798 form_fields = grok.AutoFields(IApplicant)799 form_fields['student_id'].for_display = True800 form_fields['applicant_id'].for_display = True801 809 grok.template('applicanteditpage') 802 810 manage_applications = True … … 804 812 display_actions = [[_('Save'), _('Final Submit')], 805 813 [_('Add online payment ticket'),_('Remove selected tickets')]] 814 815 @property 816 def form_fields(self): 817 if self.context.special: 818 form_fields = grok.AutoFields(IApplicant).select( 819 'applicant_id', 'firstname', 'middlename', 'lastname', 820 'reg_number', 'date_of_birth', 'email', 'special_application', 821 'locked') 822 else: 823 form_fields = grok.AutoFields(IApplicant) 824 form_fields['student_id'].for_display = True 825 form_fields['applicant_id'].for_display = True 826 return form_fields 806 827 807 828 @property … … 941 962 grok.name('edit') 942 963 grok.require('waeup.handleApplication') 943 form_fields = grok.AutoFields(IApplicantEdit).omit(944 'locked', 'course_admitted', 'student_id',945 'suspended'946 )947 form_fields['applicant_id'].for_display = True948 form_fields['reg_number'].for_display = True949 964 grok.template('applicanteditpage') 950 965 manage_applications = False 951 966 submit_state = PAID 967 968 @property 969 def form_fields(self): 970 if self.context.special: 971 form_fields = grok.AutoFields(IApplicantEdit).select( 972 'applicant_id', 'firstname', 'middlename', 'lastname', 973 'reg_number', 'date_of_birth', 'email', 'special_application') 974 else: 975 form_fields = grok.AutoFields(IApplicantEdit).omit( 976 'locked', 'course_admitted', 'student_id', 977 'suspended', 'special_application' 978 ) 979 form_fields['applicant_id'].for_display = True 980 form_fields['reg_number'].for_display = True 981 return form_fields 952 982 953 983 @property -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py
r10384 r10831 36 36 from waeup.kofa.schema import PhoneNumber 37 37 from waeup.kofa.students.vocabularies import GenderSource, RegNumberSource 38 from waeup.kofa.university.vocabularies import AppCatSource, CertificateSource 38 from waeup.kofa.university.vocabularies import ( 39 AppCatSource, CertificateSource, SpecialApplicationSource) 39 40 40 41 #: Maximum upload size for applicant passport photographs (in bytes) … … 442 443 ) 443 444 445 special_application = schema.Choice( 446 title = _(u'Special Application'), 447 source = SpecialApplicationSource(), 448 required = False, 449 ) 450 444 451 class IApplicant(IApplicantBaseData): 445 452 """An applicant. … … 497 504 readonly = True, 498 505 ) 506 special_application = schema.Choice( 507 title = _(u'Special Application'), 508 source = SpecialApplicationSource(), 509 required = True, 510 ) 499 511 500 512 IApplicantEdit['email'].order = IApplicantEdit[ -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r10655 r10831 868 868 in logcontent) 869 869 return 870 871 872 def test_pay_special_fee(self): 873 # Add special application container 874 container_name = u'special%s' % session_1 875 applicantscontainer = ApplicantsContainer() 876 applicantscontainer.code = container_name 877 applicantscontainer.prefix = 'special' 878 applicantscontainer.year = session_1 879 applicantscontainer.title = u'This is a special app container' 880 applicantscontainer.application_category = 'no' 881 applicantscontainer.mode = 'create' 882 applicantscontainer.strict_deadline = True 883 delta = timedelta(days=10) 884 applicantscontainer.startdate = datetime.now(pytz.utc) - delta 885 applicantscontainer.enddate = datetime.now(pytz.utc) + delta 886 self.app['applicants'][container_name] = applicantscontainer 887 # Add an applicant 888 applicant = createObject('waeup.Applicant') 889 # reg_number is the only field which has to be preset here 890 # because managers are allowed to edit this required field 891 applicant.reg_number = u'12345' 892 self.app['applicants'][container_name].addApplicant(applicant) 893 IUserAccount( 894 self.app['applicants'][container_name][ 895 applicant.application_number]).setPassword('apwd') 896 # Add session configuration object 897 configuration = SessionConfiguration() 898 configuration.academic_session = session_1 899 configuration.transcript_fee = 200.0 900 self.app['configuration'].addSessionConfiguration(configuration) 901 # Login 902 self.browser.open(self.login_path) 903 self.browser.getControl( 904 name="form.login").value = applicant.applicant_id 905 self.browser.getControl(name="form.password").value = 'apwd' 906 self.browser.getControl("Login").click() 907 self.browser.getLink("Edit application record").click() 908 self.browser.getControl(name="form.firstname").value = 'John' 909 self.browser.getControl(name="form.middlename").value = 'Anthony' 910 self.browser.getControl(name="form.lastname").value = 'Tester' 911 self.browser.getControl(name="form.special_application").value = [ 912 'transcript'] 913 self.browser.getControl(name="form.date_of_birth").value = '09/09/1988' 914 #self.browser.getControl(name="form.sex").value = ['m'] 915 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 916 self.browser.getControl("Save").click() 917 self.browser.getControl("Add online payment ticket").click() 918 self.assertMatches('...Payment ticket created...', 919 self.browser.contents) 920 self.assertTrue( 921 '<span>Transcript Fee</span>' in self.browser.contents) 922 self.assertTrue( 923 'This is a special app container' in self.browser.contents) 924 self.assertTrue( 925 '<span>200.0</span>' in self.browser.contents) 926 return 927 870 928 871 929 def test_duplicate_choice(self): -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
r10654 r10831 142 142 'course_admitted,date_of_birth,display_fullname,email,firstname,' 143 143 'history,lastname,locked,middlename,notice,password,phone,' 144 'reg_number,sex,s tate,'144 'reg_number,sex,special_application,state,' 145 145 'student_id,suspended,container_code\r\n' 146 146 'dp2011_654321,,654321,,,,,Anna Tester,,Anna,' … … 148 148 self.assertTrue( 149 149 'Application initialized by system\'],Tester,' 150 '0,,,,,,, initialized,,0,dp2011\r\n'150 '0,,,,,,,,initialized,,0,dp2011\r\n' 151 151 in result) 152 152 return … … 166 166 'course_admitted,date_of_birth,display_fullname,email,firstname,' 167 167 'history,lastname,locked,middlename,notice,password,phone,' 168 'reg_number,sex,s tate,'168 'reg_number,sex,special_application,state,' 169 169 'student_id,suspended,container_code\r\n' 170 170 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' … … 174 174 'Application initialized by system\'],' 175 175 'Tester,0,M.,"Some notice\nin lines.",any password,' 176 '+234-123-12345#,123456,f, initialized,,0,dp2011\r\n'176 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 177 177 in result) 178 178 … … 190 190 'course_admitted,date_of_birth,display_fullname,email,firstname,' 191 191 'history,lastname,locked,middlename,notice,password,phone,' 192 'reg_number,sex,s tate,'192 'reg_number,sex,special_application,state,' 193 193 'student_id,suspended,container_code\r\n' 194 194 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' … … 198 198 'Application initialized by system\'],' 199 199 'Tester,0,M.,"Some notice\nin lines.",any password,' 200 '+234-123-12345#,123456,f, initialized,,0,dp2011\r\n'200 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 201 201 in result) 202 202 return … … 212 212 'course_admitted,date_of_birth,display_fullname,email,firstname,' 213 213 'history,lastname,locked,middlename,notice,password,phone,' 214 'reg_number,sex,s tate,'214 'reg_number,sex,special_application,state,' 215 215 'student_id,suspended,container_code\r\n' 216 216 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' … … 220 220 'Application initialized by system\'],' 221 221 'Tester,0,M.,"Some notice\nin lines.",any password,' 222 '+234-123-12345#,123456,f, initialized,,0,dp2011\r\n'222 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 223 223 in result) 224 224 # In empty container no applicants are exported … … 233 233 'course2,course_admitted,date_of_birth,display_fullname,email,' 234 234 'firstname,history,lastname,locked,middlename,notice,password,' 235 'phone,reg_number,sex,state,student_id,suspended,container_code\r\n' 236 in result) 237 return 235 'phone,reg_number,sex,special_application,state,student_id,' 236 'suspended,container_code\r\n' 237 in result) 238 return -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py
r10208 r10831 35 35 APP_TYPES_DICT = { 36 36 'app': ['General Studies', 'APP'], 37 'special': ['Special Application', 'SPE'], 37 38 } 38 39 … … 42 43 } 43 44 44 def setPaymentDetails(self, container, payment ):45 def setPaymentDetails(self, container, payment, applicant): 45 46 """Set the payment data of an applicant. 46 47 """ … … 56 57 return _(u'Session configuration object is not available.') 57 58 payment.amount_auth = session_config.application_fee 59 payment.p_category = 'application' 60 if container.prefix.startswith('special'): 61 fee_name = applicant.special_application + '_fee' 62 payment.amount_auth = getattr(session_config, fee_name, 0.0) 63 payment.p_category = applicant.special_application 58 64 payment.p_id = "p%s" % timestamp 59 65 payment.p_item = container.title 60 66 payment.p_session = container.year 61 payment.p_category = 'application'62 67 return None 63 68 -
main/waeup.kofa/trunk/src/waeup/kofa/university/vocabularies.py
r10436 r10831 121 121 def getTitle(self, context, value): 122 122 return "%s - %s" % (value.code, value.title) 123 124 class SpecialApplicationSource(ContextualDictSourceFactoryBase): 125 """A special application source delivers all types of 126 applications which are not linked with certificates. 127 """ 128 #: name of dict to deliver from kofa utils. 129 DICT_NAME = 'SPECIAL_APP_DICT' -
main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
r10449 r10831 150 150 'regular': 'Regular Hostel', 151 151 'blocked': 'Blocked Hostel', 152 'pd': 'Postgraduate Hostel' 152 'pg': 'Postgraduate Hostel' 153 } 154 155 SPECIAL_APP_DICT = { 156 'transcript': 'Transcript Fee Payment', 153 157 } 154 158
Note: See TracChangeset for help on using the changeset viewer.