source: main/waeup.fceokene/trunk/src/waeup/fceokene/students/browser.py @ 9923

Last change on this file since 9923 was 9780, checked in by Henrik Bettermann, 12 years ago

Changes according to r9775.

  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1## $Id: browser.py 9780 2012-12-06 17:52:21Z 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
19from zope.i18n import translate
20from hurry.workflow.interfaces import IWorkflowInfo
21from waeup.kofa.interfaces import ADMITTED
22from waeup.kofa.interfaces import MessageFactory as _
23from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
24from waeup.kofa.students.browser import StartClearancePage, BedTicketAddPage
25from kofacustom.nigeria.students.browser import (
26    NigeriaOnlinePaymentDisplayFormPage,
27    NigeriaOnlinePaymentAddFormPage,
28    NigeriaExportPDFPaymentSlipPage,
29    NigeriaStudentClearanceEditFormPage,
30    )
31
32from waeup.fceokene.students.interfaces import ICustomStudentOnlinePayment
33
34class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
35    """ Page to view an online payment ticket
36    """
37    grok.context(ICustomStudentOnlinePayment)
38    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
39        'provider_amt', 'gateway_amt', 'thirdparty_amt')
40    form_fields[
41        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
42    form_fields[
43        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
44
45class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage):
46    """ Page to add an online payment ticket
47    """
48    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
49        'p_category')
50
51class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage):
52    """Deliver a PDF slip of the context.
53    """
54    grok.context(ICustomStudentOnlinePayment)
55    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
56        'provider_amt', 'gateway_amt', 'thirdparty_amt')
57    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
58    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
59
60class CustomStartClearancePage(StartClearancePage):
61
62    grok.template('startclearance')
63
64    def update(self, SUBMIT=None):
65        if not self.context.state == ADMITTED:
66            self.flash(_("Wrong state"))
67            self.redirect(self.url(self.context))
68            return
69        if not self.portrait_uploaded:
70            self.flash(_("No portrait uploaded."))
71            self.redirect(self.url(self.context, 'change_portrait'))
72            return
73        if not self.all_required_fields_filled:
74            self.flash(_("Not all required fields filled."))
75            self.redirect(self.url(self.context, 'edit_base'))
76            return
77        if SUBMIT is None:
78            return
79        IWorkflowInfo(self.context).fireTransition('start_clearance')
80        self.flash(_('Clearance process has been started.'))
81        self.redirect(self.url(self.context,'cedit'))
82        return
83
84class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
85    """ View to edit student clearance data by student
86    """
87
88    def dataNotComplete(self):
89        return False
90
91class CustomBedTicketAddPage(BedTicketAddPage):
92    """ Page to add an online payment ticket
93    """
94    grok.template('bookbed')
95    buttonname = _('Create bed ticket')
96    notice = ''
97    with_ac = False
Note: See TracBrowser for help on using the repository browser.