## $Id: browser.py 14591 2017-02-25 17:59:16Z 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 from zope.i18n import translate from zope.component import getUtility from hurry.workflow.interfaces import IWorkflowInfo from waeup.kofa.interfaces import ADMITTED, IKofaUtils from waeup.kofa.interfaces import MessageFactory as _ from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget from waeup.kofa.students.browser import ( StartClearancePage, BedTicketAddPage, ExportPDFAdmissionSlip, StudyLevelDisplayFormPage) from kofacustom.nigeria.students.browser import ( NigeriaOnlinePaymentDisplayFormPage, NigeriaOnlinePaymentAddFormPage, NigeriaExportPDFPaymentSlip, NigeriaStudentClearanceEditFormPage, NigeriaExportPDFClearanceSlip, NigeriaExportPDFCourseRegistrationSlip ) from waeup.fceokene.students.interfaces import ( ICustomStudentOnlinePayment, ICustomUGStudentClearance, ICustomStudentStudyLevel) class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): """Deliver a PDF Admission slip. """ @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 @property def label(self): portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE line0 = '' if self.context.student.current_mode.startswith('ug'): line0 = 'IN AFFILIATION WITH UNIVERSITY OF IBADAN\n' line1 = translate(_('Admission Letter of'), 'waeup.kofa', target_language=portal_language) \ + ' %s' % self.context.display_fullname return '%s%s' % (line0, line1) class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): """ Page to view an online payment ticket """ grok.context(ICustomStudentOnlinePayment) form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') form_fields[ 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') form_fields[ 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage): """ Page to add an online payment ticket """ form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select( 'p_category') class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): """Deliver a PDF slip of the context. """ grok.context(ICustomStudentOnlinePayment) form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') note = ''' The total authorized amount includes an Interswitch transaction charge of 150 Nairas. ''' class CustomStartClearancePage(StartClearancePage): @property def with_ac(self): mode = getattr(self.context, 'current_mode', None) if mode and mode.startswith('ug'): return True return False class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip): """Deliver a PDF slip of the context. """ @property def form_fields(self): if self.context.is_postgrad: form_fields = grok.AutoFields( ICustomPGStudentClearance).omit('clearance_locked') else: form_fields = grok.AutoFields( ICustomUGStudentClearance).omit('clearance_locked') if not getattr(self.context, 'officer_comment'): form_fields = form_fields.omit('officer_comment') return form_fields @property def label(self): portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE line0 = '' if self.context.student.current_mode.startswith('ug'): line0 = 'Directorate of Undergraduate Programme\n' line1 = translate(_('Clearance Slip of'), 'waeup.kofa', target_language=portal_language) \ + ' %s' % self.context.display_fullname return '%s%s' % (line0, line1) class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage): """ View to edit student clearance data by student """ def dataNotComplete(self): return False class CustomBedTicketAddPage(BedTicketAddPage): """ Page to add an online payment ticket """ buttonname = _('Create bed ticket') notice = '' with_ac = False class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage): """ Page to display student study levels """ grok.context(ICustomStudentStudyLevel) form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level') form_fields[ 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') class CustomExportPDFCourseRegistrationSlip( NigeriaExportPDFCourseRegistrationSlip): """Deliver a PDF slip of the context. """ grok.context(ICustomStudentStudyLevel) form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level')