## $Id: browser.py 16715 2021-11-19 11:06:11Z henrik $ ## ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import grok import os from zope.i18n import translate from zope.schema.interfaces import ConstraintNotSatisfied from zope.component import getUtility from zope.security import checkPermission from hurry.workflow.interfaces import IWorkflowInfo from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget from waeup.kofa.browser.layout import KofaEditFormPage from waeup.kofa.browser.layout import action, jsaction from waeup.kofa.students.browser import ( StudyLevelEditFormPage, StudyLevelDisplayFormPage, StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, ExportPDFAdmissionSlip, StartClearancePage, PaymentsManageFormPage, msave, emit_lock_message) from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS from kofacustom.nigeria.students.browser import ( NigeriaOnlinePaymentDisplayFormPage, NigeriaStudentBaseManageFormPage, NigeriaStudentClearanceEditFormPage, NigeriaOnlinePaymentAddFormPage, NigeriaExportPDFPaymentSlip, NigeriaExportPDFClearanceSlip, NigeriaExportPDFPaymentSlip, ) from kofacustom.edocons.students.interfaces import ( ICustomStudentOnlinePayment, ICustomStudentStudyCourse, ICustomStudentStudyLevel) from kofacustom.edocons.interfaces import MessageFactory as _ class CustomStartClearancePage(StartClearancePage): with_ac = False class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): """Deliver a PDF Admission slip. """ omit_fields = ('date_of_birth', 'current_level', 'current_mode', 'certificate', 'faculty') #form_fields = grok.AutoFields(IStudentBase).select('student_id', 'reg_number') post_text = ''' You are expected to proceed and pay your school fees on or before the 12th of November 2021. Please visit the College Registry (Student Affairs Division) at: Edo State College of Nursing Sciences Godwin Abbey Way (Formerly Limit Road) off Sapele Road, Benin City or call 08104797237 for enquiries. Congratulations! ''' @property def label(self): portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE return translate(_('Admission Letter of'), 'waeup.kofa', target_language=portal_language) \ + ' %s' % self.context.display_fullname def render(self): students_utils = getUtility(IStudentsUtils) letterhead_path = os.path.join( os.path.dirname(__file__), 'static', 'letterhead_admission.jpg') if not os.path.exists(letterhead_path): letterhead_path = None return students_utils.renderPDFAdmissionLetter(self, self.context.student, omit_fields=self.omit_fields, letterhead_path=letterhead_path, post_text=self.post_text) class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): """Deliver a PDF slip of the context. """ omit_fields = ('password', 'suspended', 'suspended_comment', 'phone', 'adm_code', 'sex', 'email', 'date_of_birth', 'current_level', 'flash_notice', 'certificate', 'faculty', 'parents_email') class CustomPaymentsManageFormPage(PaymentsManageFormPage): """ Page to manage the student payments. This manage form page is for both students and students officers. EDOCONS does not allow students to remove any payment ticket. """ @property def manage_payments_allowed(self): return checkPermission('waeup.manageStudent', self.context)