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
RevLine 
[12272]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
[12485]20from datetime import datetime
[12508]21from zc.sourcefactory.basic import BasicSourceFactory
[12501]22from waeup.ikoba.interfaces import IIkobaObject
[12272]23from waeup.ikoba.customers.interfaces import (
[12485]24    ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract,
25    validate_email)
[12273]26from waeup.ikoba.customers.vocabularies import (
[12485]27    ConCatProductSource, CustomerDocumentSource, nats_vocab)
28from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber
[12335]29from waeup.ikoba.products.productoptions import ProductOptionField
[12371]30from ikobacustom.pcn.interfaces import MessageFactory as _
[12485]31from ikobacustom.pcn.interfaces import LGASource
[12272]32
[12485]33def year_range():
34    curr_year = datetime.now().year
35    return range(curr_year - 2, curr_year + 5)
[12272]36
[12508]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
[12371]52class IPCNCustomer(ICustomer):
[12272]53    """Representation of a customer.
54
55    """
56
[12536]57    date_of_birth = FormattedDate(
58        title = _(u'Date of Birth'),
59        required = True,
60        show_year = True,
61        )
62
[12272]63# Customer document interfaces
64
65
[12384]66class IPCNCustomerJPGDocument(ICustomerDocument):
67    """A customer jpg document.
[12272]68
69    """
70
[12384]71class IPCNCustomerPDFDocument(ICustomerPDFDocument):
72    """A customer pdf document.
73
74    """
75
[12272]76# Customer contract interfaces
77
[12484]78class IRONContract(IContract):
[12499]79    """A Retention of Name contract.
[12272]80
81    """
82
[12485]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
[12508]128    categories_practice = schema.List(
129        title = _(u'Categories of Practice'),
130        value_type = schema.Choice(source=PracticeSource()),
[12485]131        required = False,
[12508]132        default = [],
[12485]133        )
134
135    superintendent = schema.Bool(
136        title= _('Superintendent'),
137        description= _('Tick box if you are a superintendent pharamcist.'),
138        required = False,
139        )
140
[12484]141    #document_object = schema.Choice(
142    #    title = _(u'Document'),
143    #    source = CustomerDocumentSource(),
144    #    required = False,
145    #    )
[12273]146
[12501]147class IRONContractOfficialUse(IIkobaObject):
[12508]148    """Interface for editing RON official use data.
[12501]149
150    """
151
152    comment = schema.Text(
153        title= _('Reason for rejection'),
154        required = False,
155        )
156
157
158class IRONContractProcess(IRONContract, IRONContractOfficialUse):
[12485]159    """Interface for processing RON data.
[12335]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
[12484]170class IRONContractEdit(IRONContract):
[12485]171    """Interface for editing RON data by customers.
[12273]172
173    """
174
[12484]175    #document_object = schema.Choice(
176    #    title = _(u'Document'),
177    #    source = CustomerDocumentSource(),
178    #    required = True,
179    #    )
[12499]180
181
182class IROPContract(IContract):
183    """A Registration of Premises contract.
184
185    """
186
[12501]187    premises_address = schema.Text(
188        title = _(u'Name and  Address of Pharmaceutical Premises'),
[12499]189        required = True,
190        )
191
[12508]192    categories_practice = schema.List(
193        title = _(u'Categories of Practice'),
194        value_type = schema.Choice(source=PracticeSource()),
[12499]195        required = False,
[12508]196        default = [],
[12499]197        )
198
[12501]199    premises_certificate = schema.TextLine(
200        title = _(u'Last Premises Certificate'),
[12508]201        description= _('If an old premises, state the last premises certificate number issued with date.'),
[12501]202        required = False,
[12499]203        )
204
[12501]205    date_of_qualification = FormattedDate(
206        title = _(u'Date of Qualification'),
207        required = False,
208        show_year = True,
[12499]209        )
210
211    res_address = schema.Text(
212        title = _(u'Residential Address'),
213        required = False,
214        )
215
[12501]216    last_license_number = schema.TextLine(
217        title = _(u'Last Annual License Number'),
[12499]218        required = False,
219        )
220
[12501]221    superintendent = schema.Bool(
222        title= _('Superintendent'),
223        description= _('Tick box if you were a superintendent pharamcist last year.'),
[12499]224        required = False,
225        )
226
[12501]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.'),
[12499]230        required = False,
231        )
232
[12501]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'),
[12499]236        required = False,
237        )
238
[12501]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'),
[12499]242        required = False,
243        )
244
245    #document_object = schema.Choice(
246    #    title = _(u'Document'),
247    #    source = CustomerDocumentSource(),
248    #    required = False,
249    #    )
250
[12501]251class IROPContractOfficialUse(IIkobaObject):
[12508]252    """Interface for editing ROP official use data.
[12501]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):
[12499]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.