Changeset 15592
- Timestamp:
- 18 Sep 2019, 16:51:44 (5 years ago)
- Location:
- main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/browser.py
r15588 r15592 173 173 form_fields = grok.AutoFields(ICustomSpecialApplicant) 174 174 form_fields = form_fields.omit( 175 'special_application', 'carryover_courses', 175 'special_application', 176 'carryover_courses_1', 177 'carryover_courses_2', 176 178 'locked', 'suspended') 177 179 return form_fields … … 204 206 def note(self): 205 207 if self.context.special: 206 return 208 return '''<br /><br /> 209 Head of Department Signature: 210 ''' 207 211 note = getattr(self.context.__parent__, 'application_slip_notice', None) 208 212 if note: … … 239 243 'special_application', 240 244 'locked', 'suspended', 'applicant_id') 241 if not self.context.carryover_courses: 242 form_fields = form_fields.omit('carryover_courses') 245 if not self.context.carryover_courses_1: 246 form_fields = form_fields.omit('carryover_courses_1') 247 if not self.context.carryover_courses_2: 248 form_fields = form_fields.omit('carryover_courses_2') 243 249 return form_fields 244 250 form_fields = grok.AutoFields(ICustomUGApplicant) … … 273 279 form_fields = grok.AutoFields(ICustomSpecialApplicant) 274 280 form_fields = form_fields.omit( 275 'special_application', 'carryover_courses', 281 'special_application', 282 'carryover_courses_1', 283 'carryover_courses_2', 276 284 'locked', 'suspended') 277 285 form_fields['applicant_id'].for_display = True … … 291 299 super(CustomApplicantManageFormPage,self).setUpWidgets(ignore_request) 292 300 if self.context.special: 293 self.widgets['carryover_courses'].height = 3 301 self.widgets['carryover_courses_1'].height = 3 302 self.widgets['carryover_courses_2'].height = 3 294 303 return 295 304 … … 311 320 form_fields = grok.AutoFields(ICustomSpecialApplicant) 312 321 form_fields = form_fields.omit( 313 'special_application', 'carryover_courses', 322 'special_application', 323 'carryover_courses_1', 324 'carryover_courses_2', 314 325 'locked', 'suspended') 315 326 form_fields['applicant_id'].for_display = True … … 332 343 super(CustomApplicantEditFormPage,self).setUpWidgets(ignore_request) 333 344 if self.context.special: 334 self.widgets['carryover_courses'].height = 3 345 self.widgets['carryover_courses_1'].height = 3 346 self.widgets['carryover_courses_2'].height = 3 335 347 return 336 348 -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/interfaces.py
r15588 r15592 289 289 class ICustomSpecialApplicant(ISpecialApplicant): 290 290 291 department = schema.TextLine(292 title = _(u' Department'),293 required = True,294 re adonly = False,291 certificate = schema.Choice( 292 title = _(u'Course of Study'), 293 source = CertificateSource(), 294 required = True, 295 295 ) 296 296 … … 302 302 ) 303 303 304 carryover_courses = schema.Text( 305 title = _(u'Carry-Over Courses'), 306 required = False, 307 #description = _( 308 # u'Enter course titles if carry-over remedial payment.'), 309 ) 304 carryover_courses_1 = schema.Text( 305 title = _(u'1st Semseter Carry-Over Courses'), 306 required = False, 307 ) 308 309 carryover_courses_2 = schema.Text( 310 title = _(u'2nd Semester Carry-Over Courses'), 311 required = False, 312 ) 313 310 314 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, 311 315 ICustomSpecialApplicant): -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/tests/test_browser.py
r14887 r15592 35 35 from waeup.kofa.university.faculty import Faculty 36 36 from waeup.kofa.university.department import Department 37 from waeup.kofa.interfaces import IUserAccount 38 from waeup.kofa.configuration import SessionConfiguration 37 39 from waeup.kofa.testing import FunctionalTestCase 38 40 from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup … … 75 77 #self.ndftcontainer.title = u'This is the %s container' % ndftcontainer_name 76 78 self.app['applicants'][ndftcontainer_name] = self.ndftcontainer 79 80 self.login_path = 'http://localhost/app/login' 77 81 78 82 delta = datetime.timedelta(days=10) … … 122 126 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 123 127 128 def prepare_special_container(self): 129 # Add special application container 130 container_name = u'special%s' % session 131 applicantscontainer = ApplicantsContainer() 132 applicantscontainer.code = container_name 133 applicantscontainer.prefix = 'special' 134 applicantscontainer.year = session 135 applicantscontainer.with_picture = False 136 applicantscontainer.title = u'This is a special app container' 137 applicantscontainer.application_category = 'no' 138 applicantscontainer.mode = 'create' 139 applicantscontainer.strict_deadline = True 140 delta = datetime.timedelta(days=10) 141 applicantscontainer.startdate = datetime.datetime.now(pytz.utc) - delta 142 applicantscontainer.enddate = datetime.datetime.now(pytz.utc) + delta 143 self.app['applicants'][container_name] = applicantscontainer 144 # Add an applicant 145 applicant = createObject('waeup.Applicant') 146 # reg_number is the only field which has to be preset here 147 # because managers are allowed to edit this required field 148 applicant.reg_number = u'12345' 149 self.special_applicant = applicant 150 self.app['applicants'][container_name].addApplicant(applicant) 151 IUserAccount( 152 self.app['applicants'][container_name][ 153 applicant.application_number]).setPassword('apwd') 154 # Add session configuration object 155 self.configuration = SessionConfiguration() 156 self.configuration.academic_session = session 157 #self.configuration.transcript_fee = 200.0 158 self.configuration.clearance_fee = 300.0 159 self.app['configuration'].addSessionConfiguration(self.configuration) 160 124 161 def test_manage_and_view_applicant(self): 125 162 # Managers can manage ndft applicants. … … 154 191 self.assertMatches('...Form has been saved...', self.browser.contents) 155 192 return 193 194 def test_special_application(self): 195 self.prepare_special_container() 196 # Login 197 self.browser.open(self.login_path) 198 self.browser.getControl( 199 name="form.login").value = self.special_applicant.applicant_id 200 self.browser.getControl(name="form.password").value = 'apwd' 201 self.browser.getControl("Login").click() 202 applicant_path = self.browser.url 203 self.browser.getLink("Edit application record").click() 204 self.browser.getControl(name="form.firstname").value = 'John' 205 self.browser.getControl(name="form.middlename").value = 'Anthony' 206 self.browser.getControl(name="form.lastname").value = 'Tester' 207 self.browser.getControl(name="form.special_application").value = [ 208 'carryover4'] 209 self.browser.getControl(name="form.date_of_birth").value = '09/09/1988' 210 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 211 self.browser.getControl(name="form.certificate").value = ['CERT1'] 212 self.browser.getControl(name="form.carryover_courses_1").value = 'Test Course 1 - TCO1' 213 self.browser.getControl(name="form.carryover_courses_2").value = 'Test Course 2 - TCO2 \nTest Course 3 - TCO3' 214 self.browser.getControl(name="form.grad_year").value = ['2015'] 215 self.configuration.carryover4_fee = 5000.0 216 self.browser.getControl("Save").click() 217 self.browser.getControl("Add online payment ticket").click() 218 self.assertMatches('...Payment ticket created...', 219 self.browser.contents) 220 self.assertTrue( 221 '<span>4 Carry-Over Courses</span>' in self.browser.contents) 222 self.assertTrue( 223 'This is a special app container' in self.browser.contents) 224 self.assertTrue( 225 '<span>5000.0</span>' in self.browser.contents) 226 self.assertEqual(len(self.special_applicant.keys()), 1) 227 payment_id = self.special_applicant.keys()[0] 228 # The applicant's workflow state is paid ... 229 self.special_applicant.payments[0].approveApplicantPayment() 230 self.assertEqual(self.special_applicant.state, 'paid') 231 self.browser.open(applicant_path + '/edit') 232 self.browser.getControl("Finally Submit").click() 233 self.browser.open(applicant_path + '/' + payment_id) 234 self.browser.getLink("Download payment slip").click() 235 self.assertEqual(self.browser.headers['Content-Type'], 236 'application/pdf') 237 path = os.path.join(samples_dir(), 'special_payment_slip.pdf') 238 open(path, 'wb').write(self.browser.contents) 239 print "Sample PDF clearance_slip.pdf written to %s" % path 240 self.browser.open(applicant_path) 241 self.browser.getLink("Download application slip").click() 242 path = os.path.join(samples_dir(), 'application_slip.pdf') 243 open(path, 'wb').write(self.browser.contents) 244 print "Sample application_slip.pdf written to %s" % path 156 245 157 246 class ApplicantExporterTest(ApplicantImportExportSetup):
Note: See TracChangeset for help on using the changeset viewer.