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

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

'qualifications' must be a text field.

  • Property svn:keywords set to Id
File size: 10.7 KB
RevLine 
[12272]1## $Id: interfaces.py 12577 2015-02-10 09:39:55Z 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
[12571]32from ikobacustom.pcn.customers.schoolgrades import ResultEntryField
[12272]33
[12485]34def year_range():
35    curr_year = datetime.now().year
36    return range(curr_year - 2, curr_year + 5)
[12272]37
[12508]38class PracticeSource(BasicSourceFactory):
39    """A source for categories of practice.
40    """
41    def getValues(self):
42        return [
43            'academic',
44            'administrative',
45            'distribution',
46            'importation',
47            'manufacturing',
48            'retail and dispensing',
49            'wholesale',
50            ]
51
52
[12371]53class IPCNCustomer(ICustomer):
[12272]54    """Representation of a customer.
55
56    """
57
[12536]58    date_of_birth = FormattedDate(
59        title = _(u'Date of Birth'),
60        required = True,
61        show_year = True,
62        )
63
[12272]64# Customer document interfaces
65
66
[12384]67class IPCNCustomerJPGDocument(ICustomerDocument):
68    """A customer jpg document.
[12272]69
70    """
71
[12384]72class IPCNCustomerPDFDocument(ICustomerPDFDocument):
73    """A customer pdf document.
74
75    """
76
[12272]77# Customer contract interfaces
78
[12484]79class IRONContract(IContract):
[12499]80    """A Retention of Name contract.
[12272]81
82    """
83
[12485]84    state_of_origin = schema.Choice(
85        vocabulary = nats_vocab,
86        title = _(u'State of Origin'),
87        required = False,
88        )
89
90    lga = schema.Choice(
91        source = LGASource(),
92        title = _(u'State / LGA'),
93        required = True,
94        )
95
96    year_qualification = schema.Choice(
97        title = _(u'Year of Qualification'),
98        required = True,
99        values = year_range(),
100        )
101
102    res_address = schema.Text(
103        title = _(u'Residential Address'),
104        required = True,
105        )
106
107    work_address = schema.Text(
108        title = _(u'Work Address'),
109        required = False,
110        )
111
112    work_email = schema.ASCIILine(
113        title = _(u'Work Email Address'),
114        required = False,
115        constraint=validate_email,
116        )
117
118    work_phone = PhoneNumber(
119        title = _(u'Work Phone'),
120        description = u'',
121        required = False,
122        )
123
[12508]124    categories_practice = schema.List(
125        title = _(u'Categories of Practice'),
126        value_type = schema.Choice(source=PracticeSource()),
[12485]127        required = False,
[12508]128        default = [],
[12485]129        )
130
131    superintendent = schema.Bool(
132        title= _('Superintendent'),
133        description= _('Tick box if you are a superintendent pharamcist.'),
134        required = False,
135        )
136
[12484]137    #document_object = schema.Choice(
138    #    title = _(u'Document'),
139    #    source = CustomerDocumentSource(),
140    #    required = False,
141    #    )
[12273]142
[12501]143class IRONContractOfficialUse(IIkobaObject):
[12508]144    """Interface for editing RON official use data.
[12501]145
146    """
147
148    comment = schema.Text(
149        title= _('Reason for rejection'),
150        required = False,
151        )
152
153
154class IRONContractProcess(IRONContract, IRONContractOfficialUse):
[12485]155    """Interface for processing RON data.
[12335]156    """
157
158    product_options = schema.List(
159        title = _(u'Options/Fees'),
160        value_type = ProductOptionField(),
161        required = False,
162        readonly = False,
163        default = [],
164        )
165
[12484]166class IRONContractEdit(IRONContract):
[12485]167    """Interface for editing RON data by customers.
[12273]168
169    """
170
[12484]171    #document_object = schema.Choice(
172    #    title = _(u'Document'),
173    #    source = CustomerDocumentSource(),
174    #    required = True,
175    #    )
[12499]176
177
178class IROPContract(IContract):
179    """A Registration of Premises contract.
180
181    """
182
[12501]183    premises_address = schema.Text(
184        title = _(u'Name and  Address of Pharmaceutical Premises'),
[12499]185        required = True,
186        )
187
[12508]188    categories_practice = schema.List(
189        title = _(u'Categories of Practice'),
190        value_type = schema.Choice(source=PracticeSource()),
[12499]191        required = False,
[12508]192        default = [],
[12499]193        )
194
[12501]195    premises_certificate = schema.TextLine(
196        title = _(u'Last Premises Certificate'),
[12508]197        description= _('If an old premises, state the last premises certificate number issued with date.'),
[12501]198        required = False,
[12499]199        )
200
[12501]201    date_of_qualification = FormattedDate(
202        title = _(u'Date of Qualification'),
203        required = False,
204        show_year = True,
[12499]205        )
206
207    res_address = schema.Text(
208        title = _(u'Residential Address'),
209        required = False,
210        )
211
[12501]212    last_license_number = schema.TextLine(
213        title = _(u'Last Annual License Number'),
[12499]214        required = False,
215        )
216
[12501]217    superintendent = schema.Bool(
218        title= _('Superintendent'),
219        description= _('Tick box if you were a superintendent pharamcist last year.'),
[12499]220        required = False,
221        )
222
[12501]223    work_address = schema.Text(
224        title = _(u'Full Time Employment Address'),
225        description= _('Enter work address if you were not a superintendent pharamcist last year.'),
[12499]226        required = False,
227        )
228
[12501]229    pharmacists_directors= schema.TextLine(
230        title = _(u'Pharmacist Directors'),
231        description = _(u'Full name of directors and their profession as in Form C.O.7'),
[12499]232        required = False,
233        )
234
[12501]235    other_directors= schema.TextLine(
236        title = _(u'Other Directors'),
237        description = _(u'Full name of directors and their profession as in Form C.O.7'),
[12499]238        required = False,
239        )
240
241    #document_object = schema.Choice(
242    #    title = _(u'Document'),
243    #    source = CustomerDocumentSource(),
244    #    required = False,
245    #    )
246
[12501]247class IROPContractOfficialUse(IIkobaObject):
[12508]248    """Interface for editing ROP official use data.
[12501]249
250    """
251
252    inspected = schema.Bool(
253        title = _('Inspected'),
254        description = _('Has the premises been duly inspected?'),
255        required = False,
256        )
257
258    recommended = schema.Bool(
259        title = _('Recommended'),
260        description= _('Is the premises recommended?'),
261        required = False,
262        )
263
264    official_in_state = schema.TextLine(
265        title = _(u'Name of Official in the State'),
266        required = False,
267        )
268
269class IROPContractProcess(IROPContract, IROPContractOfficialUse):
[12499]270    """Interface for processing RON data.
271    """
272
273    product_options = schema.List(
274        title = _(u'Options/Fees'),
275        value_type = ProductOptionField(),
276        required = False,
277        readonly = False,
278        default = [],
279        )
280
281class IROPContractEdit(IROPContract):
282    """Interface for editing RON data by customers.
283
284    """
285
286    #document_object = schema.Choice(
287    #    title = _(u'Document'),
288    #    source = CustomerDocumentSource(),
289    #    required = True,
290    #    )
[12571]291
292class IRPRContract(IContract):
293    """A Registration in the Provisional Register contract.
294
295    """
296
297    state_of_origin = schema.Choice(
298        vocabulary = nats_vocab,
299        title = _(u'State of Origin'),
300        required = False,
301        )
302
303    res_address = schema.Text(
304        title = _(u'Residential Address'),
305        required = False,
306        )
307
[12572]308    pharmacies_addresses = schema.Text(
309        title = _(u'Pharmacies Attended'),
310        description = u'Enter the addresses of pharmacies and periods of attendance.',
311        required = False,
312        readonly = False,
313        )
314
[12577]315    qualifications = schema.Text(
[12571]316        title = _(u'Qualifications'),
[12577]317        description = u'Enter a list of certificates obtained.',
[12571]318        required = False,
[12577]319        readonly = False,
[12571]320        )
321
[12577]322    certificates_object = schema.Choice(
[12571]323        title = _(u'Certificates'),
[12577]324        description = u'Select the document which contains scanned copies '
325                      u'of your certificates. You must create such a '
326                      u'document first.',
[12571]327        source = CustomerDocumentSource(),
328        required = False,
329        )
330
331    referee1_name = schema.TextLine(
332        title = _(u'First Referee Name'),
333        required = False,
334        readonly = False,
335        )
336
337    referee1_address = schema.Text(
338        title = _(u'First Referee Address'),
339        required = False,
340        readonly = False,
341        )
342
343    referee1_license = schema.TextLine(
344        title = _(u'First Referee License Number'),
345        required = False,
346        readonly = False,
347        )
348
349    referee2_name = schema.TextLine(
350        title = _(u'Second Referee Name'),
351        required = False,
352        readonly = False,
353        )
354
355    referee2_address = schema.Text(
356        title = _(u'Second Referee Address'),
357        required = False,
358        readonly = False,
359        )
360
361    referee2_license = schema.TextLine(
362        title = _(u'Second Referee License Number'),
363        required = False,
364        readonly = False,
365        )
366
367    internship_address = schema.Text(
368        title = _(u'Internship'),
[12577]369        description = u'Enter name and address of company where you want to serve your internship.',
[12571]370        required = False,
371        readonly = False,
372        )
373
374
375
376class IRPRContractOfficialUse(IIkobaObject):
377    """Interface for editing RON official use data.
378
379    """
380
381    comment = schema.Text(
382        title= _('Reason for rejection'),
383        required = False,
384        )
385
386
387class IRPRContractProcess(IRPRContract, IRPRContractOfficialUse):
388    """Interface for processing RON data.
389    """
390
391    product_options = schema.List(
392        title = _(u'Options/Fees'),
393        value_type = ProductOptionField(),
394        required = False,
395        readonly = False,
396        default = [],
397        )
398
399class IRPRContractEdit(IRPRContract):
400    """Interface for editing RON data by customers.
401
402    """
403
404    certificates = schema.Choice(
405        title = _(u'Certificates'),
406        source = CustomerDocumentSource(),
407        required = True,
408        )
Note: See TracBrowser for help on using the repository browser.