source: main/waeup.fceokene/trunk/src/waeup/fceokene/students/browser.py @ 15961

Last change on this file since 15961 was 15961, checked in by Henrik Bettermann, 5 years ago

Remove Interswitch surcharge notice.

  • Property svn:keywords set to Id
File size: 8.1 KB
Line 
1## $Id: browser.py 15961 2020-01-27 13:03:41Z 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##
18import grok
19import os
20from zope.i18n import translate
21from zope.component import getUtility
22from zope.security import checkPermission
23from hurry.workflow.interfaces import IWorkflowInfo
24from waeup.kofa.interfaces import ADMITTED, IKofaUtils
25from waeup.kofa.interfaces import MessageFactory as _
26from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
27from waeup.kofa.students.interfaces import IStudentsUtils
28from waeup.kofa.students.browser import (
29    StartClearancePage,
30    ExportPDFAdmissionSlip, StudyLevelDisplayFormPage,
31    PaymentsManageFormPage,
32    OnlinePaymentApproveView)
33from kofacustom.nigeria.students.browser import (
34    NigeriaOnlinePaymentDisplayFormPage,
35    NigeriaOnlinePaymentAddFormPage,
36    NigeriaExportPDFPaymentSlip,
37    NigeriaStudentClearanceEditFormPage,
38    NigeriaExportPDFClearanceSlip,
39    NigeriaExportPDFCourseRegistrationSlip,
40    NigeriaBedTicketAddPage,
41    )
42
43from waeup.fceokene.students.interfaces import (
44    ICustomStudentOnlinePayment, ICustomUGStudentClearance,
45    ICustomStudentStudyLevel)
46
47class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip):
48    """Deliver a PDF Admission slip.
49    """
50
51    @property
52    def label(self):
53        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
54        line0 = ''
55        if self.context.student.current_mode.startswith('ug'):
56            line0 = 'IN AFFILIATION WITH UNIVERSITY OF IBADAN\n'
57        line1 = translate(_('Admission Letter of'),
58            'waeup.kofa', target_language=portal_language) \
59            + ' %s' % self.context.display_fullname
60        return '%s%s' % (line0, line1)
61
62    @property
63    def _post_text(self):
64        return """You should note the following as conditions for admission:
65
661. At the point of registration, you will be required to present the originals of your certificate(s),
67   Jamb Original Result, a Birth Certificate or a Declaration of Age Certificate and Evidence of
68   Citizenship Certificate.
69
702. Please note that the name by which you are hereby admitted and by which you will be registered
71   is the one which will appear on any certificate that the Federal College of Education, Okene may
72   issue to you on successful completion of your programme except there was a change of name by
73   sworn affidavit or marriage certificate in addition to newspaper publication.
74
753. You are hereby informed that all fees must be paid at the beginning of the academic session.
76   The current school fees can be obtained from the College website.
77
784. You will present at the time of registration the Medical Certificate of Fitness from the Federal
79   College of Education, Okene Medical Centre.
80
815. Please, note that due to shortage of accommodations, students shall be given accommodations
82   on first come, first serve basis.
83
846. The offer is not transferable to another session.
85
867. You will sign a declaration of good conduct except by deferment on your arrival at the College.
87
88Accept my congratulations.
89
90Yours faithfully
91
92M. S. Adoke
93Deputy Registrar (Admissions)
94For: Registrar
95"""
96
97    def render(self):
98        students_utils = getUtility(IStudentsUtils)
99        letterhead_path = os.path.join(
100            os.path.dirname(__file__), 'static', 'letterhead_admission.jpg')
101        topMargin=1.6
102        if self.context.student.current_mode.startswith('ug'):
103            letterhead_path = None
104            topMargin=1.5
105        return students_utils.renderPDFAdmissionLetter(self,
106            self.context.student, omit_fields=self.omit_fields,
107            letterhead_path=letterhead_path,
108            topMargin=topMargin,
109            post_text=self._post_text)
110
111class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
112    """ Page to view an online payment ticket
113    """
114    grok.context(ICustomStudentOnlinePayment)
115    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
116        'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item', 'p_combi')
117    form_fields[
118        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
119    form_fields[
120        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
121
122class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage):
123    """ Page to add an online payment ticket
124    """
125    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
126        'p_combi')
127
128class OnlinePaymentApproveView(OnlinePaymentApproveView):
129    grok.require('waeup.manageStudent')
130
131class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip):
132    """Deliver a PDF slip of the context.
133    """
134    grok.context(ICustomStudentOnlinePayment)
135    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
136        'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item', 'p_combi')
137    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
138    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
139
140class CustomStartClearancePage(StartClearancePage):
141
142    @property
143    def with_ac(self):
144        mode = getattr(self.context, 'current_mode', None)
145        if mode and mode.startswith('ug'):
146            return True
147        return False
148
149class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip):
150    """Deliver a PDF slip of the context.
151    """
152
153    @property
154    def form_fields(self):
155        if self.context.is_postgrad:
156            form_fields = grok.AutoFields(
157                ICustomPGStudentClearance).omit('clearance_locked')
158        else:
159            form_fields = grok.AutoFields(
160                ICustomUGStudentClearance).omit('clearance_locked')
161        if not getattr(self.context, 'officer_comment'):
162            form_fields = form_fields.omit('officer_comment')
163        return form_fields
164
165    @property
166    def label(self):
167        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
168
169        line0 = ''
170        if self.context.student.current_mode.startswith('ug'):
171            line0 = 'Directorate of Undergraduate Programme\n'
172        line1 = translate(_('Clearance Slip of'),
173            'waeup.kofa', target_language=portal_language) \
174            + ' %s' % self.context.display_fullname
175        return '%s%s' % (line0, line1)
176
177
178class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
179    """ View to edit student clearance data by student
180    """
181
182    def dataNotComplete(self):
183        return False
184
185class CustomBedTicketAddPage(NigeriaBedTicketAddPage):
186    """ Page to add an online payment ticket
187    """
188    buttonname = _('Create bed ticket')
189    notice = ''
190    with_ac = False
191
192class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
193    """ Page to display student study levels
194    """
195    grok.context(ICustomStudentStudyLevel)
196    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level')
197    form_fields[
198        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
199
200class CustomExportPDFCourseRegistrationSlip(
201    NigeriaExportPDFCourseRegistrationSlip):
202    """Deliver a PDF slip of the context.
203    """
204    grok.context(ICustomStudentStudyLevel)
205    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level')
206
207class CustomPaymentsManageFormPage(PaymentsManageFormPage):
208    """ Page to manage the student payments. This manage form page is for
209    both students and students officers. FCEOkene does not allow students
210    to remove any payment ticket.
211    """
212    @property
213    def manage_payments_allowed(self):
214        return checkPermission('waeup.manageStudent', self.context)
Note: See TracBrowser for help on using the repository browser.