1 | ## $Id: browser.py 16796 2022-02-10 16:43:49Z 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 zope.security import checkPermission |
---|
24 | from hurry.workflow.interfaces import IWorkflowInfo |
---|
25 | from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils |
---|
26 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
27 | from waeup.kofa.browser.layout import KofaEditFormPage |
---|
28 | from waeup.kofa.browser.layout import action, jsaction |
---|
29 | from waeup.kofa.students.browser import ( |
---|
30 | StudyLevelEditFormPage, StudyLevelDisplayFormPage, |
---|
31 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, |
---|
32 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
33 | ExportPDFAdmissionSlip, StartClearancePage, PaymentsManageFormPage, |
---|
34 | BalancePaymentAddFormPage, msave, emit_lock_message) |
---|
35 | from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket |
---|
36 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
37 | from kofacustom.nigeria.students.browser import ( |
---|
38 | NigeriaOnlinePaymentDisplayFormPage, |
---|
39 | NigeriaStudentBaseManageFormPage, |
---|
40 | NigeriaStudentClearanceEditFormPage, |
---|
41 | NigeriaOnlinePaymentAddFormPage, |
---|
42 | NigeriaExportPDFPaymentSlip, |
---|
43 | NigeriaExportPDFClearanceSlip, |
---|
44 | NigeriaExportPDFPaymentSlip, |
---|
45 | ) |
---|
46 | |
---|
47 | from kofacustom.edocons.students.interfaces import ( |
---|
48 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
49 | ICustomStudentStudyLevel) |
---|
50 | from kofacustom.edocons.interfaces import MessageFactory as _ |
---|
51 | |
---|
52 | class CustomStartClearancePage(StartClearancePage): |
---|
53 | with_ac = False |
---|
54 | |
---|
55 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
---|
56 | """Deliver a PDF Admission slip. |
---|
57 | """ |
---|
58 | |
---|
59 | omit_fields = ('date_of_birth', 'current_level', 'current_mode', |
---|
60 | 'certificate', 'faculty') |
---|
61 | #form_fields = grok.AutoFields(IStudentBase).select('student_id', 'reg_number') |
---|
62 | |
---|
63 | post_text = ''' |
---|
64 | This admission will be confirmed upon payment of school fees. |
---|
65 | |
---|
66 | NOTE: ALL ADMITTED STUDENTS ARE TO PAY THEIR SCHOOL FEES ON OR BEFORE FRIDAY THE 25TH OF FEBUARY, 2022. |
---|
67 | |
---|
68 | ALSO, HOSTEL ACCOMMODATION IS AVAILABLE ON FIRST COME FIRST SERVE BASIS. |
---|
69 | |
---|
70 | Please visit the College Registry (Student Affairs Division) at: |
---|
71 | |
---|
72 | Edo State College of Nursing Sciences |
---|
73 | Godwin Abbey Way (Formerly Limit Road) off Sapele Road, Benin City |
---|
74 | or call 08104797237 for enquiries. |
---|
75 | |
---|
76 | Congratulations! |
---|
77 | ''' |
---|
78 | |
---|
79 | @property |
---|
80 | def label(self): |
---|
81 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
82 | return translate(_('Admission Letter of'), |
---|
83 | 'waeup.kofa', target_language=portal_language) \ |
---|
84 | + ' %s' % self.context.display_fullname |
---|
85 | |
---|
86 | def render(self): |
---|
87 | students_utils = getUtility(IStudentsUtils) |
---|
88 | letterhead_path = os.path.join( |
---|
89 | os.path.dirname(__file__), 'static', 'letterhead_admission.jpg') |
---|
90 | if not os.path.exists(letterhead_path): |
---|
91 | letterhead_path = None |
---|
92 | return students_utils.renderPDFAdmissionLetter(self, |
---|
93 | self.context.student, omit_fields=self.omit_fields, |
---|
94 | letterhead_path=letterhead_path, post_text=self.post_text) |
---|
95 | |
---|
96 | |
---|
97 | class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): |
---|
98 | """Deliver a PDF slip of the context. |
---|
99 | """ |
---|
100 | omit_fields = ('password', 'suspended', 'suspended_comment', 'phone', |
---|
101 | 'adm_code', 'sex', 'email', 'date_of_birth', 'current_level', |
---|
102 | 'flash_notice', 'certificate', 'faculty', 'parents_email') |
---|
103 | |
---|
104 | class CustomPaymentsManageFormPage(PaymentsManageFormPage): |
---|
105 | """ Page to manage the student payments. This manage form page is for |
---|
106 | both students and students officers. EDOCONS does not allow students |
---|
107 | to remove any payment ticket. |
---|
108 | """ |
---|
109 | @property |
---|
110 | def manage_payments_allowed(self): |
---|
111 | return checkPermission('waeup.manageStudent', self.context) |
---|
112 | |
---|
113 | class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage): |
---|
114 | grok.require('waeup.payStudent') |
---|
115 | |
---|