source: main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py @ 12538

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

If PCN requires a birth certificate, date_of_birth should also be part of IPCNCustomer.

  • Property svn:keywords set to Id
File size: 7.8 KB
Line 
1## $Id: interfaces.py 12536 2015-02-01 07:30:33Z henrik $
2##
3## Copyright (C) 2014 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
19from zope import schema
20from datetime import datetime
21from zc.sourcefactory.basic import BasicSourceFactory
22from waeup.ikoba.interfaces import IIkobaObject
23from waeup.ikoba.customers.interfaces import (
24    ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract,
25    validate_email)
26from waeup.ikoba.customers.vocabularies import (
27    ConCatProductSource, CustomerDocumentSource, nats_vocab)
28from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber
29from waeup.ikoba.products.productoptions import ProductOptionField
30from ikobacustom.pcn.interfaces import MessageFactory as _
31from ikobacustom.pcn.interfaces import LGASource
32
33def year_range():
34    curr_year = datetime.now().year
35    return range(curr_year - 2, curr_year + 5)
36
37class PracticeSource(BasicSourceFactory):
38    """A source for categories of practice.
39    """
40    def getValues(self):
41        return [
42            'academic',
43            'administrative',
44            'distribution',
45            'importation',
46            'manufacturing',
47            'retail and dispensing',
48            'wholesale',
49            ]
50
51
52class IPCNCustomer(ICustomer):
53    """Representation of a customer.
54
55    """
56
57    date_of_birth = FormattedDate(
58        title = _(u'Date of Birth'),
59        required = True,
60        show_year = True,
61        )
62
63# Customer document interfaces
64
65
66class IPCNCustomerJPGDocument(ICustomerDocument):
67    """A customer jpg document.
68
69    """
70
71class IPCNCustomerPDFDocument(ICustomerPDFDocument):
72    """A customer pdf document.
73
74    """
75
76# Customer contract interfaces
77
78class IRONContract(IContract):
79    """A Retention of Name contract.
80
81    """
82
83    state_of_origin = schema.Choice(
84        vocabulary = nats_vocab,
85        title = _(u'State of Origin'),
86        required = False,
87        )
88
89    lga = schema.Choice(
90        source = LGASource(),
91        title = _(u'State / LGA'),
92        required = True,
93        )
94
95    year_qualification = schema.Choice(
96        title = _(u'Year of Qualification'),
97        required = True,
98        values = year_range(),
99        )
100
101    res_address = schema.Text(
102        title = _(u'Residential Address'),
103        required = True,
104        )
105
106    res_address = schema.Text(
107        title = _(u'Residential Address'),
108        required = False,
109        )
110
111    work_address = schema.Text(
112        title = _(u'Work Address'),
113        required = False,
114        )
115
116    work_email = schema.ASCIILine(
117        title = _(u'Work Email Address'),
118        required = False,
119        constraint=validate_email,
120        )
121
122    work_phone = PhoneNumber(
123        title = _(u'Work Phone'),
124        description = u'',
125        required = False,
126        )
127
128    categories_practice = schema.List(
129        title = _(u'Categories of Practice'),
130        value_type = schema.Choice(source=PracticeSource()),
131        required = False,
132        default = [],
133        )
134
135    superintendent = schema.Bool(
136        title= _('Superintendent'),
137        description= _('Tick box if you are a superintendent pharamcist.'),
138        required = False,
139        )
140
141    #document_object = schema.Choice(
142    #    title = _(u'Document'),
143    #    source = CustomerDocumentSource(),
144    #    required = False,
145    #    )
146
147class IRONContractOfficialUse(IIkobaObject):
148    """Interface for editing RON official use data.
149
150    """
151
152    comment = schema.Text(
153        title= _('Reason for rejection'),
154        required = False,
155        )
156
157
158class IRONContractProcess(IRONContract, IRONContractOfficialUse):
159    """Interface for processing RON data.
160    """
161
162    product_options = schema.List(
163        title = _(u'Options/Fees'),
164        value_type = ProductOptionField(),
165        required = False,
166        readonly = False,
167        default = [],
168        )
169
170class IRONContractEdit(IRONContract):
171    """Interface for editing RON data by customers.
172
173    """
174
175    #document_object = schema.Choice(
176    #    title = _(u'Document'),
177    #    source = CustomerDocumentSource(),
178    #    required = True,
179    #    )
180
181
182class IROPContract(IContract):
183    """A Registration of Premises contract.
184
185    """
186
187    premises_address = schema.Text(
188        title = _(u'Name and  Address of Pharmaceutical Premises'),
189        required = True,
190        )
191
192    categories_practice = schema.List(
193        title = _(u'Categories of Practice'),
194        value_type = schema.Choice(source=PracticeSource()),
195        required = False,
196        default = [],
197        )
198
199    premises_certificate = schema.TextLine(
200        title = _(u'Last Premises Certificate'),
201        description= _('If an old premises, state the last premises certificate number issued with date.'),
202        required = False,
203        )
204
205    date_of_qualification = FormattedDate(
206        title = _(u'Date of Qualification'),
207        required = False,
208        show_year = True,
209        )
210
211    res_address = schema.Text(
212        title = _(u'Residential Address'),
213        required = False,
214        )
215
216    last_license_number = schema.TextLine(
217        title = _(u'Last Annual License Number'),
218        required = False,
219        )
220
221    superintendent = schema.Bool(
222        title= _('Superintendent'),
223        description= _('Tick box if you were a superintendent pharamcist last year.'),
224        required = False,
225        )
226
227    work_address = schema.Text(
228        title = _(u'Full Time Employment Address'),
229        description= _('Enter work address if you were not a superintendent pharamcist last year.'),
230        required = False,
231        )
232
233    pharmacists_directors= schema.TextLine(
234        title = _(u'Pharmacist Directors'),
235        description = _(u'Full name of directors and their profession as in Form C.O.7'),
236        required = False,
237        )
238
239    other_directors= schema.TextLine(
240        title = _(u'Other Directors'),
241        description = _(u'Full name of directors and their profession as in Form C.O.7'),
242        required = False,
243        )
244
245    #document_object = schema.Choice(
246    #    title = _(u'Document'),
247    #    source = CustomerDocumentSource(),
248    #    required = False,
249    #    )
250
251class IROPContractOfficialUse(IIkobaObject):
252    """Interface for editing ROP official use data.
253
254    """
255
256    inspected = schema.Bool(
257        title = _('Inspected'),
258        description = _('Has the premises been duly inspected?'),
259        required = False,
260        )
261
262    recommended = schema.Bool(
263        title = _('Recommended'),
264        description= _('Is the premises recommended?'),
265        required = False,
266        )
267
268    official_in_state = schema.TextLine(
269        title = _(u'Name of Official in the State'),
270        required = False,
271        )
272
273class IROPContractProcess(IROPContract, IROPContractOfficialUse):
274    """Interface for processing RON data.
275    """
276
277    product_options = schema.List(
278        title = _(u'Options/Fees'),
279        value_type = ProductOptionField(),
280        required = False,
281        readonly = False,
282        default = [],
283        )
284
285class IROPContractEdit(IROPContract):
286    """Interface for editing RON data by customers.
287
288    """
289
290    #document_object = schema.Choice(
291    #    title = _(u'Document'),
292    #    source = CustomerDocumentSource(),
293    #    required = True,
294    #    )
Note: See TracBrowser for help on using the repository browser.