[12493] | 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 | |
---|
[12600] | 19 | import grok |
---|
[12493] | 20 | from zope.component import getUtility |
---|
[12534] | 21 | from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore |
---|
[12529] | 22 | from waeup.ikoba.customers.browser import ( |
---|
| 23 | PDFContractSlipPage, CustomerBaseEditFormPage) |
---|
[12493] | 24 | from ikobacustom.pcn.interfaces import MessageFactory as _ |
---|
[12611] | 25 | from ikobacustom.pcn.customers.interfaces import IRPCContract, IAPPITContract |
---|
[12493] | 26 | |
---|
| 27 | class PDFContractSlipPage(PDFContractSlipPage): |
---|
| 28 | """Deliver pdf file including metadata. |
---|
| 29 | """ |
---|
| 30 | |
---|
| 31 | @property |
---|
| 32 | def label(self): |
---|
| 33 | portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE |
---|
[12529] | 34 | return self.context.title |
---|
| 35 | |
---|
[12600] | 36 | def _signatures(self): |
---|
| 37 | return () |
---|
[12529] | 38 | |
---|
[12600] | 39 | def _sigsInFooter(self): |
---|
| 40 | return () |
---|
| 41 | |
---|
| 42 | class 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 | |
---|
[12611] | 53 | class 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'), |
---|
[12612] | 61 | _('Date, Signature of Supervising Pharmacist'), |
---|
[12611] | 62 | ) |
---|
| 63 | |
---|
[12529] | 64 | class CustomerBaseEditFormPage(CustomerBaseEditFormPage): |
---|
| 65 | """ View to edit customer base data |
---|
| 66 | """ |
---|
| 67 | |
---|
| 68 | def dataNotComplete(self): |
---|
[12534] | 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 |
---|