1 | ## $Id: browser.py 16699 2021-11-04 17:07:40Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | import grok |
---|
19 | import os |
---|
20 | from zope.i18n import translate |
---|
21 | from zope.schema.interfaces import ConstraintNotSatisfied |
---|
22 | from zope.component import getUtility |
---|
23 | from hurry.workflow.interfaces import IWorkflowInfo |
---|
24 | from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils |
---|
25 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
26 | from waeup.kofa.browser.layout import KofaEditFormPage |
---|
27 | from waeup.kofa.browser.layout import action, jsaction |
---|
28 | from waeup.kofa.students.browser import ( |
---|
29 | StudyLevelEditFormPage, StudyLevelDisplayFormPage, |
---|
30 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, |
---|
31 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
32 | ExportPDFAdmissionSlip, StartClearancePage, |
---|
33 | msave, emit_lock_message) |
---|
34 | from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket |
---|
35 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
36 | from kofacustom.nigeria.students.browser import ( |
---|
37 | NigeriaOnlinePaymentDisplayFormPage, |
---|
38 | NigeriaStudentBaseManageFormPage, |
---|
39 | NigeriaStudentClearanceEditFormPage, |
---|
40 | NigeriaOnlinePaymentAddFormPage, |
---|
41 | NigeriaExportPDFPaymentSlip, |
---|
42 | NigeriaExportPDFClearanceSlip, |
---|
43 | ) |
---|
44 | |
---|
45 | from kofacustom.edocons.students.interfaces import ( |
---|
46 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
47 | ICustomStudentStudyLevel) |
---|
48 | from kofacustom.edocons.interfaces import MessageFactory as _ |
---|
49 | |
---|
50 | class CustomStartClearancePage(StartClearancePage): |
---|
51 | with_ac = False |
---|
52 | |
---|
53 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
---|
54 | """Deliver a PDF Admission slip. |
---|
55 | """ |
---|
56 | |
---|
57 | omit_fields = ('date_of_birth', 'current_level', 'current_mode', |
---|
58 | 'certificate', 'faculty') |
---|
59 | #form_fields = grok.AutoFields(IStudentBase).select('student_id', 'reg_number') |
---|
60 | |
---|
61 | post_text = ''' |
---|
62 | You are expected to proceed and pay your school fees on or before the 12th of November 2021. |
---|
63 | |
---|
64 | Please visit the College Registry (Student Affairs Division) at: |
---|
65 | |
---|
66 | Edo State College of Nursing Sciences |
---|
67 | |
---|
68 | Godwin Abbey Way (Formerly Limit Road) off Sapele Road, Benin City |
---|
69 | |
---|
70 | or call 08104797237 for enquiries. |
---|
71 | |
---|
72 | Congratulations! |
---|
73 | ''' |
---|
74 | |
---|
75 | @property |
---|
76 | def label(self): |
---|
77 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
78 | return translate(_('Admission Letter of'), |
---|
79 | 'waeup.kofa', target_language=portal_language) \ |
---|
80 | + ' %s' % self.context.display_fullname |
---|
81 | |
---|
82 | def render(self): |
---|
83 | students_utils = getUtility(IStudentsUtils) |
---|
84 | letterhead_path = os.path.join( |
---|
85 | os.path.dirname(__file__), 'static', 'letterhead_admission.jpg') |
---|
86 | if not os.path.exists(letterhead_path): |
---|
87 | letterhead_path = None |
---|
88 | return students_utils.renderPDFAdmissionLetter(self, |
---|
89 | self.context.student, omit_fields=self.omit_fields, |
---|
90 | letterhead_path=letterhead_path, post_text=self.post_text) |
---|
91 | |
---|