Changeset 16086 for main/waeup.kofa/trunk
- Timestamp:
- 6 May 2020, 13:39:48 (5 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r16064 r16086 4 4 1.6.1.dev0 (unreleased) 5 5 ======================= 6 7 * Implement `ExportPDFBaseDataPlusSlip` (without button 8 in the base package) 6 9 7 10 * Implement `ApplicantRefereeReportExporter`. -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r16085 r16086 702 702 mapping = {'a':self.context.display_fullname}) 703 703 704 class ExportPDFBaseDataPlusSlip(UtilityView, grok.View): 705 """Deliver a PDF base and studycourse data slip. 706 """ 707 grok.context(IStudentStudyCourse) 708 grok.name('basedata_slip.pdf') 709 grok.require('waeup.viewStudent') 710 prefix = 'form' 711 712 omit_fields = ( 713 'suspended', 714 'adm_code', 'suspended_comment', 715 'current_level', 716 'flash_notice', 'entry_session', 717 'parents_email') 718 719 form_fields = grok.AutoFields(IStudentStudyCourse).omit('certificate') 720 721 @property 722 def title(self): 723 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 724 return translate(_('Current Study Course Data'), 'waeup.kofa', 725 target_language=portal_language) 726 727 @property 728 def label(self): 729 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 730 return translate(_('Base and Study Course Data of'), 731 'waeup.kofa', target_language=portal_language) \ 732 + ' %s' % self.context.student.display_fullname 733 734 def render(self): 735 studentview = StudentBasePDFFormPage(self.context.student, 736 self.request, self.omit_fields) 737 students_utils = getUtility(IStudentsUtils) 738 return students_utils.renderPDF( 739 self, 'basedata_slip.pdf', 740 self.context.student, studentview, 741 omit_fields=self.omit_fields) 742 704 743 class ExportPDFClearanceSlip(grok.View): 705 744 """Deliver a PDF slip of the context. -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r16030 r16086 2618 2618 return 2619 2619 2620 def test_student_basedata_slip(self): 2621 IWorkflowState(self.student).setState('school fee paid') 2622 self.browser.open(self.login_path) 2623 self.browser.getControl(name="form.login").value = self.student_id 2624 self.browser.getControl(name="form.password").value = 'spwd' 2625 self.browser.getControl("Login").click() 2626 # Students can open base data slip 2627 # (no button available in base package) 2628 pdf_url = '%s/basedata_slip.pdf' % self.studycourse_path 2629 self.browser.open(pdf_url) 2630 self.assertEqual(self.browser.headers['Status'], '200 Ok') 2631 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 2632 path = os.path.join(samples_dir(), 'basedata_slip.pdf') 2633 open(path, 'wb').write(self.browser.contents) 2634 print "Sample PDF basedata_slip.pdf written to %s" % path 2635 2620 2636 def test_student_clearance(self): 2621 2637 # Student cant login if their password is not set -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r16034 r16086 149 149 f_text = Paragraph(f_text, ENTRY1_STYLE) 150 150 data_middle.append([f_label,f_text]) 151 151 if not 'date_of_birth' in omit_fields: 152 f_label = trans(_('Date of Birth:'), lang) 153 f_label = Paragraph(f_label, ENTRY1_STYLE) 154 date_of_birth = studentview.context.date_of_birth 155 tz = getUtility(IKofaUtils).tzinfo 156 date_of_birth = to_timezone(date_of_birth, tz) 157 if date_of_birth is not None: 158 date_of_birth = date_of_birth.strftime("%d/%m/%Y") 159 f_text = formatted_text(date_of_birth) 160 f_text = Paragraph(f_text, ENTRY1_STYLE) 161 data_middle.append([f_label,f_text]) 152 162 if getattr(studentview.context, 'certcode', None): 153 163 if not 'certificate' in omit_fields: … … 205 215 studentview.context, current_level) 206 216 f_text = formatted_text(current_level) 207 f_text = Paragraph(f_text, ENTRY1_STYLE)208 data_middle.append([f_label,f_text])209 if not 'date_of_birth' in omit_fields:210 f_label = trans(_('Date of Birth:'), lang)211 f_label = Paragraph(f_label, ENTRY1_STYLE)212 date_of_birth = studentview.context.date_of_birth213 tz = getUtility(IKofaUtils).tzinfo214 date_of_birth = to_timezone(date_of_birth, tz)215 if date_of_birth is not None:216 date_of_birth = date_of_birth.strftime("%d/%m/%Y")217 f_text = formatted_text(date_of_birth)218 217 f_text = Paragraph(f_text, ENTRY1_STYLE) 219 218 data_middle.append([f_label,f_text])
Note: See TracChangeset for help on using the changeset viewer.