1 | ## $Id: browser.py 12617 2015-02-14 17:22:51Z 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 | |
---|
19 | import grok |
---|
20 | from zope.component import getUtility |
---|
21 | from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore |
---|
22 | from waeup.ikoba.customers.browser import ( |
---|
23 | PDFContractSlipPage, CustomerBaseEditFormPage) |
---|
24 | from ikobacustom.pcn.interfaces import MessageFactory as _ |
---|
25 | from ikobacustom.pcn.customers.interfaces import ( |
---|
26 | IRPCContract, IAPPITContract, IAPPTContract) |
---|
27 | |
---|
28 | class PDFContractSlipPage(PDFContractSlipPage): |
---|
29 | """Deliver pdf file including metadata. |
---|
30 | """ |
---|
31 | |
---|
32 | @property |
---|
33 | def label(self): |
---|
34 | portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE |
---|
35 | return self.context.title |
---|
36 | |
---|
37 | def _signatures(self): |
---|
38 | return () |
---|
39 | |
---|
40 | def _sigsInFooter(self): |
---|
41 | return () |
---|
42 | |
---|
43 | class PDFRPCContractSlipPage(PDFContractSlipPage): |
---|
44 | """Deliver pdf file including metadata. |
---|
45 | """ |
---|
46 | |
---|
47 | grok.context(IRPCContract) |
---|
48 | |
---|
49 | def _sigsInFooter(self): |
---|
50 | return (_('Date, Signature of Witness'), |
---|
51 | _('Date, Signature of Registrant'), |
---|
52 | ) |
---|
53 | |
---|
54 | class PDFAPPITContractSlipPage(PDFContractSlipPage): |
---|
55 | """Deliver pdf file including metadata. |
---|
56 | """ |
---|
57 | |
---|
58 | grok.context(IAPPITContract) |
---|
59 | |
---|
60 | def _sigsInFooter(self): |
---|
61 | return (_('Date, Signature of Internee'), |
---|
62 | _('Date, Signature of Supervising Pharmacist'), |
---|
63 | ) |
---|
64 | |
---|
65 | class PDFAPPTContractSlipPage(PDFContractSlipPage): |
---|
66 | """Deliver pdf file including metadata. |
---|
67 | """ |
---|
68 | |
---|
69 | grok.context(IAPPTContract) |
---|
70 | |
---|
71 | def _sigsInFooter(self): |
---|
72 | return (_('Date, Signature of Applicant'), |
---|
73 | _('Date, Signature of Supervisor'), |
---|
74 | ) |
---|
75 | |
---|
76 | class CustomerBaseEditFormPage(CustomerBaseEditFormPage): |
---|
77 | """ View to edit customer base data |
---|
78 | """ |
---|
79 | |
---|
80 | def dataNotComplete(self): |
---|
81 | store = getUtility(IExtFileStore) |
---|
82 | error = '' |
---|
83 | if not store.getFileByContext(self.context, attr=u'birth_certificate.pdf'): |
---|
84 | error += _('Birth certificate is missing. ') |
---|
85 | if not store.getFileByContext(self.context, attr=u'passport.jpg'): |
---|
86 | error += _('Passport picture is missing.') |
---|
87 | if error: |
---|
88 | return error |
---|
89 | return |
---|