source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py @ 16573

Last change on this file since 16573 was 16572, checked in by Henrik Bettermann, 3 years ago

Remove Non-ASCII character

  • Property svn:keywords set to Id
File size: 27.7 KB
Line 
1## $Id: browser.py 16572 2021-08-16 10:54:02Z 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.schema.interfaces import ConstraintNotSatisfied
22from zope.component import getUtility
23from zope.security import checkPermission
24from zope.formlib.textwidgets import BytesDisplayWidget
25from hurry.workflow.interfaces import IWorkflowInfo
26from waeup.kofa.interfaces import (REQUESTED, ADMITTED, CLEARANCE,
27    IExtFileStore, IKofaUtils, academic_sessions_vocab)
28from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
29from waeup.kofa.browser.layout import (
30    action, jsaction, UtilityView, KofaEditFormPage)
31from waeup.kofa.students.browser import (
32    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
33    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
34    CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
35    StartClearancePage, BalancePaymentAddFormPage,
36    ExportPDFAdmissionSlip, ExportPDFPersonalDataSlip,
37    PaymentsManageFormPage,
38    msave, emit_lock_message)
39from waeup.kofa.students.interfaces import (
40    IStudentsUtils, ICourseTicket, IStudent)
41from waeup.kofa.students.vocabularies import StudyLevelSource
42from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
43from kofacustom.nigeria.students.browser import (
44    NigeriaOnlinePaymentDisplayFormPage,
45    NigeriaStudentBaseDisplayFormPage,
46    NigeriaStudentBaseManageFormPage,
47    NigeriaStudentClearanceEditFormPage,
48    NigeriaOnlinePaymentAddFormPage,
49    NigeriaExportPDFPaymentSlip,
50    NigeriaExportPDFClearanceSlip,
51    NigeriaExportPDFCourseRegistrationSlip,
52    NigeriaStudentBaseEditFormPage,
53    NigeriaBedTicketAddPage,
54    NigeriaAccommodationManageFormPage,
55    NigeriaAccommodationDisplayFormPage,
56    NigeriaStudentPersonalManageFormPage,
57    NigeriaStudentPersonalEditFormPage,
58    NigeriaStudentPersonalDisplayFormPage
59    )
60from kofacustom.iuokada.students.interfaces import (
61    ICustomStudentOnlinePayment, ICustomStudentStudyCourse,
62    ICustomStudentStudyLevel, ICustomStudentBase, ICustomStudent,
63    ICustomStudentPersonal, ICustomStudentPersonalEdit)
64from kofacustom.iuokada.interfaces import MessageFactory as _
65
66class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage):
67    """ Page to display student base data
68    """
69    form_fields = grok.AutoFields(ICustomStudentBase).omit(
70        'password', 'suspended', 'suspended_comment', 'flash_notice')
71
72class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage):
73    """ View to manage student base data
74    """
75    form_fields = grok.AutoFields(ICustomStudentBase).omit(
76        'student_id', 'adm_code', 'suspended',
77        'financially_cleared_by', 'financial_clearance_date')
78
79class StudentBaseEditFormPage(NigeriaStudentBaseEditFormPage):
80    """ View to edit student base data
81    """
82    @property
83    def form_fields(self):
84        form_fields = grok.AutoFields(ICustomStudentBase).select(
85            'email', 'email2', 'parents_email', 'phone',)
86        if not self.context.state in (ADMITTED, CLEARANCE):
87            form_fields['parents_email'].for_display = True
88        return form_fields
89
90class CustomExportPDFCourseRegistrationSlip(
91    NigeriaExportPDFCourseRegistrationSlip):
92    """Deliver a PDF slip of the context.
93    """
94
95    def _signatures(self):
96        return (
97                ['Student Signature'],
98                ['HoD / Course Adviser Signature'],
99                ['College Officer Signature'],
100                ['Dean Signature']
101                )
102
103    #def _sigsInFooter(self):
104    #    return (_('Student'),
105    #            _('HoD / Course Adviser'),
106    #            _('College Officer'),
107    #            _('Dean'),
108    #            )
109    #    return ()
110
111class CustomStudentPersonalDisplayFormPage(NigeriaStudentPersonalDisplayFormPage):
112    """ Page to display student personal data
113    """
114    form_fields = grok.AutoFields(ICustomStudentPersonal)
115    form_fields['perm_address'].custom_widget = BytesDisplayWidget
116    form_fields['postal_address'].custom_widget = BytesDisplayWidget
117    form_fields['hostel_address'].custom_widget = BytesDisplayWidget
118    form_fields['father_address'].custom_widget = BytesDisplayWidget
119    form_fields['mother_address'].custom_widget = BytesDisplayWidget
120    form_fields['guardian_address'].custom_widget = BytesDisplayWidget
121    form_fields[
122        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
123
124
125class CustomStudentPersonalEditFormPage(NigeriaStudentPersonalEditFormPage):
126    """ Page to edit personal data
127    """
128    form_fields = grok.AutoFields(ICustomStudentPersonalEdit).omit(
129        'personal_updated')
130
131    def update(self):
132        #if not self.context.is_fresh:
133        #    self.flash('Not allowed.', type="danger")
134        #    self.redirect(self.url(self.context))
135        #    return
136        if not self.context.minimumStudentPayments():
137            self.flash('Please make 40% of your tution fee payments first.',
138                       type="warning")
139            self.redirect(self.url(self.context, 'view_personal'))
140            return
141        super(CustomStudentPersonalEditFormPage, self).update()
142        return
143
144
145class CustomStudentPersonalManageFormPage(NigeriaStudentPersonalManageFormPage):
146    """ Page to manage personal data
147    """
148    form_fields = grok.AutoFields(ICustomStudentPersonal)
149    form_fields['personal_updated'].for_display = True
150    form_fields[
151        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
152
153class CustomExportPDFPersonalDataSlip(ExportPDFPersonalDataSlip):
154    """Deliver a PDF base and personal data slip.
155    """
156    grok.name('course_registration_clearance.pdf')
157    omit_fields = (
158        'phone', 'email',
159        'suspended',
160        'adm_code', 'suspended_comment',
161        'current_level',
162        'flash_notice', 'entry_session',
163        'parents_email')
164
165    form_fields = grok.AutoFields(ICustomStudentPersonal)
166
167    def _signatures(self):
168        return ([('I certify that the above named student has satisfied the financial requirements for registration.', 'Name and Signature of Bursary Staff', '<br><br>')],
169                [('I certify that the credentials of the student have been screened by me and the student is hereby cleared.', 'Name and Signature of Registry Staff', '<br><br>')],
170                [('I certify that the above named student has registered with the Library.', 'Name and Signature of Library Staff', '<br><br>')],
171                [('I certify that the above named student has been registered with the college. ', 'Name and Signature of College Officer', '<br><br>')],
172                [('I certify that the above named student has completed his/her ICT registration. ', 'Name and Signature of ICT Staff', '<br><br>')],
173                [('Eligibility/Congratulation Station', 'Name and Signature of Registrar', '')],
174                )
175
176    @property
177    def tabletitle(self):
178        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
179        tabletitle = []
180        session = self.context.student.current_session
181        tabletitle.append('_PB_Successful %s/%s Session Payments' %(session, session+1))
182        return tabletitle
183
184    def render(self):
185        if not self.context.minimumStudentPayments():
186            self.redirect(self.url(self.context))
187            return
188        studentview = StudentBasePDFFormPage(self.context.student,
189            self.request, self.omit_fields)
190        students_utils = getUtility(IStudentsUtils)
191
192        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
193        P_ID = translate(_('Payment Id'), 'waeup.kofa', target_language=portal_language)
194        #CD = translate(_('Creation Date'), 'waeup.kofa', target_language=portal_language)
195        PD = translate(_('Payment Date'), 'waeup.kofa', target_language=portal_language)
196        CAT = translate(_('Payment Category'), 'waeup.kofa', target_language=portal_language)
197        ITEM = translate(_('Payment Item'), 'waeup.kofa', target_language=portal_language)
198        AMT = translate(_('Amount (Naira)'), 'waeup.kofa', target_language=portal_language)
199        SSS = translate(_('Payment Session'), 'waeup.kofa', target_language=portal_language)
200        tabledata = []
201        tableheader = []
202        tabledata.append(sorted(
203            [value for value in self.context['payments'].values()
204             if value.p_state in ('paid', 'waived', 'scholarship')
205             and value.p_session >= value.student.current_session],
206             key=lambda value: value.p_session))
207        tableheader.append([(P_ID,'p_id', 4.2),
208                         #(CD,'creation_date', 3),
209                         (PD,'formatted_p_date', 3),
210                         (CAT,'category', 3),
211                         (ITEM, 'p_item', 3),
212                         (AMT, 'amount_auth', 2),
213                         (SSS, 'p_session', 2),
214                         ])
215
216        #watermark_path = os.path.join(
217        #    os.path.dirname(__file__), 'static', 'watermark.pdf')
218        #watermark = open(watermark_path, 'rb')
219        #file_path = os.path.join(
220        #    os.path.dirname(__file__), 'static', 'biodataPage2.pdf')
221        #file = open(file_path, 'rb')
222        #mergefiles = [file,]
223
224        return students_utils.renderPDF(
225            self, 'course_registration_clearance.pdf',
226            self.context.student, studentview,
227            omit_fields=self.omit_fields,
228            signatures=self._signatures(),
229
230            tableheader=tableheader,
231            tabledata=tabledata,
232
233            pagebreak=True,
234        #    mergefiles=mergefiles,
235        #    watermark=watermark
236            )
237
238class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage):
239    """ Page to view bed tickets.
240    """
241    with_hostel_selection = True
242
243class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage):
244    """ Page to manage bed tickets.
245    This manage form page is for both students and students officers.
246    """
247    with_hostel_selection = True
248
249class CustomBedTicketAddPage(NigeriaBedTicketAddPage):
250    """ Page to add a bed ticket
251    """
252    with_ac = False
253    with_bedselection = True
254
255class CustomPaymentsManageFormPage(PaymentsManageFormPage):
256    """ Page to manage the student payments. This manage form page is for
257    both students and students officers. IUOkada does not allow students
258    to remove any payment ticket.
259    """
260    grok.template('paymentsmanagepage')
261
262    @property
263    def manage_payments_allowed(self):
264        return checkPermission('waeup.manageStudent', self.context)
265
266    @property
267    def schoolfee_payments_made(self):
268        cs = self.context.student.current_session
269        SF_PAYMENTS = ('schoolfee', 'schoolfee40', 'secondinstal', 'clearance')
270        sf_paid = {cs-1: 0, cs: 0, cs+1: 0}
271        for ticket in self.context.student['payments'].values():
272            if ticket.p_category in SF_PAYMENTS and \
273                ticket.p_state == 'paid' and \
274                ticket.p_session in (cs-1, cs, cs+1):
275                sf_paid[ticket.p_session] += ticket.amount_auth
276        return sf_paid
277
278class StudentGetMatricNumberPage(UtilityView, grok.View):
279    """ Construct and set the matriculation number.
280    """
281    grok.context(IStudent)
282    grok.name('get_matric_number')
283    grok.require('waeup.manageStudent')
284
285    def update(self):
286        students_utils = getUtility(IStudentsUtils)
287        msg, mnumber = students_utils.setMatricNumber(self.context)
288        if msg:
289            self.flash(msg, type="danger")
290        else:
291            self.flash(_('Matriculation number %s assigned.' % mnumber))
292            self.context.writeLogMessage(self, '%s assigned' % mnumber)
293        self.redirect(self.url(self.context))
294        return
295
296    def render(self):
297        return
298
299class SwitchLibraryAccessView(UtilityView, grok.View):
300    """ Switch the library attribute
301    """
302    grok.context(ICustomStudent)
303    grok.name('switch_library_access')
304    grok.require('waeup.switchLibraryAccess')
305
306    def update(self):
307        if self.context.library:
308            self.context.library = False
309            self.context.writeLogMessage(self, 'library access disabled')
310            self.flash(_('Library access disabled'))
311        else:
312            self.context.library = True
313            self.context.writeLogMessage(self, 'library access enabled')
314            self.flash(_('Library access enabled'))
315        self.redirect(self.url(self.context))
316        return
317
318    def render(self):
319        return
320
321class ExportLibIdCard(UtilityView, grok.View):
322    """Deliver an id card for the library.
323    """
324    grok.context(ICustomStudent)
325    grok.name('lib_idcard.pdf')
326    grok.require('waeup.viewStudent')
327    prefix = 'form'
328
329    label = u"Library Clearance"
330
331    omit_fields = (
332        'suspended', 'email', 'phone',
333        'adm_code', 'suspended_comment',
334        'date_of_birth',
335        'current_mode', 'certificate',
336        'entry_session',
337        'flash_notice')
338
339    form_fields = []
340
341    def _sigsInFooter(self):
342        isStudent = getattr(
343            self.request.principal, 'user_type', None) == 'student'
344        if isStudent:
345            return ''
346        return (_("Date, Reader's Signature"),
347                _("Date, Circulation Librarian's Signature"),
348                )
349
350    def update(self):
351        if not self.context.library:
352            self.flash(_('Forbidden!'), type="danger")
353            self.redirect(self.url(self.context))
354        return
355
356    @property
357    def note(self):
358        return """
359<br /><br /><br /><br /><font size='12'>
360This is to certify that the bearer whose photograph and other details appear
361 overleaf is a registered user of the <b>University Library</b>.
362 The card is not transferable. A replacement fee is charged for a loss,
363 mutilation or otherwise. If found, please, return to the University Library,
364 Igbinedion University, Okada.
365</font>
366
367"""
368        return
369
370    def render(self):
371        studentview = StudentBasePDFFormPage(self.context.student,
372            self.request, self.omit_fields)
373        students_utils = getUtility(IStudentsUtils)
374        return students_utils.renderPDF(
375            self, 'lib_idcard',
376            self.context.student, studentview,
377            omit_fields=self.omit_fields,
378            sigs_in_footer=self._sigsInFooter(),
379            note=self.note)
380
381class CustomStartClearancePage(StartClearancePage):
382    with_ac = False
383
384class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage):
385    grok.require('waeup.payStudent')
386
387class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip):
388    """Deliver a PDF Admission slip.
389    """
390
391    omit_fields = ('date_of_birth',
392                   #'current_level',
393                   #'current_mode',
394                   #'entry_session'
395                   )
396
397    @property
398    def session(self):
399        return academic_sessions_vocab.getTerm(
400            self.context.entry_session).title
401
402    @property
403    def level(self):
404        studylevelsource = StudyLevelSource()
405        return studylevelsource.factory.getTitle(
406            self.context['studycourse'].certificate, self.context.current_level)
407
408    @property
409    def label(self):
410        return 'OFFER OF PROVISIONAL ADMISSION \nFOR %s SESSION' % self.session
411
412    @property
413    def pre_text_ug(self):
414        return (
415            'Following your performance in the screening exercise '
416            'for the %s academic session, I am pleased to inform '
417            'you that you have been offered provisional admission into the '
418            'Igbinedion University, Okada as follows:' % self.session)
419
420    @property
421    def pre_text_pg(self):
422        return (
423            'I am pleased to inform you that your application for admission'
424            ' into the Igbinedion University, Okada was successful. You have'
425            ' been admitted as follows:')
426
427    @property
428    def basic_medical_only_text(self):
429        return"""
430Progression to 200 Level MBBS programmes is highly competitive and strictly based on merit/approved quota. Students who are unable to make the cut off point will have the option of joining allied courses such as BSc Nursing, BSc Anatomy, BSc Biochemistry, BSc Physiology, Bachelor of Medical Laboratory Science, including Computer Science and engineering courses at 200 Level provided they have the relevant O/L credits.
431"""
432
433    @property
434    def post_text_ug(self):
435        return """
436Please note that at the point of registration for your programme of study (course), you will be required to present the following documents: Current UTME result slip, WAEC/NECO (0' Level) result, Birth certificate or sworn affidavit of age, and health certificate from a recognized Medical Centre.
437
438All credentials (original) will be checked during registration. This admission will be cancelled at any point in time it is found that your claims in the application form are false.
439
440You are required to show evidence of the result / credentials you presented on application for admission.
441
442Fees can be paid using any of the following options:
443
444Fees can be paid through your portal page. INSTRUCTIONS can be found below "FEES PAYMENT PROCEDURE" for the options you have to make your payment, as well as instructions on how to use your preferred payment option. If you choose to use the bank payment option, you can pay at any branch of the following banks through Etranzact platform only: Access Bank, First Bank, Zenith Bank
445
446Kindly note the following:
447
448Fees indicated on the Fee Structure page are valid for the current session only.
449Your Student Id (indicated above) Is your logln to the University portal.
450As an indication of your acceptance of this offer of admission, you should pay a non-refundable Acceptance deposit of N200,000. Further note that the 200,000 deposit is part of the tuition fee for the session. Failure to pay after the expiration of two weeks may lead to forfeiture of admission.
451All fees must be paid in full at the beginning of the session, as basis for accommodation, registration and attendance of lectures. This is the rule for all students at all levels. Install mental payments of not more than two installments, may be allowed under exceptional circumstances.
452Fees once paid are not refundable.
453It is advisable that you keep the original receipts of fees paid and present them on demand.
454
455Accommodation: Accommodation in University hostels is compulsory for every student. No student Is allowed to live outside the hostels. Any student who does so will be expelled from the University.
456
457Food: Food is available in cafeteria on "pay-as-you-eat" basis.
458
459Resumption Date: The University opens for fresh students on Saturday, 25th September, 2021. All newly admitted students are expected to resume on that date.
460
461Registration/Orientation Programme: Orientation programme/registration for fresh students will start on Monday, 27th September, 2021 - Thursday, 30th September, 2021. A late registration fee of N50,000 will be charged after this date. All credentials, O\'Level Results, Birth Certificate/Age Declaration, UTME Result Slip (Original) will be checked during registration. This admission will be cancelled at any point in time it is found that any of your claims in the application form is false.
462
463Transport Facility: The University provides a compulsory shuttle bus service to all students at a fee already included in the other charges.
464
465Kindly note that fresh students are not allowed the use of private vehicles.
466
467Conduct: All students are expected to conduct themselves properly and dress decently on campus, as well as obey all rules and regulations as failure to comply will attract appropriate sanctions.
468
469We wish you a successful academic career in Igbinedion University.
470
471Congratulations!
472
473
474
475<img src="${signature_benji_img_path}" valign="-20" height="38" width="86" />
476
477Friday Benji Bakare Esq.
478Registrar
479registrar@iuokada.edu.ng
48008035902949
481"""
482
483    @property
484    def post_text_pg(self):
485        return """
4861. Details of your programme will be made available to you by the Head of your Department on your arrival at the Igbinedion University.
487
4882. This offer is conditional upon the confirmation of your qualifications as listed by you in your application form. You will be required to produce the ORIGINAL COPIES of all your certificates for verification during registration. If at any time after admission, it is discovered that you do not possess any of the qualifications upon which this offer of admission was made, you will be required to withdraw from the University.
489
4903. If you accept this offer of admission upon the conditions above, you should please:
491
492(a) Complete the enclosed Acceptance Form of Provisional Offer of Admission in duplicate and send  by registered mail or by hand to the
493
494Secretary
495School of Postgraduate Studies and Research
496Igbinedion University,
497P.M.B. 0006,
498Benin City, Edo State,
499Nigeria
500
501(b)     Forward the following along with the Acceptance Form of Provisional Offer of Admission.
502
503(i) A non-refundable deposit of N100,000.00 (One Hundred Thousand Naira Only) which is part of the School fees: Payable Online.
504
505(ii) Four recent passport-size photograph of yourself with your full-names (surname first in BLOCK LETTERS) written on the reverse side of the photograph and pinned to the Acceptance Form.
506
5074. The following will be required for Registration:
508
509(a) A medical examination to be conducted by an approved medical practitioner. On your arrival at the Igbinedion University, you should submit the enclosed Igbinedion University Medical Examination Form duly completed and signed by an approved medical practitioner together with your chest X-ray film to Director of Health Service at the Igbinedion University, Okada.
510
511(b) The original copies of all credentials listed in your application form (including NYSC discharge/exemption certificate) should be brought for sighting.
512
5135. You are required to pay the necessary fees and register for your degree programme not later than three weeks from the beginning of the Academic Session. Late registration may be allowed during an additional period of five weeks on payment of a late registration fees. Please note that you will be allowed to register after two months have elapsed from the beginning of the sessions.
514
5156. Please find attached:
516
517(a) A copy of School fees Regime
518(b) A copy of Acceptance Forms
519
5207. Note:
521
522(a) All Tuition fees are to be paid online
523(b) Post-graduate dues and other charges are to be paid into ABC Microfinance Bank Okada, Account No: 30125
524
5258.  CONGRATULATIONS!!!
526
527Yours faithfully,
528
529<img src="${signature_ezewele_img_path}" valign="-20" height="38" width="86" />
530
531Mrs. Angela Ezewele
532Secretary, School of Postgraduate Studies & Research
533"""
534
535    @property
536    def post_text_pt(self):
537        return """
538Please note that at the point of registration for your programme of study (course), you will be required to present the following documents: Current UTME result slip where available, WAEC/NECO (0' Level) result, Birth certificate or sworn affidavit of age, and health certificate from a recognized Medical Centre.
539
540All credentials (original) will be checked during registration. This admission will be cancelled at any point in time it is found that your claims in the application form are false.
541
542You are required to show evidence of the result / credentials you presented on application for admission.
543
544Fees are paid through bank draft only. Fees can be paid using any of the following options: Professional courses N180,000 (One Hundred and Eighty Thousand Naira only) and Non- Professional N150,000 (One Hundred and Fifty Thousand Naira only).
545
546Your Student Id (indicated above) is your login to the University portal. As an indication of your acceptance of this offer of admission, you should immediatelty raise a draft of fees above at the beginning of the session,. Install mental payments of not more than two installments, may be allowed under exceptional circumstances. Fees once paid are not refundable.
547
548It is advisable that you keep the original receipts of fees paid and present them on demand.
549
550Resumption Date: The University opens for fresh students with online registration starting from Monday 28th September, 2020. The date for physical resumption is 14th November, 2020.
551
552All credentials, O'Level Results, Birth Certificate/Age Declaration, UTME Result Slip where available (Original) will be checked during registration. This admission will be cancelled at any point in time it is found that any of your claims in the application form is false.
553
554Conduct: All students are expected to conduct themselves properly and dress decently on campus, as well as obey all rules and regulations as failure to comply will attract appropriate sanctions.
555
556We wish you a successful academic career in Igbinedion University.
557
558Congratulations!
559
560<img src="${signature_benji_img_path}" valign="-20" height="38" width="86" />
561
562Friday Benji Bakare Esq.
563Registrar
564registrar@iuokada.edu.ng
56508035902949
566"""
567
568    def render(self):
569        students_utils = getUtility(IStudentsUtils)
570        watermark_path = os.path.join(
571            os.path.dirname(__file__), 'static', 'watermark.pdf')
572        watermark = open(watermark_path, 'rb')
573        if self.context.current_mode.endswith('_pt'):
574            return students_utils.renderPDFAdmissionLetter(self,
575                self.context.student, omit_fields=self.omit_fields,
576                pre_text=self.pre_text_ug, post_text=self.post_text_pt,
577                watermark=watermark)
578        if self.context.is_postgrad:
579            file_path = os.path.join(
580                os.path.dirname(__file__), 'static', 'admission_letter_pg.pdf')
581            file = open(file_path, 'rb')
582            mergefiles = [file,]
583            return students_utils.renderPDFAdmissionLetter(self,
584                self.context.student, omit_fields=self.omit_fields,
585                pre_text=self.pre_text_pg, post_text=self.post_text_pg,
586                mergefiles=mergefiles,
587                watermark=watermark)
588        file_path = os.path.join(
589            os.path.dirname(__file__), 'static', 'admission_letter_ug.pdf')
590        file = open(file_path, 'rb')
591        mergefiles = [file,]
592        if self.context.certcode == 'BBMS' and self.context.current_level == 100:
593            post_text = self.basic_medical_only_text + self.post_text_ug
594        else:
595            post_text = self.post_text_ug
596        return students_utils.renderPDFAdmissionLetter(self,
597            self.context.student, omit_fields=self.omit_fields,
598            pre_text=self.pre_text_ug, post_text=post_text,
599            mergefiles=mergefiles,
600            watermark=watermark)
601
602class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
603    """ Page to view an online payment ticket. We do not omit provider_amt.
604    """
605    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
606        'gateway_amt', 'thirdparty_amt', 'p_item','p_combi', 'provider_amt')
607    form_fields[
608        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
609    form_fields[
610        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
611
612class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip):
613    """Deliver a PDF slip of the context. We do not omit provider_amt.
614    """
615    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
616        'gateway_amt', 'thirdparty_amt', 'p_item',
617        'p_split_data','p_combi', 'provider_amt')
618    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
619    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
Note: See TracBrowser for help on using the repository browser.