source: main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/browser.py @ 12612

Last change on this file since 12612 was 12612, checked in by Henrik Bettermann, 10 years ago

Changes recommended by Jason.

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1## $Id: browser.py 12612 2015-02-13 11:28:55Z henrik $
2##
3## Copyright (C) 2015 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##
18
19import grok
20from zope.component import getUtility
21from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore
22from waeup.ikoba.customers.browser import (
23    PDFContractSlipPage, CustomerBaseEditFormPage)
24from ikobacustom.pcn.interfaces import MessageFactory as _
25from ikobacustom.pcn.customers.interfaces import IRPCContract, IAPPITContract
26
27class PDFContractSlipPage(PDFContractSlipPage):
28    """Deliver pdf file including metadata.
29    """
30
31    @property
32    def label(self):
33        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
34        return self.context.title
35
36    def _signatures(self):
37        return ()
38
39    def _sigsInFooter(self):
40        return ()
41
42class PDFRPCContractSlipPage(PDFContractSlipPage):
43    """Deliver pdf file including metadata.
44    """
45
46    grok.context(IRPCContract)
47
48    def _sigsInFooter(self):
49        return (_('Date, Signature of Witness'),
50                _('Date, Signature of Registrant'),
51                )
52
53class PDFAPPITContractSlipPage(PDFContractSlipPage):
54    """Deliver pdf file including metadata.
55    """
56
57    grok.context(IAPPITContract)
58
59    def _sigsInFooter(self):
60        return (_('Date, Signature of Internee'),
61                _('Date, Signature of Supervising Pharmacist'),
62                )
63
64class CustomerBaseEditFormPage(CustomerBaseEditFormPage):
65    """ View to edit customer base data
66    """
67
68    def dataNotComplete(self):
69        store = getUtility(IExtFileStore)
70        error = ''
71        if not store.getFileByContext(self.context, attr=u'birth_certificate.pdf'):
72            error += _('Birth certificate is missing. ')
73        if not store.getFileByContext(self.context, attr=u'passport.jpg'):
74            error += _('Passport picture is missing.')
75        if error:
76            return error
77        return
Note: See TracBrowser for help on using the repository browser.