source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/utils.py @ 17911

Last change on this file since 17911 was 17869, checked in by Henrik Bettermann, 5 months ago

Hide final clearance button.

  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1## $Id: utils.py 17869 2024-08-02 19:38:16Z henrik $
2##
3## Copyright (C) 2011 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.component import getUtility
20from waeup.kofa.interfaces import IExtFileStore
21from waeup.kofa.students.utils import StudentsUtils
22from kofacustom.nigeria.interfaces import MessageFactory as _
23
24class NigeriaStudentsUtils(StudentsUtils):
25    """A collection of customized methods.
26
27    """
28
29    SEPARATORS_DICT = {
30        'form.fst_sit_fname': _(u'First Sitting Record'),
31        'form.scd_sit_fname': _(u'Second Sitting Record'),
32        'form.alr_fname': _(u'Advanced Level Record'),
33        'form.hq_type': _(u'Higher Education Record'),
34        'form.hq2_type': _(u'Second Higher Education Record'),
35        'form.nysc_year': _(u'NYSC Information'),
36        'form.employer': _(u'Employment History'),
37        'form.former_matric': _(u'Former Student'),
38        }
39
40    STUDENT_EXPORTER_NAMES = StudentsUtils().STUDENT_EXPORTER_NAMES + (
41            'clearancerequested',)
42
43    # Maximum size of upload files in kB
44    MAX_KB = 250
45
46    def allowPortraitChange(self, student):
47        """Check if student is allowed to change the portrait file.
48        """
49        # Passport pictures must not be editable if application slip
50        # exists. Students are not allowed to change the picture if they passed
51        # the regular Kofa application.
52        slip = getUtility(IExtFileStore).getFileByContext(
53            student, 'application_slip')
54        if student.state not in self.PORTRAIT_CHANGE_STATES or slip is not None:
55            return False
56        return True
57
58    def final_clearance_enabled(self, student):
59        if 'Test' in student.display_fullname:
60            return True
61        return False
62
Note: See TracBrowser for help on using the repository browser.