source: main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/browser.py @ 16767

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

EDOCONS does not allow students to remove any payment ticket.

  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1## $Id: browser.py 16715 2021-11-19 11:06:11Z 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 hurry.workflow.interfaces import IWorkflowInfo
25from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils
26from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
27from waeup.kofa.browser.layout import KofaEditFormPage
28from waeup.kofa.browser.layout import action, jsaction
29from waeup.kofa.students.browser import (
30    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
31    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
32    CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
33    ExportPDFAdmissionSlip, StartClearancePage, PaymentsManageFormPage,
34    msave, emit_lock_message)
35from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket
36from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
37from kofacustom.nigeria.students.browser import (
38    NigeriaOnlinePaymentDisplayFormPage,
39    NigeriaStudentBaseManageFormPage,
40    NigeriaStudentClearanceEditFormPage,
41    NigeriaOnlinePaymentAddFormPage,
42    NigeriaExportPDFPaymentSlip,
43    NigeriaExportPDFClearanceSlip,
44    NigeriaExportPDFPaymentSlip,
45    )
46
47from kofacustom.edocons.students.interfaces import (
48    ICustomStudentOnlinePayment, ICustomStudentStudyCourse,
49    ICustomStudentStudyLevel)
50from kofacustom.edocons.interfaces import MessageFactory as _
51
52class CustomStartClearancePage(StartClearancePage):
53    with_ac = False
54
55class 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 = '''
64You are expected to proceed and pay your school fees on or before the 12th of November 2021.
65
66Please visit the College Registry (Student Affairs Division) at:
67
68Edo State College of Nursing Sciences
69
70Godwin Abbey Way (Formerly Limit Road) off Sapele Road, Benin City
71
72or call 08104797237 for enquiries.
73
74Congratulations!
75'''
76
77    @property
78    def label(self):
79        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
80        return translate(_('Admission Letter of'),
81            'waeup.kofa', target_language=portal_language) \
82            + ' %s' % self.context.display_fullname
83
84    def render(self):
85        students_utils = getUtility(IStudentsUtils)
86        letterhead_path = os.path.join(
87            os.path.dirname(__file__), 'static', 'letterhead_admission.jpg')
88        if not os.path.exists(letterhead_path):
89            letterhead_path = None
90        return students_utils.renderPDFAdmissionLetter(self,
91            self.context.student, omit_fields=self.omit_fields,
92            letterhead_path=letterhead_path, post_text=self.post_text)
93
94
95class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip):
96    """Deliver a PDF slip of the context.
97    """
98    omit_fields = ('password', 'suspended', 'suspended_comment', 'phone',
99        'adm_code', 'sex', 'email', 'date_of_birth', 'current_level',
100        'flash_notice', 'certificate', 'faculty', 'parents_email')
101
102class CustomPaymentsManageFormPage(PaymentsManageFormPage):
103    """ Page to manage the student payments. This manage form page is for
104    both students and students officers. EDOCONS does not allow students
105    to remove any payment ticket.
106    """
107    @property
108    def manage_payments_allowed(self):
109        return checkPermission('waeup.manageStudent', self.context)
110
Note: See TracBrowser for help on using the repository browser.