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

Last change on this file since 16502 was 16499, checked in by Henrik Bettermann, 4 years ago

Customize PaymentsManageFormPage?.

  • Property svn:keywords set to Id
File size: 27.2 KB
Line 
1## $Id: browser.py 16499 2021-06-03 15:23:15Z 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    @property
261    def manage_payments_allowed(self):
262        return checkPermission('waeup.manageStudent', self.context)
263
264class StudentGetMatricNumberPage(UtilityView, grok.View):
265    """ Construct and set the matriculation number.
266    """
267    grok.context(IStudent)
268    grok.name('get_matric_number')
269    grok.require('waeup.manageStudent')
270
271    def update(self):
272        students_utils = getUtility(IStudentsUtils)
273        msg, mnumber = students_utils.setMatricNumber(self.context)
274        if msg:
275            self.flash(msg, type="danger")
276        else:
277            self.flash(_('Matriculation number %s assigned.' % mnumber))
278            self.context.writeLogMessage(self, '%s assigned' % mnumber)
279        self.redirect(self.url(self.context))
280        return
281
282    def render(self):
283        return
284
285class SwitchLibraryAccessView(UtilityView, grok.View):
286    """ Switch the library attribute
287    """
288    grok.context(ICustomStudent)
289    grok.name('switch_library_access')
290    grok.require('waeup.switchLibraryAccess')
291
292    def update(self):
293        if self.context.library:
294            self.context.library = False
295            self.context.writeLogMessage(self, 'library access disabled')
296            self.flash(_('Library access disabled'))
297        else:
298            self.context.library = True
299            self.context.writeLogMessage(self, 'library access enabled')
300            self.flash(_('Library access enabled'))
301        self.redirect(self.url(self.context))
302        return
303
304    def render(self):
305        return
306
307class ExportLibIdCard(UtilityView, grok.View):
308    """Deliver an id card for the library.
309    """
310    grok.context(ICustomStudent)
311    grok.name('lib_idcard.pdf')
312    grok.require('waeup.viewStudent')
313    prefix = 'form'
314
315    label = u"Library Clearance"
316
317    omit_fields = (
318        'suspended', 'email', 'phone',
319        'adm_code', 'suspended_comment',
320        'date_of_birth',
321        'current_mode', 'certificate',
322        'entry_session',
323        'flash_notice')
324
325    form_fields = []
326
327    def _sigsInFooter(self):
328        isStudent = getattr(
329            self.request.principal, 'user_type', None) == 'student'
330        if isStudent:
331            return ''
332        return (_("Date, Reader's Signature"),
333                _("Date, Circulation Librarian's Signature"),
334                )
335
336    def update(self):
337        if not self.context.library:
338            self.flash(_('Forbidden!'), type="danger")
339            self.redirect(self.url(self.context))
340        return
341
342    @property
343    def note(self):
344        return """
345<br /><br /><br /><br /><font size='12'>
346This is to certify that the bearer whose photograph and other details appear
347 overleaf is a registered user of the <b>University Library</b>.
348 The card is not transferable. A replacement fee is charged for a loss,
349 mutilation or otherwise. If found, please, return to the University Library,
350 Igbinedion University, Okada.
351</font>
352
353"""
354        return
355
356    def render(self):
357        studentview = StudentBasePDFFormPage(self.context.student,
358            self.request, self.omit_fields)
359        students_utils = getUtility(IStudentsUtils)
360        return students_utils.renderPDF(
361            self, 'lib_idcard',
362            self.context.student, studentview,
363            omit_fields=self.omit_fields,
364            sigs_in_footer=self._sigsInFooter(),
365            note=self.note)
366
367class CustomStartClearancePage(StartClearancePage):
368    with_ac = False
369
370class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage):
371    grok.require('waeup.payStudent')
372
373class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip):
374    """Deliver a PDF Admission slip.
375    """
376
377    omit_fields = ('date_of_birth',
378                   #'current_level',
379                   #'current_mode',
380                   #'entry_session'
381                   )
382
383    @property
384    def session(self):
385        return academic_sessions_vocab.getTerm(
386            self.context.entry_session).title
387
388    @property
389    def level(self):
390        studylevelsource = StudyLevelSource()
391        return studylevelsource.factory.getTitle(
392            self.context['studycourse'].certificate, self.context.current_level)
393
394    @property
395    def label(self):
396        return 'OFFER OF PROVISIONAL ADMISSION \nFOR %s SESSION' % self.session
397
398    @property
399    def pre_text_ug(self):
400        return (
401            'Following your performance in the screening exercise '
402            'for the %s academic session, I am pleased to inform '
403            'you that you have been offered provisional admission into the '
404            'Igbinedion University, Okada as follows:' % self.session)
405
406    @property
407    def pre_text_pg(self):
408        return (
409            'I am pleased to inform you that your application for admission'
410            ' into the Igbinedion University, Okada was successful. You have'
411            ' been admitted as follows:')
412
413    @property
414    def basic_medical_only_text(self):
415        return"""
416Progression 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.
417"""
418
419    @property
420    def post_text_ug(self):
421        return """
422Please 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.
423
424All 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.
425
426You are required to show evidence of the result / credentials you presented on application for admission.
427
428Fees can be paid using any of the following options:
429
430Fees 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
431
432Kindly note the following:
433
434Fees indicated on the Fee Structure page are valid for the current session only.
435Your Student Id (indicated above) Is your logln to the University portal.
436As an indication of your acceptance of this offer of admission, you should pay a non-refundable Acceptance deposit of 200,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.
437All 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.
438Fees once paid are not refundable.
439It is advisable that you keep the original receipts of fees paid and present them on demand.
440
441Accommodation: 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.
442
443Food: Food is available in cafeteria on "pay-as-you-eat" basis.
444
445Resumption 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.
446
447Registration/Orientation Programme: Orientation programme/registration for fresh students will start on Monday, 16th November 2020. Registration ends on 2020-11-30. 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.
448
449Transport Facility: The University provides a compulsory shuttle bus service to all students at a fee already included in the other charges.
450
451Kindly note that fresh students are not allowed the use of private vehicles.
452
453Conduct: 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.
454
455We wish you a successful academic career in Igbinedion University.
456
457Congratulations!
458
459
460
461<img src="${signature_benji_img_path}" valign="-20" height="38" width="86" />
462
463Friday Benji Bakare Esq.
464Registrar
465registrar@iuokada.edu.ng
46608035902949
467"""
468
469    @property
470    def post_text_pg(self):
471        return """
4721. Details of your programme will be made available to you by the Head of your Department on your arrival at the Igbinedion University.
473
4742. 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.
475
4763. If you accept this offer of admission upon the conditions above, you should please:
477
478(a) Complete the enclosed Acceptance Form of Provisional Offer of Admission in duplicate and send  by registered mail or by hand to the
479
480Secretary
481School of Postgraduate Studies and Research
482Igbinedion University,
483P.M.B. 0006,
484Benin City, Edo State,
485Nigeria
486
487(b)     Forward the following along with the Acceptance Form of Provisional Offer of Admission.
488
489(i) A non-refundable deposit of N100,000.00 (One Hundred Thousand Naira Only) which is part of the School fees: Payable Online.
490
491(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.
492
4934. The following will be required for Registration:
494
495(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.
496
497(b) The original copies of all credentials listed in your application form (including NYSC discharge/exemption certificate) should be brought for sighting.
498
4995. 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.
500
5016. Please find attached:
502
503(a) A copy of School fees Regime
504(b) A copy of Acceptance Forms
505
5067. Note:
507
508(a) All Tuition fees are to be paid online
509(b) Post-graduate dues and other charges are to be paid into ABC Microfinance Bank Okada, Account No: 30125
510
5118.  CONGRATULATIONS!!!
512
513Yours faithfully,
514
515<img src="${signature_olaoke_img_path}" valign="-20" height="38" width="86" />
516
517Mr. Olaoke, Olasoji Oluwole
518Secretary, School of Postgraduate Studies & Research
519"""
520
521    @property
522    def post_text_pt(self):
523        return """
524Please 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.
525
526All 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.
527
528You are required to show evidence of the result / credentials you presented on application for admission.
529
530Fees 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).
531
532Your 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.
533
534It is advisable that you keep the original receipts of fees paid and present them on demand.
535
536Resumption 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.
537
538All 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.
539
540Conduct: 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.
541
542We wish you a successful academic career in Igbinedion University.
543
544Congratulations!
545
546<img src="${signature_benji_img_path}" valign="-20" height="38" width="86" />
547
548Friday Benji Bakare Esq.
549Registrar
550registrar@iuokada.edu.ng
55108035902949
552"""
553
554    def render(self):
555        students_utils = getUtility(IStudentsUtils)
556        watermark_path = os.path.join(
557            os.path.dirname(__file__), 'static', 'watermark.pdf')
558        watermark = open(watermark_path, 'rb')
559        if self.context.current_mode.endswith('_pt'):
560            return students_utils.renderPDFAdmissionLetter(self,
561                self.context.student, omit_fields=self.omit_fields,
562                pre_text=self.pre_text_ug, post_text=self.post_text_pt,
563                watermark=watermark)
564        if self.context.is_postgrad:
565            file_path = os.path.join(
566                os.path.dirname(__file__), 'static', 'admission_letter_pg.pdf')
567            file = open(file_path, 'rb')
568            mergefiles = [file,]
569            return students_utils.renderPDFAdmissionLetter(self,
570                self.context.student, omit_fields=self.omit_fields,
571                pre_text=self.pre_text_pg, post_text=self.post_text_pg,
572                mergefiles=mergefiles,
573                watermark=watermark)
574        file_path = os.path.join(
575            os.path.dirname(__file__), 'static', 'admission_letter_ug.pdf')
576        file = open(file_path, 'rb')
577        mergefiles = [file,]
578        if self.context.certcode == 'BBMS' and self.context.current_level == 100:
579            post_text = self.basic_medical_only_text + self.post_text_ug
580        else:
581            post_text = self.post_text_ug
582        return students_utils.renderPDFAdmissionLetter(self,
583            self.context.student, omit_fields=self.omit_fields,
584            pre_text=self.pre_text_ug, post_text=post_text,
585            mergefiles=mergefiles,
586            watermark=watermark)
587
588class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
589    """ Page to view an online payment ticket. We do not omit provider_amt.
590    """
591    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
592        'gateway_amt', 'thirdparty_amt', 'p_item','p_combi', 'provider_amt')
593    form_fields[
594        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
595    form_fields[
596        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
597
598class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip):
599    """Deliver a PDF slip of the context. We do not omit provider_amt.
600    """
601    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
602        'gateway_amt', 'thirdparty_amt', 'p_item',
603        'p_split_data','p_combi', 'provider_amt')
604    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
605    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
Note: See TracBrowser for help on using the repository browser.